diff --git a/.editorconfig b/.editorconfig index 30f209b0f6e..8df9e318396 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,44 +9,47 @@ tab_width = 4 ij_continuation_indent_size = 8 ij_formatter_off_tag = @formatter:off ij_formatter_on_tag = @formatter:on -ij_formatter_tags_enabled = false +ij_formatter_tags_enabled = true ij_smart_tabs = false ij_visual_guides = none ij_wrap_on_typing = false [*.java] +ij_smart_tabs = true ij_java_align_consecutive_assignments = false ij_java_align_consecutive_variable_declarations = false ij_java_align_group_field_declarations = false -ij_java_align_multiline_annotation_parameters = false +ij_java_align_multiline_annotation_parameters = true ij_java_align_multiline_array_initializer_expression = false ij_java_align_multiline_assignment = false ij_java_align_multiline_binary_operation = false ij_java_align_multiline_chained_methods = false -ij_java_align_multiline_extends_list = false -ij_java_align_multiline_for = true +ij_java_align_multiline_deconstruction_list_components = true +ij_java_align_multiline_extends_list = true +ij_java_align_multiline_for = false ij_java_align_multiline_method_parentheses = 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 -ij_java_align_multiline_resources = true +ij_java_align_multiline_resources = false ij_java_align_multiline_ternary_operation = false ij_java_align_multiline_text_blocks = false -ij_java_align_multiline_throws_list = false +ij_java_align_multiline_throws_list = true ij_java_align_subsequent_simple_methods = false ij_java_align_throws_keyword = false -ij_java_annotation_parameter_wrap = off +ij_java_align_types_in_multi_catch = true +ij_java_annotation_parameter_wrap = on_every_item 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 -ij_java_assert_statement_colon_on_next_line = false +ij_java_array_initializer_wrap = normal +ij_java_assert_statement_colon_on_next_line = true ij_java_assert_statement_wrap = off ij_java_assignment_wrap = off ij_java_binary_operation_sign_on_next_line = false -ij_java_binary_operation_wrap = off -ij_java_blank_lines_after_anonymous_class_header = 0 -ij_java_blank_lines_after_class_header = 0 +ij_java_binary_operation_wrap = normal +ij_java_blank_lines_after_anonymous_class_header = 1 +ij_java_blank_lines_after_class_header = 1 ij_java_blank_lines_after_imports = 1 ij_java_blank_lines_after_package = 1 ij_java_blank_lines_around_class = 1 @@ -55,32 +58,35 @@ ij_java_blank_lines_around_field_in_interface = 0 ij_java_blank_lines_around_initializer = 1 ij_java_blank_lines_around_method = 1 ij_java_blank_lines_around_method_in_interface = 1 -ij_java_blank_lines_before_class_end = 0 +ij_java_blank_lines_before_class_end = 1 ij_java_blank_lines_before_imports = 1 -ij_java_blank_lines_before_method_body = 0 -ij_java_blank_lines_before_package = 0 +ij_java_blank_lines_before_method_body = 1 +ij_java_blank_lines_before_package = 1 ij_java_block_brace_style = end_of_line +ij_java_block_comment_add_space = false ij_java_block_comment_at_first_column = true ij_java_builder_methods = none ij_java_call_parameters_new_line_after_left_paren = false ij_java_call_parameters_right_paren_on_new_line = false -ij_java_call_parameters_wrap = off -ij_java_case_statement_on_separate_line = false +ij_java_call_parameters_wrap = normal +ij_java_case_statement_on_separate_line = true ij_java_catch_on_new_line = false ij_java_class_annotation_wrap = split_into_lines ij_java_class_brace_style = end_of_line ij_java_class_count_to_use_import_on_demand = 5 ij_java_class_names_in_javadoc = 1 +ij_java_deconstruction_list_wrap = normal ij_java_do_not_indent_top_level_class_members = false ij_java_do_not_wrap_after_single_annotation = false +ij_java_do_not_wrap_after_single_annotation_in_parameter = false ij_java_do_while_brace_force = never ij_java_doc_add_blank_line_after_description = true ij_java_doc_add_blank_line_after_param_comments = false ij_java_doc_add_blank_line_after_return = false -ij_java_doc_add_p_tag_on_empty_lines = true +ij_java_doc_add_p_tag_on_empty_lines = false ij_java_doc_align_exception_comments = true ij_java_doc_align_param_comments = true -ij_java_doc_do_not_wrap_if_one_line = false +ij_java_doc_do_not_wrap_if_one_line = true ij_java_doc_enable_formatting = true ij_java_doc_enable_leading_asterisks = true ij_java_doc_indent_on_continuation = false @@ -93,9 +99,9 @@ ij_java_doc_param_description_on_new_line = false ij_java_doc_preserve_line_breaks = false ij_java_doc_use_throws_not_exception_tag = true ij_java_else_on_new_line = false -ij_java_enum_constants_wrap = off -ij_java_extends_keyword_wrap = off -ij_java_extends_list_wrap = off +ij_java_enum_constants_wrap = split_into_lines +ij_java_extends_keyword_wrap = normal +ij_java_extends_list_wrap = normal ij_java_field_annotation_wrap = split_into_lines ij_java_finally_on_new_line = false ij_java_for_brace_force = never @@ -105,21 +111,21 @@ 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 -ij_java_keep_blank_lines_before_right_brace = 2 -ij_java_keep_blank_lines_between_package_declaration_and_header = 2 -ij_java_keep_blank_lines_in_code = 2 -ij_java_keep_blank_lines_in_declarations = 2 +ij_java_keep_blank_lines_before_right_brace = 1 +ij_java_keep_blank_lines_between_package_declaration_and_header = 1 +ij_java_keep_blank_lines_in_code = 1 +ij_java_keep_blank_lines_in_declarations = 1 ij_java_keep_builder_methods_indents = false ij_java_keep_control_statement_in_one_line = true -ij_java_keep_first_column_comment = true +ij_java_keep_first_column_comment = false ij_java_keep_indents_on_empty_lines = false ij_java_keep_line_breaks = true ij_java_keep_multiple_expressions_in_one_line = false -ij_java_keep_simple_blocks_in_one_line = true +ij_java_keep_simple_blocks_in_one_line = false ij_java_keep_simple_classes_in_one_line = true ij_java_keep_simple_lambdas_in_one_line = true ij_java_keep_simple_methods_in_one_line = true @@ -128,17 +134,21 @@ ij_java_label_indent_size = 0 ij_java_lambda_brace_style = end_of_line ij_java_layout_static_imports_separately = true ij_java_line_comment_add_space = false +ij_java_line_comment_add_space_on_reformat = false ij_java_line_comment_at_first_column = true ij_java_method_annotation_wrap = split_into_lines ij_java_method_brace_style = end_of_line -ij_java_method_call_chain_wrap = off +ij_java_method_call_chain_wrap = normal ij_java_method_parameters_new_line_after_left_paren = false ij_java_method_parameters_right_paren_on_new_line = false -ij_java_method_parameters_wrap = off +ij_java_method_parameters_wrap = normal ij_java_modifier_list_wrap = false +ij_java_multi_catch_types_wrap = normal ij_java_names_count_to_use_import_on_demand = 3 +ij_java_new_line_after_lparen_in_annotation = false +ij_java_new_line_after_lparen_in_deconstruction_pattern = true ij_java_new_line_after_lparen_in_record_header = false -ij_java_packages_to_use_import_on_demand = java.awt.*, javax.swing.* +ij_java_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 @@ -152,7 +162,9 @@ ij_java_replace_null_check = true ij_java_replace_sum_lambda_with_method_ref = true ij_java_resource_list_new_line_after_left_paren = false ij_java_resource_list_right_paren_on_new_line = false -ij_java_resource_list_wrap = off +ij_java_resource_list_wrap = on_every_item +ij_java_rparen_on_new_line_in_annotation = false +ij_java_rparen_on_new_line_in_deconstruction_pattern = true ij_java_rparen_on_new_line_in_record_header = false ij_java_space_after_closing_angle_bracket_in_type_argument = false ij_java_space_after_colon = true @@ -163,7 +175,7 @@ ij_java_space_after_quest = true ij_java_space_after_type_cast = true ij_java_space_before_annotation_array_initializer_left_brace = false ij_java_space_before_annotation_parameter_list = false -ij_java_space_before_array_initializer_left_brace = false +ij_java_space_before_array_initializer_left_brace = true ij_java_space_before_catch_keyword = true ij_java_space_before_catch_left_brace = true ij_java_space_before_catch_parentheses = true @@ -171,6 +183,7 @@ ij_java_space_before_class_left_brace = true ij_java_space_before_colon = true ij_java_space_before_colon_in_foreach = true ij_java_space_before_comma = false +ij_java_space_before_deconstruction_list = false ij_java_space_before_do_left_brace = true ij_java_space_before_else_keyword = true ij_java_space_before_else_left_brace = true @@ -201,6 +214,7 @@ ij_java_space_within_empty_array_initializer_braces = false ij_java_space_within_empty_method_call_parentheses = false ij_java_space_within_empty_method_parentheses = false ij_java_spaces_around_additive_operators = true +ij_java_spaces_around_annotation_eq = true ij_java_spaces_around_assignment_operators = true ij_java_spaces_around_bitwise_operators = true ij_java_spaces_around_equality_operators = true @@ -214,11 +228,12 @@ ij_java_spaces_around_type_bounds_in_type_parameters = true ij_java_spaces_around_unary_operator = false ij_java_spaces_within_angle_brackets = false ij_java_spaces_within_annotation_parentheses = false -ij_java_spaces_within_array_initializer_braces = false +ij_java_spaces_within_array_initializer_braces = true ij_java_spaces_within_braces = false ij_java_spaces_within_brackets = false ij_java_spaces_within_cast_parentheses = false ij_java_spaces_within_catch_parentheses = false +ij_java_spaces_within_deconstruction_list = false ij_java_spaces_within_for_parentheses = false ij_java_spaces_within_if_parentheses = false ij_java_spaces_within_method_call_parentheses = false @@ -232,22 +247,40 @@ ij_java_spaces_within_while_parentheses = false ij_java_special_else_if_treatment = true ij_java_subclass_name_suffix = Impl ij_java_ternary_operation_signs_on_next_line = false -ij_java_ternary_operation_wrap = off +ij_java_ternary_operation_wrap = normal ij_java_test_name_suffix = Test -ij_java_throws_keyword_wrap = off -ij_java_throws_list_wrap = off +ij_java_throws_keyword_wrap = normal +ij_java_throws_list_wrap = normal ij_java_use_external_annotations = false ij_java_use_fq_class_names = false ij_java_use_relative_indents = false ij_java_use_single_class_imports = true -ij_java_variable_annotation_wrap = off +ij_java_variable_annotation_wrap = split_into_lines 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_comments = true ij_java_wrap_first_method_in_call_chain = false ij_java_wrap_long_lines = false +[*.nbtt] +indent_style = tab +max_line_length = 150 +ij_continuation_indent_size = 4 +ij_nbtt_keep_indents_on_empty_lines = false +ij_nbtt_space_after_colon = true +ij_nbtt_space_after_comma = true +ij_nbtt_space_before_colon = true +ij_nbtt_space_before_comma = false +ij_nbtt_spaces_within_brackets = false +ij_nbtt_spaces_within_parentheses = false + +[*.properties] +ij_properties_align_group_field_declarations = false +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = false + [.editorconfig] ij_editorconfig_align_group_field_declarations = false ij_editorconfig_space_after_colon = false @@ -256,31 +289,375 @@ ij_editorconfig_space_before_colon = false ij_editorconfig_space_before_comma = false ij_editorconfig_spaces_around_assignment_operators = true -[{*.har,*.ire-wood,*.json,mcmod.info,*.mcmeta}] +[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.jspx,*.pom,*.rng,*.tagx,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul}] +ij_xml_align_attributes = true +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +ij_xml_block_comment_add_space = false +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = true +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = false +ij_xml_text_wrap = normal + +[{*.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 +ij_shell_use_unix_line_separator = true + +[{*.gant,*.groovy,*.gy}] +ij_groovy_align_group_field_declarations = false +ij_groovy_align_multiline_array_initializer_expression = false +ij_groovy_align_multiline_assignment = false +ij_groovy_align_multiline_binary_operation = false +ij_groovy_align_multiline_chained_methods = false +ij_groovy_align_multiline_extends_list = false +ij_groovy_align_multiline_for = true +ij_groovy_align_multiline_list_or_map = true +ij_groovy_align_multiline_method_parentheses = false +ij_groovy_align_multiline_parameters = true +ij_groovy_align_multiline_parameters_in_calls = false +ij_groovy_align_multiline_resources = true +ij_groovy_align_multiline_ternary_operation = false +ij_groovy_align_multiline_throws_list = false +ij_groovy_align_named_args_in_map = true +ij_groovy_align_throws_keyword = false +ij_groovy_array_initializer_new_line_after_left_brace = false +ij_groovy_array_initializer_right_brace_on_new_line = false +ij_groovy_array_initializer_wrap = off +ij_groovy_assert_statement_wrap = off +ij_groovy_assignment_wrap = off +ij_groovy_binary_operation_wrap = off +ij_groovy_blank_lines_after_class_header = 0 +ij_groovy_blank_lines_after_imports = 1 +ij_groovy_blank_lines_after_package = 1 +ij_groovy_blank_lines_around_class = 1 +ij_groovy_blank_lines_around_field = 0 +ij_groovy_blank_lines_around_field_in_interface = 0 +ij_groovy_blank_lines_around_method = 1 +ij_groovy_blank_lines_around_method_in_interface = 1 +ij_groovy_blank_lines_before_imports = 1 +ij_groovy_blank_lines_before_method_body = 0 +ij_groovy_blank_lines_before_package = 0 +ij_groovy_block_brace_style = end_of_line +ij_groovy_block_comment_add_space = false +ij_groovy_block_comment_at_first_column = true +ij_groovy_call_parameters_new_line_after_left_paren = false +ij_groovy_call_parameters_right_paren_on_new_line = false +ij_groovy_call_parameters_wrap = off +ij_groovy_catch_on_new_line = false +ij_groovy_class_annotation_wrap = split_into_lines +ij_groovy_class_brace_style = end_of_line +ij_groovy_class_count_to_use_import_on_demand = 5 +ij_groovy_do_while_brace_force = never +ij_groovy_else_on_new_line = false +ij_groovy_enable_groovydoc_formatting = true +ij_groovy_enum_constants_wrap = off +ij_groovy_extends_keyword_wrap = off +ij_groovy_extends_list_wrap = off +ij_groovy_field_annotation_wrap = split_into_lines +ij_groovy_finally_on_new_line = false +ij_groovy_for_brace_force = never +ij_groovy_for_statement_new_line_after_left_paren = false +ij_groovy_for_statement_right_paren_on_new_line = false +ij_groovy_for_statement_wrap = off +ij_groovy_ginq_general_clause_wrap_policy = 2 +ij_groovy_ginq_having_wrap_policy = 1 +ij_groovy_ginq_indent_having_clause = true +ij_groovy_ginq_indent_on_clause = true +ij_groovy_ginq_on_wrap_policy = 1 +ij_groovy_ginq_space_after_keyword = true +ij_groovy_if_brace_force = never +ij_groovy_import_annotation_wrap = 2 +ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_indent_case_from_switch = true +ij_groovy_indent_label_blocks = true +ij_groovy_insert_inner_class_imports = false +ij_groovy_keep_blank_lines_before_right_brace = 2 +ij_groovy_keep_blank_lines_in_code = 2 +ij_groovy_keep_blank_lines_in_declarations = 2 +ij_groovy_keep_control_statement_in_one_line = true +ij_groovy_keep_first_column_comment = true +ij_groovy_keep_indents_on_empty_lines = false +ij_groovy_keep_line_breaks = true +ij_groovy_keep_multiple_expressions_in_one_line = false +ij_groovy_keep_simple_blocks_in_one_line = false +ij_groovy_keep_simple_classes_in_one_line = true +ij_groovy_keep_simple_lambdas_in_one_line = true +ij_groovy_keep_simple_methods_in_one_line = true +ij_groovy_label_indent_absolute = false +ij_groovy_label_indent_size = 0 +ij_groovy_lambda_brace_style = end_of_line +ij_groovy_layout_static_imports_separately = true +ij_groovy_line_comment_add_space = false +ij_groovy_line_comment_add_space_on_reformat = false +ij_groovy_line_comment_at_first_column = true +ij_groovy_method_annotation_wrap = split_into_lines +ij_groovy_method_brace_style = end_of_line +ij_groovy_method_call_chain_wrap = off +ij_groovy_method_parameters_new_line_after_left_paren = false +ij_groovy_method_parameters_right_paren_on_new_line = false +ij_groovy_method_parameters_wrap = off +ij_groovy_modifier_list_wrap = false +ij_groovy_names_count_to_use_import_on_demand = 3 +ij_groovy_packages_to_use_import_on_demand = java.awt.*,javax.swing.* +ij_groovy_parameter_annotation_wrap = off +ij_groovy_parentheses_expression_new_line_after_left_paren = false +ij_groovy_parentheses_expression_right_paren_on_new_line = false +ij_groovy_prefer_parameters_wrap = false +ij_groovy_resource_list_new_line_after_left_paren = false +ij_groovy_resource_list_right_paren_on_new_line = false +ij_groovy_resource_list_wrap = off +ij_groovy_space_after_assert_separator = true +ij_groovy_space_after_colon = true +ij_groovy_space_after_comma = true +ij_groovy_space_after_comma_in_type_arguments = true +ij_groovy_space_after_for_semicolon = true +ij_groovy_space_after_quest = true +ij_groovy_space_after_type_cast = true +ij_groovy_space_before_annotation_parameter_list = false +ij_groovy_space_before_array_initializer_left_brace = false +ij_groovy_space_before_assert_separator = false +ij_groovy_space_before_catch_keyword = true +ij_groovy_space_before_catch_left_brace = true +ij_groovy_space_before_catch_parentheses = true +ij_groovy_space_before_class_left_brace = true +ij_groovy_space_before_closure_left_brace = true +ij_groovy_space_before_colon = true +ij_groovy_space_before_comma = false +ij_groovy_space_before_do_left_brace = true +ij_groovy_space_before_else_keyword = true +ij_groovy_space_before_else_left_brace = true +ij_groovy_space_before_finally_keyword = true +ij_groovy_space_before_finally_left_brace = true +ij_groovy_space_before_for_left_brace = true +ij_groovy_space_before_for_parentheses = true +ij_groovy_space_before_for_semicolon = false +ij_groovy_space_before_if_left_brace = true +ij_groovy_space_before_if_parentheses = true +ij_groovy_space_before_method_call_parentheses = false +ij_groovy_space_before_method_left_brace = true +ij_groovy_space_before_method_parentheses = false +ij_groovy_space_before_quest = true +ij_groovy_space_before_record_parentheses = false +ij_groovy_space_before_switch_left_brace = true +ij_groovy_space_before_switch_parentheses = true +ij_groovy_space_before_synchronized_left_brace = true +ij_groovy_space_before_synchronized_parentheses = true +ij_groovy_space_before_try_left_brace = true +ij_groovy_space_before_try_parentheses = true +ij_groovy_space_before_while_keyword = true +ij_groovy_space_before_while_left_brace = true +ij_groovy_space_before_while_parentheses = true +ij_groovy_space_in_named_argument = true +ij_groovy_space_in_named_argument_before_colon = false +ij_groovy_space_within_empty_array_initializer_braces = false +ij_groovy_space_within_empty_method_call_parentheses = false +ij_groovy_spaces_around_additive_operators = true +ij_groovy_spaces_around_assignment_operators = true +ij_groovy_spaces_around_bitwise_operators = true +ij_groovy_spaces_around_equality_operators = true +ij_groovy_spaces_around_lambda_arrow = true +ij_groovy_spaces_around_logical_operators = true +ij_groovy_spaces_around_multiplicative_operators = true +ij_groovy_spaces_around_regex_operators = true +ij_groovy_spaces_around_relational_operators = true +ij_groovy_spaces_around_shift_operators = true +ij_groovy_spaces_within_annotation_parentheses = false +ij_groovy_spaces_within_array_initializer_braces = false +ij_groovy_spaces_within_braces = true +ij_groovy_spaces_within_brackets = false +ij_groovy_spaces_within_cast_parentheses = false +ij_groovy_spaces_within_catch_parentheses = false +ij_groovy_spaces_within_for_parentheses = false +ij_groovy_spaces_within_gstring_injection_braces = false +ij_groovy_spaces_within_if_parentheses = false +ij_groovy_spaces_within_list_or_map = false +ij_groovy_spaces_within_method_call_parentheses = false +ij_groovy_spaces_within_method_parentheses = false +ij_groovy_spaces_within_parentheses = false +ij_groovy_spaces_within_switch_parentheses = false +ij_groovy_spaces_within_synchronized_parentheses = false +ij_groovy_spaces_within_try_parentheses = false +ij_groovy_spaces_within_tuple_expression = false +ij_groovy_spaces_within_while_parentheses = false +ij_groovy_special_else_if_treatment = true +ij_groovy_ternary_operation_wrap = off +ij_groovy_throws_keyword_wrap = off +ij_groovy_throws_list_wrap = off +ij_groovy_use_flying_geese_braces = false +ij_groovy_use_fq_class_names = false +ij_groovy_use_fq_class_names_in_javadoc = true +ij_groovy_use_relative_indents = false +ij_groovy_use_single_class_imports = true +ij_groovy_variable_annotation_wrap = off +ij_groovy_while_brace_force = never +ij_groovy_while_on_new_line = false +ij_groovy_wrap_chain_calls_after_dot = false +ij_groovy_wrap_long_lines = false + +[{*.gradle.kts,*.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_add_space = false +ij_kotlin_block_comment_at_first_column = true +ij_kotlin_call_parameters_new_line_after_left_paren = false +ij_kotlin_call_parameters_right_paren_on_new_line = false +ij_kotlin_call_parameters_wrap = off +ij_kotlin_catch_on_new_line = false +ij_kotlin_class_annotation_wrap = split_into_lines +ij_kotlin_continuation_indent_for_chained_calls = true +ij_kotlin_continuation_indent_for_expression_bodies = true +ij_kotlin_continuation_indent_in_argument_lists = true +ij_kotlin_continuation_indent_in_elvis = true +ij_kotlin_continuation_indent_in_if_conditions = true +ij_kotlin_continuation_indent_in_parameter_lists = true +ij_kotlin_continuation_indent_in_supertype_lists = true +ij_kotlin_else_on_new_line = false +ij_kotlin_enum_constants_wrap = off +ij_kotlin_extends_list_wrap = off +ij_kotlin_field_annotation_wrap = split_into_lines +ij_kotlin_finally_on_new_line = false +ij_kotlin_if_rparen_on_new_line = false +ij_kotlin_import_nested_classes = false +ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_insert_whitespaces_in_simple_one_line_method = true +ij_kotlin_keep_blank_lines_before_right_brace = 2 +ij_kotlin_keep_blank_lines_in_code = 2 +ij_kotlin_keep_blank_lines_in_declarations = 2 +ij_kotlin_keep_first_column_comment = true +ij_kotlin_keep_indents_on_empty_lines = false +ij_kotlin_keep_line_breaks = true +ij_kotlin_lbrace_on_next_line = false +ij_kotlin_line_break_after_multiline_when_entry = true +ij_kotlin_line_comment_add_space = false +ij_kotlin_line_comment_add_space_on_reformat = false +ij_kotlin_line_comment_at_first_column = true +ij_kotlin_method_annotation_wrap = split_into_lines +ij_kotlin_method_call_chain_wrap = off +ij_kotlin_method_parameters_new_line_after_left_paren = false +ij_kotlin_method_parameters_right_paren_on_new_line = false +ij_kotlin_method_parameters_wrap = off +ij_kotlin_name_count_to_use_star_import = 5 +ij_kotlin_name_count_to_use_star_import_for_members = 3 +ij_kotlin_packages_to_use_import_on_demand = java.util.*,kotlinx.android.synthetic.**,io.ktor.** +ij_kotlin_parameter_annotation_wrap = off +ij_kotlin_space_after_comma = true +ij_kotlin_space_after_extend_colon = true +ij_kotlin_space_after_type_colon = true +ij_kotlin_space_before_catch_parentheses = true +ij_kotlin_space_before_comma = false +ij_kotlin_space_before_extend_colon = true +ij_kotlin_space_before_for_parentheses = true +ij_kotlin_space_before_if_parentheses = true +ij_kotlin_space_before_lambda_arrow = true +ij_kotlin_space_before_type_colon = false +ij_kotlin_space_before_when_parentheses = true +ij_kotlin_space_before_while_parentheses = true +ij_kotlin_spaces_around_additive_operators = true +ij_kotlin_spaces_around_assignment_operators = true +ij_kotlin_spaces_around_equality_operators = true +ij_kotlin_spaces_around_function_type_arrow = true +ij_kotlin_spaces_around_logical_operators = true +ij_kotlin_spaces_around_multiplicative_operators = true +ij_kotlin_spaces_around_range = false +ij_kotlin_spaces_around_relational_operators = true +ij_kotlin_spaces_around_unary_operator = false +ij_kotlin_spaces_around_when_arrow = true +ij_kotlin_variable_annotation_wrap = off +ij_kotlin_while_on_new_line = false +ij_kotlin_wrap_elvis_expressions = 1 +ij_kotlin_wrap_expression_body_functions = 0 +ij_kotlin_wrap_first_method_in_call_chain = false + +[{*.har,*.json,mcmod.info,pack.mcmeta}] +indent_size = 2 +ij_json_array_wrapping = split_into_lines ij_json_keep_blank_lines_in_code = 0 ij_json_keep_indents_on_empty_lines = false ij_json_keep_line_breaks = true +ij_json_keep_trailing_comma = false +ij_json_object_wrapping = split_into_lines +ij_json_property_alignment = do_not_align ij_json_space_after_colon = true ij_json_space_after_comma = true -ij_json_space_before_colon = true +ij_json_space_before_colon = false ij_json_space_before_comma = false ij_json_spaces_within_braces = false ij_json_spaces_within_brackets = false ij_json_wrap_long_lines = false +[{*.htm,*.html,*.sht,*.shtm,*.shtml}] +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_add_space = false +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal + [{*.markdown,*.md}] ij_markdown_force_one_space_after_blockquote_symbol = true ij_markdown_force_one_space_after_header_symbol = true ij_markdown_force_one_space_after_list_bullet = true ij_markdown_force_one_space_between_words = true +ij_markdown_format_tables = true +ij_markdown_insert_quote_arrows_on_wrap = true ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_keep_line_breaks_inside_text_blocks = true ij_markdown_max_lines_around_block_elements = 1 ij_markdown_max_lines_around_header = 1 ij_markdown_max_lines_between_paragraphs = 1 ij_markdown_min_lines_around_block_elements = 1 ij_markdown_min_lines_around_header = 1 ij_markdown_min_lines_between_paragraphs = 1 +ij_markdown_wrap_text_if_long = true +ij_markdown_wrap_text_inside_blockquotes = true + +[{*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,poetry.lock}] +ij_toml_keep_indents_on_empty_lines = false [{*.yaml,*.yml}] indent_size = 2 diff --git a/.github/workflows/pr_testing.yml b/.github/workflows/pr_testing.yml index feb93b4f317..7761d2a8555 100644 --- a/.github/workflows/pr_testing.yml +++ b/.github/workflows/pr_testing.yml @@ -35,3 +35,26 @@ jobs: jdks notifications wrapper + + Formatting: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '17' + + - name: Run Spotless + uses: gradle/gradle-build-action@v2 + with: + arguments: 'spotlessCheck --build-cache' + gradle-home-cache-includes: | + caches + jdks + notifications + wrapper diff --git a/gradle.properties b/gradle.properties index f8e10a2589d..ab47d3bdb1d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -135,7 +135,7 @@ noPublishedSources = false # By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless # to format your code. However, you can create your own version of these files and place them in your project's # root directory to apply your own formatting options instead. -enableSpotless = false +enableSpotless = true # Enable JUnit testing platform used for testing your code. # Uses JUnit 5. See guide and documentation here: https://junit.org/junit5/docs/current/user-guide/ diff --git a/spotless.importorder b/spotless.importorder new file mode 100644 index 00000000000..b85a5670f76 --- /dev/null +++ b/spotless.importorder @@ -0,0 +1,9 @@ +#Organize Import Order +#Sat May 27 02:13:47 CDT 2023 +0=gregtech +1=net +2=codechickenlib +2= +3=java +4=javax +5=\# diff --git a/src/main/java/gregtech/GregTechMod.java b/src/main/java/gregtech/GregTechMod.java index b481b0618a3..1cb973f18ee 100644 --- a/src/main/java/gregtech/GregTechMod.java +++ b/src/main/java/gregtech/GregTechMod.java @@ -8,6 +8,7 @@ import gregtech.common.covers.filter.oreglob.impl.OreGlobParser; import gregtech.modules.GregTechModules; import gregtech.modules.ModuleManager; + import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -17,22 +18,13 @@ import net.minecraftforge.fml.common.event.*; @Mod(modid = GTValues.MODID, - name = "GregTech", - acceptedMinecraftVersions = "[1.12.2,1.13)", - version = GTInternalTags.VERSION, - dependencies = "required:forge@[14.23.5.2847,);" - + "required-after:codechickenlib@[3.2.3,);" - + "after:appliedenergistics2;" - + "after:forestry;" - + "after:extrabees;" - + "after:extratrees;" - + "after:genetics;" - + "after:magicbees;" - + "after:jei@[4.15.0,);" - + "after:crafttweaker@[4.1.20,);" - + "after:groovyscript@[0.6.0,);" - + "after:theoneprobe;" - + "after:hwyla;") + name = "GregTech", + acceptedMinecraftVersions = "[1.12.2,1.13)", + version = GTInternalTags.VERSION, + dependencies = "required:forge@[14.23.5.2847,);" + "required-after:codechickenlib@[3.2.3,);" + + "after:appliedenergistics2;" + "after:forestry;" + "after:extrabees;" + "after:extratrees;" + + "after:genetics;" + "after:magicbees;" + "after:jei@[4.15.0,);" + "after:crafttweaker@[4.1.20,);" + + "after:groovyscript@[0.6.0,);" + "after:theoneprobe;" + "after:hwyla;") public class GregTechMod { // Hold this so that we can reference non-interface methods without diff --git a/src/main/java/gregtech/api/GTValues.java b/src/main/java/gregtech/api/GTValues.java index e19c0044128..fa0f424854a 100644 --- a/src/main/java/gregtech/api/GTValues.java +++ b/src/main/java/gregtech/api/GTValues.java @@ -2,6 +2,7 @@ import gregtech.api.util.XSTR; import gregtech.common.ConfigHolder; + import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.FMLLaunchHandler; import net.minecraftforge.oredict.OreDictionary; @@ -50,22 +51,26 @@ public class GTValues { /** * The Voltage Tiers. Use this Array instead of the old named Voltage Variables */ - public static final long[] V = {8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432, 134217728, 536870912, Integer.MAX_VALUE}; + public static final long[] V = { 8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432, + 134217728, 536870912, Integer.MAX_VALUE }; /** * The Voltage Tiers divided by 2. */ - public static final int[] VH = {4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, 67108864, 268435456, 1073741824}; + public static final int[] VH = { 4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, + 67108864, 268435456, 1073741824 }; /** * The Voltage Tiers adjusted for cable loss. Use this for recipe EU/t to avoid full-amp recipes */ - public static final int[] VA = {7, 30, 120, 480, 1920, 7680, 30720, 122880, 491520, 1966080, 7864320, 31457280, 125829120, 503316480, 2013265920}; + public static final int[] VA = { 7, 30, 120, 480, 1920, 7680, 30720, 122880, 491520, 1966080, 7864320, 31457280, + 125829120, 503316480, 2013265920 }; /** * The Voltage Tiers adjusted for cable loss, divided by 2. */ - public static final int[] VHA = {7, 16, 60, 240, 960, 3840, 15360, 61440, 245760, 983040, 3932160, 15728640, 62914560, 251658240, 1006632960}; + public static final int[] VHA = { 7, 16, 60, 240, 960, 3840, 15360, 61440, 245760, 983040, 3932160, 15728640, + 62914560, 251658240, 1006632960 }; public static final int ULV = 0; public static final int LV = 1; @@ -87,28 +92,32 @@ public class GTValues { /** * The short names for the voltages, used for registration primarily */ - public static final String[] VN = new String[]{"ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV", "UEV", "UIV", "UXV", "OpV", "MAX"}; + public static final String[] VN = new String[] { "ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV", + "UEV", "UIV", "UXV", "OpV", "MAX" }; /** * The short names for the voltages, formatted for text */ - public static final String[] VNF = new String[]{ + public static final String[] VNF = new String[] { DARK_GRAY + "ULV", GRAY + "LV", AQUA + "MV", GOLD + "HV", DARK_PURPLE + "EV", DARK_BLUE + "IV", LIGHT_PURPLE + "LuV", RED + "ZPM", DARK_AQUA + "UV", DARK_RED + "UHV", GREEN + "UEV", DARK_GREEN + "UIV", - YELLOW + "UXV", BLUE + "OpV", RED.toString() + BOLD + "MAX"}; + YELLOW + "UXV", BLUE + "OpV", RED.toString() + BOLD + "MAX" }; /** * Color values for the voltages */ - public static final int[] VC = new int[]{0xC80000, 0xDCDCDC, 0xFF6400, 0xFFFF1E, 0x808080, 0xF0F0F5, 0xE99797, 0x7EC3C4, 0x7EB07E, 0xBF74C0, 0x0B5CFE, 0x914E91, 0x488748, 0x8C0000, 0x2828F5}; + public static final int[] VC = new int[] { 0xC80000, 0xDCDCDC, 0xFF6400, 0xFFFF1E, 0x808080, 0xF0F0F5, 0xE99797, + 0x7EC3C4, 0x7EB07E, 0xBF74C0, 0x0B5CFE, 0x914E91, 0x488748, 0x8C0000, 0x2828F5 }; /** * The long names for the voltages */ - public static final String[] VOLTAGE_NAMES = new String[]{"Ultra Low Voltage", "Low Voltage", "Medium Voltage", "High Voltage", "Extreme Voltage", "Insane Voltage", "Ludicrous Voltage", "ZPM Voltage", "Ultimate Voltage", - "Ultra High Voltage", "Ultra Excessive Voltage", "Ultra Immense Voltage", "Ultra Extreme Voltage", "Overpowered Voltage", "Maximum Voltage"}; + public static final String[] VOLTAGE_NAMES = new String[] { "Ultra Low Voltage", "Low Voltage", "Medium Voltage", + "High Voltage", "Extreme Voltage", "Insane Voltage", "Ludicrous Voltage", "ZPM Voltage", "Ultimate Voltage", + "Ultra High Voltage", "Ultra Excessive Voltage", "Ultra Immense Voltage", "Ultra Extreme Voltage", + "Overpowered Voltage", "Maximum Voltage" }; /** * ModID strings, since they are quite common parameters @@ -175,6 +184,7 @@ public static boolean isDeobfEnvironment() { public static Supplier XMAS = () -> { String[] yearMonthDay = LocalDate.now().toString().split("-"); - return ConfigHolder.misc.specialEvents && yearMonthDay[1].equals("12") && (yearMonthDay[2].equals("24") || yearMonthDay[2].equals("25")); + return ConfigHolder.misc.specialEvents && yearMonthDay[1].equals("12") && + (yearMonthDay[2].equals("24") || yearMonthDay[2].equals("25")); }; } diff --git a/src/main/java/gregtech/api/GregTechAPI.java b/src/main/java/gregtech/api/GregTechAPI.java index 3c1f5a200dd..14188ff6bfa 100644 --- a/src/main/java/gregtech/api/GregTechAPI.java +++ b/src/main/java/gregtech/api/GregTechAPI.java @@ -29,14 +29,16 @@ import gregtech.common.items.MetaItems; import gregtech.common.items.ToolItems; import gregtech.common.metatileentities.MetaTileEntities; -import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.eventhandler.GenericEvent; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.HashMap; import java.util.Map; @@ -63,31 +65,34 @@ public class GregTechAPI { private static boolean highTier; private static boolean highTierInitialized; - public static final GTControlledRegistry MTE_REGISTRY = new GTControlledRegistry<>(Short.MAX_VALUE); - public static final GTControlledRegistry UI_FACTORY_REGISTRY = new GTControlledRegistry<>(Short.MAX_VALUE); - public static final GTControlledRegistry COVER_REGISTRY = new GTControlledRegistry<>(Integer.MAX_VALUE); + public static final GTControlledRegistry MTE_REGISTRY = new GTControlledRegistry<>( + Short.MAX_VALUE); + public static final GTControlledRegistry UI_FACTORY_REGISTRY = new GTControlledRegistry<>( + Short.MAX_VALUE); + public static final GTControlledRegistry COVER_REGISTRY = new GTControlledRegistry<>( + Integer.MAX_VALUE); public static BlockMachine MACHINE; public static final Map> oreBlockTable = new HashMap<>(); public static final Object2ObjectMap HEATING_COILS = new Object2ObjectOpenHashMap<>(); public static final Object2ObjectMap PSS_BATTERIES = new Object2ObjectOpenHashMap<>(); - public static final BaseCreativeTab TAB_GREGTECH = - new BaseCreativeTab(GTValues.MODID + ".main", () -> MetaItems.LOGO.getStackForm(), true); - public static final BaseCreativeTab TAB_GREGTECH_MACHINES = - new BaseCreativeTab(GTValues.MODID + ".machines", () -> MetaTileEntities.ELECTRIC_BLAST_FURNACE.getStackForm(), true); - public static final BaseCreativeTab TAB_GREGTECH_CABLES = - new BaseCreativeTab(GTValues.MODID + ".cables", () -> OreDictUnifier.get(OrePrefix.cableGtDouble, Materials.Aluminium), true); - public static final BaseCreativeTab TAB_GREGTECH_PIPES = - new BaseCreativeTab(GTValues.MODID + ".pipes", () -> OreDictUnifier.get(OrePrefix.pipeNormalFluid, Materials.Aluminium), true); - public static final BaseCreativeTab TAB_GREGTECH_TOOLS = - new BaseCreativeTab(GTValues.MODID + ".tools", () -> ToolItems.HARD_HAMMER.get(Materials.Aluminium), true); - public static final BaseCreativeTab TAB_GREGTECH_MATERIALS = - new BaseCreativeTab(GTValues.MODID + ".materials", () -> OreDictUnifier.get(OrePrefix.ingot, Materials.Aluminium), true); - public static final BaseCreativeTab TAB_GREGTECH_ORES = - new BaseCreativeTab(GTValues.MODID + ".ores", () -> OreDictUnifier.get(OrePrefix.ore, Materials.Aluminium), true); - public static final BaseCreativeTab TAB_GREGTECH_DECORATIONS = - new BaseCreativeTab(GTValues.MODID + ".decorations", () -> MetaBlocks.WARNING_SIGN.getItemVariant(BlockWarningSign.SignType.YELLOW_STRIPES), true); + public static final BaseCreativeTab TAB_GREGTECH = new BaseCreativeTab(GTValues.MODID + ".main", + () -> MetaItems.LOGO.getStackForm(), true); + public static final BaseCreativeTab TAB_GREGTECH_MACHINES = new BaseCreativeTab(GTValues.MODID + ".machines", + () -> MetaTileEntities.ELECTRIC_BLAST_FURNACE.getStackForm(), true); + public static final BaseCreativeTab TAB_GREGTECH_CABLES = new BaseCreativeTab(GTValues.MODID + ".cables", + () -> OreDictUnifier.get(OrePrefix.cableGtDouble, Materials.Aluminium), true); + public static final BaseCreativeTab TAB_GREGTECH_PIPES = new BaseCreativeTab(GTValues.MODID + ".pipes", + () -> OreDictUnifier.get(OrePrefix.pipeNormalFluid, Materials.Aluminium), true); + public static final BaseCreativeTab TAB_GREGTECH_TOOLS = new BaseCreativeTab(GTValues.MODID + ".tools", + () -> ToolItems.HARD_HAMMER.get(Materials.Aluminium), true); + public static final BaseCreativeTab TAB_GREGTECH_MATERIALS = new BaseCreativeTab(GTValues.MODID + ".materials", + () -> OreDictUnifier.get(OrePrefix.ingot, Materials.Aluminium), true); + public static final BaseCreativeTab TAB_GREGTECH_ORES = new BaseCreativeTab(GTValues.MODID + ".ores", + () -> OreDictUnifier.get(OrePrefix.ore, Materials.Aluminium), true); + public static final BaseCreativeTab TAB_GREGTECH_DECORATIONS = new BaseCreativeTab(GTValues.MODID + ".decorations", + () -> MetaBlocks.WARNING_SIGN.getItemVariant(BlockWarningSign.SignType.YELLOW_STRIPES), true); /** Will be available at the Pre-Initialization stage */ public static boolean isHighTier() { @@ -123,8 +128,8 @@ public void register(int id, ResourceLocation key, V value) { } public void register(int id, String key, V value) { - if (registry != null) registry.register(id, new ResourceLocation(Loader.instance().activeModContainer().getModId(), key), value); + if (registry != null) registry.register(id, + new ResourceLocation(Loader.instance().activeModContainer().getModId(), key), value); } } - } diff --git a/src/main/java/gregtech/api/GregTechAPIInternal.java b/src/main/java/gregtech/api/GregTechAPIInternal.java index cb653b259fe..7e7ae395de8 100644 --- a/src/main/java/gregtech/api/GregTechAPIInternal.java +++ b/src/main/java/gregtech/api/GregTechAPIInternal.java @@ -2,6 +2,7 @@ /** * If you're an addon looking in here, you're probably in the wrong place. + * * @see GregTechAPI */ public final class GregTechAPIInternal { diff --git a/src/main/java/gregtech/api/block/BlockCustomParticle.java b/src/main/java/gregtech/api/block/BlockCustomParticle.java index 8a7522dc1b4..a1f7d937be7 100644 --- a/src/main/java/gregtech/api/block/BlockCustomParticle.java +++ b/src/main/java/gregtech/api/block/BlockCustomParticle.java @@ -1,10 +1,10 @@ package gregtech.api.block; -import codechicken.lib.vec.Vector3; import gregtech.api.GregTechAPI; +import gregtech.api.util.ParticleHandlerUtil; import gregtech.core.network.NetworkUtils; import gregtech.core.network.packets.PacketBlockParticle; -import gregtech.api.util.ParticleHandlerUtil; + import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; @@ -19,6 +19,8 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.vec.Vector3; import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nonnull; @@ -38,9 +40,11 @@ public BlockCustomParticle(Material materialIn) { @Override @SideOnly(Side.CLIENT) - public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World worldObj, RayTraceResult target, @Nonnull ParticleManager manager) { + public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World worldObj, RayTraceResult target, + @Nonnull ParticleManager manager) { Pair atlasSprite = getParticleTexture(worldObj, target.getBlockPos()); - ParticleHandlerUtil.addHitEffects(state, worldObj, target, atlasSprite.getLeft(), atlasSprite.getRight(), manager); + ParticleHandlerUtil.addHitEffects(state, worldObj, target, atlasSprite.getLeft(), atlasSprite.getRight(), + manager); return true; } @@ -48,19 +52,23 @@ public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World worldObj @SideOnly(Side.CLIENT) public boolean addDestroyEffects(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ParticleManager manager) { Pair atlasSprite = getParticleTexture(world, pos); - ParticleHandlerUtil.addBlockDestroyEffects(world.getBlockState(pos), world, pos, atlasSprite.getLeft(), atlasSprite.getRight(), manager); + ParticleHandlerUtil.addBlockDestroyEffects(world.getBlockState(pos), world, pos, atlasSprite.getLeft(), + atlasSprite.getRight(), manager); return true; } @Override @SideOnly(Side.CLIENT) - public void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleManager particleManager, Vector3 entityPos, int numberOfParticles) { + public void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleManager particleManager, + Vector3 entityPos, int numberOfParticles) { Pair atlasSprite = getParticleTexture(worldObj, blockPos); - ParticleHandlerUtil.addBlockLandingEffects(worldObj, entityPos, atlasSprite.getLeft(), atlasSprite.getRight(), particleManager, numberOfParticles); + ParticleHandlerUtil.addBlockLandingEffects(worldObj, entityPos, atlasSprite.getLeft(), atlasSprite.getRight(), + particleManager, numberOfParticles); } @Override - public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, @Nonnull Entity entity) { + public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, + @Nonnull Entity entity) { if (world.isRemote) { Pair atlasSprite = getParticleTexture(world, pos); ParticleHandlerUtil.addBlockRunningEffects(world, entity, atlasSprite.getLeft(), atlasSprite.getRight()); @@ -69,9 +77,11 @@ public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnu } @Override - public boolean addLandingEffects(@Nonnull IBlockState state, @Nonnull WorldServer worldObj, @Nonnull BlockPos blockPosition, @Nonnull IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles) { - PacketBlockParticle - packet = new PacketBlockParticle(blockPosition, new Vector3(entity.posX, entity.posY, entity.posZ), numberOfParticles); + public boolean addLandingEffects(@Nonnull IBlockState state, @Nonnull WorldServer worldObj, + @Nonnull BlockPos blockPosition, @Nonnull IBlockState iblockstate, + EntityLivingBase entity, int numberOfParticles) { + PacketBlockParticle packet = new PacketBlockParticle(blockPosition, + new Vector3(entity.posX, entity.posY, entity.posZ), numberOfParticles); GregTechAPI.networkHandler.sendToAllTracking(packet, NetworkUtils.blockPoint(worldObj, blockPosition)); return true; } diff --git a/src/main/java/gregtech/api/block/BlockStateTileEntity.java b/src/main/java/gregtech/api/block/BlockStateTileEntity.java index bcd6152bbfa..f0729eddd8e 100644 --- a/src/main/java/gregtech/api/block/BlockStateTileEntity.java +++ b/src/main/java/gregtech/api/block/BlockStateTileEntity.java @@ -8,5 +8,4 @@ public class BlockStateTileEntity extends TileEntity { public IBlockState getBlockState() { return getBlockType().getStateFromMeta(getBlockMetadata()); } - } diff --git a/src/main/java/gregtech/api/block/BuiltInRenderBlock.java b/src/main/java/gregtech/api/block/BuiltInRenderBlock.java index 7113989e1b4..b20f59f7759 100644 --- a/src/main/java/gregtech/api/block/BuiltInRenderBlock.java +++ b/src/main/java/gregtech/api/block/BuiltInRenderBlock.java @@ -29,5 +29,4 @@ public boolean isOpaqueCube(@Nonnull IBlockState state) { public boolean isFullCube(@Nonnull IBlockState state) { return false; } - } diff --git a/src/main/java/gregtech/api/block/ICustomParticleBlock.java b/src/main/java/gregtech/api/block/ICustomParticleBlock.java index bad3858e73f..8024b0b07b9 100644 --- a/src/main/java/gregtech/api/block/ICustomParticleBlock.java +++ b/src/main/java/gregtech/api/block/ICustomParticleBlock.java @@ -1,11 +1,13 @@ package gregtech.api.block; -import codechicken.lib.vec.Vector3; import net.minecraft.client.particle.ParticleManager; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import codechicken.lib.vec.Vector3; + public interface ICustomParticleBlock { - void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleManager particleManager, Vector3 entityPos, int numberOfParticles); + void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleManager particleManager, Vector3 entityPos, + int numberOfParticles); } diff --git a/src/main/java/gregtech/api/block/IStateHarvestLevel.java b/src/main/java/gregtech/api/block/IStateHarvestLevel.java index 421cadc3385..b2e64adefe7 100644 --- a/src/main/java/gregtech/api/block/IStateHarvestLevel.java +++ b/src/main/java/gregtech/api/block/IStateHarvestLevel.java @@ -1,6 +1,7 @@ package gregtech.api.block; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.state.IBlockState; public interface IStateHarvestLevel { diff --git a/src/main/java/gregtech/api/block/UnlistedBooleanProperty.java b/src/main/java/gregtech/api/block/UnlistedBooleanProperty.java index ba6b30dd6d1..bfe40475459 100644 --- a/src/main/java/gregtech/api/block/UnlistedBooleanProperty.java +++ b/src/main/java/gregtech/api/block/UnlistedBooleanProperty.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; public class UnlistedBooleanProperty implements IUnlistedProperty { + private final String name; public UnlistedBooleanProperty(@Nonnull String name) { diff --git a/src/main/java/gregtech/api/block/VariantActiveBlock.java b/src/main/java/gregtech/api/block/VariantActiveBlock.java index 439d6302329..7e3a4172716 100644 --- a/src/main/java/gregtech/api/block/VariantActiveBlock.java +++ b/src/main/java/gregtech/api/block/VariantActiveBlock.java @@ -4,10 +4,7 @@ import gregtech.client.model.ActiveVariantBlockBakedModel; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import it.unimi.dsi.fastutil.objects.ObjectSet; + import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; @@ -28,9 +25,13 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import it.unimi.dsi.fastutil.objects.ObjectSet; import team.chisel.ctm.client.state.CTMExtendedState; -import javax.annotation.Nonnull; import java.util.EnumMap; import java.util.Map; import java.util.Objects; @@ -38,6 +39,8 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class VariantActiveBlock & IStringSerializable> extends VariantBlock { private static final Int2ObjectMap> ACTIVE_BLOCKS = new Int2ObjectOpenHashMap<>(); @@ -121,19 +124,21 @@ protected BlockStateContainer createBlockState() { Class enumClass = getActualTypeParameter(getClass(), VariantActiveBlock.class, 0); this.VARIANT = PropertyEnum.create("variant", enumClass); this.VALUES = enumClass.getEnumConstants(); - return new ExtendedBlockState(this, new IProperty[]{VARIANT, ACTIVE_DEPRECATED}, new IUnlistedProperty[]{ACTIVE}); + return new ExtendedBlockState(this, new IProperty[] { VARIANT, ACTIVE_DEPRECATED }, + new IUnlistedProperty[] { ACTIVE }); } @Nonnull @Override - public IExtendedBlockState getExtendedState(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) { + public IExtendedBlockState getExtendedState(@Nonnull IBlockState state, @Nonnull IBlockAccess world, + @Nonnull BlockPos pos) { IExtendedBlockState ext = ((IExtendedBlockState) state) .withProperty(ACTIVE, Minecraft.getMinecraft().world != null && isBlockActive(Minecraft.getMinecraft().world.provider.getDimension(), pos)); if (Loader.isModLoaded(GTValues.MODID_CTM)) { - //if the Connected Textures Mod is loaded we wrap our IExtendedBlockState with their wrapper, - //so that the CTM renderer can render the block properly. + // if the Connected Textures Mod is loaded we wrap our IExtendedBlockState with their wrapper, + // so that the CTM renderer can render the block properly. return new CTMExtendedState(ext, world, pos); } return ext; @@ -146,17 +151,18 @@ public void onModelRegister() { ModelResourceLocation inactiveModel = model(false, value); ModelResourceLocation activeModel = model(true, value); - ActiveVariantBlockBakedModel model = new ActiveVariantBlockBakedModel(inactiveModel, activeModel, () -> isBloomEnabled(value)); + ActiveVariantBlockBakedModel model = new ActiveVariantBlockBakedModel(inactiveModel, activeModel, + () -> isBloomEnabled(value)); models.put(value, model.getModelLocation()); Item item = Item.getItemFromBlock(this); ModelLoader.setCustomModelResourceLocation(item, value.ordinal(), inactiveModel); ModelLoader.registerItemVariants(item, activeModel); } - ModelLoader.setCustomStateMapper(this, b -> b.getBlockState().getValidStates().stream().collect(Collectors.toMap( - s -> s, - s -> models.get(s.getValue(VARIANT)) - ))); + ModelLoader.setCustomStateMapper(this, + b -> b.getBlockState().getValidStates().stream().collect(Collectors.toMap( + s -> s, + s -> models.get(s.getValue(VARIANT))))); } private ModelResourceLocation model(boolean active, T variant) { diff --git a/src/main/java/gregtech/api/block/VariantBlock.java b/src/main/java/gregtech/api/block/VariantBlock.java index 01200b1f51f..94eb2270b06 100644 --- a/src/main/java/gregtech/api/block/VariantBlock.java +++ b/src/main/java/gregtech/api/block/VariantBlock.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.util.LocalizationUtils; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; @@ -19,13 +20,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class VariantBlock & IStringSerializable> extends Block implements IWalkingSpeedBonus { protected PropertyEnum VARIANT; @@ -37,7 +39,8 @@ public VariantBlock(Material materialIn) { for (T t : VALUES) { IStateHarvestLevel stateHarvestLevel = (IStateHarvestLevel) t; IBlockState state = getState(t); - setHarvestLevel(stateHarvestLevel.getHarvestTool(state), stateHarvestLevel.getHarvestLevel(state), state); + setHarvestLevel(stateHarvestLevel.getHarvestTool(state), stateHarvestLevel.getHarvestLevel(state), + state); } } setCreativeTab(GregTechAPI.TAB_GREGTECH); @@ -82,12 +85,13 @@ protected BlockStateContainer createBlockState() { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World player, List tooltip, @Nonnull ITooltipFlag advanced) { - //tier less tooltip like: tile.turbine_casing.tooltip + public void addInformation(@Nonnull ItemStack stack, @Nullable World player, List tooltip, + @Nonnull ITooltipFlag advanced) { + // tier less tooltip like: tile.turbine_casing.tooltip String unlocalizedVariantTooltip = getTranslationKey() + ".tooltip"; if (I18n.hasKey(unlocalizedVariantTooltip)) Collections.addAll(tooltip, LocalizationUtils.formatLines(unlocalizedVariantTooltip)); - //item specific tooltip: tile.turbine_casing.bronze_gearbox.tooltip + // item specific tooltip: tile.turbine_casing.bronze_gearbox.tooltip String unlocalizedTooltip = stack.getTranslationKey() + ".tooltip"; if (I18n.hasKey(unlocalizedTooltip)) Collections.addAll(tooltip, LocalizationUtils.formatLines(unlocalizedTooltip)); @@ -117,7 +121,8 @@ public void onEntityWalk(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull return; } - IBlockState below = entityIn.getEntityWorld().getBlockState(new BlockPos(entityIn.posX, entityIn.posY - (1 / 16D), entityIn.posZ)); + IBlockState below = entityIn.getEntityWorld() + .getBlockState(new BlockPos(entityIn.posX, entityIn.posY - (1 / 16D), entityIn.posZ)); if (checkApplicableBlocks(below)) { if (bonusSpeedCondition(entityIn)) { entityIn.motionX *= getWalkingSpeedBonus(); @@ -126,9 +131,10 @@ public void onEntityWalk(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull } } - //magic is here + // magic is here @SuppressWarnings("unchecked") - protected static Class getActualTypeParameter(Class thisClass, Class declaringClass, int index) { + protected static Class getActualTypeParameter(Class thisClass, Class declaringClass, + int index) { Type type = thisClass.getGenericSuperclass(); while (!(type instanceof ParameterizedType) || ((ParameterizedType) type).getRawType() != declaringClass) { diff --git a/src/main/java/gregtech/api/block/VariantItemBlock.java b/src/main/java/gregtech/api/block/VariantItemBlock.java index 2490785f7fb..3aa02bdfc28 100644 --- a/src/main/java/gregtech/api/block/VariantItemBlock.java +++ b/src/main/java/gregtech/api/block/VariantItemBlock.java @@ -32,5 +32,4 @@ public IBlockState getBlockState(ItemStack stack) { public String getTranslationKey(@Nonnull ItemStack stack) { return super.getTranslationKey(stack) + '.' + genericBlock.getState(getBlockState(stack)).getName(); } - } diff --git a/src/main/java/gregtech/api/block/machines/BlockMachine.java b/src/main/java/gregtech/api/block/machines/BlockMachine.java index 71a4b8fdab3..5f0caaad155 100644 --- a/src/main/java/gregtech/api/block/machines/BlockMachine.java +++ b/src/main/java/gregtech/api/block/machines/BlockMachine.java @@ -1,9 +1,5 @@ package gregtech.api.block.machines; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.raytracer.RayTracer; -import codechicken.lib.vec.Cuboid6; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.block.BlockCustomParticle; @@ -22,6 +18,7 @@ import gregtech.client.renderer.handler.MetaTileEntityRenderer; import gregtech.common.items.MetaItems; import gregtech.integration.ctm.IFacadeWrapper; + import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.SoundType; @@ -57,12 +54,18 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.raytracer.RayTracer; +import codechicken.lib.vec.Cuboid6; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; +import java.util.*; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.*; import static gregtech.api.util.GTUtility.getMetaTileEntity; @@ -70,7 +73,7 @@ public class BlockMachine extends BlockCustomParticle implements ITileEntityProvider, IFacadeWrapper, IBlockAppearance { private static final List EMPTY_COLLISION_BOX = Collections.emptyList(); - //used for rendering purposes of non-opaque machines like chests and tanks + // used for rendering purposes of non-opaque machines like chests and tanks public static final PropertyBool OPAQUE = PropertyBool.create("opaque"); // Vanilla MC's getHarvestTool() and getHarvestLevel() only pass the state, which is @@ -110,7 +113,8 @@ public boolean causesSuffocation(IBlockState state) { @Nonnull @Override - public IBlockState getActualState(@Nonnull IBlockState state, @Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { + public IBlockState getActualState(@Nonnull IBlockState state, @Nonnull IBlockAccess worldIn, + @Nonnull BlockPos pos) { MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); if (metaTileEntity == null) return state; @@ -122,11 +126,13 @@ public IBlockState getActualState(@Nonnull IBlockState state, @Nonnull IBlockAcc @Nonnull @Override protected BlockStateContainer createBlockState() { - return new ExtendedBlockState(this, new IProperty[]{OPAQUE}, new IUnlistedProperty[]{HARVEST_TOOL, HARVEST_LEVEL}); + return new ExtendedBlockState(this, new IProperty[] { OPAQUE }, + new IUnlistedProperty[] { HARVEST_TOOL, HARVEST_LEVEL }); } @Override - public float getPlayerRelativeBlockHardness(@Nonnull IBlockState state, @Nonnull EntityPlayer player, @Nonnull World worldIn, @Nonnull BlockPos pos) { + public float getPlayerRelativeBlockHardness(@Nonnull IBlockState state, @Nonnull EntityPlayer player, + @Nonnull World worldIn, @Nonnull BlockPos pos) { // make sure our extended block state info is here for callers (since forge does not do it for us in this case) state = state.getBlock().getActualState(state, worldIn, pos); return super.getPlayerRelativeBlockHardness(state, player, worldIn, pos); @@ -144,7 +150,8 @@ public int getMetaFromState(IBlockState state) { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } @@ -155,7 +162,8 @@ public float getBlockHardness(@Nonnull IBlockState blockState, @Nonnull World wo } @Override - public float getExplosionResistance(@Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity exploder, @Nonnull Explosion explosion) { + public float getExplosionResistance(@Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity exploder, + @Nonnull Explosion explosion) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); return metaTileEntity == null ? 1.0f : metaTileEntity.getBlockResistance(); } @@ -170,13 +178,15 @@ private static List getCollisionBox(IBlockAccess blockAccess, Bl } @Override - public boolean doesSideBlockRendering(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public boolean doesSideBlockRendering(@Nonnull IBlockState state, @Nonnull IBlockAccess world, + @Nonnull BlockPos pos, @Nonnull EnumFacing face) { return state.isOpaqueCube() && getMetaTileEntity(world, pos) != null; } @Nonnull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); if (metaTileEntity == null) return ItemStack.EMPTY; @@ -187,7 +197,9 @@ public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResul } @Override - public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull AxisAlignedBB entityBox, @Nonnull List collidingBoxes, @Nullable Entity entityIn, boolean isActualState) { + public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull AxisAlignedBB entityBox, @Nonnull List collidingBoxes, + @Nullable Entity entityIn, boolean isActualState) { for (Cuboid6 axisAlignedBB : getCollisionBox(worldIn, pos)) { AxisAlignedBB offsetBox = axisAlignedBB.aabb().offset(pos); if (offsetBox.intersects(entityBox)) collidingBoxes.add(offsetBox); @@ -196,7 +208,8 @@ public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World wor @Nullable @Override - public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Vec3d start, @Nonnull Vec3d end) { + public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, @Nonnull World worldIn, + @Nonnull BlockPos pos, @Nonnull Vec3d start, @Nonnull Vec3d end) { return RayTracer.rayTraceCuboidsClosest(start, end, pos, getCollisionBox(worldIn, pos)); } @@ -222,7 +235,8 @@ public EnumFacing[] getValidRotations(@Nonnull World world, @Nonnull BlockPos po } @Override - public boolean recolorBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, @Nonnull EnumDyeColor color) { + public boolean recolorBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, + @Nonnull EnumDyeColor color) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); if (metaTileEntity == null || metaTileEntity.getPaintingColor() == color.colorValue) return false; @@ -231,7 +245,8 @@ public boolean recolorBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnul } @Override - public void onBlockPlacedBy(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityLivingBase placer, ItemStack stack) { + public void onBlockPlacedBy(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull EntityLivingBase placer, ItemStack stack) { IGregTechTileEntity holder = (IGregTechTileEntity) worldIn.getTileEntity(pos); MetaTileEntity sampleMetaTileEntity = GregTechAPI.MTE_REGISTRY.getObjectById(stack.getItemDamage()); if (holder != null && sampleMetaTileEntity != null) { @@ -241,7 +256,7 @@ public void onBlockPlacedBy(World worldIn, @Nonnull BlockPos pos, @Nonnull IBloc } MetaTileEntity metaTileEntity = holder.setMetaTileEntity(sampleMetaTileEntity); if (stack.hasTagCompound()) { - //noinspection ConstantConditions + // noinspection ConstantConditions metaTileEntity.initFromItemStackData(stack.getTagCompound()); } if (metaTileEntity.isValidFrontFacing(EnumFacing.UP)) { @@ -270,7 +285,8 @@ public void onBlockPlacedBy(World worldIn, @Nonnull BlockPos pos, @Nonnull IBloc ItemStack offhand = placer.getHeldItemOffhand(); for (int i = 0; i < EnumDyeColor.values().length; i++) { if (offhand.isItemEqual(MetaItems.SPRAY_CAN_DYES[i].getStackForm())) { - MetaItems.SPRAY_CAN_DYES[i].getBehaviours().get(0).onItemUse((EntityPlayer) placer, worldIn, pos, EnumHand.OFF_HAND, EnumFacing.UP, 0, 0, 0); + MetaItems.SPRAY_CAN_DYES[i].getBehaviours().get(0).onItemUse((EntityPlayer) placer, worldIn, + pos, EnumHand.OFF_HAND, EnumFacing.UP, 0, 0, 0); break; } } @@ -300,14 +316,15 @@ public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull I } @Override - public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state, int fortune) { + public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull IBlockState state, int fortune) { MetaTileEntity metaTileEntity = tileEntities.get() == null ? getMetaTileEntity(world, pos) : tileEntities.get(); if (metaTileEntity == null) return; if (!metaTileEntity.shouldDropWhenDestroyed()) return; ItemStack itemStack = metaTileEntity.getStackForm(); NBTTagCompound tagCompound = new NBTTagCompound(); metaTileEntity.writeItemStackData(tagCompound); - //only set item tag if it's not empty, so newly created items will stack with dismantled + // only set item tag if it's not empty, so newly created items will stack with dismantled if (!tagCompound.isEmpty()) itemStack.setTagCompound(tagCompound); // TODO Clean this up @@ -322,7 +339,9 @@ public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAcces } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + float hitX, float hitY, float hitZ) { MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); CuboidRayTraceResult rayTraceResult = (CuboidRayTraceResult) RayTracer.retraceBlock(worldIn, playerIn, pos); ItemStack itemStack = playerIn.getHeldItem(hand); @@ -353,26 +372,31 @@ public void onBlockClicked(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnu } @Override - public boolean canConnectRedstone(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nullable EnumFacing side) { + public boolean canConnectRedstone(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nullable EnumFacing side) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); return metaTileEntity != null && metaTileEntity.canConnectRedstone(side == null ? null : side.getOpposite()); } @Override - public boolean shouldCheckWeakPower(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean shouldCheckWeakPower(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side) { // The check in World::getRedstonePower in the vanilla code base is reversed. Setting this to false will // actually cause getWeakPower to be called, rather than prevent it. return false; } @Override - public int getWeakPower(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public int getWeakPower(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, + @Nonnull EnumFacing side) { MetaTileEntity metaTileEntity = getMetaTileEntity(blockAccess, pos); - return metaTileEntity == null ? 0 : metaTileEntity.getOutputRedstoneSignal(side == null ? null : side.getOpposite()); + return metaTileEntity == null ? 0 : + metaTileEntity.getOutputRedstoneSignal(side == null ? null : side.getOpposite()); } @Override - public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Block blockIn, @Nonnull BlockPos fromPos) { + public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull Block blockIn, @Nonnull BlockPos fromPos) { TileEntity holder = worldIn.getTileEntity(pos); if (holder instanceof IGregTechTileEntity gregTechTile) { EnumFacing facing = GTUtility.getFacingToNeighbor(pos, fromPos); @@ -397,7 +421,8 @@ public void onNeighborChange(IBlockAccess world, @NotNull BlockPos pos, @NotNull protected final ThreadLocal tileEntities = new ThreadLocal<>(); @Override - public void harvestBlock(@Nonnull World worldIn, @Nonnull EntityPlayer player, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nullable TileEntity te, @Nonnull ItemStack stack) { + public void harvestBlock(@Nonnull World worldIn, @Nonnull EntityPlayer player, @Nonnull BlockPos pos, + @Nonnull IBlockState state, @Nullable TileEntity te, @Nonnull ItemStack stack) { tileEntities.set(te == null ? tileEntities.get() : ((IGregTechTileEntity) te).getMetaTileEntity()); super.harvestBlock(worldIn, player, pos, state, te, stack); tileEntities.set(null); @@ -433,7 +458,8 @@ public boolean isFullCube(IBlockState state) { @Nonnull @Override - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EnumFacing face) { MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); return metaTileEntity == null ? BlockFaceShape.SOLID : metaTileEntity.getCoverFaceShape(face); } @@ -463,7 +489,8 @@ public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList getParticleTexture(World world, Bloc } @Override - public boolean canEntityDestroy(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull Entity entity) { + public boolean canEntityDestroy(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull Entity entity) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); if (metaTileEntity == null) { return super.canEntityDestroy(state, world, pos, entity); } - return !((entity instanceof EntityWither || entity instanceof EntityWitherSkull) && metaTileEntity.getWitherProof()); + return !((entity instanceof EntityWither || entity instanceof EntityWitherSkull) && + metaTileEntity.getWitherProof()); } @SideOnly(Side.CLIENT) @Override - public void randomDisplayTick(@Nonnull IBlockState stateIn, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Random rand) { + public void randomDisplayTick(@Nonnull IBlockState stateIn, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull Random rand) { super.randomDisplayTick(stateIn, worldIn, pos, rand); MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); if (metaTileEntity != null) metaTileEntity.randomDisplayTick(); diff --git a/src/main/java/gregtech/api/block/machines/MachineItemBlock.java b/src/main/java/gregtech/api/block/machines/MachineItemBlock.java index 42febdc36b5..8d7263b0068 100644 --- a/src/main/java/gregtech/api/block/machines/MachineItemBlock.java +++ b/src/main/java/gregtech/api/block/machines/MachineItemBlock.java @@ -1,6 +1,5 @@ package gregtech.api.block.machines; -import com.google.common.base.Preconditions; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.metatileentity.ITieredMetaTileEntity; @@ -11,14 +10,13 @@ import gregtech.api.util.LocalizationUtils; import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.ObjectArraySet; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -34,12 +32,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.base.Preconditions; +import it.unimi.dsi.fastutil.objects.ObjectArraySet; + import java.util.Collections; import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MachineItemBlock extends ItemBlock { private static final Set ADDITIONAL_CREATIVE_TABS = new ObjectArraySet<>(); @@ -51,17 +53,21 @@ public class MachineItemBlock extends ItemBlock { * Note that, for machines to be properly registered on the creative tab, a matching implementation of * {@link MetaTileEntity#isInCreativeTab(CreativeTabs)} should be provided as well. * - * @param creativeTab Creative tab to be checked during {@link net.minecraft.item.Item#getSubItems(CreativeTabs, NonNullList)} + * @param creativeTab Creative tab to be checked during + * {@link net.minecraft.item.Item#getSubItems(CreativeTabs, NonNullList)} * @throws NullPointerException If {@code creativeTab == null} - * @throws IllegalArgumentException If {@code creativeTab == GregTechAPI.TAB_GREGTECH_MACHINES || creativeTab == CreativeTabs.SEARCH} + * @throws IllegalArgumentException If + * {@code creativeTab == GregTechAPI.TAB_GREGTECH_MACHINES || creativeTab == CreativeTabs.SEARCH} * @see MetaTileEntity#isInCreativeTab(CreativeTabs) */ public static void addCreativeTab(CreativeTabs creativeTab) { Preconditions.checkNotNull(creativeTab, "creativeTab"); if (creativeTab == GregTechAPI.TAB_GREGTECH_MACHINES) { - throw new IllegalArgumentException("Adding " + GregTechAPI.TAB_GREGTECH_MACHINES.tabLabel + " as additional creative tab is redundant."); + throw new IllegalArgumentException("Adding " + GregTechAPI.TAB_GREGTECH_MACHINES.tabLabel + + " as additional creative tab is redundant."); } else if (creativeTab == CreativeTabs.SEARCH) { - throw new IllegalArgumentException("Adding " + CreativeTabs.SEARCH.tabLabel + " as additional creative tab is redundant."); + throw new IllegalArgumentException( + "Adding " + CreativeTabs.SEARCH.tabLabel + " as additional creative tab is redundant."); } ADDITIONAL_CREATIVE_TABS.add(creativeTab); } @@ -79,10 +85,12 @@ public String getTranslationKey(@Nonnull ItemStack stack) { } @Override - public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) { + public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + IBlockState newState) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(stack); - //prevent rendering glitch before meta tile entity sync to client, but after block placement - //set opaque property on the placing on block, instead during set of meta tile entity + // prevent rendering glitch before meta tile entity sync to client, but after block placement + // set opaque property on the placing on block, instead during set of meta tile entity boolean superVal = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState.withProperty(BlockMachine.OPAQUE, metaTileEntity != null && metaTileEntity.isOpaqueCube())); if (superVal && !world.isRemote) { @@ -90,7 +98,8 @@ public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer play Block block = world.getBlockState(possiblePipe).getBlock(); if (block instanceof BlockPipe) { IPipeTile pipeTile = ((BlockPipe) block).getPipeTileEntity(world, possiblePipe); - if (pipeTile != null && ((BlockPipe) block).canPipeConnectToBlock(pipeTile, side.getOpposite(), world.getTileEntity(pos))) { + if (pipeTile != null && ((BlockPipe) block).canPipeConnectToBlock(pipeTile, side.getOpposite(), + world.getTileEntity(pos))) { pipeTile.setConnection(side, true, false); } } @@ -128,7 +137,8 @@ public ItemStack getContainerItem(@Nonnull ItemStack itemStack) { return ItemStack.EMPTY; } if (itemStack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { - IFluidHandlerItem handler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem handler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (handler != null) { FluidStack drained = handler.drain(1000, true); if (drained == null || drained.amount != 1000) { @@ -142,21 +152,23 @@ public ItemStack getContainerItem(@Nonnull ItemStack itemStack) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, @Nonnull ITooltipFlag flagIn) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, + @Nonnull ITooltipFlag flagIn) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(stack); if (metaTileEntity == null) return; - //item specific tooltip like: gregtech.machine.lathe.lv.tooltip + // item specific tooltip like: gregtech.machine.lathe.lv.tooltip String tooltipLocale = metaTileEntity.getMetaName() + ".tooltip"; if (I18n.hasKey(tooltipLocale)) { Collections.addAll(tooltip, LocalizationUtils.formatLines(tooltipLocale)); } - //tier less tooltip for a electric machine like: gregtech.machine.lathe.tooltip + // tier less tooltip for a electric machine like: gregtech.machine.lathe.tooltip if (metaTileEntity instanceof ITieredMetaTileEntity) { String tierlessTooltipLocale = ((ITieredMetaTileEntity) metaTileEntity).getTierlessTooltipKey(); - //only add tierless tooltip if it's key is not equal to normal tooltip key (i.e if machine name has dot in it's name) - //case when it's not true would be any machine extending from TieredMetaTileEntity but having only one tier + // only add tierless tooltip if it's key is not equal to normal tooltip key (i.e if machine name has dot in + // it's name) + // case when it's not true would be any machine extending from TieredMetaTileEntity but having only one tier if (!tooltipLocale.equals(tierlessTooltipLocale) && I18n.hasKey(tierlessTooltipLocale)) { Collections.addAll(tooltip, LocalizationUtils.formatLines(tierlessTooltipLocale)); } diff --git a/src/main/java/gregtech/api/capability/FeCompat.java b/src/main/java/gregtech/api/capability/FeCompat.java index aadf8c1c0d9..c5768a1816e 100644 --- a/src/main/java/gregtech/api/capability/FeCompat.java +++ b/src/main/java/gregtech/api/capability/FeCompat.java @@ -1,6 +1,7 @@ package gregtech.api.capability; import gregtech.common.ConfigHolder; + import net.minecraftforge.energy.IEnergyStorage; public class FeCompat { @@ -14,6 +15,7 @@ public static int ratio(boolean feToEu) { /** * Converts eu to fe, using specified ratio + * * @return fe */ public static int toFe(long eu, int ratio) { @@ -23,6 +25,7 @@ public static int toFe(long eu, int ratio) { /** * Converts eu to fe, using specified ratio, and returns as a long. * Can be used for overflow protection. + * * @return fe */ public static long toFeLong(long eu, int ratio) { @@ -32,6 +35,7 @@ public static long toFeLong(long eu, int ratio) { /** * Converts eu to fe, using a specified ratio, and with a specified upper bound. * This can be useful for dealing with int-overflows when converting from a long to an int. + * * @return fe */ public static int toFeBounded(long eu, int ratio, int max) { @@ -40,17 +44,19 @@ public static int toFeBounded(long eu, int ratio, int max) { /** * Converts fe to eu, using specified ratio + * * @return eu */ - public static long toEu(long fe, int ratio){ + public static long toEu(long fe, int ratio) { return fe / ratio; } /** * Inserts energy to the storage. EU -> FE conversion is performed. + * * @return amount of EU inserted */ - public static long insertEu(IEnergyStorage storage, long amountEU){ + public static long insertEu(IEnergyStorage storage, long amountEU) { int euToFeRatio = ratio(false); int feSent = storage.receiveEnergy(toFe(amountEU, euToFeRatio), true); return toEu(storage.receiveEnergy(feSent - (feSent % euToFeRatio), false), euToFeRatio); @@ -58,9 +64,10 @@ public static long insertEu(IEnergyStorage storage, long amountEU){ /** * Extracts energy from the storage. EU -> FE conversion is performed. + * * @return amount of EU extracted */ - public static long extractEu(IEnergyStorage storage, long amountEU){ + public static long extractEu(IEnergyStorage storage, long amountEU) { int euToFeRatio = ratio(false); int extract = storage.extractEnergy(toFe(amountEU, euToFeRatio), true); return toEu(storage.extractEnergy(extract - (extract % euToFeRatio), false), euToFeRatio); diff --git a/src/main/java/gregtech/api/capability/GregtechCapabilities.java b/src/main/java/gregtech/api/capability/GregtechCapabilities.java index 5414f54d03f..985d6c5a7fe 100644 --- a/src/main/java/gregtech/api/capability/GregtechCapabilities.java +++ b/src/main/java/gregtech/api/capability/GregtechCapabilities.java @@ -5,6 +5,7 @@ import gregtech.api.terminal.hardware.HardwareProvider; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.converter.ConverterTrait; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; diff --git a/src/main/java/gregtech/api/capability/GregtechDataCodes.java b/src/main/java/gregtech/api/capability/GregtechDataCodes.java index eb1df93f037..b8720654da1 100644 --- a/src/main/java/gregtech/api/capability/GregtechDataCodes.java +++ b/src/main/java/gregtech/api/capability/GregtechDataCodes.java @@ -159,7 +159,6 @@ public static int assignId() { public static final String TAG_KEY_FRAGILE = "Fragile"; public static final String TAG_KEY_MUFFLED = "Muffled"; - // MTE Trait Names public static final String ABSTRACT_WORKABLE_TRAIT = "RecipeMapWorkable"; diff --git a/src/main/java/gregtech/api/capability/GregtechTileCapabilities.java b/src/main/java/gregtech/api/capability/GregtechTileCapabilities.java index d6681895937..0d7a53cc813 100644 --- a/src/main/java/gregtech/api/capability/GregtechTileCapabilities.java +++ b/src/main/java/gregtech/api/capability/GregtechTileCapabilities.java @@ -3,6 +3,7 @@ import gregtech.api.capability.impl.AbstractRecipeLogic; import gregtech.api.cover.CoverHolder; import gregtech.api.metatileentity.multiblock.IMaintenance; + import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; diff --git a/src/main/java/gregtech/api/capability/IControllable.java b/src/main/java/gregtech/api/capability/IControllable.java index 1ba7dfd0f01..631900461e5 100644 --- a/src/main/java/gregtech/api/capability/IControllable.java +++ b/src/main/java/gregtech/api/capability/IControllable.java @@ -13,5 +13,4 @@ public interface IControllable { * @param isWorkingAllowed true if the workable can work, otherwise false */ void setWorkingEnabled(boolean isWorkingAllowed); - } diff --git a/src/main/java/gregtech/api/capability/IDataAccessHatch.java b/src/main/java/gregtech/api/capability/IDataAccessHatch.java index 014a6b9c7ce..d8d42eb0681 100644 --- a/src/main/java/gregtech/api/capability/IDataAccessHatch.java +++ b/src/main/java/gregtech/api/capability/IDataAccessHatch.java @@ -2,10 +2,11 @@ import gregtech.api.recipes.Recipe; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; +import javax.annotation.Nonnull; + public interface IDataAccessHatch { /** diff --git a/src/main/java/gregtech/api/capability/IElectricItem.java b/src/main/java/gregtech/api/capability/IElectricItem.java index 9069088e1ab..34dc08b235d 100644 --- a/src/main/java/gregtech/api/capability/IElectricItem.java +++ b/src/main/java/gregtech/api/capability/IElectricItem.java @@ -90,5 +90,4 @@ default boolean canUse(long amount) { * @return The tier of the item. */ int getTier(); - } diff --git a/src/main/java/gregtech/api/capability/IEnergyContainer.java b/src/main/java/gregtech/api/capability/IEnergyContainer.java index 72df6268142..14e9c7f158d 100644 --- a/src/main/java/gregtech/api/capability/IEnergyContainer.java +++ b/src/main/java/gregtech/api/capability/IEnergyContainer.java @@ -94,29 +94,34 @@ default long getOutputVoltage() { /** * @return output energy packet size - * Overflowing this value will explode machine. + * Overflowing this value will explode machine. */ long getInputVoltage(); /** * @return input eu/s */ - default long getInputPerSec() {return 0L;} + default long getInputPerSec() { + return 0L; + } /** * @return output eu/s */ - default long getOutputPerSec() {return 0L;} + default long getOutputPerSec() { + return 0L; + } /** * @return true if information like energy capacity should be hidden from TOP. - * Useful for cables + * Useful for cables */ default boolean isOneProbeHidden() { return false; } IEnergyContainer DEFAULT = new IEnergyContainer() { + @Override public long acceptEnergyFromNetwork(EnumFacing enumFacing, long l, long l1) { return 0; diff --git a/src/main/java/gregtech/api/capability/IFilter.java b/src/main/java/gregtech/api/capability/IFilter.java index 9d7463b9a3a..d677dbb42d0 100644 --- a/src/main/java/gregtech/api/capability/IFilter.java +++ b/src/main/java/gregtech/api/capability/IFilter.java @@ -1,9 +1,10 @@ package gregtech.api.capability; -import javax.annotation.Nonnull; import java.util.Comparator; import java.util.function.Predicate; +import javax.annotation.Nonnull; + /** * Base type for generic filters. In addition to the predicate method, this interface provides priority primarily used * in insertion logic. @@ -38,20 +39,20 @@ public interface IFilter extends Predicate { * certain filters from others. The priority system uses reverse ordering; higher priority values have * precedence over lower ones. *
    - *
  • Whitelist filters have {@code Integer.MAX_VALUE - whitelistSize} as their default priority. The highest - * possible number for whitelist priority is {@code Integer.MAX_VALUE - 1}, where only one entry is - * whitelisted. The priority can be computed using {@link #whitelistPriority(int)}.
  • - *
  • Blacklist filters have {@code Integer.MIN_VALUE + 1 + blacklistSize} as their default priority. The - * lowest possible number for blacklist priority is {@code Integer.MIN_VALUE + 2}, where only one entry is - * blacklisted. The priority can be computed using {@link #blacklistPriority(int)}.
  • - *
  • Filters with unspecified priority have {@code 0} as their priority.
  • - *
  • Two values, {@link #firstPriority()}, and {@link #lastPriority()}, can be used to create filter - * with highest/lowest possible priority respectively.
  • - *
  • For custom filter implementations, it is expected to have at least positive priority for whitelist-like - * filters, and negative priority for blacklist-like filters. Methods {@link #whitelistLikePriority()} and - * {@link #blacklistLikePriority()} are available as standard priority.
  • - *
  • {@link #noPriority()} is reserved for 'no-priority' filters; it's applicable to no-op filters and - * its reverse (everything filter).
  • + *
  • Whitelist filters have {@code Integer.MAX_VALUE - whitelistSize} as their default priority. The highest + * possible number for whitelist priority is {@code Integer.MAX_VALUE - 1}, where only one entry is + * whitelisted. The priority can be computed using {@link #whitelistPriority(int)}.
  • + *
  • Blacklist filters have {@code Integer.MIN_VALUE + 1 + blacklistSize} as their default priority. The + * lowest possible number for blacklist priority is {@code Integer.MIN_VALUE + 2}, where only one entry is + * blacklisted. The priority can be computed using {@link #blacklistPriority(int)}.
  • + *
  • Filters with unspecified priority have {@code 0} as their priority.
  • + *
  • Two values, {@link #firstPriority()}, and {@link #lastPriority()}, can be used to create filter + * with highest/lowest possible priority respectively.
  • + *
  • For custom filter implementations, it is expected to have at least positive priority for whitelist-like + * filters, and negative priority for blacklist-like filters. Methods {@link #whitelistLikePriority()} and + * {@link #blacklistLikePriority()} are available as standard priority.
  • + *
  • {@link #noPriority()} is reserved for 'no-priority' filters; it's applicable to no-op filters and + * its reverse (everything filter).
  • *
* Although the priority is not a strict requirement, it is strongly encouraged to specify priority according to * these criteria. @@ -72,6 +73,7 @@ default int getPriority() { @Nonnull default IFilter negate() { return new IFilter<>() { + @Override public boolean test(@Nonnull T t) { return !IFilter.this.test(t); diff --git a/src/main/java/gregtech/api/capability/IFilteredFluidContainer.java b/src/main/java/gregtech/api/capability/IFilteredFluidContainer.java index ca35dc0b32b..524ad54eee8 100644 --- a/src/main/java/gregtech/api/capability/IFilteredFluidContainer.java +++ b/src/main/java/gregtech/api/capability/IFilteredFluidContainer.java @@ -2,9 +2,10 @@ import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; import java.util.Comparator; +import javax.annotation.Nullable; + /** * Interface for fluid containers ({@link net.minecraftforge.fluids.IFluidTank IFluidTank} or * {@link net.minecraftforge.fluids.capability.IFluidHandler IFluidHandler}) associated with {@link IFilter}. @@ -15,12 +16,11 @@ public interface IFilteredFluidContainer { * Compare logic for filtered instances. */ Comparator COMPARATOR = Comparator.nullsLast( - Comparator.comparing(IFilteredFluidContainer::getFilter, IFilter.FILTER_COMPARATOR) - ); + Comparator.comparing(IFilteredFluidContainer::getFilter, IFilter.FILTER_COMPARATOR)); /** * @return instance of {@link IFilter} associated to this object, or {@code null} if there's no filter - * associated. + * associated. */ @Nullable IFilter getFilter(); diff --git a/src/main/java/gregtech/api/capability/IHPCAComponentHatch.java b/src/main/java/gregtech/api/capability/IHPCAComponentHatch.java index 617c3e74ea2..fbd9915ebdb 100644 --- a/src/main/java/gregtech/api/capability/IHPCAComponentHatch.java +++ b/src/main/java/gregtech/api/capability/IHPCAComponentHatch.java @@ -36,8 +36,7 @@ default boolean isDamaged() { /** * Set this component as damaged (or undamaged). */ - default void setDamaged(boolean damaged) { - } + default void setDamaged(boolean damaged) {} /** * If this component allows for bridging HPCAs to Network Switches. diff --git a/src/main/java/gregtech/api/capability/ILaserContainer.java b/src/main/java/gregtech/api/capability/ILaserContainer.java index c91ac9bafb6..4f051cd8a8e 100644 --- a/src/main/java/gregtech/api/capability/ILaserContainer.java +++ b/src/main/java/gregtech/api/capability/ILaserContainer.java @@ -3,5 +3,4 @@ /** * It is its own separate interface to make piping work easier */ -public interface ILaserContainer extends IEnergyContainer { -} +public interface ILaserContainer extends IEnergyContainer {} diff --git a/src/main/java/gregtech/api/capability/IMaintenanceHatch.java b/src/main/java/gregtech/api/capability/IMaintenanceHatch.java index f15c0bbcc20..07c148bb3ab 100644 --- a/src/main/java/gregtech/api/capability/IMaintenanceHatch.java +++ b/src/main/java/gregtech/api/capability/IMaintenanceHatch.java @@ -11,14 +11,16 @@ public interface IMaintenanceHatch { /** * Sets this Maintenance Hatch as being duct taped + * * @param isTaped is the state of the hatch being taped or not */ void setTaped(boolean isTaped); /** * Stores maintenance data to this MetaTileEntity + * * @param maintenanceProblems is the byte value representing the problems - * @param timeActive is the int value representing the total time the parent multiblock has been active + * @param timeActive is the int value representing the total time the parent multiblock has been active */ void storeMaintenanceData(byte maintenanceProblems, int timeActive); @@ -30,6 +32,7 @@ public interface IMaintenanceHatch { /** * reads this MetaTileEntity's maintenance data + * * @return Tuple of Byte, Integer corresponding to the maintenance problems, and total time active */ Tuple readMaintenanceData(); diff --git a/src/main/java/gregtech/api/capability/IMiner.java b/src/main/java/gregtech/api/capability/IMiner.java index 5ac4607a31b..4b82046f399 100644 --- a/src/main/java/gregtech/api/capability/IMiner.java +++ b/src/main/java/gregtech/api/capability/IMiner.java @@ -1,6 +1,5 @@ package gregtech.api.capability; - import codechicken.lib.vec.Cuboid6; public interface IMiner { diff --git a/src/main/java/gregtech/api/capability/IMultipleRecipeMaps.java b/src/main/java/gregtech/api/capability/IMultipleRecipeMaps.java index 6e9d353e2ca..2a6259791cf 100644 --- a/src/main/java/gregtech/api/capability/IMultipleRecipeMaps.java +++ b/src/main/java/gregtech/api/capability/IMultipleRecipeMaps.java @@ -6,6 +6,7 @@ public interface IMultipleRecipeMaps { /** * Used to get all possible RecipeMaps a Multiblock can run + * * @return array of RecipeMaps */ RecipeMap[] getAvailableRecipeMaps(); diff --git a/src/main/java/gregtech/api/capability/IMultipleTankHandler.java b/src/main/java/gregtech/api/capability/IMultipleTankHandler.java index eaf5ae04cf4..bc779c0597b 100644 --- a/src/main/java/gregtech/api/capability/IMultipleTankHandler.java +++ b/src/main/java/gregtech/api/capability/IMultipleTankHandler.java @@ -1,6 +1,5 @@ package gregtech.api.capability; - import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.fluids.FluidStack; @@ -10,12 +9,13 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Comparator; import java.util.Iterator; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Base class for multi-tank fluid handlers. Handles insertion logic, along with other standard * {@link IFluidHandler} functionalities. @@ -43,7 +43,7 @@ public interface IMultipleTankHandler extends IFluidHandler, Iterable getFluidTanks(); @@ -58,7 +58,7 @@ public interface IMultipleTankHandler extends IFluidHandler, Iterable getFilter() { public IFluidTankProperties[] getTankProperties() { return delegate instanceof IFluidHandler fluidHandler ? fluidHandler.getTankProperties() : - new IFluidTankProperties[]{new FallbackTankProperty()}; + new IFluidTankProperties[] { new FallbackTankProperty() }; } public NBTTagCompound trySerialize() { @@ -137,7 +137,7 @@ public NBTTagCompound trySerialize() { return new NBTTagCompound(); } - @SuppressWarnings({"unchecked"}) + @SuppressWarnings({ "unchecked" }) public void tryDeserialize(NBTTagCompound tag) { if (delegate instanceof FluidTank fluidTank) { fluidTank.readFromNBT(tag); diff --git a/src/main/java/gregtech/api/capability/INotifiableHandler.java b/src/main/java/gregtech/api/capability/INotifiableHandler.java index b0ba2988d1b..8dddb60482d 100644 --- a/src/main/java/gregtech/api/capability/INotifiableHandler.java +++ b/src/main/java/gregtech/api/capability/INotifiableHandler.java @@ -30,5 +30,4 @@ default void addToNotifiedList(MetaTileEntity metaTileEntity, T handler, boo void addNotifiableMetaTileEntity(MetaTileEntity metaTileEntity); void removeNotifiableMetaTileEntity(MetaTileEntity metaTileEntity); - } diff --git a/src/main/java/gregtech/api/capability/IObjectHolder.java b/src/main/java/gregtech/api/capability/IObjectHolder.java index 9c599222aef..1a7dca27503 100644 --- a/src/main/java/gregtech/api/capability/IObjectHolder.java +++ b/src/main/java/gregtech/api/capability/IObjectHolder.java @@ -3,15 +3,18 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraftforge.items.IItemHandler; + import org.jetbrains.annotations.NotNull; public interface IObjectHolder { /** * Get the item held in the object holder. + * * @param remove Whether to also remove the item from its slot. */ - @NotNull ItemStack getHeldItem(boolean remove); + @NotNull + ItemStack getHeldItem(boolean remove); /** * Set the item held in the object holder. Overwrites the currently held item. @@ -20,9 +23,11 @@ public interface IObjectHolder { /** * Get the data item held in the object holder. + * * @param remove Whether to also remove the item from its slot. */ - @NotNull ItemStack getDataItem(boolean remove); + @NotNull + ItemStack getDataItem(boolean remove); /** * Set the data item held in the object holder. Overwrites the currently held data item. @@ -39,5 +44,6 @@ public interface IObjectHolder { /** * @return the object holder's contents represented as an IItemHandler */ - @NotNull IItemHandler getAsHandler(); + @NotNull + IItemHandler getAsHandler(); } diff --git a/src/main/java/gregtech/api/capability/IOpticalComputationProvider.java b/src/main/java/gregtech/api/capability/IOpticalComputationProvider.java index 82d32887cd8..ff3c94655a6 100644 --- a/src/main/java/gregtech/api/capability/IOpticalComputationProvider.java +++ b/src/main/java/gregtech/api/capability/IOpticalComputationProvider.java @@ -1,9 +1,10 @@ package gregtech.api.capability; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; +import javax.annotation.Nonnull; + /** * MUST be implemented on any multiblock which uses * Transmitter Computation Hatches in its structure. diff --git a/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java b/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java index ff5c26b3010..bf5aa13605c 100644 --- a/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java +++ b/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java @@ -4,16 +4,19 @@ import gregtech.api.fluids.attribute.AttributedFluid; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.resources.I18n; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.UnmodifiableView; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.List; +import javax.annotation.Nonnull; + import static gregtech.api.fluids.FluidConstants.CRYOGENIC_FLUID_THRESHOLD; /** @@ -75,12 +78,14 @@ default int getPriority() { /** * Set the container as able to contain an attribute * - * @param attribute the attribute to change containment status for + * @param attribute the attribute to change containment status for * @param canContain whether the attribute can be contained */ void setCanContain(@NotNull FluidAttribute attribute, boolean canContain); - @NotNull @UnmodifiableView Collection<@NotNull FluidAttribute> getContainedAttributes(); + @NotNull + @UnmodifiableView + Collection<@NotNull FluidAttribute> getContainedAttributes(); /** * Append tooltips about containment info @@ -91,7 +96,8 @@ default int getPriority() { */ default void appendTooltips(@NotNull List tooltip, boolean showToolsInfo, boolean showTemperatureInfo) { if (TooltipHelper.isShiftDown()) { - if (showTemperatureInfo) tooltip.add(I18n.format("gregtech.fluid_pipe.max_temperature", getMaxFluidTemperature())); + if (showTemperatureInfo) + tooltip.add(I18n.format("gregtech.fluid_pipe.max_temperature", getMaxFluidTemperature())); if (isGasProof()) tooltip.add(I18n.format("gregtech.fluid_pipe.gas_proof")); else tooltip.add(I18n.format("gregtech.fluid_pipe.not_gas_proof")); if (isPlasmaProof()) tooltip.add(I18n.format("gregtech.fluid_pipe.plasma_proof")); diff --git a/src/main/java/gregtech/api/capability/IWorkable.java b/src/main/java/gregtech/api/capability/IWorkable.java index d7218b065fc..300574630e4 100644 --- a/src/main/java/gregtech/api/capability/IWorkable.java +++ b/src/main/java/gregtech/api/capability/IWorkable.java @@ -19,5 +19,4 @@ public interface IWorkable extends IControllable { * @return true is machine is active */ boolean isActive(); - -} \ No newline at end of file +} diff --git a/src/main/java/gregtech/api/capability/SimpleCapabilityManager.java b/src/main/java/gregtech/api/capability/SimpleCapabilityManager.java index 287892ca8f7..8aad39dc29c 100644 --- a/src/main/java/gregtech/api/capability/SimpleCapabilityManager.java +++ b/src/main/java/gregtech/api/capability/SimpleCapabilityManager.java @@ -6,6 +6,7 @@ import gregtech.api.terminal.hardware.HardwareProvider; import gregtech.api.worldgen.generator.GTWorldGenCapability; import gregtech.common.metatileentities.converter.ConverterTrait; + import net.minecraft.nbt.NBTBase; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; @@ -19,6 +20,7 @@ public class SimpleCapabilityManager { */ public static void registerCapabilityWithNoDefault(Class capabilityClass) { CapabilityManager.INSTANCE.register(capabilityClass, new Capability.IStorage() { + @Override public NBTBase writeNBT(Capability capability, T instance, EnumFacing side) { throw new UnsupportedOperationException("Not supported"); @@ -50,7 +52,8 @@ public static void init() { registerCapabilityWithNoDefault(ConverterTrait.class); registerCapabilityWithNoDefault(ILaserContainer.class); - //internal capabilities - CapabilityManager.INSTANCE.register(GTWorldGenCapability.class, GTWorldGenCapability.STORAGE, GTWorldGenCapability.FACTORY); + // internal capabilities + CapabilityManager.INSTANCE.register(GTWorldGenCapability.class, GTWorldGenCapability.STORAGE, + GTWorldGenCapability.FACTORY); } } diff --git a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java index 9f222dce3be..898314816c7 100644 --- a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java @@ -16,6 +16,7 @@ import gregtech.api.util.GTTransferUtils; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -28,11 +29,12 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.ULV; import static gregtech.api.recipes.logic.OverclockingLogic.*; @@ -185,7 +187,7 @@ public void update() { if (progressTime > 0) { updateRecipeProgress(); } - //check everything that would make a recipe never start here. + // check everything that would make a recipe never start here. if (progressTime == 0 && shouldSearchForRecipes()) { trySearchNewRecipe(); } @@ -266,8 +268,9 @@ protected boolean canWorkWithInputs() { // if the inputs were bad last time, check if they've changed before trying to find a new recipe. if (this.invalidInputsForRecipes && !hasNotifiedInputs()) return false; - //the change in inputs (especially by removal of ingredient by the player) might change the current valid recipe. - //and if the previous recipe produced fluids and the new recipe doesn't, then outputs are not full. + // the change in inputs (especially by removal of ingredient by the player) might change the current valid + // recipe. + // and if the previous recipe produced fluids and the new recipe doesn't, then outputs are not full. this.isOutputsFull = false; this.invalidInputsForRecipes = false; this.metaTileEntity.getNotifiedItemInputList().clear(); @@ -310,7 +313,7 @@ public void setParallelRecipesPerformed(int amount) { protected void updateRecipeProgress() { if (canRecipeProgress && drawEnergy(recipeEUt, true)) { drawEnergy(recipeEUt, false); - //as recipe starts with progress on 1 this has to be > only not => to compensate for it + // as recipe starts with progress on 1 this has to be > only not => to compensate for it if (++progressTime > maxProgressTime) { completeRecipe(); } @@ -318,8 +321,8 @@ protected void updateRecipeProgress() { this.hasNotEnoughEnergy = false; } } else if (recipeEUt > 0) { - //only set hasNotEnoughEnergy if this recipe is consuming recipe - //generators always have enough energy + // only set hasNotEnoughEnergy if this recipe is consuming recipe + // generators always have enough energy this.hasNotEnoughEnergy = true; decreaseProgress(); } @@ -329,7 +332,7 @@ protected void updateRecipeProgress() { * Decrease the recipe progress time in the case that some state was not right, like available EU to drain. */ protected void decreaseProgress() { - //if current progress value is greater than 2, decrement it by 2 + // if current progress value is greater than 2, decrement it by 2 if (progressTime >= 2) { if (ConfigHolder.machines.recipeProgressLowEnergy) { this.progressTime = 1; @@ -437,7 +440,8 @@ protected boolean checkCleanroomRequirement(@Nonnull Recipe recipe) { * @return true if the recipe was successfully prepared, else false */ protected boolean prepareRecipe(Recipe recipe) { - recipe = Recipe.trimRecipeOutputs(recipe, getRecipeMap(), metaTileEntity.getItemOutputLimit(), metaTileEntity.getFluidOutputLimit()); + recipe = Recipe.trimRecipeOutputs(recipe, getRecipeMap(), metaTileEntity.getItemOutputLimit(), + metaTileEntity.getFluidOutputLimit()); // Pass in the trimmed recipe to the parallel logic recipe = findParallelRecipe( @@ -467,6 +471,7 @@ public int getParallelLimit() { /** * Set the parallel limit + * * @param amount the amount to set */ public void setParallelLimit(int amount) { @@ -499,8 +504,9 @@ protected static int getMinTankCapacity(@Nonnull IMultipleTankHandler tanks) { /** * Find a recipe using inputs - * @param maxVoltage the maximum voltage the recipe can have - * @param inputs the item inputs used to search for the recipe + * + * @param maxVoltage the maximum voltage the recipe can have + * @param inputs the item inputs used to search for the recipe * @param fluidInputs the fluid inputs used to search for the recipe * @return the recipe if found, otherwise null */ @@ -534,7 +540,8 @@ protected static boolean areItemStacksEqual(@Nonnull ItemStack stackA, @Nonnull } /** - * Determines if the provided recipe is possible to run from the provided inventory, or if there is anything preventing + * Determines if the provided recipe is possible to run from the provided inventory, or if there is anything + * preventing * the Recipe from being completed. *

* Will consume the inputs of the Recipe if it is possible to run. @@ -545,7 +552,8 @@ protected static boolean areItemStacksEqual(@Nonnull ItemStack stackA, @Nonnull * a specific bus * @return - true if the recipe is successful, false if the recipe is not successful */ - protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable importInventory) { + protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, + @Nonnull IItemHandlerModifiable importInventory) { this.overclockResults = calculateOverclock(recipe); modifyOverclockPost(overclockResults, recipe.getRecipePropertyStorage()); @@ -560,13 +568,15 @@ protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, @Nonnull I // We have already trimmed outputs and chanced outputs at this time // Attempt to merge all outputs + chanced outputs into the output bus, to prevent voiding chanced outputs - if (!metaTileEntity.canVoidRecipeItemOutputs() && !GTTransferUtils.addItemsToItemHandler(exportInventory, true, recipe.getAllItemOutputs())) { + if (!metaTileEntity.canVoidRecipeItemOutputs() && + !GTTransferUtils.addItemsToItemHandler(exportInventory, true, recipe.getAllItemOutputs())) { this.isOutputsFull = true; return false; } // We have already trimmed fluid outputs at this time - if (!metaTileEntity.canVoidRecipeFluidOutputs() && !GTTransferUtils.addFluidsToFluidHandler(exportFluids, true, recipe.getAllFluidOutputs())) { + if (!metaTileEntity.canVoidRecipeFluidOutputs() && + !GTTransferUtils.addFluidsToFluidHandler(exportFluids, true, recipe.getAllFluidOutputs())) { this.isOutputsFull = true; return false; } @@ -587,7 +597,7 @@ protected boolean hasEnoughPower(@Nonnull int[] resultOverclock) { // Format of resultOverclock: EU/t, duration int totalEUt = resultOverclock[0] * resultOverclock[1]; - //RIP Ternary + // RIP Ternary // Power Consumption case if (totalEUt >= 0) { int capacity; @@ -618,7 +628,7 @@ protected boolean hasEnoughPower(@Nonnull int[] resultOverclock) { * Is always called, even if no overclocks are performed. * * @param overclockResults The overclocked recipe EUt and duration, in format [EUt, duration] - * @param storage the RecipePropertyStorage of the recipe being processed + * @param storage the RecipePropertyStorage of the recipe being processed */ protected void modifyOverclockPost(int[] overclockResults, @Nonnull IRecipePropertyStorage storage) {} @@ -643,15 +653,16 @@ protected int[] calculateOverclock(@Nonnull Recipe recipe) { */ @Nonnull protected int[] performOverclocking(@Nonnull Recipe recipe) { - int[] values = {recipe.getEUt(), recipe.getDuration(), getNumberOfOCs(recipe.getEUt())}; + int[] values = { recipe.getEUt(), recipe.getDuration(), getNumberOfOCs(recipe.getEUt()) }; modifyOverclockPre(values, recipe.getRecipePropertyStorage()); if (values[2] <= 0) { // number of OCs is <= 0, so do not overclock - return new int[]{values[0], values[1]}; + return new int[] { values[0], values[1] }; } - return runOverclockingLogic(recipe.getRecipePropertyStorage(), values[0], getMaximumOverclockVoltage(), values[1], values[2]); + return runOverclockingLogic(recipe.getRecipePropertyStorage(), values[0], getMaximumOverclockVoltage(), + values[1], values[2]); } /** @@ -695,15 +706,15 @@ protected void modifyOverclockPre(@Nonnull int[] values, @Nonnull IRecipePropert * @return an int array of {OverclockedEUt, OverclockedDuration} */ @Nonnull - protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, long maxVoltage, int duration, int amountOC) { + protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, + long maxVoltage, int duration, int amountOC) { return standardOverclockingLogic( Math.abs(recipeEUt), maxVoltage, duration, amountOC, getOverclockingDurationDivisor(), - getOverclockingVoltageMultiplier() - ); + getOverclockingVoltageMultiplier()); } /** @@ -721,7 +732,8 @@ protected double getOverclockingVoltageMultiplier() { } /** - * Finds the maximum tier that a recipe can overclock to, when provided the maximum voltage a recipe can overclock to. + * Finds the maximum tier that a recipe can overclock to, when provided the maximum voltage a recipe can overclock + * to. * * @param voltage The maximum voltage the recipe is allowed to overclock to. * @return the highest voltage tier the machine should use to overclock with @@ -732,7 +744,8 @@ protected int getOverclockForTier(long voltage) { /** * Creates an array of Voltage Names that the machine/multiblock can overclock to. - * Since this is for use with the customizable overclock button, all tiers up to {@link AbstractRecipeLogic#getMaxVoltage()} + * Since this is for use with the customizable overclock button, all tiers up to + * {@link AbstractRecipeLogic#getMaxVoltage()} * are allowed, since the button is initialized to this value. * * @return a String array of the voltage names allowed to be used for overclocking @@ -756,8 +769,10 @@ protected void setupRecipe(Recipe recipe) { this.recipeEUt = overclockResults[0]; int recipeTier = GTUtility.getTierByVoltage(recipe.getEUt()); int machineTier = getOverclockForTier(getMaximumOverclockVoltage()); - this.fluidOutputs = GTUtility.copyFluidList(recipe.getResultFluidOutputs(recipeTier, machineTier, getRecipeMap())); - this.itemOutputs = GTUtility.copyStackList(recipe.getResultItemOutputs(recipeTier, machineTier, getRecipeMap())); + this.fluidOutputs = GTUtility + .copyFluidList(recipe.getResultFluidOutputs(recipeTier, machineTier, getRecipeMap())); + this.itemOutputs = GTUtility + .copyStackList(recipe.getResultItemOutputs(recipeTier, machineTier, getRecipeMap())); if (this.wasActiveAndNeedsUpdate) { this.wasActiveAndNeedsUpdate = false; @@ -779,7 +794,7 @@ protected void completeRecipe() { this.hasNotEnoughEnergy = false; this.wasActiveAndNeedsUpdate = true; this.parallelRecipesPerformed = 0; - this.overclockResults = new int[]{0, 0}; + this.overclockResults = new int[] { 0, 0 }; } /** @@ -1026,5 +1041,4 @@ public void deserializeNBT(@Nonnull NBTTagCompound compound) { } } } - } diff --git a/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java index d16ecba4bbd..f7cd06dda87 100644 --- a/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java @@ -9,6 +9,7 @@ import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.MetaTileEntityLargeBoiler; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -18,11 +19,12 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.BOILER_HEAT; import static gregtech.api.capability.GregtechDataCodes.BOILER_LAST_TICK_STEAM; @@ -54,13 +56,15 @@ public void update() { @Override protected boolean canProgressRecipe() { - return super.canProgressRecipe() && !(metaTileEntity instanceof IMultiblockController && ((IMultiblockController) metaTileEntity).isStructureObstructed()); + return super.canProgressRecipe() && !(metaTileEntity instanceof IMultiblockController && + ((IMultiblockController) metaTileEntity).isStructureObstructed()); } @Override protected void trySearchNewRecipe() { MetaTileEntityLargeBoiler boiler = (MetaTileEntityLargeBoiler) metaTileEntity; - if (ConfigHolder.machines.enableMaintenance && boiler.hasMaintenanceMechanics() && boiler.getNumMaintenanceProblems() > 5) { + if (ConfigHolder.machines.enableMaintenance && boiler.hasMaintenanceMechanics() && + boiler.getNumMaintenanceProblems() > 5) { return; } @@ -77,10 +81,12 @@ protected void trySearchNewRecipe() { Recipe dieselRecipe = RecipeMaps.COMBUSTION_GENERATOR_FUELS.findRecipe( GTValues.V[GTValues.MAX], dummyList, Collections.singletonList(fuelStack)); // run only if it can apply a certain amount of "parallel", this is to mitigate int division - if (dieselRecipe != null && fuelStack.amount >= dieselRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER) { + if (dieselRecipe != null && + fuelStack.amount >= dieselRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER) { fluidTank.drain(dieselRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER, true); // divide by 2, as it is half burntime for combustion - setMaxProgress(adjustBurnTimeForThrottle(Math.max(1, boiler.boilerType.runtimeBoost((Math.abs(dieselRecipe.getEUt()) * dieselRecipe.getDuration()) / FLUID_BURNTIME_TO_EU / 2)))); + setMaxProgress(adjustBurnTimeForThrottle(Math.max(1, boiler.boilerType.runtimeBoost( + (Math.abs(dieselRecipe.getEUt()) * dieselRecipe.getDuration()) / FLUID_BURNTIME_TO_EU / 2)))); didStartRecipe = true; break; } @@ -88,10 +94,13 @@ protected void trySearchNewRecipe() { Recipe denseFuelRecipe = RecipeMaps.SEMI_FLUID_GENERATOR_FUELS.findRecipe( GTValues.V[GTValues.MAX], dummyList, Collections.singletonList(fuelStack)); // run only if it can apply a certain amount of "parallel", this is to mitigate int division - if (denseFuelRecipe != null && fuelStack.amount >= denseFuelRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER) { + if (denseFuelRecipe != null && + fuelStack.amount >= denseFuelRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER) { fluidTank.drain(denseFuelRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER, true); // multiply by 2, as it is 2x burntime for semi-fluid - setMaxProgress(adjustBurnTimeForThrottle(Math.max(1, boiler.boilerType.runtimeBoost((Math.abs(denseFuelRecipe.getEUt()) * denseFuelRecipe.getDuration() / FLUID_BURNTIME_TO_EU * 2))))); + setMaxProgress(adjustBurnTimeForThrottle( + Math.max(1, boiler.boilerType.runtimeBoost((Math.abs(denseFuelRecipe.getEUt()) * + denseFuelRecipe.getDuration() / FLUID_BURNTIME_TO_EU * 2))))); didStartRecipe = true; break; } @@ -107,7 +116,8 @@ protected void trySearchNewRecipe() { this.excessFuel += fuelBurnTime % 80; int excessProgress = this.excessFuel / 80; this.excessFuel %= 80; - setMaxProgress(excessProgress + adjustBurnTimeForThrottle(boiler.boilerType.runtimeBoost(fuelBurnTime / 80))); + setMaxProgress(excessProgress + + adjustBurnTimeForThrottle(boiler.boilerType.runtimeBoost(fuelBurnTime / 80))); stack.shrink(1); didStartRecipe = true; break; @@ -157,7 +167,8 @@ protected void updateRecipeProgress() { private int getMaximumHeatFromMaintenance() { if (ConfigHolder.machines.enableMaintenance) { - return (int) Math.min(currentHeat, (1 - 0.1 * getMetaTileEntity().getNumMaintenanceProblems()) * getMaximumHeat()); + return (int) Math.min(currentHeat, + (1 - 0.1 * getMetaTileEntity().getNumMaintenanceProblems()) * getMaximumHeat()); } else return currentHeat; } diff --git a/src/main/java/gregtech/api/capability/impl/CleanroomLogic.java b/src/main/java/gregtech/api/capability/impl/CleanroomLogic.java index 1d8044d93a6..42e4a24ae0f 100644 --- a/src/main/java/gregtech/api/capability/impl/CleanroomLogic.java +++ b/src/main/java/gregtech/api/capability/impl/CleanroomLogic.java @@ -5,6 +5,7 @@ import gregtech.api.metatileentity.multiblock.ICleanroomProvider; import gregtech.api.metatileentity.multiblock.IMaintenance; import gregtech.common.ConfigHolder; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraft.world.World; @@ -32,7 +33,8 @@ public class CleanroomLogic { public CleanroomLogic(MetaTileEntity metaTileEntity, int minEnergyTier) { this.metaTileEntity = metaTileEntity; this.minEnergyTier = minEnergyTier; - this.hasMaintenance = ConfigHolder.machines.enableMaintenance && ((IMaintenance) metaTileEntity).hasMaintenanceMechanics(); + this.hasMaintenance = ConfigHolder.machines.enableMaintenance && + ((IMaintenance) metaTileEntity).hasMaintenanceMechanics(); } /** @@ -121,7 +123,8 @@ public void setWorkingEnabled(boolean workingEnabled) { this.metaTileEntity.markDirty(); World world = this.metaTileEntity.getWorld(); if (world != null && !world.isRemote) { - this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKING_ENABLED, buf -> buf.writeBoolean(workingEnabled)); + this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKING_ENABLED, + buf -> buf.writeBoolean(workingEnabled)); } } @@ -177,7 +180,8 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { /** * reads all needed values from NBT - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} method + * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} + * method */ public void readFromNBT(@Nonnull NBTTagCompound data) { this.isActive = data.getBoolean("isActive"); @@ -189,7 +193,8 @@ public void readFromNBT(@Nonnull NBTTagCompound data) { /** * writes all needed values to InitialSyncData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method */ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { buf.writeBoolean(this.isActive); @@ -201,7 +206,8 @@ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { /** * reads all needed values from InitialSyncData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method */ public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { setActive(buf.readBoolean()); @@ -213,7 +219,8 @@ public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { /** * reads all needed values from CustomData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#receiveCustomData(int, PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#receiveCustomData(int, PacketBuffer)} method */ public void receiveCustomData(int dataId, PacketBuffer buf) { if (dataId == GregtechDataCodes.IS_WORKING) { diff --git a/src/main/java/gregtech/api/capability/impl/CombinedCapabilityProvider.java b/src/main/java/gregtech/api/capability/impl/CombinedCapabilityProvider.java index 837aac7bcfc..1b02128f099 100644 --- a/src/main/java/gregtech/api/capability/impl/CombinedCapabilityProvider.java +++ b/src/main/java/gregtech/api/capability/impl/CombinedCapabilityProvider.java @@ -4,9 +4,10 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class CombinedCapabilityProvider implements ICapabilityProvider { diff --git a/src/main/java/gregtech/api/capability/impl/CommonFluidFilters.java b/src/main/java/gregtech/api/capability/impl/CommonFluidFilters.java index 8a2b633df16..6b76b5adc35 100644 --- a/src/main/java/gregtech/api/capability/impl/CommonFluidFilters.java +++ b/src/main/java/gregtech/api/capability/impl/CommonFluidFilters.java @@ -4,6 +4,7 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; import gregtech.common.ConfigHolder; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -14,7 +15,9 @@ * Common fluid filter implementations. */ public enum CommonFluidFilters implements IFilter { + ALLOW_ALL { + @Override public boolean test(@Nonnull FluidStack fluid) { return true; @@ -31,6 +34,7 @@ public IFilter negate() { } }, DISALLOW_ALL { + @Override public boolean test(@Nonnull FluidStack fluid) { return false; @@ -47,6 +51,7 @@ public IFilter negate() { } }, BOILER_FLUID { + @Override public boolean test(@Nonnull FluidStack fluid) { if (matchesFluid(fluid, FluidRegistry.WATER) || matchesFluid(fluid, Materials.DistilledWater)) { @@ -68,6 +73,7 @@ public int getPriority() { } }, STEAM { + @Override public boolean test(@Nonnull FluidStack fluid) { return matchesFluid(fluid, Materials.Steam); @@ -79,6 +85,7 @@ public int getPriority() { } }, LIGHTER_FUEL { + @Override public boolean test(@Nonnull FluidStack fluidStack) { return matchesFluid(fluidStack, Materials.Butane) || matchesFluid(fluidStack, Materials.Propane); diff --git a/src/main/java/gregtech/api/capability/impl/ComputationRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/ComputationRecipeLogic.java index 515a0159b15..ffd91c5d3ff 100644 --- a/src/main/java/gregtech/api/capability/impl/ComputationRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/ComputationRecipeLogic.java @@ -6,7 +6,9 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.recipeproperties.ComputationProperty; import gregtech.api.recipes.recipeproperties.TotalComputationProperty; + import net.minecraft.nbt.NBTTagCompound; + import org.jetbrains.annotations.NotNull; /** @@ -147,7 +149,6 @@ public void deserializeNBT(@NotNull NBTTagCompound compound) { } } - /** * @return Whether TOP / WAILA should show the recipe progress as duration or as total computation. */ diff --git a/src/main/java/gregtech/api/capability/impl/EUToFEProvider.java b/src/main/java/gregtech/api/capability/impl/EUToFEProvider.java index 327e04545de..beeba3c3d8f 100644 --- a/src/main/java/gregtech/api/capability/impl/EUToFEProvider.java +++ b/src/main/java/gregtech/api/capability/impl/EUToFEProvider.java @@ -6,6 +6,7 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; @@ -55,7 +56,6 @@ public GTEnergyWrapper(IEnergyStorage energyStorage) { @Override public long acceptEnergyFromNetwork(EnumFacing facing, long voltage, long amperage) { - int receive = 0; // Try to use the internal buffer before consuming a new packet @@ -162,9 +162,12 @@ public long getEnergyStored() { } /** - * Most RF/FE cables blindly try to insert energy without checking if there is space, since the receiving IEnergyStorage should handle it. - * This simulates that behavior in most places by allowing our "is there space" checks to pass and letting the cable attempt to insert energy. - * If the wrapped TE actually cannot accept any more energy, the energy transfer will return 0 before any changes to our internal rf buffer. + * Most RF/FE cables blindly try to insert energy without checking if there is space, since the receiving + * IEnergyStorage should handle it. + * This simulates that behavior in most places by allowing our "is there space" checks to pass and letting the + * cable attempt to insert energy. + * If the wrapped TE actually cannot accept any more energy, the energy transfer will return 0 before any + * changes to our internal rf buffer. */ @Override public long getEnergyCanBeInserted() { diff --git a/src/main/java/gregtech/api/capability/impl/ElectricItem.java b/src/main/java/gregtech/api/capability/impl/ElectricItem.java index 05fab8d05da..9300b8bed9d 100644 --- a/src/main/java/gregtech/api/capability/impl/ElectricItem.java +++ b/src/main/java/gregtech/api/capability/impl/ElectricItem.java @@ -3,6 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IElectricItem; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; @@ -10,12 +11,13 @@ import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.Constants.NBT; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.function.BiConsumer; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class ElectricItem implements IElectricItem, ICapabilityProvider { protected final ItemStack itemStack; @@ -28,7 +30,8 @@ public class ElectricItem implements IElectricItem, ICapabilityProvider { protected final List> listeners = new ArrayList<>(); - public ElectricItem(ItemStack itemStack, long maxCharge, int tier, boolean chargeable, boolean canProvideEnergyExternally) { + public ElectricItem(ItemStack itemStack, long maxCharge, int tier, boolean chargeable, + boolean canProvideEnergyExternally) { this.itemStack = itemStack; this.maxCharge = maxCharge; this.tier = tier; @@ -45,7 +48,7 @@ public void setCharge(long change) { if (!itemStack.hasTagCompound()) { itemStack.setTagCompound(new NBTTagCompound()); } - //noinspection ConstantConditions + // noinspection ConstantConditions itemStack.getTagCompound().setLong("Charge", change); listeners.forEach(l -> l.accept(itemStack, change)); } @@ -54,7 +57,7 @@ public void setMaxChargeOverride(long maxCharge) { if (!itemStack.hasTagCompound()) { itemStack.setTagCompound(new NBTTagCompound()); } - //noinspection ConstantConditions + // noinspection ConstantConditions itemStack.getTagCompound().setLong("MaxCharge", maxCharge); } @@ -86,7 +89,7 @@ public void setInfiniteCharge(boolean infiniteCharge) { if (!itemStack.hasTagCompound()) { itemStack.setTagCompound(new NBTTagCompound()); } - //noinspection ConstantConditions + // noinspection ConstantConditions itemStack.getTagCompound().setBoolean("Infinite", infiniteCharge); listeners.forEach(l -> l.accept(itemStack, getMaxCharge())); } @@ -121,11 +124,13 @@ public long charge(long amount, int chargerTier, boolean ignoreTransferLimit, bo } @Override - public long discharge(long amount, int chargerTier, boolean ignoreTransferLimit, boolean externally, boolean simulate) { + public long discharge(long amount, int chargerTier, boolean ignoreTransferLimit, boolean externally, + boolean simulate) { if (itemStack.getCount() != 1) { return 0L; } - if ((canProvideEnergyExternally || !externally || amount == Long.MAX_VALUE) && (chargerTier >= tier) && amount > 0L) { + if ((canProvideEnergyExternally || !externally || amount == Long.MAX_VALUE) && (chargerTier >= tier) && + amount > 0L) { if (!ignoreTransferLimit) { amount = Math.min(amount, getTransferLimit()); } diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java index bfe8fb75dbc..b1e61ce109f 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java @@ -5,6 +5,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -12,10 +13,11 @@ import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + public class EnergyContainerBatteryBuffer extends EnergyContainerHandler { public static final long AMPS_PER_BATTERY = 2L; @@ -23,7 +25,8 @@ public class EnergyContainerBatteryBuffer extends EnergyContainerHandler { private final int tier; public EnergyContainerBatteryBuffer(MetaTileEntity metaTileEntity, int tier, int inventorySize) { - super(metaTileEntity, GTValues.V[tier] * inventorySize * 32L, GTValues.V[tier], inventorySize * AMPS_PER_BATTERY, GTValues.V[tier], inventorySize); + super(metaTileEntity, GTValues.V[tier] * inventorySize * 32L, GTValues.V[tier], + inventorySize * AMPS_PER_BATTERY, GTValues.V[tier], inventorySize); this.tier = tier; } @@ -44,7 +47,7 @@ public long acceptEnergyFromNetwork(EnumFacing side, long voltage, long amperage return usedAmps; } - //Prioritizes as many packets as available from the buffer + // Prioritizes as many packets as available from the buffer long internalAmps = Math.min(maxAmps, Math.max(0, getInternalStorage() / voltage)); usedAmps = Math.min(usedAmps, maxAmps - internalAmps); @@ -57,14 +60,17 @@ public long acceptEnergyFromNetwork(EnumFacing side, long voltage, long amperage for (Object item : batteries) { if (item instanceof IElectricItem) { IElectricItem electricItem = (IElectricItem) item; - energy -= electricItem.charge(Math.min(distributed, GTValues.V[electricItem.getTier()] * AMPS_PER_BATTERY), getTier(), true, false); + energy -= electricItem.charge( + Math.min(distributed, GTValues.V[electricItem.getTier()] * AMPS_PER_BATTERY), getTier(), + true, false); } else if (item instanceof IEnergyStorage) { IEnergyStorage energyStorage = (IEnergyStorage) item; - energy -= FeCompat.insertEu(energyStorage, Math.min(distributed, GTValues.V[getTier()] * AMPS_PER_BATTERY)); + energy -= FeCompat.insertEu(energyStorage, + Math.min(distributed, GTValues.V[getTier()] * AMPS_PER_BATTERY)); } } - //Remove energy used and then transfer overflow energy into the internal buffer + // Remove energy used and then transfer overflow energy into the internal buffer setEnergyStored(getInternalStorage() - internalAmps * voltage + energy); return usedAmps; } @@ -89,7 +95,8 @@ public void update() { if (tileEntity == null) { return; } - IEnergyContainer energyContainer = tileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, outFacing.getOpposite()); + IEnergyContainer energyContainer = tileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + outFacing.getOpposite()); if (energyContainer == null) { return; } @@ -97,7 +104,7 @@ public void update() { long voltage = getOutputVoltage(); List batteries = getNonEmptyBatteries(); if (batteries.size() > 0) { - //Prioritize as many packets as available of energy created + // Prioritize as many packets as available of energy created long internalAmps = Math.abs(Math.min(0, getInternalStorage() / voltage)); long genAmps = Math.max(0, batteries.size() - internalAmps); long outAmps = 0L; @@ -116,7 +123,7 @@ public void update() { energy -= electricItem.discharge(distributed, getTier(), false, true, false); } - //Subtract energy created out of thin air from the buffer + // Subtract energy created out of thin air from the buffer setEnergyStored(getInternalStorage() + internalAmps * voltage - energy); } } diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryCharger.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryCharger.java index 29cfb4bc150..c335e09ddca 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryCharger.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryCharger.java @@ -7,6 +7,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraftforge.energy.CapabilityEnergy; @@ -43,7 +44,7 @@ public long acceptEnergyFromNetwork(EnumFacing side, long voltage, long amperage metaTileEntity.doExplosion(GTUtility.getExplosionPower(voltage)); } - //Prioritizes as many packets as available from the buffer + // Prioritizes as many packets as available from the buffer long internalAmps = Math.min(maxAmps, Math.max(0, getInternalStorage() / voltage)); usedAmps = Math.min(usedAmps, maxAmps - internalAmps); @@ -56,14 +57,17 @@ public long acceptEnergyFromNetwork(EnumFacing side, long voltage, long amperage for (Object item : batteries) { if (item instanceof IElectricItem) { IElectricItem electricItem = (IElectricItem) item; - energy -= electricItem.charge(Math.min(distributed, GTValues.V[electricItem.getTier()] * AMPS_PER_BATTERY), getTier(), true, false); + energy -= electricItem.charge( + Math.min(distributed, GTValues.V[electricItem.getTier()] * AMPS_PER_BATTERY), getTier(), + true, false); } else if (item instanceof IEnergyStorage) { IEnergyStorage energyStorage = (IEnergyStorage) item; - energy -= FeCompat.insertEu(energyStorage, Math.min(distributed, GTValues.V[getTier()] * AMPS_PER_BATTERY)); + energy -= FeCompat.insertEu(energyStorage, + Math.min(distributed, GTValues.V[getTier()] * AMPS_PER_BATTERY)); } } - //Remove energy used and then transfer overflow energy into the internal buffer + // Remove energy used and then transfer overflow energy into the internal buffer setEnergyStored(getInternalStorage() - internalAmps * voltage + energy); return usedAmps; } diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java index 51b10e197ca..9d3ad8b26b6 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java @@ -6,6 +6,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -15,9 +16,10 @@ import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class EnergyContainerHandler extends MTETrait implements IEnergyContainer { protected final long maxCapacity; @@ -39,7 +41,8 @@ public class EnergyContainerHandler extends MTETrait implements IEnergyContainer protected long amps = 0; - public EnergyContainerHandler(MetaTileEntity tileEntity, long maxCapacity, long maxInputVoltage, long maxInputAmperage, long maxOutputVoltage, long maxOutputAmperage) { + public EnergyContainerHandler(MetaTileEntity tileEntity, long maxCapacity, long maxInputVoltage, + long maxInputAmperage, long maxOutputVoltage, long maxOutputAmperage) { super(tileEntity); this.maxCapacity = maxCapacity; this.maxInputVoltage = maxInputVoltage; @@ -56,11 +59,13 @@ public void setSideOutputCondition(Predicate sideOutputCondition) { this.sideOutputCondition = sideOutputCondition; } - public static EnergyContainerHandler emitterContainer(MetaTileEntity tileEntity, long maxCapacity, long maxOutputVoltage, long maxOutputAmperage) { + public static EnergyContainerHandler emitterContainer(MetaTileEntity tileEntity, long maxCapacity, + long maxOutputVoltage, long maxOutputAmperage) { return new EnergyContainerHandler(tileEntity, maxCapacity, 0L, 0L, maxOutputVoltage, maxOutputAmperage); } - public static EnergyContainerHandler receiverContainer(MetaTileEntity tileEntity, long maxCapacity, long maxInputVoltage, long maxInputAmperage) { + public static EnergyContainerHandler receiverContainer(MetaTileEntity tileEntity, long maxCapacity, + long maxInputVoltage, long maxInputAmperage) { return new EnergyContainerHandler(tileEntity, maxCapacity, maxInputVoltage, maxInputAmperage, 0L, 0L); } @@ -201,10 +206,13 @@ public void update() { if (!outputsEnergy(side)) continue; TileEntity tileEntity = metaTileEntity.getNeighbor(side); EnumFacing oppositeSide = side.getOpposite(); - if (tileEntity != null && tileEntity.hasCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, oppositeSide)) { - IEnergyContainer energyContainer = tileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, oppositeSide); + if (tileEntity != null && + tileEntity.hasCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, oppositeSide)) { + IEnergyContainer energyContainer = tileEntity + .getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, oppositeSide); if (energyContainer == null || !energyContainer.inputsEnergy(oppositeSide)) continue; - amperesUsed += energyContainer.acceptEnergyFromNetwork(oppositeSide, outputVoltage, outputAmperes - amperesUsed); + amperesUsed += energyContainer.acceptEnergyFromNetwork(oppositeSide, outputVoltage, + outputAmperes - amperesUsed); if (amperesUsed == outputAmperes) break; } } @@ -242,7 +250,8 @@ public long getEnergyCapacity() { @Override public boolean inputsEnergy(EnumFacing side) { - return !outputsEnergy(side) && getInputVoltage() > 0 && (sideInputCondition == null || sideInputCondition.test(side)); + return !outputsEnergy(side) && getInputVoltage() > 0 && + (sideInputCondition == null || sideInputCondition.test(side)); } @Override @@ -253,7 +262,8 @@ public boolean outputsEnergy(EnumFacing side) { @Override public long changeEnergy(long energyToAdd) { long oldEnergyStored = getEnergyStored(); - long newEnergyStored = (maxCapacity - oldEnergyStored < energyToAdd) ? maxCapacity : (oldEnergyStored + energyToAdd); + long newEnergyStored = (maxCapacity - oldEnergyStored < energyToAdd) ? maxCapacity : + (oldEnergyStored + energyToAdd); if (newEnergyStored < 0) newEnergyStored = 0; setEnergyStored(newEnergyStored); @@ -281,6 +291,7 @@ public long getInputVoltage() { } public interface IEnergyChangeListener { + void onEnergyChanged(IEnergyContainer container, boolean isInitialChange); } diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java index 4d296a86e78..da175b75639 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java @@ -1,11 +1,13 @@ package gregtech.api.capability.impl; import gregtech.api.capability.IEnergyContainer; + import net.minecraft.util.EnumFacing; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class EnergyContainerList implements IEnergyContainer { private final List energyContainerList; @@ -55,7 +57,7 @@ public EnergyContainerList(@Nonnull List energyContainerList) /** * Computes the correct max voltage and amperage values * - * @param voltage the sum of voltage * amperage for each hatch + * @param voltage the sum of voltage * amperage for each hatch * @param amperage the total amperage of all hatches * * @return [newVoltage, newAmperage] @@ -89,7 +91,7 @@ private static long[] calculateVoltageAmperage(long voltage, long amperage) { amperage = 1; } } - return new long[]{voltage, amperage}; + return new long[] { voltage, amperage }; } private static boolean hasPrimeFactorGreaterThanTwo(long l) { @@ -185,7 +187,9 @@ public long getHighestInputVoltage() { return highestInputVoltage; } - /** The number of parts with voltage specified in {@link EnergyContainerList#getHighestInputVoltage()} in this list. */ + /** + * The number of parts with voltage specified in {@link EnergyContainerList#getHighestInputVoltage()} in this list. + */ public int getNumHighestInputContainers() { return numHighestInputContainers; } diff --git a/src/main/java/gregtech/api/capability/impl/FilteredFluidHandler.java b/src/main/java/gregtech/api/capability/impl/FilteredFluidHandler.java index 79fcffa9029..ad8765c5ed5 100644 --- a/src/main/java/gregtech/api/capability/impl/FilteredFluidHandler.java +++ b/src/main/java/gregtech/api/capability/impl/FilteredFluidHandler.java @@ -2,6 +2,7 @@ import gregtech.api.capability.IFilter; import gregtech.api.capability.IFilteredFluidContainer; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; diff --git a/src/main/java/gregtech/api/capability/impl/FilteredItemHandler.java b/src/main/java/gregtech/api/capability/impl/FilteredItemHandler.java index 38f9d0966cf..2ed16f744af 100644 --- a/src/main/java/gregtech/api/capability/impl/FilteredItemHandler.java +++ b/src/main/java/gregtech/api/capability/impl/FilteredItemHandler.java @@ -2,13 +2,15 @@ import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.metatileentity.MetaTileEntity; + import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; -import javax.annotation.Nonnull; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class FilteredItemHandler extends GTItemStackHandler { public static Predicate getCapabilityFilter(Capability cap) { @@ -18,7 +20,7 @@ public static Predicate getCapabilityFilter(Capability cap) { private Predicate fillPredicate; public FilteredItemHandler(MetaTileEntity metaTileEntity) { - super(metaTileEntity,1); + super(metaTileEntity, 1); } public FilteredItemHandler(MetaTileEntity metaTileEntity, int size) { diff --git a/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java b/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java index 5f1a92a70b6..20f762df005 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java +++ b/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java @@ -6,6 +6,7 @@ import gregtech.api.worldgen.bedrockFluids.BedrockFluidVeinHandler; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.electric.MetaTileEntityFluidDrill; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fluids.Fluid; @@ -48,7 +49,6 @@ public void performDrilling() { if (!acquireNewFluid()) return; // stop if we still have no fluid - // drills that cannot work do nothing if (!this.isWorkingEnabled) return; @@ -113,11 +113,14 @@ protected void depleteVein() { } public int getFluidToProduce() { - int depletedYield = BedrockFluidVeinHandler.getDepletedFluidYield(metaTileEntity.getWorld(), getChunkX(), getChunkZ()); + int depletedYield = BedrockFluidVeinHandler.getDepletedFluidYield(metaTileEntity.getWorld(), getChunkX(), + getChunkZ()); int regularYield = BedrockFluidVeinHandler.getFluidYield(metaTileEntity.getWorld(), getChunkX(), getChunkZ()); - int remainingOperations = BedrockFluidVeinHandler.getOperationsRemaining(metaTileEntity.getWorld(), getChunkX(), getChunkZ()); + int remainingOperations = BedrockFluidVeinHandler.getOperationsRemaining(metaTileEntity.getWorld(), getChunkX(), + getChunkZ()); - int produced = Math.max(depletedYield, regularYield * remainingOperations / BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS); + int produced = Math.max(depletedYield, + regularYield * remainingOperations / BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS); produced *= metaTileEntity.getRigMultiplier(); // Overclocks produce 50% more fluid @@ -144,7 +147,8 @@ protected boolean checkCanDrain() { return false; } - if (this.hasNotEnoughEnergy && metaTileEntity.getEnergyInputPerSecond() > 19L * GTValues.VA[metaTileEntity.getEnergyTier()]) { + if (this.hasNotEnoughEnergy && + metaTileEntity.getEnergyInputPerSecond() > 19L * GTValues.VA[metaTileEntity.getEnergyTier()]) { this.hasNotEnoughEnergy = false; } @@ -200,7 +204,8 @@ public void setWorkingEnabled(boolean isWorkingEnabled) { this.isWorkingEnabled = isWorkingEnabled; metaTileEntity.markDirty(); if (metaTileEntity.getWorld() != null && !metaTileEntity.getWorld().isRemote) { - this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKING_ENABLED, buf -> buf.writeBoolean(isWorkingEnabled)); + this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKING_ENABLED, + buf -> buf.writeBoolean(isWorkingEnabled)); } } } @@ -261,7 +266,8 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { /** * reads all needed values from NBT - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} method + * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} + * method */ public void readFromNBT(@Nonnull NBTTagCompound data) { this.isActive = data.getBoolean("isActive"); @@ -274,7 +280,8 @@ public void readFromNBT(@Nonnull NBTTagCompound data) { /** * writes all needed values to InitialSyncData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method */ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { buf.writeBoolean(this.isActive); @@ -286,7 +293,8 @@ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { /** * reads all needed values from InitialSyncData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method */ public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { setActive(buf.readBoolean()); @@ -298,7 +306,8 @@ public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { /** * reads all needed values from CustomData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#receiveCustomData(int, PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#receiveCustomData(int, PacketBuffer)} method */ public void receiveCustomData(int dataId, PacketBuffer buf) { if (dataId == GregtechDataCodes.WORKABLE_ACTIVE) { diff --git a/src/main/java/gregtech/api/capability/impl/FluidHandlerProxy.java b/src/main/java/gregtech/api/capability/impl/FluidHandlerProxy.java index a0cd2b982b8..a4bf50ed9b8 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidHandlerProxy.java +++ b/src/main/java/gregtech/api/capability/impl/FluidHandlerProxy.java @@ -1,14 +1,16 @@ package gregtech.api.capability.impl; -import com.google.common.collect.Lists; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nullable; +import com.google.common.collect.Lists; + import java.util.Collections; import java.util.List; +import javax.annotation.Nullable; + public class FluidHandlerProxy implements IFluidHandler { public IFluidHandler input; diff --git a/src/main/java/gregtech/api/capability/impl/FluidTankList.java b/src/main/java/gregtech/api/capability/impl/FluidTankList.java index 848652265a8..41b9de569b6 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidTankList.java +++ b/src/main/java/gregtech/api/capability/impl/FluidTankList.java @@ -1,6 +1,7 @@ package gregtech.api.capability.impl; import gregtech.api.capability.IMultipleTankHandler; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.common.util.Constants; @@ -9,13 +10,14 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class FluidTankList implements IMultipleTankHandler, INBTSerializable { private final MultiFluidTankEntry[] fluidTanks; @@ -35,7 +37,8 @@ public FluidTankList(boolean allowSameFluidFill, @Nonnull List list = new ArrayList<>(parent.getFluidTanks()); for (IFluidTank tank : additionalTanks) list.add(wrapIntoEntry(tank)); this.fluidTanks = list.toArray(new MultiFluidTankEntry[0]); diff --git a/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java index ce7eaa6c468..f126e354753 100644 --- a/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java @@ -6,19 +6,21 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; -import javax.annotation.Nonnull; import java.util.function.Supplier; +import javax.annotation.Nonnull; + public class FuelRecipeLogic extends RecipeLogicEnergy { - public FuelRecipeLogic(MetaTileEntity tileEntity, RecipeMap recipeMap, Supplier energyContainer) { + public FuelRecipeLogic(MetaTileEntity tileEntity, RecipeMap recipeMap, + Supplier energyContainer) { super(tileEntity, recipeMap, energyContainer); } @Nonnull @Override public ParallelLogicType getParallelLogicType() { - return ParallelLogicType.MULTIPLY; //TODO APPEND_FLUIDS + return ParallelLogicType.MULTIPLY; // TODO APPEND_FLUIDS } @Override diff --git a/src/main/java/gregtech/api/capability/impl/GTFluidHandlerItemStack.java b/src/main/java/gregtech/api/capability/impl/GTFluidHandlerItemStack.java index dabb85647cb..d55f0477dfc 100644 --- a/src/main/java/gregtech/api/capability/impl/GTFluidHandlerItemStack.java +++ b/src/main/java/gregtech/api/capability/impl/GTFluidHandlerItemStack.java @@ -2,6 +2,7 @@ import gregtech.api.capability.IFilter; import gregtech.api.capability.IFilteredFluidContainer; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidTankProperties; @@ -62,7 +63,7 @@ public GTFluidHandlerItemStack setCanDrain(boolean canDrain) { @Override public IFluidTankProperties[] getTankProperties() { if (properties == null) { - return properties = new IFluidTankProperties[]{new TankProperties()}; + return properties = new IFluidTankProperties[] { new TankProperties() }; } return properties; } diff --git a/src/main/java/gregtech/api/capability/impl/GTSimpleFluidHandlerItemStack.java b/src/main/java/gregtech/api/capability/impl/GTSimpleFluidHandlerItemStack.java index 86bb0457652..6eda40fbc36 100644 --- a/src/main/java/gregtech/api/capability/impl/GTSimpleFluidHandlerItemStack.java +++ b/src/main/java/gregtech/api/capability/impl/GTSimpleFluidHandlerItemStack.java @@ -2,9 +2,9 @@ import gregtech.api.capability.IFilter; import gregtech.api.capability.IFilteredFluidContainer; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.FluidTankProperties; import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStackSimple; @@ -63,7 +63,7 @@ public GTSimpleFluidHandlerItemStack setCanDrain(boolean canDrain) { @Override public IFluidTankProperties[] getTankProperties() { if (properties == null) { - return properties = new IFluidTankProperties[]{new GTSimpleFluidHandlerItemStack.TankProperties()}; + return properties = new IFluidTankProperties[] { new GTSimpleFluidHandlerItemStack.TankProperties() }; } return properties; } diff --git a/src/main/java/gregtech/api/capability/impl/GhostCircuitItemStackHandler.java b/src/main/java/gregtech/api/capability/impl/GhostCircuitItemStackHandler.java index 8619510ff57..27854110540 100644 --- a/src/main/java/gregtech/api/capability/impl/GhostCircuitItemStackHandler.java +++ b/src/main/java/gregtech/api/capability/impl/GhostCircuitItemStackHandler.java @@ -4,17 +4,20 @@ import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.recipes.ingredients.IntCircuitIngredient; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.util.Constants; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; -public class GhostCircuitItemStackHandler extends GTItemStackHandler implements IItemHandlerModifiable, INotifiableHandler { +import javax.annotation.Nonnull; + +public class GhostCircuitItemStackHandler extends GTItemStackHandler + implements IItemHandlerModifiable, INotifiableHandler { /** * Special circuit value indicating no circuit value is set. @@ -166,7 +169,8 @@ public void write(@Nonnull NBTTagCompound tag) { } public void read(@Nonnull NBTTagCompound tag) { - int circuitValue = tag.hasKey("GhostCircuit", Constants.NBT.TAG_ANY_NUMERIC) ? tag.getInteger("GhostCircuit") : NO_CONFIG; + int circuitValue = tag.hasKey("GhostCircuit", Constants.NBT.TAG_ANY_NUMERIC) ? tag.getInteger("GhostCircuit") : + NO_CONFIG; if (circuitValue < IntCircuitIngredient.CIRCUIT_MIN || circuitValue > IntCircuitIngredient.CIRCUIT_MAX) circuitValue = NO_CONFIG; setCircuitValue(circuitValue); diff --git a/src/main/java/gregtech/api/capability/impl/HeatingCoilRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/HeatingCoilRecipeLogic.java index 0403a3559a7..2ddd1e750cf 100644 --- a/src/main/java/gregtech/api/capability/impl/HeatingCoilRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/HeatingCoilRecipeLogic.java @@ -34,14 +34,14 @@ protected void modifyOverclockPre(@Nonnull int[] values, @Nonnull IRecipePropert @Nonnull @Override - protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, long maxVoltage, int duration, int amountOC) { + protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, + long maxVoltage, int duration, int amountOC) { return heatingCoilOverclockingLogic( Math.abs(recipeEUt), maxVoltage, duration, amountOC, ((IHeatingCoil) metaTileEntity).getCurrentTemperature(), - propertyStorage.getRecipePropertyValue(TemperatureProperty.getInstance(), 0) - ); + propertyStorage.getRecipePropertyValue(TemperatureProperty.getInstance(), 0)); } } diff --git a/src/main/java/gregtech/api/capability/impl/ItemHandlerList.java b/src/main/java/gregtech/api/capability/impl/ItemHandlerList.java index b5ce1d118cb..6fcbe6379a9 100644 --- a/src/main/java/gregtech/api/capability/impl/ItemHandlerList.java +++ b/src/main/java/gregtech/api/capability/impl/ItemHandlerList.java @@ -1,14 +1,16 @@ package gregtech.api.capability.impl; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import java.util.*; +import javax.annotation.Nonnull; + /** * Efficiently delegates calls into multiple item handlers */ diff --git a/src/main/java/gregtech/api/capability/impl/ItemHandlerProxy.java b/src/main/java/gregtech/api/capability/impl/ItemHandlerProxy.java index 80fd93aff6f..28a5ad86edc 100644 --- a/src/main/java/gregtech/api/capability/impl/ItemHandlerProxy.java +++ b/src/main/java/gregtech/api/capability/impl/ItemHandlerProxy.java @@ -23,7 +23,8 @@ public int getSlots() { @Nonnull @Override public ItemStack getStackInSlot(int slot) { - return slot < insertHandler.getSlots() ? insertHandler.getStackInSlot(slot) : extractHandler.getStackInSlot(slot - insertHandler.getSlots()); + return slot < insertHandler.getSlots() ? insertHandler.getStackInSlot(slot) : + extractHandler.getStackInSlot(slot - insertHandler.getSlots()); } @Nonnull @@ -35,11 +36,13 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate @Nonnull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { - return slot >= insertHandler.getSlots() ? extractHandler.extractItem(slot - insertHandler.getSlots(), amount, simulate) : ItemStack.EMPTY; + return slot >= insertHandler.getSlots() ? + extractHandler.extractItem(slot - insertHandler.getSlots(), amount, simulate) : ItemStack.EMPTY; } @Override public int getSlotLimit(int slot) { - return slot < insertHandler.getSlots() ? insertHandler.getSlotLimit(slot) : extractHandler.getSlotLimit(slot - insertHandler.getSlots()); + return slot < insertHandler.getSlots() ? insertHandler.getSlotLimit(slot) : + extractHandler.getSlotLimit(slot - insertHandler.getSlots()); } } diff --git a/src/main/java/gregtech/api/capability/impl/LaserContainerHandler.java b/src/main/java/gregtech/api/capability/impl/LaserContainerHandler.java index aa5dd739ee5..1665374a43d 100644 --- a/src/main/java/gregtech/api/capability/impl/LaserContainerHandler.java +++ b/src/main/java/gregtech/api/capability/impl/LaserContainerHandler.java @@ -4,21 +4,25 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.ILaserContainer; import gregtech.api.metatileentity.MetaTileEntity; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; public class LaserContainerHandler extends EnergyContainerHandler implements ILaserContainer { - public LaserContainerHandler(MetaTileEntity tileEntity, long maxCapacity, long maxInputVoltage, long maxInputAmperage, long maxOutputVoltage, long maxOutputAmperage) { + public LaserContainerHandler(MetaTileEntity tileEntity, long maxCapacity, long maxInputVoltage, + long maxInputAmperage, long maxOutputVoltage, long maxOutputAmperage) { super(tileEntity, maxCapacity, maxInputVoltage, maxInputAmperage, maxOutputVoltage, maxOutputAmperage); } - public static LaserContainerHandler emitterContainer(MetaTileEntity tileEntity, long maxCapacity, long maxOutputVoltage, long maxOutputAmperage) { + public static LaserContainerHandler emitterContainer(MetaTileEntity tileEntity, long maxCapacity, + long maxOutputVoltage, long maxOutputAmperage) { return new LaserContainerHandler(tileEntity, maxCapacity, 0L, 0L, maxOutputVoltage, maxOutputAmperage); } - public static LaserContainerHandler receiverContainer(MetaTileEntity tileEntity, long maxCapacity, long maxInputVoltage, long maxInputAmperage) { + public static LaserContainerHandler receiverContainer(MetaTileEntity tileEntity, long maxCapacity, + long maxInputVoltage, long maxInputAmperage) { return new LaserContainerHandler(tileEntity, maxCapacity, maxInputVoltage, maxInputAmperage, 0L, 0L); } @@ -50,10 +54,13 @@ public void update() { if (!outputsEnergy(side)) continue; TileEntity tileEntity = metaTileEntity.getWorld().getTileEntity(metaTileEntity.getPos().offset(side)); EnumFacing oppositeSide = side.getOpposite(); - if (tileEntity != null && tileEntity.hasCapability(GregtechTileCapabilities.CAPABILITY_LASER, oppositeSide)) { - IEnergyContainer energyContainer = tileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, oppositeSide); + if (tileEntity != null && + tileEntity.hasCapability(GregtechTileCapabilities.CAPABILITY_LASER, oppositeSide)) { + IEnergyContainer energyContainer = tileEntity + .getCapability(GregtechTileCapabilities.CAPABILITY_LASER, oppositeSide); if (energyContainer == null || !energyContainer.inputsEnergy(oppositeSide)) continue; - amperesUsed += energyContainer.acceptEnergyFromNetwork(oppositeSide, outputVoltage, outputAmperes - amperesUsed); + amperesUsed += energyContainer.acceptEnergyFromNetwork(oppositeSide, outputVoltage, + outputAmperes - amperesUsed); if (amperesUsed == outputAmperes) break; } } @@ -75,5 +82,4 @@ public String toString() { ", amps=" + amps + '}'; } - } diff --git a/src/main/java/gregtech/api/capability/impl/MultiFluidFilter.java b/src/main/java/gregtech/api/capability/impl/MultiFluidFilter.java index 0e0c4d599e0..1e88a0d5b02 100644 --- a/src/main/java/gregtech/api/capability/impl/MultiFluidFilter.java +++ b/src/main/java/gregtech/api/capability/impl/MultiFluidFilter.java @@ -1,14 +1,17 @@ package gregtech.api.capability.impl; -import com.google.common.collect.Iterables; import gregtech.api.capability.IFilter; + import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; +import com.google.common.collect.Iterables; + import java.util.Arrays; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + /** * Basic filter with multiple fluid templates. Can be either whitelist or blacklist. */ diff --git a/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java index 5aea4463085..93cd0ebd095 100644 --- a/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java @@ -8,13 +8,15 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; import gregtech.api.util.TextFormattingUtil; + import net.minecraft.util.Tuple; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class MultiblockFuelRecipeLogic extends MultiblockRecipeLogic { protected long totalContinuousRunningTime; @@ -51,7 +53,7 @@ protected void modifyOverclockPost(int[] overclockResults, @Nonnull IRecipePrope @Nonnull @Override public ParallelLogicType getParallelLogicType() { - return ParallelLogicType.MULTIPLY; //TODO APPEND_FLUIDS + return ParallelLogicType.MULTIPLY; // TODO APPEND_FLUIDS } @Override @@ -64,7 +66,7 @@ protected boolean hasEnoughPower(@Nonnull int[] resultOverclock) { public void update() { super.update(); if (workingEnabled && isActive && progressTime > 0) { - totalContinuousRunningTime ++; + totalContinuousRunningTime++; } else { totalContinuousRunningTime = 0; } @@ -146,7 +148,9 @@ public FluidStack getInputFluidStack() { if (previousRecipe == null) { Recipe recipe = findRecipe(Integer.MAX_VALUE, getInputInventory(), getInputTank()); - return recipe == null ? null : getInputTank().drain(new FluidStack(recipe.getFluidInputs().get(0).getInputFluidStack().getFluid(), Integer.MAX_VALUE), false); + return recipe == null ? null : getInputTank().drain( + new FluidStack(recipe.getFluidInputs().get(0).getInputFluidStack().getFluid(), Integer.MAX_VALUE), + false); } FluidStack fuelStack = previousRecipe.getFluidInputs().get(0).getInputFluidStack(); return getInputTank().drain(new FluidStack(fuelStack.getFluid(), Integer.MAX_VALUE), false); diff --git a/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java index f46d95abaa1..b6073d037bc 100644 --- a/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java @@ -13,16 +13,18 @@ import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.util.Tuple; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MultiblockRecipeLogic extends AbstractRecipeLogic { // Used for distinct mode @@ -39,8 +41,7 @@ public MultiblockRecipeLogic(RecipeMapMultiblockController tileEntity, boolean h } @Override - public void update() { - } + public void update() {} public void updateWorkable() { super.update(); @@ -114,7 +115,8 @@ protected boolean canWorkWithInputs() { if (controller instanceof RecipeMapMultiblockController) { RecipeMapMultiblockController distinctController = (RecipeMapMultiblockController) controller; - if (distinctController.canBeDistinct() && distinctController.isDistinct() && getInputInventory().getSlots() > 0) { + if (distinctController.canBeDistinct() && distinctController.isDistinct() && + getInputInventory().getSlots() > 0) { boolean canWork = false; if (invalidatedInputList.isEmpty()) { return true; @@ -125,7 +127,8 @@ protected boolean canWorkWithInputs() { metaTileEntity.getNotifiedFluidInputList().clear(); metaTileEntity.getNotifiedItemInputList().clear(); } else { - Iterator notifiedIter = metaTileEntity.getNotifiedItemInputList().iterator(); + Iterator notifiedIter = metaTileEntity.getNotifiedItemInputList() + .iterator(); while (notifiedIter.hasNext()) { IItemHandlerModifiable bus = notifiedIter.next(); Iterator invalidatedIter = invalidatedInputList.iterator(); @@ -169,7 +172,8 @@ protected void trySearchNewRecipe() { // do not run recipes when there are more than 5 maintenance problems // Maintenance can apply to all multiblocks, so cast to a base multiblock class MultiblockWithDisplayBase controller = (MultiblockWithDisplayBase) metaTileEntity; - if (ConfigHolder.machines.enableMaintenance && controller.hasMaintenanceMechanics() && controller.getNumMaintenanceProblems() > 5) { + if (ConfigHolder.machines.enableMaintenance && controller.hasMaintenanceMechanics() && + controller.getNumMaintenanceProblems() > 5) { return; } @@ -177,7 +181,8 @@ protected void trySearchNewRecipe() { if (controller instanceof RecipeMapMultiblockController) { RecipeMapMultiblockController distinctController = (RecipeMapMultiblockController) controller; - if (distinctController.canBeDistinct() && distinctController.isDistinct() && getInputInventory().getSlots() > 0) { + if (distinctController.canBeDistinct() && distinctController.isDistinct() && + getInputInventory().getSlots() > 0) { trySearchNewRecipeDistinct(); return; } @@ -187,7 +192,8 @@ protected void trySearchNewRecipe() { } /** - * Put into place so multiblocks can override {@link AbstractRecipeLogic#trySearchNewRecipe()} without having to deal with + * Put into place so multiblocks can override {@link AbstractRecipeLogic#trySearchNewRecipe()} without having to + * deal with * the maintenance and distinct logic in {@link MultiblockRecipeLogic#trySearchNewRecipe()} */ protected void trySearchNewRecipeCombined() { @@ -232,7 +238,7 @@ protected void trySearchNewRecipeDistinct() { } } if (currentRecipe == null) { - //no valid recipe found, invalidate this bus + // no valid recipe found, invalidate this bus invalidatedInputList.add(bus); } } @@ -242,7 +248,8 @@ protected void trySearchNewRecipeDistinct() { public void invalidateInputs() { MultiblockWithDisplayBase controller = (MultiblockWithDisplayBase) metaTileEntity; RecipeMapMultiblockController distinctController = (RecipeMapMultiblockController) controller; - if (distinctController.canBeDistinct() && distinctController.isDistinct() && getInputInventory().getSlots() > 0) { + if (distinctController.canBeDistinct() && distinctController.isDistinct() && + getInputInventory().getSlots() > 0) { invalidatedInputList.add(currentDistinctInputBus); } else { super.invalidateInputs(); @@ -254,8 +261,8 @@ protected boolean checkPreviousRecipeDistinct(IItemHandlerModifiable previousBus } protected boolean prepareRecipeDistinct(Recipe recipe) { - - recipe = Recipe.trimRecipeOutputs(recipe, getRecipeMap(), metaTileEntity.getItemOutputLimit(), metaTileEntity.getFluidOutputLimit()); + recipe = Recipe.trimRecipeOutputs(recipe, getRecipeMap(), metaTileEntity.getItemOutputLimit(), + metaTileEntity.getFluidOutputLimit()); recipe = findParallelRecipe( recipe, @@ -331,8 +338,10 @@ public long getMaximumOverclockVoltage() { @Nonnull protected Tuple getMaintenanceValues() { - MultiblockWithDisplayBase displayBase = this.metaTileEntity instanceof MultiblockWithDisplayBase ? (MultiblockWithDisplayBase) metaTileEntity : null; - int numMaintenanceProblems = displayBase == null || !displayBase.hasMaintenanceMechanics() || !ConfigHolder.machines.enableMaintenance ? 0 : displayBase.getNumMaintenanceProblems(); + MultiblockWithDisplayBase displayBase = this.metaTileEntity instanceof MultiblockWithDisplayBase ? + (MultiblockWithDisplayBase) metaTileEntity : null; + int numMaintenanceProblems = displayBase == null || !displayBase.hasMaintenanceMechanics() || + !ConfigHolder.machines.enableMaintenance ? 0 : displayBase.getNumMaintenanceProblems(); double durationMultiplier = 1.0D; if (displayBase != null && displayBase.hasMaintenanceMechanics() && ConfigHolder.machines.enableMaintenance) { durationMultiplier = displayBase.getMaintenanceDurationMultiplier(); diff --git a/src/main/java/gregtech/api/capability/impl/NotifiableFluidTank.java b/src/main/java/gregtech/api/capability/impl/NotifiableFluidTank.java index b6b785e58d8..2669fa35097 100644 --- a/src/main/java/gregtech/api/capability/impl/NotifiableFluidTank.java +++ b/src/main/java/gregtech/api/capability/impl/NotifiableFluidTank.java @@ -2,6 +2,7 @@ import gregtech.api.capability.INotifiableHandler; import gregtech.api.metatileentity.MetaTileEntity; + import net.minecraftforge.fluids.FluidTank; import java.util.ArrayList; diff --git a/src/main/java/gregtech/api/capability/impl/NotifiableItemStackHandler.java b/src/main/java/gregtech/api/capability/impl/NotifiableItemStackHandler.java index 847fc2a1847..472c29e033f 100644 --- a/src/main/java/gregtech/api/capability/impl/NotifiableItemStackHandler.java +++ b/src/main/java/gregtech/api/capability/impl/NotifiableItemStackHandler.java @@ -3,17 +3,20 @@ import gregtech.api.capability.INotifiableHandler; import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.metatileentity.MetaTileEntity; + import net.minecraftforge.items.IItemHandlerModifiable; import java.util.ArrayList; import java.util.List; -public class NotifiableItemStackHandler extends GTItemStackHandler implements IItemHandlerModifiable, INotifiableHandler { +public class NotifiableItemStackHandler extends GTItemStackHandler + implements IItemHandlerModifiable, INotifiableHandler { List notifiableEntities = new ArrayList<>(); private final boolean isExport; - public NotifiableItemStackHandler(MetaTileEntity metaTileEntity, int slots, MetaTileEntity entityToNotify, boolean isExport) { + public NotifiableItemStackHandler(MetaTileEntity metaTileEntity, int slots, MetaTileEntity entityToNotify, + boolean isExport) { super(metaTileEntity, slots); if (entityToNotify != null) { this.notifiableEntities.add(entityToNotify); diff --git a/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java index 683b51ffda9..72e7c8fd332 100644 --- a/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java @@ -45,7 +45,8 @@ public long getMaxVoltage() { @Nonnull @Override - protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, long maxVoltage, int recipeDuration, int amountOC) { + protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, + long maxVoltage, int recipeDuration, int amountOC) { return standardOverclockingLogic( 1, getMaxVoltage(), diff --git a/src/main/java/gregtech/api/capability/impl/PropertyFluidFilter.java b/src/main/java/gregtech/api/capability/impl/PropertyFluidFilter.java index c0dcd53b46f..deb8e12d8d3 100644 --- a/src/main/java/gregtech/api/capability/impl/PropertyFluidFilter.java +++ b/src/main/java/gregtech/api/capability/impl/PropertyFluidFilter.java @@ -4,6 +4,7 @@ import gregtech.api.fluids.FluidState; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.api.fluids.attribute.FluidAttributes; + import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/gregtech/api/capability/impl/RecipeLogicEnergy.java b/src/main/java/gregtech/api/capability/impl/RecipeLogicEnergy.java index c618fa377b0..f618b37e2be 100644 --- a/src/main/java/gregtech/api/capability/impl/RecipeLogicEnergy.java +++ b/src/main/java/gregtech/api/capability/impl/RecipeLogicEnergy.java @@ -10,7 +10,8 @@ public class RecipeLogicEnergy extends AbstractRecipeLogic { protected final Supplier energyContainer; - public RecipeLogicEnergy(MetaTileEntity tileEntity, RecipeMap recipeMap, Supplier energyContainer) { + public RecipeLogicEnergy(MetaTileEntity tileEntity, RecipeMap recipeMap, + Supplier energyContainer) { super(tileEntity, recipeMap); this.energyContainer = energyContainer; setMaximumOverclockVoltage(getMaxVoltage()); diff --git a/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java b/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java index c2944e24a0b..c32af96f849 100644 --- a/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java +++ b/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java @@ -10,6 +10,7 @@ import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; import gregtech.core.advancement.AdvancementTriggers; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; @@ -32,13 +33,14 @@ public class RecipeLogicSteam extends AbstractRecipeLogic implements IVentable { private final IFluidTank steamFluidTank; private final boolean isHighPressure; - private final double conversionRate; //energy units per millibucket + private final double conversionRate; // energy units per millibucket private boolean needsVenting; private boolean ventingStuck; private EnumFacing ventingSide; - public RecipeLogicSteam(MetaTileEntity tileEntity, RecipeMap recipeMap, boolean isHighPressure, IFluidTank steamFluidTank, double conversionRate) { + public RecipeLogicSteam(MetaTileEntity tileEntity, RecipeMap recipeMap, boolean isHighPressure, + IFluidTank steamFluidTank, double conversionRate) { super(tileEntity, recipeMap); this.steamFluidTank = steamFluidTank; this.conversionRate = conversionRate; @@ -139,7 +141,8 @@ public void tryDoVenting() { private void performVentingAnimation(BlockPos ventingBlockPos, BlockPos machinePos) { metaTileEntity.getWorld() - .getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), EntitySelectors.CAN_AI_TARGET) + .getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), + EntitySelectors.CAN_AI_TARGET) .forEach(entity -> { entity.attackEntityFrom(DamageSources.getHeatDamage(), this.isHighPressure ? 12.0f : 6.0f); if (entity instanceof EntityPlayerMP) { @@ -156,11 +159,11 @@ private void performVentingAnimation(BlockPos ventingBlockPos, BlockPos machineP ventingSide.getXOffset() / 2.0, ventingSide.getYOffset() / 2.0, ventingSide.getZOffset() / 2.0, 0.1); - if (ConfigHolder.machines.machineSounds && !metaTileEntity.isMuffled()){ - world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); + if (ConfigHolder.machines.machineSounds && !metaTileEntity.isMuffled()) { + world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, + 1.0f); } setNeedsVenting(false); - } @Override @@ -188,8 +191,7 @@ protected void completeRecipe() { @Nonnull @Override protected int[] calculateOverclock(@Nonnull Recipe recipe) { - - //EUt, Duration + // EUt, Duration int[] result = new int[2]; result[0] = isHighPressure ? recipe.getEUt() * 2 : recipe.getEUt(); diff --git a/src/main/java/gregtech/api/capability/impl/SingleFluidFilter.java b/src/main/java/gregtech/api/capability/impl/SingleFluidFilter.java index f1d3a4622f8..db4178ba433 100644 --- a/src/main/java/gregtech/api/capability/impl/SingleFluidFilter.java +++ b/src/main/java/gregtech/api/capability/impl/SingleFluidFilter.java @@ -1,6 +1,7 @@ package gregtech.api.capability.impl; import gregtech.api.capability.IFilter; + import net.minecraftforge.fluids.FluidStack; import javax.annotation.Nonnull; diff --git a/src/main/java/gregtech/api/capability/impl/SteamMultiWorkable.java b/src/main/java/gregtech/api/capability/impl/SteamMultiWorkable.java index 6c4aa7a4d70..cb293fe9bbe 100644 --- a/src/main/java/gregtech/api/capability/impl/SteamMultiWorkable.java +++ b/src/main/java/gregtech/api/capability/impl/SteamMultiWorkable.java @@ -6,7 +6,6 @@ import javax.annotation.Nonnull; - /** * General Recipe Handler for Steam Multiblocks. * Will do up to the passed value of items in one process. diff --git a/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java index 70cee480210..6cb6e3ed9ef 100644 --- a/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java @@ -6,6 +6,7 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.common.ConfigHolder; + import net.minecraft.block.Block; import net.minecraft.block.BlockSnow; import net.minecraft.block.state.IBlockState; @@ -30,7 +31,8 @@ public class SteamMultiblockRecipeLogic extends AbstractRecipeLogic { // EU per mB private final double conversionRate; - public SteamMultiblockRecipeLogic(RecipeMapSteamMultiblockController tileEntity, RecipeMap recipeMap, IMultipleTankHandler steamFluidTank, double conversionRate) { + public SteamMultiblockRecipeLogic(RecipeMapSteamMultiblockController tileEntity, RecipeMap recipeMap, + IMultipleTankHandler steamFluidTank, double conversionRate) { super(tileEntity, recipeMap); this.steamFluidTank = steamFluidTank; this.conversionRate = conversionRate; @@ -73,7 +75,6 @@ private void combineSteamTanks() { @Override public void update() { - // Fixes an annoying GTCE bug in AbstractRecipeLogic RecipeMapSteamMultiblockController controller = (RecipeMapSteamMultiblockController) metaTileEntity; if (isActive && !controller.isStructureFormed()) { @@ -121,7 +122,8 @@ public boolean isAllowOverclocking() { } @Override - protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable importInventory) { + protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, + @Nonnull IItemHandlerModifiable importInventory) { RecipeMapSteamMultiblockController controller = (RecipeMapSteamMultiblockController) metaTileEntity; if (controller.checkRecipe(recipe, false) && super.setupAndConsumeRecipeInputs(recipe, importInventory)) { @@ -143,8 +145,7 @@ private void ventSteam() { IBlockState blockOnPos = metaTileEntity.getWorld().getBlockState(ventingBlockPos); if (blockOnPos.getCollisionBoundingBox(metaTileEntity.getWorld(), ventingBlockPos) == Block.NULL_AABB) { performVentingAnimation(machinePos, ventingSide); - } - else if(blockOnPos.getBlock() == Blocks.SNOW_LAYER && blockOnPos.getValue(BlockSnow.LAYERS) == 1) { + } else if (blockOnPos.getBlock() == Blocks.SNOW_LAYER && blockOnPos.getValue(BlockSnow.LAYERS) == 1) { performVentingAnimation(machinePos, ventingSide); metaTileEntity.getWorld().destroyBlock(ventingBlockPos, false); } @@ -161,8 +162,9 @@ private void performVentingAnimation(BlockPos machinePos, EnumFacing ventingSide ventingSide.getXOffset() / 2.0, ventingSide.getYOffset() / 2.0, ventingSide.getZOffset() / 2.0, 0.1); - if (ConfigHolder.machines.machineSounds && !metaTileEntity.isMuffled()){ - world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); + if (ConfigHolder.machines.machineSounds && !metaTileEntity.isMuffled()) { + world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, + 1.0f); } } } diff --git a/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java b/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java index 2ded13ae1a4..98faab4159d 100644 --- a/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java +++ b/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java @@ -1,8 +1,5 @@ package gregtech.api.capability.impl.miner; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IMiner; import gregtech.api.metatileentity.MetaTileEntity; @@ -16,6 +13,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -30,15 +28,20 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.StringUtils; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; +import javax.annotation.Nonnull; + public class MinerLogic { private static final short MAX_SPEED = Short.MAX_VALUE; @@ -85,7 +88,8 @@ public class MinerLogic { * @param speed the speed in ticks per block mined * @param maximumRadius the maximum radius (square shaped) the miner can mine in */ - public MinerLogic(@Nonnull MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, ICubeRenderer pipeTexture) { + public MinerLogic(@Nonnull MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, + ICubeRenderer pipeTexture) { this.metaTileEntity = metaTileEntity; this.miner = (IMiner) metaTileEntity; this.fortune = fortune; @@ -112,7 +116,8 @@ private static IBlockState findMiningReplacementBlock() { // check for meta if (blockDescription.length > 2 && !blockDescription[2].isEmpty()) { - return replacementBlock.getDefaultState().getBlock().getStateFromMeta(Integer.parseInt(blockDescription[2])); + return replacementBlock.getDefaultState().getBlock() + .getStateFromMeta(Integer.parseInt(blockDescription[2])); } return replacementBlock.getDefaultState(); @@ -153,7 +158,8 @@ public void performMining() { // drill a hole beneath the miner and extend the pipe downwards by one WorldServer world = (WorldServer) metaTileEntity.getWorld(); if (mineY.get() < pipeY.get()) { - world.destroyBlock(new BlockPos(metaTileEntity.getPos().getX(), pipeY.get(), metaTileEntity.getPos().getZ()), false); + world.destroyBlock( + new BlockPos(metaTileEntity.getPos().getX(), pipeY.get(), metaTileEntity.getPos().getZ()), false); pipeY.decrementAndGet(); incrementPipeLength(); } @@ -223,9 +229,7 @@ protected boolean checkShouldStop() { /** * Called after each block is mined, used to perform additional actions afterwards */ - protected void onMineOperation() { - - } + protected void onMineOperation() {} /** * called in order to drain anything the miner needs to drain in order to run @@ -243,13 +247,15 @@ protected boolean drainStorages(boolean simulate) { * @param blockToMine the {@link BlockPos} of the block being mined * @param blockState the {@link IBlockState} of the block being mined */ - protected void getSmallOreBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, IBlockState blockState) { - /*small ores - if orePrefix of block in blockPos is small - applyTieredHammerNoRandomDrops... - else - current code... - */ + protected void getSmallOreBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, + IBlockState blockState) { + /* + * small ores + * if orePrefix of block in blockPos is small + * applyTieredHammerNoRandomDrops... + * else + * current code... + */ } /** @@ -260,8 +266,10 @@ protected void getSmallOreBlockDrops(NonNullList blockDrops, WorldSer * @param blockToMine the {@link BlockPos} of the block being mined * @param blockState the {@link IBlockState} of the block being mined */ - protected void getRegularBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, @Nonnull IBlockState blockState) { - blockState.getBlock().getDrops(blockDrops, world, blockToMine, blockState, 0); // regular ores do not get fortune applied + protected void getRegularBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, + @Nonnull IBlockState blockState) { + blockState.getBlock().getDrops(blockDrops, world, blockToMine, blockState, 0); // regular ores do not get + // fortune applied } /** @@ -320,7 +328,8 @@ public void initPos(@Nonnull BlockPos pos, int currentRadius) { * @param z the z coordinate * @return {@code true} if the coordinates are invalid, else false */ - private static boolean checkCoordinatesInvalid(@Nonnull AtomicInteger x, @Nonnull AtomicInteger y, @Nonnull AtomicInteger z) { + private static boolean checkCoordinatesInvalid(@Nonnull AtomicInteger x, @Nonnull AtomicInteger y, + @Nonnull AtomicInteger z) { return x.get() == Integer.MAX_VALUE && y.get() == Integer.MAX_VALUE && z.get() == Integer.MAX_VALUE; } @@ -367,7 +376,9 @@ private LinkedList getBlocksToMine() { if (x.get() <= startX.get() + currentRadius * 2) { BlockPos blockPos = new BlockPos(x.get(), y.get(), z.get()); IBlockState state = metaTileEntity.getWorld().getBlockState(blockPos); - if (state.getBlock().blockHardness >= 0 && metaTileEntity.getWorld().getTileEntity(blockPos) == null && GTUtility.isOre(GTUtility.toItem(state))) { + if (state.getBlock().blockHardness >= 0 && + metaTileEntity.getWorld().getTileEntity(blockPos) == null && + GTUtility.isOre(GTUtility.toItem(state))) { blocks.addLast(blockPos); } // move to the next x position @@ -433,12 +444,14 @@ private static double getQuotient(double base) { * @param map the recipemap from which to get the drops * @param tier the tier at which the operation is performed, used for calculating the chanced output boost */ - protected static void applyTieredHammerNoRandomDrops(@Nonnull IBlockState blockState, List drops, int fortuneLevel, @Nonnull RecipeMap map, int tier) { + protected static void applyTieredHammerNoRandomDrops(@Nonnull IBlockState blockState, List drops, + int fortuneLevel, @Nonnull RecipeMap map, int tier) { ItemStack itemStack = GTUtility.toItem(blockState); Recipe recipe = map.findRecipe(Long.MAX_VALUE, Collections.singletonList(itemStack), Collections.emptyList()); if (recipe != null && !recipe.getOutputs().isEmpty()) { drops.clear(); - for (ItemStack outputStack : recipe.getResultItemOutputs(GTUtility.getTierByVoltage(recipe.getEUt()), tier, map)) { + for (ItemStack outputStack : recipe.getResultItemOutputs(GTUtility.getTierByVoltage(recipe.getEUt()), tier, + map)) { outputStack = outputStack.copy(); if (OreDictUnifier.getPrefix(outputStack) == OrePrefix.crushed) { if (fortuneLevel > 0) { @@ -511,7 +524,8 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { /** * reads all needed values from NBT - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} method + * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} + * method */ public void readFromNBT(@Nonnull NBTTagCompound data) { x.set(data.getInteger("xPos")); @@ -534,7 +548,8 @@ public void readFromNBT(@Nonnull NBTTagCompound data) { /** * writes all needed values to InitialSyncData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method */ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { buf.writeInt(pipeLength); @@ -545,7 +560,8 @@ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { /** * reads all needed values from InitialSyncData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method */ public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { this.pipeLength = buf.readInt(); @@ -556,7 +572,8 @@ public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { /** * reads all needed values from CustomData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#receiveCustomData(int, PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#receiveCustomData(int, PacketBuffer)} method */ public void receiveCustomData(int dataId, PacketBuffer buf) { if (dataId == GregtechDataCodes.PUMP_HEAD_LEVEL) { @@ -684,7 +701,8 @@ public void setActive(boolean isActive) { this.isActive = isActive; this.metaTileEntity.markDirty(); if (metaTileEntity.getWorld() != null && !metaTileEntity.getWorld().isRemote) { - this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKABLE_ACTIVE, buf -> buf.writeBoolean(isActive)); + this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKABLE_ACTIVE, + buf -> buf.writeBoolean(isActive)); } } } @@ -699,7 +717,8 @@ public void setWorkingEnabled(boolean isWorkingEnabled) { if (metaTileEntity.getWorld() != null && !metaTileEntity.getWorld().isRemote) { if (!isWorkingEnabled) resetArea(); - this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKING_ENABLED, buf -> buf.writeBoolean(isWorkingEnabled)); + this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKING_ENABLED, + buf -> buf.writeBoolean(isWorkingEnabled)); } } } diff --git a/src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java b/src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java index 5b30ee22606..99faf2b318f 100644 --- a/src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java +++ b/src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java @@ -4,6 +4,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.recipes.RecipeMap; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -38,7 +39,8 @@ public class MultiblockMinerLogic extends MinerLogic { * @param speed the speed in ticks per block mined * @param maximumRadius the maximum radius (square shaped) the miner can mine in */ - public MultiblockMinerLogic(MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, RecipeMap blockDropRecipeMap) { + public MultiblockMinerLogic(MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, + RecipeMap blockDropRecipeMap) { super(metaTileEntity, fortune, speed, maximumRadius, null); this.blockDropRecipeMap = blockDropRecipeMap; } @@ -49,13 +51,16 @@ protected boolean drainStorages(boolean simulate) { } @Override - protected void getSmallOreBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, IBlockState blockState) { - // Small ores: use (fortune bonus + overclockAmount) value here for fortune, since every overclock increases the yield for small ores + protected void getSmallOreBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, + IBlockState blockState) { + // Small ores: use (fortune bonus + overclockAmount) value here for fortune, since every overclock increases the + // yield for small ores super.getSmallOreBlockDrops(blockDrops, world, blockToMine, blockState); } @Override - protected void getRegularBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, @Nonnull IBlockState blockState) { + protected void getRegularBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, + @Nonnull IBlockState blockState) { if (!isSilkTouchMode) // 3X the ore compared to the single blocks applyTieredHammerNoRandomDrops(blockState, blockDrops, 3, this.blockDropRecipeMap, this.voltageTier); else @@ -69,7 +74,8 @@ public void initPos(@Nonnull BlockPos pos, int currentRadius) { } else { WorldServer world = (WorldServer) this.metaTileEntity.getWorld(); Chunk origin = world.getChunk(this.metaTileEntity.getPos()); - ChunkPos startPos = (world.getChunk(origin.x - currentRadius / CHUNK_LENGTH, origin.z - currentRadius / CHUNK_LENGTH)).getPos(); + ChunkPos startPos = (world.getChunk(origin.x - currentRadius / CHUNK_LENGTH, + origin.z - currentRadius / CHUNK_LENGTH)).getPos(); getX().set(startPos.getXStart()); getY().set(this.metaTileEntity.getPos().getY() - 1); getZ().set(startPos.getZStart()); diff --git a/src/main/java/gregtech/api/capability/impl/miner/SteamMinerLogic.java b/src/main/java/gregtech/api/capability/impl/miner/SteamMinerLogic.java index 7557f1fbf63..3d20620db2a 100644 --- a/src/main/java/gregtech/api/capability/impl/miner/SteamMinerLogic.java +++ b/src/main/java/gregtech/api/capability/impl/miner/SteamMinerLogic.java @@ -14,7 +14,8 @@ public class SteamMinerLogic extends MinerLogic { * @param speed the speed in ticks per block mined * @param maximumRadius the maximum radius (square shaped) the miner can mine in */ - public SteamMinerLogic(MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, ICubeRenderer pipeTexture) { + public SteamMinerLogic(MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, + ICubeRenderer pipeTexture) { super(metaTileEntity, fortune, speed, maximumRadius, pipeTexture); } diff --git a/src/main/java/gregtech/api/cover/Cover.java b/src/main/java/gregtech/api/cover/Cover.java index b6f9c4c0a7a..a5fc207812e 100644 --- a/src/main/java/gregtech/api/cover/Cover.java +++ b/src/main/java/gregtech/api/cover/Cover.java @@ -1,11 +1,7 @@ package gregtech.api.cover; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.client.utils.BloomEffectUtil; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -17,6 +13,12 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.UnknownNullability; @@ -31,9 +33,11 @@ public interface Cover { /** * @return the CoverableView containing this cover */ - @NotNull CoverableView getCoverableView(); + @NotNull + CoverableView getCoverableView(); - @NotNull CoverDefinition getDefinition(); + @NotNull + CoverDefinition getDefinition(); /** * @return the World containing this cover @@ -97,14 +101,15 @@ default long getOffsetTimer() { default void update() {} default boolean isTickable() { - //noinspection InstanceofThis + // noinspection InstanceofThis return this instanceof ITickable; } /** * @return the side the cover is attached to */ - @NotNull EnumFacing getAttachedSide(); + @NotNull + EnumFacing getAttachedSide(); /** * @param coverable the CoverableView to attach to @@ -122,7 +127,8 @@ default boolean isTickable() { * @param player the player attaching the cover * @param itemStack the item used to place the cover */ - default void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, @Nullable EntityPlayer player, @NotNull ItemStack itemStack) {} + default void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, + @Nullable EntityPlayer player, @NotNull ItemStack itemStack) {} /** * Called when the cover is removed @@ -165,7 +171,8 @@ default boolean onLeftClick(@NotNull EntityPlayer player, @NotNull CuboidRayTrac * @param hitResult the HitResult of the click * @return the action's result */ - default @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + default @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { return EnumActionResult.PASS; } @@ -175,7 +182,8 @@ default boolean onLeftClick(@NotNull EntityPlayer player, @NotNull CuboidRayTrac * @param hitResult the HitResult of the click * @return the action's result */ - default @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + default @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { return EnumActionResult.PASS; } @@ -185,7 +193,8 @@ default boolean onLeftClick(@NotNull EntityPlayer player, @NotNull CuboidRayTrac * @param hitResult the HitResult of the click * @return the action's result */ - default @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + default @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { return EnumActionResult.PASS; } @@ -229,7 +238,8 @@ default int getRedstoneSignalOutput() { * It will be automatically translated to prevent Z-fighting with machine faces */ @SideOnly(Side.CLIENT) - void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, @NotNull IVertexOperation[] pipeline, + void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + @NotNull IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer); @SideOnly(Side.CLIENT) @@ -238,7 +248,8 @@ default boolean canRenderInLayer(@NotNull BlockRenderLayer renderLayer) { } @SideOnly(Side.CLIENT) - void renderCoverPlate(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, @NotNull IVertexOperation[] pipeline, + void renderCoverPlate(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + @NotNull IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer); default boolean canRenderBackside() { diff --git a/src/main/java/gregtech/api/cover/CoverBase.java b/src/main/java/gregtech/api/cover/CoverBase.java index a493cedd0b2..49a3429f842 100644 --- a/src/main/java/gregtech/api/cover/CoverBase.java +++ b/src/main/java/gregtech/api/cover/CoverBase.java @@ -1,13 +1,10 @@ package gregtech.api.cover; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; + import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.item.ItemStack; @@ -17,6 +14,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public abstract class CoverBase implements Cover { @@ -62,13 +64,15 @@ protected void dropInventoryContents(@NotNull IItemHandlerModifiable inventory) @SideOnly(Side.CLIENT) @Override - public void renderCoverPlate(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, @NotNull IVertexOperation[] pipeline, - @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCoverPlate(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + @NotNull IVertexOperation[] pipeline, + @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { TextureAtlasSprite casingSide = getPlateSprite(); for (EnumFacing coverPlateSide : EnumFacing.VALUES) { boolean isAttachedSide = getAttachedSide().getAxis() == coverPlateSide.getAxis(); if (isAttachedSide || !getCoverableView().hasCover(coverPlateSide)) { - Textures.renderFace(renderState, translation, pipeline, coverPlateSide, plateBox, casingSide, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, coverPlateSide, plateBox, casingSide, + BlockRenderLayer.CUTOUT_MIPPED); } } } diff --git a/src/main/java/gregtech/api/cover/CoverDefinition.java b/src/main/java/gregtech/api/cover/CoverDefinition.java index 4ac8c983c50..51d5ed655f8 100644 --- a/src/main/java/gregtech/api/cover/CoverDefinition.java +++ b/src/main/java/gregtech/api/cover/CoverDefinition.java @@ -1,9 +1,11 @@ package gregtech.api.cover; import gregtech.api.GregTechAPI; + import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -61,7 +63,8 @@ public static int getNetworkIdForCover(@NotNull CoverDefinition definition) { @FunctionalInterface public interface CoverCreator { - @NotNull Cover create(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, - @NotNull EnumFacing attachedSide); + @NotNull + Cover create(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide); } } diff --git a/src/main/java/gregtech/api/cover/CoverHolder.java b/src/main/java/gregtech/api/cover/CoverHolder.java index e1fee34ec24..06ab0791ce7 100644 --- a/src/main/java/gregtech/api/cover/CoverHolder.java +++ b/src/main/java/gregtech/api/cover/CoverHolder.java @@ -1,12 +1,8 @@ package gregtech.api.cover; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.*; import gregtech.api.util.GTUtility; import gregtech.client.utils.RenderUtil; + import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; @@ -15,6 +11,12 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -95,6 +97,7 @@ default void updateCovers() { * Also used to check whether cover placement is possible on a side, because a cover cannot be placed if the * collision boxes of the Holder and its plate overlap. * If zero, it is expected that machine is full block and plate doesn't need to be rendered. + * * @return the cover plate thickness. */ double getCoverPlateThickness(); @@ -111,11 +114,13 @@ default void updateCovers() { int getPaintingColorForRendering(); @SideOnly(Side.CLIENT) - default void renderCovers(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, @NotNull BlockRenderLayer layer) { + default void renderCovers(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + @NotNull BlockRenderLayer layer) { renderState.lightMatrix.locate(getWorld(), getPos()); double coverPlateThickness = getCoverPlateThickness(); - IVertexOperation[] platePipeline = {renderState.lightMatrix, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))}; - IVertexOperation[] coverPipeline = {renderState.lightMatrix}; + IVertexOperation[] platePipeline = { renderState.lightMatrix, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())) }; + IVertexOperation[] coverPipeline = { renderState.lightMatrix }; for (EnumFacing sideFacing : EnumFacing.values()) { Cover cover = getCoverAtSide(sideFacing); @@ -128,17 +133,22 @@ default void renderCovers(@NotNull CCRenderState renderState, @NotNull Matrix4 t } if (cover.canRenderInLayer(layer)) { - cover.renderCover(renderState, RenderUtil.adjustTrans(translation, sideFacing, 2), coverPipeline, plateBox, layer); + cover.renderCover(renderState, RenderUtil.adjustTrans(translation, sideFacing, 2), coverPipeline, + plateBox, layer); if (coverPlateThickness == 0.0 && shouldRenderCoverBackSides() && cover.canRenderBackside()) { - //machine is full block, but still not opaque - render cover on the back side too + // machine is full block, but still not opaque - render cover on the back side too Matrix4 backTranslation = translation.copy(); if (sideFacing.getAxis().isVertical()) { REVERSE_VERTICAL_ROTATION.apply(backTranslation); } else { REVERSE_HORIZONTAL_ROTATION.apply(backTranslation); } - backTranslation.translate(-sideFacing.getXOffset(), -sideFacing.getYOffset(), -sideFacing.getZOffset()); - cover.renderCover(renderState, backTranslation, coverPipeline, plateBox, layer); // may need to translate the layer here as well + backTranslation.translate(-sideFacing.getXOffset(), -sideFacing.getYOffset(), + -sideFacing.getZOffset()); + cover.renderCover(renderState, backTranslation, coverPipeline, plateBox, layer); // may need to + // translate the + // layer here as + // well } } } diff --git a/src/main/java/gregtech/api/cover/CoverRayTracer.java b/src/main/java/gregtech/api/cover/CoverRayTracer.java index bc5f0623701..e44588d4dc3 100644 --- a/src/main/java/gregtech/api/cover/CoverRayTracer.java +++ b/src/main/java/gregtech/api/cover/CoverRayTracer.java @@ -1,12 +1,14 @@ package gregtech.api.cover; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.RayTracer; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.util.GTUtility; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.RayTraceResult; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.raytracer.RayTracer; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -14,12 +16,13 @@ public final class CoverRayTracer { private CoverRayTracer() {} - public static @Nullable EnumFacing rayTraceCoverableSide(@NotNull CoverableView coverableView, @NotNull EntityPlayer player) { - + public static @Nullable EnumFacing rayTraceCoverableSide(@NotNull CoverableView coverableView, + @NotNull EntityPlayer player) { // if the coverable view is from a blockpipe, use the proper raytrace method - RayTraceResult result = coverableView.getWorld().getBlockState(coverableView.getPos()).getBlock() instanceof BlockPipe pipe ? - pipe.getServerCollisionRayTrace(player, coverableView.getPos(), coverableView.getWorld()) : - RayTracer.retraceBlock(coverableView.getWorld(), player, coverableView.getPos()); + RayTraceResult result = coverableView.getWorld().getBlockState(coverableView.getPos()) + .getBlock() instanceof BlockPipepipe ? + pipe.getServerCollisionRayTrace(player, coverableView.getPos(), coverableView.getWorld()) : + RayTracer.retraceBlock(coverableView.getWorld(), player, coverableView.getPos()); if (result == null || result.typeOfHit != RayTraceResult.Type.BLOCK) { return null; } @@ -37,9 +40,9 @@ private CoverRayTracer() {} return pipeConnectionData.side; } else if (rayTraceResult.cuboid6.data instanceof PrimaryBoxData primaryBoxData) { return primaryBoxData.usePlacementGrid ? determineGridSideHit(result) : result.sideHit; - } //unknown hit type, fall through + } // unknown hit type, fall through } - //normal collision ray trace, return side hit + // normal collision ray trace, return side hit return determineGridSideHit(result); } @@ -47,8 +50,7 @@ private CoverRayTracer() {} return GTUtility.determineWrenchingSide(result.sideHit, (float) (result.hitVec.x - result.getBlockPos().getX()), (float) (result.hitVec.y - result.getBlockPos().getY()), - (float) (result.hitVec.z - result.getBlockPos().getZ()) - ); + (float) (result.hitVec.z - result.getBlockPos().getZ())); } public static class PrimaryBoxData { diff --git a/src/main/java/gregtech/api/cover/CoverSaveHandler.java b/src/main/java/gregtech/api/cover/CoverSaveHandler.java index 5b956024261..fe62aa782a9 100644 --- a/src/main/java/gregtech/api/cover/CoverSaveHandler.java +++ b/src/main/java/gregtech/api/cover/CoverSaveHandler.java @@ -1,12 +1,14 @@ package gregtech.api.cover; import gregtech.api.util.GTLog; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.PacketBuffer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.Constants; + import org.jetbrains.annotations.NotNull; import java.util.function.BiConsumer; @@ -59,7 +61,8 @@ public static void receiveInitialSyncData(@NotNull PacketBuffer buf, @NotNull Co CoverDefinition definition = CoverDefinition.getCoverByNetworkId(id); if (definition == null) { - GTLog.logger.warn("Unable to find CoverDefinition for Network ID {} at position {}", id, coverHolder.getPos()); + GTLog.logger.warn("Unable to find CoverDefinition for Network ID {} at position {}", id, + coverHolder.getPos()); } else { Cover cover = definition.createCover(coverHolder, facing); cover.readInitialSyncData(buf); @@ -92,12 +95,13 @@ public static void writeCoverPlacement(@NotNull CoverHolder coverHolder, int dis * @param coverHolder the CoverHolder the cover is placed on */ public static void readCoverPlacement(@NotNull PacketBuffer buf, @NotNull CoverHolder coverHolder) { - //cover placement event + // cover placement event EnumFacing placementSide = EnumFacing.VALUES[buf.readByte()]; int id = buf.readVarInt(); CoverDefinition coverDefinition = CoverDefinition.getCoverByNetworkId(id); if (coverDefinition == null) { - GTLog.logger.warn("Unable to find CoverDefinition for Network ID {} at position {}", id, coverHolder.getPos()); + GTLog.logger.warn("Unable to find CoverDefinition for Network ID {} at position {}", id, + coverHolder.getPos()); } else { Cover cover = coverDefinition.createCover(coverHolder, placementSide); coverHolder.addCover(placementSide, cover); diff --git a/src/main/java/gregtech/api/cover/CoverUIFactory.java b/src/main/java/gregtech/api/cover/CoverUIFactory.java index c937bcadeb1..a21cd057d44 100644 --- a/src/main/java/gregtech/api/cover/CoverUIFactory.java +++ b/src/main/java/gregtech/api/cover/CoverUIFactory.java @@ -5,6 +5,7 @@ import gregtech.api.gui.ModularUI; import gregtech.api.gui.UIFactory; import gregtech.api.util.GTUtility; + import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.PacketBuffer; @@ -16,8 +17,7 @@ public final class CoverUIFactory extends UIFactory { public static final CoverUIFactory INSTANCE = new CoverUIFactory(); - private CoverUIFactory() { - } + private CoverUIFactory() {} public void init() { GregTechAPI.UI_FACTORY_REGISTRY.register(2, GTUtility.gregtechId("cover_behavior_factory"), this); @@ -33,7 +33,8 @@ protected CoverWithUI readHolderFromSyncData(PacketBuffer syncData) { BlockPos blockPos = syncData.readBlockPos(); EnumFacing attachedSide = EnumFacing.VALUES[syncData.readByte()]; TileEntity tileEntity = Minecraft.getMinecraft().world.getTileEntity(blockPos); - CoverableView coverable = tileEntity == null ? null : tileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, attachedSide); + CoverableView coverable = tileEntity == null ? null : + tileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, attachedSide); if (coverable != null) { Cover cover = coverable.getCoverAtSide(attachedSide); if (cover instanceof CoverWithUI coverWithUI) { diff --git a/src/main/java/gregtech/api/cover/CoverUtil.java b/src/main/java/gregtech/api/cover/CoverUtil.java index 2e78461090b..cd18b64b5a9 100644 --- a/src/main/java/gregtech/api/cover/CoverUtil.java +++ b/src/main/java/gregtech/api/cover/CoverUtil.java @@ -1,8 +1,9 @@ package gregtech.api.cover; +import net.minecraft.util.EnumFacing; + import codechicken.lib.raytracer.IndexedCuboid6; import codechicken.lib.vec.Cuboid6; -import net.minecraft.util.EnumFacing; import org.jetbrains.annotations.NotNull; import java.util.List; diff --git a/src/main/java/gregtech/api/cover/CoverWithUI.java b/src/main/java/gregtech/api/cover/CoverWithUI.java index ad1dfe41d7b..eb7dfcad582 100644 --- a/src/main/java/gregtech/api/cover/CoverWithUI.java +++ b/src/main/java/gregtech/api/cover/CoverWithUI.java @@ -2,6 +2,7 @@ import gregtech.api.gui.IUIHolder; import gregtech.api.gui.ModularUI; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; diff --git a/src/main/java/gregtech/api/cover/CoverableView.java b/src/main/java/gregtech/api/cover/CoverableView.java index 9f19aaa853c..0b7d6f33c68 100644 --- a/src/main/java/gregtech/api/cover/CoverableView.java +++ b/src/main/java/gregtech/api/cover/CoverableView.java @@ -6,6 +6,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.UnknownNullability; @@ -17,18 +18,21 @@ public interface CoverableView extends ICapabilityProvider { /** * @return the world containing the CoverableView */ - @UnknownNullability World getWorld(); + @UnknownNullability + World getWorld(); /** * @return the pos of the block containing the CoverableView */ - @UnknownNullability BlockPos getPos(); + @UnknownNullability + BlockPos getPos(); /** * @param facing the side to get the neighbor at * @return the neighbor tile entity at the side */ - @Nullable TileEntity getNeighbor(@NotNull EnumFacing facing); + @Nullable + TileEntity getNeighbor(@NotNull EnumFacing facing); /** * Mark the CoverableView as needing to be saved to the chunk @@ -59,7 +63,8 @@ public interface CoverableView extends ICapabilityProvider { * @param side the side to retrieve a cover from * @return the cover at the side */ - @Nullable Cover getCoverAtSide(@NotNull EnumFacing side); + @Nullable + Cover getCoverAtSide(@NotNull EnumFacing side); /** * @param side the side to check @@ -75,7 +80,7 @@ default boolean hasCover(@NotNull EnumFacing side) { boolean hasAnyCover(); /** - * @param side the side to get the redstone from + * @param side the side to get the redstone from * @param ignoreCover if the cover is being ignored * @return the redstone signal being input at the side */ diff --git a/src/main/java/gregtech/api/damagesources/DamageSourceTool.java b/src/main/java/gregtech/api/damagesources/DamageSourceTool.java index 005f1a9d2b3..d0d046d8924 100644 --- a/src/main/java/gregtech/api/damagesources/DamageSourceTool.java +++ b/src/main/java/gregtech/api/damagesources/DamageSourceTool.java @@ -21,7 +21,8 @@ public DamageSourceTool(String type, EntityLivingBase player, String deathMessag @Override @SuppressWarnings("deprecation") public ITextComponent getDeathMessage(@Nonnull EntityLivingBase target) { - if (deathMessage == null || damageSourceEntity == null || !I18n.canTranslate(deathMessage)) return super.getDeathMessage(target); + if (deathMessage == null || damageSourceEntity == null || !I18n.canTranslate(deathMessage)) + return super.getDeathMessage(target); return new TextComponentTranslation(deathMessage, target.getDisplayName(), damageSourceEntity.getDisplayName()); } } diff --git a/src/main/java/gregtech/api/damagesources/DamageSources.java b/src/main/java/gregtech/api/damagesources/DamageSources.java index 98efc8cd049..c4ad36b5127 100644 --- a/src/main/java/gregtech/api/damagesources/DamageSources.java +++ b/src/main/java/gregtech/api/damagesources/DamageSources.java @@ -1,6 +1,7 @@ package gregtech.api.damagesources; import gregtech.api.items.toolitem.IGTTool; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; diff --git a/src/main/java/gregtech/api/event/MaterialInfoEvent.java b/src/main/java/gregtech/api/event/MaterialInfoEvent.java index f495de9acfa..868d339b18c 100644 --- a/src/main/java/gregtech/api/event/MaterialInfoEvent.java +++ b/src/main/java/gregtech/api/event/MaterialInfoEvent.java @@ -5,5 +5,4 @@ /** * Fired right before processing handlers for autogenerated recipes are run for items with MaterialInfo. */ -public final class MaterialInfoEvent extends Event { -} +public final class MaterialInfoEvent extends Event {} diff --git a/src/main/java/gregtech/api/fluids/FluidBuilder.java b/src/main/java/gregtech/api/fluids/FluidBuilder.java index b7cccf6dbee..31eb9e358fe 100644 --- a/src/main/java/gregtech/api/fluids/FluidBuilder.java +++ b/src/main/java/gregtech/api/fluids/FluidBuilder.java @@ -1,6 +1,5 @@ package gregtech.api.fluids; -import com.google.common.base.Preconditions; import gregtech.api.GTValues; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.api.fluids.store.FluidStorageKey; @@ -11,11 +10,14 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.util.FluidTooltipUtil; import gregtech.api.util.GTUtility; -import io.github.drmanganese.topaddons.reference.Colors; + import net.minecraft.block.material.MaterialLiquid; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fml.common.Loader; + +import com.google.common.base.Preconditions; +import io.github.drmanganese.topaddons.reference.Colors; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -137,6 +139,7 @@ public FluidBuilder() {} /** * Converts a density value in g/cm^3 to an MC fluid density by comparison to air's density. + * * @param density the density to convert * @return the MC integer density */ @@ -180,6 +183,7 @@ private static int convertToMCDensity(double density) { /** * Converts viscosity in Poise to MC viscosity + * * @param viscosity the viscosity to convert * @return the converted value */ @@ -200,13 +204,14 @@ private static int convertViscosity(double viscosity) { * @param attributes the attributes to add * @return this */ - public @NotNull FluidBuilder attributes(@NotNull FluidAttribute @NotNull ... attributes) { + public @NotNull FluidBuilder attributes(@NotNull FluidAttribute @NotNull... attributes) { Collections.addAll(this.attributes, attributes); return this; } /** * Mark this fluid as having a custom still texture + * * @return this */ public @NotNull FluidBuilder customStill() { @@ -217,6 +222,7 @@ private static int convertViscosity(double viscosity) { /** * Mark this fluid as having a custom flowing texture + * * @return this */ public @NotNull FluidBuilder customFlow() { @@ -226,7 +232,7 @@ private static int convertViscosity(double viscosity) { } /** - * @param hasCustomStill if the fluid has a custom still texture + * @param hasCustomStill if the fluid has a custom still texture * @param hasCustomFlowing if the fluid has a custom flowing texture * @return this */ @@ -310,7 +316,8 @@ private static int convertViscosity(double viscosity) { MaterialLiquid materialLiquid = new GTFluidMaterial(GTUtility.getMapColor(color), false); block = new GTFluidBlock(fluid, materialLiquid, false, false, false); } else { - MaterialLiquid materialLiquid = new GTFluidMaterial(GTUtility.getMapColor(color), material.hasFlag(MaterialFlags.STICKY)); + MaterialLiquid materialLiquid = new GTFluidMaterial(GTUtility.getMapColor(color), + material.hasFlag(MaterialFlags.STICKY)); block = new GTFluidBlock(fluid, materialLiquid, material); } block.setRegistryName(modid, "fluid." + name); diff --git a/src/main/java/gregtech/api/fluids/FluidState.java b/src/main/java/gregtech/api/fluids/FluidState.java index a8b5fb7055b..02cad14303c 100644 --- a/src/main/java/gregtech/api/fluids/FluidState.java +++ b/src/main/java/gregtech/api/fluids/FluidState.java @@ -3,6 +3,7 @@ import org.jetbrains.annotations.NotNull; public enum FluidState { + LIQUID("gregtech.fluid.state_liquid"), GAS("gregtech.fluid.state_gas"), PLASMA("gregtech.fluid.state_plasma"); diff --git a/src/main/java/gregtech/api/fluids/GTFluid.java b/src/main/java/gregtech/api/fluids/GTFluid.java index 193623efa11..5b808f034f8 100644 --- a/src/main/java/gregtech/api/fluids/GTFluid.java +++ b/src/main/java/gregtech/api/fluids/GTFluid.java @@ -3,7 +3,7 @@ import gregtech.api.fluids.attribute.AttributedFluid; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.api.unification.material.Material; -import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; + import net.minecraft.client.resources.I18n; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextComponentTranslation; @@ -11,6 +11,8 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Unmodifiable; @@ -22,7 +24,8 @@ public class GTFluid extends Fluid implements AttributedFluid { private final Collection attributes = new ObjectLinkedOpenHashSet<>(); private final FluidState state; - public GTFluid(@NotNull String fluidName, ResourceLocation still, ResourceLocation flowing, @NotNull FluidState state) { + public GTFluid(@NotNull String fluidName, ResourceLocation still, ResourceLocation flowing, + @NotNull FluidState state) { super(fluidName, still, flowing); setGaseous(state != FluidState.LIQUID); this.state = state; @@ -43,7 +46,6 @@ public void addAttribute(@NotNull FluidAttribute attribute) { attributes.add(attribute); } - public static class GTMaterialFluid extends GTFluid { private final Material material; diff --git a/src/main/java/gregtech/api/fluids/GTFluidBlock.java b/src/main/java/gregtech/api/fluids/GTFluidBlock.java index d1cc60045f1..73089981f2e 100644 --- a/src/main/java/gregtech/api/fluids/GTFluidBlock.java +++ b/src/main/java/gregtech/api/fluids/GTFluidBlock.java @@ -3,6 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.info.MaterialFlags; + import net.minecraft.block.Block; import net.minecraft.block.BlockFire; import net.minecraft.block.material.MaterialLiquid; @@ -16,6 +17,7 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -65,7 +67,10 @@ public boolean isSticky() { @Nullable @Override - public Boolean isEntityInsideMaterial(@NotNull IBlockAccess world, @NotNull BlockPos blockpos, @NotNull IBlockState iblockstate, @NotNull Entity entity, double yToTest, @NotNull net.minecraft.block.material.Material materialIn, boolean testingHead) { + public Boolean isEntityInsideMaterial(@NotNull IBlockAccess world, @NotNull BlockPos blockpos, + @NotNull IBlockState iblockstate, @NotNull Entity entity, double yToTest, + @NotNull net.minecraft.block.material.Material materialIn, + boolean testingHead) { return materialIn == net.minecraft.block.material.Material.WATER ? true : null; } @@ -85,16 +90,19 @@ public int getFlammability(@NotNull IBlockAccess world, @NotNull BlockPos pos, @ } @Override - public void neighborChanged(@NotNull IBlockState state, @NotNull World world, @NotNull BlockPos pos, @NotNull Block neighborBlock, @NotNull BlockPos neighbourPos) { + public void neighborChanged(@NotNull IBlockState state, @NotNull World world, @NotNull BlockPos pos, + @NotNull Block neighborBlock, @NotNull BlockPos neighbourPos) { super.neighborChanged(state, world, pos, neighborBlock, neighbourPos); - if (this.isExplosive && this.isFlammable && neighborBlock instanceof BlockFire && GTValues.RNG.nextInt(5) == 0) { + if (this.isExplosive && this.isFlammable && neighborBlock instanceof BlockFire && + GTValues.RNG.nextInt(5) == 0) { world.setBlockToAir(pos); world.createExplosion(null, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, 1.5F, true); } } @Override - public void onEntityCollision(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, @NotNull Entity entityIn) { + public void onEntityCollision(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, + @NotNull Entity entityIn) { if (this.isSticky) { if (entityIn instanceof EntityPlayer && ((EntityPlayer) entityIn).isCreative()) { return; diff --git a/src/main/java/gregtech/api/fluids/GTFluidRegistration.java b/src/main/java/gregtech/api/fluids/GTFluidRegistration.java index 9145279fef1..dcfb0bc7d4a 100644 --- a/src/main/java/gregtech/api/fluids/GTFluidRegistration.java +++ b/src/main/java/gregtech/api/fluids/GTFluidRegistration.java @@ -1,18 +1,20 @@ package gregtech.api.fluids; -import com.google.common.collect.BiMap; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.FluidProperty; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.common.blocks.MetaBlocks; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.BlockFluidBase; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; + +import com.google.common.collect.BiMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -41,7 +43,7 @@ private static void fixFluidRegistryName(@NotNull Fluid fluid, @NotNull String m try { Field field = FluidRegistry.class.getDeclaredField("masterFluidReference"); field.setAccessible(true); - //noinspection unchecked + // noinspection unchecked MASTER_FLUID_REFERENCE = (BiMap) field.get(null); } catch (NoSuchFieldException | IllegalAccessException e) { throw new IllegalStateException("Could not reflect the Forge Master Fluid Registry", e); diff --git a/src/main/java/gregtech/api/fluids/attribute/AttributedFluid.java b/src/main/java/gregtech/api/fluids/attribute/AttributedFluid.java index dd679dbd5f5..d35a99be991 100644 --- a/src/main/java/gregtech/api/fluids/attribute/AttributedFluid.java +++ b/src/main/java/gregtech/api/fluids/attribute/AttributedFluid.java @@ -1,6 +1,7 @@ package gregtech.api.fluids.attribute; import gregtech.api.fluids.FluidState; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Unmodifiable; @@ -11,12 +12,15 @@ public interface AttributedFluid { /** * @return the attributes on the fluid */ - @NotNull @Unmodifiable Collection getAttributes(); + @NotNull + @Unmodifiable + Collection getAttributes(); /** * @param attribute the attribute to add */ void addAttribute(@NotNull FluidAttribute attribute); - @NotNull FluidState getState(); + @NotNull + FluidState getState(); } diff --git a/src/main/java/gregtech/api/fluids/attribute/FluidAttribute.java b/src/main/java/gregtech/api/fluids/attribute/FluidAttribute.java index 3842bd55160..ad99e07821b 100644 --- a/src/main/java/gregtech/api/fluids/attribute/FluidAttribute.java +++ b/src/main/java/gregtech/api/fluids/attribute/FluidAttribute.java @@ -1,6 +1,7 @@ package gregtech.api.fluids.attribute; import net.minecraft.util.ResourceLocation; + import org.jetbrains.annotations.NotNull; import java.util.List; @@ -13,7 +14,8 @@ public final class FluidAttribute { private final Consumer> containerTooltip; private final int hashCode; - public FluidAttribute(@NotNull ResourceLocation resourceLocation, @NotNull Consumer> fluidTooltip, + public FluidAttribute(@NotNull ResourceLocation resourceLocation, + @NotNull Consumer> fluidTooltip, @NotNull Consumer> containerTooltip) { this.resourceLocation = resourceLocation; this.fluidTooltip = fluidTooltip; diff --git a/src/main/java/gregtech/api/fluids/attribute/FluidAttributes.java b/src/main/java/gregtech/api/fluids/attribute/FluidAttributes.java index ba051d27798..b683d21c4fc 100644 --- a/src/main/java/gregtech/api/fluids/attribute/FluidAttributes.java +++ b/src/main/java/gregtech/api/fluids/attribute/FluidAttributes.java @@ -11,8 +11,7 @@ public final class FluidAttributes { */ public static final FluidAttribute ACID = new FluidAttribute(gregtechId("acid"), list -> list.add(I18n.format("gregtech.fluid.type_acid.tooltip")), - list -> list.add(I18n.format("gregtech.fluid_pipe.acid_proof")) - ); + list -> list.add(I18n.format("gregtech.fluid_pipe.acid_proof"))); private FluidAttributes() {} } diff --git a/src/main/java/gregtech/api/fluids/store/FluidStorage.java b/src/main/java/gregtech/api/fluids/store/FluidStorage.java index 2188697bd90..ea21d756480 100644 --- a/src/main/java/gregtech/api/fluids/store/FluidStorage.java +++ b/src/main/java/gregtech/api/fluids/store/FluidStorage.java @@ -3,8 +3,10 @@ import gregtech.api.fluids.FluidBuilder; import gregtech.api.unification.material.Material; import gregtech.api.util.GTLog; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraftforge.fluids.Fluid; + +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -23,7 +25,7 @@ public FluidStorage() {} /** * Enqueue a fluid for registration * - * @param key the key corresponding with the fluid + * @param key the key corresponding with the fluid * @param builder the FluidBuilder to build */ public void enqueueRegistration(@NotNull FluidStorageKey key, @NotNull FluidBuilder builder) { @@ -80,7 +82,7 @@ public void registerFluids(@NotNull Material material) { /** * Will do nothing if an existing fluid association would be overwritten. * - * @param key the key to associate with the fluid + * @param key the key to associate with the fluid * @param fluid the fluid to associate with the key * @return if the associations were successfully updated */ @@ -95,7 +97,7 @@ public boolean storeNoOverwrites(@NotNull FluidStorageKey key, @NotNull Fluid fl /** * Will overwrite existing fluid associations. * - * @param key the key to associate with the fluid + * @param key the key to associate with the fluid * @param fluid the fluid to associate with the key */ public void store(@NotNull FluidStorageKey key, @NotNull Fluid fluid) { diff --git a/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java b/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java index 79090fc1d8e..dae9a0c02e6 100644 --- a/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java +++ b/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java @@ -2,8 +2,10 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.info.MaterialIconType; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.util.ResourceLocation; + +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/api/gui/BlankUIHolder.java b/src/main/java/gregtech/api/gui/BlankUIHolder.java index 66efbb74208..5eb4bcff7e5 100644 --- a/src/main/java/gregtech/api/gui/BlankUIHolder.java +++ b/src/main/java/gregtech/api/gui/BlankUIHolder.java @@ -13,6 +13,5 @@ public boolean isRemote() { } @Override - public void markAsDirty() { - } -} \ No newline at end of file + public void markAsDirty() {} +} diff --git a/src/main/java/gregtech/api/gui/GuiTextures.java b/src/main/java/gregtech/api/gui/GuiTextures.java index e0b11726854..20936a052b2 100644 --- a/src/main/java/gregtech/api/gui/GuiTextures.java +++ b/src/main/java/gregtech/api/gui/GuiTextures.java @@ -7,264 +7,449 @@ public class GuiTextures { - //GREGTECH + // GREGTECH public static final TextureArea GREGTECH_LOGO = TextureArea.fullImage("textures/gui/icon/gregtech_logo.png"); - public static final TextureArea GREGTECH_LOGO_XMAS = TextureArea.fullImage("textures/gui/icon/gregtech_logo_xmas.png"); - public static final TextureArea GREGTECH_LOGO_DARK = TextureArea.fullImage("textures/gui/icon/gregtech_logo_dark.png"); - public static final TextureArea GREGTECH_LOGO_BLINKING_YELLOW = TextureArea.fullImage("textures/gui/icon/gregtech_logo_blinking_yellow.png"); - public static final TextureArea GREGTECH_LOGO_BLINKING_RED = TextureArea.fullImage("textures/gui/icon/gregtech_logo_blinking_red.png"); + public static final TextureArea GREGTECH_LOGO_XMAS = TextureArea + .fullImage("textures/gui/icon/gregtech_logo_xmas.png"); + public static final TextureArea GREGTECH_LOGO_DARK = TextureArea + .fullImage("textures/gui/icon/gregtech_logo_dark.png"); + public static final TextureArea GREGTECH_LOGO_BLINKING_YELLOW = TextureArea + .fullImage("textures/gui/icon/gregtech_logo_blinking_yellow.png"); + public static final TextureArea GREGTECH_LOGO_BLINKING_RED = TextureArea + .fullImage("textures/gui/icon/gregtech_logo_blinking_red.png"); - //BASE TEXTURES - public static final TextureArea BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/base/background.png", 176, 166, 3, 3); - public static final TextureArea BORDERED_BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/base/bordered_background.png", 195, 136, 4, 4); - public static final TextureArea BOXED_BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/base/boxed_background.png", 256, 174, 11, 11); - public static final SteamTexture BACKGROUND_STEAM = SteamTexture.fullImage("textures/gui/base/background_%s.png", 176, 166, 3, 3); - public static final TextureArea CLIPBOARD_BACKGROUND = TextureArea.fullImage("textures/gui/base/clipboard_background.png"); - public static final TextureArea CLIPBOARD_PAPER_BACKGROUND = TextureArea.fullImage("textures/gui/base/clipboard_paper_background.png"); + // BASE TEXTURES + public static final TextureArea BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/base/background.png", 176, + 166, 3, 3); + public static final TextureArea BORDERED_BACKGROUND = AdoptableTextureArea + .fullImage("textures/gui/base/bordered_background.png", 195, 136, 4, 4); + public static final TextureArea BOXED_BACKGROUND = AdoptableTextureArea + .fullImage("textures/gui/base/boxed_background.png", 256, 174, 11, 11); + public static final SteamTexture BACKGROUND_STEAM = SteamTexture.fullImage("textures/gui/base/background_%s.png", + 176, 166, 3, 3); + public static final TextureArea CLIPBOARD_BACKGROUND = TextureArea + .fullImage("textures/gui/base/clipboard_background.png"); + public static final TextureArea CLIPBOARD_PAPER_BACKGROUND = TextureArea + .fullImage("textures/gui/base/clipboard_paper_background.png"); public static final TextureArea BLANK = AdoptableTextureArea.fullImage("textures/gui/base/blank.png", 1, 1, 0, 0); - public static final TextureArea BLANK_TRANSPARENT = AdoptableTextureArea.fullImage("textures/gui/base/blank_transparent.png", 1, 1, 0, 0); - public static final TextureArea DISPLAY = AdoptableTextureArea.fullImage("textures/gui/base/display.png", 143, 75, 2, 2); - public static final SteamTexture DISPLAY_STEAM = SteamTexture.fullImage("textures/gui/base/display_%s.png", 143, 75, 2, 2); - public static final TextureArea FLUID_SLOT = AdoptableTextureArea.fullImage("textures/gui/base/fluid_slot.png", 18, 18, 1, 1); - public static final TextureArea FLUID_TANK_BACKGROUND = TextureArea.fullImage("textures/gui/base/fluid_tank_background.png"); - public static final TextureArea FLUID_TANK_OVERLAY = TextureArea.fullImage("textures/gui/base/fluid_tank_overlay.png"); + public static final TextureArea BLANK_TRANSPARENT = AdoptableTextureArea + .fullImage("textures/gui/base/blank_transparent.png", 1, 1, 0, 0); + public static final TextureArea DISPLAY = AdoptableTextureArea.fullImage("textures/gui/base/display.png", 143, 75, + 2, 2); + public static final SteamTexture DISPLAY_STEAM = SteamTexture.fullImage("textures/gui/base/display_%s.png", 143, 75, + 2, 2); + public static final TextureArea FLUID_SLOT = AdoptableTextureArea.fullImage("textures/gui/base/fluid_slot.png", 18, + 18, 1, 1); + public static final TextureArea FLUID_TANK_BACKGROUND = TextureArea + .fullImage("textures/gui/base/fluid_tank_background.png"); + public static final TextureArea FLUID_TANK_OVERLAY = TextureArea + .fullImage("textures/gui/base/fluid_tank_overlay.png"); public static final TextureArea SLOT = AdoptableTextureArea.fullImage("textures/gui/base/slot.png", 18, 18, 1, 1); public static final TextureArea SLOT_DARKENED = TextureArea.fullImage("textures/gui/base/darkened_slot.png"); public static final SteamTexture SLOT_STEAM = SteamTexture.fullImage("textures/gui/base/slot_%s.png"); - public static final TextureArea TOGGLE_BUTTON_BACK = TextureArea.fullImage("textures/gui/widget/toggle_button_background.png"); + public static final TextureArea TOGGLE_BUTTON_BACK = TextureArea + .fullImage("textures/gui/widget/toggle_button_background.png"); - //FLUID & ITEM OUTPUT BUTTONS + // FLUID & ITEM OUTPUT BUTTONS public static final TextureArea BLOCKS_INPUT = TextureArea.fullImage("textures/gui/widget/button_blocks_input.png"); public static final TextureArea BUTTON = TextureArea.fullImage("textures/gui/widget/button.png"); - public static final TextureArea BUTTON_ALLOW_IMPORT_EXPORT = TextureArea.fullImage("textures/gui/widget/button_allow_import_export.png"); - public static final TextureArea BUTTON_BLACKLIST = TextureArea.fullImage("textures/gui/widget/button_blacklist.png"); - public static final TextureArea BUTTON_CLEAR_GRID = TextureArea.fullImage("textures/gui/widget/button_clear_grid.png"); - public static final TextureArea BUTTON_FILTER_DAMAGE = TextureArea.fullImage("textures/gui/widget/button_filter_damage.png"); - public static final TextureArea BUTTON_FILTER_NBT = TextureArea.fullImage("textures/gui/widget/button_filter_nbt.png"); - public static final TextureArea BUTTON_FLUID_OUTPUT = TextureArea.fullImage("textures/gui/widget/button_fluid_output_overlay.png"); - public static final TextureArea BUTTON_ITEM_OUTPUT = TextureArea.fullImage("textures/gui/widget/button_item_output_overlay.png"); + public static final TextureArea BUTTON_ALLOW_IMPORT_EXPORT = TextureArea + .fullImage("textures/gui/widget/button_allow_import_export.png"); + public static final TextureArea BUTTON_BLACKLIST = TextureArea + .fullImage("textures/gui/widget/button_blacklist.png"); + public static final TextureArea BUTTON_CLEAR_GRID = TextureArea + .fullImage("textures/gui/widget/button_clear_grid.png"); + public static final TextureArea BUTTON_FILTER_DAMAGE = TextureArea + .fullImage("textures/gui/widget/button_filter_damage.png"); + public static final TextureArea BUTTON_FILTER_NBT = TextureArea + .fullImage("textures/gui/widget/button_filter_nbt.png"); + public static final TextureArea BUTTON_FLUID_OUTPUT = TextureArea + .fullImage("textures/gui/widget/button_fluid_output_overlay.png"); + public static final TextureArea BUTTON_ITEM_OUTPUT = TextureArea + .fullImage("textures/gui/widget/button_item_output_overlay.png"); public static final TextureArea BUTTON_LOCK = TextureArea.fullImage("textures/gui/widget/button_lock.png"); - public static final TextureArea BUTTON_FLUID_VOID = TextureArea.fullImage("textures/gui/widget/button_fluid_void.png"); - public static final TextureArea BUTTON_ITEM_VOID = TextureArea.fullImage("textures/gui/widget/button_item_void.png"); - public static final TextureArea BUTTON_VOID_NONE = TextureArea.fullImage("textures/gui/widget/button_void_none.png"); - public static final TextureArea BUTTON_VOID_MULTIBLOCK = TextureArea.fullImage("textures/gui/widget/button_void_multiblock.png"); + public static final TextureArea BUTTON_FLUID_VOID = TextureArea + .fullImage("textures/gui/widget/button_fluid_void.png"); + public static final TextureArea BUTTON_ITEM_VOID = TextureArea + .fullImage("textures/gui/widget/button_item_void.png"); + public static final TextureArea BUTTON_VOID_NONE = TextureArea + .fullImage("textures/gui/widget/button_void_none.png"); + public static final TextureArea BUTTON_VOID_MULTIBLOCK = TextureArea + .fullImage("textures/gui/widget/button_void_multiblock.png"); public static final TextureArea BUTTON_LEFT = TextureArea.fullImage("textures/gui/widget/left.png"); - public static final TextureArea BUTTON_OVERCLOCK = TextureArea.fullImage("textures/gui/widget/button_overclock.png"); - public static final TextureArea BUTTON_PUBLIC_PRIVATE = TextureArea.fullImage("textures/gui/widget/button_public_private.png"); + public static final TextureArea BUTTON_OVERCLOCK = TextureArea + .fullImage("textures/gui/widget/button_overclock.png"); + public static final TextureArea BUTTON_PUBLIC_PRIVATE = TextureArea + .fullImage("textures/gui/widget/button_public_private.png"); public static final TextureArea BUTTON_RIGHT = TextureArea.fullImage("textures/gui/widget/right.png"); - public static final TextureArea BUTTON_SWITCH_VIEW = TextureArea.fullImage("textures/gui/widget/button_switch_view.png"); - public static final TextureArea BUTTON_WORKING_ENABLE = TextureArea.fullImage("textures/gui/widget/button_working_enable.png"); - public static final TextureArea BUTTON_INT_CIRCUIT_PLUS = TextureArea.fullImage("textures/gui/widget/button_circuit_plus.png"); - public static final TextureArea BUTTON_INT_CIRCUIT_MINUS = TextureArea.fullImage("textures/gui/widget/button_circuit_minus.png"); - public static final TextureArea CLIPBOARD_BUTTON = TextureArea.fullImage("textures/gui/widget/clipboard_button.png"); - public static final SizedTextureArea CLIPBOARD_TEXT_BOX = AdoptableTextureArea.fullImage("textures/gui/widget/clipboard_text_box.png", 9, 18, 1, 1); - public static final TextureArea DISTRIBUTION_MODE = TextureArea.fullImage("textures/gui/widget/button_distribution_mode.png"); + public static final TextureArea BUTTON_SWITCH_VIEW = TextureArea + .fullImage("textures/gui/widget/button_switch_view.png"); + public static final TextureArea BUTTON_WORKING_ENABLE = TextureArea + .fullImage("textures/gui/widget/button_working_enable.png"); + public static final TextureArea BUTTON_INT_CIRCUIT_PLUS = TextureArea + .fullImage("textures/gui/widget/button_circuit_plus.png"); + public static final TextureArea BUTTON_INT_CIRCUIT_MINUS = TextureArea + .fullImage("textures/gui/widget/button_circuit_minus.png"); + public static final TextureArea CLIPBOARD_BUTTON = TextureArea + .fullImage("textures/gui/widget/clipboard_button.png"); + public static final SizedTextureArea CLIPBOARD_TEXT_BOX = AdoptableTextureArea + .fullImage("textures/gui/widget/clipboard_text_box.png", 9, 18, 1, 1); + public static final TextureArea DISTRIBUTION_MODE = TextureArea + .fullImage("textures/gui/widget/button_distribution_mode.png"); public static final TextureArea LOCK = TextureArea.fullImage("textures/gui/widget/lock.png"); public static final TextureArea LOCK_WHITE = TextureArea.fullImage("textures/gui/widget/lock_white.png"); public static final TextureArea SWITCH = TextureArea.fullImage("textures/gui/widget/switch.png"); - public static final TextureArea SWITCH_HORIZONTAL = TextureArea.fullImage("textures/gui/widget/switch_horizontal.png"); - public static final SizedTextureArea VANILLA_BUTTON = SizedTextureArea.fullImage("textures/gui/widget/vanilla_button.png", 200, 40); + public static final TextureArea SWITCH_HORIZONTAL = TextureArea + .fullImage("textures/gui/widget/switch_horizontal.png"); + public static final SizedTextureArea VANILLA_BUTTON = SizedTextureArea + .fullImage("textures/gui/widget/vanilla_button.png", 200, 40); public static final TextureArea BUTTON_POWER = TextureArea.fullImage("textures/gui/widget/button_power.png"); - public static final TextureArea BUTTON_POWER_DETAIL = TextureArea.fullImage("textures/gui/widget/button_power_detail.png"); - public static final TextureArea BUTTON_DISTINCT_BUSES = TextureArea.fullImage("textures/gui/widget/button_distinct_buses.png"); - public static final TextureArea BUTTON_NO_DISTINCT_BUSES = TextureArea.fullImage("textures/gui/widget/button_no_distinct_buses.png"); + public static final TextureArea BUTTON_POWER_DETAIL = TextureArea + .fullImage("textures/gui/widget/button_power_detail.png"); + public static final TextureArea BUTTON_DISTINCT_BUSES = TextureArea + .fullImage("textures/gui/widget/button_distinct_buses.png"); + public static final TextureArea BUTTON_NO_DISTINCT_BUSES = TextureArea + .fullImage("textures/gui/widget/button_no_distinct_buses.png"); public static final TextureArea BUTTON_NO_FLEX = TextureArea.fullImage("textures/gui/widget/button_no_flex.png"); - public static final TextureArea BUTTON_MULTI_MAP = TextureArea.fullImage("textures/gui/widget/button_multi_map.png"); - public static final TextureArea BUTTON_MINER_MODES = TextureArea.fullImage("textures/gui/widget/button_miner_modes.png"); - public static final TextureArea BUTTON_THROTTLE_MINUS = TextureArea.fullImage("textures/gui/widget/button_throttle_minus.png"); - public static final TextureArea BUTTON_THROTTLE_PLUS = TextureArea.fullImage("textures/gui/widget/button_throttle_plus.png"); + public static final TextureArea BUTTON_MULTI_MAP = TextureArea + .fullImage("textures/gui/widget/button_multi_map.png"); + public static final TextureArea BUTTON_MINER_MODES = TextureArea + .fullImage("textures/gui/widget/button_miner_modes.png"); + public static final TextureArea BUTTON_THROTTLE_MINUS = TextureArea + .fullImage("textures/gui/widget/button_throttle_minus.png"); + public static final TextureArea BUTTON_THROTTLE_PLUS = TextureArea + .fullImage("textures/gui/widget/button_throttle_plus.png"); - //INDICATORS & ICONS - public static final TextureArea INDICATOR_NO_ENERGY = TextureArea.fullImage("textures/gui/base/indicator_no_energy.png"); - public static final SteamTexture INDICATOR_NO_STEAM = SteamTexture.fullImage("textures/gui/base/indicator_no_steam_%s.png"); + // INDICATORS & ICONS + public static final TextureArea INDICATOR_NO_ENERGY = TextureArea + .fullImage("textures/gui/base/indicator_no_energy.png"); + public static final SteamTexture INDICATOR_NO_STEAM = SteamTexture + .fullImage("textures/gui/base/indicator_no_steam_%s.png"); public static final TextureArea TANK_ICON = TextureArea.fullImage("textures/gui/base/tank_icon.png"); - //WIDGET UI RELATED - public static final TextureArea SLIDER_BACKGROUND = TextureArea.fullImage("textures/gui/widget/slider_background.png"); - public static final TextureArea SLIDER_BACKGROUND_VERTICAL = TextureArea.fullImage("textures/gui/widget/slider_background_vertical.png"); + // WIDGET UI RELATED + public static final TextureArea SLIDER_BACKGROUND = TextureArea + .fullImage("textures/gui/widget/slider_background.png"); + public static final TextureArea SLIDER_BACKGROUND_VERTICAL = TextureArea + .fullImage("textures/gui/widget/slider_background_vertical.png"); public static final TextureArea SLIDER_ICON = TextureArea.fullImage("textures/gui/widget/slider.png"); - public static final TextureArea MAINTENANCE_ICON = TextureArea.fullImage("textures/gui/widget/button_maintenance.png"); + public static final TextureArea MAINTENANCE_ICON = TextureArea + .fullImage("textures/gui/widget/button_maintenance.png"); - //PRIMITIVE - public static final TextureArea PRIMITIVE_BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/primitive/primitive_background.png", 176, 166, 3, 3); - public static final TextureArea PRIMITIVE_SLOT = AdoptableTextureArea.fullImage("textures/gui/primitive/primitive_slot.png", 18, 18, 1, 1); - public static final TextureArea PRIMITIVE_FURNACE_OVERLAY = TextureArea.fullImage("textures/gui/primitive/overlay_primitive_furnace.png"); - public static final TextureArea PRIMITIVE_DUST_OVERLAY = TextureArea.fullImage("textures/gui/primitive/overlay_primitive_dust.png"); - public static final TextureArea PRIMITIVE_INGOT_OVERLAY = TextureArea.fullImage("textures/gui/primitive/overlay_primitive_ingot.png"); - public static final TextureArea PRIMITIVE_LARGE_FLUID_TANK = TextureArea.fullImage("textures/gui/primitive/primitive_large_fluid_tank.png"); - public static final TextureArea PRIMITIVE_LARGE_FLUID_TANK_OVERLAY = TextureArea.fullImage("textures/gui/primitive/primitive_large_fluid_tank_overlay.png"); - public static final TextureArea PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR = TextureArea.fullImage("textures/gui/primitive/progress_bar_primitive_blast_furnace.png"); + // PRIMITIVE + public static final TextureArea PRIMITIVE_BACKGROUND = AdoptableTextureArea + .fullImage("textures/gui/primitive/primitive_background.png", 176, 166, 3, 3); + public static final TextureArea PRIMITIVE_SLOT = AdoptableTextureArea + .fullImage("textures/gui/primitive/primitive_slot.png", 18, 18, 1, 1); + public static final TextureArea PRIMITIVE_FURNACE_OVERLAY = TextureArea + .fullImage("textures/gui/primitive/overlay_primitive_furnace.png"); + public static final TextureArea PRIMITIVE_DUST_OVERLAY = TextureArea + .fullImage("textures/gui/primitive/overlay_primitive_dust.png"); + public static final TextureArea PRIMITIVE_INGOT_OVERLAY = TextureArea + .fullImage("textures/gui/primitive/overlay_primitive_ingot.png"); + public static final TextureArea PRIMITIVE_LARGE_FLUID_TANK = TextureArea + .fullImage("textures/gui/primitive/primitive_large_fluid_tank.png"); + public static final TextureArea PRIMITIVE_LARGE_FLUID_TANK_OVERLAY = TextureArea + .fullImage("textures/gui/primitive/primitive_large_fluid_tank_overlay.png"); + public static final TextureArea PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR = TextureArea + .fullImage("textures/gui/primitive/progress_bar_primitive_blast_furnace.png"); - //SLOT OVERLAYS - public static final TextureArea ATOMIC_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/atomic_overlay_1.png"); - public static final TextureArea ATOMIC_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/atomic_overlay_2.png"); - public static final TextureArea ARROW_INPUT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/arrow_input_overlay.png"); - public static final TextureArea ARROW_OUTPUT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/arrow_output_overlay.png"); + // SLOT OVERLAYS + public static final TextureArea ATOMIC_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/atomic_overlay_1.png"); + public static final TextureArea ATOMIC_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/atomic_overlay_2.png"); + public static final TextureArea ARROW_INPUT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/arrow_input_overlay.png"); + public static final TextureArea ARROW_OUTPUT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/arrow_output_overlay.png"); public static final TextureArea BATTERY_OVERLAY = TextureArea.fullImage("textures/gui/overlay/battery_overlay.png"); - public static final TextureArea BEAKER_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/beaker_overlay_1.png"); - public static final TextureArea BEAKER_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/beaker_overlay_2.png"); - public static final TextureArea BEAKER_OVERLAY_3 = TextureArea.fullImage("textures/gui/overlay/beaker_overlay_3.png"); - public static final TextureArea BEAKER_OVERLAY_4 = TextureArea.fullImage("textures/gui/overlay/beaker_overlay_4.png"); + public static final TextureArea BEAKER_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/beaker_overlay_1.png"); + public static final TextureArea BEAKER_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/beaker_overlay_2.png"); + public static final TextureArea BEAKER_OVERLAY_3 = TextureArea + .fullImage("textures/gui/overlay/beaker_overlay_3.png"); + public static final TextureArea BEAKER_OVERLAY_4 = TextureArea + .fullImage("textures/gui/overlay/beaker_overlay_4.png"); public static final TextureArea BENDER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/bender_overlay.png"); public static final TextureArea BOX_OVERLAY = TextureArea.fullImage("textures/gui/overlay/box_overlay.png"); public static final TextureArea BOXED_OVERLAY = TextureArea.fullImage("textures/gui/overlay/boxed_overlay.png"); public static final TextureArea BREWER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/brewer_overlay.png"); public static final TextureArea CANNER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/canner_overlay.png"); - public static final TextureArea CHARGER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/charger_slot_overlay.png"); - public static final TextureArea CANISTER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/canister_overlay.png"); - public static final SteamTexture CANISTER_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/canister_overlay_%s.png"); - public static final TextureArea CENTRIFUGE_OVERLAY = TextureArea.fullImage("textures/gui/overlay/centrifuge_overlay.png"); + public static final TextureArea CHARGER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/charger_slot_overlay.png"); + public static final TextureArea CANISTER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/canister_overlay.png"); + public static final SteamTexture CANISTER_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/canister_overlay_%s.png"); + public static final TextureArea CENTRIFUGE_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/centrifuge_overlay.png"); public static final TextureArea CIRCUIT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/circuit_overlay.png"); - public static final SteamTexture COAL_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/coal_overlay_%s.png"); - public static final TextureArea COMPRESSOR_OVERLAY = TextureArea.fullImage("textures/gui/overlay/compressor_overlay.png"); - public static final SteamTexture COMPRESSOR_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/compressor_overlay_%s.png"); - public static final TextureArea CRACKING_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/cracking_overlay_1.png"); - public static final TextureArea CRACKING_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/cracking_overlay_2.png"); - public static final TextureArea CRUSHED_ORE_OVERLAY = TextureArea.fullImage("textures/gui/overlay/crushed_ore_overlay.png"); - public static final SteamTexture CRUSHED_ORE_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/crushed_ore_overlay_%s.png"); + public static final SteamTexture COAL_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/coal_overlay_%s.png"); + public static final TextureArea COMPRESSOR_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/compressor_overlay.png"); + public static final SteamTexture COMPRESSOR_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/compressor_overlay_%s.png"); + public static final TextureArea CRACKING_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/cracking_overlay_1.png"); + public static final TextureArea CRACKING_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/cracking_overlay_2.png"); + public static final TextureArea CRUSHED_ORE_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/crushed_ore_overlay.png"); + public static final SteamTexture CRUSHED_ORE_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/crushed_ore_overlay_%s.png"); public static final TextureArea CRYSTAL_OVERLAY = TextureArea.fullImage("textures/gui/overlay/crystal_overlay.png"); public static final TextureArea CUTTER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/cutter_overlay.png"); - public static final TextureArea DARK_CANISTER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/dark_canister_overlay.png"); + public static final TextureArea DARK_CANISTER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/dark_canister_overlay.png"); public static final TextureArea DUST_OVERLAY = TextureArea.fullImage("textures/gui/overlay/dust_overlay.png"); - public static final SteamTexture DUST_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/dust_overlay_%s.png"); - public static final TextureArea EXTRACTOR_OVERLAY = TextureArea.fullImage("textures/gui/overlay/extractor_overlay.png"); - public static final SteamTexture EXTRACTOR_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/extractor_overlay_%s.png"); - public static final TextureArea FILTER_SLOT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/filter_slot_overlay.png"); - public static final TextureArea FURNACE_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/furnace_overlay_1.png"); - public static final TextureArea FURNACE_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/furnace_overlay_2.png"); - public static final SteamTexture FURNACE_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/furnace_overlay_%s.png"); + public static final SteamTexture DUST_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/dust_overlay_%s.png"); + public static final TextureArea EXTRACTOR_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/extractor_overlay.png"); + public static final SteamTexture EXTRACTOR_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/extractor_overlay_%s.png"); + public static final TextureArea FILTER_SLOT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/filter_slot_overlay.png"); + public static final TextureArea FURNACE_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/furnace_overlay_1.png"); + public static final TextureArea FURNACE_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/furnace_overlay_2.png"); + public static final SteamTexture FURNACE_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/furnace_overlay_%s.png"); public static final TextureArea HAMMER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/hammer_overlay.png"); - public static final SteamTexture HAMMER_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/hammer_overlay_%s.png"); - public static final TextureArea HEATING_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/heating_overlay_1.png"); - public static final TextureArea HEATING_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/heating_overlay_2.png"); - public static final TextureArea IMPLOSION_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/implosion_overlay_1.png"); - public static final TextureArea IMPLOSION_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/implosion_overlay_2.png"); + public static final SteamTexture HAMMER_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/hammer_overlay_%s.png"); + public static final TextureArea HEATING_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/heating_overlay_1.png"); + public static final TextureArea HEATING_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/heating_overlay_2.png"); + public static final TextureArea IMPLOSION_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/implosion_overlay_1.png"); + public static final TextureArea IMPLOSION_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/implosion_overlay_2.png"); public static final TextureArea IN_SLOT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/in_slot_overlay.png"); - public static final SteamTexture IN_SLOT_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/in_slot_overlay_%s.png"); + public static final SteamTexture IN_SLOT_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/in_slot_overlay_%s.png"); public static final TextureArea INGOT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/ingot_overlay.png"); - public static final TextureArea INT_CIRCUIT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/int_circuit_overlay.png"); + public static final TextureArea INT_CIRCUIT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/int_circuit_overlay.png"); public static final TextureArea LENS_OVERLAY = TextureArea.fullImage("textures/gui/overlay/lens_overlay.png"); - public static final TextureArea LIGHTNING_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/lightning_overlay_1.png"); - public static final TextureArea LIGHTNING_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/lightning_overlay_2.png"); + public static final TextureArea LIGHTNING_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/lightning_overlay_1.png"); + public static final TextureArea LIGHTNING_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/lightning_overlay_2.png"); public static final TextureArea MOLD_OVERLAY = TextureArea.fullImage("textures/gui/overlay/mold_overlay.png"); - public static final TextureArea MOLECULAR_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/molecular_overlay_1.png"); - public static final TextureArea MOLECULAR_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/molecular_overlay_2.png"); - public static final TextureArea MOLECULAR_OVERLAY_3 = TextureArea.fullImage("textures/gui/overlay/molecular_overlay_3.png"); - public static final TextureArea MOLECULAR_OVERLAY_4 = TextureArea.fullImage("textures/gui/overlay/molecular_overlay_4.png"); - public static final TextureArea OUT_SLOT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/out_slot_overlay.png"); - public static final SteamTexture OUT_SLOT_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/out_slot_overlay_%s.png"); + public static final TextureArea MOLECULAR_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/molecular_overlay_1.png"); + public static final TextureArea MOLECULAR_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/molecular_overlay_2.png"); + public static final TextureArea MOLECULAR_OVERLAY_3 = TextureArea + .fullImage("textures/gui/overlay/molecular_overlay_3.png"); + public static final TextureArea MOLECULAR_OVERLAY_4 = TextureArea + .fullImage("textures/gui/overlay/molecular_overlay_4.png"); + public static final TextureArea OUT_SLOT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/out_slot_overlay.png"); + public static final SteamTexture OUT_SLOT_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/out_slot_overlay_%s.png"); public static final TextureArea PAPER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/paper_overlay.png"); - public static final TextureArea PRINTED_PAPER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/printed_paper_overlay.png"); + public static final TextureArea PRINTED_PAPER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/printed_paper_overlay.png"); public static final TextureArea PIPE_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/pipe_overlay_2.png"); public static final TextureArea PIPE_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/pipe_overlay_1.png"); public static final TextureArea PRESS_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/press_overlay_1.png"); public static final TextureArea PRESS_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/press_overlay_2.png"); public static final TextureArea PRESS_OVERLAY_3 = TextureArea.fullImage("textures/gui/overlay/press_overlay_3.png"); public static final TextureArea PRESS_OVERLAY_4 = TextureArea.fullImage("textures/gui/overlay/press_overlay_4.png"); - public static final TextureArea SAWBLADE_OVERLAY = TextureArea.fullImage("textures/gui/overlay/sawblade_overlay.png"); - public static final TextureArea SOLIDIFIER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/solidifier_overlay.png"); - public static final TextureArea STRING_SLOT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/string_slot_overlay.png"); - public static final TextureArea TOOL_SLOT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/tool_slot_overlay.png"); + public static final TextureArea SAWBLADE_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/sawblade_overlay.png"); + public static final TextureArea SOLIDIFIER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/solidifier_overlay.png"); + public static final TextureArea STRING_SLOT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/string_slot_overlay.png"); + public static final TextureArea TOOL_SLOT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/tool_slot_overlay.png"); public static final TextureArea TURBINE_OVERLAY = TextureArea.fullImage("textures/gui/overlay/turbine_overlay.png"); public static final TextureArea VIAL_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/vial_overlay_1.png"); public static final TextureArea VIAL_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/vial_overlay_2.png"); - public static final TextureArea WIREMILL_OVERLAY = TextureArea.fullImage("textures/gui/overlay/wiremill_overlay.png"); - public static final TextureArea POSITIVE_MATTER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/positive_matter_overlay.png"); - public static final TextureArea NEUTRAL_MATTER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/neutral_matter_overlay.png"); - public static final TextureArea DATA_ORB_OVERLAY = TextureArea.fullImage("textures/gui/overlay/data_orb_overlay.png"); + public static final TextureArea WIREMILL_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/wiremill_overlay.png"); + public static final TextureArea POSITIVE_MATTER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/positive_matter_overlay.png"); + public static final TextureArea NEUTRAL_MATTER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/neutral_matter_overlay.png"); + public static final TextureArea DATA_ORB_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/data_orb_overlay.png"); public static final TextureArea SCANNER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/scanner_overlay.png"); - public static final TextureArea DUCT_TAPE_OVERLAY = TextureArea.fullImage("textures/gui/overlay/duct_tape_overlay.png"); - public static final TextureArea RESEARCH_STATION_OVERLAY = TextureArea.fullImage("textures/gui/overlay/research_station_overlay.png"); + public static final TextureArea DUCT_TAPE_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/duct_tape_overlay.png"); + public static final TextureArea RESEARCH_STATION_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/research_station_overlay.png"); - //PROGRESS BARS - public static final TextureArea PROGRESS_BAR_ARC_FURNACE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_arc_furnace.png"); - public static final TextureArea PROGRESS_BAR_ARROW = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_arrow.png"); - public static final SteamTexture PROGRESS_BAR_ARROW_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_arrow_%s.png"); - public static final TextureArea PROGRESS_BAR_ARROW_MULTIPLE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_arrow_multiple.png"); - public static final TextureArea PROGRESS_BAR_ASSEMBLY_LINE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_assembly_line.png"); - public static final TextureArea PROGRESS_BAR_ASSEMBLY_LINE_ARROW = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_assembly_line_arrow.png"); - public static final TextureArea PROGRESS_BAR_BATH = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_bath.png"); - public static final TextureArea PROGRESS_BAR_BENDING = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_bending.png"); - public static final SteamTexture PROGRESS_BAR_BOILER_EMPTY = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_boiler_empty_%s.png"); - public static final SteamTexture PROGRESS_BAR_BOILER_FUEL = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_boiler_fuel_%s.png"); - public static final TextureArea PROGRESS_BAR_BOILER_HEAT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_boiler_heat.png"); - public static final TextureArea PROGRESS_BAR_CANNER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_canner.png"); - public static final TextureArea PROGRESS_BAR_CIRCUIT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_circuit.png"); - public static final TextureArea PROGRESS_BAR_CIRCUIT_ASSEMBLER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_circuit_assembler.png"); - public static final TextureArea PROGRESS_BAR_COKE_OVEN = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_coke_oven.png"); - public static final TextureArea PROGRESS_BAR_COMPRESS = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_compress.png"); - public static final SteamTexture PROGRESS_BAR_COMPRESS_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_compress_%s.png"); - public static final TextureArea PROGRESS_BAR_CRACKING = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_cracking.png"); - public static final TextureArea PROGRESS_BAR_CRACKING_INPUT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_cracking_2.png"); - public static final TextureArea PROGRESS_BAR_CRYSTALLIZATION = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_crystallization.png"); - public static final TextureArea PROGRESS_BAR_DISTILLATION_TOWER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_distillation_tower.png"); - public static final TextureArea PROGRESS_BAR_EXTRACT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_extract.png"); - public static final SteamTexture PROGRESS_BAR_EXTRACT_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_extract_%s.png"); - public static final TextureArea PROGRESS_BAR_EXTRUDER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_extruder.png"); - public static final TextureArea PROGRESS_BAR_FUSION = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fusion.png"); - public static final TextureArea PROGRESS_BAR_GAS_COLLECTOR = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_gas_collector.png"); - public static final TextureArea PROGRESS_BAR_HAMMER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_hammer.png"); - public static final SteamTexture PROGRESS_BAR_HAMMER_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_hammer_%s.png"); - public static final TextureArea PROGRESS_BAR_HAMMER_BASE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_hammer_base.png"); - public static final SteamTexture PROGRESS_BAR_HAMMER_BASE_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_hammer_base_%s.png"); - public static final TextureArea PROGRESS_BAR_LATHE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lathe.png"); - public static final TextureArea PROGRESS_BAR_LATHE_BASE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lathe_base.png"); - public static final TextureArea PROGRESS_BAR_MACERATE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_macerate.png"); - public static final SteamTexture PROGRESS_BAR_MACERATE_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_macerate_%s.png"); - public static final TextureArea PROGRESS_BAR_MAGNET = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_magnet.png"); - public static final TextureArea PROGRESS_BAR_MASS_FAB = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_mass_fab.png"); - public static final TextureArea PROGRESS_BAR_MIXER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_mixer.png"); - public static final TextureArea PROGRESS_BAR_PACKER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_packer.png"); - public static final TextureArea PROGRESS_BAR_RECYCLER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_recycler.png"); - public static final TextureArea PROGRESS_BAR_REPLICATOR = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_replicator.png"); - public static final TextureArea PROGRESS_BAR_SIFT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_sift.png"); - public static final TextureArea PROGRESS_BAR_SLICE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_slice.png"); - public static final SteamTexture PROGRESS_BAR_SOLAR_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_solar_%s.png"); - public static final TextureArea PROGRESS_BAR_UNLOCK = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_unlock.png"); - public static final TextureArea PROGRESS_BAR_UNPACKER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_unpacker.png"); - public static final TextureArea PROGRESS_BAR_WIREMILL = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_wiremill.png"); - public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_1 = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_research_station_1.png"); - public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_2 = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_research_station_2.png"); - public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_BASE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_research_station_base.png"); - public static final TextureArea PROGRESS_BAR_FUSION_ENERGY = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fusion_energy.png"); - public static final TextureArea PROGRESS_BAR_FUSION_HEAT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fusion_heat.png"); - public static final TextureArea PROGRESS_BAR_MULTI_ENERGY_YELLOW = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_multi_energy_yellow.png"); - public static final TextureArea PROGRESS_BAR_HPCA_COMPUTATION = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_hpca_computation.png"); - public static final TextureArea PROGRESS_BAR_LCE_FUEL = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lce_fuel.png"); - public static final TextureArea PROGRESS_BAR_LCE_LUBRICANT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lce_lubricant.png"); - public static final TextureArea PROGRESS_BAR_LCE_OXYGEN = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lce_oxygen.png"); - public static final TextureArea PROGRESS_BAR_TURBINE_ROTOR_SPEED = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_speed.png"); - public static final TextureArea PROGRESS_BAR_TURBINE_ROTOR_DURABILITY = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_durability.png"); - public static final TextureArea PROGRESS_BAR_FLUID_RIG_DEPLETION = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fluid_rig_depletion.png"); + // PROGRESS BARS + public static final TextureArea PROGRESS_BAR_ARC_FURNACE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_arc_furnace.png"); + public static final TextureArea PROGRESS_BAR_ARROW = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_arrow.png"); + public static final SteamTexture PROGRESS_BAR_ARROW_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_arrow_%s.png"); + public static final TextureArea PROGRESS_BAR_ARROW_MULTIPLE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_arrow_multiple.png"); + public static final TextureArea PROGRESS_BAR_ASSEMBLY_LINE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_assembly_line.png"); + public static final TextureArea PROGRESS_BAR_ASSEMBLY_LINE_ARROW = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_assembly_line_arrow.png"); + public static final TextureArea PROGRESS_BAR_BATH = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_bath.png"); + public static final TextureArea PROGRESS_BAR_BENDING = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_bending.png"); + public static final SteamTexture PROGRESS_BAR_BOILER_EMPTY = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_boiler_empty_%s.png"); + public static final SteamTexture PROGRESS_BAR_BOILER_FUEL = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_boiler_fuel_%s.png"); + public static final TextureArea PROGRESS_BAR_BOILER_HEAT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_boiler_heat.png"); + public static final TextureArea PROGRESS_BAR_CANNER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_canner.png"); + public static final TextureArea PROGRESS_BAR_CIRCUIT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_circuit.png"); + public static final TextureArea PROGRESS_BAR_CIRCUIT_ASSEMBLER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_circuit_assembler.png"); + public static final TextureArea PROGRESS_BAR_COKE_OVEN = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_coke_oven.png"); + public static final TextureArea PROGRESS_BAR_COMPRESS = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_compress.png"); + public static final SteamTexture PROGRESS_BAR_COMPRESS_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_compress_%s.png"); + public static final TextureArea PROGRESS_BAR_CRACKING = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_cracking.png"); + public static final TextureArea PROGRESS_BAR_CRACKING_INPUT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_cracking_2.png"); + public static final TextureArea PROGRESS_BAR_CRYSTALLIZATION = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_crystallization.png"); + public static final TextureArea PROGRESS_BAR_DISTILLATION_TOWER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_distillation_tower.png"); + public static final TextureArea PROGRESS_BAR_EXTRACT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_extract.png"); + public static final SteamTexture PROGRESS_BAR_EXTRACT_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_extract_%s.png"); + public static final TextureArea PROGRESS_BAR_EXTRUDER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_extruder.png"); + public static final TextureArea PROGRESS_BAR_FUSION = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_fusion.png"); + public static final TextureArea PROGRESS_BAR_GAS_COLLECTOR = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_gas_collector.png"); + public static final TextureArea PROGRESS_BAR_HAMMER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_hammer.png"); + public static final SteamTexture PROGRESS_BAR_HAMMER_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_hammer_%s.png"); + public static final TextureArea PROGRESS_BAR_HAMMER_BASE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_hammer_base.png"); + public static final SteamTexture PROGRESS_BAR_HAMMER_BASE_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_hammer_base_%s.png"); + public static final TextureArea PROGRESS_BAR_LATHE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_lathe.png"); + public static final TextureArea PROGRESS_BAR_LATHE_BASE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_lathe_base.png"); + public static final TextureArea PROGRESS_BAR_MACERATE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_macerate.png"); + public static final SteamTexture PROGRESS_BAR_MACERATE_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_macerate_%s.png"); + public static final TextureArea PROGRESS_BAR_MAGNET = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_magnet.png"); + public static final TextureArea PROGRESS_BAR_MASS_FAB = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_mass_fab.png"); + public static final TextureArea PROGRESS_BAR_MIXER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_mixer.png"); + public static final TextureArea PROGRESS_BAR_PACKER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_packer.png"); + public static final TextureArea PROGRESS_BAR_RECYCLER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_recycler.png"); + public static final TextureArea PROGRESS_BAR_REPLICATOR = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_replicator.png"); + public static final TextureArea PROGRESS_BAR_SIFT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_sift.png"); + public static final TextureArea PROGRESS_BAR_SLICE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_slice.png"); + public static final SteamTexture PROGRESS_BAR_SOLAR_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_solar_%s.png"); + public static final TextureArea PROGRESS_BAR_UNLOCK = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_unlock.png"); + public static final TextureArea PROGRESS_BAR_UNPACKER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_unpacker.png"); + public static final TextureArea PROGRESS_BAR_WIREMILL = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_wiremill.png"); + public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_1 = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_research_station_1.png"); + public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_2 = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_research_station_2.png"); + public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_BASE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_research_station_base.png"); + public static final TextureArea PROGRESS_BAR_FUSION_ENERGY = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_fusion_energy.png"); + public static final TextureArea PROGRESS_BAR_FUSION_HEAT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_fusion_heat.png"); + public static final TextureArea PROGRESS_BAR_MULTI_ENERGY_YELLOW = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_multi_energy_yellow.png"); + public static final TextureArea PROGRESS_BAR_HPCA_COMPUTATION = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_hpca_computation.png"); + public static final TextureArea PROGRESS_BAR_LCE_FUEL = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_lce_fuel.png"); + public static final TextureArea PROGRESS_BAR_LCE_LUBRICANT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_lce_lubricant.png"); + public static final TextureArea PROGRESS_BAR_LCE_OXYGEN = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_lce_oxygen.png"); + public static final TextureArea PROGRESS_BAR_TURBINE_ROTOR_SPEED = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_speed.png"); + public static final TextureArea PROGRESS_BAR_TURBINE_ROTOR_DURABILITY = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_durability.png"); + public static final TextureArea PROGRESS_BAR_FLUID_RIG_DEPLETION = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_fluid_rig_depletion.png"); // Fusion reactor diagram progress bar parts - public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BL = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/bottom_left.png"); - public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BR = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/bottom_right.png"); - public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TL = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/top_left.png"); - public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TR = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/top_right.png"); + public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BL = TextureArea + .fullImage("textures/gui/progress_bar/fusion_diagram/bottom_left.png"); + public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BR = TextureArea + .fullImage("textures/gui/progress_bar/fusion_diagram/bottom_right.png"); + public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TL = TextureArea + .fullImage("textures/gui/progress_bar/fusion_diagram/top_left.png"); + public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TR = TextureArea + .fullImage("textures/gui/progress_bar/fusion_diagram/top_right.png"); - //JEI + // JEI public static final TextureArea INFO_ICON = TextureArea.fullImage("textures/gui/widget/information.png"); - public static final TextureArea MULTIBLOCK_CATEGORY = TextureArea.fullImage("textures/gui/icon/multiblock_category.png"); - public static final TextureArea ARC_FURNACE_RECYLCING_CATEGORY = TextureArea.fullImage("textures/gui/icon/arc_furnace_recycling.png"); - public static final TextureArea MACERATOR_RECYLCING_CATEGORY = TextureArea.fullImage("textures/gui/icon/macerator_recycling.png"); - public static final TextureArea EXTRACTOR_RECYLCING_CATEGORY = TextureArea.fullImage("textures/gui/icon/extractor_recycling.png"); + public static final TextureArea MULTIBLOCK_CATEGORY = TextureArea + .fullImage("textures/gui/icon/multiblock_category.png"); + public static final TextureArea ARC_FURNACE_RECYLCING_CATEGORY = TextureArea + .fullImage("textures/gui/icon/arc_furnace_recycling.png"); + public static final TextureArea MACERATOR_RECYLCING_CATEGORY = TextureArea + .fullImage("textures/gui/icon/macerator_recycling.png"); + public static final TextureArea EXTRACTOR_RECYLCING_CATEGORY = TextureArea + .fullImage("textures/gui/icon/extractor_recycling.png"); // Covers - public static final TextureArea COVER_MACHINE_CONTROLLER = TextureArea.fullImage("textures/items/metaitems/cover.controller.png"); + public static final TextureArea COVER_MACHINE_CONTROLLER = TextureArea + .fullImage("textures/items/metaitems/cover.controller.png"); // Ore Filter public static final TextureArea ORE_FILTER_INFO = TextureArea.fullImage("textures/gui/widget/ore_filter/info.png"); - public static final TextureArea ORE_FILTER_SUCCESS = TextureArea.fullImage("textures/gui/widget/ore_filter/success.png"); - public static final TextureArea ORE_FILTER_ERROR = TextureArea.fullImage("textures/gui/widget/ore_filter/error.png"); + public static final TextureArea ORE_FILTER_SUCCESS = TextureArea + .fullImage("textures/gui/widget/ore_filter/success.png"); + public static final TextureArea ORE_FILTER_ERROR = TextureArea + .fullImage("textures/gui/widget/ore_filter/error.png"); public static final TextureArea ORE_FILTER_WARN = TextureArea.fullImage("textures/gui/widget/ore_filter/warn.png"); - public static final TextureArea ORE_FILTER_WAITING = TextureArea.fullImage("textures/gui/widget/ore_filter/waiting.png"); + public static final TextureArea ORE_FILTER_WAITING = TextureArea + .fullImage("textures/gui/widget/ore_filter/waiting.png"); - public static final TextureArea ORE_FILTER_MATCH = TextureArea.fullImage("textures/gui/widget/ore_filter/match.png"); - public static final TextureArea ORE_FILTER_NO_MATCH = TextureArea.fullImage("textures/gui/widget/ore_filter/no_match.png"); + public static final TextureArea ORE_FILTER_MATCH = TextureArea + .fullImage("textures/gui/widget/ore_filter/match.png"); + public static final TextureArea ORE_FILTER_NO_MATCH = TextureArea + .fullImage("textures/gui/widget/ore_filter/no_match.png"); - //Terminal + // Terminal public static final TextureArea ICON_REMOVE = TextureArea.fullImage("textures/gui/terminal/icon/remove_hover.png"); public static final TextureArea ICON_UP = TextureArea.fullImage("textures/gui/terminal/icon/up_hover.png"); public static final TextureArea ICON_DOWN = TextureArea.fullImage("textures/gui/terminal/icon/down_hover.png"); @@ -272,49 +457,79 @@ public class GuiTextures { public static final TextureArea ICON_LEFT = TextureArea.fullImage("textures/gui/terminal/icon/left_hover.png"); public static final TextureArea ICON_ADD = TextureArea.fullImage("textures/gui/terminal/icon/add_hover.png"); - public final static TextureArea ICON_NEW_PAGE = TextureArea.fullImage("textures/gui/terminal/icon/system/memory_card_hover.png"); + public final static TextureArea ICON_NEW_PAGE = TextureArea + .fullImage("textures/gui/terminal/icon/system/memory_card_hover.png"); public final static TextureArea ICON_LOAD = TextureArea.fullImage("textures/gui/terminal/icon/folder_hover.png"); - public final static TextureArea ICON_SAVE = TextureArea.fullImage("textures/gui/terminal/icon/system/save_hover.png"); + public final static TextureArea ICON_SAVE = TextureArea + .fullImage("textures/gui/terminal/icon/system/save_hover.png"); public final static TextureArea ICON_LOCATION = TextureArea.fullImage("textures/gui/terminal/icon/guide_hover.png"); - public final static TextureArea ICON_VISIBLE = TextureArea.fullImage("textures/gui/terminal/icon/appearance_hover.png"); - public final static TextureArea ICON_CALCULATOR = TextureArea.fullImage("textures/gui/terminal/icon/calculator_hover.png"); + public final static TextureArea ICON_VISIBLE = TextureArea + .fullImage("textures/gui/terminal/icon/appearance_hover.png"); + public final static TextureArea ICON_CALCULATOR = TextureArea + .fullImage("textures/gui/terminal/icon/calculator_hover.png"); public final static TextureArea UI_FRAME_SIDE_UP = TextureArea.fullImage("textures/gui/terminal/frame_side_up.png"); - public final static TextureArea UI_FRAME_SIDE_DOWN = TextureArea.fullImage("textures/gui/terminal/frame_side_down.png"); + public final static TextureArea UI_FRAME_SIDE_DOWN = TextureArea + .fullImage("textures/gui/terminal/frame_side_down.png"); // Texture Areas - public static final TextureArea BUTTON_FLUID = TextureArea.fullImage("textures/blocks/cover/cover_interface_fluid_button.png"); - public static final TextureArea BUTTON_ITEM = TextureArea.fullImage("textures/blocks/cover/cover_interface_item_button.png"); - public static final TextureArea BUTTON_ENERGY = TextureArea.fullImage("textures/blocks/cover/cover_interface_energy_button.png"); - public static final TextureArea BUTTON_MACHINE = TextureArea.fullImage("textures/blocks/cover/cover_interface_machine_button.png"); - public static final TextureArea BUTTON_INTERFACE = TextureArea.fullImage("textures/blocks/cover/cover_interface_computer_button.png"); - public static final TextureArea COVER_INTERFACE_MACHINE_ON_PROXY = TextureArea.fullImage("textures/blocks/cover/cover_interface_machine_on_proxy.png"); - public static final TextureArea COVER_INTERFACE_MACHINE_OFF_PROXY = TextureArea.fullImage("textures/blocks/cover/cover_interface_machine_off_proxy.png"); + public static final TextureArea BUTTON_FLUID = TextureArea + .fullImage("textures/blocks/cover/cover_interface_fluid_button.png"); + public static final TextureArea BUTTON_ITEM = TextureArea + .fullImage("textures/blocks/cover/cover_interface_item_button.png"); + public static final TextureArea BUTTON_ENERGY = TextureArea + .fullImage("textures/blocks/cover/cover_interface_energy_button.png"); + public static final TextureArea BUTTON_MACHINE = TextureArea + .fullImage("textures/blocks/cover/cover_interface_machine_button.png"); + public static final TextureArea BUTTON_INTERFACE = TextureArea + .fullImage("textures/blocks/cover/cover_interface_computer_button.png"); + public static final TextureArea COVER_INTERFACE_MACHINE_ON_PROXY = TextureArea + .fullImage("textures/blocks/cover/cover_interface_machine_on_proxy.png"); + public static final TextureArea COVER_INTERFACE_MACHINE_OFF_PROXY = TextureArea + .fullImage("textures/blocks/cover/cover_interface_machine_off_proxy.png"); // Lamp item overlay - public static final TextureArea LAMP_NO_BLOOM = TextureArea.fullImage("textures/gui/item_overlay/lamp_no_bloom.png"); - public static final TextureArea LAMP_NO_LIGHT = TextureArea.fullImage("textures/gui/item_overlay/lamp_no_light.png"); + public static final TextureArea LAMP_NO_BLOOM = TextureArea + .fullImage("textures/gui/item_overlay/lamp_no_bloom.png"); + public static final TextureArea LAMP_NO_LIGHT = TextureArea + .fullImage("textures/gui/item_overlay/lamp_no_light.png"); // ME hatch/bus - public static final TextureArea NUMBER_BACKGROUND = TextureArea.fullImage("textures/gui/widget/number_background.png"); + public static final TextureArea NUMBER_BACKGROUND = TextureArea + .fullImage("textures/gui/widget/number_background.png"); public static final TextureArea CONFIG_ARROW = TextureArea.fullImage("textures/gui/widget/config_arrow.png"); - public static final TextureArea CONFIG_ARROW_DARK = TextureArea.fullImage("textures/gui/widget/config_arrow_dark.png"); + public static final TextureArea CONFIG_ARROW_DARK = TextureArea + .fullImage("textures/gui/widget/config_arrow_dark.png"); public static final TextureArea SELECT_BOX = TextureArea.fullImage("textures/gui/widget/select_box.png"); // Fusion Reactor custom images - public static final TextureArea FUSION_REACTOR_MK1_TITLE = TextureArea.fullImage("textures/gui/widget/fusion_reactor_mk1_title.png"); - public static final TextureArea FUSION_REACTOR_MK2_TITLE = TextureArea.fullImage("textures/gui/widget/fusion_reactor_mk2_title.png"); - public static final TextureArea FUSION_REACTOR_MK3_TITLE = TextureArea.fullImage("textures/gui/widget/fusion_reactor_mk3_title.png"); - public static final TextureArea FUSION_REACTOR_DIAGRAM = TextureArea.fullImage("textures/gui/widget/fusion_reactor_diagram.png"); - public static final TextureArea FUSION_REACTOR_LEGEND = TextureArea.fullImage("textures/gui/widget/fusion_reactor_legend.png"); + public static final TextureArea FUSION_REACTOR_MK1_TITLE = TextureArea + .fullImage("textures/gui/widget/fusion_reactor_mk1_title.png"); + public static final TextureArea FUSION_REACTOR_MK2_TITLE = TextureArea + .fullImage("textures/gui/widget/fusion_reactor_mk2_title.png"); + public static final TextureArea FUSION_REACTOR_MK3_TITLE = TextureArea + .fullImage("textures/gui/widget/fusion_reactor_mk3_title.png"); + public static final TextureArea FUSION_REACTOR_DIAGRAM = TextureArea + .fullImage("textures/gui/widget/fusion_reactor_diagram.png"); + public static final TextureArea FUSION_REACTOR_LEGEND = TextureArea + .fullImage("textures/gui/widget/fusion_reactor_legend.png"); // HPCA Component icons - public static final TextureArea HPCA_COMPONENT_OUTLINE = TextureArea.fullImage("textures/gui/widget/hpca/component_outline.png"); - public static final TextureArea HPCA_ICON_EMPTY_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/empty_component.png"); - public static final TextureArea HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/advanced_computation_component.png"); - public static final TextureArea HPCA_ICON_BRIDGE_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/bridge_component.png"); - public static final TextureArea HPCA_ICON_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/computation_component.png"); - public static final TextureArea HPCA_ICON_ACTIVE_COOLER_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/active_cooler_component.png"); - public static final TextureArea HPCA_ICON_HEAT_SINK_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/heat_sink_component.png"); - public static final TextureArea HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/damaged_advanced_computation_component.png"); - public static final TextureArea HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/damaged_computation_component.png"); + public static final TextureArea HPCA_COMPONENT_OUTLINE = TextureArea + .fullImage("textures/gui/widget/hpca/component_outline.png"); + public static final TextureArea HPCA_ICON_EMPTY_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/empty_component.png"); + public static final TextureArea HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/advanced_computation_component.png"); + public static final TextureArea HPCA_ICON_BRIDGE_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/bridge_component.png"); + public static final TextureArea HPCA_ICON_COMPUTATION_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/computation_component.png"); + public static final TextureArea HPCA_ICON_ACTIVE_COOLER_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/active_cooler_component.png"); + public static final TextureArea HPCA_ICON_HEAT_SINK_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/heat_sink_component.png"); + public static final TextureArea HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/damaged_advanced_computation_component.png"); + public static final TextureArea HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/damaged_computation_component.png"); } diff --git a/src/main/java/gregtech/api/gui/INativeWidget.java b/src/main/java/gregtech/api/gui/INativeWidget.java index 937a3e976d5..3d2d2d76101 100644 --- a/src/main/java/gregtech/api/gui/INativeWidget.java +++ b/src/main/java/gregtech/api/gui/INativeWidget.java @@ -11,6 +11,7 @@ * Rendering is still handled by widget via helpers in {@link gregtech.api.gui.IRenderContext} */ public interface INativeWidget { + /** * You should return MC slot handle instance you created earlier * @@ -44,6 +45,7 @@ default ItemStack onItemTake(EntityPlayer player, ItemStack stack, boolean simul ItemStack slotClick(int dragType, ClickType clickTypeIn, EntityPlayer player); class SlotLocationInfo { + public final boolean isPlayerInventory; public final boolean isHotbarSlot; diff --git a/src/main/java/gregtech/api/gui/ISizeProvider.java b/src/main/java/gregtech/api/gui/ISizeProvider.java index bb2b4791a22..05186421288 100644 --- a/src/main/java/gregtech/api/gui/ISizeProvider.java +++ b/src/main/java/gregtech/api/gui/ISizeProvider.java @@ -20,15 +20,15 @@ public interface ISizeProvider { /** * @return width of the GUI the widget is located in - * if the widget is located in the sub interface, then width - * and height will be the sub interface's holder dimensions + * if the widget is located in the sub interface, then width + * and height will be the sub interface's holder dimensions */ int getWidth(); /** * @return height of the GUI the widget is located in - * if the widget is located in the sub interface, then height - * and width will be the sub interface's holder dimensions + * if the widget is located in the sub interface, then height + * and width will be the sub interface's holder dimensions */ int getHeight(); @@ -41,6 +41,7 @@ default int getGuiTop() { } default Rectangle toScreenCoords(Rectangle widgetRect) { - return new Rectangle(getGuiLeft() + widgetRect.x, getGuiTop() + widgetRect.y, widgetRect.width, widgetRect.height); + return new Rectangle(getGuiLeft() + widgetRect.x, getGuiTop() + widgetRect.y, widgetRect.width, + widgetRect.height); } } diff --git a/src/main/java/gregtech/api/gui/ModularUI.java b/src/main/java/gregtech/api/gui/ModularUI.java index 96874665a1d..e437790302f 100644 --- a/src/main/java/gregtech/api/gui/ModularUI.java +++ b/src/main/java/gregtech/api/gui/ModularUI.java @@ -1,8 +1,5 @@ package gregtech.api.gui; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableBiMap; -import com.google.common.collect.ImmutableList; import gregtech.api.gui.impl.ModularUIGui; import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.gui.resources.TextureArea; @@ -11,12 +8,17 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.util.Position; import gregtech.common.ConfigHolder; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableBiMap; +import com.google.common.collect.ImmutableList; + import java.util.ArrayList; import java.util.List; import java.util.function.DoubleSupplier; @@ -51,7 +53,9 @@ public final class ModularUI implements ISizeProvider { public final IUIHolder holder; public final EntityPlayer entityPlayer; - public ModularUI(ImmutableBiMap guiWidgets, ImmutableList openListeners, ImmutableList closeListeners, IGuiTexture backgroundPath, int width, int height, IUIHolder holder, EntityPlayer entityPlayer) { + public ModularUI(ImmutableBiMap guiWidgets, ImmutableList openListeners, + ImmutableList closeListeners, IGuiTexture backgroundPath, int width, int height, + IUIHolder holder, EntityPlayer entityPlayer) { this.guiWidgets = guiWidgets; this.uiOpenCallback = openListeners; this.uiCloseCallback = closeListeners; @@ -94,7 +98,7 @@ public void setSize(int width, int height) { getModularUIGui().initGui(); } } - + public void updateScreenSize(int screenWidth, int screenHeight) { this.screenWidth = screenWidth; this.screenHeight = screenHeight; @@ -223,17 +227,22 @@ public Builder slot(IItemHandlerModifiable itemHandler, int slotIndex, int x, in return widget(new SlotWidget(itemHandler, slotIndex, x, y).setBackgroundTexture(overlays)); } - public Builder slot(IItemHandlerModifiable itemHandler, int slotIndex, int x, int y, boolean canTakeItems, boolean canPutItems, IGuiTexture... overlays) { - return widget(new SlotWidget(itemHandler, slotIndex, x, y, canTakeItems, canPutItems).setBackgroundTexture(overlays)); + public Builder slot(IItemHandlerModifiable itemHandler, int slotIndex, int x, int y, boolean canTakeItems, + boolean canPutItems, IGuiTexture... overlays) { + return widget(new SlotWidget(itemHandler, slotIndex, x, y, canTakeItems, canPutItems) + .setBackgroundTexture(overlays)); } // todo this shouldn't exist, only RecipeProgressWidget should directly take a DoubleSupplier - public Builder progressBar(DoubleSupplier progressSupplier, int x, int y, int width, int height, TextureArea texture, MoveType moveType) { + public Builder progressBar(DoubleSupplier progressSupplier, int x, int y, int width, int height, + TextureArea texture, MoveType moveType) { return widget(new ProgressWidget(progressSupplier, x, y, width, height, texture, moveType)); } - public Builder progressBar(DoubleSupplier progressSupplier, int x, int y, int width, int height, TextureArea texture, MoveType moveType, RecipeMap recipeMap) { - return widget(new RecipeProgressWidget(progressSupplier, x, y, width, height, texture, moveType, recipeMap)); + public Builder progressBar(DoubleSupplier progressSupplier, int x, int y, int width, int height, + TextureArea texture, MoveType moveType, RecipeMap recipeMap) { + return widget( + new RecipeProgressWidget(progressSupplier, x, y, width, height, texture, moveType, recipeMap)); } public Builder bindPlayerInventory(InventoryPlayer inventoryPlayer) { @@ -286,7 +295,8 @@ public Builder shouldColor(boolean color) { } public ModularUI build(IUIHolder holder, EntityPlayer player) { - ModularUI ui = new ModularUI(widgets.build(), openListeners.build(), closeListeners.build(), background, width, height, holder, player); + ModularUI ui = new ModularUI(widgets.build(), openListeners.build(), closeListeners.build(), background, + width, height, holder, player); ui.shouldColor = this.shouldColor; return ui; } diff --git a/src/main/java/gregtech/api/gui/UIFactory.java b/src/main/java/gregtech/api/gui/UIFactory.java index 300d6b022a1..163f08f2342 100644 --- a/src/main/java/gregtech/api/gui/UIFactory.java +++ b/src/main/java/gregtech/api/gui/UIFactory.java @@ -5,7 +5,7 @@ import gregtech.api.gui.impl.ModularUIGui; import gregtech.core.network.packets.PacketUIOpen; import gregtech.core.network.packets.PacketUIWidgetUpdate; -import io.netty.buffer.Unpooled; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.player.EntityPlayer; @@ -17,11 +17,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import io.netty.buffer.Unpooled; + import java.util.ArrayList; import java.util.List; /** - * Implement and register on the {@link GregTechAPI.RegisterEvent} event to be able to create and open ModularUI's + * Implement and register on the {@link GregTechAPI.RegisterEvent} event to be able to create and open + * ModularUI's * createUITemplate should return equal gui both on server and client side, or sync will break! * * @param UI holder type @@ -50,7 +53,7 @@ public final void openUI(E holder, EntityPlayerMP player) { ModularUIContainer container = new ModularUIContainer(uiTemplate); container.windowId = currentWindowId; - //accumulate all initial updates of widgets in open packet + // accumulate all initial updates of widgets in open packet container.accumulateWidgetUpdateData = true; uiTemplate.guiWidgets.values().forEach(Widget::detectAndSendChanges); container.accumulateWidgetUpdateData = false; @@ -63,12 +66,13 @@ public final void openUI(E holder, EntityPlayerMP player) { container.addListener(player); player.openContainer = container; - //and fire forge event only in the end + // and fire forge event only in the end MinecraftForge.EVENT_BUS.post(new PlayerContainerEvent.Open(player, container)); } @SideOnly(Side.CLIENT) - public final void initClientUI(PacketBuffer serializedHolder, int windowId, List initialWidgetUpdates) { + public final void initClientUI(PacketBuffer serializedHolder, int windowId, + List initialWidgetUpdates) { E holder = readHolderFromSyncData(serializedHolder); Minecraft minecraft = Minecraft.getMinecraft(); EntityPlayerSP entityPlayer = minecraft.player; @@ -92,5 +96,4 @@ public final void initClientUI(PacketBuffer serializedHolder, int windowId, List protected abstract E readHolderFromSyncData(PacketBuffer syncData); protected abstract void writeHolderToSyncData(PacketBuffer syncData, E holder); - } diff --git a/src/main/java/gregtech/api/gui/Widget.java b/src/main/java/gregtech/api/gui/Widget.java index e7fff37b8e2..be7a34b2ebb 100644 --- a/src/main/java/gregtech/api/gui/Widget.java +++ b/src/main/java/gregtech/api/gui/Widget.java @@ -1,10 +1,10 @@ package gregtech.api.gui; -import com.google.common.base.Preconditions; import gregtech.api.gui.widgets.WidgetUIAccess; import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.FontRenderer; @@ -21,15 +21,18 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.base.Preconditions; import org.lwjgl.opengl.GL11; -import javax.annotation.Nullable; import java.awt.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.Consumer; +import javax.annotation.Nullable; + /** * Widget is functional element of ModularUI * It can draw, perform actions, react to key press and mouse @@ -136,11 +139,9 @@ protected void recomputePosition() { onPositionUpdate(); } - protected void onPositionUpdate() { - } + protected void onPositionUpdate() {} - protected void onSizeUpdate() { - } + protected void onSizeUpdate() {} public boolean isMouseOverElement(int mouseX, int mouseY) { Position position = getPosition(); @@ -155,40 +156,34 @@ public static boolean isMouseOver(int x, int y, int width, int height, int mouse /** * Called on both sides to initialize widget data */ - public void initWidget() { - } + public void initWidget() {} /** * Called on serverside to detect changes and synchronize them with clients */ - public void detectAndSendChanges() { - } + public void detectAndSendChanges() {} /** * Called clientside every tick with this modular UI open */ - public void updateScreen() { - } + public void updateScreen() {} /** * Called clientside approximately every 1/60th of a second with this modular UI open */ - public void updateScreenOnFrame() { - } + public void updateScreenOnFrame() {} /** * Called each draw tick to draw this widget in GUI */ @SideOnly(Side.CLIENT) - public void drawInForeground(int mouseX, int mouseY) { - } + public void drawInForeground(int mouseX, int mouseY) {} /** * Called each draw tick to draw this widget in GUI */ @SideOnly(Side.CLIENT) - public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { - } + public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {} /** * Called when mouse wheel is moved in GUI @@ -235,11 +230,9 @@ public boolean keyTyped(char charTyped, int keyCode) { * Read data received from server's {@link #writeUpdateInfo} */ @SideOnly(Side.CLIENT) - public void readUpdateInfo(int id, PacketBuffer buffer) { - } + public void readUpdateInfo(int id, PacketBuffer buffer) {} - public void handleClientAction(int id, PacketBuffer buffer) { - } + public void handleClientAction(int id, PacketBuffer buffer) {} public List getNativeWidgets() { if (this instanceof INativeWidget) { @@ -282,7 +275,8 @@ public void drawHoveringText(ItemStack itemStack, List tooltip, int maxT } @SideOnly(Side.CLIENT) - public static void drawStringSized(String text, double x, double y, int color, boolean dropShadow, float scale, boolean center) { + public static void drawStringSized(String text, double x, double y, int color, boolean dropShadow, float scale, + boolean center) { GlStateManager.pushMatrix(); FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; double scaledTextWidth = center ? fontRenderer.getStringWidth(text) * scale : 0.0; @@ -293,7 +287,8 @@ public static void drawStringSized(String text, double x, double y, int color, b } @SideOnly(Side.CLIENT) - public static void drawStringFixedCorner(String text, double x, double y, int color, boolean dropShadow, float scale) { + public static void drawStringFixedCorner(String text, double x, double y, int color, boolean dropShadow, + float scale) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; double scaledWidth = fontRenderer.getStringWidth(text) * scale; double scaledHeight = fontRenderer.FONT_HEIGHT * scale; @@ -342,7 +337,8 @@ public static void drawItemStack(ItemStack itemStack, int x, int y, @Nullable St @SideOnly(Side.CLIENT) public static List getItemToolTip(ItemStack itemStack) { Minecraft mc = Minecraft.getMinecraft(); - ITooltipFlag flag = mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL; + ITooltipFlag flag = mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : + ITooltipFlag.TooltipFlags.NORMAL; List tooltip = itemStack.getTooltip(mc.player, flag); for (int i = 0; i < tooltip.size(); ++i) { if (i == 0) { @@ -380,7 +376,9 @@ public static void drawRectShadow(int x, int y, int width, int height, int dista GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); @@ -406,7 +404,8 @@ public static void drawGradientRect(int x, int y, int width, int height, int sta } @SideOnly(Side.CLIENT) - public static void drawGradientRect(float x, float y, float width, float height, int startColor, int endColor, boolean horizontal) { + public static void drawGradientRect(float x, float y, float width, float height, int startColor, int endColor, + boolean horizontal) { float startAlpha = (float) (startColor >> 24 & 255) / 255.0F; float startRed = (float) (startColor >> 16 & 255) / 255.0F; float startGreen = (float) (startColor >> 8 & 255) / 255.0F; @@ -418,7 +417,9 @@ public static void drawGradientRect(float x, float y, float width, float height, GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); @@ -454,11 +455,14 @@ public static void drawCircle(float x, float y, float r, int color, int segments BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); setColor(color); bufferbuilder.begin(GL11.GL_POLYGON, DefaultVertexFormats.POSITION); for (int i = 0; i < segments; i++) { - bufferbuilder.pos(x + r * Math.cos(-2 * Math.PI * i / segments), y + r * Math.sin(-2 * Math.PI * i / segments), 0.0D).endVertex(); + bufferbuilder.pos(x + r * Math.cos(-2 * Math.PI * i / segments), + y + r * Math.sin(-2 * Math.PI * i / segments), 0.0D).endVertex(); } tessellator.draw(); GlStateManager.enableTexture2D(); @@ -473,12 +477,16 @@ public static void drawSector(float x, float y, float r, int color, int segments BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); setColor(color); bufferbuilder.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION); for (int i = from; i < to; i++) { - bufferbuilder.pos(x + r * Math.cos(-2 * Math.PI * i / segments), y + r * Math.sin(-2 * Math.PI * i / segments), 0.0D).endVertex(); - bufferbuilder.pos(x + r * Math.cos(-2 * Math.PI * (i + 1) / segments), y + r * Math.sin(-2 * Math.PI * (i + 1) / segments), 0.0D).endVertex(); + bufferbuilder.pos(x + r * Math.cos(-2 * Math.PI * i / segments), + y + r * Math.sin(-2 * Math.PI * i / segments), 0.0D).endVertex(); + bufferbuilder.pos(x + r * Math.cos(-2 * Math.PI * (i + 1) / segments), + y + r * Math.sin(-2 * Math.PI * (i + 1) / segments), 0.0D).endVertex(); bufferbuilder.pos(x, y, 0.0D).endVertex(); } tessellator.draw(); @@ -486,12 +494,15 @@ public static void drawSector(float x, float y, float r, int color, int segments GlStateManager.color(1, 1, 1, 1); } - public static void drawTorus(float x, float y, float outer, float inner, int color, int segments, int from, int to) { + public static void drawTorus(float x, float y, float outer, float inner, int color, int segments, int from, + int to) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); setColor(color); bufferbuilder.begin(GL11.GL_QUAD_STRIP, DefaultVertexFormats.POSITION); for (int i = from; i <= to; i++) { @@ -510,7 +521,9 @@ public static void drawLines(List points, int startColor, int endColor, f BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); GlStateManager.glLineWidth(width); if (startColor == endColor) { setColor(startColor); @@ -568,7 +581,7 @@ public static List genBezierPoints(Vec2f from, Vec2f to, boolean horizont c1 = new Vec2f(from.x, (from.y + to.y) / 2); c2 = new Vec2f(to.x, (from.y + to.y) / 2); } - Vec2f[] controlPoint = new Vec2f[]{from, c1, c2, to}; + Vec2f[] controlPoint = new Vec2f[] { from, c1, c2, to }; int n = controlPoint.length - 1; int i, r; List bezierPoints = new ArrayList<>(); @@ -589,7 +602,8 @@ public static List genBezierPoints(Vec2f from, Vec2f to, boolean horizont @SideOnly(Side.CLIENT) protected static void playButtonClickSound() { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + Minecraft.getMinecraft().getSoundHandler() + .playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); } @SideOnly(Side.CLIENT) @@ -611,6 +625,7 @@ protected static boolean isClientSide() { } public static final class ClickData { + public final int button; public final boolean isShiftClick; public final boolean isCtrlClick; @@ -647,6 +662,7 @@ public static ClickData readFromBuf(PacketBuffer buf) { } public static final class WheelData { + public final int wheelDelta; public final boolean isShiftClick; public final boolean isCtrlClick; @@ -681,5 +697,4 @@ public static WheelData readFromBuf(PacketBuffer buf) { return new WheelData(button, shiftClick, ctrlClick, isClient); } } - } diff --git a/src/main/java/gregtech/api/gui/impl/FakeModularGui.java b/src/main/java/gregtech/api/gui/impl/FakeModularGui.java index 22742ea1602..e244ff9c25a 100644 --- a/src/main/java/gregtech/api/gui/impl/FakeModularGui.java +++ b/src/main/java/gregtech/api/gui/impl/FakeModularGui.java @@ -4,6 +4,7 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.ModularUI; import gregtech.api.gui.Widget; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -26,12 +27,13 @@ @SideOnly(Side.CLIENT) public class FakeModularGui implements IRenderContext { + public final ModularUI modularUI; public FakeModularGuiContainer container; protected Minecraft mc; protected FontRenderer fr; - public FakeModularGui(ModularUI modularUI, FakeModularGuiContainer fakeModularUIContainer){ + public FakeModularGui(ModularUI modularUI, FakeModularGuiContainer fakeModularUIContainer) { this.modularUI = modularUI; this.container = fakeModularUIContainer; this.modularUI.updateScreenSize(this.modularUI.getWidth(), this.modularUI.getHeight()); @@ -57,11 +59,12 @@ public void drawScreen(double x, double y, float partialTicks) { float halfW = modularUI.getWidth() / 2f; float halfH = modularUI.getHeight() / 2f; float scale = 0.5f / Math.max(halfW, halfH); - int mouseX = (int) ((x / scale) + (halfW > halfH? 0: (halfW - halfH))); - int mouseY = (int) ((y / scale) + (halfH > halfW? 0: (halfH - halfW))); + int mouseX = (int) ((x / scale) + (halfW > halfH ? 0 : (halfW - halfH))); + int mouseY = (int) ((y / scale) + (halfH > halfW ? 0 : (halfH - halfW))); GlStateManager.translate(-scale * halfW, -scale * halfH, 0); GlStateManager.scale(scale, scale, 1); - GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), modularUI.getBColorForOverlay(), 1.0F); + GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), + modularUI.getBColorForOverlay(), 1.0F); modularUI.backgroundPath.draw(0, 0, modularUI.getWidth(), modularUI.getHeight()); GlStateManager.translate(0, 0, 0.001); GlStateManager.depthMask(false); @@ -77,7 +80,8 @@ public void drawScreen(double x, double y, float partialTicks) { for (int i = 0; i < this.container.inventorySlots.size(); ++i) { Slot slot = this.container.inventorySlots.get(i); - if (!slot.getStack().isEmpty() && slot.xPos < mouseX && mouseX < slot.xPos + 18 && slot.yPos < mouseY && mouseY < slot.yPos + 18) { + if (!slot.getStack().isEmpty() && slot.xPos < mouseX && mouseX < slot.xPos + 18 && slot.yPos < mouseY && + mouseY < slot.yPos + 18) { renderToolTip(slot.getStack(), slot.xPos, slot.yPos); } } @@ -98,22 +102,19 @@ public static void renderSlot(Slot slot, FontRenderer fr) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); renderItem.renderItemAndEffectIntoGUI(stack, 0, 0); renderItem.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, stack, 0, 0, null); - String text = stack.getCount() > 1? Integer.toString(stack.getCount()) : null; + String text = stack.getCount() > 1 ? Integer.toString(stack.getCount()) : null; - if (!stack.isEmpty()) - { - if (stack.getCount() != 1) - { + if (!stack.isEmpty()) { + if (stack.getCount() != 1) { String s = text == null ? String.valueOf(stack.getCount()) : text; GlStateManager.disableLighting(); GlStateManager.disableBlend(); - fr.drawStringWithShadow(s, (float)(17 - fr.getStringWidth(s)), (float)9, 16777215); + fr.drawStringWithShadow(s, (float) (17 - fr.getStringWidth(s)), (float) 9, 16777215); GlStateManager.enableLighting(); GlStateManager.enableBlend(); } - if (stack.getItem().showDurabilityBar(stack)) - { + if (stack.getItem().showDurabilityBar(stack)) { GlStateManager.disableLighting(); GlStateManager.disableTexture2D(); GlStateManager.disableAlpha(); @@ -122,9 +123,10 @@ public static void renderSlot(Slot slot, FontRenderer fr) { BufferBuilder bufferbuilder = tessellator.getBuffer(); double health = stack.getItem().getDurabilityForDisplay(stack); int rgbfordisplay = stack.getItem().getRGBDurabilityForDisplay(stack); - int i = Math.round(13.0F - (float)health * 13.0F); + int i = Math.round(13.0F - (float) health * 13.0F); draw(bufferbuilder, 2, 13, 13, 2, 0, 0, 0, 255); - draw(bufferbuilder, 2, 13, i, 1, rgbfordisplay >> 16 & 255, rgbfordisplay >> 8 & 255, rgbfordisplay & 255, 255); + draw(bufferbuilder, 2, 13, i, 1, rgbfordisplay >> 16 & 255, rgbfordisplay >> 8 & 255, + rgbfordisplay & 255, 255); GlStateManager.enableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); @@ -132,15 +134,16 @@ public static void renderSlot(Slot slot, FontRenderer fr) { } EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player; - float f3 = entityplayersp == null ? 0.0F : entityplayersp.getCooldownTracker().getCooldown(stack.getItem(), Minecraft.getMinecraft().getRenderPartialTicks()); + float f3 = entityplayersp == null ? 0.0F : entityplayersp.getCooldownTracker() + .getCooldown(stack.getItem(), Minecraft.getMinecraft().getRenderPartialTicks()); - if (f3 > 0.0F) - { + if (f3 > 0.0F) { GlStateManager.disableLighting(); GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); - draw(bufferBuilder, 0, MathHelper.floor(16.0F * (1.0F - f3)), 16, MathHelper.ceil(16.0F * f3), 255, 255, 255, 127); + draw(bufferBuilder, 0, MathHelper.floor(16.0F * (1.0F - f3)), 16, MathHelper.ceil(16.0F * f3), 255, + 255, 255, 127); GlStateManager.enableTexture2D(); GlStateManager.enableLighting(); } @@ -151,8 +154,8 @@ public static void renderSlot(Slot slot, FontRenderer fr) { } } - private static void draw(BufferBuilder renderer, int x, int y, int width, int height, int red, int green, int blue, int alpha) - { + private static void draw(BufferBuilder renderer, int x, int y, int width, int height, int red, int green, int blue, + int alpha) { renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); renderer.pos(x, y, 0.0D).color(red, green, blue, alpha).endVertex(); renderer.pos((x), y + height, 0.0D).color(red, green, blue, alpha).endVertex(); @@ -164,12 +167,14 @@ private static void draw(BufferBuilder renderer, int x, int y, int width, int he protected void renderToolTip(ItemStack stack, int x, int y) { FontRenderer font = stack.getItem().getFontRenderer(stack); GuiUtils.preItemToolTip(stack); - GuiUtils.drawHoveringText(this.getItemToolTip(stack), x, y, modularUI.getScreenWidth(), modularUI.getScreenHeight(), -1, (font == null ? fr : font)); + GuiUtils.drawHoveringText(this.getItemToolTip(stack), x, y, modularUI.getScreenWidth(), + modularUI.getScreenHeight(), -1, (font == null ? fr : font)); net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip(); } protected List getItemToolTip(ItemStack itemStack) { - List list = itemStack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL); + List list = itemStack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? + ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL); list.set(0, itemStack.getItem().getForgeRarity(itemStack).getColor() + list.get(0)); for (int i = 1; i < list.size(); ++i) { list.set(i, TextFormatting.GRAY + list.get(i)); @@ -178,10 +183,12 @@ protected List getItemToolTip(ItemStack itemStack) { } public void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { - GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), modularUI.getBColorForOverlay(), 1.0F); + GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), + modularUI.getBColorForOverlay(), 1.0F); for (Widget widget : modularUI.guiWidgets.values()) { GlStateManager.pushMatrix(); - GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), modularUI.getBColorForOverlay()); + GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), + modularUI.getBColorForOverlay()); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); widget.drawInBackground(mouseX, mouseY, partialTicks, this); @@ -202,7 +209,8 @@ public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { public void mouseClicked(int mouseX, int mouseY, int mouseButton) { for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) { Widget widget = modularUI.guiWidgets.get(i); - if(widget.isVisible() && widget.isActive() && !(widget instanceof INativeWidget) && widget.mouseClicked(mouseX, mouseY, mouseButton)) { + if (widget.isVisible() && widget.isActive() && !(widget instanceof INativeWidget) && + widget.mouseClicked(mouseX, mouseY, mouseButton)) { return; } } diff --git a/src/main/java/gregtech/api/gui/impl/FakeModularGuiContainer.java b/src/main/java/gregtech/api/gui/impl/FakeModularGuiContainer.java index b86ff057c92..150a28c245f 100644 --- a/src/main/java/gregtech/api/gui/impl/FakeModularGuiContainer.java +++ b/src/main/java/gregtech/api/gui/impl/FakeModularGuiContainer.java @@ -1,18 +1,21 @@ package gregtech.api.gui.impl; -import com.google.common.collect.Lists; import gregtech.api.gui.INativeWidget; import gregtech.api.gui.ModularUI; import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.WidgetUIAccess; + import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.util.NonNullList; +import com.google.common.collect.Lists; + import java.util.List; public abstract class FakeModularGuiContainer implements WidgetUIAccess { + protected final NonNullList inventoryItemStacks = NonNullList.create(); public final List inventorySlots = Lists.newArrayList(); public final ModularUI modularUI; @@ -22,7 +25,8 @@ public FakeModularGuiContainer(ModularUI modularUI) { this.modularUI = modularUI; modularUI.initWidgets(); modularUI.guiWidgets.values().forEach(widget -> widget.setUiAccess(this)); - modularUI.guiWidgets.values().stream().flatMap(widget -> widget.getNativeWidgets().stream()).forEach(nativeWidget -> addSlotToContainer(nativeWidget.getHandle())); + modularUI.guiWidgets.values().stream().flatMap(widget -> widget.getNativeWidgets().stream()) + .forEach(nativeWidget -> addSlotToContainer(nativeWidget.getHandle())); modularUI.triggerOpenListeners(); } @@ -38,7 +42,7 @@ public void handleSlotUpdate(PacketBuffer updateData) { for (int i = 0; i < size; i++) { inventorySlots.get(updateData.readVarInt()).putStack(updateData.readItemStack()); } - } catch (Exception ignored){ + } catch (Exception ignored) { } } @@ -58,14 +62,10 @@ public void handleClientAction(PacketBuffer buffer) { public abstract void detectAndSendChanges(); @Override - public void notifySizeChange() { - - } + public void notifySizeChange() {} @Override - public void notifyWidgetChange() { - - } + public void notifyWidgetChange() {} @Override public boolean attemptMergeStack(ItemStack itemStack, boolean b, boolean b1) { @@ -73,10 +73,8 @@ public boolean attemptMergeStack(ItemStack itemStack, boolean b, boolean b1) { } @Override - public void sendSlotUpdate(INativeWidget iNativeWidget) { - } + public void sendSlotUpdate(INativeWidget iNativeWidget) {} @Override - public void sendHeldItemUpdate() { - } + public void sendHeldItemUpdate() {} } diff --git a/src/main/java/gregtech/api/gui/impl/ModularUIContainer.java b/src/main/java/gregtech/api/gui/impl/ModularUIContainer.java index d235f53d8fe..de6753738cd 100644 --- a/src/main/java/gregtech/api/gui/impl/ModularUIContainer.java +++ b/src/main/java/gregtech/api/gui/impl/ModularUIContainer.java @@ -10,7 +10,7 @@ import gregtech.api.util.PerTickIntCounter; import gregtech.core.network.packets.PacketUIClientAction; import gregtech.core.network.packets.PacketUIWidgetUpdate; -import io.netty.buffer.Unpooled; + import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -19,11 +19,14 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.server.SPacketSetSlot; -import javax.annotation.Nonnull; +import io.netty.buffer.Unpooled; + import java.util.*; import java.util.function.Consumer; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class ModularUIContainer extends Container implements WidgetUIAccess { protected final HashMap slotMap = new HashMap<>(); @@ -46,11 +49,10 @@ public ModularUIContainer(ModularUI modularUI) { } @Override - public void notifySizeChange() { - } + public void notifySizeChange() {} - //WARNING! WIDGET CHANGES SHOULD BE *STRICTLY* SYNCHRONIZED BETWEEN SERVER AND CLIENT, - //OTHERWISE ID MISMATCH CAN HAPPEN BETWEEN ASSIGNED SLOTS! + // WARNING! WIDGET CHANGES SHOULD BE *STRICTLY* SYNCHRONIZED BETWEEN SERVER AND CLIENT, + // OTHERWISE ID MISMATCH CAN HAPPEN BETWEEN ASSIGNED SLOTS! @Override public void notifyWidgetChange() { List nativeWidgets = modularUI.guiWidgets.values().stream() @@ -63,7 +65,7 @@ public void notifyWidgetChange() { for (INativeWidget removedWidget : removedWidgets) { Slot slotHandle = removedWidget.getHandle(); this.slotMap.remove(slotHandle); - //replace removed slot with empty placeholder to avoid list index shift + // replace removed slot with empty placeholder to avoid list index shift EmptySlotPlaceholder emptySlotPlaceholder = new EmptySlotPlaceholder(); emptySlotPlaceholder.slotNumber = slotHandle.slotNumber; this.inventorySlots.set(slotHandle.slotNumber, emptySlotPlaceholder); @@ -80,7 +82,7 @@ public void notifyWidgetChange() { int currentIndex = 0; for (INativeWidget addedWidget : addedWidgets) { Slot slotHandle = addedWidget.getHandle(); - //add or replace empty slot in inventory + // add or replace empty slot in inventory this.slotMap.put(slotHandle, addedWidget); if (currentIndex < emptySlotIndexes.length) { int slotIndex = emptySlotIndexes[currentIndex++]; @@ -187,7 +189,7 @@ public ItemStack transferStackInSlot(@Nonnull EntityPlayer player, int index) { return ItemStack.EMPTY; } if (!slot.getHasStack()) { - //return empty if we can't transfer it + // return empty if we can't transfer it return ItemStack.EMPTY; } ItemStack stackInSlot = slot.getStack(); @@ -200,17 +202,17 @@ public ItemStack transferStackInSlot(@Nonnull EntityPlayer player, int index) { if (stackToMerge.isEmpty() || slotMap.get(slot).canMergeSlot(stackToMerge)) { itemsMerged = stackInSlot.getCount() - stackToMerge.getCount(); } else { - //if we can't have partial stack merge, we have to use all the stack + // if we can't have partial stack merge, we have to use all the stack itemsMerged = stackInSlot.getCount(); } int itemsToExtract = itemsMerged; itemsMerged += transferredPerTick.get(player.world); if (itemsMerged > stackInSlot.getMaxStackSize()) { - //we can merge at most one stack at a time + // we can merge at most one stack at a time return ItemStack.EMPTY; } transferredPerTick.increment(player.world, itemsToExtract); - //otherwise, perform extraction and merge + // otherwise, perform extraction and merge ItemStack extractedStack = stackInSlot.splitStack(itemsToExtract); if (stackInSlot.isEmpty()) { slot.putStack(ItemStack.EMPTY); @@ -281,8 +283,7 @@ public ItemStack getStack() { } @Override - public void putStack(@Nonnull ItemStack stack) { - } + public void putStack(@Nonnull ItemStack stack) {} @Override public boolean isItemValid(@Nonnull ItemStack stack) { diff --git a/src/main/java/gregtech/api/gui/impl/ModularUIGui.java b/src/main/java/gregtech/api/gui/impl/ModularUIGui.java index 7bedb941f0e..c1aeb1ac8f4 100644 --- a/src/main/java/gregtech/api/gui/impl/ModularUIGui.java +++ b/src/main/java/gregtech/api/gui/impl/ModularUIGui.java @@ -5,6 +5,7 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.SlotWidget; import gregtech.core.network.packets.PacketUIWidgetUpdate; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; @@ -16,6 +17,7 @@ import net.minecraft.util.math.MathHelper; import net.minecraftforge.client.event.GuiContainerEvent; import net.minecraftforge.common.MinecraftForge; + import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -26,7 +28,7 @@ public class ModularUIGui extends GuiContainer implements IRenderContext { private final ModularUI modularUI; - public static final float FRAMES_PER_TICK = 1/3f; + public static final float FRAMES_PER_TICK = 1 / 3f; private float lastUpdate; @@ -134,7 +136,6 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) { renderHoveredToolTip(mouseX, mouseY); } - public void setHoveredSlot(Slot hoveredSlot) { this.hoveredSlot = hoveredSlot; } @@ -170,7 +171,7 @@ private void renderItemStackOnMouse(int mouseX, int mouseY) { itemStack.setCount(this.dragSplittingRemnant); } // This null is eventually nullable, 2 calls deep - //noinspection DataFlowIssue + // noinspection DataFlowIssue this.drawItemStack(itemStack, mouseX - guiLeft - 8, mouseY - guiTop - dragOffset, null); } } @@ -186,7 +187,7 @@ private void renderReturningItemStack() { int deltaY = this.returningStackDestSlot.yPos - this.touchUpY; int currentX = this.touchUpX + (int) ((float) deltaX * partialTicks); int currentY = this.touchUpY + (int) ((float) deltaY * partialTicks); - //noinspection ConstantConditions + // noinspection ConstantConditions this.drawItemStack(this.returningStack, currentX, currentY, null); } } @@ -205,7 +206,8 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.pushMatrix(); - GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), modularUI.getBColorForOverlay(), 1.0F); + GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), + modularUI.getBColorForOverlay(), 1.0F); GlStateManager.enableBlend(); GlStateManager.popMatrix(); modularUI.backgroundPath.draw(guiLeft, guiTop, xSize, ySize); @@ -213,8 +215,9 @@ protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, i if (!widget.isVisible()) return; GlStateManager.pushMatrix(); GlStateManager.enableBlend(); - widget.drawInBackground(mouseX, mouseY, partialTicks,this); - GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), modularUI.getBColorForOverlay(), 1.0F); + widget.drawInBackground(mouseX, mouseY, partialTicks, this); + GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), + modularUI.getBColorForOverlay(), 1.0F); GlStateManager.popMatrix(); }); } @@ -233,7 +236,7 @@ public void handleMouseInput() throws IOException { protected void mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) { Widget widget = modularUI.guiWidgets.get(i); - if(widget.isVisible() && widget.isActive() && widget.mouseWheelMove(mouseX, mouseY, wheelDelta)) { + if (widget.isVisible() && widget.isActive() && widget.mouseWheelMove(mouseX, mouseY, wheelDelta)) { return; } } @@ -251,7 +254,7 @@ public boolean getDragSplitting() { protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) { Widget widget = modularUI.guiWidgets.get(i); - if(widget.isVisible() && widget.isActive() && widget.mouseClicked(mouseX, mouseY, mouseButton)) { + if (widget.isVisible() && widget.isActive() && widget.mouseClicked(mouseX, mouseY, mouseButton)) { return; } } @@ -260,14 +263,15 @@ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { public void superMouseClicked(int mouseX, int mouseY, int mouseButton) { try { super.mouseClicked(mouseX, mouseY, mouseButton); - } catch (Exception ignored) { } + } catch (Exception ignored) {} } @Override protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) { Widget widget = modularUI.guiWidgets.get(i); - if(widget.isVisible() && widget.isActive() && widget.mouseDragged(mouseX, mouseY, clickedMouseButton, timeSinceLastClick)) { + if (widget.isVisible() && widget.isActive() && + widget.mouseDragged(mouseX, mouseY, clickedMouseButton, timeSinceLastClick)) { return; } } @@ -281,7 +285,7 @@ public void superMouseClickMove(int mouseX, int mouseY, int clickedMouseButton, protected void mouseReleased(int mouseX, int mouseY, int state) { for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) { Widget widget = modularUI.guiWidgets.get(i); - if(widget.isVisible() && widget.isActive() && widget.mouseReleased(mouseX, mouseY, state)) { + if (widget.isVisible() && widget.isActive() && widget.mouseReleased(mouseX, mouseY, state)) { return; } } @@ -295,7 +299,7 @@ public void superMouseReleased(int mouseX, int mouseY, int state) { protected void keyTyped(char typedChar, int keyCode) throws IOException { for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) { Widget widget = modularUI.guiWidgets.get(i); - if(widget.isVisible() && widget.isActive() && widget.keyTyped(typedChar, keyCode)) { + if (widget.isVisible() && widget.isActive() && widget.keyTyped(typedChar, keyCode)) { return; } } diff --git a/src/main/java/gregtech/api/gui/ingredient/IGhostIngredientTarget.java b/src/main/java/gregtech/api/gui/ingredient/IGhostIngredientTarget.java index 7ac592b8dd3..03c569c6d33 100644 --- a/src/main/java/gregtech/api/gui/ingredient/IGhostIngredientTarget.java +++ b/src/main/java/gregtech/api/gui/ingredient/IGhostIngredientTarget.java @@ -7,5 +7,4 @@ public interface IGhostIngredientTarget { List> getPhantomTargets(Object ingredient); - } diff --git a/src/main/java/gregtech/api/gui/ingredient/IIngredientSlot.java b/src/main/java/gregtech/api/gui/ingredient/IIngredientSlot.java index cff05cbf6c2..0ac1ab8f4d6 100644 --- a/src/main/java/gregtech/api/gui/ingredient/IIngredientSlot.java +++ b/src/main/java/gregtech/api/gui/ingredient/IIngredientSlot.java @@ -3,5 +3,4 @@ public interface IIngredientSlot { Object getIngredientOverMouse(int mouseX, int mouseY); - } diff --git a/src/main/java/gregtech/api/gui/ingredient/IRecipeTransferHandlerWidget.java b/src/main/java/gregtech/api/gui/ingredient/IRecipeTransferHandlerWidget.java index aef53bf91e8..21d87be00cf 100644 --- a/src/main/java/gregtech/api/gui/ingredient/IRecipeTransferHandlerWidget.java +++ b/src/main/java/gregtech/api/gui/ingredient/IRecipeTransferHandlerWidget.java @@ -1,10 +1,13 @@ package gregtech.api.gui.ingredient; import gregtech.api.gui.impl.ModularUIContainer; -import mezz.jei.api.gui.IRecipeLayout; + import net.minecraft.entity.player.EntityPlayer; +import mezz.jei.api.gui.IRecipeLayout; + public interface IRecipeTransferHandlerWidget { - String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer); + String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, + boolean maxTransfer, boolean doTransfer); } diff --git a/src/main/java/gregtech/api/gui/resources/AdoptableTextureArea.java b/src/main/java/gregtech/api/gui/resources/AdoptableTextureArea.java index 01fbe3509a7..90bcd67f56e 100644 --- a/src/main/java/gregtech/api/gui/resources/AdoptableTextureArea.java +++ b/src/main/java/gregtech/api/gui/resources/AdoptableTextureArea.java @@ -1,6 +1,7 @@ package gregtech.api.gui.resources; import gregtech.api.util.GTUtility; + import net.minecraft.util.ResourceLocation; public class AdoptableTextureArea extends SizedTextureArea { @@ -8,38 +9,48 @@ public class AdoptableTextureArea extends SizedTextureArea { private final int pixelCornerWidth; private final int pixelCornerHeight; - public AdoptableTextureArea(ResourceLocation imageLocation, double offsetX, double offsetY, double width, double height, double pixelImageWidth, double pixelImageHeight, int pixelCornerWidth, int pixelCornerHeight) { + public AdoptableTextureArea(ResourceLocation imageLocation, double offsetX, double offsetY, double width, + double height, double pixelImageWidth, double pixelImageHeight, int pixelCornerWidth, + int pixelCornerHeight) { super(imageLocation, offsetX, offsetY, width, height, pixelImageWidth, pixelImageHeight); this.pixelCornerWidth = pixelCornerWidth; this.pixelCornerHeight = pixelCornerHeight; } - public static AdoptableTextureArea fullImage(String imageLocation, int imageWidth, int imageHeight, int cornerWidth, int cornerHeight) { - return new AdoptableTextureArea(GTUtility.gregtechId(imageLocation), 0.0, 0.0, 1.0, 1.0, imageWidth, imageHeight, cornerWidth, cornerHeight); + public static AdoptableTextureArea fullImage(String imageLocation, int imageWidth, int imageHeight, int cornerWidth, + int cornerHeight) { + return new AdoptableTextureArea(GTUtility.gregtechId(imageLocation), 0.0, 0.0, 1.0, 1.0, imageWidth, + imageHeight, cornerWidth, cornerHeight); } @Override - public void drawSubArea(double x, double y, double width, double height, double drawnU, double drawnV, double drawnWidth, double drawnHeight) { - //compute relative sizes + public void drawSubArea(double x, double y, double width, double height, double drawnU, double drawnV, + double drawnWidth, double drawnHeight) { + // compute relative sizes double cornerWidth = pixelCornerWidth / pixelImageWidth; double cornerHeight = pixelCornerHeight / pixelImageHeight; - //draw up corners + // draw up corners super.drawSubArea(x, y, pixelCornerWidth, pixelCornerHeight, 0.0, 0.0, cornerWidth, cornerHeight); - super.drawSubArea(x + width - pixelCornerWidth, y, pixelCornerWidth, pixelCornerHeight, 1.0 - cornerWidth, 0.0, cornerWidth, cornerHeight); - //draw down corners - super.drawSubArea(x, y + height - pixelCornerHeight, pixelCornerWidth, pixelCornerHeight, 0.0, 1.0 - cornerHeight, cornerWidth, cornerHeight); - super.drawSubArea(x + width - pixelCornerWidth, y + height - pixelCornerHeight, pixelCornerWidth, pixelCornerHeight, 1.0 - cornerWidth, 1.0 - cornerHeight, cornerWidth, cornerHeight); - //draw horizontal connections + super.drawSubArea(x + width - pixelCornerWidth, y, pixelCornerWidth, pixelCornerHeight, 1.0 - cornerWidth, 0.0, + cornerWidth, cornerHeight); + // draw down corners + super.drawSubArea(x, y + height - pixelCornerHeight, pixelCornerWidth, pixelCornerHeight, 0.0, + 1.0 - cornerHeight, cornerWidth, cornerHeight); + super.drawSubArea(x + width - pixelCornerWidth, y + height - pixelCornerHeight, pixelCornerWidth, + pixelCornerHeight, 1.0 - cornerWidth, 1.0 - cornerHeight, cornerWidth, cornerHeight); + // draw horizontal connections super.drawSubArea(x + pixelCornerWidth, y, width - 2 * pixelCornerWidth, pixelCornerHeight, cornerWidth, 0.0, 1.0 - 2 * cornerWidth, cornerHeight); - super.drawSubArea(x + pixelCornerWidth, y + height - pixelCornerHeight, width - 2 * pixelCornerWidth, pixelCornerHeight, + super.drawSubArea(x + pixelCornerWidth, y + height - pixelCornerHeight, width - 2 * pixelCornerWidth, + pixelCornerHeight, cornerWidth, 1.0 - cornerHeight, 1.0 - 2 * cornerWidth, cornerHeight); - //draw vertical connections + // draw vertical connections super.drawSubArea(x, y + pixelCornerHeight, pixelCornerWidth, height - 2 * pixelCornerHeight, 0.0, cornerHeight, cornerWidth, 1.0 - 2 * cornerHeight); - super.drawSubArea(x + width - pixelCornerWidth, y + pixelCornerHeight, pixelCornerWidth, height - 2 * pixelCornerHeight, + super.drawSubArea(x + width - pixelCornerWidth, y + pixelCornerHeight, pixelCornerWidth, + height - 2 * pixelCornerHeight, 1.0 - cornerWidth, cornerHeight, cornerWidth, 1.0 - 2 * cornerHeight); - //draw central body + // draw central body super.drawSubArea(x + pixelCornerWidth, y + pixelCornerHeight, width - 2 * pixelCornerWidth, height - 2 * pixelCornerHeight, cornerWidth, cornerHeight, 1.0 - 2 * cornerWidth, 1.0 - 2 * cornerHeight); diff --git a/src/main/java/gregtech/api/gui/resources/ColorRectTexture.java b/src/main/java/gregtech/api/gui/resources/ColorRectTexture.java index b1ae34250df..f27e41b2965 100644 --- a/src/main/java/gregtech/api/gui/resources/ColorRectTexture.java +++ b/src/main/java/gregtech/api/gui/resources/ColorRectTexture.java @@ -7,7 +7,8 @@ import java.awt.*; -public class ColorRectTexture implements IGuiTexture{ +public class ColorRectTexture implements IGuiTexture { + public int color; public ColorRectTexture(int color) { @@ -42,15 +43,17 @@ public void draw(double x, double y, int width, int height) { y = bottom; bottom = j; } - float f3 = (float)(color >> 24 & 255) / 255.0F; - float f = (float)(color >> 16 & 255) / 255.0F; - float f1 = (float)(color >> 8 & 255) / 255.0F; - float f2 = (float)(color & 255) / 255.0F; + float f3 = (float) (color >> 24 & 255) / 255.0F; + float f = (float) (color >> 16 & 255) / 255.0F; + float f1 = (float) (color >> 8 & 255) / 255.0F; + float f2 = (float) (color & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); GlStateManager.color(f, f1, f2, f3); bufferbuilder.begin(7, DefaultVertexFormats.POSITION); bufferbuilder.pos(x, bottom, 0.0D).endVertex(); diff --git a/src/main/java/gregtech/api/gui/resources/FileTexture.java b/src/main/java/gregtech/api/gui/resources/FileTexture.java index 94cac96e4f2..cd8a397a47b 100644 --- a/src/main/java/gregtech/api/gui/resources/FileTexture.java +++ b/src/main/java/gregtech/api/gui/resources/FileTexture.java @@ -7,19 +7,23 @@ import gregtech.api.gui.resources.utils.GifDecoder; import gregtech.api.gui.resources.utils.ImageUtils; import gregtech.api.gui.resources.utils.ProcessedImageData; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.compress.utils.IOUtils; -import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -public class FileTexture implements IGuiTexture{ +import javax.imageio.ImageIO; + +public class FileTexture implements IGuiTexture { + public final File file; @SideOnly(Side.CLIENT) private PictureTexture texture; @@ -33,7 +37,7 @@ public FileTexture(File file) { } @SideOnly(Side.CLIENT) - public void loadFile(){ + public void loadFile() { if (imageData != null) { if (imageData.isAnimated()) { texture = new AnimatedPictureTexture(imageData); @@ -83,7 +87,7 @@ public void loadFile(){ @SideOnly(Side.CLIENT) @Override public void updateTick() { - if(this.texture != null) { + if (this.texture != null) { texture.tick(); // gif\video update } } @@ -91,17 +95,18 @@ public void updateTick() { @Override public void draw(double x, double y, int width, int height) { if (texture != null && texture.hasTexture()) { - texture.render((float)x, (float)y, width, height, 0, 1, 1, false, false); + texture.render((float) x, (float) y, width, height, 0, 1, 1, false, false); } else { if (failed || file == null) { - Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("texture.url_texture.fail"), (int)x + 2, (int)(y + height / 2.0 - 4), 0xffff0000); + Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("texture.url_texture.fail"), (int) x + 2, + (int) (y + height / 2.0 - 4), 0xffff0000); } else { this.loadFile(); int s = (int) Math.floorMod(System.currentTimeMillis() / 200, 24); - Widget.drawSector((float)(x + width / 2.0), (float)(y + height / 2.0), (float)(Math.min(width, height) / 4.0), + Widget.drawSector((float) (x + width / 2.0), (float) (y + height / 2.0), + (float) (Math.min(width, height) / 4.0), 0xFF94E2C1, 24, s, s + 5); } } } - } diff --git a/src/main/java/gregtech/api/gui/resources/IGuiTexture.java b/src/main/java/gregtech/api/gui/resources/IGuiTexture.java index 4c0355e2780..cd9e81cd79a 100644 --- a/src/main/java/gregtech/api/gui/resources/IGuiTexture.java +++ b/src/main/java/gregtech/api/gui/resources/IGuiTexture.java @@ -1,7 +1,10 @@ package gregtech.api.gui.resources; public interface IGuiTexture { + void draw(double x, double y, int width, int height); - default void updateTick() { } + + default void updateTick() {} + IGuiTexture EMPTY = (x, y, width, height) -> {}; } diff --git a/src/main/java/gregtech/api/gui/resources/ItemStackTexture.java b/src/main/java/gregtech/api/gui/resources/ItemStackTexture.java index 5718ab90a77..901a1b1aad1 100644 --- a/src/main/java/gregtech/api/gui/resources/ItemStackTexture.java +++ b/src/main/java/gregtech/api/gui/resources/ItemStackTexture.java @@ -7,7 +7,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class ItemStackTexture implements IGuiTexture{ +public class ItemStackTexture implements IGuiTexture { + private final ItemStack[] itemStack; private int index = 0; private int ticks = 0; @@ -21,15 +22,15 @@ public ItemStackTexture(ItemStack stack, ItemStack... itemStack) { public ItemStackTexture(Item item, Item... items) { this.itemStack = new ItemStack[items.length + 1]; this.itemStack[0] = new ItemStack(item); - for(int i = 0; i < items.length; i++) { - itemStack[i+1] = new ItemStack(items[i]); + for (int i = 0; i < items.length; i++) { + itemStack[i + 1] = new ItemStack(items[i]); } } @Override public void updateTick() { - if(itemStack.length > 1 && ++ticks % 20 == 0) - if(++index == itemStack.length) + if (itemStack.length > 1 && ++ticks % 20 == 0) + if (++index == itemStack.length) index = 0; } diff --git a/src/main/java/gregtech/api/gui/resources/ModifyGuiTexture.java b/src/main/java/gregtech/api/gui/resources/ModifyGuiTexture.java index bcd378396f7..302650df8f5 100644 --- a/src/main/java/gregtech/api/gui/resources/ModifyGuiTexture.java +++ b/src/main/java/gregtech/api/gui/resources/ModifyGuiTexture.java @@ -1,13 +1,15 @@ package gregtech.api.gui.resources; -import com.google.gson.JsonObject; import net.minecraft.util.ResourceLocation; +import com.google.gson.JsonObject; + import java.io.File; import java.util.Arrays; import java.util.List; -public class ModifyGuiTexture implements IGuiTexture{ +public class ModifyGuiTexture implements IGuiTexture { + public static List TYPES = Arrays.asList("resource", "url", "text", "color", "file"); private IGuiTexture texture; @@ -74,7 +76,7 @@ public JsonObject saveConfig() { if (((FileTexture) texture).file != null) { config.addProperty("file", ((FileTexture) texture).file.getPath()); } else { - config.addProperty("file", (String)null); + config.addProperty("file", (String) null); } } else { return null; @@ -86,7 +88,8 @@ public void loadConfig(JsonObject config) { try { switch (config.get("type").getAsString()) { case "resource": - setTexture(new TextureArea(new ResourceLocation(config.get("resource").getAsString()), 0.0, 0.0, 1.0, 1.0)); + setTexture(new TextureArea(new ResourceLocation(config.get("resource").getAsString()), 0.0, 0.0, + 1.0, 1.0)); case "url": setTexture(new URLTexture(config.get("url").getAsString())); case "text": @@ -96,7 +99,6 @@ public void loadConfig(JsonObject config) { case "file": setTexture(new FileTexture(new File(config.get("file").getAsString()))); } - } catch (Exception ignored) { - } + } catch (Exception ignored) {} } } diff --git a/src/main/java/gregtech/api/gui/resources/ResourceHelper.java b/src/main/java/gregtech/api/gui/resources/ResourceHelper.java index a93fe233937..7dd56f551f4 100644 --- a/src/main/java/gregtech/api/gui/resources/ResourceHelper.java +++ b/src/main/java/gregtech/api/gui/resources/ResourceHelper.java @@ -2,20 +2,23 @@ import gregtech.api.GTValues; import gregtech.api.util.GTUtility; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.io.IOUtils; -import javax.annotation.Nonnull; import java.io.IOException; import java.net.URL; import java.util.HashMap; import java.util.Map; +import javax.annotation.Nonnull; + /** * Original copied from com.brandon3055.draconicevolution.helpers; *

@@ -69,7 +72,8 @@ public static boolean isResourceExist(String rs) { * @return if the resource exists */ @SideOnly(Side.CLIENT) - public static boolean doResourcepacksHaveTexture(@Nonnull String modid, @Nonnull String textureResource, boolean format) { + public static boolean doResourcepacksHaveTexture(@Nonnull String modid, @Nonnull String textureResource, + boolean format) { if (format) textureResource = String.format(DIR_FORMAT, textureResource); return doResourcepacksHaveResource(modid, textureResource); } diff --git a/src/main/java/gregtech/api/gui/resources/ShaderTexture.java b/src/main/java/gregtech/api/gui/resources/ShaderTexture.java index bb267a3b117..589dae4078a 100644 --- a/src/main/java/gregtech/api/gui/resources/ShaderTexture.java +++ b/src/main/java/gregtech/api/gui/resources/ShaderTexture.java @@ -1,35 +1,36 @@ package gregtech.api.gui.resources; -import codechicken.lib.render.shader.ShaderObject; -import codechicken.lib.render.shader.ShaderProgram; import gregtech.api.gui.Widget; import gregtech.client.shader.Shaders; import gregtech.common.ConfigHolder; + import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.shader.ShaderObject; +import codechicken.lib.render.shader.ShaderProgram; + import java.util.HashMap; import java.util.Map; import java.util.function.Consumer; -public class ShaderTexture implements IGuiTexture{ +public class ShaderTexture implements IGuiTexture { + @SideOnly(Side.CLIENT) private static final Map PROGRAMS = new HashMap<>(); @SideOnly(Side.CLIENT) private ShaderProgram program; @SideOnly(Side.CLIENT) private ShaderObject object; - private float resolution = (float)ConfigHolder.client.resolution; + private float resolution = (float) ConfigHolder.client.resolution; - public static void clear(){ + public static void clear() { PROGRAMS.values().forEach(ShaderTexture::dispose); PROGRAMS.clear(); } - private ShaderTexture() { - - } + private ShaderTexture() {} public void dispose() { if (object != null) { @@ -96,7 +97,7 @@ public void draw(double x, double y, int width, int height) { public void draw(double x, double y, int width, int height, Consumer uniformCache) { if (program != null) { - program.useShader(cache->{ + program.useShader(cache -> { cache.glUniform2F("u_resolution", width * resolution, height * resolution); if (uniformCache != null) { uniformCache.accept(cache); diff --git a/src/main/java/gregtech/api/gui/resources/SizedTextureArea.java b/src/main/java/gregtech/api/gui/resources/SizedTextureArea.java index 4ce47aac5e7..fb0a22b85b6 100644 --- a/src/main/java/gregtech/api/gui/resources/SizedTextureArea.java +++ b/src/main/java/gregtech/api/gui/resources/SizedTextureArea.java @@ -1,6 +1,7 @@ package gregtech.api.gui.resources; import gregtech.api.util.GTUtility; + import net.minecraft.util.ResourceLocation; public class SizedTextureArea extends TextureArea { @@ -8,7 +9,8 @@ public class SizedTextureArea extends TextureArea { public final double pixelImageWidth; public final double pixelImageHeight; - public SizedTextureArea(ResourceLocation imageLocation, double offsetX, double offsetY, double width, double height, double pixelImageWidth, double pixelImageHeight) { + public SizedTextureArea(ResourceLocation imageLocation, double offsetX, double offsetY, double width, double height, + double pixelImageWidth, double pixelImageHeight) { super(imageLocation, offsetX, offsetY, width, height); this.pixelImageWidth = pixelImageWidth; this.pixelImageHeight = pixelImageHeight; diff --git a/src/main/java/gregtech/api/gui/resources/SteamTexture.java b/src/main/java/gregtech/api/gui/resources/SteamTexture.java index 6b50a93823a..df10c63603b 100644 --- a/src/main/java/gregtech/api/gui/resources/SteamTexture.java +++ b/src/main/java/gregtech/api/gui/resources/SteamTexture.java @@ -20,18 +20,19 @@ private SteamTexture(TextureArea bronzeTexture, TextureArea steelTexture) { public static SteamTexture fullImage(String path) { return new SteamTexture( TextureArea.fullImage(String.format(path, BRONZE)), - TextureArea.fullImage(String.format(path, STEEL)) - ); + TextureArea.fullImage(String.format(path, STEEL))); } - public static SteamTexture fullImage(String path, int imageWidth, int imageHeight, int cornerWidth, int cornerHeight) { + public static SteamTexture fullImage(String path, int imageWidth, int imageHeight, int cornerWidth, + int cornerHeight) { return new SteamTexture( - AdoptableTextureArea.fullImage(String.format(path, BRONZE), imageWidth, imageHeight, cornerWidth, cornerHeight), - AdoptableTextureArea.fullImage(String.format(path, STEEL), imageWidth, imageHeight, cornerWidth, cornerHeight) - ); + AdoptableTextureArea.fullImage(String.format(path, BRONZE), imageWidth, imageHeight, cornerWidth, + cornerHeight), + AdoptableTextureArea.fullImage(String.format(path, STEEL), imageWidth, imageHeight, cornerWidth, + cornerHeight)); } public TextureArea get(boolean isHighPressure) { - return isHighPressure ? steelTexture : bronzeTexture; + return isHighPressure ? steelTexture : bronzeTexture; } } diff --git a/src/main/java/gregtech/api/gui/resources/TextTexture.java b/src/main/java/gregtech/api/gui/resources/TextTexture.java index 507851d9a31..19928d07c8b 100644 --- a/src/main/java/gregtech/api/gui/resources/TextTexture.java +++ b/src/main/java/gregtech/api/gui/resources/TextTexture.java @@ -11,7 +11,8 @@ import java.util.Collections; import java.util.List; -public class TextTexture implements IGuiTexture{ +public class TextTexture implements IGuiTexture { + public String text; public int color; public int width; @@ -87,7 +88,7 @@ public void draw(double x, double y, int width, int height) { GlStateManager.color(1, 1, 1, 1); } - public enum TextType{ + public enum TextType { NORMAL, HIDE, ROLL diff --git a/src/main/java/gregtech/api/gui/resources/TextureArea.java b/src/main/java/gregtech/api/gui/resources/TextureArea.java index de56ae56591..1466759d646 100644 --- a/src/main/java/gregtech/api/gui/resources/TextureArea.java +++ b/src/main/java/gregtech/api/gui/resources/TextureArea.java @@ -1,13 +1,10 @@ package gregtech.api.gui.resources; -import codechicken.lib.vec.Rotation; -import codechicken.lib.vec.Transformation; -import codechicken.lib.vec.Translation; -import codechicken.lib.vec.Vector3; import gregtech.api.util.GTUtility; import gregtech.api.util.Position; import gregtech.api.util.PositionedRect; import gregtech.api.util.Size; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -17,6 +14,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.vec.Rotation; +import codechicken.lib.vec.Transformation; +import codechicken.lib.vec.Translation; +import codechicken.lib.vec.Vector3; + /** * Represents a texture area of image * This representation doesn't take image size in account, so all image variables are @@ -44,7 +46,8 @@ public static TextureArea fullImage(String imageLocation) { return new TextureArea(GTUtility.gregtechId(imageLocation), 0.0, 0.0, 1.0, 1.0); } - public static TextureArea areaOfImage(String imageLocation, int imageSizeX, int imageSizeY, int u, int v, int width, int height) { + public static TextureArea areaOfImage(String imageLocation, int imageSizeX, int imageSizeY, int u, int v, int width, + int height) { return new TextureArea(new ResourceLocation(imageLocation), u / (imageSizeX * 1.0), v / (imageSizeY * 1.0), @@ -66,7 +69,8 @@ public void drawRotated(int x, int y, Size areaSize, PositionedRect positionedRe GlStateManager.pushMatrix(); GlStateManager.translate(x, y, 0.0f); transformation.glApply(); - draw(positionedRect.position.x, positionedRect.position.y, positionedRect.size.width, positionedRect.size.height); + draw(positionedRect.position.x, positionedRect.position.y, positionedRect.size.width, + positionedRect.size.height); GlStateManager.popMatrix(); } @@ -106,8 +110,9 @@ public void draw(double x, double y, int width, int height) { } @SideOnly(Side.CLIENT) - public void drawSubArea(double x, double y, double width, double height, double drawnU, double drawnV, double drawnWidth, double drawnHeight) { - //sub area is just different width and height + public void drawSubArea(double x, double y, double width, double height, double drawnU, double drawnV, + double drawnWidth, double drawnHeight) { + // sub area is just different width and height double imageU = this.offsetX + (this.imageWidth * drawnU); double imageV = this.offsetY + (this.imageHeight * drawnV); double imageWidth = this.imageWidth * drawnWidth; diff --git a/src/main/java/gregtech/api/gui/resources/URLTexture.java b/src/main/java/gregtech/api/gui/resources/URLTexture.java index ef101d59b41..80a7a9630e1 100644 --- a/src/main/java/gregtech/api/gui/resources/URLTexture.java +++ b/src/main/java/gregtech/api/gui/resources/URLTexture.java @@ -3,12 +3,14 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.resources.picturetexture.PictureTexture; import gregtech.api.gui.resources.utils.DownloadThread; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class URLTexture implements IGuiTexture{ +public class URLTexture implements IGuiTexture { + public final String url; @SideOnly(Side.CLIENT) private DownloadThread downloader; @@ -19,7 +21,6 @@ public class URLTexture implements IGuiTexture{ @SideOnly(Side.CLIENT) private String error; - public URLTexture(String url) { this.url = url; } @@ -27,7 +28,7 @@ public URLTexture(String url) { @SideOnly(Side.CLIENT) @Override public void updateTick() { - if(this.texture != null) { + if (this.texture != null) { texture.tick(); // gif\video update } } @@ -35,14 +36,16 @@ public void updateTick() { @Override public void draw(double x, double y, int width, int height) { if (texture != null && texture.hasTexture()) { - texture.render((float)x, (float)y, width, height, 0, 1, 1, false, false); + texture.render((float) x, (float) y, width, height, 0, 1, 1, false, false); } else { if (failed || url == null || this.url.isEmpty()) { - Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("texture.url_texture.fail"), (int)x + 2, (int)(y + height / 2.0 - 4), 0xffff0000); + Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("texture.url_texture.fail"), (int) x + 2, + (int) (y + height / 2.0 - 4), 0xffff0000); } else { this.loadTexture(); int s = (int) Math.floorMod(System.currentTimeMillis() / 200, 24); - Widget.drawSector((float)(x + width / 2.0), (float)(y + height / 2.0), (float)(Math.min(width, height) / 4.0), + Widget.drawSector((float) (x + width / 2.0), (float) (y + height / 2.0), + (float) (Math.min(width, height) / 4.0), 0xFF94E2C1, 24, s, s + 5); } } diff --git a/src/main/java/gregtech/api/gui/resources/picturetexture/AnimatedPictureTexture.java b/src/main/java/gregtech/api/gui/resources/picturetexture/AnimatedPictureTexture.java index a8b4526edef..3020f361f5e 100644 --- a/src/main/java/gregtech/api/gui/resources/picturetexture/AnimatedPictureTexture.java +++ b/src/main/java/gregtech/api/gui/resources/picturetexture/AnimatedPictureTexture.java @@ -1,12 +1,13 @@ package gregtech.api.gui.resources.picturetexture; - import gregtech.api.gui.resources.utils.ProcessedImageData; + import net.minecraft.client.renderer.GlStateManager; import java.util.Arrays; public class AnimatedPictureTexture extends PictureTexture { + private final int[] textureIDs; private final long[] delay; private final long duration; @@ -28,7 +29,8 @@ public void tick() { if (imageData != null) { long startTime = System.currentTimeMillis(); int index = 0; - while (completedFrames < textureIDs.length && index < textureIDs.length && System.currentTimeMillis() - startTime < 10) { + while (completedFrames < textureIDs.length && index < textureIDs.length && + System.currentTimeMillis() - startTime < 10) { while (textureIDs[index] != -1 && index < textureIDs.length - 1) index++; if (textureIDs[index] == -1) diff --git a/src/main/java/gregtech/api/gui/resources/picturetexture/OrdinaryTexture.java b/src/main/java/gregtech/api/gui/resources/picturetexture/OrdinaryTexture.java index 31d2e2a3983..deeff304937 100644 --- a/src/main/java/gregtech/api/gui/resources/picturetexture/OrdinaryTexture.java +++ b/src/main/java/gregtech/api/gui/resources/picturetexture/OrdinaryTexture.java @@ -12,12 +12,10 @@ public OrdinaryTexture(ProcessedImageData image) { } @Override - public void tick() { - } + public void tick() {} @Override public int getTextureID() { return textureID; } } - diff --git a/src/main/java/gregtech/api/gui/resources/picturetexture/PictureTexture.java b/src/main/java/gregtech/api/gui/resources/picturetexture/PictureTexture.java index 8d614fbecac..8ecd30be847 100644 --- a/src/main/java/gregtech/api/gui/resources/picturetexture/PictureTexture.java +++ b/src/main/java/gregtech/api/gui/resources/picturetexture/PictureTexture.java @@ -1,32 +1,33 @@ package gregtech.api.gui.resources.picturetexture; import gregtech.api.gui.resources.IGuiTexture; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; + import org.lwjgl.opengl.GL11; public abstract class PictureTexture implements IGuiTexture { + public int width; public int height; public PictureTexture(int width, int height) { this.width = width; this.height = height; - } - public void beforeRender() { - - } + public void beforeRender() {} @Override public void draw(double x, double y, int width, int height) { - render((float)x, (float)y, 1, 1, 0, width, height, false, false); + render((float) x, (float) y, 1, 1, 0, width, height, false, false); } - public void render(float x, float y, float width, float height, float rotation, float scaleX, float scaleY, boolean flippedX, boolean flippedY) { + public void render(float x, float y, float width, float height, float rotation, float scaleX, float scaleY, + boolean flippedX, boolean flippedY) { this.beforeRender(); - GlStateManager.color(1,1,1,1); + GlStateManager.color(1, 1, 1, 1); GlStateManager.enableBlend(); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GlStateManager.bindTexture(this.getTextureID()); diff --git a/src/main/java/gregtech/api/gui/resources/picturetexture/VideoTexture.java b/src/main/java/gregtech/api/gui/resources/picturetexture/VideoTexture.java index 70f1dc7aebf..ac1b631c03f 100644 --- a/src/main/java/gregtech/api/gui/resources/picturetexture/VideoTexture.java +++ b/src/main/java/gregtech/api/gui/resources/picturetexture/VideoTexture.java @@ -1,17 +1,15 @@ package gregtech.api.gui.resources.picturetexture; public class VideoTexture extends PictureTexture { - //TODO implementations of it in the future + // TODO implementations of it in the future public VideoTexture(String url) { super(100, 100); } - + @Override - public void tick() { - - } - + public void tick() {} + @Override public int getTextureID() { return 0; diff --git a/src/main/java/gregtech/api/gui/resources/utils/DownloadThread.java b/src/main/java/gregtech/api/gui/resources/utils/DownloadThread.java index e9685bbf694..962c2639489 100644 --- a/src/main/java/gregtech/api/gui/resources/utils/DownloadThread.java +++ b/src/main/java/gregtech/api/gui/resources/utils/DownloadThread.java @@ -5,12 +5,13 @@ import gregtech.api.gui.resources.picturetexture.PictureTexture; import gregtech.api.gui.resources.picturetexture.VideoTexture; import gregtech.api.util.GTLog; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.compress.utils.IOUtils; import org.apache.logging.log4j.Logger; -import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.*; import java.net.HttpURLConnection; @@ -24,8 +25,11 @@ import java.util.HashSet; import java.util.Set; +import javax.imageio.ImageIO; + @SideOnly(Side.CLIENT) public class DownloadThread extends Thread { + public static final Logger LOGGER = GTLog.logger; public static final TextureCache TEXTURE_CACHE = new TextureCache(); @@ -134,7 +138,8 @@ public static byte[] load(String url) throws IOException, FoundVideoException { TextureCache.CacheEntry entry = TEXTURE_CACHE.getEntry(url); long requestTime = System.currentTimeMillis(); URLConnection connection = new URL(url).openConnection(); - connection.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0"); + connection.addRequestProperty("User-Agent", + "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0"); int responseCode = -1; if (connection instanceof HttpURLConnection) { HttpURLConnection httpConnection = (HttpURLConnection) connection; diff --git a/src/main/java/gregtech/api/gui/resources/utils/GifDecoder.java b/src/main/java/gregtech/api/gui/resources/utils/GifDecoder.java index 2577edf7c8c..37ee5ee3b10 100644 --- a/src/main/java/gregtech/api/gui/resources/utils/GifDecoder.java +++ b/src/main/java/gregtech/api/gui/resources/utils/GifDecoder.java @@ -10,11 +10,13 @@ import java.net.URL; import java.util.ArrayList; -/** Class GifDecoder - Decodes a GIF file into one or more frames. +/** + * Class GifDecoder - Decodes a GIF file into one or more frames. * * Example: * *

+ * 
  * {
  *     @code
  *     GifDecoder d = new GifDecoder();
@@ -33,7 +35,8 @@
  * restrictions. Please forward any corrections to questions at fmsware.com.
  *
  * @author Kevin Weiner, FM Software; LZW decoder adapted from John Cristy's ImageMagick.
- * @version 1.03 November 2003 */
+ * @version 1.03 November 2003
+ */
 
 public class GifDecoder {
 
@@ -97,6 +100,7 @@ public class GifDecoder {
     protected int frameCount;
 
     static class GifFrame {
+
         public GifFrame(BufferedImage im, int del) {
             image = im;
             delay = del;
@@ -106,11 +110,13 @@ public GifFrame(BufferedImage im, int del) {
         public int delay;
     }
 
-    /** Gets display duration for specified frame.
+    /**
+     * Gets display duration for specified frame.
      *
      * @param n
-     *            int index of frame
-     * @return delay in milliseconds */
+     *          int index of frame
+     * @return delay in milliseconds
+     */
     public int getDelay(int n) {
         //
         delay = -1;
@@ -120,30 +126,38 @@ public int getDelay(int n) {
         return delay;
     }
 
-    /** Gets the number of frames read from file.
+    /**
+     * Gets the number of frames read from file.
      *
-     * @return frame count */
+     * @return frame count
+     */
     public int getFrameCount() {
         return frameCount;
     }
 
-    /** Gets the first (or only) image read.
+    /**
+     * Gets the first (or only) image read.
      *
-     * @return BufferedImage containing first frame, or null if none. */
+     * @return BufferedImage containing first frame, or null if none.
+     */
     public BufferedImage getImage() {
         return getFrame(0);
     }
 
-    /** Gets the "Netscape" iteration count, if any.
+    /**
+     * Gets the "Netscape" iteration count, if any.
      * A count of 0 means repeat indefinitiely.
      *
-     * @return iteration count if one was specified, else 1. */
+     * @return iteration count if one was specified, else 1.
+     */
     public int getLoopCount() {
         return loopCount;
     }
 
-    /** Creates new frame image from current data (and previous
-     * frames as specified by their disposition codes). */
+    /**
+     * Creates new frame image from current data (and previous
+     * frames as specified by their disposition codes).
+     */
     protected void setPixels() {
         // expose destination image's pixels as int array
         int[] dest = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
@@ -229,9 +243,11 @@ protected void setPixels() {
         }
     }
 
-    /** Gets the image contents of frame n.
+    /**
+     * Gets the image contents of frame n.
      *
-     * @return BufferedImage representation of frame, or null if n is invalid. */
+     * @return BufferedImage representation of frame, or null if n is invalid.
+     */
     public BufferedImage getFrame(int n) {
         BufferedImage im = null;
         if ((n >= 0) && (n < frameCount)) {
@@ -240,18 +256,22 @@ public BufferedImage getFrame(int n) {
         return im;
     }
 
-    /** Gets image size.
+    /**
+     * Gets image size.
      *
-     * @return GIF image dimensions */
+     * @return GIF image dimensions
+     */
     public Dimension getFrameSize() {
         return new Dimension(width, height);
     }
 
-    /** Reads GIF image from stream
+    /**
+     * Reads GIF image from stream
      *
      * @param is
-     *            BufferedInputStream containing GIF file.
-     * @return read status code (0 = no errors) */
+     *           BufferedInputStream containing GIF file.
+     * @return read status code (0 = no errors)
+     */
     public int read(BufferedInputStream is) {
         init();
         if (is != null) {
@@ -268,16 +288,17 @@ public int read(BufferedInputStream is) {
         }
         try {
             is.close();
-        } catch (IOException e) {
-        }
+        } catch (IOException e) {}
         return status;
     }
 
-    /** Reads GIF image from stream
+    /**
+     * Reads GIF image from stream
      *
      * @param is
-     *            InputStream containing GIF file.
-     * @return read status code (0 = no errors) */
+     *           InputStream containing GIF file.
+     * @return read status code (0 = no errors)
+     */
     public int read(InputStream is) {
         init();
         if (is != null) {
@@ -296,17 +317,18 @@ public int read(InputStream is) {
         }
         try {
             is.close();
-        } catch (IOException e) {
-        }
+        } catch (IOException e) {}
         return status;
     }
 
-    /** Reads GIF file from specified file/URL source
+    /**
+     * Reads GIF file from specified file/URL source
      * (URL assumed if name contains ":/" or "file:")
      *
      * @param name
-     *            String containing source
-     * @return read status code (0 = no errors) */
+     *             String containing source
+     * @return read status code (0 = no errors)
+     */
     public int read(String name) {
         status = STATUS_OK;
         try {
@@ -325,8 +347,10 @@ public int read(String name) {
         return status;
     }
 
-    /** Decodes LZW image data into pixel array.
-     * Adapted from John Cristy's ImageMagick. */
+    /**
+     * Decodes LZW image data into pixel array.
+     * Adapted from John Cristy's ImageMagick.
+     */
     protected void decodeImageData() {
         int NullCode = -1;
         int npix = iw * ih;
@@ -343,7 +367,7 @@ protected void decodeImageData() {
         if (pixelStack == null)
             pixelStack = new byte[MaxStackSize + 1];
 
-        //  Initialize GIF data stream decoder.
+        // Initialize GIF data stream decoder.
 
         data_size = read();
         clear = 1 << data_size;
@@ -357,14 +381,14 @@ protected void decodeImageData() {
             suffix[code] = (byte) code;
         }
 
-        //  Decode GIF pixel stream.
+        // Decode GIF pixel stream.
 
         datum = bits = count = first = top = pi = bi = 0;
 
         for (i = 0; i < npix;) {
             if (top == 0) {
                 if (bits < code_size) {
-                    //  Load bytes until there are enough bits for a code.
+                    // Load bytes until there are enough bits for a code.
                     if (count == 0) {
                         // Read a new data block.
                         count = readBlock();
@@ -379,18 +403,18 @@ protected void decodeImageData() {
                     continue;
                 }
 
-                //  Get the next code.
+                // Get the next code.
 
                 code = datum & code_mask;
                 datum >>= code_size;
                 bits -= code_size;
 
-                //  Interpret the code
+                // Interpret the code
 
                 if ((code > available) || (code == end_of_information))
                     break;
                 if (code == clear) {
-                    //  Reset decoder.
+                    // Reset decoder.
                     code_size = data_size + 1;
                     code_mask = (1 << code_size) - 1;
                     available = clear + 2;
@@ -414,7 +438,7 @@ protected void decodeImageData() {
                 }
                 first = (suffix[code]) & 0xff;
 
-                //  Add a new string to the string table,
+                // Add a new string to the string table,
 
                 if (available >= MaxStackSize) {
                     pixelStack[top++] = (byte) first;
@@ -431,7 +455,7 @@ protected void decodeImageData() {
                 old_code = in_code;
             }
 
-            //  Pop a pixel off the pixel stack.
+            // Pop a pixel off the pixel stack.
 
             top--;
             pixels[pi++] = pixelStack[top];
@@ -441,7 +465,6 @@ protected void decodeImageData() {
         for (i = pi; i < npix; i++) {
             pixels[i] = 0; // clear missing pixels
         }
-
     }
 
     /** Returns true if an error was encountered during reading/decoding */
@@ -469,9 +492,11 @@ protected int read() {
         return curByte;
     }
 
-    /** Reads next variable length block from input.
+    /**
+     * Reads next variable length block from input.
      *
-     * @return number of bytes stored in "buffer" */
+     * @return number of bytes stored in "buffer"
+     */
     protected int readBlock() {
         blockSize = read();
         int n = 0;
@@ -484,8 +509,7 @@ protected int readBlock() {
                         break;
                     n += count;
                 }
-            } catch (IOException e) {
-            }
+            } catch (IOException e) {}
 
             if (n < blockSize) {
                 status = STATUS_FORMAT_ERROR;
@@ -494,11 +518,13 @@ protected int readBlock() {
         return n;
     }
 
-    /** Reads color table as 256 RGB integer values
+    /**
+     * Reads color table as 256 RGB integer values
      *
      * @param ncolors
-     *            int number of colors to read
-     * @return int array containing 256 colors (packed ARGB with full alpha) */
+     *                int number of colors to read
+     * @return int array containing 256 colors (packed ARGB with full alpha)
+     */
     protected int[] readColorTable(int ncolors) {
         int nbytes = 3 * ncolors;
         int[] tab = null;
@@ -506,8 +532,7 @@ protected int[] readColorTable(int ncolors) {
         int n = 0;
         try {
             n = in.read(c);
-        } catch (IOException e) {
-        }
+        } catch (IOException e) {}
         if (n < nbytes) {
             status = STATUS_FORMAT_ERROR;
         } else {
@@ -658,21 +683,19 @@ protected void readImage() {
             act[transIndex] = save;
         }
         resetFrame();
-
     }
 
     /** Reads Logical Screen Descriptor */
     protected void readLSD() {
-
         // logical screen size
         width = readShort();
         height = readShort();
 
         // packed fields
         int packed = read();
-        gctFlag = (packed & 0x80) != 0; // 1   : global color table flag
+        gctFlag = (packed & 0x80) != 0; // 1 : global color table flag
         // 2-4 : color resolution
-        // 5   : gct sort flag
+        // 5 : gct sort flag
         gctSize = 2 << (packed & 7); // 6-8 : gct size
 
         bgIndex = read(); // background color index
@@ -710,8 +733,10 @@ protected void resetFrame() {
         lct = null;
     }
 
-    /** Skips variable length blocks up to and including
-     * next zero length block. */
+    /**
+     * Skips variable length blocks up to and including
+     * next zero length block.
+     */
     protected void skip() {
         do {
             readBlock();
diff --git a/src/main/java/gregtech/api/gui/resources/utils/ImageUtils.java b/src/main/java/gregtech/api/gui/resources/utils/ImageUtils.java
index af980ff8eaf..b48cf952fea 100644
--- a/src/main/java/gregtech/api/gui/resources/utils/ImageUtils.java
+++ b/src/main/java/gregtech/api/gui/resources/utils/ImageUtils.java
@@ -1,21 +1,24 @@
 package gregtech.api.gui.resources.utils;
 
 import gregtech.GregTechMod;
+
 import org.apache.commons.compress.utils.IOUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
-import javax.imageio.ImageIO;
-import javax.imageio.ImageReadParam;
-import javax.imageio.ImageReader;
-import javax.imageio.stream.ImageInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Iterator;
 
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReadParam;
+import javax.imageio.ImageReader;
+import javax.imageio.stream.ImageInputStream;
+
 public class ImageUtils {
+
     public static final Logger LOGGER = LogManager.getLogger(GregTechMod.class);
 
     public static String readType(byte[] input) throws IOException {
diff --git a/src/main/java/gregtech/api/gui/resources/utils/ProcessedImageData.java b/src/main/java/gregtech/api/gui/resources/utils/ProcessedImageData.java
index 81a354d91a2..1baf6296c32 100644
--- a/src/main/java/gregtech/api/gui/resources/utils/ProcessedImageData.java
+++ b/src/main/java/gregtech/api/gui/resources/utils/ProcessedImageData.java
@@ -8,8 +8,8 @@
 import java.awt.image.BufferedImage;
 import java.nio.ByteBuffer;
 
-
 public class ProcessedImageData {
+
     private final int width;
     private final int height;
     private final Frame[] frames;
@@ -75,14 +75,14 @@ public int uploadFrame(int index) {
     }
 
     private static int uploadFrame(ByteBuffer buffer, boolean hasAlpha, int width, int height) {
-        int textureID = GL11.glGenTextures(); //Generate texture ID
-        GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); //Bind texture ID
+        int textureID = GL11.glGenTextures(); // Generate texture ID
+        GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); // Bind texture ID
 
-        //Setup wrap mode
+        // Setup wrap mode
         GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
         GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
 
-        //Setup texture scaling filtering
+        // Setup texture scaling filtering
         GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
         GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
 
@@ -90,10 +90,11 @@ private static int uploadFrame(ByteBuffer buffer, boolean hasAlpha, int width, i
             GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
         }
 
-        //Send texel data to OpenGL
-        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, hasAlpha ? GL11.GL_RGBA8 : GL11.GL_RGB8, width, height, 0, hasAlpha ? GL11.GL_RGBA : GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, buffer);
+        // Send texel data to OpenGL
+        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, hasAlpha ? GL11.GL_RGBA8 : GL11.GL_RGB8, width, height, 0,
+                hasAlpha ? GL11.GL_RGBA : GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, buffer);
 
-        //Return the texture ID so we can bind it later again
+        // Return the texture ID so we can bind it later again
         return textureID;
     }
 
@@ -126,6 +127,7 @@ private static Frame loadFrom(BufferedImage image) {
     }
 
     private static class Frame {
+
         private final ByteBuffer buffer;
         private final boolean hasAlpha;
 
diff --git a/src/main/java/gregtech/api/gui/resources/utils/TextureCache.java b/src/main/java/gregtech/api/gui/resources/utils/TextureCache.java
index 39975f2448e..c7c45c1fc9c 100644
--- a/src/main/java/gregtech/api/gui/resources/utils/TextureCache.java
+++ b/src/main/java/gregtech/api/gui/resources/utils/TextureCache.java
@@ -1,6 +1,7 @@
 package gregtech.api.gui.resources.utils;
 
 import net.minecraft.client.Minecraft;
+
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.io.IOUtils;
 
@@ -12,6 +13,7 @@
 import java.util.zip.GZIPOutputStream;
 
 public class TextureCache {
+
     private File cacheDirectory = new File(Minecraft.getMinecraft().gameDir, "opframe_cache");
     private File index = new File(cacheDirectory, "index");
 
@@ -104,6 +106,7 @@ private static File getFile(String url) {
     }
 
     public static class CacheEntry {
+
         private String url;
         private String etag;
         private long time;
diff --git a/src/main/java/gregtech/api/gui/widgets/AbstractWidgetGroup.java b/src/main/java/gregtech/api/gui/widgets/AbstractWidgetGroup.java
index 672714597c4..d765f7f7a39 100644
--- a/src/main/java/gregtech/api/gui/widgets/AbstractWidgetGroup.java
+++ b/src/main/java/gregtech/api/gui/widgets/AbstractWidgetGroup.java
@@ -9,11 +9,13 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.common.ConfigHolder;
-import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
 
+import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -27,7 +29,6 @@ public class AbstractWidgetGroup extends Widget implements IGhostIngredientTarge
     private transient boolean initialized = false;
     protected transient List waitToRemoved;
 
-
     public AbstractWidgetGroup(Position position) {
         super(position, Size.ZERO);
         this.isDynamicSized = true;
@@ -284,7 +285,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         for (Widget widget : widgets) {
             if (widget.isVisible()) {
                 widget.drawInBackground(mouseX, mouseY, partialTicks, context);
-                GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), 1.0F);
+                GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(),
+                        1.0F);
             }
         }
     }
@@ -293,7 +295,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
     public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) {
         for (int i = widgets.size() - 1; i >= 0; i--) {
             Widget widget = widgets.get(i);
-            if(widget.isVisible() && widget.isActive() && widget.mouseWheelMove(mouseX, mouseY, wheelDelta)) {
+            if (widget.isVisible() && widget.isActive() && widget.mouseWheelMove(mouseX, mouseY, wheelDelta)) {
                 return true;
             }
         }
@@ -304,7 +306,7 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) {
     public boolean mouseClicked(int mouseX, int mouseY, int button) {
         for (int i = widgets.size() - 1; i >= 0; i--) {
             Widget widget = widgets.get(i);
-            if(widget.isVisible() && widget.isActive() && widget.mouseClicked(mouseX, mouseY, button)) {
+            if (widget.isVisible() && widget.isActive() && widget.mouseClicked(mouseX, mouseY, button)) {
                 return true;
             }
         }
@@ -315,7 +317,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
     public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged) {
         for (int i = widgets.size() - 1; i >= 0; i--) {
             Widget widget = widgets.get(i);
-            if(widget.isVisible() && widget.isActive() && widget.mouseDragged(mouseX, mouseY, button, timeDragged)) {
+            if (widget.isVisible() && widget.isActive() && widget.mouseDragged(mouseX, mouseY, button, timeDragged)) {
                 return true;
             }
         }
@@ -326,7 +328,7 @@ public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged
     public boolean mouseReleased(int mouseX, int mouseY, int button) {
         for (int i = widgets.size() - 1; i >= 0; i--) {
             Widget widget = widgets.get(i);
-            if(widget.isVisible() && widget.isActive() && widget.mouseReleased(mouseX, mouseY, button)) {
+            if (widget.isVisible() && widget.isActive() && widget.mouseReleased(mouseX, mouseY, button)) {
                 return true;
             }
         }
@@ -337,7 +339,7 @@ public boolean mouseReleased(int mouseX, int mouseY, int button) {
     public boolean keyTyped(char charTyped, int keyCode) {
         for (int i = widgets.size() - 1; i >= 0; i--) {
             Widget widget = widgets.get(i);
-            if(widget.isVisible() && widget.isActive() && widget.keyTyped(charTyped, keyCode)) {
+            if (widget.isVisible() && widget.isActive() && widget.keyTyped(charTyped, keyCode)) {
                 return true;
             }
         }
@@ -426,6 +428,5 @@ public void writeUpdateInfo(Widget widget, int updateId, Consumer
                 dataWriter.accept(buffer);
             });
         }
-
     }
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/AdvancedTextWidget.java b/src/main/java/gregtech/api/gui/widgets/AdvancedTextWidget.java
index 27aff5dc44f..a6988624841 100644
--- a/src/main/java/gregtech/api/gui/widgets/AdvancedTextWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/AdvancedTextWidget.java
@@ -4,6 +4,7 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.gui.GuiScreen;
@@ -19,20 +20,23 @@
 import net.minecraftforge.fml.client.config.GuiUtils;
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
+
 import org.lwjgl.input.Mouse;
 
-import javax.annotation.Nonnull;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.function.BiConsumer;
 import java.util.function.Consumer;
 import java.util.stream.Collectors;
 
+import javax.annotation.Nonnull;
+
 /**
  * Represents a text-component based widget, which obtains
  * text from server and automatically synchronizes it with clients
  */
 public class AdvancedTextWidget extends Widget {
+
     protected int maxWidthLimit;
 
     @SideOnly(Side.CLIENT)
@@ -52,7 +56,7 @@ public AdvancedTextWidget(int xPosition, int yPosition, Consumer GuiUtilRenderComponents.splitText(c, maxTextWidthResult, fontRenderer, true, true).stream())
+                .flatMap(c -> GuiUtilRenderComponents.splitText(c, maxTextWidthResult, fontRenderer, true, true)
+                        .stream())
                 .collect(Collectors.toList());
     }
 
@@ -234,7 +240,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
         Position position = getPosition();
         for (int i = 0; i < displayText.size(); i++) {
-            fontRenderer.drawString(displayText.get(i).getFormattedText(), position.x, position.y + i * (fontRenderer.FONT_HEIGHT + 2), color);
+            fontRenderer.drawString(displayText.get(i).getFormattedText(), position.x,
+                    position.y + i * (fontRenderer.FONT_HEIGHT + 2), color);
         }
     }
 
@@ -254,6 +261,7 @@ public void drawInForeground(int mouseX, int mouseY) {
      */
     @SideOnly(Side.CLIENT)
     private static class WrapScreen extends GuiScreen {
+
         @Override
         public void handleComponentHover(@Nonnull ITextComponent component, int x, int y) {
             super.handleComponentHover(component, x, y);
diff --git a/src/main/java/gregtech/api/gui/widgets/BlockableSlotWidget.java b/src/main/java/gregtech/api/gui/widgets/BlockableSlotWidget.java
index db4eb4ac043..ed876833814 100644
--- a/src/main/java/gregtech/api/gui/widgets/BlockableSlotWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/BlockableSlotWidget.java
@@ -3,6 +3,7 @@
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.inventory.IInventory;
 import net.minecraftforge.items.IItemHandler;
@@ -17,15 +18,18 @@ public class BlockableSlotWidget extends SlotWidget {
 
     private BooleanSupplier isBlocked = () -> false;
 
-    public BlockableSlotWidget(IInventory inventory, int slotIndex, int xPosition, int yPosition, boolean canTakeItems, boolean canPutItems) {
+    public BlockableSlotWidget(IInventory inventory, int slotIndex, int xPosition, int yPosition, boolean canTakeItems,
+                               boolean canPutItems) {
         super(inventory, slotIndex, xPosition, yPosition, canTakeItems, canPutItems);
     }
 
-    public BlockableSlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition, boolean canTakeItems, boolean canPutItems) {
+    public BlockableSlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition,
+                               boolean canTakeItems, boolean canPutItems) {
         super(itemHandler, slotIndex, xPosition, yPosition, canTakeItems, canPutItems);
     }
 
-    public BlockableSlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition, boolean canTakeItems, boolean canPutItems, boolean canShiftClickInto) {
+    public BlockableSlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition,
+                               boolean canTakeItems, boolean canPutItems, boolean canShiftClickInto) {
         super(itemHandler, slotIndex, xPosition, yPosition, canTakeItems, canPutItems, canShiftClickInto);
     }
 
diff --git a/src/main/java/gregtech/api/gui/widgets/ClickButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/ClickButtonWidget.java
index e3bf4cede24..a834867fd1e 100644
--- a/src/main/java/gregtech/api/gui/widgets/ClickButtonWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ClickButtonWidget.java
@@ -1,6 +1,5 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.base.Preconditions;
 import gregtech.api.gui.GuiTextures;
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.Widget;
@@ -9,11 +8,14 @@
 import gregtech.api.util.LocalizationUtils;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.resources.I18n;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
+
+import com.google.common.base.Preconditions;
 import org.lwjgl.input.Mouse;
 
 import java.util.Arrays;
@@ -33,7 +35,8 @@ public class ClickButtonWidget extends Widget {
     private String tooltipText;
     private Object[] tooltipArgs;
 
-    public ClickButtonWidget(int xPosition, int yPosition, int width, int height, String displayText, Consumer onPressed) {
+    public ClickButtonWidget(int xPosition, int yPosition, int width, int height, String displayText,
+                             Consumer onPressed) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         this.displayText = displayText;
         this.onPressCallback = onPressed;
@@ -84,7 +87,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         Position position = getPosition();
         Size size = getSize();
         if (buttonTexture instanceof SizedTextureArea) {
-            ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(position.x, position.y, size.width, size.height, 0.0, 1.0);
+            ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(position.x, position.y, size.width, size.height,
+                    0.0, 1.0);
         } else {
             buttonTexture.drawSubArea(position.x, position.y, size.width, size.height, 0.0, 0.0, 1.0, 1.0);
         }
diff --git a/src/main/java/gregtech/api/gui/widgets/CraftingStationInputWidgetGroup.java b/src/main/java/gregtech/api/gui/widgets/CraftingStationInputWidgetGroup.java
index a53a3b9b441..0f95c5af62b 100644
--- a/src/main/java/gregtech/api/gui/widgets/CraftingStationInputWidgetGroup.java
+++ b/src/main/java/gregtech/api/gui/widgets/CraftingStationInputWidgetGroup.java
@@ -5,21 +5,25 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.common.metatileentities.storage.CraftingRecipeLogic;
+
 import net.minecraft.network.PacketBuffer;
 import net.minecraftforge.items.ItemStackHandler;
 
 public class CraftingStationInputWidgetGroup extends AbstractWidgetGroup {
+
     protected CraftingRecipeLogic recipeResolver;
     protected short tintLocations;
     public static final int LIGHT_RED = 0x66FF0000;
 
-    public CraftingStationInputWidgetGroup(int x, int y, ItemStackHandler craftingGrid, CraftingRecipeLogic recipeResolver) {
+    public CraftingStationInputWidgetGroup(int x, int y, ItemStackHandler craftingGrid,
+                                           CraftingRecipeLogic recipeResolver) {
         super(new Position(x, y));
 
-        //crafting grid
+        // crafting grid
         for (int i = 0; i < 3; ++i) {
             for (int j = 0; j < 3; ++j) {
-                this.addWidget(new PhantomSlotWidget(craftingGrid, j + i * 3, x + j * 18, y + i * 18).setBackgroundTexture(GuiTextures.SLOT));
+                this.addWidget(new PhantomSlotWidget(craftingGrid, j + i * 3, x + j * 18, y + i * 18)
+                        .setBackgroundTexture(GuiTextures.SLOT));
             }
         }
 
@@ -29,15 +33,17 @@ public CraftingStationInputWidgetGroup(int x, int y, ItemStackHandler craftingGr
     @Override
     public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
         super.drawInBackground(mouseX, mouseY, partialTicks, context);
-        if(this.widgets.size() == 9) { // In case someone added more...
+        if (this.widgets.size() == 9) { // In case someone added more...
             for (int i = 0; i < 9; i++) {
                 Widget widget = widgets.get(i);
-                if (widget instanceof PhantomSlotWidget && ((tintLocations >> i) & 1) == 0) { // In other words, is this slot usable?
+                if (widget instanceof PhantomSlotWidget && ((tintLocations >> i) & 1) == 0) { // In other words, is this
+                                                                                              // slot usable?
                     int color = LIGHT_RED;
 
                     PhantomSlotWidget phantomSlotWidget = (PhantomSlotWidget) widget;
                     drawSolidRect(phantomSlotWidget.getPosition().x + 1, phantomSlotWidget.getPosition().y + 1,
-                            phantomSlotWidget.getSize().getWidth() - 2, phantomSlotWidget.getSize().getWidth() - 2, color);
+                            phantomSlotWidget.getSize().getWidth() - 2, phantomSlotWidget.getSize().getWidth() - 2,
+                            color);
                 }
             }
         }
diff --git a/src/main/java/gregtech/api/gui/widgets/CycleButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/CycleButtonWidget.java
index 2bc7d8a858e..9e4690c8f21 100644
--- a/src/main/java/gregtech/api/gui/widgets/CycleButtonWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/CycleButtonWidget.java
@@ -10,6 +10,7 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.api.util.function.BooleanConsumer;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.resources.I18n;
@@ -36,23 +37,27 @@ public class CycleButtonWidget extends Widget {
     protected int currentOption;
     protected String tooltipHoverString;
 
-    public CycleButtonWidget(int xPosition, int yPosition, int width, int height, String[] optionNames, IntSupplier currentOptionSupplier, IntConsumer setOptionExecutor) {
+    public CycleButtonWidget(int xPosition, int yPosition, int width, int height, String[] optionNames,
+                             IntSupplier currentOptionSupplier, IntConsumer setOptionExecutor) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         this.optionNames = optionNames;
         this.currentOptionSupplier = currentOptionSupplier;
         this.setOptionExecutor = setOptionExecutor;
     }
 
-    public  & IStringSerializable> CycleButtonWidget(int xPosition, int yPosition, int width, int height, Class enumClass, Supplier supplier, Consumer updater) {
+    public  & IStringSerializable> CycleButtonWidget(int xPosition, int yPosition, int width,
+                                                                       int height, Class enumClass,
+                                                                       Supplier supplier, Consumer updater) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         T[] enumConstantPool = enumClass.getEnumConstants();
-        //noinspection RedundantCast
+        // noinspection RedundantCast
         this.optionNames = GTUtility.mapToString(enumConstantPool, it -> ((IStringSerializable) it).getName());
         this.currentOptionSupplier = () -> supplier.get().ordinal();
         this.setOptionExecutor = (newIndex) -> updater.accept(enumConstantPool[newIndex]);
     }
 
-    public CycleButtonWidget(int xPosition, int yPosition, int width, int height, BooleanSupplier supplier, BooleanConsumer updater, String... optionNames) {
+    public CycleButtonWidget(int xPosition, int yPosition, int width, int height, BooleanSupplier supplier,
+                             BooleanConsumer updater, String... optionNames) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         this.optionNames = optionNames;
         this.currentOptionSupplier = () -> supplier.getAsBoolean() ? 1 : 0;
@@ -81,7 +86,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         Position pos = getPosition();
         Size size = getSize();
         if (buttonTexture instanceof SizedTextureArea) {
-            ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height, 0.0, 1.0);
+            ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height, 0.0,
+                    1.0);
         } else {
             buttonTexture.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0, 0.0, 1.0, 1.0);
         }
@@ -122,9 +128,9 @@ public void readUpdateInfo(int id, PacketBuffer buffer) {
     public boolean mouseClicked(int mouseX, int mouseY, int button) {
         super.mouseClicked(mouseX, mouseY, button);
         if (isMouseOverElement(mouseX, mouseY)) {
-            //Allow only the RMB to reverse cycle
+            // Allow only the RMB to reverse cycle
             if (button == RIGHT_MOUSE) {
-                //Wrap from the first option to the last if needed
+                // Wrap from the first option to the last if needed
                 this.currentOption = currentOption == 0 ? optionNames.length - 1 : currentOption - 1;
             } else {
                 this.currentOption = (currentOption + 1) % optionNames.length;
@@ -137,7 +143,6 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
         return false;
     }
 
-
     @Override
     public void handleClientAction(int id, PacketBuffer buffer) {
         super.handleClientAction(id, buffer);
@@ -146,5 +151,4 @@ public void handleClientAction(int id, PacketBuffer buffer) {
             setOptionExecutor.accept(currentOption);
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/DrawableWidget.java b/src/main/java/gregtech/api/gui/widgets/DrawableWidget.java
index 99bdc84b7b0..65f9eeb3aa2 100644
--- a/src/main/java/gregtech/api/gui/widgets/DrawableWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/DrawableWidget.java
@@ -33,23 +33,25 @@ public DrawableWidget setForegroundDrawer(ForegroundDrawer foregroundDrawer) {
 
     @Override
     public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
-        if(backgroundDrawer != null)
+        if (backgroundDrawer != null)
             backgroundDrawer.draw(mouseX, mouseY, partialTicks, context, this);
     }
 
     @Override
     public void drawInForeground(int mouseX, int mouseY) {
-        if(foregroundDrawer != null)
+        if (foregroundDrawer != null)
             foregroundDrawer.draw(mouseX, mouseY, this);
     }
 
     @FunctionalInterface
     public interface BackgroundDrawer {
+
         void draw(int mouseX, int mouseY, float partialTicks, IRenderContext context, Widget widget);
     }
 
     @FunctionalInterface
     public interface ForegroundDrawer {
+
         void draw(int mouseX, int mouseY, Widget widget);
     }
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/DynamicLabelWidget.java b/src/main/java/gregtech/api/gui/widgets/DynamicLabelWidget.java
index 66fc169ba3e..8e5b1b5afdf 100644
--- a/src/main/java/gregtech/api/gui/widgets/DynamicLabelWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/DynamicLabelWidget.java
@@ -3,6 +3,7 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraftforge.fml.relauncher.Side;
@@ -57,5 +58,4 @@ public void drawInForeground(int mouseX, int mouseY) {
             fontRenderer.drawString(split[i], position.x, position.y + (i * (fontRenderer.FONT_HEIGHT + 2)), color);
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/FluidContainerSlotWidget.java b/src/main/java/gregtech/api/gui/widgets/FluidContainerSlotWidget.java
index 252c02cbb45..6097076b1aa 100644
--- a/src/main/java/gregtech/api/gui/widgets/FluidContainerSlotWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/FluidContainerSlotWidget.java
@@ -9,7 +9,8 @@ public class FluidContainerSlotWidget extends SlotWidget {
 
     private final boolean requireFilledContainer;
 
-    public FluidContainerSlotWidget(IItemHandlerModifiable itemHandler, int slotIndex, int xPosition, int yPosition, boolean requireFilledContainer) {
+    public FluidContainerSlotWidget(IItemHandlerModifiable itemHandler, int slotIndex, int xPosition, int yPosition,
+                                    boolean requireFilledContainer) {
         super(itemHandler, slotIndex, xPosition, yPosition, true, true);
         this.requireFilledContainer = requireFilledContainer;
     }
@@ -17,6 +18,7 @@ public FluidContainerSlotWidget(IItemHandlerModifiable itemHandler, int slotInde
     @Override
     public boolean canPutStack(ItemStack stack) {
         IFluidHandlerItem fluidHandlerItem = FluidUtil.getFluidHandler(stack);
-        return fluidHandlerItem != null && (!requireFilledContainer || fluidHandlerItem.getTankProperties()[0].getContents() != null);
+        return fluidHandlerItem != null &&
+                (!requireFilledContainer || fluidHandlerItem.getTankProperties()[0].getContents() != null);
     }
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/GhostCircuitSlotWidget.java b/src/main/java/gregtech/api/gui/widgets/GhostCircuitSlotWidget.java
index 2fe2887d0bd..c2dd6f114a7 100644
--- a/src/main/java/gregtech/api/gui/widgets/GhostCircuitSlotWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/GhostCircuitSlotWidget.java
@@ -4,13 +4,13 @@
 import gregtech.api.recipes.ingredients.IntCircuitIngredient;
 import gregtech.api.util.LocalizationUtils;
 import gregtech.client.utils.TooltipHelper;
+
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
 
 import java.util.Arrays;
 import java.util.List;
 
-
 /**
  * Used for setting a "ghost" IC for a machine
  */
@@ -22,7 +22,8 @@ public class GhostCircuitSlotWidget extends SlotWidget {
 
     private final GhostCircuitItemStackHandler circuitInventory;
 
-    public GhostCircuitSlotWidget(GhostCircuitItemStackHandler circuitInventory, int slotIndex, int xPosition, int yPosition) {
+    public GhostCircuitSlotWidget(GhostCircuitItemStackHandler circuitInventory, int slotIndex, int xPosition,
+                                  int yPosition) {
         super(circuitInventory, slotIndex, xPosition, yPosition, false, false, false);
         this.circuitInventory = circuitInventory;
     }
diff --git a/src/main/java/gregtech/api/gui/widgets/ImageCycleButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/ImageCycleButtonWidget.java
index 2442b76a458..33deaf48b2a 100644
--- a/src/main/java/gregtech/api/gui/widgets/ImageCycleButtonWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ImageCycleButtonWidget.java
@@ -9,6 +9,7 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.api.util.function.BooleanConsumer;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
@@ -35,7 +36,8 @@ public class ImageCycleButtonWidget extends Widget {
     protected boolean shouldUseBaseBackground = false;
     protected boolean singleTexture = false;
 
-    public ImageCycleButtonWidget(int xPosition, int yPosition, int width, int height, TextureArea buttonTexture, int optionCount, IntSupplier currentOptionSupplier, IntConsumer setOptionExecutor) {
+    public ImageCycleButtonWidget(int xPosition, int yPosition, int width, int height, TextureArea buttonTexture,
+                                  int optionCount, IntSupplier currentOptionSupplier, IntConsumer setOptionExecutor) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         this.buttonTexture = buttonTexture;
         this.currentOptionSupplier = currentOptionSupplier;
@@ -44,8 +46,8 @@ public ImageCycleButtonWidget(int xPosition, int yPosition, int width, int heigh
         this.currentOption = currentOptionSupplier.getAsInt();
     }
 
-
-    public ImageCycleButtonWidget(int xPosition, int yPosition, int width, int height, TextureArea buttonTexture, BooleanSupplier supplier, BooleanConsumer updater) {
+    public ImageCycleButtonWidget(int xPosition, int yPosition, int width, int height, TextureArea buttonTexture,
+                                  BooleanSupplier supplier, BooleanConsumer updater) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         this.buttonTexture = buttonTexture;
         this.currentOptionSupplier = () -> supplier.getAsBoolean() ? 1 : 0;
@@ -94,9 +96,11 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
             buttonTexture.draw(pos.x, pos.y, size.width, size.height);
         } else {
             if (buttonTexture instanceof SizedTextureArea) {
-                ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height, (float) currentOption / optionCount, (float) 1 / optionCount);
+                ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height,
+                        (float) currentOption / optionCount, (float) 1 / optionCount);
             } else {
-                buttonTexture.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0, (float) currentOption / optionCount, 1.0, (float) 1 / optionCount);
+                buttonTexture.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0,
+                        (float) currentOption / optionCount, 1.0, (float) 1 / optionCount);
             }
         }
     }
@@ -104,7 +108,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
     @Override
     public void drawInForeground(int mouseX, int mouseY) {
         if (isMouseOverElement(mouseX, mouseY) && tooltipHoverString != null) {
-            List hoverList = Arrays.asList(LocalizationUtils.formatLines(tooltipHoverString.apply(currentOption)));
+            List hoverList = Arrays
+                    .asList(LocalizationUtils.formatLines(tooltipHoverString.apply(currentOption)));
             drawHoveringText(ItemStack.EMPTY, hoverList, 300, mouseX, mouseY);
         }
     }
@@ -131,9 +136,9 @@ public void readUpdateInfo(int id, PacketBuffer buffer) {
     public boolean mouseClicked(int mouseX, int mouseY, int button) {
         super.mouseClicked(mouseX, mouseY, button);
         if (isMouseOverElement(mouseX, mouseY)) {
-            //Allow only the RMB to reverse cycle
+            // Allow only the RMB to reverse cycle
             if (button == RIGHT_MOUSE) {
-                //Wrap from the first option to the last if needed
+                // Wrap from the first option to the last if needed
                 this.currentOption = currentOption == 0 ? optionCount - 1 : currentOption - 1;
             } else {
                 this.currentOption = (currentOption + 1) % optionCount;
@@ -146,7 +151,6 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
         return false;
     }
 
-
     @Override
     public void handleClientAction(int id, PacketBuffer buffer) {
         super.handleClientAction(id, buffer);
diff --git a/src/main/java/gregtech/api/gui/widgets/ImageTextFieldWidget.java b/src/main/java/gregtech/api/gui/widgets/ImageTextFieldWidget.java
index 4c3961b4d0a..674e4573829 100644
--- a/src/main/java/gregtech/api/gui/widgets/ImageTextFieldWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ImageTextFieldWidget.java
@@ -7,28 +7,33 @@
 import java.util.function.Supplier;
 
 public class ImageTextFieldWidget extends TextFieldWidget {
+
     SizedTextureArea textureArea;
 
-    public ImageTextFieldWidget(int xPosition, int yPosition, int width, int height, SizedTextureArea textureArea, Supplier textSupplier, Consumer textResponder) {
+    public ImageTextFieldWidget(int xPosition, int yPosition, int width, int height, SizedTextureArea textureArea,
+                                Supplier textSupplier, Consumer textResponder) {
         super(xPosition, yPosition, width, height, false, textSupplier, textResponder);
         this.textureArea = textureArea;
     }
 
-    public ImageTextFieldWidget(int xPosition, int yPosition, int width, int height, SizedTextureArea textureArea, Supplier textSupplier, Consumer textResponder, int maxStringLength) {
+    public ImageTextFieldWidget(int xPosition, int yPosition, int width, int height, SizedTextureArea textureArea,
+                                Supplier textSupplier, Consumer textResponder, int maxStringLength) {
         super(xPosition, yPosition, width, height, false, textSupplier, textResponder, maxStringLength);
         this.textureArea = textureArea;
     }
 
-    public ImageTextFieldWidget(int xPosition, int yPosition, int width, int height, SizedTextureArea textureArea, Supplier textSupplier, Consumer textResponder, int maxStringLength, int color) {
+    public ImageTextFieldWidget(int xPosition, int yPosition, int width, int height, SizedTextureArea textureArea,
+                                Supplier textSupplier, Consumer textResponder, int maxStringLength,
+                                int color) {
         this(xPosition, yPosition, width, height, textureArea, textSupplier, textResponder, maxStringLength);
-        if(isClientSide())
+        if (isClientSide())
             this.textField.setTextColor(color);
     }
 
-
     @Override
     public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
-        this.textureArea.drawHorizontalCutArea(this.getPosition().x - 2, this.getPosition().y, this.getSize().width, this.getSize().height);
+        this.textureArea.drawHorizontalCutArea(this.getPosition().x - 2, this.getPosition().y, this.getSize().width,
+                this.getSize().height);
         super.drawInBackground(mouseX, mouseY, partialTicks, context);
     }
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/ImageWidget.java b/src/main/java/gregtech/api/gui/widgets/ImageWidget.java
index 7950da9568c..c7d4cea16db 100644
--- a/src/main/java/gregtech/api/gui/widgets/ImageWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ImageWidget.java
@@ -7,6 +7,7 @@
 import gregtech.api.util.LocalizationUtils;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
@@ -116,4 +117,3 @@ public void drawInForeground(int mouseX, int mouseY) {
         }
     }
 }
-
diff --git a/src/main/java/gregtech/api/gui/widgets/IncrementButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/IncrementButtonWidget.java
index 4e7f354c6ff..478fca6ef08 100644
--- a/src/main/java/gregtech/api/gui/widgets/IncrementButtonWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/IncrementButtonWidget.java
@@ -8,6 +8,7 @@
 import gregtech.api.util.LocalizationUtils;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.item.ItemStack;
@@ -34,8 +35,8 @@ public class IncrementButtonWidget extends Widget {
     protected boolean isMouseHovered;
     protected float textScale = 1;
 
-
-    public IncrementButtonWidget(int x, int y, int width, int height, int increment, int incrementShift, int incrementCtrl, int incrementShiftCtrl, IntConsumer updater) {
+    public IncrementButtonWidget(int x, int y, int width, int height, int increment, int incrementShift,
+                                 int incrementCtrl, int incrementShiftCtrl, IntConsumer updater) {
         super(x, y, width, height);
         this.increment = increment;
         this.incrementShift = incrementShift;
@@ -81,7 +82,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         Position position = getPosition();
         Size size = getSize();
         if (buttonTexture instanceof SizedTextureArea) {
-            ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(position.x, position.y, size.width, size.height, 0.0, 1.0);
+            ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(position.x, position.y, size.width, size.height,
+                    0.0, 1.0);
         } else {
             buttonTexture.drawSubArea(position.x, position.y, size.width, size.height, 0.0, 0.0, 1.0, 1.0);
         }
diff --git a/src/main/java/gregtech/api/gui/widgets/IndicatorImageWidget.java b/src/main/java/gregtech/api/gui/widgets/IndicatorImageWidget.java
index 445594b846a..af5f0820c05 100644
--- a/src/main/java/gregtech/api/gui/widgets/IndicatorImageWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/IndicatorImageWidget.java
@@ -6,6 +6,7 @@
 import gregtech.api.gui.resources.TextureArea;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
 import net.minecraft.util.text.ITextComponent;
@@ -36,7 +37,8 @@ public IndicatorImageWidget(int xPosition, int yPosition, int width, int height,
     }
 
     /** Widget displays warning status if the supplied List is nonnull and not empty */
-    public IndicatorImageWidget setWarningStatus(TextureArea texture, Consumer> warningTextSupplier) {
+    public IndicatorImageWidget setWarningStatus(TextureArea texture,
+                                                 Consumer> warningTextSupplier) {
         this.warningTexture = texture;
         this.warningTextSupplier = warningTextSupplier;
         return this;
diff --git a/src/main/java/gregtech/api/gui/widgets/LabelWidget.java b/src/main/java/gregtech/api/gui/widgets/LabelWidget.java
index e5f4bc9070b..d694e936be5 100644
--- a/src/main/java/gregtech/api/gui/widgets/LabelWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/LabelWidget.java
@@ -4,6 +4,7 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.resources.I18n;
@@ -111,5 +112,4 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
             fontRenderer.drawString(resultText, x, y, color, dropShadow);
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/PhantomFluidWidget.java b/src/main/java/gregtech/api/gui/widgets/PhantomFluidWidget.java
index a48160c138c..f7f90bd4767 100644
--- a/src/main/java/gregtech/api/gui/widgets/PhantomFluidWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/PhantomFluidWidget.java
@@ -1,6 +1,5 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.collect.Lists;
 import gregtech.api.gui.GuiTextures;
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.Widget;
@@ -10,7 +9,7 @@
 import gregtech.api.util.*;
 import gregtech.client.utils.RenderUtil;
 import gregtech.client.utils.TooltipHelper;
-import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.renderer.GlStateManager;
@@ -23,7 +22,9 @@
 import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
 import net.minecraftforge.fluids.capability.IFluidHandlerItem;
 
-import javax.annotation.Nonnull;
+import com.google.common.collect.Lists;
+import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import java.awt.*;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -32,6 +33,8 @@
 import java.util.function.Consumer;
 import java.util.function.Supplier;
 
+import javax.annotation.Nonnull;
+
 import static gregtech.api.util.GTUtility.getFluidFromContainer;
 
 public class PhantomFluidWidget extends Widget implements IIngredientSlot, IGhostIngredientTarget {
@@ -46,7 +49,8 @@ public class PhantomFluidWidget extends Widget implements IIngredientSlot, IGhos
     private boolean showTip;
     protected FluidStack lastFluidStack;
 
-    public PhantomFluidWidget(int xPosition, int yPosition, int width, int height, Supplier fluidStackSupplier, Consumer fluidStackUpdater) {
+    public PhantomFluidWidget(int xPosition, int yPosition, int width, int height,
+                              Supplier fluidStackSupplier, Consumer fluidStackUpdater) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         this.fluidStackSupplier = fluidStackSupplier;
         this.fluidStackUpdater = fluidStackUpdater;
@@ -89,6 +93,7 @@ public List> getPhantomTargets(Object ingredient) {
 
         Rectangle rectangle = toRectangleBox();
         return Lists.newArrayList(new Target() {
+
             @Nonnull
             @Override
             public Rectangle getArea() {
@@ -180,7 +185,8 @@ public void handleClientAction(int id, PacketBuffer buffer) {
             ItemStack itemStack = gui.entityPlayer.inventory.getItemStack().copy();
             if (!itemStack.isEmpty()) {
                 itemStack.setCount(1);
-                IFluidHandlerItem fluidHandler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+                IFluidHandlerItem fluidHandler = itemStack
+                        .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
                 if (fluidHandler != null) {
                     FluidStack resultFluid = fluidHandler.drain(Integer.MAX_VALUE, false);
                     fluidStackUpdater.accept(resultFluid);
@@ -271,13 +277,16 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         }
         if (lastFluidStack != null) {
             GlStateManager.disableBlend();
-            RenderUtil.drawFluidForGui(lastFluidStack, lastFluidStack.amount, pos.x + 1, pos.y + 1, size.width - 1, size.height - 1);
+            RenderUtil.drawFluidForGui(lastFluidStack, lastFluidStack.amount, pos.x + 1, pos.y + 1, size.width - 1,
+                    size.height - 1);
             if (showTip) {
                 GlStateManager.pushMatrix();
                 GlStateManager.scale(0.5, 0.5, 1);
                 String s = TextFormattingUtil.formatLongToCompactString(lastFluidStack.amount, 4) + "L";
                 FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
-                fontRenderer.drawStringWithShadow(s, (pos.x + (size.width / 3F)) * 2 - fontRenderer.getStringWidth(s) + 21, (pos.y + (size.height / 3F) + 6) * 2, 0xFFFFFF);
+                fontRenderer.drawStringWithShadow(s,
+                        (pos.x + (size.width / 3F)) * 2 - fontRenderer.getStringWidth(s) + 21,
+                        (pos.y + (size.height / 3F) + 6) * 2, 0xFFFFFF);
                 GlStateManager.popMatrix();
             }
             GlStateManager.enableBlend();
@@ -293,7 +302,8 @@ public void drawInForeground(int mouseX, int mouseY) {
                 hoverStringList.add(fluidName);
                 if (showTip) {
                     hoverStringList.add(lastFluidStack.amount + " L");
-                    Collections.addAll(hoverStringList, LocalizationUtils.formatLines("cover.fluid_filter.config_amount"));
+                    Collections.addAll(hoverStringList,
+                            LocalizationUtils.formatLines("cover.fluid_filter.config_amount"));
                 }
                 drawHoveringText(ItemStack.EMPTY, hoverStringList, -1, mouseX, mouseY);
             }
diff --git a/src/main/java/gregtech/api/gui/widgets/PhantomSlotWidget.java b/src/main/java/gregtech/api/gui/widgets/PhantomSlotWidget.java
index 214b4cc20e7..0490d7310b8 100644
--- a/src/main/java/gregtech/api/gui/widgets/PhantomSlotWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/PhantomSlotWidget.java
@@ -1,22 +1,25 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.collect.Lists;
 import gregtech.api.gui.ingredient.IGhostIngredientTarget;
 import gregtech.client.utils.TooltipHelper;
-import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.inventory.ClickType;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
 import net.minecraftforge.items.IItemHandlerModifiable;
+
+import com.google.common.collect.Lists;
+import mezz.jei.api.gui.IGhostIngredientHandler.Target;
 import org.lwjgl.input.Mouse;
 
-import javax.annotation.Nonnull;
 import java.awt.*;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
 
+import javax.annotation.Nonnull;
+
 public class PhantomSlotWidget extends SlotWidget implements IGhostIngredientTarget {
 
     private boolean clearSlotOnRightClick;
@@ -35,8 +38,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
         if (isMouseOverElement(mouseX, mouseY) && gui != null) {
             if (button == 1 && clearSlotOnRightClick && !slotReference.getStack().isEmpty()) {
                 slotReference.putStack(ItemStack.EMPTY);
-                writeClientAction(2, buf -> {
-                });
+                writeClientAction(2, buf -> {});
             } else {
                 gui.getModularUIGui().superMouseClicked(mouseX, mouseY, button);
             }
@@ -81,6 +83,7 @@ public List> getPhantomTargets(Object ingredient) {
         }
         Rectangle rectangle = toRectangleBox();
         return Lists.newArrayList(new Target() {
+
             @Nonnull
             @Override
             public Rectangle getArea() {
diff --git a/src/main/java/gregtech/api/gui/widgets/PhantomTankWidget.java b/src/main/java/gregtech/api/gui/widgets/PhantomTankWidget.java
index d4a910f3e71..53299b3d133 100644
--- a/src/main/java/gregtech/api/gui/widgets/PhantomTankWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/PhantomTankWidget.java
@@ -1,13 +1,12 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.collect.Lists;
 import gregtech.api.fluids.GTFluid;
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.ingredient.IGhostIngredientTarget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.client.utils.RenderUtil;
-import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.nbt.NBTTagCompound;
@@ -18,8 +17,9 @@
 import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
 import net.minecraftforge.fluids.capability.IFluidHandlerItem;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import com.google.common.collect.Lists;
+import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import java.awt.*;
 import java.io.IOException;
 import java.util.Collections;
@@ -27,6 +27,9 @@
 import java.util.function.Consumer;
 import java.util.function.Supplier;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import static gregtech.api.capability.GregtechDataCodes.*;
 import static gregtech.api.util.GTUtility.getFluidFromContainer;
 
@@ -41,7 +44,8 @@ public class PhantomTankWidget extends TankWidget implements IGhostIngredientTar
     @Nullable
     protected FluidStack lastPhantomStack;
 
-    public PhantomTankWidget(IFluidTank fluidTank, int x, int y, int width, int height, Supplier phantomFluidGetter, Consumer phantomFluidSetter) {
+    public PhantomTankWidget(IFluidTank fluidTank, int x, int y, int width, int height,
+                             Supplier phantomFluidGetter, Consumer phantomFluidSetter) {
         super(fluidTank, x, y, width, height);
         this.phantomFluidGetter = phantomFluidGetter;
         this.phantomFluidSetter = phantomFluidSetter;
@@ -94,7 +98,8 @@ public void handleClientAction(int id, PacketBuffer buf) {
                 phantomFluidSetter.accept(null);
             } else {
                 stack.setCount(1);
-                IFluidHandlerItem fluidHandler = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+                IFluidHandlerItem fluidHandler = stack
+                        .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
                 if (fluidHandler != null) {
                     phantomFluidSetter.accept(fluidHandler.drain(Integer.MAX_VALUE, false));
                 }
@@ -121,8 +126,7 @@ public Object getIngredientOverMouse(int mouseX, int mouseY) {
     @Override
     public boolean mouseClicked(int mouseX, int mouseY, int button) {
         if (isMouseOverElement(mouseX, mouseY)) {
-            writeClientAction(SET_PHANTOM_FLUID, buf -> {
-            });
+            writeClientAction(SET_PHANTOM_FLUID, buf -> {});
             return true;
         }
         return false;
@@ -159,8 +163,7 @@ public void detectAndSendChanges() {
         if (stack == null) {
             if (lastPhantomStack != null) {
                 setLastPhantomStack(null);
-                writeUpdateInfo(REMOVE_PHANTOM_FLUID_TYPE, buf -> {
-                });
+                writeUpdateInfo(REMOVE_PHANTOM_FLUID_TYPE, buf -> {});
             }
         } else if (lastPhantomStack == null || !stack.isFluidEqual(lastPhantomStack)) {
             setLastPhantomStack(stack);
diff --git a/src/main/java/gregtech/api/gui/widgets/ProgressWidget.java b/src/main/java/gregtech/api/gui/widgets/ProgressWidget.java
index ec13e57dc44..b4699c241fd 100644
--- a/src/main/java/gregtech/api/gui/widgets/ProgressWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ProgressWidget.java
@@ -6,6 +6,7 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.common.ConfigHolder;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
@@ -55,34 +56,35 @@ public ProgressWidget(int ticksPerCycle, int x, int y, int width, int height) {
         this(new TimedProgressSupplier(ticksPerCycle, width, false), x, y, width, height);
     }
 
-    public ProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, TextureArea fullImage, MoveType moveType) {
+    public ProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, TextureArea fullImage,
+                          MoveType moveType) {
         super(new Position(x, y), new Size(width, height));
         this.progressSupplier = progressSupplier;
         this.emptyBarArea = fullImage.getSubArea(0.0, 0.0, 1.0, 0.5);
         this.moveType = moveType;
         if (moveType == MoveType.CIRCULAR) {
-            this.filledBarArea = new TextureArea[]{
+            this.filledBarArea = new TextureArea[] {
                     fullImage.getSubArea(0.0, 0.75, 0.5, 0.25), // UP
                     fullImage.getSubArea(0.0, 0.5, 0.5, 0.25), // LEFT
                     fullImage.getSubArea(0.5, 0.5, 0.5, 0.25), // DOWN
                     fullImage.getSubArea(0.5, 0.75, 0.5, 0.25), // RIGHT
             };
         } else {
-            this.filledBarArea = new TextureArea[]{fullImage.getSubArea(0.0, 0.5, 1.0, 0.5)};
+            this.filledBarArea = new TextureArea[] { fullImage.getSubArea(0.0, 0.5, 1.0, 0.5) };
         }
     }
 
-    public ProgressWidget(int ticksPerCycle, int x, int y, int width, int height, TextureArea fullImage, MoveType moveType) {
+    public ProgressWidget(int ticksPerCycle, int x, int y, int width, int height, TextureArea fullImage,
+                          MoveType moveType) {
         this(new TimedProgressSupplier(
                 ticksPerCycle,
                 moveType == MoveType.HORIZONTAL ? width : height,
-                false
-        ), x, y, width, height, fullImage, moveType);
+                false), x, y, width, height, fullImage, moveType);
     }
 
     public ProgressWidget setProgressBar(TextureArea emptyBarArea, TextureArea filledBarArea, MoveType moveType) {
         this.emptyBarArea = emptyBarArea;
-        this.filledBarArea = new TextureArea[]{filledBarArea};
+        this.filledBarArea = new TextureArea[] { filledBarArea };
         this.moveType = moveType;
         return this;
     }
@@ -183,8 +185,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
                         0.0,
                         1.0 - progressScaledDrawnHeight,
                         1.0,
-                        progressScaledDrawnHeight
-                );
+                        progressScaledDrawnHeight);
 
                 // TL, draw RIGHT
                 progressScaled = subAreas[1] * halfWidth;
@@ -198,8 +199,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
                         0.0,
                         0.0,
                         progressScaledDrawnWidth,
-                        1.0
-                );
+                        1.0);
 
                 // TR, draw DOWN
                 progressScaled = subAreas[2] * halfWidth;
@@ -213,8 +213,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
                         0.0,
                         0.0,
                         1.0,
-                        progressScaledDrawnHeight
-                );
+                        progressScaledDrawnHeight);
 
                 // BR, draw LEFT
                 progressScaled = subAreas[3] * halfWidth;
@@ -228,8 +227,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
                         1.0 - progressScaledDrawnWidth,
                         0.0,
                         progressScaledDrawnWidth,
-                        1.0
-                );
+                        1.0);
             } else if (moveType == MoveType.VERTICAL_DOWNWARDS) {
                 double height = size.height * lastProgressValue;
                 if (!smooth) height = (int) height;
diff --git a/src/main/java/gregtech/api/gui/widgets/RecipeProgressWidget.java b/src/main/java/gregtech/api/gui/widgets/RecipeProgressWidget.java
index 485ed4f44be..fea7730043a 100644
--- a/src/main/java/gregtech/api/gui/widgets/RecipeProgressWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/RecipeProgressWidget.java
@@ -8,6 +8,7 @@
 import gregtech.integration.jei.JustEnoughItemsModule;
 import gregtech.integration.jei.recipe.RecipeMapCategory;
 import gregtech.modules.GregTechModules;
+
 import net.minecraft.util.text.TextComponentTranslation;
 
 import java.util.ArrayList;
@@ -19,22 +20,28 @@ public class RecipeProgressWidget extends ProgressWidget {
 
     private final RecipeMap recipeMap;
 
-    public RecipeProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, RecipeMap recipeMap) {
+    public RecipeProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height,
+                                RecipeMap recipeMap) {
         super(progressSupplier, x, y, width, height);
         this.recipeMap = recipeMap;
-        setHoverTextConsumer(list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip")));
+        setHoverTextConsumer(
+                list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip")));
     }
 
-    public RecipeProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, TextureArea fullImage, MoveType moveType, RecipeMap recipeMap) {
+    public RecipeProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height,
+                                TextureArea fullImage, MoveType moveType, RecipeMap recipeMap) {
         super(progressSupplier, x, y, width, height, fullImage, moveType);
         this.recipeMap = recipeMap;
-        setHoverTextConsumer(list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip")));
+        setHoverTextConsumer(
+                list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip")));
     }
 
-    public RecipeProgressWidget(int ticksPerCycle, int x, int y, int width, int height, TextureArea fullImage, MoveType moveType, RecipeMap recipeMap) {
+    public RecipeProgressWidget(int ticksPerCycle, int x, int y, int width, int height, TextureArea fullImage,
+                                MoveType moveType, RecipeMap recipeMap) {
         super(ticksPerCycle, x, y, width, height, fullImage, moveType);
         this.recipeMap = recipeMap;
-        setHoverTextConsumer(list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip")));
+        setHoverTextConsumer(
+                list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip")));
     }
 
     @Override
diff --git a/src/main/java/gregtech/api/gui/widgets/ScrollableListWidget.java b/src/main/java/gregtech/api/gui/widgets/ScrollableListWidget.java
index d4259768923..88aee272e6d 100644
--- a/src/main/java/gregtech/api/gui/widgets/ScrollableListWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ScrollableListWidget.java
@@ -6,9 +6,11 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.client.utils.RenderUtil;
-import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import net.minecraft.util.math.MathHelper;
 
+import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import java.awt.*;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -71,9 +73,9 @@ private void updateElementPositions() {
 
     @Override
     public void drawInForeground(int mouseX, int mouseY) {
-        //make sure mouse is not hovered on any element when outside of bounds,
-        //since foreground rendering is not scissored,
-        //because cut tooltips don't really look nice
+        // make sure mouse is not hovered on any element when outside of bounds,
+        // since foreground rendering is not scissored,
+        // because cut tooltips don't really look nice
         if (!isPositionInsideScissor(mouseX, mouseY)) {
             mouseX = Integer.MAX_VALUE;
             mouseY = Integer.MAX_VALUE;
@@ -83,7 +85,7 @@ public void drawInForeground(int mouseX, int mouseY) {
 
     @Override
     public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
-        //make sure mouse is not hovered on any element when outside of bounds
+        // make sure mouse is not hovered on any element when outside of bounds
         if (!isPositionInsideScissor(mouseX, mouseY)) {
             mouseX = Integer.MAX_VALUE;
             mouseY = Integer.MAX_VALUE;
@@ -102,8 +104,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         int scrollSliderY = Math.round(position.y + (size.height - scrollSliderHeight) * scrollPercent);
         GuiTextures.SLIDER_ICON.draw(scrollX + 1, scrollSliderY + 2, paneSize - 2, scrollSliderHeight);
 
-        RenderUtil.useScissor(position.x, position.y, size.width - paneSize, size.height, () ->
-            super.drawInBackground(finalMouseX, finalMouseY, partialTicks, context));
+        RenderUtil.useScissor(position.x, position.y, size.width - paneSize, size.height,
+                () -> super.drawInBackground(finalMouseX, finalMouseY, partialTicks, context));
     }
 
     @Override
@@ -194,7 +196,7 @@ public Object getIngredientOverMouse(int mouseX, int mouseY) {
 
     @Override
     public List> getPhantomTargets(Object ingredient) {
-        //for phantom targets, show only ones who are fully inside scissor box to avoid visual glitches
+        // for phantom targets, show only ones who are fully inside scissor box to avoid visual glitches
         return super.getPhantomTargets(ingredient).stream()
                 .filter(it -> isBoxInsideScissor(it.getArea()))
                 .collect(Collectors.toList());
diff --git a/src/main/java/gregtech/api/gui/widgets/ServerWidgetGroup.java b/src/main/java/gregtech/api/gui/widgets/ServerWidgetGroup.java
index b16f914f289..3c6c872e8ee 100644
--- a/src/main/java/gregtech/api/gui/widgets/ServerWidgetGroup.java
+++ b/src/main/java/gregtech/api/gui/widgets/ServerWidgetGroup.java
@@ -3,6 +3,7 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.network.PacketBuffer;
 
 import java.util.function.BooleanSupplier;
diff --git a/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java b/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java
index 5603467851e..8ca0e4ae7be 100644
--- a/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java
@@ -4,6 +4,7 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.resources.I18n;
@@ -29,11 +30,13 @@ public class SimpleTextWidget extends Widget {
     protected float scale = 1;
     protected int width;
 
-    public SimpleTextWidget(int xPosition, int yPosition, String formatLocale, int color, Supplier textSupplier) {
+    public SimpleTextWidget(int xPosition, int yPosition, String formatLocale, int color,
+                            Supplier textSupplier) {
         this(xPosition, yPosition, formatLocale, color, textSupplier, false);
     }
 
-    public SimpleTextWidget(int xPosition, int yPosition, String formatLocale, int color, Supplier textSupplier, boolean clientWidget) {
+    public SimpleTextWidget(int xPosition, int yPosition, String formatLocale, int color, Supplier textSupplier,
+                            boolean clientWidget) {
         super(new Position(xPosition, yPosition), Size.ZERO);
         this.color = color;
         this.formatLocale = formatLocale;
@@ -89,7 +92,8 @@ public void updateScreen() {
 
     @Override
     public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
-        String text = formatLocale.isEmpty() ? (I18n.hasKey(lastText) ? I18n.format(lastText) : lastText) : I18n.format(formatLocale, lastText);
+        String text = formatLocale.isEmpty() ? (I18n.hasKey(lastText) ? I18n.format(lastText) : lastText) :
+                I18n.format(formatLocale, lastText);
         List texts;
         if (this.width > 0) {
             texts = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(text, (int) (width * (1 / scale)));
diff --git a/src/main/java/gregtech/api/gui/widgets/SliderWidget.java b/src/main/java/gregtech/api/gui/widgets/SliderWidget.java
index d0af94529c8..73ec60ec40c 100644
--- a/src/main/java/gregtech/api/gui/widgets/SliderWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/SliderWidget.java
@@ -1,6 +1,5 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.base.Preconditions;
 import gregtech.api.gui.GuiTextures;
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.Widget;
@@ -8,19 +7,24 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.api.util.function.FloatConsumer;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.resources.I18n;
 import net.minecraft.network.PacketBuffer;
 import net.minecraft.util.math.MathHelper;
 
+import com.google.common.base.Preconditions;
+
+import java.util.function.BiFunction;
+
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
-import java.util.function.BiFunction;
 
 public class SliderWidget extends Widget {
 
-    public static final BiFunction DEFAULT_TEXT_SUPPLIER = (name, value) -> I18n.format(name, value.intValue());
+    public static final BiFunction DEFAULT_TEXT_SUPPLIER = (name, value) -> I18n.format(name,
+            value.intValue());
 
     private int sliderWidth = 8;
     private TextureArea backgroundArea = GuiTextures.SLIDER_BACKGROUND;
@@ -39,7 +43,8 @@ public class SliderWidget extends Widget {
     private float sliderPosition;
     public boolean isMouseDown;
 
-    public SliderWidget(String name, int xPosition, int yPosition, int width, int height, float min, float max, float currentValue, FloatConsumer responder) {
+    public SliderWidget(String name, int xPosition, int yPosition, int width, int height, float min, float max,
+                        float currentValue, FloatConsumer responder) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         Preconditions.checkNotNull(responder, "responder");
         Preconditions.checkNotNull(name, "name");
@@ -97,7 +102,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         if (displayString == null) {
             this.displayString = getDisplayString();
         }
-        sliderIcon.draw(pos.x + (int) (this.sliderPosition * (float) (size.width - 8)), pos.y, sliderWidth, size.height);
+        sliderIcon.draw(pos.x + (int) (this.sliderPosition * (float) (size.width - 8)), pos.y, sliderWidth,
+                size.height);
         FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
         fontRenderer.drawString(displayString,
                 pos.x + size.width / 2 - fontRenderer.getStringWidth(displayString) / 2,
diff --git a/src/main/java/gregtech/api/gui/widgets/SlotWidget.java b/src/main/java/gregtech/api/gui/widgets/SlotWidget.java
index b77c73fe1d8..1e0e680d8ec 100644
--- a/src/main/java/gregtech/api/gui/widgets/SlotWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/SlotWidget.java
@@ -1,6 +1,5 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.base.Preconditions;
 import gregtech.api.gui.INativeWidget;
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.ISizeProvider;
@@ -10,6 +9,7 @@
 import gregtech.api.util.LocalizationUtils;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.client.renderer.RenderHelper;
@@ -26,11 +26,14 @@
 import net.minecraftforge.items.IItemHandlerModifiable;
 import net.minecraftforge.items.SlotItemHandler;
 
-import javax.annotation.Nonnull;
+import com.google.common.base.Preconditions;
+
 import java.util.Arrays;
 import java.util.List;
 import java.util.function.Consumer;
 
+import javax.annotation.Nonnull;
+
 public class SlotWidget extends Widget implements INativeWidget {
 
     protected final Slot slotReference;
@@ -46,21 +49,24 @@ public class SlotWidget extends Widget implements INativeWidget {
 
     protected Consumer consumer;
 
-    public SlotWidget(IInventory inventory, int slotIndex, int xPosition, int yPosition, boolean canTakeItems, boolean canPutItems) {
+    public SlotWidget(IInventory inventory, int slotIndex, int xPosition, int yPosition, boolean canTakeItems,
+                      boolean canPutItems) {
         super(new Position(xPosition, yPosition), new Size(18, 18));
         this.canTakeItems = canTakeItems;
         this.canPutItems = canPutItems;
         this.slotReference = createSlot(inventory, slotIndex);
     }
 
-    public SlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition, boolean canTakeItems, boolean canPutItems) {
+    public SlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition, boolean canTakeItems,
+                      boolean canPutItems) {
         super(new Position(xPosition, yPosition), new Size(18, 18));
         this.canTakeItems = canTakeItems;
         this.canPutItems = canPutItems;
         this.slotReference = createSlot(itemHandler, slotIndex, true);
     }
 
-    public SlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition, boolean canTakeItems, boolean canPutItems, boolean canShiftClickInto) {
+    public SlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition, boolean canTakeItems,
+                      boolean canPutItems, boolean canShiftClickInto) {
         super(new Position(xPosition, yPosition), new Size(18, 18));
         this.canTakeItems = canTakeItems;
         this.canPutItems = canPutItems;
@@ -102,12 +108,14 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         }
         ItemStack itemStack = slotReference.getStack();
         ModularUIGui modularUIGui = gui == null ? null : gui.getModularUIGui();
-        if (itemStack.isEmpty() && modularUIGui != null && modularUIGui.getDragSplitting() && modularUIGui.getDragSplittingSlots().contains(slotReference)) { // draw split
+        if (itemStack.isEmpty() && modularUIGui != null && modularUIGui.getDragSplitting() &&
+                modularUIGui.getDragSplittingSlots().contains(slotReference)) { // draw split
             int splitSize = modularUIGui.getDragSplittingSlots().size();
             itemStack = gui.entityPlayer.inventory.getItemStack();
             if (!itemStack.isEmpty() && splitSize > 1 && Container.canAddItemToSlot(slotReference, itemStack, true)) {
                 itemStack = itemStack.copy();
-                Container.computeStackSize(modularUIGui.getDragSplittingSlots(), modularUIGui.dragSplittingLimit, itemStack, slotReference.getStack().isEmpty() ? 0 : slotReference.getStack().getCount());
+                Container.computeStackSize(modularUIGui.getDragSplittingSlots(), modularUIGui.dragSplittingLimit,
+                        itemStack, slotReference.getStack().isEmpty() ? 0 : slotReference.getStack().getCount());
                 int k = Math.min(itemStack.getMaxStackSize(), slotReference.getItemStackLimit(itemStack));
                 if (itemStack.getCount() > k) {
                     itemStack.setCount(k);
@@ -125,7 +133,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
             GlStateManager.pushMatrix();
             RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
             itemRender.renderItemAndEffectIntoGUI(itemStack, pos.x + 1, pos.y + 1);
-            itemRender.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, itemStack, pos.x + 1, pos.y + 1, null);
+            itemRender.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, itemStack, pos.x + 1, pos.y + 1,
+                    null);
             GlStateManager.enableAlpha();
             GlStateManager.popMatrix();
             RenderHelper.disableStandardItemLighting();
@@ -275,12 +284,14 @@ public final Slot getHandle() {
     }
 
     public interface ISlotWidget {
+
         void setHover(boolean isHover);
 
         boolean isHover();
     }
 
     protected class WidgetSlot extends Slot implements ISlotWidget {
+
         boolean isHover;
 
         public WidgetSlot(IInventory inventory, int index, int xPosition, int yPosition) {
@@ -333,10 +344,12 @@ public boolean isEnabled() {
     }
 
     public class WidgetSlotItemHandler extends SlotItemHandler implements ISlotWidget {
+
         boolean isHover;
         final boolean canShiftClickInto;
 
-        public WidgetSlotItemHandler(IItemHandler itemHandler, int index, int xPosition, int yPosition, boolean canShiftClickInto) {
+        public WidgetSlotItemHandler(IItemHandler itemHandler, int index, int xPosition, int yPosition,
+                                     boolean canShiftClickInto) {
             super(itemHandler, index, xPosition, yPosition);
             this.canShiftClickInto = canShiftClickInto;
         }
diff --git a/src/main/java/gregtech/api/gui/widgets/SortingButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/SortingButtonWidget.java
index c1b14ea5337..d053c49e7d1 100644
--- a/src/main/java/gregtech/api/gui/widgets/SortingButtonWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/SortingButtonWidget.java
@@ -11,7 +11,8 @@ public class SortingButtonWidget extends ClickButtonWidget {
     private static boolean inventoryTweaksPresent;
     private static KeyBinding sortKeyBinding;
 
-    public SortingButtonWidget(int xPosition, int yPosition, int width, int height, String displayText, Consumer onPressed) {
+    public SortingButtonWidget(int xPosition, int yPosition, int width, int height, String displayText,
+                               Consumer onPressed) {
         super(xPosition, yPosition, width, height, displayText, onPressed);
     }
 
@@ -59,5 +60,4 @@ private static int getInvTweaksSortCode() {
             return 0;
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/SuppliedImageWidget.java b/src/main/java/gregtech/api/gui/widgets/SuppliedImageWidget.java
index 834a519ee20..526f3b113dc 100644
--- a/src/main/java/gregtech/api/gui/widgets/SuppliedImageWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/SuppliedImageWidget.java
@@ -8,7 +8,8 @@ public class SuppliedImageWidget extends ImageWidget {
 
     private final Supplier areaSupplier;
 
-    public SuppliedImageWidget(int xPosition, int yPosition, int width, int height, Supplier areaSupplier) {
+    public SuppliedImageWidget(int xPosition, int yPosition, int width, int height,
+                               Supplier areaSupplier) {
         super(xPosition, yPosition, width, height);
         this.areaSupplier = areaSupplier;
     }
diff --git a/src/main/java/gregtech/api/gui/widgets/SyncableColorRectWidget.java b/src/main/java/gregtech/api/gui/widgets/SyncableColorRectWidget.java
index 98046a5ee41..977b2b0c796 100644
--- a/src/main/java/gregtech/api/gui/widgets/SyncableColorRectWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/SyncableColorRectWidget.java
@@ -4,6 +4,7 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.network.PacketBuffer;
 
 import java.util.function.Supplier;
@@ -57,18 +58,20 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         if (drawCheckerboard) {
             int white = 0xFFFFFFFF;
             int grey = 0xFFBFBFBF;
-            int columnWidth = (size.width - 2*borderWidth) / checkerboardGridColumns;
-            int rowHeight = (size.height - 2*borderWidth) / checkerboardGridRows;
+            int columnWidth = (size.width - 2 * borderWidth) / checkerboardGridColumns;
+            int rowHeight = (size.height - 2 * borderWidth) / checkerboardGridRows;
             boolean whiteGrey = false;
             for (int i = 0; i < checkerboardGridRows; i++) {
                 for (int j = 0; j < checkerboardGridColumns; j++) {
-                    drawSolidRect(position.x + borderWidth + i * columnWidth, position.y + borderWidth + j * rowHeight, columnWidth, rowHeight, whiteGrey ? white : grey);
+                    drawSolidRect(position.x + borderWidth + i * columnWidth, position.y + borderWidth + j * rowHeight,
+                            columnWidth, rowHeight, whiteGrey ? white : grey);
                     whiteGrey = !whiteGrey;
                 }
                 whiteGrey = !whiteGrey;
             }
         }
-        drawSolidRect(position.x + borderWidth, position.y + borderWidth, size.width - 2*borderWidth, size.height - 2*borderWidth, color);
+        drawSolidRect(position.x + borderWidth, position.y + borderWidth, size.width - 2 * borderWidth,
+                size.height - 2 * borderWidth, color);
     }
 
     @Override
diff --git a/src/main/java/gregtech/api/gui/widgets/TabGroup.java b/src/main/java/gregtech/api/gui/widgets/TabGroup.java
index dc1e65e9aa1..6fdc44f9571 100644
--- a/src/main/java/gregtech/api/gui/widgets/TabGroup.java
+++ b/src/main/java/gregtech/api/gui/widgets/TabGroup.java
@@ -11,6 +11,7 @@
 import gregtech.api.gui.widgets.tab.VerticalTabListRenderer.HorizontalLocation;
 import gregtech.api.gui.widgets.tab.VerticalTabListRenderer.VerticalStartCorner;
 import gregtech.api.util.Position;
+
 import net.minecraft.network.PacketBuffer;
 import net.minecraft.util.Tuple;
 
@@ -109,7 +110,8 @@ public List getContainedWidgets(boolean includeHidden) {
     @Override
     public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
         super.drawInBackground(mouseX, mouseY, partialTicks, context);
-        this.tabListRenderer.renderTabs(gui, getPosition(), tabInfos, sizes.getWidth(), sizes.getHeight(), selectedTabIndex);
+        this.tabListRenderer.renderTabs(gui, getPosition(), tabInfos, sizes.getWidth(), sizes.getHeight(),
+                selectedTabIndex);
     }
 
     @Override
@@ -120,7 +122,8 @@ public void drawInForeground(int mouseX, int mouseY) {
             int[] tabSizes = tabOnMouse.getSecond();
             ITabInfo tabInfo = tabOnMouse.getFirst();
             boolean isSelected = tabInfos.get(selectedTabIndex) == tabInfo;
-            tabInfo.renderHoverText(tabSizes[0], tabSizes[1], tabSizes[2], tabSizes[3], sizes.getWidth(), sizes.getHeight(), isSelected, mouseX, mouseY);
+            tabInfo.renderHoverText(tabSizes[0], tabSizes[1], tabSizes[2], tabSizes[3], sizes.getWidth(),
+                    sizes.getHeight(), isSelected, mouseX, mouseY);
         }
     }
 
@@ -193,8 +196,10 @@ public enum TabLocation {
 
         HORIZONTAL_TOP_LEFT(() -> new HorizontalTabListRenderer(HorizontalStartCorner.LEFT, VerticalLocation.TOP)),
         HORIZONTAL_TOP_RIGHT(() -> new HorizontalTabListRenderer(HorizontalStartCorner.RIGHT, VerticalLocation.TOP)),
-        HORIZONTAL_BOTTOM_LEFT(() -> new HorizontalTabListRenderer(HorizontalStartCorner.LEFT, VerticalLocation.BOTTOM)),
-        HORIZONTAL_BOTTOM_RIGHT(() -> new HorizontalTabListRenderer(HorizontalStartCorner.RIGHT, VerticalLocation.BOTTOM)),
+        HORIZONTAL_BOTTOM_LEFT(
+                () -> new HorizontalTabListRenderer(HorizontalStartCorner.LEFT, VerticalLocation.BOTTOM)),
+        HORIZONTAL_BOTTOM_RIGHT(
+                () -> new HorizontalTabListRenderer(HorizontalStartCorner.RIGHT, VerticalLocation.BOTTOM)),
         VERTICAL_LEFT_TOP(() -> new VerticalTabListRenderer(VerticalStartCorner.TOP, HorizontalLocation.LEFT)),
         VERTICAL_LEFT_BOTTOM(() -> new VerticalTabListRenderer(VerticalStartCorner.BOTTOM, HorizontalLocation.LEFT)),
         VERTICAL_RIGHT_TOP(() -> new VerticalTabListRenderer(VerticalStartCorner.TOP, HorizontalLocation.RIGHT)),
@@ -206,5 +211,4 @@ public enum TabLocation {
             this.supplier = supplier;
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/TankWidget.java b/src/main/java/gregtech/api/gui/widgets/TankWidget.java
index b4b1bf64039..2be6bdfeca8 100644
--- a/src/main/java/gregtech/api/gui/widgets/TankWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/TankWidget.java
@@ -9,6 +9,7 @@
 import gregtech.api.util.*;
 import gregtech.client.utils.RenderUtil;
 import gregtech.client.utils.TooltipHelper;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.renderer.GlStateManager;
@@ -28,14 +29,16 @@
 import net.minecraftforge.fluids.capability.IFluidHandlerItem;
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
-import org.jetbrains.annotations.NotNull;
+
 import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
 
-import javax.annotation.Nullable;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.annotation.Nullable;
+
 public class TankWidget extends Widget implements IIngredientSlot {
 
     public final IFluidTank fluidTank;
@@ -63,7 +66,8 @@ public TankWidget(IFluidTank fluidTank, int x, int y, int width, int height) {
 
     public TankWidget setClient() {
         this.isClient = true;
-        this.lastFluidInTank = fluidTank != null ? fluidTank.getFluid() != null ? fluidTank.getFluid().copy() : null : null;
+        this.lastFluidInTank = fluidTank != null ? fluidTank.getFluid() != null ? fluidTank.getFluid().copy() : null :
+                null;
         this.lastTankCapacity = fluidTank != null ? fluidTank.getCapacity() : 0;
         return this;
     }
@@ -100,7 +104,8 @@ public TankWidget setFluidRenderOffset(int fluidRenderOffset) {
 
     public TankWidget setContainerClicking(boolean allowClickContainerFilling, boolean allowClickContainerEmptying) {
         if (!(fluidTank instanceof IFluidHandler))
-            throw new IllegalStateException("Container IO is only supported for fluid tanks that implement IFluidHandler");
+            throw new IllegalStateException(
+                    "Container IO is only supported for fluid tanks that implement IFluidHandler");
         this.allowClickFilling = allowClickContainerFilling;
         this.allowClickEmptying = allowClickContainerEmptying;
         return this;
@@ -149,7 +154,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
                 textureArea.draw(pos.x, pos.y, size.width, size.height);
             }
         }
-        //do not draw fluids if they are handled by JEI - it draws them itself
+        // do not draw fluids if they are handled by JEI - it draws them itself
         if (lastFluidInTank != null && !gui.isJEIHandled) {
             GlStateManager.disableBlend();
             FluidStack stackToDraw = lastFluidInTank;
@@ -170,7 +175,9 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
                 String s = TextFormattingUtil.formatLongToCompactString(lastFluidInTank.amount, 4) + "L";
 
                 FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
-                fontRenderer.drawStringWithShadow(s, (pos.x + (size.width / 3F)) * 2 - fontRenderer.getStringWidth(s) + 21, (pos.y + (size.height / 3F) + 6) * 2, 0xFFFFFF);
+                fontRenderer.drawStringWithShadow(s,
+                        (pos.x + (size.width / 3F)) * 2 - fontRenderer.getStringWidth(s) + 21,
+                        (pos.y + (size.height / 3F) + 6) * 2, 0xFFFFFF);
                 GlStateManager.popMatrix();
             }
             GlStateManager.enableBlend();
@@ -189,7 +196,8 @@ public void drawInForeground(int mouseX, int mouseY) {
                 tooltips.add(fluid.getLocalizedName(lastFluidInTank));
 
                 // Amount Tooltip
-                tooltips.add(LocalizationUtils.format("gregtech.fluid.amount", lastFluidInTank.amount, lastTankCapacity));
+                tooltips.add(
+                        LocalizationUtils.format("gregtech.fluid.amount", lastFluidInTank.amount, lastTankCapacity));
 
                 // Add various tooltips from the material
                 List formula = FluidTooltipUtil.getFluidTooltip(lastFluidInTank);
@@ -207,15 +215,13 @@ public void drawInForeground(int mouseX, int mouseY) {
                 tooltips.add(LocalizationUtils.format("gregtech.fluid.empty"));
                 tooltips.add(LocalizationUtils.format("gregtech.fluid.amount", 0, lastTankCapacity));
             }
-            if(allowClickEmptying && allowClickFilling) {
+            if (allowClickEmptying && allowClickFilling) {
                 tooltips.add(""); // Add an empty line to separate from the bottom material tooltips
                 tooltips.add(LocalizationUtils.format("gregtech.fluid.click_combined"));
-            }
-            else if (allowClickFilling) {
+            } else if (allowClickFilling) {
                 tooltips.add(""); // Add an empty line to separate from the bottom material tooltips
                 tooltips.add(LocalizationUtils.format("gregtech.fluid.click_to_fill"));
-            }
-            else if (allowClickEmptying) {
+            } else if (allowClickEmptying) {
                 tooltips.add(""); // Add an empty line to separate from the bottom material tooltips
                 tooltips.add(LocalizationUtils.format("gregtech.fluid.click_to_empty"));
             }
@@ -253,8 +259,7 @@ public void detectAndSendChanges() {
         }
         if (fluidStack == null && lastFluidInTank != null) {
             this.lastFluidInTank = null;
-            writeUpdateInfo(1, buffer -> {
-            });
+            writeUpdateInfo(1, buffer -> {});
         } else if (fluidStack != null) {
             if (!fluidStack.isFluidEqual(lastFluidInTank)) {
                 this.lastFluidInTank = fluidStack.copy();
@@ -304,7 +309,8 @@ private ItemStack tryClickContainer(boolean tryFillAll) {
 
         ItemStack heldItemSizedOne = currentStack.copy();
         heldItemSizedOne.setCount(1);
-        IFluidHandlerItem fluidHandlerItem = heldItemSizedOne.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+        IFluidHandlerItem fluidHandlerItem = heldItemSizedOne
+                .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
         if (fluidHandlerItem == null) return ItemStack.EMPTY;
 
         FluidStack tankFluid = fluidTank.getFluid();
@@ -369,7 +375,8 @@ private ItemStack fillTankFromStack(@NotNull FluidStack heldFluid, boolean tryFi
         ItemStack itemStackEmptied = ItemStack.EMPTY;
         int fluidAmountTaken = 0;
 
-        IFluidHandlerItem fluidHandler = heldItemSizedOne.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+        IFluidHandlerItem fluidHandler = heldItemSizedOne
+                .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
         if (fluidHandler == null) return ItemStack.EMPTY;
 
         FluidStack drained = fluidHandler.drain(freeSpace, true);
@@ -406,7 +413,8 @@ private ItemStack drainTankFromStack(boolean tryFillAll) {
         currentFluid = currentFluid.copy();
 
         int originalFluidAmount = fluidTank.getFluidAmount();
-        IFluidHandlerItem handler = heldItemSizedOne.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+        IFluidHandlerItem handler = heldItemSizedOne.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY,
+                null);
         if (handler == null) return ItemStack.EMPTY;
         ItemStack filledContainer = fillFluidContainer(currentFluid, heldItemSizedOne);
         if (filledContainer != ItemStack.EMPTY) {
@@ -431,7 +439,8 @@ private ItemStack drainTankFromStack(boolean tryFillAll) {
     }
 
     private ItemStack fillFluidContainer(FluidStack fluidStack, ItemStack itemStack) {
-        IFluidHandlerItem fluidHandlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+        IFluidHandlerItem fluidHandlerItem = itemStack
+                .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
         if (fluidHandlerItem == null) return ItemStack.EMPTY;
         int filledAmount = fluidHandlerItem.fill(fluidStack, true);
         if (filledAmount > 0) {
diff --git a/src/main/java/gregtech/api/gui/widgets/TextFieldWidget.java b/src/main/java/gregtech/api/gui/widgets/TextFieldWidget.java
index c27c83a503d..cfea1c60d28 100644
--- a/src/main/java/gregtech/api/gui/widgets/TextFieldWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/TextFieldWidget.java
@@ -6,6 +6,7 @@
 import gregtech.api.util.MCGuiUtil;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.gui.GuiTextField;
@@ -32,7 +33,8 @@ public class TextFieldWidget extends Widget {
     private boolean enableBackground;
     private boolean isClient;
 
-    public TextFieldWidget(int xPosition, int yPosition, int width, int height, boolean enableBackground, Supplier textSupplier, Consumer textResponder) {
+    public TextFieldWidget(int xPosition, int yPosition, int width, int height, boolean enableBackground,
+                           Supplier textSupplier, Consumer textResponder) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         if (isClientSide()) {
             this.enableBackground = enableBackground;
@@ -40,7 +42,8 @@ public TextFieldWidget(int xPosition, int yPosition, int width, int height, bool
             if (enableBackground) {
                 this.textField = new GuiTextField(0, fontRenderer, xPosition, yPosition, width, height);
             } else {
-                this.textField = new GuiTextField(0, fontRenderer, xPosition + 1, yPosition + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, width - 2, height);
+                this.textField = new GuiTextField(0, fontRenderer, xPosition + 1,
+                        yPosition + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, width - 2, height);
             }
             this.textField.setCanLoseFocus(true);
             this.textField.setEnableBackgroundDrawing(enableBackground);
@@ -51,14 +54,16 @@ public TextFieldWidget(int xPosition, int yPosition, int width, int height, bool
         this.textResponder = textResponder;
     }
 
-    public TextFieldWidget(int xPosition, int yPosition, int width, int height, boolean enableBackground, Supplier textSupplier, Consumer textResponder, int maxStringLength) {
+    public TextFieldWidget(int xPosition, int yPosition, int width, int height, boolean enableBackground,
+                           Supplier textSupplier, Consumer textResponder, int maxStringLength) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         if (isClientSide()) {
             FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
             if (enableBackground) {
                 this.textField = new GuiTextField(0, fontRenderer, xPosition, yPosition, width, height);
             } else {
-                this.textField = new GuiTextField(0, fontRenderer, xPosition + 1, yPosition + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, width - 2, height);
+                this.textField = new GuiTextField(0, fontRenderer, xPosition + 1,
+                        yPosition + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, width - 2, height);
             }
             this.textField.setCanLoseFocus(true);
             this.textField.setEnableBackgroundDrawing(enableBackground);
@@ -70,12 +75,14 @@ public TextFieldWidget(int xPosition, int yPosition, int width, int height, bool
         this.textResponder = textResponder;
     }
 
-    public TextFieldWidget(int xPosition, int yPosition, int width, int height, IGuiTexture background, Supplier textSupplier, Consumer textResponder) {
+    public TextFieldWidget(int xPosition, int yPosition, int width, int height, IGuiTexture background,
+                           Supplier textSupplier, Consumer textResponder) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         if (isClientSide()) {
             this.enableBackground = false;
             FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
-            this.textField = new GuiTextField(0, fontRenderer, xPosition + 1, yPosition + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, width - 2, height);
+            this.textField = new GuiTextField(0, fontRenderer, xPosition + 1,
+                    yPosition + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, width - 2, height);
             this.textField.setCanLoseFocus(true);
             this.textField.setEnableBackgroundDrawing(false);
             this.textField.setMaxStringLength(maxStringLength);
@@ -116,7 +123,6 @@ public String getCurrentString() {
         return this.currentString;
     }
 
-
     @Override
     protected void onPositionUpdate() {
         if (isClientSide() && textField != null) {
@@ -138,7 +144,8 @@ protected void onSizeUpdate() {
             GuiTextField textField = this.textField;
             textField.width = enableBackground ? size.width : size.width - 2;
             textField.height = size.height;
-            textField.y = enableBackground ? position.y : position.y + (getSize().height - fontRenderer.FONT_HEIGHT) / 2 + 1;
+            textField.y = enableBackground ? position.y :
+                    position.y + (getSize().height - fontRenderer.FONT_HEIGHT) / 2 + 1;
 
         }
     }
diff --git a/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java b/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java
index a103f8e0bbb..4a7a57980b0 100644
--- a/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java
+++ b/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java
@@ -2,6 +2,7 @@
 
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.Widget;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.gui.GuiScreen;
@@ -13,14 +14,16 @@
 import net.minecraft.network.PacketBuffer;
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
+
 import org.lwjgl.input.Keyboard;
 
-import javax.annotation.Nullable;
 import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.Supplier;
 import java.util.regex.Pattern;
 
+import javax.annotation.Nullable;
+
 /**
  * @author brachy84
  */
@@ -132,7 +135,9 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         String text = getRenderText();
         if (cursorPos != cursorPos2) {
             // render marked text background
-            float startX = fontRenderer.getStringWidth(text.substring(0, toRenderTextIndex(Math.min(cursorPos, cursorPos2)))) * scale + textX;
+            float startX = fontRenderer
+                    .getStringWidth(text.substring(0, toRenderTextIndex(Math.min(cursorPos, cursorPos2)))) * scale +
+                    textX;
             String marked = getSelectedText();
             float width = fontRenderer.getStringWidth(marked);
             drawSelectionBox(startX * scaleFactor, y, width);
diff --git a/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java
index a342c4e9bee..2da1ba14564 100644
--- a/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java
@@ -1,6 +1,5 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.base.Preconditions;
 import gregtech.api.gui.GuiTextures;
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.Widget;
@@ -10,12 +9,15 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.api.util.function.BooleanConsumer;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
+import com.google.common.base.Preconditions;
+
 import java.util.Arrays;
 import java.util.List;
 import java.util.function.BooleanSupplier;
@@ -32,7 +34,8 @@ public class ToggleButtonWidget extends Widget {
     protected boolean isPressed;
     private boolean shouldUseBaseBackground;
 
-    public ToggleButtonWidget(int xPosition, int yPosition, int width, int height, BooleanSupplier isPressedCondition, BooleanConsumer setPressedExecutor) {
+    public ToggleButtonWidget(int xPosition, int yPosition, int width, int height, BooleanSupplier isPressedCondition,
+                              BooleanConsumer setPressedExecutor) {
         this(xPosition, yPosition, width, height, GuiTextures.VANILLA_BUTTON, isPressedCondition, setPressedExecutor);
     }
 
@@ -76,12 +79,14 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         Position pos = getPosition();
         Size size = getSize();
         if (shouldUseBaseBackground) {
-            GuiTextures.TOGGLE_BUTTON_BACK.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0, isPressed ? 0.5 : 0.0, 1.0, 0.5);
+            GuiTextures.TOGGLE_BUTTON_BACK.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0,
+                    isPressed ? 0.5 : 0.0, 1.0, 0.5);
             GlStateManager.color(1, 1, 1, 1);
             buttonTexture.draw(pos.x, pos.y, size.width, size.height);
         } else {
             if (buttonTexture instanceof SizedTextureArea) {
-                ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height, isPressed ? 0.5 : 0.0, 0.5);
+                ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height,
+                        isPressed ? 0.5 : 0.0, 0.5);
             } else {
                 buttonTexture.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0, isPressed ? 0.5 : 0.0, 1.0, 0.5);
             }
@@ -135,7 +140,6 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
         return false;
     }
 
-
     @Override
     public void handleClientAction(int id, PacketBuffer buffer) {
         super.handleClientAction(id, buffer);
@@ -144,5 +148,4 @@ public void handleClientAction(int id, PacketBuffer buffer) {
             setPressedExecutor.apply(isPressed);
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/WidgetUIAccess.java b/src/main/java/gregtech/api/gui/widgets/WidgetUIAccess.java
index 5c8d907f9bb..a318f1bdefc 100644
--- a/src/main/java/gregtech/api/gui/widgets/WidgetUIAccess.java
+++ b/src/main/java/gregtech/api/gui/widgets/WidgetUIAccess.java
@@ -2,6 +2,7 @@
 
 import gregtech.api.gui.INativeWidget;
 import gregtech.api.gui.Widget;
+
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
 
@@ -57,5 +58,4 @@ public interface WidgetUIAccess {
      * Client will receive payload data in {@link Widget#readUpdateInfo(int, PacketBuffer)}
      */
     void writeUpdateInfo(Widget widget, int id, Consumer payloadWriter);
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/tab/HorizontalTabListRenderer.java b/src/main/java/gregtech/api/gui/widgets/tab/HorizontalTabListRenderer.java
index 83158640701..d4d376caba9 100644
--- a/src/main/java/gregtech/api/gui/widgets/tab/HorizontalTabListRenderer.java
+++ b/src/main/java/gregtech/api/gui/widgets/tab/HorizontalTabListRenderer.java
@@ -3,6 +3,7 @@
 import gregtech.api.gui.ModularUI;
 import gregtech.api.gui.resources.TextureArea;
 import gregtech.api.util.Position;
+
 import net.minecraft.client.renderer.GlStateManager;
 
 import java.util.List;
@@ -18,7 +19,8 @@ public HorizontalTabListRenderer(HorizontalStartCorner startCorner, VerticalLoca
     }
 
     @Override
-    public void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight, int selectedTabIndex) {
+    public void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight,
+                           int selectedTabIndex) {
         boolean startLeft = startCorner == HorizontalStartCorner.LEFT;
         boolean isTopLine = verticalLocation == VerticalLocation.TOP;
         int tabYPosition = isTopLine ? (0 - TAB_HEIGHT + TAB_Y_OFFSET) : (guiHeight - TAB_Y_OFFSET);
@@ -29,12 +31,14 @@ public void renderTabs(ModularUI gui, Position offset, List tabInfos,
             boolean isTabFirst = tabIndex == 0;
             TextureArea tabTexture = getTabTexture(isTabSelected, isTabFirst, isTopLine, startLeft);
             int finalPosX = startLeft ? currentXOffset : (guiWidth - TAB_WIDTH - currentXOffset);
-            tabInfos.get(tabIndex).renderTab(tabTexture, offset.x + finalPosX, offset.y + tabYPosition, TAB_WIDTH, TAB_HEIGHT, isTabSelected);
+            tabInfos.get(tabIndex).renderTab(tabTexture, offset.x + finalPosX, offset.y + tabYPosition, TAB_WIDTH,
+                    TAB_HEIGHT, isTabSelected);
             currentXOffset += (TAB_WIDTH + SPACE_BETWEEN_TABS);
         }
     }
 
-    private static TextureArea getTabTexture(boolean isTabSelected, boolean isTabFirst, boolean isTopLine, boolean startLeft) {
+    private static TextureArea getTabTexture(boolean isTabSelected, boolean isTabFirst, boolean isTopLine,
+                                             boolean startLeft) {
         if (isTopLine) {
             return TopTextures.getTabTexture(isTabFirst, startLeft, isTabSelected);
         } else return BottomTextures.getTabTexture(isTabFirst, startLeft, isTabSelected);
@@ -46,27 +50,35 @@ public int[] getTabPos(int tabIndex, int guiWidth, int guiHeight) {
         boolean isTopLine = verticalLocation == VerticalLocation.TOP;
         int tabYPosition = isTopLine ? (0 - TAB_HEIGHT + TAB_Y_OFFSET) : (guiHeight - TAB_Y_OFFSET);
         int tabXOffset = (TAB_WIDTH + SPACE_BETWEEN_TABS) * tabIndex;
-        return new int[]{startLeft ? tabXOffset : (guiWidth - TAB_WIDTH - tabXOffset), tabYPosition, TAB_WIDTH, TAB_HEIGHT};
+        return new int[] { startLeft ? tabXOffset : (guiWidth - TAB_WIDTH - tabXOffset), tabYPosition, TAB_WIDTH,
+                TAB_HEIGHT };
     }
 
     public enum HorizontalStartCorner {
-        LEFT, RIGHT
+        LEFT,
+        RIGHT
     }
 
     public enum VerticalLocation {
-        TOP, BOTTOM
+        TOP,
+        BOTTOM
     }
 
     private static final class TopTextures {
 
-        private static final TextureArea startTabInactiveTexture = TABS_TOP_TEXTURE.getSubArea(0.0, 0.0, 1.0 / 3.0, 0.5);
+        private static final TextureArea startTabInactiveTexture = TABS_TOP_TEXTURE.getSubArea(0.0, 0.0, 1.0 / 3.0,
+                0.5);
         private static final TextureArea startTabActiveTexture = TABS_TOP_TEXTURE.getSubArea(0.0, 0.5, 1.0 / 3.0, 0.5);
 
-        private static final TextureArea middleTabInactiveTexture = TABS_TOP_TEXTURE.getSubArea(1.0 / 3.0, 0.0, 1.0 / 3.0, 0.5);
-        private static final TextureArea middleTabActiveTexture = TABS_TOP_TEXTURE.getSubArea(1.0 / 3.0, 0.5, 1.0 / 3.0, 0.5);
+        private static final TextureArea middleTabInactiveTexture = TABS_TOP_TEXTURE.getSubArea(1.0 / 3.0, 0.0,
+                1.0 / 3.0, 0.5);
+        private static final TextureArea middleTabActiveTexture = TABS_TOP_TEXTURE.getSubArea(1.0 / 3.0, 0.5, 1.0 / 3.0,
+                0.5);
 
-        private static final TextureArea endTabInactiveTexture = TABS_TOP_TEXTURE.getSubArea(2.0 / 3.0, 0.0, 1.0 / 3.0, 0.5);
-        private static final TextureArea endTabActiveTexture = TABS_TOP_TEXTURE.getSubArea(2.0 / 3.0, 0.5, 1.0 / 3.0, 0.5);
+        private static final TextureArea endTabInactiveTexture = TABS_TOP_TEXTURE.getSubArea(2.0 / 3.0, 0.0, 1.0 / 3.0,
+                0.5);
+        private static final TextureArea endTabActiveTexture = TABS_TOP_TEXTURE.getSubArea(2.0 / 3.0, 0.5, 1.0 / 3.0,
+                0.5);
 
         private static TextureArea getTabTexture(boolean isTabFirst, boolean startLeft, boolean isTabSelected) {
             return isTabFirst ? (startLeft ? (isTabSelected ? startTabActiveTexture : startTabInactiveTexture) :
@@ -77,14 +89,20 @@ private static TextureArea getTabTexture(boolean isTabFirst, boolean startLeft,
 
     private static final class BottomTextures {
 
-        private static final TextureArea startTabInactiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(0.0, 0.5, 1.0 / 3.0, 0.5);
-        private static final TextureArea startTabActiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(0.0, 0.0, 1.0 / 3.0, 0.5);
+        private static final TextureArea startTabInactiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(0.0, 0.5, 1.0 / 3.0,
+                0.5);
+        private static final TextureArea startTabActiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(0.0, 0.0, 1.0 / 3.0,
+                0.5);
 
-        private static final TextureArea middleTabInactiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(1.0 / 3.0, 0.5, 1.0 / 3.0, 0.5);
-        private static final TextureArea middleTabActiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(1.0 / 3.0, 0.0, 1.0 / 3.0, 0.5);
+        private static final TextureArea middleTabInactiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(1.0 / 3.0, 0.5,
+                1.0 / 3.0, 0.5);
+        private static final TextureArea middleTabActiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(1.0 / 3.0, 0.0,
+                1.0 / 3.0, 0.5);
 
-        private static final TextureArea endTabInactiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(2.0 / 3.0, 0.5, 1.0 / 3.0, 0.5);
-        private static final TextureArea endTabActiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(2.0 / 3.0, 0.0, 1.0 / 3.0, 0.5);
+        private static final TextureArea endTabInactiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(2.0 / 3.0, 0.5,
+                1.0 / 3.0, 0.5);
+        private static final TextureArea endTabActiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(2.0 / 3.0, 0.0, 1.0 / 3.0,
+                0.5);
 
         private static TextureArea getTabTexture(boolean isTabFirst, boolean startLeft, boolean isTabSelected) {
             return isTabFirst ? (startLeft ? (isTabSelected ? startTabActiveTexture : startTabInactiveTexture) :
@@ -92,5 +110,4 @@ private static TextureArea getTabTexture(boolean isTabFirst, boolean startLeft,
                     (isTabSelected ? middleTabActiveTexture : middleTabInactiveTexture);
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/tab/IGuiTextureTabInfo.java b/src/main/java/gregtech/api/gui/widgets/tab/IGuiTextureTabInfo.java
index f1d4728e9af..6d1c078e8c0 100644
--- a/src/main/java/gregtech/api/gui/widgets/tab/IGuiTextureTabInfo.java
+++ b/src/main/java/gregtech/api/gui/widgets/tab/IGuiTextureTabInfo.java
@@ -1,13 +1,16 @@
 package gregtech.api.gui.widgets.tab;
 
-import com.google.common.collect.Lists;
 import gregtech.api.gui.resources.IGuiTexture;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.ScaledResolution;
 import net.minecraft.client.resources.I18n;
 import net.minecraftforge.fml.client.config.GuiUtils;
 
+import com.google.common.collect.Lists;
+
 public class IGuiTextureTabInfo implements ITabInfo {
+
     public final IGuiTexture texture;
     public final String nameLocale;
 
@@ -23,10 +26,12 @@ public void renderTab(IGuiTexture tabTexture, int posX, int posY, int xSize, int
     }
 
     @Override
-    public void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight, boolean isSelected, int mouseX, int mouseY) {
+    public void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight,
+                                boolean isSelected, int mouseX, int mouseY) {
         String localizedText = I18n.format(nameLocale);
         Minecraft mc = Minecraft.getMinecraft();
         ScaledResolution resolution = new ScaledResolution(mc);
-        GuiUtils.drawHoveringText(Lists.newArrayList(localizedText), mouseX, mouseY, resolution.getScaledWidth(), resolution.getScaledHeight(), -1, mc.fontRenderer);
+        GuiUtils.drawHoveringText(Lists.newArrayList(localizedText), mouseX, mouseY, resolution.getScaledWidth(),
+                resolution.getScaledHeight(), -1, mc.fontRenderer);
     }
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/tab/ITabInfo.java b/src/main/java/gregtech/api/gui/widgets/tab/ITabInfo.java
index 28fb8daace7..961daad1eb7 100644
--- a/src/main/java/gregtech/api/gui/widgets/tab/ITabInfo.java
+++ b/src/main/java/gregtech/api/gui/widgets/tab/ITabInfo.java
@@ -6,6 +6,6 @@ public interface ITabInfo {
 
     void renderTab(IGuiTexture tabTexture, int posX, int posY, int xSize, int ySize, boolean isSelected);
 
-    void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight, boolean isSelected, int mouseX, int mouseY);
-
+    void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight, boolean isSelected,
+                         int mouseX, int mouseY);
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java b/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java
index e88e88a3e01..b00bf2c363b 100644
--- a/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java
+++ b/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java
@@ -1,7 +1,7 @@
 package gregtech.api.gui.widgets.tab;
 
-import com.google.common.collect.Lists;
 import gregtech.api.gui.resources.IGuiTexture;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.ScaledResolution;
 import net.minecraft.client.renderer.GlStateManager;
@@ -10,6 +10,8 @@
 import net.minecraft.item.ItemStack;
 import net.minecraftforge.fml.client.config.GuiUtils;
 
+import com.google.common.collect.Lists;
+
 public class ItemTabInfo implements ITabInfo {
 
     private final String nameLocale;
@@ -25,13 +27,15 @@ public void renderTab(IGuiTexture tabTexture, int posX, int posY, int xSize, int
         tabTexture.draw(posX, posY, xSize, ySize);
         GlStateManager.enableRescaleNormal();
         RenderHelper.enableGUIStandardItemLighting();
-        Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(iconStack, posX + xSize / 2 - 8, posY + ySize / 2 - 8);
+        Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(iconStack, posX + xSize / 2 - 8,
+                posY + ySize / 2 - 8);
         RenderHelper.disableStandardItemLighting();
         GlStateManager.disableRescaleNormal();
     }
 
     @Override
-    public void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight, boolean isSelected, int mouseX, int mouseY) {
+    public void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight,
+                                boolean isSelected, int mouseX, int mouseY) {
         if (nameLocale != null) {
             String localizedText = I18n.format(nameLocale);
             Minecraft mc = Minecraft.getMinecraft();
diff --git a/src/main/java/gregtech/api/gui/widgets/tab/TabListRenderer.java b/src/main/java/gregtech/api/gui/widgets/tab/TabListRenderer.java
index e512ffddefd..61b44d7ada5 100644
--- a/src/main/java/gregtech/api/gui/widgets/tab/TabListRenderer.java
+++ b/src/main/java/gregtech/api/gui/widgets/tab/TabListRenderer.java
@@ -18,8 +18,8 @@ public abstract class TabListRenderer {
     public static final TextureArea TABS_LEFT_TEXTURE = TextureArea.fullImage("textures/gui/tab/tabs_left.png");
     public static final TextureArea TABS_RIGHT_TEXTURE = TextureArea.fullImage("textures/gui/tab/tabs_right.png");
 
-    public abstract void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight, int selectedTabIndex);
+    public abstract void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth,
+                                    int guiHeight, int selectedTabIndex);
 
     public abstract int[] getTabPos(int tabIndex, int guiWidth, int guiHeight);
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/tab/VerticalTabListRenderer.java b/src/main/java/gregtech/api/gui/widgets/tab/VerticalTabListRenderer.java
index 6285f155ae0..c401ed703c7 100644
--- a/src/main/java/gregtech/api/gui/widgets/tab/VerticalTabListRenderer.java
+++ b/src/main/java/gregtech/api/gui/widgets/tab/VerticalTabListRenderer.java
@@ -3,6 +3,7 @@
 import gregtech.api.gui.ModularUI;
 import gregtech.api.gui.resources.TextureArea;
 import gregtech.api.util.Position;
+
 import net.minecraft.client.renderer.GlStateManager;
 
 import java.util.List;
@@ -18,7 +19,8 @@ public VerticalTabListRenderer(VerticalStartCorner startCorner, HorizontalLocati
     }
 
     @Override
-    public void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight, int selectedTabIndex) {
+    public void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight,
+                           int selectedTabIndex) {
         boolean startTop = startCorner == VerticalStartCorner.TOP;
         boolean isLeftLine = verticalLocation == HorizontalLocation.LEFT;
         int tabXPosition = isLeftLine ? (0 - TAB_HEIGHT + TAB_Y_OFFSET) : (guiWidth - TAB_Y_OFFSET);
@@ -29,14 +31,16 @@ public void renderTabs(ModularUI gui, Position offset, List tabInfos,
             boolean isTabFirst = tabIndex == 0;
             TextureArea tabTexture = getTabTexture(isTabSelected, isTabFirst, isLeftLine, startTop);
             int finalPosY = startTop ? currentYPosition : (guiHeight - TAB_WIDTH - currentYPosition);
-            //noinspection SuspiciousNameCombination
-            tabInfos.get(tabIndex).renderTab(tabTexture, offset.x + tabXPosition, offset.y + finalPosY, TAB_HEIGHT, TAB_WIDTH, isTabSelected);
+            // noinspection SuspiciousNameCombination
+            tabInfos.get(tabIndex).renderTab(tabTexture, offset.x + tabXPosition, offset.y + finalPosY, TAB_HEIGHT,
+                    TAB_WIDTH, isTabSelected);
             currentYPosition += (TAB_WIDTH + SPACE_BETWEEN_TABS);
             GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), 1.0F);
         }
     }
 
-    private static TextureArea getTabTexture(boolean isTabSelected, boolean isTabFirst, boolean isLeftSide, boolean startTop) {
+    private static TextureArea getTabTexture(boolean isTabSelected, boolean isTabFirst, boolean isLeftSide,
+                                             boolean startTop) {
         if (isLeftSide) {
             return LeftTextures.getTabTexture(isTabFirst, startTop, isTabSelected);
         } else return RightTextures.getTabTexture(isTabFirst, startTop, isTabSelected);
@@ -48,27 +52,35 @@ public int[] getTabPos(int tabIndex, int guiWidth, int guiHeight) {
         boolean isLeftLine = verticalLocation == HorizontalLocation.LEFT;
         int tabXPosition = isLeftLine ? (0 - TAB_HEIGHT + TAB_Y_OFFSET) : (guiWidth - TAB_Y_OFFSET);
         int tabYOffset = (TAB_WIDTH + SPACE_BETWEEN_TABS) * tabIndex;
-        return new int[]{tabXPosition, startTop ? tabYOffset : (guiHeight - TAB_WIDTH - tabYOffset), TAB_HEIGHT, TAB_WIDTH};
+        return new int[] { tabXPosition, startTop ? tabYOffset : (guiHeight - TAB_WIDTH - tabYOffset), TAB_HEIGHT,
+                TAB_WIDTH };
     }
 
     public enum VerticalStartCorner {
-        TOP, BOTTOM
+        TOP,
+        BOTTOM
     }
 
     public enum HorizontalLocation {
-        LEFT, RIGHT
+        LEFT,
+        RIGHT
     }
 
     private static final class LeftTextures {
 
-        private static final TextureArea startTabInactiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.0, 0.0, 0.5, 1.0 / 3.0);
+        private static final TextureArea startTabInactiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.0, 0.0, 0.5,
+                1.0 / 3.0);
         private static final TextureArea startTabActiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.5, 0.0, 0.5, 1.0 / 3.0);
 
-        private static final TextureArea middleTabInactiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.0, 1.0 / 3.0, 0.5, 1.0 / 3.0);
-        private static final TextureArea middleTabActiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.5, 1.0 / 3.0, 0.5, 1.0 / 3.0);
+        private static final TextureArea middleTabInactiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.0, 1.0 / 3.0, 0.5,
+                1.0 / 3.0);
+        private static final TextureArea middleTabActiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.5, 1.0 / 3.0, 0.5,
+                1.0 / 3.0);
 
-        private static final TextureArea endTabInactiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.0, 2.0 / 3.0, 0.5, 1.0 / 3.0);
-        private static final TextureArea endTabActiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.5, 2.0 / 3.0, 0.5, 1.0 / 3.0);
+        private static final TextureArea endTabInactiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.0, 2.0 / 3.0, 0.5,
+                1.0 / 3.0);
+        private static final TextureArea endTabActiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.5, 2.0 / 3.0, 0.5,
+                1.0 / 3.0);
 
         private static TextureArea getTabTexture(boolean isTabFirst, boolean startTop, boolean isTabSelected) {
             return isTabFirst ? (startTop ? (isTabSelected ? startTabActiveTexture : startTabInactiveTexture) :
@@ -79,14 +91,20 @@ private static TextureArea getTabTexture(boolean isTabFirst, boolean startTop, b
 
     private static final class RightTextures {
 
-        private static final TextureArea startTabInactiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.5, 0.0, 0.5, 1.0 / 3.0);
-        private static final TextureArea startTabActiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.0, 0.0, 0.5, 1.0 / 3.0);
+        private static final TextureArea startTabInactiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.5, 0.0, 0.5,
+                1.0 / 3.0);
+        private static final TextureArea startTabActiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.0, 0.0, 0.5,
+                1.0 / 3.0);
 
-        private static final TextureArea middleTabInactiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.5, 1.0 / 3.0, 0.5, 1.0 / 3.0);
-        private static final TextureArea middleTabActiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.0, 1.0 / 3.0, 0.5, 1.0 / 3.0);
+        private static final TextureArea middleTabInactiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.5, 1.0 / 3.0, 0.5,
+                1.0 / 3.0);
+        private static final TextureArea middleTabActiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.0, 1.0 / 3.0, 0.5,
+                1.0 / 3.0);
 
-        private static final TextureArea endTabInactiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.5, 2.0 / 3.0, 0.5, 1.0 / 3.0);
-        private static final TextureArea endTabActiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.0, 2.0 / 3.0, 0.5, 1.0 / 3.0);
+        private static final TextureArea endTabInactiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.5, 2.0 / 3.0, 0.5,
+                1.0 / 3.0);
+        private static final TextureArea endTabActiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.0, 2.0 / 3.0, 0.5,
+                1.0 / 3.0);
 
         private static TextureArea getTabTexture(boolean isTabFirst, boolean startTop, boolean isTabSelected) {
             return isTabFirst ? (startTop ? (isTabSelected ? startTabActiveTexture : startTabInactiveTexture) :
@@ -94,5 +112,4 @@ private static TextureArea getTabTexture(boolean isTabFirst, boolean startTop, b
                     (isTabSelected ? middleTabActiveTexture : middleTabInactiveTexture);
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/items/OreDictNames.java b/src/main/java/gregtech/api/items/OreDictNames.java
index 488d5bc2078..b1ddb1c4e10 100644
--- a/src/main/java/gregtech/api/items/OreDictNames.java
+++ b/src/main/java/gregtech/api/items/OreDictNames.java
@@ -1,6 +1,5 @@
 package gregtech.api.items;
 
-
 public enum OreDictNames {
 
     string,
diff --git a/src/main/java/gregtech/api/items/armor/ArmorLogicSuite.java b/src/main/java/gregtech/api/items/armor/ArmorLogicSuite.java
index a761c670b14..1fedb208ce4 100644
--- a/src/main/java/gregtech/api/items/armor/ArmorLogicSuite.java
+++ b/src/main/java/gregtech/api/items/armor/ArmorLogicSuite.java
@@ -1,11 +1,11 @@
 package gregtech.api.items.armor;
 
-
 import gregtech.api.capability.GregtechCapabilities;
 import gregtech.api.capability.IElectricItem;
 import gregtech.api.items.armor.ArmorMetaItem.ArmorMetaValueItem;
 import gregtech.api.items.metaitem.ElectricStats;
 import gregtech.api.items.metaitem.stats.IItemHUDProvider;
+
 import net.minecraft.client.resources.I18n;
 import net.minecraft.entity.Entity;
 import net.minecraft.entity.EntityLivingBase;
@@ -18,9 +18,10 @@
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
-import javax.annotation.Nonnull;
 import java.util.List;
 
+import javax.annotation.Nonnull;
+
 public abstract class ArmorLogicSuite implements ISpecialArmorLogic, IItemHUDProvider {
 
     protected final int energyPerUse;
@@ -39,9 +40,10 @@ protected ArmorLogicSuite(int energyPerUse, long maxCapacity, int tier, EntityEq
     public abstract void onArmorTick(World world, EntityPlayer player, ItemStack itemStack);
 
     @Override
-    public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) {
+    public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source,
+                                         double damage, EntityEquipmentSlot equipmentSlot) {
         IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
-        if(item == null) {
+        if (item == null) {
             return new ArmorProperties(0, 0.0, 0);
         }
         int damageLimit = Integer.MAX_VALUE;
@@ -64,6 +66,7 @@ public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
     @Override
     public void addToolComponents(ArmorMetaValueItem mvi) {
         mvi.addComponents(new ElectricStats(maxCapacity, tier, true, false) {
+
             @Override
             public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
                 return onRightClick(world, player, hand);
@@ -85,7 +88,8 @@ public void addInfo(ItemStack itemStack, List lines) {
     public ActionResult onRightClick(World world, EntityPlayer player, EnumHand hand) {
         if (player.getHeldItem(hand).getItem() instanceof ArmorMetaItem) {
             ItemStack armor = player.getHeldItem(hand);
-            if (armor.getItem() instanceof ArmorMetaItem && player.inventory.armorInventory.get(SLOT.getIndex()).isEmpty() && !player.isSneaking()) {
+            if (armor.getItem() instanceof ArmorMetaItem &&
+                    player.inventory.armorInventory.get(SLOT.getIndex()).isEmpty() && !player.isSneaking()) {
                 player.inventory.armorInventory.set(SLOT.getIndex(), armor.copy());
                 player.setHeldItem(hand, ItemStack.EMPTY);
                 player.playSound(new SoundEvent(new ResourceLocation("item.armor.equip_generic")), 1.0F, 1.0F);
diff --git a/src/main/java/gregtech/api/items/armor/ArmorMetaItem.java b/src/main/java/gregtech/api/items/armor/ArmorMetaItem.java
index d7dd9225644..223fb0a7425 100644
--- a/src/main/java/gregtech/api/items/armor/ArmorMetaItem.java
+++ b/src/main/java/gregtech/api/items/armor/ArmorMetaItem.java
@@ -1,11 +1,10 @@
 package gregtech.api.items.armor;
 
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Multimap;
 import gregtech.api.GregTechAPI;
 import gregtech.api.items.metaitem.MetaItem;
 import gregtech.api.items.metaitem.stats.IEnchantabilityHelper;
 import gregtech.api.items.metaitem.stats.IItemComponent;
+
 import net.minecraft.client.gui.ScaledResolution;
 import net.minecraft.client.model.ModelBiped;
 import net.minecraft.enchantment.Enchantment;
@@ -24,10 +23,14 @@
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Multimap;
+
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-public class ArmorMetaItem.ArmorMetaValueItem> extends MetaItem implements IArmorItem, ISpecialArmor, IEnchantabilityHelper {
+public class ArmorMetaItem.ArmorMetaValueItem> extends MetaItem
+                          implements IArmorItem, ISpecialArmor, IEnchantabilityHelper {
 
     public ArmorMetaItem() {
         super((short) 0);
@@ -48,7 +51,8 @@ private IArmorLogic getArmorLogic(ItemStack itemStack) {
 
     @Nonnull
     @Override
-    public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack) {
+    public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot,
+                                                                     @Nonnull ItemStack stack) {
         Multimap multimap = super.getAttributeModifiers(slot, stack);
         IArmorLogic armorLogic = getArmorLogic(stack);
         multimap.putAll(armorLogic.getAttributeModifiers(slot, stack));
@@ -56,7 +60,8 @@ public Multimap getAttributeModifiers(@Nonnull Entity
     }
 
     @Override
-    public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) {
+    public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source,
+                                         double damage, int slot) {
         IArmorLogic armorLogic = getArmorLogic(armor);
         if (armorLogic instanceof ISpecialArmorLogic) {
             return ((ISpecialArmorLogic) armorLogic).getProperties(player, armor, source, damage, getSlotByIndex(slot));
@@ -74,16 +79,19 @@ public int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int sl
     }
 
     @Override
-    public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack stack, DamageSource source, int damage, int slot) {
+    public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack stack, DamageSource source, int damage,
+                            int slot) {
         IArmorLogic armorLogic = getArmorLogic(stack);
         armorLogic.damageArmor(entity, stack, source, damage, getSlotByIndex(slot));
     }
 
     @Override
-    public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) {
+    public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source,
+                                           double damage, int slot) {
         IArmorLogic armorLogic = getArmorLogic(armor);
         if (armorLogic instanceof ISpecialArmorLogic) {
-            return ((ISpecialArmorLogic) armorLogic).handleUnblockableDamage(entity, armor, source, damage, getSlotByIndex(slot));
+            return ((ISpecialArmorLogic) armorLogic).handleUnblockableDamage(entity, armor, source, damage,
+                    getSlotByIndex(slot));
         }
         return false;
     }
@@ -95,7 +103,8 @@ public void onArmorTick(@Nonnull World world, @Nonnull EntityPlayer player, @Non
     }
 
     @Override
-    public boolean isValidArmor(@Nonnull ItemStack stack, @Nonnull EntityEquipmentSlot armorType, @Nonnull Entity entity) {
+    public boolean isValidArmor(@Nonnull ItemStack stack, @Nonnull EntityEquipmentSlot armorType,
+                                @Nonnull Entity entity) {
         IArmorLogic armorLogic = getArmorLogic(stack);
         return super.isValidArmor(stack, armorType, entity) &&
                 armorLogic.isValidArmor(stack, entity, armorType);
@@ -110,7 +119,8 @@ public EntityEquipmentSlot getEquipmentSlot(@Nonnull ItemStack stack) {
 
     @Nullable
     @Override
-    public String getArmorTexture(@Nonnull ItemStack stack, @Nonnull Entity entity, @Nonnull EntityEquipmentSlot slot, @Nonnull String type) {
+    public String getArmorTexture(@Nonnull ItemStack stack, @Nonnull Entity entity, @Nonnull EntityEquipmentSlot slot,
+                                  @Nonnull String type) {
         IArmorLogic armorLogic = getArmorLogic(stack);
         return armorLogic.getArmorTexture(stack, entity, slot, type);
     }
@@ -118,7 +128,8 @@ public String getArmorTexture(@Nonnull ItemStack stack, @Nonnull Entity entity,
     @Nullable
     @Override
     @SideOnly(Side.CLIENT)
-    public ModelBiped getArmorModel(@Nonnull EntityLivingBase entityLiving, @Nonnull ItemStack itemStack, @Nonnull EntityEquipmentSlot armorSlot, @Nonnull ModelBiped _default) {
+    public ModelBiped getArmorModel(@Nonnull EntityLivingBase entityLiving, @Nonnull ItemStack itemStack,
+                                    @Nonnull EntityEquipmentSlot armorSlot, @Nonnull ModelBiped _default) {
         IArmorLogic armorLogic = getArmorLogic(itemStack);
         return armorLogic.getArmorModel(entityLiving, itemStack, armorSlot, _default);
     }
@@ -136,7 +147,8 @@ public int getArmorLayerColor(ItemStack itemStack, int layerIndex) {
     }
 
     @Override
-    public void renderHelmetOverlay(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull ScaledResolution resolution, float partialTicks) {
+    public void renderHelmetOverlay(@Nonnull ItemStack stack, @Nonnull EntityPlayer player,
+                                    @Nonnull ScaledResolution resolution, float partialTicks) {
         IArmorLogic armorLogic = getArmorLogic(stack);
         armorLogic.renderHelmetOverlay(stack, player, resolution, partialTicks);
     }
@@ -175,7 +187,6 @@ public ArmorMetaValueItem setArmorLogic(IArmorLogic armorLogic) {
             return this;
         }
 
-
         @Override
         public ArmorMetaValueItem addComponents(IItemComponent... stats) {
             super.addComponents(stats);
@@ -228,5 +239,4 @@ public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack, @Nonnull Ench
                 return enchantment.isAllowedOnBooks();
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/items/armor/ArmorUtils.java b/src/main/java/gregtech/api/items/armor/ArmorUtils.java
index 4ef4bfa1e9f..12794ed3d02 100644
--- a/src/main/java/gregtech/api/items/armor/ArmorUtils.java
+++ b/src/main/java/gregtech/api/items/armor/ArmorUtils.java
@@ -1,12 +1,10 @@
 package gregtech.api.items.armor;
 
-
 import gregtech.api.capability.GregtechCapabilities;
 import gregtech.api.capability.IElectricItem;
 import gregtech.api.util.ItemStackHashStrategy;
 import gregtech.common.ConfigHolder;
-import it.unimi.dsi.fastutil.objects.Object2IntMap;
-import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.ScaledResolution;
 import net.minecraft.entity.player.EntityPlayer;
@@ -22,14 +20,18 @@
 import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
+
+import it.unimi.dsi.fastutil.objects.Object2IntMap;
+import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap;
 import org.apache.commons.lang3.tuple.Pair;
 
-import javax.annotation.Nonnull;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import javax.annotation.Nonnull;
+
 public class ArmorUtils {
 
     public static final Side SIDE = FMLCommonHandler.instance().getSide();
@@ -41,7 +43,8 @@ public class ArmorUtils {
     public static boolean isPossibleToCharge(ItemStack chargeable) {
         IElectricItem container = chargeable.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
         if (container != null) {
-            return container.getCharge() < container.getMaxCharge() && (container.getCharge() + container.getTransferLimit()) <= container.getMaxCharge();
+            return container.getCharge() < container.getMaxCharge() &&
+                    (container.getCharge() + container.getTransferLimit()) <= container.getMaxCharge();
         }
         return false;
     }
@@ -66,35 +69,34 @@ public static List, List>> getChargeableIte
             }
         }
 
-        if(!openMainSlots.isEmpty()) {
+        if (!openMainSlots.isEmpty()) {
             inventorySlotMap.add(Pair.of(player.inventory.mainInventory, openMainSlots));
         }
 
-
         List openArmorSlots = new ArrayList<>();
-        for(int i = 0; i < player.inventory.armorInventory.size(); i++) {
+        for (int i = 0; i < player.inventory.armorInventory.size(); i++) {
             ItemStack current = player.inventory.armorInventory.get(i);
             IElectricItem item = current.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
-            if(item == null) {
+            if (item == null) {
                 continue;
             }
 
-            if(isPossibleToCharge(current) && item.getTier() <= tier) {
+            if (isPossibleToCharge(current) && item.getTier() <= tier) {
                 openArmorSlots.add(i);
             }
         }
 
-        if(!openArmorSlots.isEmpty()) {
+        if (!openArmorSlots.isEmpty()) {
             inventorySlotMap.add(Pair.of(player.inventory.armorInventory, openArmorSlots));
         }
 
         ItemStack offHand = player.inventory.offHandInventory.get(0);
         IElectricItem offHandItem = offHand.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
-        if(offHandItem == null) {
+        if (offHandItem == null) {
             return inventorySlotMap;
         }
 
-        if(isPossibleToCharge(offHand) && offHandItem.getTier() <= tier) {
+        if (isPossibleToCharge(offHand) && offHandItem.getTier() <= tier) {
             inventorySlotMap.add(Pair.of(player.inventory.offHandInventory, Collections.singletonList(0)));
         }
 
@@ -107,7 +109,8 @@ public static List, List>> getChargeableIte
     public static void spawnParticle(World world, EntityPlayer player, EnumParticleTypes type, double speedY) {
         if (type != null && SIDE.isClient()) {
             Vec3d forward = player.getForward();
-            world.spawnParticle(type, player.posX - forward.x, player.posY + 0.5D, player.posZ - forward.z, 0.0D, speedY, 0.0D);
+            world.spawnParticle(type, player.posX - forward.x, player.posY + 0.5D, player.posZ - forward.z, 0.0D,
+                    speedY, 0.0D);
         }
     }
 
@@ -134,7 +137,8 @@ public static void playJetpackSound(@Nonnull EntityPlayer player) {
     @SuppressWarnings("deprecation")
     public static void resetPlayerFloatingTime(EntityPlayer player) {
         if (player instanceof EntityPlayerMP) {
-            ObfuscationReflectionHelper.setPrivateValue(NetHandlerPlayServer.class, ((EntityPlayerMP) player).connection, 0, "field_147365_f", "floatingTickCount");
+            ObfuscationReflectionHelper.setPrivateValue(NetHandlerPlayServer.class,
+                    ((EntityPlayerMP) player).connection, 0, "field_147365_f", "floatingTickCount");
         }
     }
 
@@ -151,7 +155,7 @@ public static ActionResult canEat(EntityPlayer player, ItemStack food
 
         ItemFood foodItem = (ItemFood) food.getItem();
         if (player.getFoodStats().needFood()) {
-            if(!player.isCreative()) {
+            if (!player.isCreative()) {
                 food.setCount(food.getCount() - 1);
             }
 
@@ -164,8 +168,10 @@ public static ActionResult canEat(EntityPlayer player, ItemStack food
             // Increase the saturation of the food if the food replenishes more than the amount of missing haunches
             saturation += (hunger - foodItem.getHealAmount(food)) < 0 ? foodItem.getHealAmount(food) - hunger : 1.0F;
 
-            // Use this method to add stats for compat with TFC, who overrides addStats(int amount, float saturation) for their food and does nothing
-            player.getFoodStats().addStats(new ItemFood(foodItem.getHealAmount(food), saturation, foodItem.isWolfsFavoriteMeat()), food);
+            // Use this method to add stats for compat with TFC, who overrides addStats(int amount, float saturation)
+            // for their food and does nothing
+            player.getFoodStats().addStats(
+                    new ItemFood(foodItem.getHealAmount(food), saturation, foodItem.isWolfsFavoriteMeat()), food);
 
             return new ActionResult<>(EnumActionResult.SUCCESS, food);
         } else {
@@ -180,7 +186,8 @@ public static ActionResult canEat(EntityPlayer player, ItemStack food
      * @return Formated list
      */
     public static List format(List input) {
-        Object2IntMap items = new Object2IntOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount());
+        Object2IntMap items = new Object2IntOpenCustomHashMap<>(
+                ItemStackHashStrategy.comparingAllButCount());
         List output = new ArrayList<>();
         for (ItemStack itemStack : input) {
             if (items.containsKey(itemStack)) {
@@ -198,7 +205,6 @@ public static List format(List input) {
         return output;
     }
 
-
     @Nonnull
     public static String format(long value) {
         return new DecimalFormat("###,###.##").format(value);
@@ -215,6 +221,7 @@ public static String format(double value) {
      */
     @SideOnly(Side.CLIENT)
     public static class ModularHUD {
+
         private byte stringAmount = 0;
         private final List stringList;
         private static final Minecraft mc = Minecraft.getMinecraft();
@@ -231,7 +238,8 @@ public void newString(String string) {
         public void draw() {
             for (int i = 0; i < stringAmount; i++) {
                 Pair coords = this.getStringCoord(i);
-                mc.ingameGUI.drawString(mc.fontRenderer, stringList.get(i), coords.getLeft(), coords.getRight(), 0xFFFFFF);
+                mc.ingameGUI.drawString(mc.fontRenderer, stringList.get(i), coords.getLeft(), coords.getRight(),
+                        0xFFFFFF);
             }
         }
 
@@ -265,6 +273,5 @@ public void reset() {
             this.stringAmount = 0;
             this.stringList.clear();
         }
-
     }
 }
diff --git a/src/main/java/gregtech/api/items/armor/DummyArmorLogic.java b/src/main/java/gregtech/api/items/armor/DummyArmorLogic.java
index 37f3204e94a..91c18351856 100644
--- a/src/main/java/gregtech/api/items/armor/DummyArmorLogic.java
+++ b/src/main/java/gregtech/api/items/armor/DummyArmorLogic.java
@@ -5,6 +5,7 @@
 import net.minecraft.item.ItemStack;
 
 class DummyArmorLogic implements IArmorLogic {
+
     @Override
     public EntityEquipmentSlot getEquipmentSlot(ItemStack itemStack) {
         return EntityEquipmentSlot.HEAD;
diff --git a/src/main/java/gregtech/api/items/armor/IArmorItem.java b/src/main/java/gregtech/api/items/armor/IArmorItem.java
index afde8b798d9..41fb9b4eaf5 100644
--- a/src/main/java/gregtech/api/items/armor/IArmorItem.java
+++ b/src/main/java/gregtech/api/items/armor/IArmorItem.java
@@ -1,18 +1,18 @@
-package gregtech.api.items.armor;
-
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.DamageSource;
-
-public interface IArmorItem {
-
-    default int getArmorLayersAmount(ItemStack itemStack) {
-        return 1;
-    }
-
-    default int getArmorLayerColor(ItemStack itemStack, int layerIndex) {
-        return 0xFFFFFF;
-    }
-
-    void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage, int slot);
-}
+package gregtech.api.items.armor;
+
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
+
+public interface IArmorItem {
+
+    default int getArmorLayersAmount(ItemStack itemStack) {
+        return 1;
+    }
+
+    default int getArmorLayerColor(ItemStack itemStack, int layerIndex) {
+        return 0xFFFFFF;
+    }
+
+    void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage, int slot);
+}
diff --git a/src/main/java/gregtech/api/items/armor/IArmorLogic.java b/src/main/java/gregtech/api/items/armor/IArmorLogic.java
index 590d54234fb..66ad1627bab 100644
--- a/src/main/java/gregtech/api/items/armor/IArmorLogic.java
+++ b/src/main/java/gregtech/api/items/armor/IArmorLogic.java
@@ -1,8 +1,7 @@
 package gregtech.api.items.armor;
 
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.Multimap;
 import gregtech.api.items.armor.ArmorMetaItem.ArmorMetaValueItem;
+
 import net.minecraft.client.gui.ScaledResolution;
 import net.minecraft.client.model.ModelBiped;
 import net.minecraft.entity.Entity;
@@ -16,9 +15,13 @@
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
-import javax.annotation.Nullable;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.Multimap;
+
 import java.util.UUID;
 
+import javax.annotation.Nullable;
+
 /**
  * Defines abstract armor logic that can be added to ArmorMetaItem to control it
  * It can implement {@link net.minecraftforge.common.ISpecialArmor} for extended damage calculations
@@ -29,8 +32,7 @@ public interface IArmorLogic {
     UUID ATTACK_DAMAGE_MODIFIER = UUID.fromString("CB3F55D3-645C-4F38-A144-9C13A33DB5CF");
     UUID ATTACK_SPEED_MODIFIER = UUID.fromString("FA233E1C-4180-4288-B05C-BCCE9785ACA3");
 
-    default void addToolComponents(ArmorMetaValueItem metaValueItem) {
-    }
+    default void addToolComponents(ArmorMetaValueItem metaValueItem) {}
 
     EntityEquipmentSlot getEquipmentSlot(ItemStack itemStack);
 
@@ -38,9 +40,8 @@ default boolean canBreakWithDamage(ItemStack stack) {
         return false;
     }
 
-    default void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage, EntityEquipmentSlot equipmentSlot) {
-
-    }
+    default void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage,
+                             EntityEquipmentSlot equipmentSlot) {}
 
     default Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
         return ImmutableMultimap.of();
@@ -50,12 +51,11 @@ default boolean isValidArmor(ItemStack itemStack, Entity entity, EntityEquipment
         return getEquipmentSlot(itemStack) == equipmentSlot;
     }
 
-    default void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
-    }
+    default void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {}
 
     @SideOnly(Side.CLIENT)
-    default void renderHelmetOverlay(ItemStack itemStack, EntityPlayer player, ScaledResolution resolution, float partialTicks) {
-    }
+    default void renderHelmetOverlay(ItemStack itemStack, EntityPlayer player, ScaledResolution resolution,
+                                     float partialTicks) {}
 
     default int getArmorLayersAmount(ItemStack itemStack) {
         return 1;
@@ -68,7 +68,8 @@ default int getArmorLayerColor(ItemStack itemStack, int layerIndex) {
     String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type);
 
     @Nullable
-    default ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped defaultModel) {
+    default ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot,
+                                     ModelBiped defaultModel) {
         return null;
     }
 
diff --git a/src/main/java/gregtech/api/items/armor/ISpecialArmorLogic.java b/src/main/java/gregtech/api/items/armor/ISpecialArmorLogic.java
index 35734b1d7b3..acab02f1da0 100644
--- a/src/main/java/gregtech/api/items/armor/ISpecialArmorLogic.java
+++ b/src/main/java/gregtech/api/items/armor/ISpecialArmorLogic.java
@@ -23,7 +23,8 @@ public interface ISpecialArmorLogic extends IArmorLogic {
      * same priority, damage will be distributed between them based on there
      * absorption ratio.
      */
-    ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot);
+    ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage,
+                                  EntityEquipmentSlot equipmentSlot);
 
     /**
      * Get the displayed effective armor.
@@ -40,7 +41,8 @@ public interface ISpecialArmorLogic extends IArmorLogic {
      * Returning true here means that the armor is able to meaningfully respond
      * to this damage source. Otherwise, no interaction is allowed.
      */
-    default boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) {
+    default boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source,
+                                            double damage, EntityEquipmentSlot equipmentSlot) {
         return false;
     }
 }
diff --git a/src/main/java/gregtech/api/items/behavior/CoverItemBehavior.java b/src/main/java/gregtech/api/items/behavior/CoverItemBehavior.java
index 56901483847..5feda5eac58 100644
--- a/src/main/java/gregtech/api/items/behavior/CoverItemBehavior.java
+++ b/src/main/java/gregtech/api/items/behavior/CoverItemBehavior.java
@@ -7,6 +7,7 @@
 import gregtech.api.cover.CoverRayTracer;
 import gregtech.api.items.metaitem.stats.IItemBehaviour;
 import gregtech.core.advancement.AdvancementTriggers;
+
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.item.ItemStack;
@@ -16,6 +17,7 @@
 import net.minecraft.util.EnumHand;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.world.World;
+
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -33,7 +35,8 @@ public CoverItemBehavior(@NotNull CoverDefinition definition) {
     }
 
     @Override
-    public EnumActionResult onItemUseFirst(EntityPlayer player, @NotNull World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
+    public EnumActionResult onItemUseFirst(EntityPlayer player, @NotNull World world, BlockPos pos, EnumFacing side,
+                                           float hitX, float hitY, float hitZ, EnumHand hand) {
         TileEntity tileEntity = world.getTileEntity(pos);
         if (tileEntity == null) return EnumActionResult.PASS;
 
diff --git a/src/main/java/gregtech/api/items/behavior/MonitorPluginBaseBehavior.java b/src/main/java/gregtech/api/items/behavior/MonitorPluginBaseBehavior.java
index 6700269dc35..3e4183e8d6f 100644
--- a/src/main/java/gregtech/api/items/behavior/MonitorPluginBaseBehavior.java
+++ b/src/main/java/gregtech/api/items/behavior/MonitorPluginBaseBehavior.java
@@ -9,11 +9,11 @@
 import gregtech.api.items.gui.PlayerInventoryHolder;
 import gregtech.api.items.metaitem.MetaItem;
 import gregtech.api.items.metaitem.stats.IItemBehaviour;
-import gregtech.core.network.packets.PacketPluginSynced;
 import gregtech.api.util.IDirtyNotifiable;
 import gregtech.common.gui.widget.monitor.WidgetPluginConfig;
 import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen;
-import io.netty.buffer.Unpooled;
+import gregtech.core.network.packets.PacketPluginSynced;
+
 import net.minecraft.client.resources.I18n;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.entity.player.EntityPlayerMP;
@@ -29,11 +29,15 @@
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
-import javax.annotation.Nonnull;
+import io.netty.buffer.Unpooled;
+
 import java.util.List;
 import java.util.function.Consumer;
 
+import javax.annotation.Nonnull;
+
 public abstract class MonitorPluginBaseBehavior implements IItemBehaviour, ItemUIFactory, IDirtyNotifiable {
+
     protected MetaTileEntityMonitorScreen screen;
     private NBTTagCompound nbtTagCompound;
 
@@ -57,7 +61,8 @@ public MetaTileEntityMonitorScreen getScreen() {
 
     /***
      * Do not override createUI below.
-     * @param holder It should be one of PlayerInventoryHolder or MetaTileEntityHolder.
+     * 
+     * @param holder       It should be one of PlayerInventoryHolder or MetaTileEntityHolder.
      * @param entityPlayer Player
      * @return WidgetGroup back
      */
@@ -73,15 +78,17 @@ public boolean hasUI() {
     }
 
     /***
-     * Server / Client. Itemstack will be synced to client when init so... yeah normally you don't need to consider nbt init.
+     * Server / Client. Itemstack will be synced to client when init so... yeah normally you don't need to consider nbt
+     * init.
      * this will be called when you markDirty.
+     * 
      * @param data nbtTag
      */
-    public void writeToNBT(NBTTagCompound data) {
-    }
+    public void writeToNBT(NBTTagCompound data) {}
 
     /***
      * Server / Client. Initialization of Server and Client.
+     * 
      * @param data nbtTag
      */
     public void readFromNBT(NBTTagCompound data) {
@@ -90,7 +97,8 @@ public void readFromNBT(NBTTagCompound data) {
 
     /***
      * Server. Same as writeCustomData in MetaTileEntity.
-     * @param id PacketID
+     * 
+     * @param id  PacketID
      * @param buf PacketBuffer
      */
     public final void writePluginData(int id, @Nonnull Consumer buf) {
@@ -104,16 +112,16 @@ public final void writePluginData(int id, @Nonnull Consumer buf) {
 
     /***
      * Client. Same as receiveCustomData in MetaTileEntity.
-     * @param id PacketID
+     * 
+     * @param id  PacketID
      * @param buf PacketBuffer
      */
-    public void readPluginData(int id, PacketBuffer buf) {
-
-    }
+    public void readPluginData(int id, PacketBuffer buf) {}
 
     /***
      * Client. Send data to Server.
-     * @param id PacketID
+     * 
+     * @param id         PacketID
      * @param dataWriter PacketBuffer
      */
     public final void writePluginAction(int id, @Nonnull Consumer dataWriter) {
@@ -127,29 +135,26 @@ public final void writePluginAction(int id, @Nonnull Consumer data
 
     /***
      * Server. receive data from client
+     * 
      * @param player player
-     * @param id PacketID
-     * @param buf PacketBuffer
+     * @param id     PacketID
+     * @param buf    PacketBuffer
      */
-    public void readPluginAction(EntityPlayerMP player, int id, PacketBuffer buf) {
-
-    }
+    public void readPluginAction(EntityPlayerMP player, int id, PacketBuffer buf) {}
 
     /***
      * Server. Same as writeInitialSyncData in MetaTileEntity.
+     * 
      * @param buf PacketBuffer
      */
-    public void writeInitialSyncData(PacketBuffer buf) {
-
-    }
+    public void writeInitialSyncData(PacketBuffer buf) {}
 
     /***
      * Client. Same as receiveInitialSyncData in MetaTileEntity.
+     * 
      * @param buf PacketBuffer
      */
-    public void receiveInitialSyncData(PacketBuffer buf) {
-
-    }
+    public void receiveInitialSyncData(PacketBuffer buf) {}
 
     /***
      * Server / Client (deprecated). Should be called when need to write persistence data to NBT
@@ -162,36 +167,36 @@ public void markAsDirty() {
         }
     }
 
-    /*** Server / Client. Called when player touch the screen.
+    /***
+     * Server / Client. Called when player touch the screen.
+     * 
      * @param playerIn Player
-     * @param hand Hand
-     * @param facing Facing
-     * @param isRight is Right Click
-     * @param x xPos of the screen (0 ~ 1.0)
-     * @param y yPos of the screen (0 ~ 1.0)
+     * @param hand     Hand
+     * @param facing   Facing
+     * @param isRight  is Right Click
+     * @param x        xPos of the screen (0 ~ 1.0)
+     * @param y        yPos of the screen (0 ~ 1.0)
      * @return trigger result
      */
-    public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, double y) {
+    public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x,
+                                double y) {
         return false;
     }
 
     /***
      * Server / Client. Called per tick when structure formed.
      */
-    public void update() {
-
-    }
+    public void update() {}
 
     /***
      * Client. Write rendering here
      */
     @SideOnly(Side.CLIENT)
-    public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) {
-
-    }
+    public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) {}
 
     /***
      * Server / Client. Called when plugin is added or removed from the screen.
+     * 
      * @param screen
      * @param valid
      */
@@ -227,7 +232,8 @@ public final ModularUI createUI(PlayerInventoryHolder playerInventoryHolder, Ent
             behavior = behavior.createPlugin();
             behavior.readFromNBT(itemStack.getOrCreateSubCompound("monitor_plugin"));
             return ModularUI.builder(GuiTextures.BOXED_BACKGROUND, 260, 210)
-                    .widget(behavior.customUI(new WidgetPluginConfig().setBackGround(GuiTextures.BACKGROUND), playerInventoryHolder, entityPlayer))
+                    .widget(behavior.customUI(new WidgetPluginConfig().setBackGround(GuiTextures.BACKGROUND),
+                            playerInventoryHolder, entityPlayer))
                     .bindCloseListener(this::markAsDirty)
                     .build(playerInventoryHolder, entityPlayer);
         }
diff --git a/src/main/java/gregtech/api/items/behavior/ProxyHolderPluginBehavior.java b/src/main/java/gregtech/api/items/behavior/ProxyHolderPluginBehavior.java
index b1ea0eb1fd0..ca7aa7ebc67 100644
--- a/src/main/java/gregtech/api/items/behavior/ProxyHolderPluginBehavior.java
+++ b/src/main/java/gregtech/api/items/behavior/ProxyHolderPluginBehavior.java
@@ -1,6 +1,7 @@
 package gregtech.api.items.behavior;
 
 import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
+
 import net.minecraft.client.resources.I18n;
 import net.minecraft.item.ItemStack;
 import net.minecraft.util.math.BlockPos;
@@ -9,6 +10,7 @@
 import java.util.Objects;
 
 public abstract class ProxyHolderPluginBehavior extends MonitorPluginBaseBehavior {
+
     protected IGregTechTileEntity holder;
     private BlockPos pos;
 
diff --git a/src/main/java/gregtech/api/items/gui/ItemUIFactory.java b/src/main/java/gregtech/api/items/gui/ItemUIFactory.java
index 2c3dff4cdce..796cfeaf535 100644
--- a/src/main/java/gregtech/api/items/gui/ItemUIFactory.java
+++ b/src/main/java/gregtech/api/items/gui/ItemUIFactory.java
@@ -2,6 +2,7 @@
 
 import gregtech.api.gui.ModularUI;
 import gregtech.api.items.metaitem.stats.IItemComponent;
+
 import net.minecraft.entity.player.EntityPlayer;
 
 public interface ItemUIFactory extends IItemComponent {
@@ -11,5 +12,4 @@ public interface ItemUIFactory extends IItemComponent {
      * about item stack and hand, and also player
      */
     ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer);
-
 }
diff --git a/src/main/java/gregtech/api/items/gui/PlayerInventoryHolder.java b/src/main/java/gregtech/api/items/gui/PlayerInventoryHolder.java
index a80c8863c92..98ae3e4ead9 100644
--- a/src/main/java/gregtech/api/items/gui/PlayerInventoryHolder.java
+++ b/src/main/java/gregtech/api/items/gui/PlayerInventoryHolder.java
@@ -2,6 +2,7 @@
 
 import gregtech.api.gui.IUIHolder;
 import gregtech.api.gui.ModularUI;
+
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.item.ItemStack;
diff --git a/src/main/java/gregtech/api/items/gui/PlayerInventoryUIFactory.java b/src/main/java/gregtech/api/items/gui/PlayerInventoryUIFactory.java
index b58083e2898..e9be886107d 100644
--- a/src/main/java/gregtech/api/items/gui/PlayerInventoryUIFactory.java
+++ b/src/main/java/gregtech/api/items/gui/PlayerInventoryUIFactory.java
@@ -5,6 +5,7 @@
 import gregtech.api.gui.UIFactory;
 import gregtech.api.items.metaitem.MetaItem;
 import gregtech.api.util.GTUtility;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.item.ItemStack;
@@ -22,8 +23,7 @@ public class PlayerInventoryUIFactory extends UIFactory {
 
     public static final PlayerInventoryUIFactory INSTANCE = new PlayerInventoryUIFactory();
 
-    private PlayerInventoryUIFactory() {
-    }
+    private PlayerInventoryUIFactory() {}
 
     public void init() {
         GregTechAPI.UI_FACTORY_REGISTRY.register(1, GTUtility.gregtechId("player_inventory_factory"), this);
@@ -53,5 +53,4 @@ protected void writeHolderToSyncData(PacketBuffer syncData, PlayerInventoryHolde
         syncData.writeByte(holder.hand.ordinal());
         syncData.writeItemStack(holder.getCurrentItem());
     }
-
 }
diff --git a/src/main/java/gregtech/api/items/itemhandlers/GTItemStackHandler.java b/src/main/java/gregtech/api/items/itemhandlers/GTItemStackHandler.java
index e3170ffdb34..b983862e399 100644
--- a/src/main/java/gregtech/api/items/itemhandlers/GTItemStackHandler.java
+++ b/src/main/java/gregtech/api/items/itemhandlers/GTItemStackHandler.java
@@ -1,6 +1,7 @@
 package gregtech.api.items.itemhandlers;
 
 import gregtech.api.metatileentity.MetaTileEntity;
+
 import net.minecraft.item.ItemStack;
 import net.minecraft.util.NonNullList;
 import net.minecraftforge.items.ItemStackHandler;
diff --git a/src/main/java/gregtech/api/items/itemhandlers/InaccessibleItemStackHandler.java b/src/main/java/gregtech/api/items/itemhandlers/InaccessibleItemStackHandler.java
index 630312a13e3..237a1ca09fb 100644
--- a/src/main/java/gregtech/api/items/itemhandlers/InaccessibleItemStackHandler.java
+++ b/src/main/java/gregtech/api/items/itemhandlers/InaccessibleItemStackHandler.java
@@ -1,11 +1,13 @@
 package gregtech.api.items.itemhandlers;
 
 import gregtech.api.metatileentity.MetaTileEntity;
+
 import net.minecraft.item.ItemStack;
 
 import javax.annotation.Nonnull;
 
 public class InaccessibleItemStackHandler extends GTItemStackHandler {
+
     public InaccessibleItemStackHandler(MetaTileEntity metaTileEntity) {
         super(metaTileEntity);
     }
diff --git a/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java b/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java
index 14a6ac03016..a117bd7e2ef 100644
--- a/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java
+++ b/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java
@@ -15,7 +15,7 @@
 import gregtech.api.unification.material.registry.MaterialRegistry;
 import gregtech.api.unification.ore.OrePrefix;
 import gregtech.api.unification.stack.UnificationEntry;
-import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
+
 import net.minecraft.block.BlockCauldron;
 import net.minecraft.block.state.IBlockState;
 import net.minecraft.client.renderer.block.model.ModelBakery;
@@ -32,13 +32,16 @@
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
+
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 public class MetaPrefixItem extends StandardMetaItem {
 
     private final MaterialRegistry registry;
@@ -125,7 +128,8 @@ public void registerModels() {
 
             short registrationKey = (short) (prefix.id + materialIconSet.id);
             if (!alreadyRegistered.containsKey(registrationKey)) {
-                ResourceLocation resourceLocation = Objects.requireNonNull(prefix.materialIconType).getItemModelPath(materialIconSet);
+                ResourceLocation resourceLocation = Objects.requireNonNull(prefix.materialIconType)
+                        .getItemModelPath(materialIconSet);
                 ModelBakery.registerItemVariants(this, resourceLocation);
                 alreadyRegistered.put(registrationKey, new ModelResourceLocation(resourceLocation, "inventory"));
             }
@@ -136,7 +140,8 @@ public void registerModels() {
         // Make some default models for meta prefix items without any materials associated
         if (metaItems.keySet().isEmpty()) {
             MaterialIconSet defaultIcon = MaterialIconSet.DULL;
-            ResourceLocation defaultLocation = Objects.requireNonNull(OrePrefix.ingot.materialIconType).getItemModelPath(defaultIcon);
+            ResourceLocation defaultLocation = Objects.requireNonNull(OrePrefix.ingot.materialIconType)
+                    .getItemModelPath(defaultIcon);
             ModelBakery.registerItemVariants(this, defaultLocation);
         }
     }
@@ -148,7 +153,8 @@ public int getItemStackLimit(@Nonnull ItemStack stack) {
     }
 
     @Override
-    public void onUpdate(@Nonnull ItemStack itemStack, @Nonnull World worldIn, @Nonnull Entity entityIn, int itemSlot, boolean isSelected) {
+    public void onUpdate(@Nonnull ItemStack itemStack, @Nonnull World worldIn, @Nonnull Entity entityIn, int itemSlot,
+                         boolean isSelected) {
         super.onUpdate(itemStack, worldIn, entityIn, itemSlot, isSelected);
         if (metaItems.containsKey((short) itemStack.getItemDamage()) && entityIn instanceof EntityLivingBase entity) {
             if (entityIn.ticksExisted % 20 == 0) {
@@ -160,7 +166,8 @@ public void onUpdate(@Nonnull ItemStack itemStack, @Nonnull World worldIn, @Nonn
                 float heatDamage = prefix.heatDamageFunction.apply(material.getBlastTemperature());
                 ItemStack armor = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
                 if (!armor.isEmpty() && armor.getItem() instanceof ArmorMetaItem) {
-                    ArmorMetaItem.ArmorMetaValueItem metaValueItem = ((ArmorMetaItem) armor.getItem()).getItem(armor);
+                    ArmorMetaItem.ArmorMetaValueItem metaValueItem = ((ArmorMetaItem) armor.getItem())
+                            .getItem(armor);
                     if (metaValueItem != null) heatDamage *= metaValueItem.getArmorLogic().getHeatResistance();
                 }
 
@@ -175,7 +182,8 @@ public void onUpdate(@Nonnull ItemStack itemStack, @Nonnull World worldIn, @Nonn
 
     @Override
     @SideOnly(Side.CLIENT)
-    public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, @Nonnull List lines, @Nonnull ITooltipFlag tooltipFlag) {
+    public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, @Nonnull List lines,
+                               @Nonnull ITooltipFlag tooltipFlag) {
         super.addInformation(itemStack, worldIn, lines, tooltipFlag);
         Material material = getMaterial(itemStack);
         if (prefix == null || material == null) return;
@@ -226,7 +234,6 @@ public int getItemBurnTime(@Nonnull ItemStack itemStack) {
         DustProperty property = material == null ? null : material.getProperty(PropertyKey.DUST);
         if (property != null) return (int) (property.getBurnTime() * prefix.getMaterialAmount(material) / GTValues.M);
         return super.getItemBurnTime(itemStack);
-
     }
 
     @Override
diff --git a/src/main/java/gregtech/api/items/metaitem/DefaultSubItemHandler.java b/src/main/java/gregtech/api/items/metaitem/DefaultSubItemHandler.java
index 15c40fb9655..a0084373b9f 100644
--- a/src/main/java/gregtech/api/items/metaitem/DefaultSubItemHandler.java
+++ b/src/main/java/gregtech/api/items/metaitem/DefaultSubItemHandler.java
@@ -4,6 +4,7 @@
 import gregtech.api.capability.IElectricItem;
 import gregtech.api.items.metaitem.stats.ISubItemHandler;
 import gregtech.common.ConfigHolder;
+
 import net.minecraft.creativetab.CreativeTabs;
 import net.minecraft.item.ItemStack;
 import net.minecraft.util.NonNullList;
@@ -20,8 +21,7 @@ public class DefaultSubItemHandler implements ISubItemHandler {
 
     public static final DefaultSubItemHandler INSTANCE = new DefaultSubItemHandler();
 
-    private DefaultSubItemHandler() {
-    }
+    private DefaultSubItemHandler() {}
 
     @Override
     public String getItemSubType(ItemStack itemStack) {
@@ -46,7 +46,8 @@ public void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullLi
     }
 
     public static String getFluidContainerSubType(ItemStack itemStack) {
-        IFluidHandlerItem fluidHandler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+        IFluidHandlerItem fluidHandler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY,
+                null);
         if (fluidHandler != null) {
             IFluidTankProperties fluidTankProperties = fluidHandler.getTankProperties()[0];
             FluidStack fluid = fluidTankProperties.getContents();
@@ -58,7 +59,8 @@ public static String getFluidContainerSubType(ItemStack itemStack) {
     public static void addFluidContainerVariants(ItemStack itemStack, List subItems) {
         for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
             ItemStack containerStack = itemStack.copy();
-            IFluidHandlerItem fluidContainer = containerStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+            IFluidHandlerItem fluidContainer = containerStack
+                    .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
             if (fluidContainer != null) {
                 fluidContainer.fill(new FluidStack(fluid, Integer.MAX_VALUE), true);
                 if (fluidContainer.drain(Integer.MAX_VALUE, false) == null)
diff --git a/src/main/java/gregtech/api/items/metaitem/ElectricStats.java b/src/main/java/gregtech/api/items/metaitem/ElectricStats.java
index 187ab86c37e..91bd1b739da 100644
--- a/src/main/java/gregtech/api/items/metaitem/ElectricStats.java
+++ b/src/main/java/gregtech/api/items/metaitem/ElectricStats.java
@@ -8,6 +8,7 @@
 import gregtech.api.items.metaitem.stats.*;
 import gregtech.common.ConfigHolder;
 import gregtech.integration.baubles.BaublesModule;
+
 import net.minecraft.client.resources.I18n;
 import net.minecraft.creativetab.CreativeTabs;
 import net.minecraft.entity.Entity;
@@ -30,7 +31,8 @@
 import java.time.Instant;
 import java.util.List;
 
-public class ElectricStats implements IItemComponent, IItemCapabilityProvider, IItemMaxStackSizeProvider, IItemBehaviour, ISubItemHandler {
+public class ElectricStats implements IItemComponent, IItemCapabilityProvider, IItemMaxStackSizeProvider,
+                           IItemBehaviour, ISubItemHandler {
 
     public static final ElectricStats EMPTY = new ElectricStats(0, 0, false, false);
 
@@ -79,7 +81,8 @@ public void onUpdate(ItemStack itemStack, Entity entity) {
 
             for (int i = 0; i < inventoryPlayer.getSizeInventory(); i++) {
                 ItemStack itemInSlot = inventoryPlayer.getStackInSlot(i);
-                IElectricItem slotElectricItem = itemInSlot.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
+                IElectricItem slotElectricItem = itemInSlot.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM,
+                        null);
                 IEnergyStorage feEnergyItem = itemInSlot.getCapability(CapabilityEnergy.ENERGY, null);
                 if (slotElectricItem != null && !slotElectricItem.canProvideChargeExternally()) {
 
@@ -93,7 +96,8 @@ public void onUpdate(ItemStack itemStack, Entity entity) {
                         int energyMissing = feEnergyItem.getMaxEnergyStored() - feEnergyItem.getEnergyStored();
                         long euToCharge = FeCompat.toEu(energyMissing, ConfigHolder.compat.energy.feToEuRatio);
                         long energyToTransfer = Math.min(euToCharge, transferLimit);
-                        long maxDischargeAmount = Math.min(energyToTransfer, electricItem.discharge(energyToTransfer, electricItem.getTier(), false, true, true));
+                        long maxDischargeAmount = Math.min(energyToTransfer,
+                                electricItem.discharge(energyToTransfer, electricItem.getTier(), false, true, true));
                         FeCompat.insertEu(feEnergyItem, maxDischargeAmount);
                         electricItem.discharge(maxDischargeAmount, electricItem.getTier(), false, true, false);
                     }
@@ -172,7 +176,8 @@ private static boolean isInDischargeMode(ItemStack itemStack) {
 
     @Override
     public int getMaxStackSize(ItemStack itemStack, int defaultValue) {
-        ElectricItem electricItem = (ElectricItem) itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
+        ElectricItem electricItem = (ElectricItem) itemStack
+                .getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
         if (electricItem == null || electricItem.getCharge() == 0) {
             return defaultValue;
         }
diff --git a/src/main/java/gregtech/api/items/metaitem/FilteredFluidStats.java b/src/main/java/gregtech/api/items/metaitem/FilteredFluidStats.java
index 8e5505c4ae5..2c3cbf3dff5 100644
--- a/src/main/java/gregtech/api/items/metaitem/FilteredFluidStats.java
+++ b/src/main/java/gregtech/api/items/metaitem/FilteredFluidStats.java
@@ -6,6 +6,7 @@
 import gregtech.api.capability.impl.PropertyFluidFilter;
 import gregtech.api.items.metaitem.stats.IItemCapabilityProvider;
 import gregtech.api.items.metaitem.stats.IItemComponent;
+
 import net.minecraft.item.ItemStack;
 import net.minecraftforge.common.capabilities.ICapabilityProvider;
 import net.minecraftforge.fluids.FluidStack;
@@ -27,7 +28,8 @@ public FilteredFluidStats(int capacity, boolean allowPartialFill, @Nullable IFil
 
     public FilteredFluidStats(int capacity, int maxFluidTemperature, boolean gasProof, boolean acidProof,
                               boolean cryoProof, boolean plasmaProof, boolean allowPartialFill) {
-        this(capacity, allowPartialFill, new PropertyFluidFilter(maxFluidTemperature, gasProof, acidProof, cryoProof, plasmaProof));
+        this(capacity, allowPartialFill,
+                new PropertyFluidFilter(maxFluidTemperature, gasProof, acidProof, cryoProof, plasmaProof));
     }
 
     @Override
diff --git a/src/main/java/gregtech/api/items/metaitem/FoodStats.java b/src/main/java/gregtech/api/items/metaitem/FoodStats.java
index 0ce012f359b..2a7533a624e 100644
--- a/src/main/java/gregtech/api/items/metaitem/FoodStats.java
+++ b/src/main/java/gregtech/api/items/metaitem/FoodStats.java
@@ -3,14 +3,16 @@
 import gregtech.api.GTValues;
 import gregtech.api.items.metaitem.stats.IFoodBehavior;
 import gregtech.api.util.RandomPotionEffect;
+
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.item.EnumAction;
 import net.minecraft.item.ItemStack;
 import net.minecraft.potion.PotionEffect;
 
-import javax.annotation.Nullable;
 import java.util.List;
 
+import javax.annotation.Nullable;
+
 /**
  * Simple {@link gregtech.api.items.metaitem.stats.IFoodBehavior} implementation
  *
@@ -27,7 +29,8 @@ public class FoodStats implements IFoodBehavior {
     @Nullable
     public ItemStack containerItem;
 
-    public FoodStats(int foodLevel, float saturation, boolean isDrink, boolean alwaysEdible, ItemStack containerItem, RandomPotionEffect... potionEffects) {
+    public FoodStats(int foodLevel, float saturation, boolean isDrink, boolean alwaysEdible, ItemStack containerItem,
+                     RandomPotionEffect... potionEffects) {
         this.foodLevel = foodLevel;
         this.saturation = saturation;
         this.isDrink = isDrink;
@@ -99,8 +102,7 @@ public void addInformation(ItemStack itemStack, List lines) {
             for (int i = 0; i < potionEffects.length; i++) {
                 effects[i] = potionEffects[i].effect;
             }
-//            GTUtility.addPotionTooltip(Iterables.cycle(effects), lines); todo implement this
+            // GTUtility.addPotionTooltip(Iterables.cycle(effects), lines); todo implement this
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/items/metaitem/FoodUseManager.java b/src/main/java/gregtech/api/items/metaitem/FoodUseManager.java
index af4a8d7914a..88ac607190c 100644
--- a/src/main/java/gregtech/api/items/metaitem/FoodUseManager.java
+++ b/src/main/java/gregtech/api/items/metaitem/FoodUseManager.java
@@ -3,6 +3,7 @@
 import gregtech.api.items.metaitem.stats.IFoodBehavior;
 import gregtech.api.items.metaitem.stats.IItemBehaviour;
 import gregtech.api.items.metaitem.stats.IItemUseManager;
+
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.item.EnumAction;
 import net.minecraft.item.ItemStack;
@@ -22,8 +23,7 @@ public IFoodBehavior getFoodStats() {
     }
 
     @Override
-    public void onItemUseStart(ItemStack stack, EntityPlayer player) {
-    }
+    public void onItemUseStart(ItemStack stack, EntityPlayer player) {}
 
     @Override
     public boolean canStartUsing(ItemStack stack, EntityPlayer player) {
@@ -41,12 +41,10 @@ public int getMaxItemUseDuration(ItemStack itemStack) {
     }
 
     @Override
-    public void onItemUsingTick(ItemStack stack, EntityPlayer player, int count) {
-    }
+    public void onItemUsingTick(ItemStack stack, EntityPlayer player, int count) {}
 
     @Override
-    public void onPlayerStoppedItemUsing(ItemStack stack, EntityPlayer player, int timeLeft) {
-    }
+    public void onPlayerStoppedItemUsing(ItemStack stack, EntityPlayer player, int timeLeft) {}
 
     @Override
     public ItemStack onItemUseFinish(ItemStack stack, EntityPlayer player) {
diff --git a/src/main/java/gregtech/api/items/metaitem/MetaItem.java b/src/main/java/gregtech/api/items/metaitem/MetaItem.java
index f9942826eff..3124992ad78 100644
--- a/src/main/java/gregtech/api/items/metaitem/MetaItem.java
+++ b/src/main/java/gregtech/api/items/metaitem/MetaItem.java
@@ -1,9 +1,5 @@
 package gregtech.api.items.metaitem;
 
-import com.enderio.core.common.interfaces.IOverlayRenderAware;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Multimap;
 import gregtech.api.GTValues;
 import gregtech.api.GregTechAPI;
 import gregtech.api.capability.GregtechCapabilities;
@@ -26,11 +22,7 @@
 import gregtech.api.util.LocalizationUtils;
 import gregtech.client.utils.ToolChargeBarRenderer;
 import gregtech.common.ConfigHolder;
-import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
-import it.unimi.dsi.fastutil.objects.ObjectArraySet;
-import it.unimi.dsi.fastutil.shorts.Short2ObjectLinkedOpenHashMap;
-import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
-import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.renderer.block.model.ModelBakery;
 import net.minecraft.client.renderer.block.model.ModelResourceLocation;
@@ -62,30 +54,44 @@
 import net.minecraftforge.fml.relauncher.SideOnly;
 import net.minecraftforge.items.ItemHandlerHelper;
 import net.minecraftforge.oredict.OreDictionary;
+
+import com.enderio.core.common.interfaces.IOverlayRenderAware;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Multimap;
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.objects.ObjectArraySet;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectLinkedOpenHashMap;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.Validate;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import java.time.Duration;
 import java.time.Instant;
 import java.util.*;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 /**
  * MetaItem is item that can have up to Short.MAX_VALUE items inside one id.
  * These items even can be edible, have custom behaviours, be electric or act like fluid containers!
  * They can also have different burn time, plus be handheld, oredicted or invisible!
  * They also can be reactor components.
  * 

- * You can also extend this class and occupy some of it's MetaData, and just pass an meta offset in constructor, and everything will work properly. + * You can also extend this class and occupy some of it's MetaData, and just pass an meta offset in constructor, and + * everything will work properly. *

- * Items are added in MetaItem via {@link #addItem(int, String)}. You will get {@link MetaValueItem} instance, which you can configure in builder-alike pattern: + * Items are added in MetaItem via {@link #addItem(int, String)}. You will get {@link MetaValueItem} instance, which you + * can configure in builder-alike pattern: * {@code addItem(0, "test_item").addStats(new ElectricStats(10000, 1, false)) } * This will add single-use (not rechargeable) LV battery with initial capacity 10000 EU */ @Optional.Interface(modid = GTValues.MODID_ECORE, iface = "com.enderio.core.common.interfaces.IOverlayRenderAware") -public abstract class MetaItem.MetaValueItem> extends Item implements ItemUIFactory, IOverlayRenderAware { +public abstract class MetaItem.MetaValueItem> extends Item + implements ItemUIFactory, IOverlayRenderAware { private static final List> META_ITEMS = new ArrayList<>(); @@ -97,11 +103,12 @@ public static List> getMetaItems() { protected final Short2ObjectMap metaItems = new Short2ObjectLinkedOpenHashMap<>(); protected final Short2ObjectMap metaItemsModels = new Short2ObjectOpenHashMap<>(); protected final Short2ObjectMap specialItemsModels = new Short2ObjectOpenHashMap<>(); - protected static final ModelResourceLocation MISSING_LOCATION = new ModelResourceLocation("builtin/missing", "inventory"); + protected static final ModelResourceLocation MISSING_LOCATION = new ModelResourceLocation("builtin/missing", + "inventory"); protected final short metaItemOffset; - private CreativeTabs[] defaultCreativeTabs = new CreativeTabs[]{GregTechAPI.TAB_GREGTECH}; + private CreativeTabs[] defaultCreativeTabs = new CreativeTabs[] { GregTechAPI.TAB_GREGTECH }; private final Set additionalCreativeTabs = new ObjectArraySet<>(); public MetaItem(short metaItemOffset) { @@ -135,7 +142,8 @@ public void registerModels() { if (numberOfModels > 0) { ModelBakery.registerItemVariants(this, resourceLocation); } - metaItemsModels.put((short) (metaItemOffset + itemMetaKey), new ModelResourceLocation(resourceLocation, "inventory")); + metaItemsModels.put((short) (metaItemOffset + itemMetaKey), + new ModelResourceLocation(resourceLocation, "inventory")); } } @@ -213,11 +221,14 @@ public EnumRarity getRarity(@Nonnull ItemStack stack) { protected abstract T constructMetaValueItem(short metaValue, String unlocalizedName); public final T addItem(int metaValue, String unlocalizedName) { - Validate.inclusiveBetween(0, Short.MAX_VALUE - 1, metaValue + metaItemOffset, "MetaItem ID should be in range from 0 to Short.MAX_VALUE-1"); + Validate.inclusiveBetween(0, Short.MAX_VALUE - 1, metaValue + metaItemOffset, + "MetaItem ID should be in range from 0 to Short.MAX_VALUE-1"); T metaValueItem = constructMetaValueItem((short) metaValue, unlocalizedName); if (metaItems.containsKey((short) metaValue)) { T registeredItem = metaItems.get((short) metaValue); - throw new IllegalArgumentException(String.format("MetaId %d is already occupied by item %s (requested by item %s)", metaValue, registeredItem.unlocalizedName, unlocalizedName)); + throw new IllegalArgumentException( + String.format("MetaId %d is already occupied by item %s (requested by item %s)", metaValue, + registeredItem.unlocalizedName, unlocalizedName)); } metaItems.put((short) metaValue, metaValueItem); names.put(unlocalizedName, metaValueItem); @@ -247,8 +258,7 @@ protected short formatRawItemDamage(short metaValue) { return metaValue; } - public void registerSubItems() { - } + public void registerSubItems() {} @Override public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable NBTTagCompound nbt) { @@ -277,7 +287,7 @@ public int getItemBurnTime(@Nonnull ItemStack itemStack) { } ////////////////////////////////////////////////////////////////// - // Behaviours and Use Manager Implementation // + // Behaviours and Use Manager Implementation // ////////////////////////////////////////////////////////////////// private IItemUseManager getUseManager(ItemStack itemStack) { @@ -335,7 +345,8 @@ public void onUsingTick(@Nonnull ItemStack stack, @Nonnull EntityLivingBase play } @Override - public void onPlayerStoppedUsing(@Nonnull ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase player, int timeLeft) { + public void onPlayerStoppedUsing(@Nonnull ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase player, + int timeLeft) { if (player instanceof EntityPlayer) { IItemUseManager useManager = getUseManager(stack); if (useManager != null) { @@ -367,7 +378,8 @@ public boolean onLeftClickEntity(@Nonnull ItemStack stack, @Nonnull EntityPlayer } @Override - public boolean itemInteractionForEntity(@Nonnull ItemStack stack, @Nonnull EntityPlayer playerIn, @Nonnull EntityLivingBase target, @Nonnull EnumHand hand) { + public boolean itemInteractionForEntity(@Nonnull ItemStack stack, @Nonnull EntityPlayer playerIn, + @Nonnull EntityLivingBase target, @Nonnull EnumHand hand) { boolean returnValue = false; for (IItemBehaviour behaviour : getBehaviours(stack)) { if (behaviour.itemInteractionForEntity(stack, playerIn, target, hand)) { @@ -401,10 +413,13 @@ public ActionResult onItemRightClick(@Nonnull World world, EntityPlay @Nonnull @Override - public EnumActionResult onItemUseFirst(EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { ItemStack itemStack = player.getHeldItem(hand); for (IItemBehaviour behaviour : getBehaviours(itemStack)) { - EnumActionResult behaviourResult = behaviour.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); + EnumActionResult behaviourResult = behaviour.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, + hand); if (behaviourResult != EnumActionResult.PASS) { return behaviourResult; } else if (itemStack.isEmpty()) { @@ -416,11 +431,14 @@ public EnumActionResult onItemUseFirst(EntityPlayer player, @Nonnull World world @Nonnull @Override - public EnumActionResult onItemUse(EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { ItemStack stack = player.getHeldItem(hand); ItemStack originalStack = stack.copy(); for (IItemBehaviour behaviour : getBehaviours(stack)) { - ActionResult behaviourResult = behaviour.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); + ActionResult behaviourResult = behaviour.onItemUse(player, world, pos, hand, facing, hitX, hitY, + hitZ); stack = behaviourResult.getResult(); if (behaviourResult.getType() != EnumActionResult.PASS) { if (!ItemStack.areItemStacksEqual(originalStack, stack)) @@ -436,7 +454,8 @@ public EnumActionResult onItemUse(EntityPlayer player, @Nonnull World world, @No @Nonnull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, + @Nonnull ItemStack stack) { HashMultimap modifiers = HashMultimap.create(); T metaValueItem = getItem(stack); if (metaValueItem != null) { @@ -478,16 +497,20 @@ public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack, @Nonnull Ench } @Override - public void onUpdate(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull Entity entityIn, int itemSlot, boolean isSelected) { + public void onUpdate(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull Entity entityIn, int itemSlot, + boolean isSelected) { for (IItemBehaviour behaviour : getBehaviours(stack)) { behaviour.onUpdate(stack, entityIn); } } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, boolean slotChanged) { - //if item is equal, and old item has electric item capability, remove charge tags to stop reequip animation when charge is altered - if (ItemStack.areItemsEqual(oldStack, newStack) && oldStack.hasCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null) && + public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + boolean slotChanged) { + // if item is equal, and old item has electric item capability, remove charge tags to stop reequip animation + // when charge is altered + if (ItemStack.areItemsEqual(oldStack, newStack) && + oldStack.hasCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null) && oldStack.hasTagCompound() && newStack.hasTagCompound()) { oldStack = oldStack.copy(); newStack = newStack.copy(); @@ -538,7 +561,8 @@ public String getItemStackDisplayName(ItemStack stack) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, @Nonnull List lines, @Nonnull ITooltipFlag tooltipFlag) { + public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, @Nonnull List lines, + @Nonnull ITooltipFlag tooltipFlag) { T item = getItem(itemStack); if (item == null) return; String unlocalizedTooltip = "metaitem." + item.unlocalizedName + ".tooltip"; @@ -549,7 +573,8 @@ public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn IElectricItem electricItem = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (electricItem != null) { if (electricItem.canProvideChargeExternally()) { - addDischargeItemTooltip(lines, electricItem.getMaxCharge(), electricItem.getCharge(), electricItem.getTier()); + addDischargeItemTooltip(lines, electricItem.getMaxCharge(), electricItem.getCharge(), + electricItem.getTier()); } else { lines.add(I18n.format("metaitem.generic.electric_item.tooltip", electricItem.getCharge(), @@ -586,7 +611,8 @@ public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn private static void addDischargeItemTooltip(List tooltip, long maxCharge, long currentCharge, int tier) { if (currentCharge == 0) { // do not display when empty - tooltip.add(I18n.format("metaitem.generic.electric_item.tooltip", currentCharge, maxCharge, GTValues.VNF[tier])); + tooltip.add(I18n.format("metaitem.generic.electric_item.tooltip", currentCharge, maxCharge, + GTValues.VNF[tier])); return; } Instant start = Instant.now(); @@ -644,7 +670,7 @@ public CreativeTabs[] getCreativeTabs() { @Override public MetaItem setCreativeTab(CreativeTabs tab) { - this.defaultCreativeTabs = new CreativeTabs[]{tab}; + this.defaultCreativeTabs = new CreativeTabs[] { tab }; return this; } @@ -977,7 +1003,9 @@ public ItemStack getMaxChargeOverrideStack(long maxCharge) { throw new IllegalStateException("Not an electric item."); } if (!(electricItem instanceof ElectricItem)) { - throw new IllegalStateException("Only standard ElectricItem implementation supported, but this item uses " + electricItem.getClass()); + throw new IllegalStateException( + "Only standard ElectricItem implementation supported, but this item uses " + + electricItem.getClass()); } ((ElectricItem) electricItem).setMaxChargeOverride(maxCharge); return itemStack; @@ -990,7 +1018,9 @@ public ItemStack getChargedStackWithOverride(IElectricItem source) { throw new IllegalStateException("Not an electric item."); } if (!(electricItem instanceof ElectricItem)) { - throw new IllegalStateException("Only standard ElectricItem implementation supported, but this item uses " + electricItem.getClass()); + throw new IllegalStateException( + "Only standard ElectricItem implementation supported, but this item uses " + + electricItem.getClass()); } ((ElectricItem) electricItem).setMaxChargeOverride(source.getMaxCharge()); long charge = source.discharge(Long.MAX_VALUE, Integer.MAX_VALUE, true, false, true); @@ -999,7 +1029,8 @@ public ItemStack getChargedStackWithOverride(IElectricItem source) { } public boolean isInCreativeTab(CreativeTabs tab) { - CreativeTabs[] tabs = this.creativeTabsOverride != null ? this.creativeTabsOverride : MetaItem.this.defaultCreativeTabs; + CreativeTabs[] tabs = this.creativeTabsOverride != null ? this.creativeTabsOverride : + MetaItem.this.defaultCreativeTabs; return tabs.length > 0 && (tab == CreativeTabs.SEARCH || ArrayUtils.contains(tabs, tab)); } diff --git a/src/main/java/gregtech/api/items/metaitem/MetaOreDictItem.java b/src/main/java/gregtech/api/items/metaitem/MetaOreDictItem.java index 0cf6a89067e..429450f09e5 100644 --- a/src/main/java/gregtech/api/items/metaitem/MetaOreDictItem.java +++ b/src/main/java/gregtech/api/items/metaitem/MetaOreDictItem.java @@ -1,15 +1,12 @@ package gregtech.api.items.metaitem; -import com.google.common.base.CaseFormat; -import com.google.common.collect.ImmutableList; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.info.MaterialIconType; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.util.GTUtility; import gregtech.api.util.SmallDigits; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.ItemStack; @@ -17,6 +14,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import com.google.common.base.CaseFormat; +import com.google.common.collect.ImmutableList; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,7 +30,8 @@ public class MetaOreDictItem extends StandardMetaItem { private static final List DISALLOWED_TYPES = ImmutableList.of( MaterialIconType.block, MaterialIconType.ore, MaterialIconType.oreSmall, MaterialIconType.frameGt); - private static final ModelResourceLocation MISSING_LOCATION = new ModelResourceLocation("builtin/missing", "inventory"); + private static final ModelResourceLocation MISSING_LOCATION = new ModelResourceLocation("builtin/missing", + "inventory"); public MetaOreDictItem(short metaItemOffset) { super(metaItemOffset); @@ -74,11 +77,14 @@ public void registerModels() { } @SuppressWarnings("unused") - public OreDictValueItem addOreDictItem(int id, String materialName, int rgb, MaterialIconSet materialIconSet, OrePrefix orePrefix) { + public OreDictValueItem addOreDictItem(int id, String materialName, int rgb, MaterialIconSet materialIconSet, + OrePrefix orePrefix) { return this.addOreDictItem(id, materialName, rgb, materialIconSet, orePrefix, null); } - public OreDictValueItem addOreDictItem(int id, String materialName, int materialRGB, MaterialIconSet materialIconSet, OrePrefix orePrefix, String chemicalFormula) { + public OreDictValueItem addOreDictItem(int id, String materialName, int materialRGB, + MaterialIconSet materialIconSet, OrePrefix orePrefix, + String chemicalFormula) { return new OreDictValueItem((short) id, materialName, materialRGB, materialIconSet, orePrefix, chemicalFormula); } @@ -92,7 +98,8 @@ public class OreDictValueItem { protected String chemicalFormula; - private OreDictValueItem(short id, String materialName, int materialRGB, MaterialIconSet materialIconSet, OrePrefix orePrefix, String chemicalFormula) { + private OreDictValueItem(short id, String materialName, int materialRGB, MaterialIconSet materialIconSet, + OrePrefix orePrefix, String chemicalFormula) { this.id = id; this.materialName = materialName; this.materialRGB = materialRGB; @@ -142,5 +149,4 @@ public int getMaterialRGB() { return materialRGB; } } - } diff --git a/src/main/java/gregtech/api/items/metaitem/MusicDiscStats.java b/src/main/java/gregtech/api/items/metaitem/MusicDiscStats.java index d23276e7e46..a505896cb24 100644 --- a/src/main/java/gregtech/api/items/metaitem/MusicDiscStats.java +++ b/src/main/java/gregtech/api/items/metaitem/MusicDiscStats.java @@ -2,6 +2,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.items.metaitem.stats.IMusicDisc; + import net.minecraft.block.BlockJukebox; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; @@ -31,12 +32,13 @@ public SoundEvent getSound() { } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { IBlockState iblockstate = world.getBlockState(pos); ItemStack itemStack = player.getHeldItem(hand); - if (iblockstate.getBlock() == Blocks.JUKEBOX && !(Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)) { + if (iblockstate.getBlock() == Blocks.JUKEBOX && !(Boolean) iblockstate.getValue(BlockJukebox.HAS_RECORD)) { if (!world.isRemote) { - ((BlockJukebox)Blocks.JUKEBOX).insertRecord(world, pos, iblockstate, itemStack); + ((BlockJukebox) Blocks.JUKEBOX).insertRecord(world, pos, iblockstate, itemStack); world.playEvent(SOUND_TYPE, pos, itemStack.getItemDamage()); itemStack.shrink(1); player.addStat(StatList.RECORD_PLAYED); diff --git a/src/main/java/gregtech/api/items/metaitem/StandardMetaItem.java b/src/main/java/gregtech/api/items/metaitem/StandardMetaItem.java index f08a227eb7d..39aadc1351d 100644 --- a/src/main/java/gregtech/api/items/metaitem/StandardMetaItem.java +++ b/src/main/java/gregtech/api/items/metaitem/StandardMetaItem.java @@ -14,5 +14,4 @@ public StandardMetaItem(short metaItemOffset) { protected MetaValueItem constructMetaValueItem(short metaValue, String unlocalizedName) { return new MetaValueItem(metaValue, unlocalizedName); } - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IEnchantabilityHelper.java b/src/main/java/gregtech/api/items/metaitem/stats/IEnchantabilityHelper.java index 82a7343e8e5..2159e0d0b2f 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IEnchantabilityHelper.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IEnchantabilityHelper.java @@ -10,5 +10,4 @@ public interface IEnchantabilityHelper extends IItemComponent { int getItemEnchantability(ItemStack stack); boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment); - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IFoodBehavior.java b/src/main/java/gregtech/api/items/metaitem/stats/IFoodBehavior.java index ee4bc8b2b95..b1c1da05c47 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IFoodBehavior.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IFoodBehavior.java @@ -4,9 +4,10 @@ import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public interface IFoodBehavior extends IItemComponent { int getFoodLevel(ItemStack itemStack, @Nullable EntityPlayer player); @@ -22,5 +23,4 @@ default ItemStack onFoodEaten(ItemStack stack, EntityPlayer player) { } void addInformation(ItemStack itemStack, List lines); - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemBehaviour.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemBehaviour.java index c9cce6c917f..bd0a72dd988 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemBehaviour.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemBehaviour.java @@ -1,7 +1,5 @@ package gregtech.api.items.metaitem.stats; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.attributes.AttributeModifier; @@ -16,32 +14,37 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import javax.annotation.Nonnull; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; + import java.util.List; +import javax.annotation.Nonnull; + public interface IItemBehaviour extends IItemComponent { default boolean onLeftClickEntity(ItemStack itemStack, EntityPlayer player, Entity entity) { return false; } - default boolean itemInteractionForEntity(ItemStack itemStack, EntityPlayer player, EntityLivingBase target, EnumHand hand) { + default boolean itemInteractionForEntity(ItemStack itemStack, EntityPlayer player, EntityLivingBase target, + EnumHand hand) { return false; } - default EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + default EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, + float hitY, float hitZ, EnumHand hand) { return EnumActionResult.PASS; } - default ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + default ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } - default void addInformation(ItemStack itemStack, List lines) { - } + default void addInformation(ItemStack itemStack, List lines) {} - default void onUpdate(ItemStack itemStack, Entity entity) { - } + default void onUpdate(ItemStack itemStack, Entity entity) {} default Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) { return HashMultimap.create(); @@ -51,6 +54,5 @@ default ActionResult onItemRightClick(World world, EntityPlayer playe return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } - default void addPropertyOverride(@Nonnull Item item) { - } + default void addPropertyOverride(@Nonnull Item item) {} } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemCapabilityProvider.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemCapabilityProvider.java index 6fc0b91f2d7..8133dbf2eb6 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemCapabilityProvider.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemCapabilityProvider.java @@ -7,5 +7,4 @@ public interface IItemCapabilityProvider extends IItemComponent { ICapabilityProvider createProvider(ItemStack itemStack); - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemComponent.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemComponent.java index 3d4998bfb4a..4517f61853e 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemComponent.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemComponent.java @@ -4,5 +4,4 @@ * Describes generic component attachable to metaitem * Multiple components can be attached to one item */ -public interface IItemComponent { -} +public interface IItemComponent {} diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemDurabilityManager.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemDurabilityManager.java index 25670d3b6b6..119c8785ab4 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemDurabilityManager.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemDurabilityManager.java @@ -1,11 +1,13 @@ package gregtech.api.items.metaitem.stats; import net.minecraft.item.ItemStack; + import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.awt.*; +import javax.annotation.Nullable; + public interface IItemDurabilityManager extends IItemComponent { /** The durability remaining on this item (double from 0 to 1). */ @@ -22,12 +24,18 @@ default boolean doDamagedStateColors(ItemStack itemStack) { return true; } - /** Whether to show the durability bar when {@link IItemDurabilityManager#getDurabilityForDisplay(ItemStack)} is 0. Default true */ + /** + * Whether to show the durability bar when {@link IItemDurabilityManager#getDurabilityForDisplay(ItemStack)} is 0. + * Default true + */ default boolean showEmptyBar(ItemStack itemStack) { return true; } - /** Whether to show the durability bar when {@link IItemDurabilityManager#getDurabilityForDisplay(ItemStack)} is 1. Default true */ + /** + * Whether to show the durability bar when {@link IItemDurabilityManager#getDurabilityForDisplay(ItemStack)} is 1. + * Default true + */ default boolean showFullBar(ItemStack itemStack) { return true; } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemMaxStackSizeProvider.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemMaxStackSizeProvider.java index 6287d24bd47..7f5a06adcc3 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemMaxStackSizeProvider.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemMaxStackSizeProvider.java @@ -6,5 +6,4 @@ public interface IItemMaxStackSizeProvider extends IItemComponent { int getMaxStackSize(ItemStack itemStack, int defaultValue); - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemModelManager.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemModelManager.java index 6554a4c610c..5f1199fe41e 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemModelManager.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemModelManager.java @@ -1,4 +1,3 @@ package gregtech.api.items.metaitem.stats; -public interface IItemModelManager extends IItemComponent { -} +public interface IItemModelManager extends IItemComponent {} diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemNameProvider.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemNameProvider.java index 90c09aedd5b..059167e3949 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemNameProvider.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemNameProvider.java @@ -6,5 +6,4 @@ public interface IItemNameProvider extends IItemComponent { String getItemStackDisplayName(ItemStack itemStack, String unlocalizedName); - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemUseManager.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemUseManager.java index 4e3a05c593f..0da05d4af15 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemUseManager.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemUseManager.java @@ -10,18 +10,15 @@ default boolean canStartUsing(ItemStack stack, EntityPlayer player) { return true; } - default void onItemUseStart(ItemStack stack, EntityPlayer player) { - } + default void onItemUseStart(ItemStack stack, EntityPlayer player) {} EnumAction getUseAction(ItemStack stack); int getMaxItemUseDuration(ItemStack stack); - default void onItemUsingTick(ItemStack stack, EntityPlayer player, int count) { - } + default void onItemUsingTick(ItemStack stack, EntityPlayer player, int count) {} - default void onPlayerStoppedItemUsing(ItemStack stack, EntityPlayer player, int timeLeft) { - } + default void onPlayerStoppedItemUsing(ItemStack stack, EntityPlayer player, int timeLeft) {} default ItemStack onItemUseFinish(ItemStack stack, EntityPlayer player) { return stack; diff --git a/src/main/java/gregtech/api/items/metaitem/stats/ISubItemHandler.java b/src/main/java/gregtech/api/items/metaitem/stats/ISubItemHandler.java index 6e7f74ebd62..ab939e27570 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/ISubItemHandler.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/ISubItemHandler.java @@ -9,5 +9,4 @@ public interface ISubItemHandler extends IItemComponent { String getItemSubType(ItemStack itemStack); void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullList subItems); - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/ItemFluidContainer.java b/src/main/java/gregtech/api/items/metaitem/stats/ItemFluidContainer.java index a946bf2ae21..b206c683512 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/ItemFluidContainer.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/ItemFluidContainer.java @@ -6,6 +6,7 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem; public class ItemFluidContainer implements IItemContainerItemProvider { + @Override public ItemStack getContainerItem(ItemStack itemStack) { IFluidHandlerItem handler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); diff --git a/src/main/java/gregtech/api/items/toolitem/EnchantmentLevel.java b/src/main/java/gregtech/api/items/toolitem/EnchantmentLevel.java index 70a48c4381d..afeedf3dfb9 100644 --- a/src/main/java/gregtech/api/items/toolitem/EnchantmentLevel.java +++ b/src/main/java/gregtech/api/items/toolitem/EnchantmentLevel.java @@ -1,6 +1,7 @@ package gregtech.api.items.toolitem; public class EnchantmentLevel { + private double level; private double levelGrowth; diff --git a/src/main/java/gregtech/api/items/toolitem/IGTTool.java b/src/main/java/gregtech/api/items/toolitem/IGTTool.java index 11bb1c9716d..ed3219d685e 100644 --- a/src/main/java/gregtech/api/items/toolitem/IGTTool.java +++ b/src/main/java/gregtech/api/items/toolitem/IGTTool.java @@ -1,13 +1,5 @@ package gregtech.api.items.toolitem; -import appeng.api.implementations.items.IAEWrench; -import buildcraft.api.tools.IToolWrench; -import cofh.api.item.IToolHammer; -import com.enderio.core.common.interfaces.IOverlayRenderAware; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import crazypants.enderio.api.tool.ITool; -import forestry.api.arboriculture.IToolGrafter; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.capability.GregtechCapabilities; @@ -36,8 +28,7 @@ import gregtech.client.utils.ToolChargeBarRenderer; import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.resources.I18n; @@ -67,8 +58,17 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import appeng.api.implementations.items.IAEWrench; +import buildcraft.api.tools.IToolWrench; +import cofh.api.item.IToolHammer; +import com.enderio.core.common.interfaces.IOverlayRenderAware; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import crazypants.enderio.api.tool.ITool; +import forestry.api.arboriculture.IToolGrafter; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -76,6 +76,9 @@ import java.util.function.Supplier; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.items.armor.IArmorLogic.ATTACK_DAMAGE_MODIFIER; import static gregtech.api.items.armor.IArmorLogic.ATTACK_SPEED_MODIFIER; import static gregtech.api.items.toolitem.ToolHelper.*; @@ -89,8 +92,10 @@ @Optional.Interface(modid = GTValues.MODID_COFH, iface = "cofh.api.item.IToolHammer"), @Optional.Interface(modid = GTValues.MODID_EIO, iface = "crazypants.enderio.api.tool.ITool"), @Optional.Interface(modid = GTValues.MODID_FR, iface = "forestry.api.arboriculture.IToolGrafter"), - @Optional.Interface(modid = GTValues.MODID_ECORE, iface = "com.enderio.core.common.interfaces.IOverlayRenderAware")}) -public interface IGTTool extends ItemUIFactory, IAEWrench, IToolWrench, IToolHammer, ITool, IToolGrafter, IOverlayRenderAware { + @Optional.Interface(modid = GTValues.MODID_ECORE, + iface = "com.enderio.core.common.interfaces.IOverlayRenderAware") }) +public interface IGTTool extends ItemUIFactory, IAEWrench, IToolWrench, IToolHammer, ITool, IToolGrafter, + IOverlayRenderAware { /** * @return the modid of the tool @@ -156,12 +161,14 @@ default ItemStack get(Material material) { ToolProperty toolProperty = material.getProperty(PropertyKey.TOOL); // Durability formula we are working with: - // Final Durability = (material durability * material durability multiplier) + (tool definition durability * definition durability multiplier) - 1 + // Final Durability = (material durability * material durability multiplier) + (tool definition durability * + // definition durability multiplier) - 1 // Subtracts 1 internally since Minecraft treats "0" as a valid durability, but we don't want to display this. int durability = toolProperty.getToolDurability() * toolProperty.getDurabilityMultiplier(); - // Most Tool Definitions do not set a base durability, which will lead to ignoring the multiplier if present. So apply the multiplier to the material durability if that would happen + // Most Tool Definitions do not set a base durability, which will lead to ignoring the multiplier if present. So + // apply the multiplier to the material durability if that would happen if (toolStats.getBaseDurability(stack) == 0) { durability *= toolStats.getDurabilityMultiplier(stack); } else { @@ -176,8 +183,10 @@ default ItemStack get(Material material) { // Set tool and material enchantments Object2IntMap enchantments = new Object2IntOpenHashMap<>(); - toolProperty.getEnchantments().forEach((enchantment, level) -> enchantments.put(enchantment, level.getLevel(toolProperty.getToolHarvestLevel()))); - toolStats.getDefaultEnchantments(stack).forEach((enchantment, level) -> enchantments.put(enchantment, level.getLevel(toolProperty.getToolHarvestLevel()))); + toolProperty.getEnchantments().forEach((enchantment, level) -> enchantments.put(enchantment, + level.getLevel(toolProperty.getToolHarvestLevel()))); + toolStats.getDefaultEnchantments(stack).forEach((enchantment, level) -> enchantments.put(enchantment, + level.getLevel(toolProperty.getToolHarvestLevel()))); enchantments.forEach((enchantment, level) -> { if (stack.getItem().canApplyAtEnchantingTable(stack, enchantment)) { stack.addEnchantment(enchantment, level); @@ -188,7 +197,6 @@ default ItemStack get(Material material) { NBTTagCompound behaviourTag = getBehaviorsTag(stack); getToolStats().getBehaviors().forEach(behavior -> behavior.addBehaviorNBT(stack, behaviourTag)); - if (aoeDefinition != AoESymmetrical.none()) { behaviourTag.setInteger(MAX_AOE_COLUMN_KEY, aoeDefinition.column); behaviourTag.setInteger(MAX_AOE_ROW_KEY, aoeDefinition.row); @@ -208,7 +216,8 @@ default ItemStack get(Material material) { default ItemStack get(Material material, long defaultCharge, long defaultMaxCharge) { ItemStack stack = get(material); if (isElectric()) { - ElectricItem electricItem = (ElectricItem) stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + ElectricItem electricItem = (ElectricItem) stack + .getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (electricItem != null) { electricItem.setMaxChargeOverride(defaultMaxCharge); electricItem.setCharge(defaultCharge); @@ -296,7 +305,8 @@ default float getTotalToolSpeed(ItemStack stack) { if (toolTag.hasKey(TOOL_SPEED_KEY, Constants.NBT.TAG_FLOAT)) { return toolTag.getFloat(TOOL_SPEED_KEY); } - float toolSpeed = getToolStats().getEfficiencyMultiplier(stack) * getMaterialToolSpeed(stack) + getToolStats().getBaseEfficiency(stack); + float toolSpeed = getToolStats().getEfficiencyMultiplier(stack) * getMaterialToolSpeed(stack) + + getToolStats().getBaseEfficiency(stack); toolTag.setFloat(TOOL_SPEED_KEY, toolSpeed); return toolSpeed; } @@ -336,8 +346,10 @@ default int getTotalMaxDurability(ItemStack stack) { int maxDurability = getMaterialDurability(stack); int builderDurability = (int) (toolStats.getBaseDurability(stack) * toolStats.getDurabilityMultiplier(stack)); - // If there is no durability set in the tool builder, multiply the builder AOE multiplier to the material durability - maxDurability = builderDurability == 0 ? (int) (maxDurability * toolStats.getDurabilityMultiplier(stack)) : maxDurability + builderDurability; + // If there is no durability set in the tool builder, multiply the builder AOE multiplier to the material + // durability + maxDurability = builderDurability == 0 ? (int) (maxDurability * toolStats.getDurabilityMultiplier(stack)) : + maxDurability + builderDurability; toolTag.setInteger(MAX_DURABILITY_KEY, maxDurability); return maxDurability; @@ -431,9 +443,11 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return false; } - default boolean definition$onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) { + default boolean definition$onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, + EntityLivingBase entityLiving) { if (!worldIn.isRemote) { - getToolStats().getBehaviors().forEach(behavior -> behavior.onBlockDestroyed(stack, worldIn, state, pos, entityLiving)); + getToolStats().getBehaviors() + .forEach(behavior -> behavior.onBlockDestroyed(stack, worldIn, state, pos, entityLiving)); if ((double) state.getBlockHardness(worldIn, pos) != 0.0D) { damageItem(stack, entityLiving, getToolStats().getToolDamagePerBlockBreak(stack)); @@ -477,24 +491,31 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return false; } - default Multimap definition$getAttributeModifiers(EntityEquipmentSlot equipmentSlot, ItemStack stack) { + default Multimap definition$getAttributeModifiers(EntityEquipmentSlot equipmentSlot, + ItemStack stack) { Multimap multimap = HashMultimap.create(); if (equipmentSlot == EntityEquipmentSlot.MAINHAND) { - multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getTotalAttackDamage(stack), 0)); - multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", Math.max(-3.9D, getTotalAttackSpeed(stack)), 0)); + multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), + new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getTotalAttackDamage(stack), 0)); + multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, + "Weapon modifier", Math.max(-3.9D, getTotalAttackSpeed(stack)), 0)); } return multimap; } - default int definition$getHarvestLevel(ItemStack stack, String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { + default int definition$getHarvestLevel(ItemStack stack, String toolClass, @Nullable EntityPlayer player, + @Nullable IBlockState blockState) { return get().getToolClasses(stack).contains(toolClass) ? getTotalHarvestLevel(stack) : -1; } - default boolean definition$canDisableShield(ItemStack stack, ItemStack shield, EntityLivingBase entity, EntityLivingBase attacker) { - return getToolStats().getBehaviors().stream().anyMatch(behavior -> behavior.canDisableShield(stack, shield, entity, attacker)); + default boolean definition$canDisableShield(ItemStack stack, ItemStack shield, EntityLivingBase entity, + EntityLivingBase attacker) { + return getToolStats().getBehaviors().stream() + .anyMatch(behavior -> behavior.canDisableShield(stack, shield, entity, attacker)); } - default boolean definition$doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + default boolean definition$doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, + @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { return getToolStats().doesSneakBypassUse(); } @@ -528,7 +549,8 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return stack; } - default boolean definition$shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { + default boolean definition$shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, + boolean slotChanged) { if (getCharge(oldStack) != getCharge(newStack)) { return slotChanged; } @@ -540,7 +562,8 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return false; } - default boolean definition$canDestroyBlockInCreative(World world, BlockPos pos, ItemStack stack, EntityPlayer player) { + default boolean definition$canDestroyBlockInCreative(World world, BlockPos pos, ItemStack stack, + EntityPlayer player) { return true; } @@ -598,9 +621,12 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return new CombinedCapabilityProvider(providers); } - default EnumActionResult definition$onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + default EnumActionResult definition$onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EnumFacing facing, float hitX, + float hitY, float hitZ, @Nonnull EnumHand hand) { for (IToolBehavior behavior : getToolStats().getBehaviors()) { - if (behavior.onItemUseFirst(player, world, pos, facing, hitX, hitY, hitZ, hand) == EnumActionResult.SUCCESS) { + if (behavior.onItemUseFirst(player, world, pos, facing, hitX, hitY, hitZ, hand) == + EnumActionResult.SUCCESS) { return EnumActionResult.SUCCESS; } } @@ -608,9 +634,10 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return EnumActionResult.PASS; } - default EnumActionResult definition$onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + default EnumActionResult definition$onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { for (IToolBehavior behavior : getToolStats().getBehaviors()) { - if (behavior.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ) == EnumActionResult.SUCCESS) { + if (behavior.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ) == EnumActionResult.SUCCESS) { return EnumActionResult.SUCCESS; } } @@ -649,7 +676,8 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { // Client-side methods @SideOnly(Side.CLIENT) - default void definition$addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, ITooltipFlag flag) { + default void definition$addInformation(@Nonnull ItemStack stack, @Nullable World world, + @Nonnull List tooltip, ITooltipFlag flag) { if (!(stack.getItem() instanceof IGTTool)) return; IGTTool tool = (IGTTool) stack.getItem(); @@ -668,29 +696,36 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { // durability info if (!tagCompound.getBoolean(UNBREAKABLE_KEY)) { - // Plus 1 to match vanilla behavior where tools can still be used once at zero durability. We want to not show this + // Plus 1 to match vanilla behavior where tools can still be used once at zero durability. We want to not + // show this int damageRemaining = tool.getTotalMaxDurability(stack) - stack.getItemDamage() + 1; if (toolStats.isSuitableForCrafting(stack)) { - tooltip.add(I18n.format("item.gt.tool.tooltip.crafting_uses", TextFormattingUtil.formatNumbers(damageRemaining / Math.max(1, toolStats.getToolDamagePerCraft(stack))))); + tooltip.add(I18n.format("item.gt.tool.tooltip.crafting_uses", TextFormattingUtil + .formatNumbers(damageRemaining / Math.max(1, toolStats.getToolDamagePerCraft(stack))))); } - tooltip.add(I18n.format("item.gt.tool.tooltip.general_uses", TextFormattingUtil.formatNumbers(damageRemaining))); + tooltip.add(I18n.format("item.gt.tool.tooltip.general_uses", + TextFormattingUtil.formatNumbers(damageRemaining))); } // attack info if (toolStats.isSuitableForAttacking(stack)) { - tooltip.add(I18n.format("item.gt.tool.tooltip.attack_damage", TextFormattingUtil.formatNumbers(2 + tool.getTotalAttackDamage(stack)))); - tooltip.add(I18n.format("item.gt.tool.tooltip.attack_speed", TextFormattingUtil.formatNumbers(4 + tool.getTotalAttackSpeed(stack)))); + tooltip.add(I18n.format("item.gt.tool.tooltip.attack_damage", + TextFormattingUtil.formatNumbers(2 + tool.getTotalAttackDamage(stack)))); + tooltip.add(I18n.format("item.gt.tool.tooltip.attack_speed", + TextFormattingUtil.formatNumbers(4 + tool.getTotalAttackSpeed(stack)))); } // mining info if (toolStats.isSuitableForBlockBreak(stack)) { - tooltip.add(I18n.format("item.gt.tool.tooltip.mining_speed", TextFormattingUtil.formatNumbers(tool.getTotalToolSpeed(stack)))); + tooltip.add(I18n.format("item.gt.tool.tooltip.mining_speed", + TextFormattingUtil.formatNumbers(tool.getTotalToolSpeed(stack)))); int harvestLevel = tool.getTotalHarvestLevel(stack); String harvestName = "item.gt.tool.harvest_level." + harvestLevel; if (I18n.hasKey(harvestName)) { // if there's a defined name for the harvest level, use it - tooltip.add(I18n.format("item.gt.tool.tooltip.harvest_level_extra", harvestLevel, I18n.format(harvestName))); + tooltip.add(I18n.format("item.gt.tool.tooltip.harvest_level_extra", harvestLevel, + I18n.format(harvestName))); } else { tooltip.add(I18n.format("item.gt.tool.tooltip.harvest_level", harvestLevel)); } @@ -733,8 +768,7 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { tooltip.add(I18n.format("item.gt.tool.usable_as", stack.getItem().getToolClasses(stack).stream() .map(s -> I18n.format("gt.tool.class." + s)) - .collect(Collectors.joining(", ")) - )); + .collect(Collectors.joining(", ")))); // repair info if (!tagCompound.getBoolean(UNBREAKABLE_KEY)) { @@ -776,11 +810,13 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { case "enchantment.cofhcore.smelting": // cofhcore case "enchantment.as.smelting": // astral sorcery // block autosmelt enchants from AoE and Tree-Felling tools - return getToolStats().getAoEDefinition(stack) == AoESymmetrical.none() && !getBehaviorsTag(stack).hasKey(TREE_FELLING_KEY); + return getToolStats().getAoEDefinition(stack) == AoESymmetrical.none() && + !getBehaviorsTag(stack).hasKey(TREE_FELLING_KEY); } // Block Mending and Unbreaking on Electric tools - if (isElectric() && (enchantment instanceof EnchantmentMending || enchantment instanceof EnchantmentDurability)) { + if (isElectric() && + (enchantment instanceof EnchantmentMending || enchantment instanceof EnchantmentDurability)) { return false; } @@ -834,7 +870,8 @@ default void playCraftingSound(EntityPlayer player, ItemStack stack) { if (ConfigHolder.client.toolCraftingSounds && getSound() != null && player != null) { if (canPlaySound(stack)) { setLastCraftingSoundTime(stack); - player.getEntityWorld().playSound(null, player.posX, player.posY, player.posZ, getSound(), SoundCategory.PLAYERS, 1F, 1F); + player.getEntityWorld().playSound(null, player.posX, player.posY, player.posZ, getSound(), + SoundCategory.PLAYERS, 1F, 1F); } } } @@ -849,7 +886,8 @@ default boolean canPlaySound(ItemStack stack) { default void playSound(EntityPlayer player) { if (ConfigHolder.client.toolUseSounds && getSound() != null) { - player.getEntityWorld().playSound(null, player.posX, player.posY, player.posZ, getSound(), SoundCategory.PLAYERS, 1F, 1F); + player.getEntityWorld().playSound(null, player.posX, player.posY, player.posZ, getSound(), + SoundCategory.PLAYERS, 1F, 1F); } } @@ -884,12 +922,13 @@ default ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlay AoESymmetrical.decreaseLayer(tag, defaultDefinition); holder.markAsDirty(); })) - .widget(new DynamicLabelWidget(23, 65, () -> - Integer.toString(1 + 2 * AoESymmetrical.getColumn(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition)))) - .widget(new DynamicLabelWidget(58, 65, () -> - Integer.toString(1 + 2 * AoESymmetrical.getRow(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition)))) - .widget(new DynamicLabelWidget(93, 65, () -> - Integer.toString(1 + AoESymmetrical.getLayer(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition)))) + .widget(new DynamicLabelWidget(23, 65, () -> Integer.toString( + 1 + 2 * AoESymmetrical.getColumn(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition)))) + .widget(new DynamicLabelWidget(58, 65, () -> Integer.toString( + 1 + 2 * AoESymmetrical.getRow(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition)))) + .widget(new DynamicLabelWidget(93, 65, + () -> Integer.toString(1 + + AoESymmetrical.getLayer(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition)))) .build(holder, entityPlayer); } @@ -913,25 +952,29 @@ default boolean canWrench(ItemStack wrench, EntityPlayer player, BlockPos pos) { // IToolWrench - /*** Called to ensure that the wrench can be used. + /*** + * Called to ensure that the wrench can be used. * - * @param player - The player doing the wrenching - * @param hand - Which hand was holding the wrench - * @param wrench - The item stack that holds the wrench + * @param player - The player doing the wrenching + * @param hand - Which hand was holding the wrench + * @param wrench - The item stack that holds the wrench * @param rayTrace - The object that is being wrenched * - * @return true if wrenching is allowed, false if not */ + * @return true if wrenching is allowed, false if not + */ @Override default boolean canWrench(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace) { return get().getToolClasses(wrench).contains(ToolClasses.WRENCH); } - /*** Callback after the wrench has been used. This can be used to decrease durability or for other purposes. + /*** + * Callback after the wrench has been used. This can be used to decrease durability or for other purposes. * - * @param player - The player doing the wrenching - * @param hand - Which hand was holding the wrench - * @param wrench - The item stack that holds the wrench - * @param rayTrace - The object that is being wrenched */ + * @param player - The player doing the wrenching + * @param hand - Which hand was holding the wrench + * @param wrench - The item stack that holds the wrench + * @param rayTrace - The object that is being wrenched + */ @Override default void wrenchUsed(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace) { damageItem(player.getHeldItem(hand), player); diff --git a/src/main/java/gregtech/api/items/toolitem/IGTToolDefinition.java b/src/main/java/gregtech/api/items/toolitem/IGTToolDefinition.java index b218b788086..3602a3a19ea 100644 --- a/src/main/java/gregtech/api/items/toolitem/IGTToolDefinition.java +++ b/src/main/java/gregtech/api/items/toolitem/IGTToolDefinition.java @@ -2,11 +2,13 @@ import gregtech.api.items.toolitem.aoe.AoESymmetrical; import gregtech.api.items.toolitem.behavior.IToolBehavior; -import it.unimi.dsi.fastutil.objects.Object2ObjectMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.enchantment.Enchantment; import net.minecraft.item.ItemStack; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; + import java.util.List; /** @@ -103,5 +105,4 @@ default boolean isEnchantable(ItemStack stack) { default ItemStack getBrokenStack() { return ItemStack.EMPTY; } - } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTAxe.java b/src/main/java/gregtech/api/items/toolitem/ItemGTAxe.java index 700b3ce8aae..405ef425369 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTAxe.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTAxe.java @@ -1,8 +1,8 @@ package gregtech.api.items.toolitem; -import com.google.common.collect.Multimap; import gregtech.api.GregTechAPI; import gregtech.api.util.LocalizationUtils; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; @@ -22,13 +22,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.Multimap; + import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class ItemGTAxe extends ItemAxe implements IGTTool { protected final String domain, id; @@ -42,7 +45,9 @@ public class ItemGTAxe extends ItemAxe implements IGTTool { protected final boolean playSoundOnBlockDestroy; protected final Supplier markerItem; - protected ItemGTAxe(String domain, String id, int tier, IGTToolDefinition toolStats, SoundEvent sound, boolean playSoundOnBlockDestroy, Set toolClasses, String oreDict, List secondaryOreDicts, Supplier markerItem) { + protected ItemGTAxe(String domain, String id, int tier, IGTToolDefinition toolStats, SoundEvent sound, + boolean playSoundOnBlockDestroy, Set toolClasses, String oreDict, + List secondaryOreDicts, Supplier markerItem) { super(ToolMaterial.STONE, 0F, 0F); this.domain = domain; this.id = id; @@ -130,17 +135,20 @@ public float getDestroySpeed(@Nonnull ItemStack stack, @Nonnull IBlockState stat } @Override - public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, @Nonnull EntityLivingBase attacker) { + public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, + @Nonnull EntityLivingBase attacker) { return definition$hitEntity(stack, target, attacker); } @Override - public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$onBlockStartBreak(itemstack, pos, player); } @Override - public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { + public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { return definition$onBlockDestroyed(stack, worldIn, state, pos, entityLiving); } @@ -156,12 +164,14 @@ public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack r @Nonnull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, + @Nonnull ItemStack stack) { return definition$getAttributeModifiers(slot, stack); } @Override - public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { + public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, + @Nullable IBlockState blockState) { return definition$getHarvestLevel(stack, toolClass, player, blockState); } @@ -172,12 +182,14 @@ public Set getToolClasses(@Nonnull ItemStack stack) { } @Override - public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { + public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, + @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { return definition$canDisableShield(stack, shield, entity, attacker); } @Override - public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$doesSneakBypassUse(stack, world, pos, player); } @@ -203,12 +215,14 @@ public boolean onEntitySwing(@Nonnull EntityLivingBase entityLiving, @Nonnull It } @Override - public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, @Nonnull EntityPlayer player) { + public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, + @Nonnull EntityPlayer player) { return definition$canDestroyBlockInCreative(world, pos, stack, player); } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, boolean slotChanged) { + public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + boolean slotChanged) { return definition$shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } @@ -250,25 +264,31 @@ public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable @Nonnull @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { return definition$onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); } @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { return definition$onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); } @Nonnull @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, + @Nonnull EnumHand hand) { return definition$onItemRightClick(world, player, hand); } @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { definition$addInformation(stack, world, tooltip, flag); } @@ -295,7 +315,8 @@ public Builder(@Nonnull String domain, @Nonnull String id) { @Override public Supplier supply() { - return () -> new ItemGTAxe(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, oreDict, secondaryOreDicts, markerItem); + return () -> new ItemGTAxe(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, + oreDict, secondaryOreDicts, markerItem); } } } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java b/src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java index b82c24e8c6c..8e56c245339 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java @@ -1,8 +1,8 @@ package gregtech.api.items.toolitem; -import com.google.common.collect.Multimap; import gregtech.api.GregTechAPI; import gregtech.api.util.LocalizationUtils; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; @@ -22,13 +22,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.Multimap; + import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class ItemGTHoe extends ItemHoe implements IGTTool { protected final String domain, id; @@ -42,7 +45,9 @@ public class ItemGTHoe extends ItemHoe implements IGTTool { protected final boolean playSoundOnBlockDestroy; protected final Supplier markerItem; - protected ItemGTHoe(String domain, String id, int tier, IGTToolDefinition toolStats, SoundEvent sound, boolean playSoundOnBlockDestroy, Set toolClasses, String oreDict, List secondaryOreDicts, Supplier markerItem) { + protected ItemGTHoe(String domain, String id, int tier, IGTToolDefinition toolStats, SoundEvent sound, + boolean playSoundOnBlockDestroy, Set toolClasses, String oreDict, + List secondaryOreDicts, Supplier markerItem) { super(ToolMaterial.STONE); this.domain = domain; this.id = id; @@ -130,12 +135,14 @@ public float getDestroySpeed(@Nonnull ItemStack stack, @Nonnull IBlockState stat } @Override - public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$onBlockStartBreak(itemstack, pos, player); } @Override - public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { + public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { return definition$onBlockDestroyed(stack, worldIn, state, pos, entityLiving); } @@ -151,12 +158,14 @@ public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack r @Nonnull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, + @Nonnull ItemStack stack) { return definition$getAttributeModifiers(slot, stack); } @Override - public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { + public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, + @Nullable IBlockState blockState) { return definition$getHarvestLevel(stack, toolClass, player, blockState); } @@ -167,12 +176,14 @@ public Set getToolClasses(@Nonnull ItemStack stack) { } @Override - public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { + public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, + @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { return definition$canDisableShield(stack, shield, entity, attacker); } @Override - public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$doesSneakBypassUse(stack, world, pos, player); } @@ -198,12 +209,14 @@ public boolean onEntitySwing(@Nonnull EntityLivingBase entityLiving, @Nonnull It } @Override - public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, @Nonnull EntityPlayer player) { + public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, + @Nonnull EntityPlayer player) { return definition$canDestroyBlockInCreative(world, pos, stack, player); } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, boolean slotChanged) { + public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + boolean slotChanged) { return definition$shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } @@ -245,19 +258,23 @@ public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable @Nonnull @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { return definition$onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); } @Nonnull @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, + @Nonnull EnumHand hand) { return definition$onItemRightClick(world, player, hand); } @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { definition$addInformation(stack, world, tooltip, flag); } @@ -281,7 +298,9 @@ public String getMaterialName() { @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { // try to do the vanilla hoe behavior first EnumActionResult result = super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ); if (result == EnumActionResult.SUCCESS) return EnumActionResult.SUCCESS; @@ -289,7 +308,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w } @Override - public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, @Nonnull EntityLivingBase attacker) { + public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, + @Nonnull EntityLivingBase attacker) { getToolStats().getBehaviors().forEach(behavior -> behavior.hitEntity(stack, target, attacker)); // damage by 1, as this is what vanilla does ToolHelper.damageItem(stack, attacker, 1); @@ -309,7 +329,8 @@ public Builder(@Nonnull String domain, @Nonnull String id) { @Override public Supplier supply() { - return () -> new ItemGTHoe(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, oreDict, secondaryOreDicts, markerItem); + return () -> new ItemGTHoe(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, + oreDict, secondaryOreDicts, markerItem); } } } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTSword.java b/src/main/java/gregtech/api/items/toolitem/ItemGTSword.java index de3a327d086..9f71e5a5f46 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTSword.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTSword.java @@ -1,8 +1,8 @@ package gregtech.api.items.toolitem; -import com.google.common.collect.Multimap; import gregtech.api.GregTechAPI; import gregtech.api.util.LocalizationUtils; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; @@ -22,13 +22,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.Multimap; + import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class ItemGTSword extends ItemSword implements IGTTool { private final String domain; @@ -135,17 +138,20 @@ public float getDestroySpeed(@Nonnull ItemStack stack, @Nonnull IBlockState stat } @Override - public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, @Nonnull EntityLivingBase attacker) { + public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, + @Nonnull EntityLivingBase attacker) { return definition$hitEntity(stack, target, attacker); } @Override - public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$onBlockStartBreak(itemstack, pos, player); } @Override - public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { + public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { return definition$onBlockDestroyed(stack, worldIn, state, pos, entityLiving); } @@ -165,18 +171,21 @@ public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack r } @Override - public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, @Nonnull EntityPlayer player) { + public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, + @Nonnull EntityPlayer player) { return false; } @Nonnull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, + @Nonnull ItemStack stack) { return definition$getAttributeModifiers(slot, stack); } @Override - public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { + public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, + @Nullable IBlockState blockState) { return definition$getHarvestLevel(stack, toolClass, player, blockState); } @@ -187,12 +196,14 @@ public Set getToolClasses(@Nonnull ItemStack stack) { } @Override - public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { + public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, + @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { return definition$canDisableShield(stack, shield, entity, attacker); } @Override - public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$doesSneakBypassUse(stack, world, pos, player); } @@ -218,7 +229,8 @@ public boolean onEntitySwing(@Nonnull EntityLivingBase entityLiving, @Nonnull It } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, boolean slotChanged) { + public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + boolean slotChanged) { return definition$shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } @@ -260,20 +272,24 @@ public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { return definition$onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); } @Nonnull @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, + @Nonnull EnumHand hand) { // do not utilize IGTTool method to prevent a config gui from appearing return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand)); } @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { definition$addInformation(stack, world, tooltip, flag); } @@ -300,7 +316,8 @@ public Builder(@Nonnull String domain, @Nonnull String id) { @Override public Supplier supply() { - return () -> new ItemGTSword(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, oreDict, secondaryOreDicts, markerItem); + return () -> new ItemGTSword(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, + oreDict, secondaryOreDicts, markerItem); } } } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTTool.java b/src/main/java/gregtech/api/items/toolitem/ItemGTTool.java index 559032a6885..7fcd5a9d896 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTTool.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTTool.java @@ -1,8 +1,8 @@ package gregtech.api.items.toolitem; -import com.google.common.collect.Multimap; import gregtech.api.GregTechAPI; import gregtech.api.util.LocalizationUtils; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; @@ -22,13 +22,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.Multimap; + import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * GT-styled ItemTool (generic tool item). *

@@ -47,8 +50,10 @@ public class ItemGTTool extends ItemTool implements IGTTool { protected final boolean playSoundOnBlockDestroy; protected final Supplier markerItem; - protected ItemGTTool(String domain, String id, int tier, IGTToolDefinition toolStats, SoundEvent sound, boolean playSoundOnBlockDestroy, - Set toolClasses, String oreDict, List secondaryOreDicts, Supplier markerItem) { + protected ItemGTTool(String domain, String id, int tier, IGTToolDefinition toolStats, SoundEvent sound, + boolean playSoundOnBlockDestroy, + Set toolClasses, String oreDict, List secondaryOreDicts, + Supplier markerItem) { super(0F, 0F, ToolMaterial.STONE, Collections.emptySet()); this.domain = domain; this.id = id; @@ -136,17 +141,20 @@ public float getDestroySpeed(@Nonnull ItemStack stack, @Nonnull IBlockState stat } @Override - public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, @Nonnull EntityLivingBase attacker) { + public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, + @Nonnull EntityLivingBase attacker) { return definition$hitEntity(stack, target, attacker); } @Override - public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$onBlockStartBreak(itemstack, pos, player); } @Override - public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { + public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { return definition$onBlockDestroyed(stack, worldIn, state, pos, entityLiving); } @@ -162,12 +170,14 @@ public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack r @Nonnull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, + @Nonnull ItemStack stack) { return definition$getAttributeModifiers(slot, stack); } @Override - public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { + public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, + @Nullable IBlockState blockState) { return definition$getHarvestLevel(stack, toolClass, player, blockState); } @@ -178,12 +188,14 @@ public Set getToolClasses(@Nonnull ItemStack stack) { } @Override - public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { + public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, + @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { return definition$canDisableShield(stack, shield, entity, attacker); } @Override - public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$doesSneakBypassUse(stack, world, pos, player); } @@ -209,12 +221,14 @@ public boolean onEntitySwing(@Nonnull EntityLivingBase entityLiving, @Nonnull It } @Override - public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, @Nonnull EntityPlayer player) { + public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, + @Nonnull EntityPlayer player) { return definition$canDestroyBlockInCreative(world, pos, stack, player); } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, boolean slotChanged) { + public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + boolean slotChanged) { return definition$shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } @@ -256,25 +270,31 @@ public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable @Nonnull @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { return definition$onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); } @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { return definition$onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); } @Nonnull @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, + @Nonnull EnumHand hand) { return definition$onItemRightClick(world, player, hand); } @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { definition$addInformation(stack, world, tooltip, flag); } @@ -301,7 +321,8 @@ public Builder(@Nonnull String domain, @Nonnull String id) { @Override public Supplier supply() { - return () -> new ItemGTTool(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, oreDict, secondaryOreDicts, markerItem); + return () -> new ItemGTTool(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, + oreDict, secondaryOreDicts, markerItem); } } } diff --git a/src/main/java/gregtech/api/items/toolitem/ToolBuilder.java b/src/main/java/gregtech/api/items/toolitem/ToolBuilder.java index 319a5f16c27..073e689451b 100644 --- a/src/main/java/gregtech/api/items/toolitem/ToolBuilder.java +++ b/src/main/java/gregtech/api/items/toolitem/ToolBuilder.java @@ -1,14 +1,16 @@ package gregtech.api.items.toolitem; -import it.unimi.dsi.fastutil.objects.ObjectArraySet; import net.minecraft.item.ItemStack; import net.minecraft.util.SoundEvent; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.ObjectArraySet; + import java.util.*; import java.util.function.Supplier; import java.util.function.UnaryOperator; +import javax.annotation.Nonnull; + public abstract class ToolBuilder { protected final String domain, id; @@ -102,11 +104,11 @@ public T build() { } IGTTool existing = ToolHelper.getToolFromSymbol(this.symbol); if (existing != null) { - throw new IllegalArgumentException(String.format("Symbol %s has been taken by %s already!", symbol, existing)); + throw new IllegalArgumentException( + String.format("Symbol %s has been taken by %s already!", symbol, existing)); } T supplied = supply().get(); ToolHelper.registerToolSymbol(this.symbol, supplied); return supplied; } - } diff --git a/src/main/java/gregtech/api/items/toolitem/ToolDefinitionBuilder.java b/src/main/java/gregtech/api/items/toolitem/ToolDefinitionBuilder.java index 797e0fa8e6e..655f97eb148 100644 --- a/src/main/java/gregtech/api/items/toolitem/ToolDefinitionBuilder.java +++ b/src/main/java/gregtech/api/items/toolitem/ToolDefinitionBuilder.java @@ -1,9 +1,8 @@ package gregtech.api.items.toolitem; -import com.google.common.collect.ImmutableList; import gregtech.api.items.toolitem.aoe.AoESymmetrical; import gregtech.api.items.toolitem.behavior.IToolBehavior; -import it.unimi.dsi.fastutil.objects.*; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -11,6 +10,9 @@ import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.item.ItemStack; +import com.google.common.collect.ImmutableList; +import it.unimi.dsi.fastutil.objects.*; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -190,7 +192,6 @@ public ToolDefinitionBuilder defaultEnchantment(Enchantment enchantment, double return this; } - public IGTToolDefinition build() { return new IGTToolDefinition() { @@ -229,9 +230,11 @@ public IGTToolDefinition build() { effectiveStatePredicate.or(state -> effectiveMaterials.contains(state.getMaterial())); } if (effectiveStates != null) { - effectiveStatePredicate = effectiveStatePredicate == null ? effectiveStates : effectiveStatePredicate.or(effectiveStates); + effectiveStatePredicate = effectiveStatePredicate == null ? effectiveStates : + effectiveStatePredicate.or(effectiveStates); } - this.effectiveStatePredicate = effectiveStatePredicate == null ? state -> false : effectiveStatePredicate; + this.effectiveStatePredicate = effectiveStatePredicate == null ? state -> false : + effectiveStatePredicate; } @Override @@ -335,5 +338,4 @@ public AoESymmetrical getAoEDefinition(ItemStack stack) { } }; } - } diff --git a/src/main/java/gregtech/api/items/toolitem/ToolHelper.java b/src/main/java/gregtech/api/items/toolitem/ToolHelper.java index 52423c510f7..ffd5ee89594 100644 --- a/src/main/java/gregtech/api/items/toolitem/ToolHelper.java +++ b/src/main/java/gregtech/api/items/toolitem/ToolHelper.java @@ -1,8 +1,5 @@ package gregtech.api.items.toolitem; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.ImmutableSet; import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IElectricItem; @@ -19,8 +16,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; import gregtech.tools.enchants.EnchantmentHardHammer; -import it.unimi.dsi.fastutil.objects.ObjectArraySet; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.block.*; import net.minecraft.block.state.IBlockState; @@ -50,14 +46,21 @@ import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.ImmutableSet; +import it.unimi.dsi.fastutil.objects.ObjectArraySet; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.reflect.Method; import java.util.*; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.LV; import static gregtech.api.GTValues.V; @@ -115,11 +118,23 @@ public final class ToolHelper { private static final BiMap symbols = HashBiMap.create(); // Effective Vanilla Blocks - public static final Set PICKAXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE); - public static final Set STONE_PICKAXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE); - public static final Set IRON_PICKAXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.EMERALD_ORE, Blocks.EMERALD_BLOCK, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE); - public static final Set SHOVEL_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH, Blocks.CONCRETE_POWDER); - public static final Set AXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE); + public static final Set PICKAXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, + Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, + Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, + Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, + Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, + Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, + Blocks.STONE_PRESSURE_PLATE); + public static final Set STONE_PICKAXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.IRON_BLOCK, + Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE); + public static final Set IRON_PICKAXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.DIAMOND_BLOCK, + Blocks.DIAMOND_ORE, Blocks.EMERALD_ORE, Blocks.EMERALD_BLOCK, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE); + public static final Set SHOVEL_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.CLAY, Blocks.DIRT, + Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, + Blocks.SOUL_SAND, Blocks.GRASS_PATH, Blocks.CONCRETE_POWDER); + public static final Set AXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, + Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, + Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE); // Suppliers for broken tool stacks public static final Supplier SUPPLY_POWER_UNIT_LV = () -> MetaItems.POWER_UNIT_LV.getStackForm(); @@ -136,7 +151,8 @@ public final class ToolHelper { // archaic way to get around access violations for method handles. // this was improved in Java 9 with MethodHandles.privateLookupIn(), // but that does not exist in Java 8, so we have to unreflect instead. - Method method = ObfuscationReflectionHelper.findMethod(Block.class, "func_180643_i", ItemStack.class, IBlockState.class); + Method method = ObfuscationReflectionHelper.findMethod(Block.class, "func_180643_i", ItemStack.class, + IBlockState.class); method.setAccessible(true); GET_SILK_TOUCH_DROP = MethodHandles.lookup().unreflect(method); method.setAccessible(false); @@ -176,7 +192,8 @@ public static NBTTagCompound getBehaviorsTag(ItemStack stack) { return stack.getOrCreateSubCompound(BEHAVIOURS_TAG_KEY); } - public static ItemStack getAndSetToolData(IGTTool tool, Material material, int maxDurability, int harvestLevel, float toolSpeed, float attackDamage) { + public static ItemStack getAndSetToolData(IGTTool tool, Material material, int maxDurability, int harvestLevel, + float toolSpeed, float attackDamage) { ItemStack stack = tool.getRaw(); GTUtility.getOrCreateNbtCompound(stack).setInteger(HIDE_FLAGS, 2); NBTTagCompound toolTag = getToolTag(stack); @@ -208,7 +225,8 @@ public static void damageItemWhenCrafting(@Nonnull ItemStack stack, @Nullable En if (stack.getItem() instanceof IGTTool) { damage = ((IGTTool) stack.getItem()).getToolStats().getToolDamagePerCraft(stack); } else { - if (OreDictUnifier.getOreDictionaryNames(stack).stream().anyMatch(s -> s.startsWith("tool") || s.startsWith("craftingTool"))) { + if (OreDictUnifier.getOreDictionaryNames(stack).stream() + .anyMatch(s -> s.startsWith("tool") || s.startsWith("craftingTool"))) { damage = 1; } } @@ -248,14 +266,17 @@ public static void damageItem(@Nonnull ItemStack stack, @Nullable EntityLivingBa Random random = entity == null ? GTValues.RNG : entity.getRNG(); if (tool.isElectric()) { int electricDamage = damage * ConfigHolder.machines.energyUsageMultiplier; - IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (electricItem != null) { electricItem.discharge(electricDamage, tool.getElectricTier(), true, false, false); - if (electricItem.getCharge() > 0 && random.nextInt(100) > ConfigHolder.tools.rngDamageElectricTools) { + if (electricItem.getCharge() > 0 && + random.nextInt(100) > ConfigHolder.tools.rngDamageElectricTools) { return; } } else { - throw new IllegalStateException("Electric tool does not have an attached electric item capability."); + throw new IllegalStateException( + "Electric tool does not have an attached electric item capability."); } } int unbreakingLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.UNBREAKING, stack); @@ -303,7 +324,8 @@ public static void onActionDone(@Nonnull EntityPlayer player, @Nonnull World wor IGTTool tool = (IGTTool) stack.getItem(); ToolHelper.damageItem(stack, player); if (tool.getSound() != null) { - world.playSound(null, player.posX, player.posY, player.posZ, tool.getSound(), SoundCategory.PLAYERS, 1.0F, 1.0F); + world.playSound(null, player.posX, player.posY, player.posZ, tool.getSound(), SoundCategory.PLAYERS, 1.0F, + 1.0F); } player.swingArm(hand); } @@ -374,7 +396,8 @@ public static boolean areaOfEffectBlockBreakRoutine(ItemStack stack, EntityPlaye } remainingUses--; - if (stack.getItem() instanceof IGTTool && !((IGTTool) stack.getItem()).isElectric() && remainingUses == 0) { + if (stack.getItem() instanceof IGTTool && !((IGTTool) stack.getItem()).isElectric() && + remainingUses == 0) { return true; } // If the tool is an electric tool, catch the tool breaking and cancel the remaining AOE @@ -387,8 +410,11 @@ else if (!player.getHeldItemMainhand().isItemEqualIgnoreDurability(stack)) { return false; } - public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefinition, World world, EntityPlayer player, RayTraceResult rayTraceResult, QuintFunction function) { - if (aoeDefinition != AoESymmetrical.none() && rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && rayTraceResult.sideHit != null) { + public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefinition, World world, + EntityPlayer player, RayTraceResult rayTraceResult, + QuintFunction function) { + if (aoeDefinition != AoESymmetrical.none() && rayTraceResult != null && + rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && rayTraceResult.sideHit != null) { int column = aoeDefinition.column; int row = aoeDefinition.row; int layer = aoeDefinition.layer; @@ -405,7 +431,8 @@ public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefini for (int z = isX ? -column : -row; z <= (isX ? column : row); z++) { if (!(x == 0 && y == 0 && z == 0)) { BlockPos pos = rayTraceResult.getBlockPos().add(x, isDown ? y : -y, z); - if (player.canPlayerEdit(pos.offset(rayTraceResult.sideHit), rayTraceResult.sideHit, stack)) { + if (player.canPlayerEdit(pos.offset(rayTraceResult.sideHit), rayTraceResult.sideHit, + stack)) { if (function.apply(stack, world, player, pos, rayTraceResult.getBlockPos())) { validPositions.add(pos); } @@ -423,7 +450,9 @@ public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefini for (int y = (row == 0 ? 0 : -1); y <= (row == 0 ? 0 : row * 2 - 1); y++) { for (int z = -column; z <= column; z++) { if (!(x == 0 && y == 0 && z == 0)) { - BlockPos pos = rayTraceResult.getBlockPos().add(isX ? (isNegative ? x : -x) : (isNegative ? z : -z), y, isX ? (isNegative ? z : -z) : (isNegative ? x : -x)); + BlockPos pos = rayTraceResult.getBlockPos().add( + isX ? (isNegative ? x : -x) : (isNegative ? z : -z), y, + isX ? (isNegative ? z : -z) : (isNegative ? x : -x)); if (function.apply(stack, world, player, pos, rayTraceResult.getBlockPos())) { validPositions.add(pos); } @@ -437,18 +466,21 @@ public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefini return Collections.emptySet(); } - public static Set getHarvestableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, World world, EntityPlayer player, RayTraceResult rayTraceResult) { + public static Set getHarvestableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, World world, + EntityPlayer player, RayTraceResult rayTraceResult) { return iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, ToolHelper::isBlockAoEHarvestable); } - private static boolean isBlockAoEHarvestable(ItemStack stack, World world, EntityPlayer player, BlockPos pos, BlockPos hitBlockPos) { + private static boolean isBlockAoEHarvestable(ItemStack stack, World world, EntityPlayer player, BlockPos pos, + BlockPos hitBlockPos) { if (world.isAirBlock(pos)) return false; IBlockState state = world.getBlockState(pos); if (state.getBlock() instanceof BlockLiquid) return false; IBlockState hitBlockState = world.getBlockState(hitBlockPos); - if (state.getBlockHardness(world, pos) < 0 || state.getBlockHardness(world, pos) - hitBlockState.getBlockHardness(world, hitBlockPos) > 8) { + if (state.getBlockHardness(world, pos) < 0 || + state.getBlockHardness(world, pos) - hitBlockState.getBlockHardness(world, hitBlockPos) > 8) { // If mining a block takes significantly longer than the center block, do not mine it. // Originally this was just a check for if it is at all harder of a block, however that // would cause some annoyances, like Grass Block not being broken if a Dirt Block was the @@ -484,7 +516,8 @@ public static boolean isToolEffective(IBlockState state, Set toolClasses if (PICKAXE_HARVESTABLE_BLOCKS.contains(block)) return true; if (material == net.minecraft.block.material.Material.ROCK || material == net.minecraft.block.material.Material.IRON || - material == net.minecraft.block.material.Material.ANVIL) return true; + material == net.minecraft.block.material.Material.ANVIL) + return true; } if (toolClasses.contains(ToolClasses.SHOVEL)) { if (SHOVEL_HARVESTABLE_BLOCKS.contains(block)) return true; @@ -494,7 +527,8 @@ public static boolean isToolEffective(IBlockState state, Set toolClasses if (AXE_HARVESTABLE_BLOCKS.contains(block)) return true; if (material == net.minecraft.block.material.Material.WOOD || material == net.minecraft.block.material.Material.PLANTS || - material == net.minecraft.block.material.Material.VINE) return true; + material == net.minecraft.block.material.Material.VINE) + return true; } if (toolClasses.contains(ToolClasses.SWORD)) { if (block instanceof BlockWeb) return true; @@ -502,7 +536,8 @@ public static boolean isToolEffective(IBlockState state, Set toolClasses material == net.minecraft.block.material.Material.VINE || material == net.minecraft.block.material.Material.CORAL || material == net.minecraft.block.material.Material.LEAVES || - material == net.minecraft.block.material.Material.GOURD) return true; + material == net.minecraft.block.material.Material.GOURD) + return true; } if (toolClasses.contains(ToolClasses.SCYTHE)) { if (material == net.minecraft.block.material.Material.LEAVES || @@ -547,7 +582,8 @@ public static float getDestroySpeed(IBlockState state, Set toolClasses) return -1; } - public static Set getHarvestableBlocks(ItemStack stack, World world, EntityPlayer player, RayTraceResult rayTraceResult) { + public static Set getHarvestableBlocks(ItemStack stack, World world, EntityPlayer player, + RayTraceResult rayTraceResult) { return getHarvestableBlocks(stack, getAoEDefinition(stack), world, player, rayTraceResult); } @@ -562,7 +598,6 @@ public static Set getHarvestableBlocks(ItemStack stack, EntityPlayer p } public static RayTraceResult getPlayerDefaultRaytrace(@Nonnull EntityPlayer player) { - Vec3d lookPos = player.getPositionEyes(1F); Vec3d rotation = player.getLook(1); Vec3d realLookPos = lookPos.add(rotation.x * 5, rotation.y * 5, rotation.z * 5); @@ -588,14 +623,17 @@ public static void treeFellingRoutine(EntityPlayerMP player, ItemStack stack, Bl /** * Applies Forge Hammer recipes to block broken, used for hammers or tools with hard hammer enchant applied. */ - public static void applyHammerDropConversion(ItemStack tool, IBlockState state, List drops, int fortune, float dropChance, Random random) { - if (tool.getItem().getToolClasses(tool).contains(ToolClasses.HARD_HAMMER) || EnchantmentHelper.getEnchantmentLevel(EnchantmentHardHammer.INSTANCE, tool) > 0) { + public static void applyHammerDropConversion(ItemStack tool, IBlockState state, List drops, int fortune, + float dropChance, Random random) { + if (tool.getItem().getToolClasses(tool).contains(ToolClasses.HARD_HAMMER) || + EnchantmentHelper.getEnchantmentLevel(EnchantmentHardHammer.INSTANCE, tool) > 0) { ItemStack silktouchDrop = getSilkTouchDrop(state); if (!silktouchDrop.isEmpty()) { // Stack lists can be immutable going into Recipe#matches barring no rewrites List dropAsList = Collections.singletonList(silktouchDrop); // Search for forge hammer recipes from all drops individually (only LV or under) - Recipe hammerRecipe = RecipeMaps.FORGE_HAMMER_RECIPES.findRecipe(V[LV], dropAsList, Collections.emptyList(), false); + Recipe hammerRecipe = RecipeMaps.FORGE_HAMMER_RECIPES.findRecipe(V[LV], dropAsList, + Collections.emptyList(), false); if (hammerRecipe != null && hammerRecipe.matches(true, dropAsList, Collections.emptyList())) { drops.clear(); OrePrefix prefix = OreDictUnifier.getPrefix(silktouchDrop); @@ -678,7 +716,8 @@ public static int shearBlockRoutine(EntityPlayerMP player, ItemStack tool, Block if (state.getBlock() instanceof IShearable) { IShearable shearable = (IShearable) state.getBlock(); if (shearable.isShearable(tool, world, pos)) { - List shearedDrops = shearable.onSheared(tool, world, pos, EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, tool)); + List shearedDrops = shearable.onSheared(tool, world, pos, + EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, tool)); boolean relocateMinedBlocks = getBehaviorsTag(tool).getBoolean(RELOCATE_MINED_BLOCKS_KEY); Iterator iter = shearedDrops.iterator(); while (iter.hasNext()) { @@ -690,7 +729,8 @@ public static int shearBlockRoutine(EntityPlayerMP player, ItemStack tool, Block double xo = world.rand.nextFloat() * f + 0.15D; double yo = world.rand.nextFloat() * f + 0.15D; double zo = world.rand.nextFloat() * f + 0.15D; - EntityItem entityItem = new EntityItem(world, pos.getX() + xo, pos.getY() + yo, pos.getZ() + zo, stack); + EntityItem entityItem = new EntityItem(world, pos.getX() + xo, pos.getY() + yo, + pos.getZ() + zo, stack); entityItem.setDefaultPickupDelay(); player.world.spawnEntity(entityItem); } @@ -705,7 +745,8 @@ public static int shearBlockRoutine(EntityPlayerMP player, ItemStack tool, Block return -1; } - public static boolean removeBlockRoutine(@Nullable IBlockState state, World world, EntityPlayerMP player, BlockPos pos, boolean canHarvest) { + public static boolean removeBlockRoutine(@Nullable IBlockState state, World world, EntityPlayerMP player, + BlockPos pos, boolean canHarvest) { state = state == null ? world.getBlockState(pos) : state; boolean successful = state.getBlock().removedByPlayer(state, world, pos, player, canHarvest); if (successful) { @@ -731,6 +772,5 @@ public static void playToolSound(ItemStack stack, EntityPlayer player) { if (stack.getItem() instanceof IGTTool) { ((IGTTool) stack.getItem()).playSound(player); } - } } diff --git a/src/main/java/gregtech/api/items/toolitem/TreeFellingListener.java b/src/main/java/gregtech/api/items/toolitem/TreeFellingListener.java index 525807639cb..2a73aac9dd3 100644 --- a/src/main/java/gregtech/api/items/toolitem/TreeFellingListener.java +++ b/src/main/java/gregtech/api/items/toolitem/TreeFellingListener.java @@ -1,6 +1,5 @@ package gregtech.api.items.toolitem; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayerMP; @@ -12,10 +11,13 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.*; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public final class TreeFellingListener { private final EntityPlayerMP player; @@ -28,7 +30,8 @@ private TreeFellingListener(EntityPlayerMP player, ItemStack tool, Deque onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) { + default ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, + @Nonnull EnumHand hand) { return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } @SideOnly(Side.CLIENT) - default void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { - } + default void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) {} /** * Add the necessary NBT information to the tool + * * @param stack the tool * @param tag the nbt tag to add to */ - default void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag) { - } + default void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag) {} /** * Add a capability to a tool. * Recommended to only use this if no other options exist. + * * @param stack the tool * @param tag the capability nbt of the item */ diff --git a/src/main/java/gregtech/api/metatileentity/IDataInfoProvider.java b/src/main/java/gregtech/api/metatileentity/IDataInfoProvider.java index dcfe757a01f..4991ba06cd0 100644 --- a/src/main/java/gregtech/api/metatileentity/IDataInfoProvider.java +++ b/src/main/java/gregtech/api/metatileentity/IDataInfoProvider.java @@ -1,11 +1,11 @@ package gregtech.api.metatileentity; - import net.minecraft.util.text.ITextComponent; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public interface IDataInfoProvider { @Nonnull diff --git a/src/main/java/gregtech/api/metatileentity/IFastRenderMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/IFastRenderMetaTileEntity.java index 41f9dd0b2d2..d8bd451ee29 100644 --- a/src/main/java/gregtech/api/metatileentity/IFastRenderMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/IFastRenderMetaTileEntity.java @@ -1,11 +1,12 @@ package gregtech.api.metatileentity; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.vec.Matrix4; import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.vec.Matrix4; + public interface IFastRenderMetaTileEntity { int RENDER_PASS_NORMAL = 0; @@ -15,9 +16,7 @@ public interface IFastRenderMetaTileEntity { default void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) {} @SideOnly(Side.CLIENT) - default void renderMetaTileEntity(double x, double y, double z, float partialTicks) { - - } + default void renderMetaTileEntity(double x, double y, double z, float partialTicks) {} AxisAlignedBB getRenderBoundingBox(); diff --git a/src/main/java/gregtech/api/metatileentity/IMachineHatchMultiblock.java b/src/main/java/gregtech/api/metatileentity/IMachineHatchMultiblock.java index 372fc3382a6..b942a132b38 100644 --- a/src/main/java/gregtech/api/metatileentity/IMachineHatchMultiblock.java +++ b/src/main/java/gregtech/api/metatileentity/IMachineHatchMultiblock.java @@ -3,7 +3,8 @@ public interface IMachineHatchMultiblock { /** - * @return a String array of blacklisted RecipeMaps for the {@link gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMachineHatch} + * @return a String array of blacklisted RecipeMaps for the + * {@link gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMachineHatch} */ default String[] getBlacklist() { return new String[0]; diff --git a/src/main/java/gregtech/api/metatileentity/IVoidable.java b/src/main/java/gregtech/api/metatileentity/IVoidable.java index 62879b47428..16d60b6e3c7 100644 --- a/src/main/java/gregtech/api/metatileentity/IVoidable.java +++ b/src/main/java/gregtech/api/metatileentity/IVoidable.java @@ -10,7 +10,8 @@ public interface IVoidable { boolean canVoidRecipeFluidOutputs(); - // -1 is taken into account as a skip case. I would have passed Integer.MAX_VALUE, but that would have been bad for some sublisting stuff + // -1 is taken into account as a skip case. I would have passed Integer.MAX_VALUE, but that would have been bad for + // some sublisting stuff default int getItemOutputLimit() { return -1; } @@ -20,6 +21,7 @@ default int getFluidOutputLimit() { } enum VoidingMode implements IStringSerializable { + VOID_NONE("gregtech.gui.multiblock_no_voiding"), VOID_ITEMS("gregtech.gui.multiblock_item_voiding"), VOID_FLUIDS("gregtech.gui.multiblock_fluid_voiding"), @@ -39,5 +41,4 @@ public String getName() { return localeName; } } - } diff --git a/src/main/java/gregtech/api/metatileentity/MTETrait.java b/src/main/java/gregtech/api/metatileentity/MTETrait.java index ec5a8b354ee..3cc461e5c97 100644 --- a/src/main/java/gregtech/api/metatileentity/MTETrait.java +++ b/src/main/java/gregtech/api/metatileentity/MTETrait.java @@ -1,12 +1,14 @@ package gregtech.api.metatileentity; import gregtech.api.metatileentity.interfaces.ISyncedTileEntity; -import it.unimi.dsi.fastutil.objects.Object2IntFunction; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; + +import it.unimi.dsi.fastutil.objects.Object2IntFunction; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -64,19 +66,16 @@ public final int getNetworkID() { public abstract T getCapability(Capability capability); - public void onFrontFacingSet(EnumFacing newFrontFacing) { - } + public void onFrontFacingSet(EnumFacing newFrontFacing) {} - public void update() { - } + public void update() {} @NotNull public NBTTagCompound serializeNBT() { return new NBTTagCompound(); } - public void deserializeNBT(@NotNull NBTTagCompound compound) { - } + public void deserializeNBT(@NotNull NBTTagCompound compound) {} @Override public void writeInitialSyncData(@NotNull PacketBuffer buf) {} diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index b05b5790c7b..1412a674817 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -1,17 +1,5 @@ package gregtech.api.metatileentity; -import appeng.api.util.AECableType; -import appeng.api.util.AEPartLocation; -import appeng.me.helpers.AENetworkProxy; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import com.google.common.base.Preconditions; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.block.machines.BlockMachine; @@ -34,16 +22,13 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.Block; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; @@ -69,6 +54,22 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; + +import appeng.api.util.AECableType; +import appeng.api.util.AEPartLocation; +import appeng.me.helpers.AENetworkProxy; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import com.google.common.base.Preconditions; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; @@ -188,12 +189,11 @@ public final void writeCustomData(int discriminator, @NotNull Consumer<@NotNull } } - public void addDebugInfo(List list) { - } + public void addDebugInfo(List list) {} @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { - } + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) {} /** * Override this to add extended tool information to the "Hold SHIFT to show Tool Info" tooltip section. @@ -255,9 +255,11 @@ public void setRenderContextStack(ItemStack itemStack) { @SideOnly(Side.CLIENT) public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { TextureAtlasSprite atlasSprite = TextureUtils.getMissingSprite(); - IVertexOperation[] renderPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] renderPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); for (EnumFacing face : EnumFacing.VALUES) { - Textures.renderFace(renderState, translation, renderPipeline, face, Cuboid6.full, atlasSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, renderPipeline, face, Cuboid6.full, atlasSprite, + BlockRenderLayer.CUTOUT_MIPPED); } } @@ -265,7 +267,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, public boolean canRenderInLayer(BlockRenderLayer renderLayer) { return renderLayer == BlockRenderLayer.CUTOUT_MIPPED || renderLayer == BloomEffectUtil.getEffectiveBloomLayer() || - (renderLayer == BlockRenderLayer.TRANSLUCENT && !getWorld().getBlockState(getPos()).getValue(BlockMachine.OPAQUE)); + (renderLayer == BlockRenderLayer.TRANSLUCENT && + !getWorld().getBlockState(getPos()).getValue(BlockMachine.OPAQUE)); } @Override @@ -285,17 +288,14 @@ public int getPaintingColorForRendering() { * This method is typically used by torches or nether portals, as an example use-case */ @SideOnly(Side.CLIENT) - public void randomDisplayTick() { - - } + public void randomDisplayTick() {} /** * Called from ItemBlock to initialize this MTE with data contained in ItemStack * * @param itemStack itemstack of itemblock */ - public void initFromItemStackData(NBTTagCompound itemStack) { - } + public void initFromItemStackData(NBTTagCompound itemStack) {} /** * Called to write MTE specific data when it is destroyed to save it's state @@ -303,8 +303,7 @@ public void initFromItemStackData(NBTTagCompound itemStack) { * * @param itemStack itemstack from which this MTE is being placed */ - public void writeItemStackData(NBTTagCompound itemStack) { - } + public void writeItemStackData(NBTTagCompound itemStack) {} public void getSubItems(CreativeTabs creativeTab, NonNullList subItems) { subItems.add(getStackForm()); @@ -317,7 +316,8 @@ public void getSubItems(CreativeTabs creativeTab, NonNullList subItem * * @param creativeTab The creative tab to check * @return Whether this MTE belongs in the creative tab or not - * @see gregtech.api.block.machines.MachineItemBlock#addCreativeTab(CreativeTabs) MachineItemBlock#addCreativeTab(CreativeTabs) + * @see gregtech.api.block.machines.MachineItemBlock#addCreativeTab(CreativeTabs) + * MachineItemBlock#addCreativeTab(CreativeTabs) */ public boolean isInCreativeTab(CreativeTabs creativeTab) { return creativeTab == CreativeTabs.SEARCH || creativeTab == GregTechAPI.TAB_GREGTECH_MACHINES; @@ -430,7 +430,8 @@ public final void onCoverLeftClick(EntityPlayer playerIn, CuboidRayTraceResult r * * @return true if something happened, so animation will be played */ - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { ItemStack heldStack = playerIn.getHeldItem(hand); if (!playerIn.isSneaking() && openGUIOnRightClick()) { if (getWorld() != null && !getWorld().isRemote) { @@ -440,7 +441,8 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac } else { // Attempt to rename the MTE first if (heldStack.getItem() == Items.NAME_TAG) { - if (playerIn.isSneaking() && heldStack.getTagCompound() != null && heldStack.getTagCompound().hasKey("display")) { + if (playerIn.isSneaking() && heldStack.getTagCompound() != null && + heldStack.getTagCompound().hasKey("display")) { MetaTileEntityHolder mteHolder = (MetaTileEntityHolder) getHolder(); mteHolder.setCustomName(heldStack.getTagCompound().getCompoundTag("display").getString("Name")); @@ -476,7 +478,8 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac * * @return true if something happened, so tools will get damaged and animations will be played */ - public final boolean onToolClick(EntityPlayer playerIn, @NotNull Set toolClasses, EnumHand hand, CuboidRayTraceResult hitResult) { + public final boolean onToolClick(EntityPlayer playerIn, @NotNull Set toolClasses, EnumHand hand, + CuboidRayTraceResult hitResult) { // the side hit from the machine grid EnumFacing gridSideHit = CoverRayTracer.determineGridSideHit(hitResult); Cover cover = gridSideHit == null ? null : getCoverAtSide(gridSideHit); @@ -509,7 +512,8 @@ public final boolean onToolClick(EntityPlayer playerIn, @NotNull Set too * * @return true if something happened, so the tool will get damaged and animation will be played */ - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, + CuboidRayTraceResult hitResult) { if (!needsSneakToRotate() || playerIn.isSneaking()) { if (wrenchSide == getFrontFacing() || !isValidFrontFacing(wrenchSide) || !hasFrontFacing()) { return false; @@ -527,7 +531,8 @@ public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wr * * @return true if something happened, so the tool will get damaged and animation will be played */ - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { return false; } @@ -536,7 +541,8 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci * * @return true if something happened, so the tool will get damaged and animation will be played */ - public boolean onCrowbarClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onCrowbarClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getCoverAtSide(facing) != null) { removeCover(facing); return true; @@ -549,7 +555,8 @@ public boolean onCrowbarClick(EntityPlayer playerIn, EnumHand hand, EnumFacing f * * @return true if something happened, so the tool will get damaged and animation will be played */ - public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { IControllable controllable = getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, null); if (controllable != null) { controllable.setWorkingEnabled(!controllable.isWorkingEnabled()); @@ -567,7 +574,8 @@ public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacin * * @return true if something happened, so the tool will get damaged and animation will be played */ - public boolean onHardHammerClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onHardHammerClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { toggleMuffled(); if (!getWorld().isRemote) { playerIn.sendStatusMessage(new TextComponentTranslation(isMuffled() ? @@ -576,8 +584,7 @@ public boolean onHardHammerClick(EntityPlayer playerIn, EnumHand hand, EnumFacin return true; } - public void onLeftClick(EntityPlayer player, EnumFacing facing, CuboidRayTraceResult hitResult) { - } + public void onLeftClick(EntityPlayer player, EnumFacing facing, CuboidRayTraceResult hitResult) {} /** * @return true if the player must sneak to rotate this metatileentity, otherwise false @@ -655,12 +662,11 @@ public void onLoad() { } } - public void onUnload() { - } + public void onUnload() {} public final boolean canConnectRedstone(@Nullable EnumFacing side) { - //so far null side means either upwards or downwards redstone wire connection - //so check both top cover and bottom cover + // so far null side means either upwards or downwards redstone wire connection + // so check both top cover and bottom cover if (side == null) { return canConnectRedstone(EnumFacing.UP) || canConnectRedstone(EnumFacing.DOWN); @@ -679,7 +685,7 @@ protected boolean canMachineConnectRedstone(EnumFacing side) { @Override public final int getInputRedstoneSignal(@NotNull EnumFacing side, boolean ignoreCover) { if (!ignoreCover && getCoverAtSide(side) != null) { - return 0; //covers block input redstone signal for machine + return 0; // covers block input redstone signal for machine } return sidedRedstoneInput[side.getIndex()]; } @@ -693,8 +699,7 @@ public final boolean isBlockRedstonePowered() { return false; } - public void onNeighborChanged() { - } + public void onNeighborChanged() {} public void updateInputRedstoneSignals() { for (EnumFacing side : EnumFacing.VALUES) { @@ -711,7 +716,8 @@ public void updateInputRedstoneSignals() { } /** - * @deprecated Will be removed in 2.9. Comparators no longer supported for MetaTileEntities, as cover are interactions favored. + * @deprecated Will be removed in 2.9. Comparators no longer supported for MetaTileEntities, as cover are + * interactions favored. */ @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @Deprecated @@ -805,8 +811,7 @@ public final ItemStack getStackForm() { * @param dropsList list of meta tile entity drops * @param harvester harvester of this meta tile entity, or null */ - public void getDrops(NonNullList dropsList, @Nullable EntityPlayer harvester) { - } + public void getDrops(NonNullList dropsList, @Nullable EntityPlayer harvester) {} public final ItemStack getPickItem(CuboidRayTraceResult result, EntityPlayer player) { IndexedCuboid6 hitCuboid = result.cuboid6; @@ -814,7 +819,7 @@ public final ItemStack getPickItem(CuboidRayTraceResult result, EntityPlayer pla Cover cover = getCoverAtSide(coverSideData.side); return cover == null ? ItemStack.EMPTY : cover.getPickItem(); } else if (hitCuboid.data == null || hitCuboid.data instanceof CoverRayTracer.PrimaryBoxData) { - //data is null -> MetaTileEntity hull hit + // data is null -> MetaTileEntity hull hit Cover cover = getCoverAtSide(result.sideHit); if (cover != null) { return cover.getPickItem(); @@ -938,13 +943,13 @@ public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { } else if (dataId == COVER_ATTACHED_MTE) { CoverSaveHandler.readCoverPlacement(buf, this); } else if (dataId == COVER_REMOVED_MTE) { - //cover removed event + // cover removed event EnumFacing placementSide = EnumFacing.VALUES[buf.readByte()]; this.covers.remove(placementSide); onCoverPlacementUpdate(); scheduleRenderUpdate(); } else if (dataId == UPDATE_COVER_DATA_MTE) { - //cover custom data received + // cover custom data received EnumFacing coverSide = EnumFacing.VALUES[buf.readByte()]; Cover cover = getCoverAtSide(coverSide); int internalId = buf.readVarInt(); @@ -961,7 +966,7 @@ public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { public BlockFaceShape getCoverFaceShape(EnumFacing side) { if (getCoverAtSide(side) != null) { - return BlockFaceShape.SOLID; //covers are always solid + return BlockFaceShape.SOLID; // covers are always solid } return getFaceShape(side); } @@ -985,8 +990,8 @@ public T getCapability(Capability capability, EnumFacing side) { return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(getFluidInventory()); } else if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && getItemInventory().getSlots() > 0) { - return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(getItemInventory()); - } + return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(getItemInventory()); + } T capabilityResult = null; for (MTETrait mteTrait : this.mteTraits.values()) { capabilityResult = mteTrait.getCapability(capability); @@ -997,7 +1002,7 @@ public T getCapability(Capability capability, EnumFacing side) { if (side != null && capabilityResult instanceof IEnergyContainer) { IEnergyContainer energyContainer = (IEnergyContainer) capabilityResult; if (!energyContainer.inputsEnergy(side) && !energyContainer.outputsEnergy(side)) { - return null; //do not provide energy container if it can't input or output energy at all + return null; // do not provide energy container if it can't input or output energy at all } } return capabilityResult; @@ -1010,13 +1015,14 @@ public void fillInternalTankFromFluidContainer() { public void fillInternalTankFromFluidContainer(IFluidHandler fluidHandler) { for (int i = 0; i < importItems.getSlots(); i++) { ItemStack inputContainerStack = importItems.extractItem(i, 1, true); - FluidActionResult result = FluidUtil.tryEmptyContainer(inputContainerStack, fluidHandler, Integer.MAX_VALUE, null, false); + FluidActionResult result = FluidUtil.tryEmptyContainer(inputContainerStack, fluidHandler, Integer.MAX_VALUE, + null, false); if (result.isSuccess()) { ItemStack remainingItem = result.getResult(); if (ItemStack.areItemStacksEqual(inputContainerStack, remainingItem)) - continue; //do not fill if item stacks match + continue; // do not fill if item stacks match if (!remainingItem.isEmpty() && !GTTransferUtils.insertItem(exportItems, remainingItem, true).isEmpty()) - continue; //do not fill if can't put remaining item + continue; // do not fill if can't put remaining item FluidUtil.tryEmptyContainer(inputContainerStack, fluidHandler, Integer.MAX_VALUE, null, true); importItems.extractItem(i, 1, false); GTTransferUtils.insertItem(exportItems, remainingItem, false); @@ -1031,7 +1037,8 @@ public void fillContainerFromInternalTank() { public void fillContainerFromInternalTank(IFluidHandler fluidHandler) { for (int i = 0; i < importItems.getSlots(); i++) { ItemStack emptyContainer = importItems.extractItem(i, 1, true); - FluidActionResult result = FluidUtil.tryFillContainer(emptyContainer, fluidHandler, Integer.MAX_VALUE, null, false); + FluidActionResult result = FluidUtil.tryFillContainer(emptyContainer, fluidHandler, Integer.MAX_VALUE, null, + false); if (result.isSuccess()) { ItemStack remainingItem = result.getResult(); if (!remainingItem.isEmpty() && !GTTransferUtils.insertItem(exportItems, remainingItem, true).isEmpty()) @@ -1044,19 +1051,23 @@ public void fillContainerFromInternalTank(IFluidHandler fluidHandler) { } public void pushFluidsIntoNearbyHandlers(EnumFacing... allowedFaces) { - transferToNearby(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, GTTransferUtils::transferFluids, allowedFaces); + transferToNearby(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, GTTransferUtils::transferFluids, + allowedFaces); } public void pullFluidsFromNearbyHandlers(EnumFacing... allowedFaces) { - transferToNearby(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, (thisCap, otherCap) -> GTTransferUtils.transferFluids(otherCap, thisCap), allowedFaces); + transferToNearby(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + (thisCap, otherCap) -> GTTransferUtils.transferFluids(otherCap, thisCap), allowedFaces); } public void pushItemsIntoNearbyHandlers(EnumFacing... allowedFaces) { - transferToNearby(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, GTTransferUtils::moveInventoryItems, allowedFaces); + transferToNearby(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, GTTransferUtils::moveInventoryItems, + allowedFaces); } public void pullItemsFromNearbyHandlers(EnumFacing... allowedFaces) { - transferToNearby(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, (thisCap, otherCap) -> GTTransferUtils.moveInventoryItems(otherCap, thisCap), allowedFaces); + transferToNearby(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + (thisCap, otherCap) -> GTTransferUtils.moveInventoryItems(otherCap, thisCap), allowedFaces); } private void transferToNearby(Capability capability, BiConsumer transfer, EnumFacing... allowedFaces) { @@ -1066,7 +1077,7 @@ private void transferToNearby(Capability capability, BiConsumer tra continue; } T otherCap = tileEntity.getCapability(capability, nearbyFacing.getOpposite()); - //use getCoverCapability so item/ore dictionary filter covers will work properly + // use getCoverCapability so item/ore dictionary filter covers will work properly T thisCap = getCoverCapability(capability, nearbyFacing); if (otherCap == null || thisCap == null) { continue; @@ -1150,7 +1161,7 @@ public boolean hasFrontFacing() { /** * @return true if this meta tile entity should serialize it's export and import inventories - * Useful when you use your own unified inventory and don't need these dummies to be saved + * Useful when you use your own unified inventory and don't need these dummies to be saved */ protected boolean shouldSerializeInventories() { return true; @@ -1235,17 +1246,14 @@ public int getItemStackLimit(ItemStack stack) { * If placing an MTE with methods such as {@link World#setBlockState(BlockPos, IBlockState)}, * this should be manually called immediately afterwards */ - public void onPlacement() { - - } + public void onPlacement() {} /** * Called from breakBlock right before meta tile entity destruction * at this stage tile entity inventory is already dropped on ground, but drops aren't fetched yet * tile entity will still get getDrops called after this, if player broke block */ - public void onRemoval() { - } + public void onRemoval() {} public void invalidate() { if (getWorld() != null && getWorld().isRemote) { @@ -1367,8 +1375,9 @@ public final AbstractRecipeLogic getRecipeLogic() { if (trait instanceof AbstractRecipeLogic) { return ((AbstractRecipeLogic) trait); } else if (trait != null) { - throw new IllegalStateException("MTE Trait " + trait.getName() + " has name " + GregtechDataCodes.ABSTRACT_WORKABLE_TRAIT + - " but is not instanceof AbstractRecipeLogic"); + throw new IllegalStateException( + "MTE Trait " + trait.getName() + " has name " + GregtechDataCodes.ABSTRACT_WORKABLE_TRAIT + + " but is not instanceof AbstractRecipeLogic"); } return null; } @@ -1382,20 +1391,25 @@ public final RecipeMap getRecipeMap() { return recipeLogic == null ? null : recipeLogic.getRecipeMap(); } - public void checkWeatherOrTerrainExplosion(float explosionPower, double additionalFireChance, IEnergyContainer energyContainer) { + public void checkWeatherOrTerrainExplosion(float explosionPower, double additionalFireChance, + IEnergyContainer energyContainer) { World world = getWorld(); - if (!world.isRemote && ConfigHolder.machines.doTerrainExplosion && !getIsWeatherOrTerrainResistant() && energyContainer.getEnergyStored() != 0) { + if (!world.isRemote && ConfigHolder.machines.doTerrainExplosion && !getIsWeatherOrTerrainResistant() && + energyContainer.getEnergyStored() != 0) { if (GTValues.RNG.nextInt(1000) == 0) { for (EnumFacing side : EnumFacing.VALUES) { Block block = getWorld().getBlockState(getPos().offset(side)).getBlock(); - if (block == Blocks.FIRE || block == Blocks.WATER || block == Blocks.FLOWING_WATER || block == Blocks.LAVA || block == Blocks.FLOWING_LAVA) { + if (block == Blocks.FIRE || block == Blocks.WATER || block == Blocks.FLOWING_WATER || + block == Blocks.LAVA || block == Blocks.FLOWING_LAVA) { doExplosion(explosionPower); return; } } } if (GTValues.RNG.nextInt(1000) == 0) { - if (world.isRainingAt(getPos()) || world.isRainingAt(getPos().east()) || world.isRainingAt(getPos().west()) || world.isRainingAt(getPos().north()) || world.isRainingAt(getPos().south())) { + if (world.isRainingAt(getPos()) || world.isRainingAt(getPos().east()) || + world.isRainingAt(getPos().west()) || world.isRainingAt(getPos().north()) || + world.isRainingAt(getPos().south())) { if (world.isThundering() && GTValues.RNG.nextInt(3) == 0) { doExplosion(explosionPower); } else if (GTValues.RNG.nextInt(10) == 0) { @@ -1457,7 +1471,7 @@ public boolean doTickProfileMessage() { } public boolean canRenderMachineGrid(@NotNull ItemStack mainHandStack, @NotNull ItemStack offHandStack) { - final String[] tools = {ToolClasses.WRENCH, ToolClasses.SCREWDRIVER}; + final String[] tools = { ToolClasses.WRENCH, ToolClasses.SCREWDRIVER }; return ToolHelper.isTool(mainHandStack, tools) || ToolHelper.isTool(offHandStack, tools); } @@ -1489,6 +1503,5 @@ public AENetworkProxy getProxy() { } @Method(modid = GTValues.MODID_APPENG) - public void gridChanged() { - } + public void gridChanged() {} } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java index 8f8b7266275..bfaf3dd00d9 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java @@ -1,13 +1,5 @@ package gregtech.api.metatileentity; -import appeng.api.networking.IGridNode; -import appeng.api.networking.security.IActionHost; -import appeng.api.util.AECableType; -import appeng.api.util.AEPartLocation; -import appeng.api.util.DimensionalCoord; -import appeng.me.helpers.AENetworkProxy; -import appeng.me.helpers.IGridProxyable; -import com.google.common.base.Preconditions; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.block.machines.BlockMachine; @@ -21,6 +13,7 @@ import gregtech.client.particle.GTParticleManager; import gregtech.common.ConfigHolder; import gregtech.core.network.packets.PacketRecoverMTE; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; @@ -42,20 +35,33 @@ import net.minecraftforge.fml.common.Optional.Method; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import appeng.api.networking.IGridNode; +import appeng.api.networking.security.IActionHost; +import appeng.api.util.AECableType; +import appeng.api.util.AEPartLocation; +import appeng.api.util.DimensionalCoord; +import appeng.me.helpers.AENetworkProxy; +import appeng.me.helpers.IGridProxyable; +import com.google.common.base.Preconditions; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.text.DecimalFormat; import java.util.ArrayList; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.INITIALIZE_MTE; @InterfaceList(value = { - @Interface(iface = "appeng.api.networking.security.IActionHost", modid = GTValues.MODID_APPENG, striprefs = true), + @Interface(iface = "appeng.api.networking.security.IActionHost", + modid = GTValues.MODID_APPENG, + striprefs = true), @Interface(iface = "appeng.me.helpers.IGridProxyable", modid = GTValues.MODID_APPENG, striprefs = true), }) -public class MetaTileEntityHolder extends TickableTileEntityBase implements IGregTechTileEntity, IUIHolder, IWorldNameable, IActionHost, IGridProxyable { +public class MetaTileEntityHolder extends TickableTileEntityBase implements IGregTechTileEntity, IUIHolder, + IWorldNameable, IActionHost, IGridProxyable { MetaTileEntity metaTileEntity; private boolean needToUpdateLightning = false; @@ -89,7 +95,7 @@ public MetaTileEntity setMetaTileEntity(MetaTileEntity sampleMetaTileEntity) { buffer.writeVarInt(GregTechAPI.MTE_REGISTRY.getIdByObjectName(getMetaTileEntity().metaTileEntityId)); getMetaTileEntity().writeInitialSyncData(buffer); }); - //just to update neighbours so cables and other things will work properly + // just to update neighbours so cables and other things will work properly this.needToUpdateLightning = true; world.neighborChanged(getPos(), getBlockType(), getPos()); markDirty(); @@ -126,8 +132,10 @@ public void readFromNBT(@Nonnull NBTTagCompound compound) { NBTTagCompound metaTileEntityData = compound.getCompoundTag("MetaTileEntity"); if (sampleMetaTileEntity != null) { setRawMetaTileEntity(sampleMetaTileEntity.createMetaTileEntity(this)); - /* Note: NBTs need to be read before onAttached is run, since NBTs may contain important information - * about the composition of the BlockPattern that onAttached may generate. */ + /* + * Note: NBTs need to be read before onAttached is run, since NBTs may contain important information + * about the composition of the BlockPattern that onAttached may generate. + */ this.metaTileEntity.readFromNBT(metaTileEntityData); } else { GTLog.logger.error("Failed to load MetaTileEntity with invalid ID " + metaTileEntityIdRaw); @@ -168,7 +176,8 @@ public void invalidate() { @Override public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { - Object metaTileEntityValue = metaTileEntity == null ? null : metaTileEntity.getCoverCapability(capability, facing); + Object metaTileEntityValue = metaTileEntity == null ? null : + metaTileEntity.getCoverCapability(capability, facing); return metaTileEntityValue != null || super.hasCapability(capability, facing); } @@ -204,11 +213,13 @@ public void update() { timeStatisticsIndex = (timeStatisticsIndex + 1) % timeStatistics.length; } if (tickTime > 100_000_000L && getMetaTileEntity().doTickProfileMessage() && lagWarningCount++ < 10) - GTLog.logger.warn("WARNING: Possible Lag Source at [" + getPos().getX() + ", " + getPos().getY() + ", " + getPos().getZ() + "] in Dimension " + world.provider.getDimension() + " with " + tickTime + "ns caused by an instance of " + getMetaTileEntity().getClass()); + GTLog.logger.warn("WARNING: Possible Lag Source at [" + getPos().getX() + ", " + getPos().getY() + + ", " + getPos().getZ() + "] in Dimension " + world.provider.getDimension() + " with " + + tickTime + "ns caused by an instance of " + getMetaTileEntity().getClass()); } - //increment only after current tick, so meta tile entities will get first tick as timer == 0 - //and update their settings which depend on getTimer() % N properly + // increment only after current tick, so meta tile entities will get first tick as timer == 0 + // and update their settings which depend on getTimer() % N properly super.update(); } @@ -217,20 +228,22 @@ public ArrayList getDebugInfo(EntityPlayer player, int logLevel) if (logLevel > 2) { if (isValid()) { list.add(new TextComponentTranslation("behavior.tricorder.debug_machine", - new TextComponentTranslation(getMetaTileEntity().metaTileEntityId.toString()).setStyle(new Style().setColor(TextFormatting.BLUE)), - new TextComponentTranslation("behavior.tricorder.debug_machine_valid").setStyle(new Style().setColor(TextFormatting.GREEN)) - )); + new TextComponentTranslation(getMetaTileEntity().metaTileEntityId.toString()) + .setStyle(new Style().setColor(TextFormatting.BLUE)), + new TextComponentTranslation("behavior.tricorder.debug_machine_valid") + .setStyle(new Style().setColor(TextFormatting.GREEN)))); } else if (metaTileEntity == null) { - //noinspection NoTranslation + // noinspection NoTranslation list.add(new TextComponentTranslation("behavior.tricorder.debug_machine", new TextComponentTranslation("-1").setStyle(new Style().setColor(TextFormatting.BLUE)), - new TextComponentTranslation("behavior.tricorder.debug_machine_invalid_null").setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation("behavior.tricorder.debug_machine_invalid_null") + .setStyle(new Style().setColor(TextFormatting.RED)))); } else { list.add(new TextComponentTranslation("behavior.tricorder.debug_machine", - new TextComponentTranslation(getMetaTileEntity().metaTileEntityId.toString()).setStyle(new Style().setColor(TextFormatting.BLUE)), - new TextComponentTranslation("behavior.tricorder.debug_machine_invalid").setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(getMetaTileEntity().metaTileEntityId.toString()) + .setStyle(new Style().setColor(TextFormatting.BLUE)), + new TextComponentTranslation("behavior.tricorder.debug_machine_invalid") + .setStyle(new Style().setColor(TextFormatting.RED)))); } } if (logLevel > 1) { @@ -240,18 +253,23 @@ public ArrayList getDebugInfo(EntityPlayer player, int logLevel) double worstTickTime = timeStats[1]; list.add(new TextComponentTranslation("behavior.tricorder.debug_cpu_load", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(averageTickTime / timeStatistics.length)).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(timeStatistics.length)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(worstTickTime)).setStyle(new Style().setColor(TextFormatting.RED)) - )); - list.add(new TextComponentTranslation("behavior.tricorder.debug_cpu_load_seconds", tricorderFormat.format(worstTickTime / 1000000000))); + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(averageTickTime / timeStatistics.length)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(timeStatistics.length)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(worstTickTime)) + .setStyle(new Style().setColor(TextFormatting.RED)))); + list.add(new TextComponentTranslation("behavior.tricorder.debug_cpu_load_seconds", + tricorderFormat.format(worstTickTime / 1000000000))); } if (lagWarningCount > 0) { list.add(new TextComponentTranslation("behavior.tricorder.debug_lag_count", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(lagWarningCount)).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(100_000_000L)).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(lagWarningCount)) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(100_000_000L)) + .setStyle(new Style().setColor(TextFormatting.RED)))); } } return list; @@ -259,7 +277,7 @@ public ArrayList getDebugInfo(EntityPlayer player, int logLevel) /** * @return double array of length 2, with index 0 being the average time and index 1 the worst time, in ns. - * If there is no tick time, it will return null. + * If there is no tick time, it will return null. */ public double[] getTimeStatistics() { if (timeStatistics.length > 0) { @@ -271,7 +289,7 @@ public double[] getTimeStatistics() { worstTickTime = tickTime; } } - return new double[]{averageTickTime, worstTickTime}; + return new double[] { averageTickTime, worstTickTime }; } return null; } @@ -365,8 +383,10 @@ public void onChunkUnload() { } @Override - public boolean shouldRefresh(@Nonnull World world, @Nonnull BlockPos pos, IBlockState oldState, IBlockState newState) { - return oldState.getBlock() != newState.getBlock(); //MetaTileEntityHolder should never refresh (until block changes) + public boolean shouldRefresh(@Nonnull World world, @Nonnull BlockPos pos, IBlockState oldState, + IBlockState newState) { + return oldState.getBlock() != newState.getBlock(); // MetaTileEntityHolder should never refresh (until block + // changes) } @Override @@ -452,7 +472,7 @@ public void setCustomName(String customName) { } @SideOnly(Side.CLIENT) - private void updateNameTagParticle(){ + private void updateNameTagParticle() { if (hasCustomName()) { if (nameTagParticle == null) { nameTagParticle = new GTNameTagParticle(this, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5); @@ -480,7 +500,9 @@ public boolean hasCustomName() { @Nonnull @Override public ITextComponent getDisplayName() { - return this.hasCustomName() ? new TextComponentString(this.getName()) : metaTileEntity != null ? new TextComponentTranslation(metaTileEntity.getMetaFullName()) : new TextComponentString(this.getName()); + return this.hasCustomName() ? new TextComponentString(this.getName()) : + metaTileEntity != null ? new TextComponentTranslation(metaTileEntity.getMetaFullName()) : + new TextComponentString(this.getName()); } @Nullable diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntityUIFactory.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntityUIFactory.java index f18f409a52b..43dd60efea2 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntityUIFactory.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntityUIFactory.java @@ -5,6 +5,7 @@ import gregtech.api.gui.UIFactory; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTUtility; + import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.PacketBuffer; @@ -18,8 +19,7 @@ public class MetaTileEntityUIFactory extends UIFactory { public static final MetaTileEntityUIFactory INSTANCE = new MetaTileEntityUIFactory(); - private MetaTileEntityUIFactory() { - } + private MetaTileEntityUIFactory() {} public void init() { GregTechAPI.UI_FACTORY_REGISTRY.register(0, GTUtility.gregtechId("meta_tile_entity_factory"), this); diff --git a/src/main/java/gregtech/api/metatileentity/NeighborCacheTileEntityBase.java b/src/main/java/gregtech/api/metatileentity/NeighborCacheTileEntityBase.java index 6eb7cb8f8ce..473b950d63c 100644 --- a/src/main/java/gregtech/api/metatileentity/NeighborCacheTileEntityBase.java +++ b/src/main/java/gregtech/api/metatileentity/NeighborCacheTileEntityBase.java @@ -1,10 +1,12 @@ package gregtech.api.metatileentity; import gregtech.api.metatileentity.interfaces.INeighborCache; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java index fc165b64c1b..074ace86e8b 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java @@ -1,8 +1,5 @@ package gregtech.api.metatileentity; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IActiveOutputSide; import gregtech.api.capability.impl.EnergyContainerHandler; @@ -18,6 +15,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.PipelineUtil; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -28,28 +26,36 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.CapabilityItemHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; import java.util.function.Function; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class SimpleGeneratorMetaTileEntity extends WorkableTieredMetaTileEntity implements IActiveOutputSide { private static final int FONT_HEIGHT = 9; // Minecraft's FontRenderer FONT_HEIGHT value - public SimpleGeneratorMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, + public SimpleGeneratorMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, Function tankScalingFunction) { this(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction, false); } - public SimpleGeneratorMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, + public SimpleGeneratorMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, Function tankScalingFunction, boolean handlesRecipeOutputs) { super(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction, handlesRecipeOutputs); } @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new SimpleGeneratorMetaTileEntity(metaTileEntityId, workable.getRecipeMap(), renderer, getTier(), getTankScalingFunction(), handlesRecipeOutputs); + return new SimpleGeneratorMetaTileEntity(metaTileEntityId, workable.getRecipeMap(), renderer, getTier(), + getTankScalingFunction(), handlesRecipeOutputs); } @Override @@ -98,17 +104,18 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) { workableRecipeMap.getMaxOutputs() >= 6 || workableRecipeMap.getMaxFluidOutputs() >= 6) yOffset = FONT_HEIGHT; - ModularUI.Builder builder; - if (handlesRecipeOutputs) builder = workableRecipeMap.createUITemplate(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids, yOffset); - else builder = workableRecipeMap.createUITemplateNoOutputs(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids, yOffset); + if (handlesRecipeOutputs) builder = workableRecipeMap.createUITemplate(workable::getProgressPercent, + importItems, exportItems, importFluids, exportFluids, yOffset); + else builder = workableRecipeMap.createUITemplateNoOutputs(workable::getProgressPercent, importItems, + exportItems, importFluids, exportFluids, yOffset); builder.widget(new LabelWidget(6, 6, getMetaFullName())) .bindPlayerInventory(player.inventory, GuiTextures.SLOT, yOffset); builder.widget(new CycleButtonWidget(7, 62 + yOffset, 18, 18, workable.getAvailableOverclockingTiers(), workable::getOverclockTier, workable::setOverclockTier) - .setTooltipHoverString("gregtech.gui.overclock.description") - .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); + .setTooltipHoverString("gregtech.gui.overclock.description") + .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); return builder; } @@ -117,11 +124,13 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) { public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); renderOverlays(renderState, translation, pipeline); - Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); } protected void renderOverlays(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - this.renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workable.isActive(), workable.isWorkingEnabled()); + this.renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workable.isActive(), + workable.isWorkingEnabled()); } @Override @@ -130,16 +139,20 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { String key = this.metaTileEntityId.getPath().split("\\.")[0]; String mainKey = String.format("gregtech.machine.%s.tooltip", key); if (I18n.hasKey(mainKey)) { tooltip.add(1, I18n.format(mainKey)); } - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); if (recipeMap.getMaxFluidInputs() > 0 || recipeMap.getMaxFluidOutputs() > 0) - tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", this.getTankScalingFunction().apply(getTier()))); + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", + this.getTankScalingFunction().apply(getTier()))); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java index 5f0d9b562c3..e414c212236 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java @@ -1,9 +1,5 @@ package gregtech.api.metatileentity; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IActiveOutputSide; @@ -22,6 +18,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.RenderUtil; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -43,16 +40,23 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.List; import java.util.function.Function; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.*; -public class SimpleMachineMetaTileEntity extends WorkableTieredMetaTileEntity implements IActiveOutputSide, IGhostSlotConfigurable { +public class SimpleMachineMetaTileEntity extends WorkableTieredMetaTileEntity + implements IActiveOutputSide, IGhostSlotConfigurable { private final boolean hasFrontFacing; @@ -74,11 +78,13 @@ public class SimpleMachineMetaTileEntity extends WorkableTieredMetaTileEntity im private static final int FONT_HEIGHT = 9; // Minecraft's FontRenderer FONT_HEIGHT value - public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, boolean hasFrontFacing) { + public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, boolean hasFrontFacing) { this(metaTileEntityId, recipeMap, renderer, tier, hasFrontFacing, GTUtility.defaultTankSizeFunction); } - public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, boolean hasFrontFacing, + public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, boolean hasFrontFacing, Function tankScalingFunction) { super(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction); this.hasFrontFacing = hasFrontFacing; @@ -87,7 +93,8 @@ public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap< @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new SimpleMachineMetaTileEntity(metaTileEntityId, workable.getRecipeMap(), renderer, getTier(), hasFrontFacing, getTankScalingFunction()); + return new SimpleMachineMetaTileEntity(metaTileEntityId, workable.getRecipeMap(), renderer, getTier(), + hasFrontFacing, getTankScalingFunction()); } @Override @@ -119,13 +126,14 @@ public boolean hasFrontFacing() { } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { - //TODO Separate into two output getters + // TODO Separate into two output getters if (getOutputFacing() == facing) return false; if (hasFrontFacing() && facing == getFrontFacing()) return false; if (!getWorld().isRemote) { - //TODO Separate into two output setters + // TODO Separate into two output setters setOutputFacing(facing); } return true; @@ -151,16 +159,20 @@ public void addCover(@NotNull EnumFacing side, @NotNull Cover cover) { public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); if (outputFacingFluids != null && getExportFluids().getTanks() > 0) { - Textures.PIPE_OUT_OVERLAY.renderSided(outputFacingFluids, renderState, RenderUtil.adjustTrans(translation, outputFacingFluids, 2), pipeline); + Textures.PIPE_OUT_OVERLAY.renderSided(outputFacingFluids, renderState, + RenderUtil.adjustTrans(translation, outputFacingFluids, 2), pipeline); } if (outputFacingItems != null && getExportItems().getSlots() > 0) { - Textures.PIPE_OUT_OVERLAY.renderSided(outputFacingItems, renderState, RenderUtil.adjustTrans(translation, outputFacingItems, 2), pipeline); + Textures.PIPE_OUT_OVERLAY.renderSided(outputFacingItems, renderState, + RenderUtil.adjustTrans(translation, outputFacingItems, 2), pipeline); } if (isAutoOutputItems() && outputFacingItems != null) { - Textures.ITEM_OUTPUT_OVERLAY.renderSided(outputFacingItems, renderState, RenderUtil.adjustTrans(translation, outputFacingItems, 2), pipeline); + Textures.ITEM_OUTPUT_OVERLAY.renderSided(outputFacingItems, renderState, + RenderUtil.adjustTrans(translation, outputFacingItems, 2), pipeline); } if (isAutoOutputFluids() && outputFacingFluids != null) { - Textures.FLUID_OUTPUT_OVERLAY.renderSided(outputFacingFluids, renderState, RenderUtil.adjustTrans(translation, outputFacingFluids, 2), pipeline); + Textures.FLUID_OUTPUT_OVERLAY.renderSided(outputFacingFluids, renderState, + RenderUtil.adjustTrans(translation, outputFacingFluids, 2), pipeline); } } @@ -182,16 +194,19 @@ public void update() { } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { if (isAllowInputFromOutputSideItems()) { setAllowInputFromOutputSideItems(false); setAllowInputFromOutputSideFluids(false); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.disallow"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.disallow"), true); } else { setAllowInputFromOutputSideItems(true); setAllowInputFromOutputSideFluids(true); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.allow"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.allow"), true); } } return true; @@ -200,13 +215,15 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci @Override public T getCapability(Capability capability, EnumFacing side) { if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { - IFluidHandler fluidHandler = (side == getOutputFacingFluids() && !isAllowInputFromOutputSideFluids()) ? outputFluidInventory : fluidInventory; + IFluidHandler fluidHandler = (side == getOutputFacingFluids() && !isAllowInputFromOutputSideFluids()) ? + outputFluidInventory : fluidInventory; if (fluidHandler.getTankProperties().length > 0) { return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(fluidHandler); } return null; } else if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { - IItemHandler itemHandler = (side == getOutputFacingItems() && !isAllowInputFromOutputSideFluids()) ? outputItemInventory : itemInventory; + IItemHandler itemHandler = (side == getOutputFacingItems() && !isAllowInputFromOutputSideFluids()) ? + outputItemInventory : itemInventory; if (itemHandler.getSlots() > 0) { return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(itemHandler); } @@ -300,8 +317,8 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { @Override public boolean isValidFrontFacing(EnumFacing facing) { - //use direct outputFacing field instead of getter method because otherwise - //it will just return SOUTH for null output facing + // use direct outputFacing field instead of getter method because otherwise + // it will just return SOUTH for null output facing return super.isValidFrontFacing(facing) && facing != outputFacingItems && facing != outputFacingFluids; } @@ -388,7 +405,7 @@ public void setGhostCircuitConfig(int config) { public void setFrontFacing(EnumFacing frontFacing) { super.setFrontFacing(frontFacing); if (this.outputFacingItems == null || this.outputFacingFluids == null) { - //set initial output facing as opposite to front + // set initial output facing as opposite to front setOutputFacing(frontFacing.getOpposite()); } } @@ -436,11 +453,14 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) { yOffset = FONT_HEIGHT; } - ModularUI.Builder builder = workableRecipeMap.createUITemplate(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids, yOffset) + ModularUI.Builder builder = workableRecipeMap + .createUITemplate(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids, + yOffset) .widget(new LabelWidget(5, 5, getMetaFullName())) .widget(new SlotWidget(chargerInventory, 0, 79, 62 + yOffset, true, true, false) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.CHARGER_OVERLAY) - .setTooltipText("gregtech.gui.charger_slot.tooltip", GTValues.VNF[getTier()], GTValues.VNF[getTier()])) + .setTooltipText("gregtech.gui.charger_slot.tooltip", GTValues.VNF[getTier()], + GTValues.VNF[getTier()])) .widget(new ImageWidget(79, 42 + yOffset, 18, 18, GuiTextures.INDICATOR_NO_ENERGY).setIgnoreColor(true) .setPredicate(workable::isHasNotEnoughEnergy)) .bindPlayerInventory(player.inventory, GuiTextures.SLOT, yOffset); @@ -450,27 +470,27 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) { if (exportItems.getSlots() > 0) { builder.widget(new ToggleButtonWidget(leftButtonStartX, 62 + yOffset, 18, 18, GuiTextures.BUTTON_ITEM_OUTPUT, this::isAutoOutputItems, this::setAutoOutputItems) - .setTooltipText("gregtech.gui.item_auto_output.tooltip") - .shouldUseBaseBackground()); + .setTooltipText("gregtech.gui.item_auto_output.tooltip") + .shouldUseBaseBackground()); leftButtonStartX += 18; } if (exportFluids.getTanks() > 0) { builder.widget(new ToggleButtonWidget(leftButtonStartX, 62 + yOffset, 18, 18, GuiTextures.BUTTON_FLUID_OUTPUT, this::isAutoOutputFluids, this::setAutoOutputFluids) - .setTooltipText("gregtech.gui.fluid_auto_output.tooltip") - .shouldUseBaseBackground()); + .setTooltipText("gregtech.gui.fluid_auto_output.tooltip") + .shouldUseBaseBackground()); leftButtonStartX += 18; } builder.widget(new CycleButtonWidget(leftButtonStartX, 62 + yOffset, 18, 18, workable.getAvailableOverclockingTiers(), workable::getOverclockTier, workable::setOverclockTier) - .setTooltipHoverString("gregtech.gui.overclock.description") - .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); + .setTooltipHoverString("gregtech.gui.overclock.description") + .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); if (exportItems.getSlots() + exportFluids.getTanks() <= 9) { ImageWidget logo = new ImageWidget(152, 63 + yOffset, 17, 17, GTValues.XMAS.get() ? GuiTextures.GREGTECH_LOGO_XMAS : GuiTextures.GREGTECH_LOGO) - .setIgnoreColor(true); + .setIgnoreColor(true); if (this.circuitInventory != null) { SlotWidget circuitSlot = new GhostCircuitSlotWidget(circuitInventory, 0, 124, 62 + yOffset) diff --git a/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java index 59b9d1ba1b7..2093b72e7ff 100644 --- a/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java @@ -1,10 +1,5 @@ package gregtech.api.metatileentity; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.CommonFluidFilters; import gregtech.api.capability.impl.FilteredFluidHandler; @@ -20,6 +15,7 @@ import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -31,13 +27,20 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.util.List; import java.util.Objects; +import javax.annotation.Nullable; + public abstract class SteamMetaTileEntity extends MetaTileEntity { protected static final int STEAM_CAPACITY = 16000; @@ -47,7 +50,8 @@ public abstract class SteamMetaTileEntity extends MetaTileEntity { protected RecipeLogicSteam workableHandler; protected FluidTank steamFluidTank; - public SteamMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, boolean isHighPressure) { + public SteamMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, + boolean isHighPressure) { super(metaTileEntityId); this.workableHandler = new RecipeLogicSteam(this, recipeMap, isHighPressure, steamFluidTank, 1.0); @@ -83,11 +87,13 @@ public int getDefaultPaintingColor() { } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { EnumFacing currentVentingSide = workableHandler.getVentingSide(); if (currentVentingSide == facing || - getFrontFacing() == facing) return false; + getFrontFacing() == facing) + return false; workableHandler.setVentingSide(facing); return true; } @@ -102,10 +108,13 @@ public Pair getParticleTexture() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); getBaseRenderer().render(renderState, translation, colouredPipeline); - renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workableHandler.isActive(), workableHandler.isWorkingEnabled()); - Textures.STEAM_VENT_OVERLAY.renderSided(workableHandler.getVentingSide(), renderState, RenderUtil.adjustTrans(translation, workableHandler.getVentingSide(), 2), pipeline); + renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workableHandler.isActive(), + workableHandler.isWorkingEnabled()); + Textures.STEAM_VENT_OVERLAY.renderSided(workableHandler.getVentingSide(), renderState, + RenderUtil.adjustTrans(translation, workableHandler.getVentingSide(), 2), pipeline); } protected boolean isBrickedCasing() { @@ -153,9 +162,11 @@ public void randomDisplayTick() { x += horizontalOffset; } if (ConfigHolder.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { - getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); + getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, + false); } - randomDisplayTick(x, y, z, EnumParticleTypes.FLAME, isHighPressure ? EnumParticleTypes.SMOKE_LARGE : EnumParticleTypes.SMOKE_NORMAL); + randomDisplayTick(x, y, z, EnumParticleTypes.FLAME, + isHighPressure ? EnumParticleTypes.SMOKE_LARGE : EnumParticleTypes.SMOKE_NORMAL); } } diff --git a/src/main/java/gregtech/api/metatileentity/SyncedTileEntityBase.java b/src/main/java/gregtech/api/metatileentity/SyncedTileEntityBase.java index 8bd1c85e58c..4e29fe09328 100644 --- a/src/main/java/gregtech/api/metatileentity/SyncedTileEntityBase.java +++ b/src/main/java/gregtech/api/metatileentity/SyncedTileEntityBase.java @@ -5,8 +5,7 @@ import gregtech.api.metatileentity.interfaces.ISyncedTileEntity; import gregtech.api.network.PacketDataList; import gregtech.api.util.GTLog; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; + import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; @@ -17,6 +16,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.util.Constants; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -88,7 +90,8 @@ public final void onDataPacket(@NotNull NetworkManager net, @NotNull SPacketUpda if (className == null) { className = this.getClass().getName(); } - GTLog.logger.error("Class {} failed to finish reading receiveCustomData with discriminator {} and {} bytes remaining", + GTLog.logger.error( + "Class {} failed to finish reading receiveCustomData with discriminator {} and {} bytes remaining", className, discriminatorKey, backedBuffer.readableBytes()); } } diff --git a/src/main/java/gregtech/api/metatileentity/TickableTileEntityBase.java b/src/main/java/gregtech/api/metatileentity/TickableTileEntityBase.java index 64db1834ab9..b60908d3f3e 100644 --- a/src/main/java/gregtech/api/metatileentity/TickableTileEntityBase.java +++ b/src/main/java/gregtech/api/metatileentity/TickableTileEntityBase.java @@ -1,6 +1,7 @@ package gregtech.api.metatileentity; import gregtech.api.GTValues; + import net.minecraft.util.ITickable; public abstract class TickableTileEntityBase extends NeighborCacheTileEntityBase implements ITickable { @@ -31,7 +32,5 @@ public void update() { timer++; } - protected void onFirstTick() { - } - + protected void onFirstTick() {} } diff --git a/src/main/java/gregtech/api/metatileentity/TieredMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/TieredMetaTileEntity.java index 737a5728064..16c9090233b 100644 --- a/src/main/java/gregtech/api/metatileentity/TieredMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/TieredMetaTileEntity.java @@ -1,9 +1,5 @@ package gregtech.api.metatileentity; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.impl.EnergyContainerHandler; @@ -12,6 +8,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -19,14 +16,21 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public abstract class TieredMetaTileEntity extends MetaTileEntity implements IEnergyChangeListener, ITieredMetaTileEntity { +public abstract class TieredMetaTileEntity extends MetaTileEntity + implements IEnergyChangeListener, ITieredMetaTileEntity { private final int tier; protected IEnergyContainer energyContainer; @@ -47,8 +51,7 @@ protected void reinitializeEnergyContainer() { } @Override - public void onEnergyChanged(IEnergyContainer container, boolean isInitialChange) { - } + public void onEnergyChanged(IEnergyContainer container, boolean isInitialChange) {} @SideOnly(Side.CLIENT) protected SimpleSidedCubeRenderer getBaseRenderer() { @@ -56,7 +59,8 @@ protected SimpleSidedCubeRenderer getBaseRenderer() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); if (ConfigHolder.machines.doTerrainExplosion && getIsWeatherOrTerrainResistant()) tooltip.add(I18n.format("gregtech.universal.tooltip.terrain_resist")); @@ -70,7 +74,8 @@ public Pair getParticleTexture() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); getBaseRenderer().render(renderState, translation, colouredPipeline); } @@ -109,5 +114,4 @@ protected long getMaxInputOutputAmperage() { protected boolean isEnergyEmitter() { return false; } - } diff --git a/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java index ef909139eda..2b4e6b8a5be 100644 --- a/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java @@ -1,8 +1,5 @@ package gregtech.api.metatileentity; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.*; import gregtech.api.items.itemhandlers.GTItemStackHandler; @@ -11,6 +8,7 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -23,13 +21,19 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.List; import java.util.function.Function; -public abstract class WorkableTieredMetaTileEntity extends TieredMetaTileEntity implements IDataInfoProvider, ICleanroomReceiver { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class WorkableTieredMetaTileEntity extends TieredMetaTileEntity + implements IDataInfoProvider, ICleanroomReceiver { protected final RecipeLogicEnergy workable; protected final RecipeMap recipeMap; @@ -41,12 +45,14 @@ public abstract class WorkableTieredMetaTileEntity extends TieredMetaTileEntity private ICleanroomProvider cleanroom; - public WorkableTieredMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, + public WorkableTieredMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, Function tankScalingFunction) { this(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction, true); } - public WorkableTieredMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, + public WorkableTieredMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, Function tankScalingFunction, boolean handlesRecipeOutputs) { super(metaTileEntityId, tier); this.renderer = renderer; @@ -69,6 +75,7 @@ protected void reinitializeEnergyContainer() { this.energyContainer = EnergyContainerHandler.emitterContainer(this, tierVoltage * 64L, tierVoltage, getMaxInputOutputAmperage()); } else this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 64L, tierVoltage, 2, 0L, 0L) { + @Override public long getInputAmperage() { if (getEnergyCapacity() / 2 > getEnergyStored() && workable.isActive()) { @@ -87,7 +94,8 @@ protected long getMaxInputOutputAmperage() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workable.isActive(), workable.isWorkingEnabled()); + renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workable.isActive(), + workable.isWorkingEnabled()); } @Override @@ -107,7 +115,8 @@ protected FluidTankList createImportFluidHandler() { if (workable == null) return new FluidTankList(false); NotifiableFluidTank[] fluidImports = new NotifiableFluidTank[workable.getRecipeMap().getMaxFluidInputs()]; for (int i = 0; i < fluidImports.length; i++) { - NotifiableFluidTank filteredFluidHandler = new NotifiableFluidTank(this.tankScalingFunction.apply(this.getTier()), this, false); + NotifiableFluidTank filteredFluidHandler = new NotifiableFluidTank( + this.tankScalingFunction.apply(this.getTier()), this, false); fluidImports[i] = filteredFluidHandler; } return new FluidTankList(false, fluidImports); @@ -126,10 +135,13 @@ protected FluidTankList createExportFluidHandler() { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); if (workable.getRecipeMap().getMaxFluidInputs() != 0) - tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", this.tankScalingFunction.apply(getTier()))); + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", + this.tankScalingFunction.apply(getTier()))); } public Function getTankScalingFunction() { @@ -152,27 +164,35 @@ public List getDataInfo() { if (workable != null) { list.add(new TextComponentTranslation("behavior.tricorder.workable_progress", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getProgress() / 20)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getMaxProgress() / 20)).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getProgress() / 20)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getMaxProgress() / 20)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); if (energyContainer != null) { list.add(new TextComponentTranslation("behavior.tricorder.workable_stored_energy", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored())).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored())) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } // multi amp recipes: change 0 ? 0 : 1 to 0 ? 0 : amperage if (workable.consumesEnergy()) { list.add(new TextComponentTranslation("behavior.tricorder.workable_consumption", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt())).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt() == 0 ? 0 : 1)).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt())) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt() == 0 ? 0 : 1)) + .setStyle(new Style().setColor(TextFormatting.RED)))); } else { list.add(new TextComponentTranslation("behavior.tricorder.workable_production", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt())).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt() == 0 ? 0 : 1)).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt())) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt() == 0 ? 0 : 1)) + .setStyle(new Style().setColor(TextFormatting.RED)))); } } diff --git a/src/main/java/gregtech/api/metatileentity/interfaces/IHasWorldObjectAndCoords.java b/src/main/java/gregtech/api/metatileentity/interfaces/IHasWorldObjectAndCoords.java index ea88018bdc8..9508a1d76d7 100644 --- a/src/main/java/gregtech/api/metatileentity/interfaces/IHasWorldObjectAndCoords.java +++ b/src/main/java/gregtech/api/metatileentity/interfaces/IHasWorldObjectAndCoords.java @@ -1,6 +1,7 @@ package gregtech.api.metatileentity.interfaces; import gregtech.api.util.IDirtyNotifiable; + import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; diff --git a/src/main/java/gregtech/api/metatileentity/interfaces/INeighborCache.java b/src/main/java/gregtech/api/metatileentity/interfaces/INeighborCache.java index cb952e4bff0..cf6a662d2cb 100644 --- a/src/main/java/gregtech/api/metatileentity/interfaces/INeighborCache.java +++ b/src/main/java/gregtech/api/metatileentity/interfaces/INeighborCache.java @@ -2,6 +2,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/api/metatileentity/interfaces/ISyncedTileEntity.java b/src/main/java/gregtech/api/metatileentity/interfaces/ISyncedTileEntity.java index f38c8e8ac92..f08beb475b9 100644 --- a/src/main/java/gregtech/api/metatileentity/interfaces/ISyncedTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/interfaces/ISyncedTileEntity.java @@ -1,6 +1,7 @@ package gregtech.api.metatileentity.interfaces; import net.minecraft.network.PacketBuffer; + import org.jetbrains.annotations.NotNull; import java.util.function.Consumer; diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/CleanroomType.java b/src/main/java/gregtech/api/metatileentity/multiblock/CleanroomType.java index 9330a01605c..9eea63c0cf4 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/CleanroomType.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/CleanroomType.java @@ -2,24 +2,27 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import java.util.Map; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Map; public class CleanroomType { private static final Map CLEANROOM_TYPES = new Object2ObjectOpenHashMap<>(); - public static final CleanroomType CLEANROOM = new CleanroomType("cleanroom", "gregtech.recipe.cleanroom.display_name"); - public static final CleanroomType STERILE_CLEANROOM = new CleanroomType("sterile_cleanroom", "gregtech.recipe.cleanroom_sterile.display_name"); - + public static final CleanroomType CLEANROOM = new CleanroomType("cleanroom", + "gregtech.recipe.cleanroom.display_name"); + public static final CleanroomType STERILE_CLEANROOM = new CleanroomType("sterile_cleanroom", + "gregtech.recipe.cleanroom_sterile.display_name"); private final String name; private final String translationKey; public CleanroomType(@Nonnull String name, @Nonnull String translationKey) { if (CLEANROOM_TYPES.get(name) != null) - throw new IllegalArgumentException(String.format("CleanroomType with name %s is already registered!", name)); + throw new IllegalArgumentException( + String.format("CleanroomType with name %s is already registered!", name)); this.name = name; this.translationKey = translationKey; diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/DummyCleanroom.java b/src/main/java/gregtech/api/metatileentity/multiblock/DummyCleanroom.java index bd2c9810656..198a972b725 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/DummyCleanroom.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/DummyCleanroom.java @@ -1,9 +1,10 @@ package gregtech.api.metatileentity.multiblock; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; +import javax.annotation.Nonnull; + public final class DummyCleanroom implements ICleanroomProvider { private final boolean allowsAllTypes; @@ -11,6 +12,7 @@ public final class DummyCleanroom implements ICleanroomProvider { /** * Create a Dummy Cleanroom that provides specific types + * * @param types the types to provide */ @Nonnull diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java index eefd5bb1e68..a67d7ec7b09 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java @@ -10,6 +10,7 @@ import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.common.ConfigHolder; + import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.Style; @@ -17,10 +18,11 @@ import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + public abstract class FuelMultiblockController extends RecipeMapMultiblockController { public FuelMultiblockController(ResourceLocation metaTileEntityId, RecipeMap recipeMap, int tier) { @@ -79,32 +81,40 @@ public List getDataInfo() { List list = new ArrayList<>(); if (recipeMapWorkable.getMaxProgress() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.workable_progress", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getProgress() / 20)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getMaxProgress() / 20)).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getProgress() / 20)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(recipeMapWorkable.getMaxProgress() / 20)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } list.add(new TextComponentTranslation("behavior.tricorder.energy_container_storage", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored())).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored())) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); if (!recipeMapWorkable.consumesEnergy()) { list.add(new TextComponentTranslation("behavior.tricorder.workable_production", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(Math.abs(recipeMapWorkable.getInfoProviderEUt()))).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getInfoProviderEUt() == 0 ? 0 : 1)).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(Math.abs(recipeMapWorkable.getInfoProviderEUt()))) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(recipeMapWorkable.getInfoProviderEUt() == 0 ? 0 : 1)) + .setStyle(new Style().setColor(TextFormatting.RED)))); list.add(new TextComponentTranslation("behavior.tricorder.multiblock_energy_output", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getOutputVoltage())).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(GTValues.VN[GTUtility.getTierByVoltage(energyContainer.getOutputVoltage())]).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getOutputVoltage())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation( + GTValues.VN[GTUtility.getTierByVoltage(energyContainer.getOutputVoltage())]) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } if (ConfigHolder.machines.enableMaintenance && hasMaintenanceMechanics()) { list.add(new TextComponentTranslation("behavior.tricorder.multiblock_maintenance", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(getNumMaintenanceProblems())).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(getNumMaintenanceProblems())) + .setStyle(new Style().setColor(TextFormatting.RED)))); } return list; @@ -122,7 +132,7 @@ protected int[] getTotalFluidAmount(FluidStack testStack, IMultipleTankHandler m } } } - return new int[]{fluidAmount, fluidCapacity}; + return new int[] { fluidAmount, fluidCapacity }; } protected void addFuelText(List textList) { @@ -140,7 +150,8 @@ protected void addFuelText(List textList) { } if (fuelStack != null) { - ITextComponent fuelName = TextComponentUtil.setColor(GTUtility.getFluidTranslation(fuelStack), TextFormatting.GOLD); + ITextComponent fuelName = TextComponentUtil.setColor(GTUtility.getFluidTranslation(fuelStack), + TextFormatting.GOLD); ITextComponent fuelInfo = new TextComponentTranslation("%s / %s L (%s)", TextFormattingUtil.formatNumbers(fuelStored), TextFormattingUtil.formatNumbers(fuelCapacity), diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/IBatteryData.java b/src/main/java/gregtech/api/metatileentity/multiblock/IBatteryData.java index 4a16f831cf3..786416fc382 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/IBatteryData.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/IBatteryData.java @@ -8,5 +8,6 @@ public interface IBatteryData { long getCapacity(); - @NotNull String getBatteryName(); + @NotNull + String getBatteryName(); } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockAbilityPart.java b/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockAbilityPart.java index 2bf30beed55..d71121f196d 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockAbilityPart.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockAbilityPart.java @@ -7,5 +7,4 @@ public interface IMultiblockAbilityPart extends IMultiblockPart { MultiblockAbility getAbility(); void registerAbilities(List abilityList); - } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockPart.java b/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockPart.java index 4a6f58ac09f..dc6cb0e5d28 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockPart.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockPart.java @@ -11,5 +11,4 @@ public interface IMultiblockPart { default boolean canPartShare() { return true; } - } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/IProgressBarMultiblock.java b/src/main/java/gregtech/api/metatileentity/multiblock/IProgressBarMultiblock.java index 8a8a0e7ea8e..77567e09af2 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/IProgressBarMultiblock.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/IProgressBarMultiblock.java @@ -2,6 +2,7 @@ import gregtech.api.gui.GuiTextures; import gregtech.api.gui.resources.TextureArea; + import net.minecraft.util.text.ITextComponent; import java.util.List; @@ -12,7 +13,9 @@ default boolean showProgressBar() { return true; } - /** Can optionally have two progress bars side-by-side. Can support up to 3 bars. Any other values will default to 1. */ + /** + * Can optionally have two progress bars side-by-side. Can support up to 3 bars. Any other values will default to 1. + */ default int getNumProgressBars() { return 1; } @@ -30,6 +33,5 @@ default TextureArea getProgressBarTexture(int index) { * * @param index The index, 0, 1, or 2, of your progress bar. Only relevant if you have multiple bars. */ - default void addBarHoverText(List hoverList, int index) { - } + default void addBarHoverText(List hoverList, int index) {} } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java index fbc399be582..667333aec1c 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java @@ -1,6 +1,5 @@ package gregtech.api.metatileentity.multiblock; -import codechicken.lib.raytracer.CuboidRayTraceResult; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IMultipleRecipeMaps; @@ -10,6 +9,7 @@ import gregtech.api.pattern.TraceabilityPredicate; import gregtech.api.recipes.RecipeMap; import gregtech.api.util.LocalizationUtils; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -23,13 +23,17 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + @SuppressWarnings("unused") -public abstract class MultiMapMultiblockController extends RecipeMapMultiblockController implements IMultipleRecipeMaps { +public abstract class MultiMapMultiblockController extends RecipeMapMultiblockController + implements IMultipleRecipeMaps { // array of possible recipes, specific to each multi - used when the multi has multiple RecipeMaps private final RecipeMap[] recipeMaps; @@ -43,7 +47,8 @@ public MultiMapMultiblockController(ResourceLocation metaTileEntityId, RecipeMap } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (recipeMaps.length == 1) return true; if (!getWorld().isRemote) { if (!this.recipeMapWorkable.isActive()) { @@ -57,7 +62,8 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci setRecipeMapIndex(index); this.recipeMapWorkable.forceRecipeRecheck(); } else { - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.multiblock.multiple_recipemaps.switch_message"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.multiblock.multiple_recipemaps.switch_message"), true); } } @@ -89,11 +95,14 @@ public RecipeMap getCurrentRecipeMap() { } @Override - public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, boolean checkMaintenance, boolean checkItemIn, boolean checkItemOut, boolean checkFluidIn, boolean checkFluidOut, boolean checkMuffler) { + public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, boolean checkMaintenance, boolean checkItemIn, + boolean checkItemOut, boolean checkFluidIn, boolean checkFluidOut, + boolean checkMuffler) { boolean checkedItemIn = false, checkedItemOut = false, checkedFluidIn = false, checkedFluidOut = false; TraceabilityPredicate predicate = super.autoAbilities(checkMaintenance, checkMuffler) - .or(checkEnergyIn ? abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(3).setPreviewCount(1) : new TraceabilityPredicate()); + .or(checkEnergyIn ? abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1) + .setMaxGlobalLimited(3).setPreviewCount(1) : new TraceabilityPredicate()); for (RecipeMap recipeMap : getAvailableRecipeMaps()) { if (!checkedItemIn && checkItemIn) { @@ -129,10 +138,11 @@ public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, boolean checkM if (getAvailableRecipeMaps() != null && getAvailableRecipeMaps().length > 1) { return new ImageCycleButtonWidget(x, y, width, height, GuiTextures.BUTTON_MULTI_MAP, getAvailableRecipeMaps().length, this::getRecipeMapIndex, this::setRecipeMapIndex) - .shouldUseBaseBackground().singleTexture() - .setTooltipHoverString(i -> - LocalizationUtils.format("gregtech.multiblock.multiple_recipemaps.header") + " " - + LocalizationUtils.format("recipemap." + getAvailableRecipeMaps()[i].getUnlocalizedName() + ".name")); + .shouldUseBaseBackground().singleTexture() + .setTooltipHoverString(i -> LocalizationUtils + .format("gregtech.multiblock.multiple_recipemaps.header") + " " + + LocalizationUtils.format( + "recipemap." + getAvailableRecipeMaps()[i].getUnlocalizedName() + ".name")); } return super.getFlexButton(x, y, width, height); } @@ -148,9 +158,9 @@ public void addInformation(ItemStack stack, @Nullable World player, List public String recipeMapsToString() { StringBuilder recipeMapsString = new StringBuilder(); RecipeMap[] recipeMaps = getAvailableRecipeMaps(); - for(int i = 0; i < recipeMaps.length; i++) { + for (int i = 0; i < recipeMaps.length; i++) { recipeMapsString.append(recipeMaps[i].getLocalizedName()); - if(recipeMaps.length - 1 != i) + if (recipeMaps.length - 1 != i) recipeMapsString.append(", "); // For delimiting } return recipeMapsString.toString(); diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java index 3bb22cecbe8..4c23893823c 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java @@ -2,11 +2,13 @@ import gregtech.api.capability.*; import gregtech.api.metatileentity.MetaTileEntity; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -14,11 +16,14 @@ @SuppressWarnings("InstantiationOfUtilityClass") public class MultiblockAbility { + public static final Map> NAME_REGISTRY = new HashMap<>(); public static final Map, List> REGISTRY = new Object2ObjectOpenHashMap<>(); - public static final MultiblockAbility EXPORT_ITEMS = new MultiblockAbility<>("export_items"); - public static final MultiblockAbility IMPORT_ITEMS = new MultiblockAbility<>("import_items"); + public static final MultiblockAbility EXPORT_ITEMS = new MultiblockAbility<>( + "export_items"); + public static final MultiblockAbility IMPORT_ITEMS = new MultiblockAbility<>( + "import_items"); public static final MultiblockAbility EXPORT_FLUIDS = new MultiblockAbility<>("export_fluids"); public static final MultiblockAbility IMPORT_FLUIDS = new MultiblockAbility<>("import_fluids"); @@ -26,36 +31,49 @@ public class MultiblockAbility { public static final MultiblockAbility INPUT_ENERGY = new MultiblockAbility<>("input_energy"); public static final MultiblockAbility OUTPUT_ENERGY = new MultiblockAbility<>("output_energy"); - public static final MultiblockAbility SUBSTATION_INPUT_ENERGY = new MultiblockAbility<>("substation_input_energy"); - public static final MultiblockAbility SUBSTATION_OUTPUT_ENERGY = new MultiblockAbility<>("substation_output_energy"); + public static final MultiblockAbility SUBSTATION_INPUT_ENERGY = new MultiblockAbility<>( + "substation_input_energy"); + public static final MultiblockAbility SUBSTATION_OUTPUT_ENERGY = new MultiblockAbility<>( + "substation_output_energy"); public static final MultiblockAbility ROTOR_HOLDER = new MultiblockAbility<>("rotor_holder"); public static final MultiblockAbility PUMP_FLUID_HATCH = new MultiblockAbility<>("pump_fluid_hatch"); public static final MultiblockAbility STEAM = new MultiblockAbility<>("steam"); - public static final MultiblockAbility STEAM_IMPORT_ITEMS = new MultiblockAbility<>("steam_import_items"); - public static final MultiblockAbility STEAM_EXPORT_ITEMS = new MultiblockAbility<>("steam_export_items"); + public static final MultiblockAbility STEAM_IMPORT_ITEMS = new MultiblockAbility<>( + "steam_import_items"); + public static final MultiblockAbility STEAM_EXPORT_ITEMS = new MultiblockAbility<>( + "steam_export_items"); - public static final MultiblockAbility MAINTENANCE_HATCH = new MultiblockAbility<>("maintenance_hatch"); + public static final MultiblockAbility MAINTENANCE_HATCH = new MultiblockAbility<>( + "maintenance_hatch"); public static final MultiblockAbility MUFFLER_HATCH = new MultiblockAbility<>("muffler_hatch"); - public static final MultiblockAbility MACHINE_HATCH = new MultiblockAbility<>("machine_hatch"); + public static final MultiblockAbility MACHINE_HATCH = new MultiblockAbility<>( + "machine_hatch"); public static final MultiblockAbility TANK_VALVE = new MultiblockAbility<>("tank_valve"); - public static final MultiblockAbility PASSTHROUGH_HATCH = new MultiblockAbility<>("passthrough_hatch"); + public static final MultiblockAbility PASSTHROUGH_HATCH = new MultiblockAbility<>( + "passthrough_hatch"); - public static final MultiblockAbility DATA_ACCESS_HATCH = new MultiblockAbility<>("data_access_hatch"); - public static final MultiblockAbility OPTICAL_DATA_RECEPTION = new MultiblockAbility<>("optical_data_reception"); - public static final MultiblockAbility OPTICAL_DATA_TRANSMISSION = new MultiblockAbility<>("optical_data_transmission"); + public static final MultiblockAbility DATA_ACCESS_HATCH = new MultiblockAbility<>( + "data_access_hatch"); + public static final MultiblockAbility OPTICAL_DATA_RECEPTION = new MultiblockAbility<>( + "optical_data_reception"); + public static final MultiblockAbility OPTICAL_DATA_TRANSMISSION = new MultiblockAbility<>( + "optical_data_transmission"); public static final MultiblockAbility INPUT_LASER = new MultiblockAbility<>("input_laser"); public static final MultiblockAbility OUTPUT_LASER = new MultiblockAbility<>("output_laser"); - public static final MultiblockAbility COMPUTATION_DATA_RECEPTION = new MultiblockAbility<>("computation_data_reception"); - public static final MultiblockAbility COMPUTATION_DATA_TRANSMISSION = new MultiblockAbility<>("computation_data_transmission"); + public static final MultiblockAbility COMPUTATION_DATA_RECEPTION = new MultiblockAbility<>( + "computation_data_reception"); + public static final MultiblockAbility COMPUTATION_DATA_TRANSMISSION = new MultiblockAbility<>( + "computation_data_transmission"); - public static final MultiblockAbility HPCA_COMPONENT = new MultiblockAbility<>("hpca_component"); + public static final MultiblockAbility HPCA_COMPONENT = new MultiblockAbility<>( + "hpca_component"); public static final MultiblockAbility OBJECT_HOLDER = new MultiblockAbility<>("object_holder"); public static void registerMultiblockAbility(MultiblockAbility ability, MetaTileEntity part) { @@ -65,7 +83,7 @@ public static void registerMultiblockAbility(MultiblockAbility ability, MetaT REGISTRY.get(ability).add(part); } - public MultiblockAbility(String name){ + public MultiblockAbility(String name) { NAME_REGISTRY.put(name.toLowerCase(), this); } } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java index 98e6c6d4764..ef8cf414ed3 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java @@ -1,11 +1,5 @@ package gregtech.api.metatileentity.multiblock; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Rotation; import gregtech.api.GregTechAPI; import gregtech.api.block.VariantActiveBlock; import gregtech.api.capability.GregtechCapabilities; @@ -27,6 +21,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOrientedCubeRenderer; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -44,17 +39,25 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Rotation; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.*; public abstract class MultiblockControllerBase extends MetaTileEntity implements IMultiblockController { @@ -171,7 +174,8 @@ public TextureAtlasSprite getFrontDefaultTexture() { return getFrontOverlay().getParticleSprite(); } - public static TraceabilityPredicate tilePredicate(@Nonnull BiFunction predicate, @Nullable Supplier candidates) { + public static TraceabilityPredicate tilePredicate(@Nonnull BiFunction predicate, + @Nullable Supplier candidates) { return new TraceabilityPredicate(blockWorldState -> { TileEntity tileEntity = blockWorldState.getTileEntity(); if (!(tileEntity instanceof IGregTechTileEntity)) @@ -179,7 +183,8 @@ public static TraceabilityPredicate tilePredicate(@Nonnull BiFunction partsFound = blockWorldState.getMatchContext().getOrCreate("MultiblockParts", HashSet::new); + Set partsFound = blockWorldState.getMatchContext().getOrCreate("MultiblockParts", + HashSet::new); partsFound.add((IMultiblockPart) metaTileEntity); } return true; @@ -189,8 +194,10 @@ public static TraceabilityPredicate tilePredicate(@Nonnull BiFunction tile.metaTileEntityId).toArray(ResourceLocation[]::new); - return tilePredicate((state, tile) -> ArrayUtils.contains(ids, tile.metaTileEntityId), getCandidates(metaTileEntities)); + ResourceLocation[] ids = Arrays.stream(metaTileEntities).filter(Objects::nonNull) + .map(tile -> tile.metaTileEntityId).toArray(ResourceLocation[]::new); + return tilePredicate((state, tile) -> ArrayUtils.contains(ids, tile.metaTileEntityId), + getCandidates(metaTileEntities)); } private static Supplier getCandidates(MetaTileEntity... metaTileEntities) { @@ -210,8 +217,10 @@ private static Supplier getCandidates(IBlockState... allowedStates) public static TraceabilityPredicate abilities(MultiblockAbility... allowedAbilities) { return tilePredicate((state, tile) -> tile instanceof IMultiblockAbilityPart && - ArrayUtils.contains(allowedAbilities, ((IMultiblockAbilityPart) tile).getAbility()), - getCandidates(Arrays.stream(allowedAbilities).flatMap(ability -> MultiblockAbility.REGISTRY.get(ability).stream()).toArray(MetaTileEntity[]::new))); + ArrayUtils.contains(allowedAbilities, ((IMultiblockAbilityPart) tile).getAbility()), + getCandidates(Arrays.stream(allowedAbilities) + .flatMap(ability -> MultiblockAbility.REGISTRY.get(ability).stream()) + .toArray(MetaTileEntity[]::new))); } public static TraceabilityPredicate states(IBlockState... allowedStates) { @@ -228,19 +237,22 @@ public static TraceabilityPredicate states(IBlockState... allowedStates) { * Use this predicate for Frames in your Multiblock. Allows for Framed Pipes as well as normal Frame blocks. */ public static TraceabilityPredicate frames(Material... frameMaterials) { - return states(Arrays.stream(frameMaterials).map(m -> MetaBlocks.FRAMES.get(m).getBlock(m)).toArray(IBlockState[]::new)) - .or(new TraceabilityPredicate(blockWorldState -> { - TileEntity tileEntity = blockWorldState.getTileEntity(); - if (!(tileEntity instanceof IPipeTile)) { - return false; - } - IPipeTile pipeTile = (IPipeTile) tileEntity; - return ArrayUtils.contains(frameMaterials, pipeTile.getFrameMaterial()); - })); + return states(Arrays.stream(frameMaterials).map(m -> MetaBlocks.FRAMES.get(m).getBlock(m)) + .toArray(IBlockState[]::new)) + .or(new TraceabilityPredicate(blockWorldState -> { + TileEntity tileEntity = blockWorldState.getTileEntity(); + if (!(tileEntity instanceof IPipeTile)) { + return false; + } + IPipeTile pipeTile = (IPipeTile) tileEntity; + return ArrayUtils.contains(frameMaterials, pipeTile.getFrameMaterial()); + })); } public static TraceabilityPredicate blocks(Block... block) { - return new TraceabilityPredicate(blockWorldState -> ArrayUtils.contains(block, blockWorldState.getBlockState().getBlock()), getCandidates(Arrays.stream(block).map(Block::getDefaultState).toArray(IBlockState[]::new))); + return new TraceabilityPredicate( + blockWorldState -> ArrayUtils.contains(block, blockWorldState.getBlockState().getBlock()), + getCandidates(Arrays.stream(block).map(Block::getDefaultState).toArray(IBlockState[]::new))); } public static TraceabilityPredicate air() { @@ -262,7 +274,8 @@ public TraceabilityPredicate selfPredicate() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { ICubeRenderer baseTexture = getBaseTexture(null); - pipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + pipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); if (baseTexture instanceof SimpleOrientedCubeRenderer) { baseTexture.renderOriented(renderState, translation, pipeline, getFrontFacing()); } else { @@ -270,8 +283,10 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } if (allowsExtendedFacing()) { - double degree = Math.PI / 2 * (upwardsFacing == EnumFacing.EAST ? -1 : upwardsFacing == EnumFacing.SOUTH ? 2 : upwardsFacing == EnumFacing.WEST ? 1 : 0); - Rotation rotation = new Rotation(degree, frontFacing.getXOffset(), frontFacing.getYOffset(), frontFacing.getZOffset()); + double degree = Math.PI / 2 * (upwardsFacing == EnumFacing.EAST ? -1 : + upwardsFacing == EnumFacing.SOUTH ? 2 : upwardsFacing == EnumFacing.WEST ? 1 : 0); + Rotation rotation = new Rotation(degree, frontFacing.getXOffset(), frontFacing.getYOffset(), + frontFacing.getZOffset()); translation.translate(0.5, 0.5, 0.5); if (frontFacing == EnumFacing.DOWN && upwardsFacing.getAxis() == EnumFacing.Axis.Z) { translation.apply(new Rotation(Math.PI, 0, 1, 0)); @@ -305,7 +320,8 @@ protected Function multiblockPartSorter() { public void checkStructurePattern() { if (structurePattern == null) return; - PatternMatchContext context = structurePattern.checkPatternFastAt(getWorld(), getPos(), getFrontFacing().getOpposite(), getUpwardsFacing(), allowsFlip()); + PatternMatchContext context = structurePattern.checkPatternFastAt(getWorld(), getPos(), + getFrontFacing().getOpposite(), getUpwardsFacing(), allowsFlip()); if (context != null && !structureFormed) { Set rawPartsSet = context.getOrCreate("MultiblockParts", HashSet::new); ArrayList parts = new ArrayList<>(rawPartsSet); @@ -323,7 +339,8 @@ public void checkStructurePattern() { if (multiblockPart instanceof IMultiblockAbilityPart) { @SuppressWarnings("unchecked") IMultiblockAbilityPart abilityPart = (IMultiblockAbilityPart) multiblockPart; - List abilityInstancesList = abilities.computeIfAbsent(abilityPart.getAbility(), k -> new ArrayList<>()); + List abilityInstancesList = abilities.computeIfAbsent(abilityPart.getAbility(), + k -> new ArrayList<>()); abilityPart.registerAbilities(abilityInstancesList); } } @@ -343,8 +360,7 @@ public void checkStructurePattern() { } } - protected void formStructure(PatternMatchContext context) { - } + protected void formStructure(PatternMatchContext context) {} public void invalidateStructure() { this.multiblockParts.forEach(part -> part.removeFromMultiBlock(this)); @@ -447,7 +463,8 @@ public void setFrontFacing(EnumFacing frontFacing) { // Set the upwards facing in a way that makes it "look like" the upwards facing wasn't changed if (allowsExtendedFacing()) { - EnumFacing newUpwardsFacing = RelativeDirection.simulateAxisRotation(frontFacing, oldFrontFacing, getUpwardsFacing()); + EnumFacing newUpwardsFacing = RelativeDirection.simulateAxisRotation(frontFacing, oldFrontFacing, + getUpwardsFacing()); setUpwardsFacing(newUpwardsFacing); } @@ -477,11 +494,13 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (super.onRightClick(playerIn, hand, facing, hitResult)) return true; - if (this.getWorld().isRemote && !this.isStructureFormed() && playerIn.isSneaking() && playerIn.getHeldItem(hand).isEmpty()) { + if (this.getWorld().isRemote && !this.isStructureFormed() && playerIn.isSneaking() && + playerIn.getHeldItem(hand).isEmpty()) { MultiblockPreviewRenderer.renderMultiBlockPreview(this, 60000); return true; } @@ -489,7 +508,8 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, + CuboidRayTraceResult hitResult) { if (wrenchSide == getFrontFacing() && allowsExtendedFacing()) { if (!getWorld().isRemote) { setUpwardsFacing(playerIn.isSneaking() ? upwardsFacing.rotateYCCW() : upwardsFacing.rotateY()); @@ -526,7 +546,8 @@ public List getMatchingShapes() { return repetitionDFS(new ArrayList<>(), aisleRepetitions, new Stack<>()); } - private List repetitionDFS(List pages, int[][] aisleRepetitions, Stack repetitionStack) { + private List repetitionDFS(List pages, int[][] aisleRepetitions, + Stack repetitionStack) { if (repetitionStack.size() == aisleRepetitions.length) { int[] repetition = new int[repetitionStack.size()]; for (int i = 0; i < repetitionStack.size(); i++) { @@ -534,7 +555,8 @@ private List repetitionDFS(List pages, } pages.add(new MultiblockShapeInfo(Objects.requireNonNull(this.structurePattern).getPreview(repetition))); } else { - for (int i = aisleRepetitions[repetitionStack.size()][0]; i <= aisleRepetitions[repetitionStack.size()][1]; i++) { + for (int i = aisleRepetitions[repetitionStack.size()][0]; i <= + aisleRepetitions[repetitionStack.size()][1]; i++) { repetitionStack.push(i); repetitionDFS(pages, aisleRepetitions, repetitionStack); repetitionStack.pop(); @@ -546,7 +568,7 @@ private List repetitionDFS(List pages, @SideOnly(Side.CLIENT) public String[] getDescription() { String key = String.format("gregtech.multiblock.%s.description", metaTileEntityId.getPath()); - return I18n.hasKey(key) ? new String[]{I18n.format(key)} : new String[0]; + return I18n.hasKey(key) ? new String[] { I18n.format(key) } : new String[0]; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java index cf34d8094b9..0802125bf07 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java @@ -6,6 +6,7 @@ import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.common.ConfigHolder; + import net.minecraft.util.text.*; import java.util.List; @@ -24,7 +25,8 @@ public static Builder builder(List textList, boolean isStructure return builder(textList, isStructureFormed, true); } - public static Builder builder(List textList, boolean isStructureFormed, boolean showIncompleteStructureWarning) { + public static Builder builder(List textList, boolean isStructureFormed, + boolean showIncompleteStructureWarning) { return new Builder(textList, isStructureFormed, showIncompleteStructureWarning); } @@ -40,13 +42,16 @@ public static class Builder { private String pausedKey = "gregtech.multiblock.work_paused"; private String runningKey = "gregtech.multiblock.running"; - private Builder(List textList, boolean isStructureFormed, boolean showIncompleteStructureWarning) { + private Builder(List textList, boolean isStructureFormed, + boolean showIncompleteStructureWarning) { this.textList = textList; this.isStructureFormed = isStructureFormed; if (!isStructureFormed && showIncompleteStructureWarning) { - ITextComponent base = TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.invalid_structure"); - ITextComponent hover = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.invalid_structure.tooltip"); + ITextComponent base = TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.invalid_structure"); + ITextComponent hover = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.invalid_structure.tooltip"); textList.add(TextComponentUtil.setHover(base, hover)); } } @@ -87,13 +92,15 @@ public Builder addEnergyUsageLine(IEnergyContainer energyContainer) { String energyFormatted = TextFormattingUtil.formatNumbers(maxVoltage); // wrap in text component to keep it from being formatted - ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); + ITextComponent voltageName = new TextComponentString( + GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); ITextComponent bodyText = TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.max_energy_per_tick", energyFormatted, voltageName); - ITextComponent hoverText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.max_energy_per_tick_hover"); + ITextComponent hoverText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.max_energy_per_tick_hover"); textList.add(TextComponentUtil.setHover(bodyText, hoverText)); } return this; @@ -102,7 +109,8 @@ public Builder addEnergyUsageLine(IEnergyContainer energyContainer) { /** * Adds the max Recipe Tier that this multiblock can use for recipe lookup. *
- * Added if the structure is formed and if the passed tier is a valid energy tier index for {@link GTValues#VNF}. + * Added if the structure is formed and if the passed tier is a valid energy tier index for + * {@link GTValues#VNF}. */ public Builder addEnergyTierLine(int tier) { if (!isStructureFormed) return this; @@ -113,7 +121,8 @@ public Builder addEnergyTierLine(int tier) { TextFormatting.GRAY, "gregtech.multiblock.max_recipe_tier", voltageName); - ITextComponent hoverText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.max_recipe_tier_hover"); + ITextComponent hoverText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.max_recipe_tier_hover"); textList.add(TextComponentUtil.setHover(bodyText, hoverText)); return this; } @@ -128,7 +137,8 @@ public Builder addEnergyUsageExactLine(long energyUsage) { if (energyUsage > 0) { String energyFormatted = TextFormattingUtil.formatNumbers(energyUsage); // wrap in text component to keep it from being formatted - ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getTierByVoltage(energyUsage)]); + ITextComponent voltageName = new TextComponentString( + GTValues.VNF[GTUtility.getTierByVoltage(energyUsage)]); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, @@ -148,7 +158,8 @@ public Builder addEnergyProductionLine(long maxVoltage, long recipeEUt) { if (maxVoltage != 0 && maxVoltage >= -recipeEUt) { String energyFormatted = TextFormattingUtil.formatNumbers(maxVoltage); // wrap in text component to keep it from being formatted - ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); + ITextComponent voltageName = new TextComponentString( + GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, @@ -159,16 +170,19 @@ public Builder addEnergyProductionLine(long maxVoltage, long recipeEUt) { } /** - * Adds the max EU/t that this multiblock can produce, including how many amps. Recommended for multi-amp outputting multis. + * Adds the max EU/t that this multiblock can produce, including how many amps. Recommended for multi-amp + * outputting multis. *
- * Added if the structure is formed, if the amperage is greater than zero and if the max voltage is greater than zero. + * Added if the structure is formed, if the amperage is greater than zero and if the max voltage is greater than + * zero. */ public Builder addEnergyProductionAmpsLine(long maxVoltage, int amperage) { if (!isStructureFormed) return this; if (maxVoltage != 0 && amperage != 0) { String energyFormatted = TextFormattingUtil.formatNumbers(maxVoltage); // wrap in text component to keep it from being formatted - ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); + ITextComponent voltageName = new TextComponentString( + GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, @@ -186,7 +200,8 @@ public Builder addEnergyProductionAmpsLine(long maxVoltage, int amperage) { public Builder addComputationUsageLine(int maxCWUt) { if (!isStructureFormed) return this; if (maxCWUt > 0) { - ITextComponent computation = TextComponentUtil.stringWithColor(TextFormatting.AQUA, TextFormattingUtil.formatNumbers(maxCWUt)); + ITextComponent computation = TextComponentUtil.stringWithColor(TextFormatting.AQUA, + TextFormattingUtil.formatNumbers(maxCWUt)); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.computation.max", @@ -203,7 +218,8 @@ public Builder addComputationUsageLine(int maxCWUt) { public Builder addComputationUsageExactLine(int currentCWUt) { if (!isStructureFormed) return this; if (isActive && currentCWUt > 0) { - ITextComponent computation = TextComponentUtil.stringWithColor(TextFormatting.AQUA, TextFormattingUtil.formatNumbers(currentCWUt) + " CWU/t"); + ITextComponent computation = TextComponentUtil.stringWithColor(TextFormatting.AQUA, + TextFormattingUtil.formatNumbers(currentCWUt) + " CWU/t"); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.computation.usage", @@ -285,7 +301,8 @@ public Builder addProgressLine(double progressPercent) { // todo return this; } - /** Adds a line indicating how many parallels this multi can potentially perform. + /** + * Adds a line indicating how many parallels this multi can potentially perform. *
* Added if structure is formed and the number of parallels is greater than one. */ @@ -312,7 +329,8 @@ public Builder addParallelsLine(int numParallels) { public Builder addLowPowerLine(boolean isLowPower) { if (!isStructureFormed) return this; if (isLowPower) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.not_enough_energy")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.not_enough_energy")); } return this; } @@ -325,7 +343,8 @@ public Builder addLowPowerLine(boolean isLowPower) { public Builder addLowComputationLine(boolean isLowComputation) { if (!isStructureFormed) return this; if (isLowComputation) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.computation.not_enough_computation")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.computation.not_enough_computation")); } return this; } @@ -338,7 +357,8 @@ public Builder addLowComputationLine(boolean isLowComputation) { public Builder addLowDynamoTierLine(boolean isTooLow) { if (!isStructureFormed) return this; if (isTooLow) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.not_enough_energy_output")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.not_enough_energy_output")); } return this; } @@ -422,8 +442,10 @@ private boolean addMaintenanceProblemHeader(boolean hasAddedHeader) { public Builder addMufflerObstructedLine(boolean isObstructed) { if (!isStructureFormed) return this; if (isObstructed) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.universal.muffler_obstructed")); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.universal.muffler_obstructed_desc")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.universal.muffler_obstructed")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.universal.muffler_obstructed_desc")); } return this; } @@ -436,7 +458,8 @@ public Builder addMufflerObstructedLine(boolean isObstructed) { public Builder addFuelNeededLine(String fuelName, int previousRecipeDuration) { if (!isStructureFormed || !isActive) return this; ITextComponent fuelNeeded = TextComponentUtil.stringWithColor(TextFormatting.RED, fuelName); - ITextComponent numTicks = TextComponentUtil.stringWithColor(TextFormatting.AQUA, TextFormattingUtil.formatNumbers(previousRecipeDuration)); + ITextComponent numTicks = TextComponentUtil.stringWithColor(TextFormatting.AQUA, + TextFormattingUtil.formatNumbers(previousRecipeDuration)); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.turbine.fuel_needed", diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java index f036a3cc08e..c065b166997 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java @@ -19,6 +19,7 @@ import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; import gregtech.common.ConfigHolder; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -31,6 +32,7 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.jetbrains.annotations.NotNull; import java.util.*; @@ -56,17 +58,20 @@ public abstract class MultiblockWithDisplayBase extends MultiblockControllerBase /** * Items to recover in a muffler hatch */ - protected final List recoveryItems = new ArrayList<>(Collections.singleton(OreDictUnifier.get(OrePrefix.dustTiny, Materials.Ash))); + protected final List recoveryItems = new ArrayList<>( + Collections.singleton(OreDictUnifier.get(OrePrefix.dustTiny, Materials.Ash))); private int timeActive; /** * This value stores whether each of the 5 maintenance problems have been fixed. * A value of 0 means the problem is not fixed, else it is fixed - * Value positions correspond to the following from left to right: 0=Wrench, 1=Screwdriver, 2=Soft Mallet, 3=Hard Hammer, 4=Wire Cutter, 5=Crowbar + * Value positions correspond to the following from left to right: 0=Wrench, 1=Screwdriver, 2=Soft Mallet, 3=Hard + * Hammer, 4=Wire Cutter, 5=Crowbar */ protected byte maintenance_problems; - // Used for tracking if this is the initial state of the machine, for maintenance hatches which automatically fix initial issues. + // Used for tracking if this is the initial state of the machine, for maintenance hatches which automatically fix + // initial issues. private boolean initialMaintenanceDone; // Used for data preservation with Maintenance Hatch @@ -97,7 +102,8 @@ public void setMaintenanceFixed(int index) { @Override public void causeMaintenanceProblems() { this.maintenance_problems &= ~(1 << ((int) (GTValues.RNG.nextFloat() * 5))); - this.getWorld().playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getBreakdownSound(), SoundCategory.BLOCKS, 1.f, 1.f); + this.getWorld().playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), + this.getBreakdownSound(), SoundCategory.BLOCKS, 1.f, 1.f); } /** @@ -113,7 +119,8 @@ public byte getMaintenanceProblems() { */ @Override public int getNumMaintenanceProblems() { - return ConfigHolder.machines.enableMaintenance && hasMaintenanceMechanics() ? 6 - Integer.bitCount(maintenance_problems) : 0; + return ConfigHolder.machines.enableMaintenance && hasMaintenanceMechanics() ? + 6 - Integer.bitCount(maintenance_problems) : 0; } /** @@ -175,7 +182,8 @@ public boolean isStructureObstructed() { @Override protected void formStructure(PatternMatchContext context) { super.formStructure(context); - if (this.hasMaintenanceMechanics() && ConfigHolder.machines.enableMaintenance) { // nothing extra if no maintenance + if (this.hasMaintenanceMechanics() && ConfigHolder.machines.enableMaintenance) { // nothing extra if no + // maintenance if (getAbilities(MultiblockAbility.MAINTENANCE_HATCH).isEmpty()) return; maintenanceHatch = getAbilities(MultiblockAbility.MAINTENANCE_HATCH).get(0); @@ -261,7 +269,8 @@ public boolean isMufflerFaceFree() { if (hasMufflerMechanics() && getAbilities(MultiblockAbility.MUFFLER_HATCH).size() == 0) return false; - return isStructureFormed() && hasMufflerMechanics() && getAbilities(MultiblockAbility.MUFFLER_HATCH).get(0).isFrontFaceFree(); + return isStructureFormed() && hasMufflerMechanics() && + getAbilities(MultiblockAbility.MUFFLER_HATCH).get(0).isFrontFaceFree(); } /** @@ -330,7 +339,8 @@ public TraceabilityPredicate autoAbilities(boolean checkMaintenance, boolean che predicate = predicate.or(maintenancePredicate()); } if (checkMuffler && hasMufflerMechanics()) { - predicate = predicate.or(abilities(MultiblockAbility.MUFFLER_HATCH).setMinGlobalLimited(1).setMaxGlobalLimited(1)); + predicate = predicate + .or(abilities(MultiblockAbility.MUFFLER_HATCH).setMinGlobalLimited(1).setMaxGlobalLimited(1)); } return predicate; } @@ -357,8 +367,7 @@ protected void addDisplayText(List textList) { * with special click event handler * Data is the data specified in the component */ - protected void handleDisplayClick(String componentData, ClickData clickData) { - } + protected void handleDisplayClick(String componentData, ClickData clickData) {} protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 198, 208); @@ -373,21 +382,21 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { () -> progressMulti.getFillPercentage(0), 4, 115, 62, 7, progressMulti.getProgressBarTexture(0), ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); builder.widget(progressBar); progressBar = new ProgressWidget( () -> progressMulti.getFillPercentage(1), 68, 115, 62, 7, progressMulti.getProgressBarTexture(1), ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 1)); + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 1)); builder.widget(progressBar); progressBar = new ProgressWidget( () -> progressMulti.getFillPercentage(2), 132, 115, 62, 7, progressMulti.getProgressBarTexture(2), ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 2)); + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 2)); builder.widget(progressBar); } else if (progressMulti.getNumProgressBars() == 2) { // double bar @@ -395,14 +404,14 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { () -> progressMulti.getFillPercentage(0), 4, 115, 94, 7, progressMulti.getProgressBarTexture(0), ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); builder.widget(progressBar); progressBar = new ProgressWidget( () -> progressMulti.getFillPercentage(1), 100, 115, 94, 7, progressMulti.getProgressBarTexture(1), ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 1)); + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 1)); builder.widget(progressBar); } else { // single bar @@ -410,7 +419,7 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { () -> progressMulti.getFillPercentage(0), 4, 115, 190, 7, progressMulti.getProgressBarTexture(0), ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); builder.widget(progressBar); } builder.widget(new IndicatorImageWidget(174, 93, 17, 17, getLogo()) @@ -441,7 +450,7 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { if (shouldShowVoidingModeButton()) { builder.widget(new ImageCycleButtonWidget(173, 161, 18, 18, GuiTextures.BUTTON_VOID_MULTIBLOCK, 4, this::getVoidingMode, this::setVoidingMode) - .setTooltipHoverString(MultiblockWithDisplayBase::getVoidingModeTooltip)); + .setTooltipHoverString(MultiblockWithDisplayBase::getVoidingModeTooltip)); } else { builder.widget(new ImageWidget(173, 161, 18, 18, GuiTextures.BUTTON_VOID_NONE) .setTooltip("gregtech.gui.multiblock_voiding_not_supported")); @@ -449,8 +458,10 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { // Distinct Buses Button if (this instanceof IDistinctBusController distinct && distinct.canBeDistinct()) { - builder.widget(new ImageCycleButtonWidget(173, 143, 18, 18, GuiTextures.BUTTON_DISTINCT_BUSES, distinct::isDistinct, distinct::setDistinct) - .setTooltipHoverString(i -> "gregtech.multiblock.universal.distinct_" + (i == 0 ? "disabled" : "enabled"))); + builder.widget(new ImageCycleButtonWidget(173, 143, 18, 18, GuiTextures.BUTTON_DISTINCT_BUSES, + distinct::isDistinct, distinct::setDistinct) + .setTooltipHoverString(i -> "gregtech.multiblock.universal.distinct_" + + (i == 0 ? "disabled" : "enabled"))); } else { builder.widget(new ImageWidget(173, 143, 18, 18, GuiTextures.BUTTON_NO_DISTINCT_BUSES) .setTooltip("gregtech.multiblock.universal.distinct_not_supported")); @@ -466,7 +477,8 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { /** * Add a custom third button to the Multiblock UI. By default, this is a placeholder * stating that there is no additional functionality for this Multiblock. - *

+ *
+ *
* Parameters should be passed directly to the created widget. Size will be 18x18. */ @SuppressWarnings("SameParameterValue") @@ -521,7 +533,8 @@ protected void setVoidingMode(int mode) { this.voidingItems = mode == 1 || mode == 3; - // After changing the voiding mode, reset the notified buses in case a recipe can run now that voiding mode has been changed + // After changing the voiding mode, reset the notified buses in case a recipe can run now that voiding mode has + // been changed for (IFluidTank tank : this.getAbilities(MultiblockAbility.IMPORT_FLUIDS)) { this.getNotifiedFluidInputList().add((IFluidHandler) tank); } @@ -621,7 +634,8 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { } if (getWorld().provider.getDimension() == id) { - getWorld().markBlockRangeForRenderUpdate(new BlockPos(minX, minY, minZ), new BlockPos(maxX, maxY, maxZ)); + getWorld().markBlockRangeForRenderUpdate(new BlockPos(minX, minY, minZ), + new BlockPos(maxX, maxY, maxZ)); } } if (dataId == IS_WORKING) { diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/ParallelLogicType.java b/src/main/java/gregtech/api/metatileentity/multiblock/ParallelLogicType.java index 00b3d7770a0..58f913d0e6a 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/ParallelLogicType.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/ParallelLogicType.java @@ -1,5 +1,6 @@ package gregtech.api.metatileentity.multiblock; public enum ParallelLogicType { - MULTIPLY, APPEND_ITEMS + MULTIPLY, + APPEND_ITEMS } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java index 25857cf5538..e81be4277aa 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java @@ -1,9 +1,5 @@ package gregtech.api.metatileentity.multiblock; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.capability.IDistinctBusController; import gregtech.api.capability.IEnergyContainer; @@ -21,6 +17,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.TextFormattingUtil; import gregtech.common.ConfigHolder; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; @@ -31,12 +28,19 @@ import net.minecraft.util.text.TextFormatting; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import com.google.common.collect.Lists; + import java.util.ArrayList; import java.util.List; -public abstract class RecipeMapMultiblockController extends MultiblockWithDisplayBase implements IDataInfoProvider, ICleanroomReceiver, IDistinctBusController { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class RecipeMapMultiblockController extends MultiblockWithDisplayBase implements IDataInfoProvider, + ICleanroomReceiver, IDistinctBusController { public final RecipeMap recipeMap; protected MultiblockRecipeLogic recipeMapWorkable; @@ -104,7 +108,7 @@ public void invalidateStructure() { @Override protected void updateFormedValid() { - if (!hasMufflerMechanics() || isMufflerFaceFree()){ + if (!hasMufflerMechanics() || isMufflerFaceFree()) { this.recipeMapWorkable.updateWorkable(); } } @@ -116,9 +120,11 @@ public boolean isActive() { protected void initializeAbilities() { this.inputInventory = new ItemHandlerList(getAbilities(MultiblockAbility.IMPORT_ITEMS)); - this.inputFluidInventory = new FluidTankList(allowSameFluidFillForOutputs(), getAbilities(MultiblockAbility.IMPORT_FLUIDS)); + this.inputFluidInventory = new FluidTankList(allowSameFluidFillForOutputs(), + getAbilities(MultiblockAbility.IMPORT_FLUIDS)); this.outputInventory = new ItemHandlerList(getAbilities(MultiblockAbility.EXPORT_ITEMS)); - this.outputFluidInventory = new FluidTankList(allowSameFluidFillForOutputs(), getAbilities(MultiblockAbility.EXPORT_FLUIDS)); + this.outputFluidInventory = new FluidTankList(allowSameFluidFillForOutputs(), + getAbilities(MultiblockAbility.EXPORT_FLUIDS)); this.energyContainer = new EnergyContainerList(getAbilities(MultiblockAbility.INPUT_ENERGY)); } @@ -198,7 +204,8 @@ public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); + this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); } @Override @@ -240,7 +247,7 @@ public boolean isDistinct() { public void setDistinct(boolean isDistinct) { this.isDistinct = isDistinct; recipeMapWorkable.onDistinctChanged(); - //mark buses as changed on distinct toggle + // mark buses as changed on distinct toggle if (this.isDistinct) { this.notifiedItemInputList.addAll(this.getAbilities(MultiblockAbility.IMPORT_ITEMS)); } else { @@ -259,38 +266,44 @@ public List getDataInfo() { List list = new ArrayList<>(); if (recipeMapWorkable.getMaxProgress() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.workable_progress", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getProgress() / 20)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getMaxProgress() / 20)).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getProgress() / 20)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(recipeMapWorkable.getMaxProgress() / 20)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } list.add(new TextComponentTranslation("behavior.tricorder.energy_container_storage", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored())).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored())) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); if (recipeMapWorkable.getRecipeEUt() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.workable_consumption", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getRecipeEUt())).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getRecipeEUt() == 0 ? 0 : 1)).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getRecipeEUt())) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(recipeMapWorkable.getRecipeEUt() == 0 ? 0 : 1)) + .setStyle(new Style().setColor(TextFormatting.RED)))); } list.add(new TextComponentTranslation("behavior.tricorder.multiblock_energy_input", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getInputVoltage())).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(GTValues.VN[GTUtility.getTierByVoltage(energyContainer.getInputVoltage())]).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getInputVoltage())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation(GTValues.VN[GTUtility.getTierByVoltage(energyContainer.getInputVoltage())]) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); if (ConfigHolder.machines.enableMaintenance && hasMaintenanceMechanics()) { list.add(new TextComponentTranslation("behavior.tricorder.multiblock_maintenance", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(getNumMaintenanceProblems())).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(getNumMaintenanceProblems())) + .setStyle(new Style().setColor(TextFormatting.RED)))); } if (recipeMapWorkable.getParallelLimit() > 1) { list.add(new TextComponentTranslation("behavior.tricorder.multiblock_parallel", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getParallelLimit())).setStyle(new Style().setColor(TextFormatting.GREEN)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getParallelLimit())) + .setStyle(new Style().setColor(TextFormatting.GREEN)))); } return list; diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java index 7c6b9c81b3e..d5bd83b3413 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java @@ -3,6 +3,7 @@ import gregtech.api.capability.impl.*; import gregtech.api.metatileentity.MTETrait; import gregtech.api.recipes.RecipeMap; + import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraftforge.fluids.FluidTank; @@ -22,10 +23,14 @@ public RecipeMapPrimitiveMultiblockController(ResourceLocation metaTileEntityId, // just initialize inventories based on RecipeMap values by default protected void initializeAbilities() { - this.importItems = new NotifiableItemStackHandler(this, recipeMapWorkable.getRecipeMap().getMaxInputs(), this, false); - this.importFluids = new FluidTankList(true, makeFluidTanks(recipeMapWorkable.getRecipeMap().getMaxFluidInputs(), false)); - this.exportItems = new NotifiableItemStackHandler(this, recipeMapWorkable.getRecipeMap().getMaxOutputs(), this, true); - this.exportFluids = new FluidTankList(false, makeFluidTanks(recipeMapWorkable.getRecipeMap().getMaxFluidOutputs(), true)); + this.importItems = new NotifiableItemStackHandler(this, recipeMapWorkable.getRecipeMap().getMaxInputs(), this, + false); + this.importFluids = new FluidTankList(true, + makeFluidTanks(recipeMapWorkable.getRecipeMap().getMaxFluidInputs(), false)); + this.exportItems = new NotifiableItemStackHandler(this, recipeMapWorkable.getRecipeMap().getMaxOutputs(), this, + true); + this.exportFluids = new FluidTankList(false, + makeFluidTanks(recipeMapWorkable.getRecipeMap().getMaxFluidOutputs(), true)); this.itemInventory = new ItemHandlerProxy(this.importItems, this.exportItems); this.fluidInventory = new FluidHandlerProxy(this.importFluids, this.exportFluids); diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java index 025e54ea9af..fd396609419 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java @@ -1,8 +1,5 @@ package gregtech.api.metatileentity.multiblock; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.capability.impl.ItemHandlerList; @@ -20,6 +17,7 @@ import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.common.ConfigHolder; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; @@ -28,6 +26,10 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.items.IItemHandlerModifiable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; public abstract class RecipeMapSteamMultiblockController extends MultiblockWithDisplayBase { @@ -41,7 +43,8 @@ public abstract class RecipeMapSteamMultiblockController extends MultiblockWithD protected IItemHandlerModifiable outputInventory; protected IMultipleTankHandler steamFluidTank; - public RecipeMapSteamMultiblockController(ResourceLocation metaTileEntityId, RecipeMap recipeMap, double conversionRate) { + public RecipeMapSteamMultiblockController(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + double conversionRate) { super(metaTileEntityId); this.recipeMap = recipeMap; this.recipeMapWorkable = new SteamMultiblockRecipeLogic(this, recipeMap, steamFluidTank, conversionRate); @@ -147,7 +150,8 @@ public TraceabilityPredicate autoAbilities(boolean checkSteam, boolean checkItemOut, boolean checkMuffler) { TraceabilityPredicate predicate = super.autoAbilities(checkMaintainer, checkMuffler) - .or(checkSteam ? abilities(MultiblockAbility.STEAM).setMinGlobalLimited(1).setPreviewCount(1) : new TraceabilityPredicate()); + .or(checkSteam ? abilities(MultiblockAbility.STEAM).setMinGlobalLimited(1).setPreviewCount(1) : + new TraceabilityPredicate()); if (checkItemIn) { if (recipeMap.getMaxInputs() > 0) { predicate = predicate.or(abilities(MultiblockAbility.STEAM_IMPORT_ITEMS).setPreviewCount(1)); @@ -155,7 +159,7 @@ public TraceabilityPredicate autoAbilities(boolean checkSteam, } if (checkItemOut) { if (recipeMap.getMaxOutputs() > 0) { - predicate = predicate.or(abilities(MultiblockAbility.STEAM_EXPORT_ITEMS).setPreviewCount(1)); + predicate = predicate.or(abilities(MultiblockAbility.STEAM_EXPORT_ITEMS).setPreviewCount(1)); } } return predicate; @@ -169,7 +173,8 @@ protected boolean shouldUpdate(MTETrait trait) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); + this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); } @Override @@ -184,7 +189,8 @@ public boolean isActive() { @Override protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { - ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND_STEAM.get(ConfigHolder.machines.steelSteamMultiblocks), 176, 208); + ModularUI.Builder builder = ModularUI + .builder(GuiTextures.BACKGROUND_STEAM.get(ConfigHolder.machines.steelSteamMultiblocks), 176, 208); builder.shouldColor(false); builder.image(4, 4, 168, 117, GuiTextures.DISPLAY_STEAM.get(ConfigHolder.machines.steelSteamMultiblocks)); builder.label(9, 9, getMetaFullName(), 0xFFFFFF); @@ -194,7 +200,8 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { builder.widget(new IndicatorImageWidget(152, 101, 17, 17, getLogo()) .setWarningStatus(getWarningLogo(), this::addWarningText) .setErrorStatus(getErrorLogo(), this::addErrorText)); - builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT_STEAM.get(ConfigHolder.machines.steelSteamMultiblocks), 7, 125); + builder.bindPlayerInventory(entityPlayer.inventory, + GuiTextures.SLOT_STEAM.get(ConfigHolder.machines.steelSteamMultiblocks), 7, 125); return builder; } } diff --git a/src/main/java/gregtech/api/modules/IGregTechModule.java b/src/main/java/gregtech/api/modules/IGregTechModule.java index f767e09471f..847a87878ec 100644 --- a/src/main/java/gregtech/api/modules/IGregTechModule.java +++ b/src/main/java/gregtech/api/modules/IGregTechModule.java @@ -2,69 +2,62 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.event.*; + import org.apache.logging.log4j.Logger; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; + /** * All modules must implement this interface. *

- * Provides methods for responding to FML lifecycle events, adding event bus subscriber classes, and processing IMC messages. + * Provides methods for responding to FML lifecycle events, adding event bus subscriber classes, and processing IMC + * messages. */ public interface IGregTechModule { /** * What other modules this module depends on. *

- * e.g. new ResourceLocation("gregtech", "foo_module") represents a dependency on the module "foo_module" in the container "gregtech" + * e.g. new ResourceLocation("gregtech", "foo_module") represents a dependency on the module + * "foo_module" in the container "gregtech" */ @Nonnull default Set getDependencyUids() { return Collections.emptySet(); } - default void construction(FMLConstructionEvent event) { - } + default void construction(FMLConstructionEvent event) {} - default void preInit(FMLPreInitializationEvent event) { - } + default void preInit(FMLPreInitializationEvent event) {} - default void init(FMLInitializationEvent event) { - } + default void init(FMLInitializationEvent event) {} - default void postInit(FMLPostInitializationEvent event) { - } + default void postInit(FMLPostInitializationEvent event) {} - default void loadComplete(FMLLoadCompleteEvent event) { - } + default void loadComplete(FMLLoadCompleteEvent event) {} - default void serverAboutToStart(FMLServerAboutToStartEvent event) { - } + default void serverAboutToStart(FMLServerAboutToStartEvent event) {} - default void serverStarting(FMLServerStartingEvent event) { - } + default void serverStarting(FMLServerStartingEvent event) {} - default void serverStarted(FMLServerStartedEvent event) { - } + default void serverStarted(FMLServerStartedEvent event) {} - default void serverStopping(FMLServerStoppingEvent event) { - } + default void serverStopping(FMLServerStoppingEvent event) {} - default void serverStopped(FMLServerStoppedEvent event) { - } + default void serverStopped(FMLServerStoppedEvent event) {} /** * Register packets using GregTech's packet handling API here. */ - default void registerPackets() { - } + default void registerPackets() {} /** * @return A list of classes to subscribe to the Forge event bus. - * As the class gets subscribed, not any specific instance, event handlers must be static! + * As the class gets subscribed, not any specific instance, event handlers must be static! */ @Nonnull default List> getEventBusSubscribers() { diff --git a/src/main/java/gregtech/api/modules/IModuleManager.java b/src/main/java/gregtech/api/modules/IModuleManager.java index 6ce3bac26ef..e6a04f62075 100644 --- a/src/main/java/gregtech/api/modules/IModuleManager.java +++ b/src/main/java/gregtech/api/modules/IModuleManager.java @@ -1,6 +1,7 @@ package gregtech.api.modules; import gregtech.api.util.GTUtility; + import net.minecraft.util.ResourceLocation; public interface IModuleManager { diff --git a/src/main/java/gregtech/api/modules/ModuleContainer.java b/src/main/java/gregtech/api/modules/ModuleContainer.java index dd66e14d4fa..a589fa5e0bd 100644 --- a/src/main/java/gregtech/api/modules/ModuleContainer.java +++ b/src/main/java/gregtech/api/modules/ModuleContainer.java @@ -10,5 +10,4 @@ */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) -public @interface ModuleContainer { -} +public @interface ModuleContainer {} diff --git a/src/main/java/gregtech/api/modules/ModuleContainerRegistryEvent.java b/src/main/java/gregtech/api/modules/ModuleContainerRegistryEvent.java index 5328fd4c685..092de63ee5e 100644 --- a/src/main/java/gregtech/api/modules/ModuleContainerRegistryEvent.java +++ b/src/main/java/gregtech/api/modules/ModuleContainerRegistryEvent.java @@ -2,5 +2,4 @@ import net.minecraftforge.fml.common.eventhandler.Event; -public class ModuleContainerRegistryEvent extends Event { -} +public class ModuleContainerRegistryEvent extends Event {} diff --git a/src/main/java/gregtech/api/network/IPacket.java b/src/main/java/gregtech/api/network/IPacket.java index e18da5a0081..f5152e13410 100644 --- a/src/main/java/gregtech/api/network/IPacket.java +++ b/src/main/java/gregtech/api/network/IPacket.java @@ -3,22 +3,27 @@ import net.minecraft.network.PacketBuffer; /** - * The general structure of Network Packets.

+ * The general structure of Network Packets.
+ *
*

* To implement a new packet, implement both {@link IPacket#encode(PacketBuffer)} and - * {@link IPacket#decode(PacketBuffer)}, and register the packet to {@link gregtech.api.GregTechAPI#networkHandler}.

+ * {@link IPacket#decode(PacketBuffer)}, and register the packet to {@link gregtech.api.GregTechAPI#networkHandler}.
+ *
+ *

+ * Additionally, do one of the following: *

- * Additionally, do one of the following:

* - If this Packet is to be received on the SERVER, implement {@link IServerExecutor}. *

- * - If this Packet is to be received on the CLIENT, implement {@link IClientExecutor}.

+ * - If this Packet is to be received on the CLIENT, implement {@link IClientExecutor}.
+ *
*

* Lastly, add a no-args constructor to your Packet class. */ public interface IPacket { /** - * Used to write data from a Packet into a PacketBuffer.

+ * Used to write data from a Packet into a PacketBuffer.
+ *
*

* This is the first step in sending a Packet to a different thread, * and is done on the "sending" side. @@ -28,7 +33,8 @@ public interface IPacket { void encode(PacketBuffer buf); /** - * Used to read data from a PacketBuffer into this Packet.

+ * Used to read data from a PacketBuffer into this Packet.
+ *
*

* This is the next step of sending a Packet to a different thread, * and is done on the "receiving" side. diff --git a/src/main/java/gregtech/api/network/PacketDataList.java b/src/main/java/gregtech/api/network/PacketDataList.java index 427c0e7bea2..e2f57507eff 100644 --- a/src/main/java/gregtech/api/network/PacketDataList.java +++ b/src/main/java/gregtech/api/network/PacketDataList.java @@ -2,12 +2,14 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; + import org.jetbrains.annotations.NotNull; /** * An optimised data structure backed by two arrays. * This is essentially equivalent to List>, but more efficient. - * {@link it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap} can not be used since it doesn't allow duplicate discriminators. + * {@link it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap} can not be used since it doesn't allow duplicate + * discriminators. */ public class PacketDataList { diff --git a/src/main/java/gregtech/api/pattern/BlockPattern.java b/src/main/java/gregtech/api/pattern/BlockPattern.java index 4e1ac49e858..ec3cba8402b 100644 --- a/src/main/java/gregtech/api/pattern/BlockPattern.java +++ b/src/main/java/gregtech/api/pattern/BlockPattern.java @@ -8,8 +8,7 @@ import gregtech.api.util.BlockInfo; import gregtech.api.util.RelativeDirection; import gregtech.common.blocks.MetaBlocks; -import it.unimi.dsi.fastutil.longs.Long2ObjectMap; -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -20,9 +19,11 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + +import it.unimi.dsi.fastutil.longs.Long2ObjectMap; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nonnull; import java.lang.reflect.Array; import java.util.Arrays; import java.util.HashMap; @@ -30,15 +31,18 @@ import java.util.Map; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class BlockPattern { - static EnumFacing[] FACINGS = {EnumFacing.SOUTH, EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.EAST, EnumFacing.UP, EnumFacing.DOWN}; + static EnumFacing[] FACINGS = { EnumFacing.SOUTH, EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.EAST, EnumFacing.UP, + EnumFacing.DOWN }; public final int[][] aisleRepetitions; public final RelativeDirection[] structureDir; - protected final TraceabilityPredicate[][][] blockMatches; //[z][y][x] - protected final int fingerLength; //z size - protected final int thumbLength; //y size - protected final int palmLength; //x size + protected final TraceabilityPredicate[][][] blockMatches; // [z][y][x] + protected final int fingerLength; // z size + protected final int thumbLength; // y size + protected final int palmLength; // x size protected final BlockWorldState worldState = new BlockWorldState(); protected final PatternMatchContext matchContext = new PatternMatchContext(); protected final Map globalCount; @@ -83,10 +87,11 @@ private void initializeCenterOffsets() { loop: for (int x = 0; x < this.palmLength; x++) { for (int y = 0; y < this.thumbLength; y++) { - for (int z = 0, minZ = 0, maxZ = 0; z < this.fingerLength; minZ += aisleRepetitions[z][0], maxZ += aisleRepetitions[z][1], z++) { + for (int z = 0, minZ = 0, maxZ = 0; z < + this.fingerLength; minZ += aisleRepetitions[z][0], maxZ += aisleRepetitions[z][1], z++) { TraceabilityPredicate predicate = this.blockMatches[z][y][x]; if (predicate.isCenter) { - centerOffset = new int[]{x, y, z, minZ, maxZ}; + centerOffset = new int[] { x, y, z, minZ, maxZ }; break loop; } } @@ -101,7 +106,8 @@ public PatternError getError() { return worldState.error; } - public PatternMatchContext checkPatternFastAt(World world, BlockPos centerPos, EnumFacing frontFacing, EnumFacing upwardsFacing, boolean allowsFlip) { + public PatternMatchContext checkPatternFastAt(World world, BlockPos centerPos, EnumFacing frontFacing, + EnumFacing upwardsFacing, boolean allowsFlip) { if (!cache.isEmpty()) { boolean pass = true; for (Map.Entry entry : cache.entrySet()) { @@ -139,7 +145,8 @@ public void clearCache() { cache.clear(); } - private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, EnumFacing frontFacing, EnumFacing upwardsFacing, boolean isFlipped) { + private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, EnumFacing frontFacing, + EnumFacing upwardsFacing, boolean isFlipped) { boolean findFirstAisle = false; int minZ = -centerOffset[4]; @@ -147,13 +154,13 @@ private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, Enum this.globalCount.clear(); this.layerCount.clear(); cache.clear(); - //Checking aisles + // Checking aisles for (int c = 0, z = minZ++, r; c < this.fingerLength; c++) { - //Checking repeatable slices + // Checking repeatable slices int validRepetitions = 0; loop: for (r = 0; (findFirstAisle ? r < aisleRepetitions[c][1] : z <= -centerOffset[3]); r++) { - //Checking single slice + // Checking single slice this.layerCount.clear(); for (int b = 0, y = -centerOffset[1]; b < this.thumbLength; b++, y++) { @@ -166,24 +173,26 @@ private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, Enum if (predicate != TraceabilityPredicate.ANY) { if (tileEntity instanceof IGregTechTileEntity) { if (((IGregTechTileEntity) tileEntity).isValid()) { - cache.put(pos.toLong(), new BlockInfo(worldState.getBlockState(), tileEntity, predicate)); + cache.put(pos.toLong(), + new BlockInfo(worldState.getBlockState(), tileEntity, predicate)); } else { cache.put(pos.toLong(), new BlockInfo(worldState.getBlockState(), null, predicate)); } } else { - cache.put(pos.toLong(), new BlockInfo(worldState.getBlockState(), tileEntity, predicate)); + cache.put(pos.toLong(), + new BlockInfo(worldState.getBlockState(), tileEntity, predicate)); } } if (!predicate.test(worldState)) { if (findFirstAisle) { - if (r < aisleRepetitions[c][0]) {//retreat to see if the first aisle can start later + if (r < aisleRepetitions[c][0]) {// retreat to see if the first aisle can start later r = c = 0; z = minZ++; matchContext.reset(); findFirstAisle = false; } } else { - z++;//continue searching for the first aisle + z++;// continue searching for the first aisle } continue loop; } @@ -192,7 +201,7 @@ private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, Enum findFirstAisle = true; z++; - //Check layer-local matcher predicate + // Check layer-local matcher predicate for (Map.Entry entry : layerCount.entrySet()) { if (entry.getValue() < entry.getKey().minLayerCount) { worldState.setError(new TraceabilityPredicate.SinglePredicateError(entry.getKey(), 3)); @@ -201,7 +210,7 @@ private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, Enum } validRepetitions++; } - //Repetitions out of range + // Repetitions out of range if (r < aisleRepetitions[c][0]) { if (!worldState.hasError()) { worldState.setError(new PatternError()); @@ -213,7 +222,7 @@ private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, Enum formedRepetitionCount[c] = validRepetitions; } - //Check count matches amount + // Check count matches amount for (Map.Entry entry : globalCount.entrySet()) { if (entry.getValue() < entry.getKey().minGlobalCount) { worldState.setError(new TraceabilityPredicate.SinglePredicateError(entry.getKey(), 1)); @@ -242,8 +251,9 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa for (int b = 0, y = -centerOffset[1]; b < this.thumbLength; b++, y++) { for (int a = 0, x = -centerOffset[0]; a < this.palmLength; a++, x++) { TraceabilityPredicate predicate = this.blockMatches[c][b][a]; - BlockPos pos = setActualRelativeOffset(x, y, z, facing, controllerBase.getUpwardsFacing(), controllerBase.isFlipped()) - .add(centerPos.getX(), centerPos.getY(), centerPos.getZ()); + BlockPos pos = setActualRelativeOffset(x, y, z, facing, controllerBase.getUpwardsFacing(), + controllerBase.isFlipped()) + .add(centerPos.getX(), centerPos.getY(), centerPos.getZ()); worldState.update(world, pos, matchContext, globalCount, layerCount, predicate); if (!world.getBlockState(pos).getMaterial().isReplaceable()) { blocks.put(pos, world.getBlockState(pos)); @@ -257,11 +267,13 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa if (limit.minLayerCount > 0) { if (!cacheLayer.containsKey(limit)) { cacheLayer.put(limit, 1); - } else if (cacheLayer.get(limit) < limit.minLayerCount && (limit.maxLayerCount == -1 || cacheLayer.get(limit) < limit.maxLayerCount)) { - cacheLayer.put(limit, cacheLayer.get(limit) + 1); - } else { - continue; - } + } else + if (cacheLayer.get(limit) < limit.minLayerCount && (limit.maxLayerCount == -1 || + cacheLayer.get(limit) < limit.maxLayerCount)) { + cacheLayer.put(limit, cacheLayer.get(limit) + 1); + } else { + continue; + } } else { continue; } @@ -277,11 +289,13 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa if (limit.minGlobalCount > 0) { if (!cacheGlobal.containsKey(limit)) { cacheGlobal.put(limit, 1); - } else if (cacheGlobal.get(limit) < limit.minGlobalCount && (limit.maxGlobalCount == -1 || cacheGlobal.get(limit) < limit.maxGlobalCount)) { - cacheGlobal.put(limit, cacheGlobal.get(limit) + 1); - } else { - continue; - } + } else if (cacheGlobal.get(limit) < limit.minGlobalCount && + (limit.maxGlobalCount == -1 || + cacheGlobal.get(limit) < limit.maxGlobalCount)) { + cacheGlobal.put(limit, cacheGlobal.get(limit) + 1); + } else { + continue; + } } else { continue; } @@ -295,9 +309,11 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa } if (!find) { // no limited for (TraceabilityPredicate.SimplePredicate limit : predicate.limited) { - if (limit.maxLayerCount != -1 && cacheLayer.getOrDefault(limit, Integer.MAX_VALUE) == limit.maxLayerCount) + if (limit.maxLayerCount != -1 && + cacheLayer.getOrDefault(limit, Integer.MAX_VALUE) == limit.maxLayerCount) continue; - if (limit.maxGlobalCount != -1 && cacheGlobal.getOrDefault(limit, Integer.MAX_VALUE) == limit.maxGlobalCount) + if (limit.maxGlobalCount != -1 && + cacheGlobal.getOrDefault(limit, Integer.MAX_VALUE) == limit.maxGlobalCount) continue; if (!cacheInfos.containsKey(limit)) { cacheInfos.put(limit, limit.candidates == null ? null : limit.candidates.get()); @@ -316,27 +332,35 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa } for (TraceabilityPredicate.SimplePredicate common : predicate.common) { if (!cacheInfos.containsKey(common)) { - cacheInfos.put(common, common.candidates == null ? null : common.candidates.get()); + cacheInfos.put(common, + common.candidates == null ? null : common.candidates.get()); } infos = ArrayUtils.addAll(infos, cacheInfos.get(common)); } } - List candidates = Arrays.stream(infos).filter(info -> info.getBlockState().getBlock() != Blocks.AIR).map(info -> { - IBlockState blockState = info.getBlockState(); - MetaTileEntity metaTileEntity = info.getTileEntity() instanceof IGregTechTileEntity ? ((IGregTechTileEntity) info.getTileEntity()).getMetaTileEntity() : null; - if (metaTileEntity != null) { - return metaTileEntity.getStackForm(); - } else { - return new ItemStack(Item.getItemFromBlock(blockState.getBlock()), 1, blockState.getBlock().damageDropped(blockState)); - } - }).collect(Collectors.toList()); + List candidates = Arrays.stream(infos) + .filter(info -> info.getBlockState().getBlock() != Blocks.AIR).map(info -> { + IBlockState blockState = info.getBlockState(); + MetaTileEntity metaTileEntity = info + .getTileEntity() instanceof IGregTechTileEntity ? + ((IGregTechTileEntity) info.getTileEntity()) + .getMetaTileEntity() : + null; + if (metaTileEntity != null) { + return metaTileEntity.getStackForm(); + } else { + return new ItemStack(Item.getItemFromBlock(blockState.getBlock()), 1, + blockState.getBlock().damageDropped(blockState)); + } + }).collect(Collectors.toList()); if (candidates.isEmpty()) continue; // check inventory ItemStack found = null; if (!player.isCreative()) { for (ItemStack itemStack : player.inventory.mainInventory) { - if (candidates.stream().anyMatch(candidate -> candidate.isItemEqual(itemStack)) && !itemStack.isEmpty() && itemStack.getItem() instanceof ItemBlock) { + if (candidates.stream().anyMatch(candidate -> candidate.isItemEqual(itemStack)) && + !itemStack.isEmpty() && itemStack.getItem() instanceof ItemBlock) { found = itemStack.copy(); itemStack.setCount(itemStack.getCount() - 1); break; @@ -354,14 +378,17 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa if (found == null) continue; } ItemBlock itemBlock = (ItemBlock) found.getItem(); - IBlockState state = itemBlock.getBlock().getStateFromMeta(itemBlock.getMetadata(found.getMetadata())); + IBlockState state = itemBlock.getBlock() + .getStateFromMeta(itemBlock.getMetadata(found.getMetadata())); blocks.put(pos, state); world.setBlockState(pos, state); TileEntity holder = world.getTileEntity(pos); if (holder instanceof IGregTechTileEntity) { - MetaTileEntity sampleMetaTileEntity = GregTechAPI.MTE_REGISTRY.getObjectById(found.getItemDamage()); + MetaTileEntity sampleMetaTileEntity = GregTechAPI.MTE_REGISTRY + .getObjectById(found.getItemDamage()); if (sampleMetaTileEntity != null) { - MetaTileEntity metaTileEntity = ((IGregTechTileEntity) holder).setMetaTileEntity(sampleMetaTileEntity); + MetaTileEntity metaTileEntity = ((IGregTechTileEntity) holder) + .setMetaTileEntity(sampleMetaTileEntity); metaTileEntity.onPlacement(); blocks.put(pos, metaTileEntity); if (found.getTagCompound() != null) { @@ -375,7 +402,9 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa z++; } } - EnumFacing[] facings = ArrayUtils.addAll(new EnumFacing[]{controllerBase.getFrontFacing()}, FACINGS); // follow controller first + EnumFacing[] facings = ArrayUtils.addAll(new EnumFacing[] { controllerBase.getFrontFacing() }, FACINGS); // follow + // controller + // first blocks.forEach((pos, block) -> { // adjust facing if (block instanceof MetaTileEntity) { MetaTileEntity metaTileEntity = (MetaTileEntity) block; @@ -413,14 +442,15 @@ public BlockInfo[][][] getPreview(int[] repetition) { int maxZ = Integer.MIN_VALUE; for (int l = 0, x = 0; l < this.fingerLength; l++) { for (int r = 0; r < repetition[l]; r++) { - //Checking single slice + // Checking single slice Map cacheLayer = new HashMap<>(); for (int y = 0; y < this.thumbLength; y++) { for (int z = 0; z < this.palmLength; z++) { TraceabilityPredicate predicate = this.blockMatches[l][y][z]; boolean find = false; BlockInfo[] infos = null; - for (TraceabilityPredicate.SimplePredicate limit : predicate.limited) { // check layer and previewCount + for (TraceabilityPredicate.SimplePredicate limit : predicate.limited) { // check layer and + // previewCount if (limit.minLayerCount > 0) { if (!cacheLayer.containsKey(limit)) { cacheLayer.put(limit, 1); @@ -503,7 +533,8 @@ public BlockInfo[][][] getPreview(int[] repetition) { for (TraceabilityPredicate.SimplePredicate common : predicate.common) { if (common.previewCount == -1) { if (!cacheInfos.containsKey(common)) { - cacheInfos.put(common, common.candidates == null ? null : common.candidates.get()); + cacheInfos.put(common, + common.candidates == null ? null : common.candidates.get()); } infos = cacheInfos.get(common); find = true; @@ -561,7 +592,8 @@ public BlockInfo[][][] getPreview(int[] repetition) { x++; } } - BlockInfo[][][] result = (BlockInfo[][][]) Array.newInstance(BlockInfo.class, maxX - minX + 1, maxY - minY + 1, maxZ - minZ + 1); + BlockInfo[][][] result = (BlockInfo[][][]) Array.newInstance(BlockInfo.class, maxX - minX + 1, maxY - minY + 1, + maxZ - minZ + 1); int finalMinX = minX; int finalMinY = minY; int finalMinZ = minZ; @@ -581,7 +613,8 @@ public BlockInfo[][][] getPreview(int[] repetition) { if (!find) { for (EnumFacing enumFacing : FACINGS) { BlockInfo blockInfo = blocks.get(pos.offset(enumFacing)); - if (blockInfo != null && blockInfo.getBlockState().getBlock() == Blocks.AIR && metaTileEntity.isValidFrontFacing(enumFacing)) { + if (blockInfo != null && blockInfo.getBlockState().getBlock() == Blocks.AIR && + metaTileEntity.isValidFrontFacing(enumFacing)) { metaTileEntity.setFrontFacing(enumFacing); break; } @@ -593,8 +626,9 @@ public BlockInfo[][][] getPreview(int[] repetition) { return result; } - private BlockPos setActualRelativeOffset(int x, int y, int z, EnumFacing facing, EnumFacing upwardsFacing, boolean isFlipped) { - int[] c0 = new int[]{x, y, z}, c1 = new int[3]; + private BlockPos setActualRelativeOffset(int x, int y, int z, EnumFacing facing, EnumFacing upwardsFacing, + boolean isFlipped) { + int[] c0 = new int[] { x, y, z }, c1 = new int[3]; if (facing == EnumFacing.UP || facing == EnumFacing.DOWN) { EnumFacing of = facing == EnumFacing.DOWN ? upwardsFacing : upwardsFacing.getOpposite(); for (int i = 0; i < 3; i++) { @@ -638,10 +672,12 @@ private BlockPos setActualRelativeOffset(int x, int y, int z, EnumFacing facing, } } if (upwardsFacing == EnumFacing.WEST || upwardsFacing == EnumFacing.EAST) { - int xOffset = upwardsFacing == EnumFacing.WEST ? facing.rotateY().getXOffset() : facing.rotateY().getOpposite().getXOffset(); - int zOffset = upwardsFacing == EnumFacing.WEST ? facing.rotateY().getZOffset() : facing.rotateY().getOpposite().getZOffset(); + int xOffset = upwardsFacing == EnumFacing.WEST ? facing.rotateY().getXOffset() : + facing.rotateY().getOpposite().getXOffset(); + int zOffset = upwardsFacing == EnumFacing.WEST ? facing.rotateY().getZOffset() : + facing.rotateY().getOpposite().getZOffset(); int tmp; - if(xOffset == 0) { + if (xOffset == 0) { tmp = c1[2]; c1[2] = zOffset > 0 ? -c1[1] : c1[1]; c1[1] = zOffset > 0 ? tmp : -tmp; diff --git a/src/main/java/gregtech/api/pattern/BlockWorldState.java b/src/main/java/gregtech/api/pattern/BlockWorldState.java index 6be658482ca..07fef964ba8 100644 --- a/src/main/java/gregtech/api/pattern/BlockWorldState.java +++ b/src/main/java/gregtech/api/pattern/BlockWorldState.java @@ -7,9 +7,10 @@ import net.minecraft.util.math.BlockPos.MutableBlockPos; import net.minecraft.world.World; -import javax.annotation.Nullable; import java.util.Map; +import javax.annotation.Nullable; + public class BlockWorldState { protected World world; @@ -23,7 +24,10 @@ public class BlockWorldState { protected TraceabilityPredicate predicate; protected PatternError error; - public void update(World worldIn, BlockPos posIn, PatternMatchContext matchContext, Map globalCount, Map layerCount, TraceabilityPredicate predicate) { + public void update(World worldIn, BlockPos posIn, PatternMatchContext matchContext, + Map globalCount, + Map layerCount, + TraceabilityPredicate predicate) { this.world = worldIn; this.pos = posIn; this.state = null; diff --git a/src/main/java/gregtech/api/pattern/FactoryBlockPattern.java b/src/main/java/gregtech/api/pattern/FactoryBlockPattern.java index 32bef31c9a0..e83c519186d 100644 --- a/src/main/java/gregtech/api/pattern/FactoryBlockPattern.java +++ b/src/main/java/gregtech/api/pattern/FactoryBlockPattern.java @@ -1,7 +1,8 @@ package gregtech.api.pattern; -import com.google.common.base.Joiner; import gregtech.api.util.RelativeDirection; + +import com.google.common.base.Joiner; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; @@ -60,11 +61,14 @@ public FactoryBlockPattern aisleRepeatable(int minRepeat, int maxRepeat, String. } if (aisle.length != this.aisleHeight) { - throw new IllegalArgumentException("Expected aisle with height of " + this.aisleHeight + ", but was given one with a height of " + aisle.length + ")"); + throw new IllegalArgumentException("Expected aisle with height of " + this.aisleHeight + + ", but was given one with a height of " + aisle.length + ")"); } else { for (String s : aisle) { if (s.length() != this.rowWidth) { - throw new IllegalArgumentException("Not all rows in the given aisle are the correct width (expected " + this.rowWidth + ", found one with " + s.length() + ")"); + throw new IllegalArgumentException( + "Not all rows in the given aisle are the correct width (expected " + this.rowWidth + + ", found one with " + s.length() + ")"); } for (char c0 : s.toCharArray()) { @@ -77,7 +81,7 @@ public FactoryBlockPattern aisleRepeatable(int minRepeat, int maxRepeat, String. this.depth.add(aisle); if (minRepeat > maxRepeat) throw new IllegalArgumentException("Lower bound of repeat counting must smaller than upper bound!"); - aisleRepetitions.add(new int[]{minRepeat, maxRepeat}); + aisleRepetitions.add(new int[] { minRepeat, maxRepeat }); return this; } } else { @@ -98,7 +102,7 @@ public FactoryBlockPattern aisle(String... aisle) { public FactoryBlockPattern setRepeatable(int minRepeat, int maxRepeat) { if (minRepeat > maxRepeat) throw new IllegalArgumentException("Lower bound of repeat counting must smaller than upper bound!"); - aisleRepetitions.set(aisleRepetitions.size() - 1, new int[]{minRepeat, maxRepeat}); + aisleRepetitions.set(aisleRepetitions.size() - 1, new int[] { minRepeat, maxRepeat }); return this; } @@ -113,7 +117,8 @@ public static FactoryBlockPattern start() { return new FactoryBlockPattern(RIGHT, UP, BACK); } - public static FactoryBlockPattern start(RelativeDirection charDir, RelativeDirection stringDir, RelativeDirection aisleDir) { + public static FactoryBlockPattern start(RelativeDirection charDir, RelativeDirection stringDir, + RelativeDirection aisleDir) { return new FactoryBlockPattern(charDir, stringDir, aisleDir); } @@ -123,12 +128,14 @@ public FactoryBlockPattern where(char symbol, TraceabilityPredicate blockMatcher } public BlockPattern build() { - return new BlockPattern(makePredicateArray(), structureDir, aisleRepetitions.toArray(new int[aisleRepetitions.size()][])); + return new BlockPattern(makePredicateArray(), structureDir, + aisleRepetitions.toArray(new int[aisleRepetitions.size()][])); } private TraceabilityPredicate[][][] makePredicateArray() { this.checkMissingPredicates(); - TraceabilityPredicate[][][] predicate = (TraceabilityPredicate[][][]) Array.newInstance(TraceabilityPredicate.class, this.depth.size(), this.aisleHeight, this.rowWidth); + TraceabilityPredicate[][][] predicate = (TraceabilityPredicate[][][]) Array + .newInstance(TraceabilityPredicate.class, this.depth.size(), this.aisleHeight, this.rowWidth); for (int i = 0; i < this.depth.size(); ++i) { for (int j = 0; j < this.aisleHeight; ++j) { diff --git a/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java b/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java index dbecbff8a6f..a4bd56a9150 100644 --- a/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java +++ b/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java @@ -4,17 +4,19 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.util.BlockInfo; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Supplier; +import javax.annotation.Nonnull; + public class MultiblockShapeInfo { /** {@code [x][y][z]} */ @@ -75,7 +77,8 @@ public Builder where(char symbol, Supplier partSupplier, EnumFacing frontSide return where(symbol, (IBlockState) part); } else if (part instanceof MetaTileEntity) { return where(symbol, (MetaTileEntity) part, frontSideIfTE); - } else throw new IllegalArgumentException("Supplier must supply either a MetaTileEntity or an IBlockState! Actual: " + part.getClass()); + } else throw new IllegalArgumentException( + "Supplier must supply either a MetaTileEntity or an IBlockState! Actual: " + part.getClass()); } @Nonnull @@ -118,7 +121,5 @@ public Builder shallowCopy() { public MultiblockShapeInfo build() { return new MultiblockShapeInfo(bakeArray()); } - } - } diff --git a/src/main/java/gregtech/api/pattern/PatternStringError.java b/src/main/java/gregtech/api/pattern/PatternStringError.java index 8867593b240..fc62bfecb27 100644 --- a/src/main/java/gregtech/api/pattern/PatternStringError.java +++ b/src/main/java/gregtech/api/pattern/PatternStringError.java @@ -2,7 +2,8 @@ import net.minecraft.client.resources.I18n; -public class PatternStringError extends PatternError{ +public class PatternStringError extends PatternError { + public final String translateKey; public PatternStringError(String translateKey) { diff --git a/src/main/java/gregtech/api/pattern/TraceabilityPredicate.java b/src/main/java/gregtech/api/pattern/TraceabilityPredicate.java index 10051b909ad..da9483998be 100644 --- a/src/main/java/gregtech/api/pattern/TraceabilityPredicate.java +++ b/src/main/java/gregtech/api/pattern/TraceabilityPredicate.java @@ -6,6 +6,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.util.BlockInfo; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; @@ -25,7 +26,9 @@ public class TraceabilityPredicate { // Allow any block. public static TraceabilityPredicate ANY = new TraceabilityPredicate((state) -> true); // Allow the air block. - public static TraceabilityPredicate AIR = new TraceabilityPredicate(blockWorldState -> blockWorldState.getBlockState().getBlock().isAir(blockWorldState.getBlockState(), blockWorldState.getWorld(), blockWorldState.getPos())); + public static TraceabilityPredicate AIR = new TraceabilityPredicate( + blockWorldState -> blockWorldState.getBlockState().getBlock().isAir(blockWorldState.getBlockState(), + blockWorldState.getWorld(), blockWorldState.getPos())); // Allow all heating coils, and require them to have the same type. public static Supplier HEATING_COILS = () -> new TraceabilityPredicate(blockWorldState -> { IBlockState blockState = blockWorldState.getBlockState(); @@ -45,7 +48,7 @@ public class TraceabilityPredicate { .sorted(Comparator.comparingInt(entry -> entry.getValue().getTier())) .map(entry -> new BlockInfo(entry.getKey(), null)) .toArray(BlockInfo[]::new)) - .addTooltips("gregtech.multiblock.pattern.error.coils"); + .addTooltips("gregtech.multiblock.pattern.error.coils"); public final List common = new ArrayList<>(); public final List limited = new ArrayList<>(); @@ -53,8 +56,7 @@ public class TraceabilityPredicate { protected boolean hasAir = false; protected boolean isSingle = true; - public TraceabilityPredicate() { - } + public TraceabilityPredicate() {} public TraceabilityPredicate(TraceabilityPredicate predicate) { common.addAll(predicate.common); @@ -81,7 +83,8 @@ public boolean isSingle() { } /** - * Mark it as the controller of this multi. Normally you won't call it yourself. Use {@link MultiblockControllerBase#selfPredicate()} plz. + * Mark it as the controller of this multi. Normally you won't call it yourself. Use + * {@link MultiblockControllerBase#selfPredicate()} plz. */ public TraceabilityPredicate setCenter() { isCenter = true; @@ -238,6 +241,7 @@ public TraceabilityPredicate or(TraceabilityPredicate other) { } public static class SimplePredicate { + public final Supplier candidates; public final Predicate predicate; @@ -266,7 +270,8 @@ public List getToolTips(TraceabilityPredicate predicates) { if (minGlobalCount == maxGlobalCount && maxGlobalCount != -1) { result.add(I18n.format("gregtech.multiblock.pattern.error.limited_exact", minGlobalCount)); } else if (minGlobalCount != maxGlobalCount && minGlobalCount != -1 && maxGlobalCount != -1) { - result.add(I18n.format("gregtech.multiblock.pattern.error.limited_within", minGlobalCount, maxGlobalCount)); + result.add(I18n.format("gregtech.multiblock.pattern.error.limited_within", minGlobalCount, + maxGlobalCount)); } else { if (minGlobalCount != -1) { result.add(I18n.format("gregtech.multiblock.pattern.error.limited.1", minGlobalCount)); @@ -322,19 +327,23 @@ public boolean testLayer(BlockWorldState blockWorldState) { } public List getCandidates() { - return candidates == null ? Collections.emptyList() : Arrays.stream(this.candidates.get()).filter(info -> info.getBlockState().getBlock() != Blocks.AIR).map(info -> { - IBlockState blockState = info.getBlockState(); - MetaTileEntity metaTileEntity = info.getTileEntity() instanceof IGregTechTileEntity ? ((IGregTechTileEntity) info.getTileEntity()).getMetaTileEntity() : null; - if (metaTileEntity != null) { - return metaTileEntity.getStackForm(); - } else { - return new ItemStack(Item.getItemFromBlock(blockState.getBlock()), 1, blockState.getBlock().damageDropped(blockState)); - } - }).collect(Collectors.toList()); + return candidates == null ? Collections.emptyList() : Arrays.stream(this.candidates.get()) + .filter(info -> info.getBlockState().getBlock() != Blocks.AIR).map(info -> { + IBlockState blockState = info.getBlockState(); + MetaTileEntity metaTileEntity = info.getTileEntity() instanceof IGregTechTileEntity ? + ((IGregTechTileEntity) info.getTileEntity()).getMetaTileEntity() : null; + if (metaTileEntity != null) { + return metaTileEntity.getStackForm(); + } else { + return new ItemStack(Item.getItemFromBlock(blockState.getBlock()), 1, + blockState.getBlock().damageDropped(blockState)); + } + }).collect(Collectors.toList()); } } public static class SinglePredicateError extends PatternError { + public final SimplePredicate predicate; public final int type; @@ -359,5 +368,4 @@ public String getErrorInfo() { return I18n.format("gregtech.multiblock.pattern.error.limited." + type, number); } } - } diff --git a/src/main/java/gregtech/api/pipenet/IBlockAppearance.java b/src/main/java/gregtech/api/pipenet/IBlockAppearance.java index f195b5788b9..e7326479210 100644 --- a/src/main/java/gregtech/api/pipenet/IBlockAppearance.java +++ b/src/main/java/gregtech/api/pipenet/IBlockAppearance.java @@ -8,7 +8,8 @@ import javax.annotation.Nonnull; /** - * Implement this interface on blocks that can mimic the appearance of other blocks. Note that this is meant to be available server-side, so ensure the code is + * Implement this interface on blocks that can mimic the appearance of other blocks. Note that this is meant to be + * available server-side, so ensure the code is * server-safe and doesn't use client-side code. *

* Mostly based on and (copied from) CoFHCore with minor tweaks @@ -27,7 +28,8 @@ public interface IBlockAppearance { IBlockState getVisualState(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side); /** - * This function returns whether the block's renderer will visually connect to other blocks implementing IBlockAppearance. + * This function returns whether the block's renderer will visually connect to other blocks implementing + * IBlockAppearance. */ boolean supportsVisualConnections(); } diff --git a/src/main/java/gregtech/api/pipenet/IRoutePath.java b/src/main/java/gregtech/api/pipenet/IRoutePath.java index b1291e025bc..31b5ac9f15e 100644 --- a/src/main/java/gregtech/api/pipenet/IRoutePath.java +++ b/src/main/java/gregtech/api/pipenet/IRoutePath.java @@ -1,13 +1,14 @@ package gregtech.api.pipenet; import gregtech.api.pipenet.tile.IPipeTile; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.capabilities.Capability; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.UnknownNullability; public interface IRoutePath> { diff --git a/src/main/java/gregtech/api/pipenet/PipeNet.java b/src/main/java/gregtech/api/pipenet/PipeNet.java index 644a9ec894b..384d15134a1 100644 --- a/src/main/java/gregtech/api/pipenet/PipeNet.java +++ b/src/main/java/gregtech/api/pipenet/PipeNet.java @@ -1,9 +1,5 @@ package gregtech.api.pipenet; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; @@ -14,6 +10,11 @@ import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.common.util.INBTSerializable; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.*; import java.util.Map.Entry; @@ -21,13 +22,14 @@ public abstract class PipeNet implements INBTSerializable> worldData; private final Map> nodeByBlockPos = new HashMap<>(); - private final Map> unmodifiableNodeByBlockPos = Collections.unmodifiableMap(nodeByBlockPos); + private final Map> unmodifiableNodeByBlockPos = Collections + .unmodifiableMap(nodeByBlockPos); private final Map ownedChunks = new HashMap<>(); private long lastUpdate; boolean isValid = false; public PipeNet(WorldPipeNet> world) { - //noinspection unchecked + // noinspection unchecked this.worldData = (WorldPipeNet>) world; } @@ -57,11 +59,9 @@ protected void onNodeConnectionsUpdate() { /** * Is called when any connection of any pipe in the net changes */ - public void onPipeConnectionsUpdate() { - } + public void onPipeConnectionsUpdate() {} - public void onNeighbourUpdate(BlockPos fromPos) { - } + public void onNeighbourUpdate(BlockPos fromPos) {} public Map> getAllNodes() { return unmodifiableNodeByBlockPos; @@ -131,25 +131,26 @@ protected void updateBlockedConnections(BlockPos nodePos, EnumFacing facing, boo BlockPos offsetPos = nodePos.offset(facing); PipeNet pipeNetAtOffset = worldData.getNetFromPos(offsetPos); if (pipeNetAtOffset == null) { - //if there is no any pipe net at this side, - //updating blocked status of it won't change anything in any net + // if there is no any pipe net at this side, + // updating blocked status of it won't change anything in any net return; } - //if we are on that side of node too - //and it is blocked now + // if we are on that side of node too + // and it is blocked now if (pipeNetAtOffset == this) { - //if side was unblocked, well, there is really nothing changed in this e-net - //if it is blocked now, but was able to connect with neighbour node before, try split networks + // if side was unblocked, well, there is really nothing changed in this e-net + // if it is blocked now, but was able to connect with neighbour node before, try split networks if (isBlocked) { - //need to unblock node before doing canNodesConnectCheck + // need to unblock node before doing canNodesConnectCheck setBlocked(selfNode, facing, false); if (canNodesConnect(selfNode, facing, getNodeAt(offsetPos), this)) { - //now block again to call findAllConnectedBlocks + // now block again to call findAllConnectedBlocks setBlocked(selfNode, facing, true); HashMap> thisENet = findAllConnectedBlocks(nodePos); if (!getAllNodes().equals(thisENet)) { - //node visibility has changed, split network into 2 - //node that code below is similar to removeNodeInternal, but only for 2 networks, and without node removal + // node visibility has changed, split network into 2 + // node that code below is similar to removeNodeInternal, but only for 2 networks, and without + // node removal PipeNet newPipeNet = worldData.createNetInstance(); thisENet.keySet().forEach(this::removeNodeWithoutRebuilding); newPipeNet.transferNodeData(thisENet, this); @@ -157,16 +158,16 @@ protected void updateBlockedConnections(BlockPos nodePos, EnumFacing facing, boo } } } - //there is another network on that side - //if this is an unblock, and we can connect with their node, merge them + // there is another network on that side + // if this is an unblock, and we can connect with their node, merge them } else if (!isBlocked) { Node neighbourNode = pipeNetAtOffset.getNodeAt(offsetPos); - //check connection availability from both networks + // check connection availability from both networks if (canNodesConnect(selfNode, facing, neighbourNode, pipeNetAtOffset) && pipeNetAtOffset.canNodesConnect(neighbourNode, facing.getOpposite(), selfNode, this)) { - //so, side is unblocked now, and nodes can connect, merge two networks - //our network consumes other one + // so, side is unblocked now, and nodes can connect, merge two networks + // our network consumes other one uniteNetworks(pipeNetAtOffset); } } @@ -187,32 +188,32 @@ protected void updateMark(BlockPos nodePos, int newMark) { PipeNet otherPipeNet = worldData.getNetFromPos(offsetPos); Node secondNode = otherPipeNet == null ? null : otherPipeNet.getNodeAt(offsetPos); if (secondNode == null) - continue; //there is noting here + continue; // there is noting here if (!areNodeBlockedConnectionsCompatible(selfNode, facing, secondNode) || !areNodesCustomContactable(selfNode.data, secondNode.data, otherPipeNet)) - continue; //if connections aren't compatible, skip them + continue; // if connections aren't compatible, skip them if (areMarksCompatible(oldMark, secondNode.mark) == areMarksCompatible(newMark, secondNode.mark)) - continue; //if compatibility didn't change, skip it + continue; // if compatibility didn't change, skip it if (areMarksCompatible(newMark, secondNode.mark)) { - //if marks are compatible now, and offset network is different network, merge them - //if it is same network, just update mask and paths + // if marks are compatible now, and offset network is different network, merge them + // if it is same network, just update mask and paths if (otherPipeNet != this) { uniteNetworks(otherPipeNet); } - //marks are incompatible now, and this net is connected with it + // marks are incompatible now, and this net is connected with it } else if (otherPipeNet == this) { - //search connected nodes from newly marked node - //populate self connected blocks lazily only once + // search connected nodes from newly marked node + // populate self connected blocks lazily only once if (selfConnectedBlocks == null) { selfConnectedBlocks = findAllConnectedBlocks(nodePos); } if (getAllNodes().equals(selfConnectedBlocks)) { - continue; //if this node is still connected to this network, just continue + continue; // if this node is still connected to this network, just continue } - //otherwise, it is not connected + // otherwise, it is not connected HashMap> offsetConnectedBlocks = findAllConnectedBlocks(offsetPos); - //if in the result of remarking offset node has separated from main network, - //and it is also separated from current cable too, form new network for it + // if in the result of remarking offset node has separated from main network, + // and it is also separated from current cable too, form new network for it if (!offsetConnectedBlocks.equals(selfConnectedBlocks)) { offsetConnectedBlocks.keySet().forEach(this::removeNodeWithoutRebuilding); PipeNet offsetPipeNet = worldData.createNetInstance(); @@ -250,7 +251,8 @@ protected final void uniteNetworks(PipeNet unitedPipeNet) { transferNodeData(allNodes, unitedPipeNet); } - private boolean areNodeBlockedConnectionsCompatible(Node first, EnumFacing firstFacing, Node second) { + private boolean areNodeBlockedConnectionsCompatible(Node first, EnumFacing firstFacing, + Node second) { return !first.isBlocked(firstFacing) && !second.isBlocked(firstFacing.getOpposite()); } @@ -263,13 +265,14 @@ private static boolean areMarksCompatible(int mark1, int mark2) { * Note that this logic should equal with block connection logic * for proper work of network */ - protected final boolean canNodesConnect(Node first, EnumFacing firstFacing, Node second, PipeNet secondPipeNet) { + protected final boolean canNodesConnect(Node first, EnumFacing firstFacing, Node second, + PipeNet secondPipeNet) { return areNodeBlockedConnectionsCompatible(first, firstFacing, second) && areMarksCompatible(first.mark, second.mark) && areNodesCustomContactable(first.data, second.data, secondPipeNet); } - //we need to search only this network + // we need to search only this network protected HashMap> findAllConnectedBlocks(BlockPos startPos) { HashMap> observedSet = new HashMap<>(); observedSet.put(startPos, getNodeAt(startPos)); @@ -281,8 +284,10 @@ protected HashMap> findAllConnectedBlocks(BlockPos for (EnumFacing facing : EnumFacing.VALUES) { currentPos.move(facing); Node secondNode = getNodeAt(currentPos); - //if there is node, and it can connect with previous node, add it to list, and set previous node as current - if (secondNode != null && canNodesConnect(firstNode, facing, secondNode, this) && !observedSet.containsKey(currentPos)) { + // if there is node, and it can connect with previous node, add it to list, and set previous node as + // current + if (secondNode != null && canNodesConnect(firstNode, facing, secondNode, this) && + !observedSet.containsKey(currentPos)) { observedSet.put(currentPos.toImmutable(), getNodeAt(currentPos)); firstNode = secondNode; moveStack.push(facing.getOpposite()); @@ -297,7 +302,7 @@ protected HashMap> findAllConnectedBlocks(BlockPos return observedSet; } - //called when node is removed to rebuild network + // called when node is removed to rebuild network protected void rebuildNetworkOnNodeRemoval(BlockPos nodePos, Node selfNode) { int amountOfConnectedSides = 0; for (EnumFacing facing : EnumFacing.values()) { @@ -305,26 +310,26 @@ protected void rebuildNetworkOnNodeRemoval(BlockPos nodePos, Node if (containsNode(offsetPos)) amountOfConnectedSides++; } - //if we are connected only on one side or not connected at all, we don't need to find connected blocks - //because they are only on on side or doesn't exist at all - //this saves a lot of performance in big networks, which are quite big to depth-first them fastly + // if we are connected only on one side or not connected at all, we don't need to find connected blocks + // because they are only on on side or doesn't exist at all + // this saves a lot of performance in big networks, which are quite big to depth-first them fastly if (amountOfConnectedSides >= 2) { for (EnumFacing facing : EnumFacing.VALUES) { BlockPos offsetPos = nodePos.offset(facing); Node secondNode = getNodeAt(offsetPos); if (secondNode == null || !canNodesConnect(selfNode, facing, secondNode, this)) { - //if there isn't any neighbour node, or it wasn't connected with us, just skip it + // if there isn't any neighbour node, or it wasn't connected with us, just skip it continue; } HashMap> thisENet = findAllConnectedBlocks(offsetPos); if (getAllNodes().equals(thisENet)) { - //if cable on some direction contains all nodes of this network - //the network didn't change so keep it as is + // if cable on some direction contains all nodes of this network + // the network didn't change so keep it as is break; } else { - //and use them to create new network with caching active nodes set + // and use them to create new network with caching active nodes set PipeNet energyNet = worldData.createNetInstance(); - //remove blocks that aren't connected with this network + // remove blocks that aren't connected with this network thisENet.keySet().forEach(this::removeNodeWithoutRebuilding); energyNet.transferNodeData(thisENet, this); worldData.addPipeNet(energyNet); @@ -332,14 +337,15 @@ protected void rebuildNetworkOnNodeRemoval(BlockPos nodePos, Node } } if (getAllNodes().isEmpty()) { - //if this energy net is empty now, remove it + // if this energy net is empty now, remove it worldData.removePipeNet(this); } onNodeConnectionsUpdate(); worldData.markDirty(); } - protected boolean areNodesCustomContactable(NodeDataType first, NodeDataType second, PipeNet secondNodePipeNet) { + protected boolean areNodesCustomContactable(NodeDataType first, NodeDataType second, + PipeNet secondNodePipeNet) { return true; } @@ -354,7 +360,8 @@ protected boolean canAttachNode(NodeDataType nodeData) { * from parent network and add it to it's own tank, keeping network contents when old network is split * Note that it should be called when parent net doesn't have transferredNodes in allNodes already */ - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { transferredNodes.forEach(this::addNodeSilently); onNodeConnectionsUpdate(); worldData.markDirty(); @@ -458,5 +465,4 @@ protected NBTTagCompound serializeAllNodeList(Map> compound.setTag("WireProperties", wirePropertiesList); return compound; } - } diff --git a/src/main/java/gregtech/api/pipenet/PipeNetWalker.java b/src/main/java/gregtech/api/pipenet/PipeNetWalker.java index 970b2720b89..bbcc08842a2 100644 --- a/src/main/java/gregtech/api/pipenet/PipeNetWalker.java +++ b/src/main/java/gregtech/api/pipenet/PipeNetWalker.java @@ -3,22 +3,30 @@ import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.util.GTLog; import gregtech.common.pipelike.itempipe.net.ItemNetWalker; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.*; +import javax.annotation.Nullable; + /** * This is a helper class to get information about a pipe net - *

The walker is written that it will always find the shortest path to any destination - *

On the way it can collect information about the pipes and it's neighbours - *

After creating a walker simply call {@link #traversePipeNet()} to start walking, then you can just collect the data - *

Do not walk a walker more than once - *

For example implementations look at {@link ItemNetWalker} + *

+ * The walker is written that it will always find the shortest path to any destination + *

+ * On the way it can collect information about the pipes and it's neighbours + *

+ * After creating a walker simply call {@link #traversePipeNet()} to start walking, then you can just collect the data + *

+ * Do not walk a walker more than once + *

+ * For example implementations look at {@link ItemNetWalker} */ public abstract class PipeNetWalker> { @@ -52,7 +60,8 @@ protected PipeNetWalker(World world, BlockPos sourcePipe, int walkedBlocks) { * @param walkedBlocks distance from source in blocks * @return new sub walker */ - protected abstract PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, int walkedBlocks); + protected abstract PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, + int walkedBlocks); /** * You can increase walking stats here. for example @@ -69,7 +78,8 @@ protected PipeNetWalker(World world, BlockPos sourcePipe, int walkedBlocks) { * @param faceToNeighbour face to neighbour * @param neighbourTile neighbour tile */ - protected abstract void checkNeighbour(T pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, @Nullable TileEntity neighbourTile); + protected abstract void checkNeighbour(T pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, + @Nullable TileEntity neighbourTile); /** * If the pipe is valid to perform a walk on @@ -100,8 +110,7 @@ protected EnumFacing[] getSurroundingPipeSides() { * * @param subWalker the finished sub walker */ - protected void onRemoveSubWalker(PipeNetWalker subWalker) { - } + protected void onRemoveSubWalker(PipeNetWalker subWalker) {} public void traversePipeNet() { traversePipeNet(32768); @@ -120,7 +129,7 @@ public void traversePipeNet(int maxWalks) { walked = new ObjectOpenHashSet<>(); int i = 0; running = true; - while (running && !walk() && i++ < maxWalks) ; + while (running && !walk() && i++ < maxWalks); running = false; walked = null; if (i >= maxWalks) @@ -148,7 +157,9 @@ private boolean walk() { walkers = new ArrayList<>(); for (int i = 0; i < nextPipeFacings.size(); i++) { EnumFacing side = nextPipeFacings.get(i); - PipeNetWalker walker = Objects.requireNonNull(createSubWalker(world, side, currentPos.offset(side), walkedBlocks + 1), "Walker can't be null"); + PipeNetWalker walker = Objects.requireNonNull( + createSubWalker(world, side, currentPos.offset(side), walkedBlocks + 1), + "Walker can't be null"); walker.root = root; walker.currentPipe = nextPipes.get(i); walker.from = side.getOpposite(); @@ -187,14 +198,15 @@ private boolean checkPos() { // check for surrounding pipes and item handlers for (EnumFacing accessSide : getSurroundingPipeSides()) { - //skip sides reported as blocked by pipe network + // skip sides reported as blocked by pipe network if (accessSide == from || !pipeTile.isConnected(accessSide)) continue; TileEntity tile = pipeTile.getNeighbor(accessSide); if (tile != null && getBasePipeClass().isAssignableFrom(tile.getClass())) { T otherPipe = (T) tile; - if (!otherPipe.isConnected(accessSide.getOpposite()) || otherPipe.isFaceBlocked(accessSide.getOpposite()) || isWalked(otherPipe)) + if (!otherPipe.isConnected(accessSide.getOpposite()) || + otherPipe.isFaceBlocked(accessSide.getOpposite()) || isWalked(otherPipe)) continue; if (isValidPipe(pipeTile, otherPipe, currentPos, accessSide)) { nextPipeFacings.add(accessSide); diff --git a/src/main/java/gregtech/api/pipenet/WorldPipeNet.java b/src/main/java/gregtech/api/pipenet/WorldPipeNet.java index 7026c6a9634..aa6d2d47ac1 100644 --- a/src/main/java/gregtech/api/pipenet/WorldPipeNet.java +++ b/src/main/java/gregtech/api/pipenet/WorldPipeNet.java @@ -9,10 +9,11 @@ import net.minecraft.world.storage.WorldSavedData; import net.minecraftforge.common.util.Constants.NBT; -import javax.annotation.Nonnull; import java.lang.ref.WeakReference; import java.util.*; +import javax.annotation.Nonnull; + public abstract class WorldPipeNet> extends WorldSavedData { private WeakReference worldRef = new WeakReference<>(null); diff --git a/src/main/java/gregtech/api/pipenet/block/BlockPipe.java b/src/main/java/gregtech/api/pipenet/block/BlockPipe.java index 2fccb22fdf8..0333f07e149 100644 --- a/src/main/java/gregtech/api/pipenet/block/BlockPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/BlockPipe.java @@ -1,9 +1,5 @@ package gregtech.api.pipenet.block; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.raytracer.RayTracer; -import codechicken.lib.vec.Cuboid6; import gregtech.api.block.BuiltInRenderBlock; import gregtech.api.cover.Cover; import gregtech.api.cover.CoverHolder; @@ -23,6 +19,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; import gregtech.integration.ctm.IFacadeWrapper; + import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.SoundType; @@ -46,19 +43,27 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.raytracer.RayTracer; +import codechicken.lib.vec.Cuboid6; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.metatileentity.MetaTileEntity.FULL_CUBE_COLLISION; @SuppressWarnings("deprecation") -public abstract class BlockPipe & IPipeType, NodeDataType, WorldPipeNetType extends WorldPipeNet>> extends BuiltInRenderBlock implements ITileEntityProvider, IFacadeWrapper, IBlockAppearance { +public abstract class BlockPipe & IPipeType, NodeDataType, + WorldPipeNetType extends WorldPipeNet>> extends BuiltInRenderBlock + implements ITileEntityProvider, IFacadeWrapper, IBlockAppearance { protected final ThreadLocal> tileEntities = new ThreadLocal<>(); @@ -153,7 +158,8 @@ public void onBlockAdded(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockSt } @Override - public void updateTick(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Random rand) { + public void updateTick(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull Random rand) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null) { int activeConnections = pipeTile.getConnections(); @@ -164,7 +170,8 @@ public void updateTick(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull I } @Override - public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityLivingBase placer, @Nonnull ItemStack stack) { + public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull EntityLivingBase placer, @Nonnull ItemStack stack) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null) { setTileEntityData((TileEntityPipeBase) pipeTile, stack); @@ -174,7 +181,8 @@ public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonn ItemStack offhand = placer.getHeldItemOffhand(); for (int i = 0; i < EnumDyeColor.values().length; i++) { if (offhand.isItemEqual(MetaItems.SPRAY_CAN_DYES[i].getStackForm())) { - MetaItems.SPRAY_CAN_DYES[i].getBehaviours().get(0).onItemUse((EntityPlayer) placer, worldIn, pos, EnumHand.OFF_HAND, EnumFacing.UP, 0, 0, 0); + MetaItems.SPRAY_CAN_DYES[i].getBehaviours().get(0).onItemUse((EntityPlayer) placer, worldIn, + pos, EnumHand.OFF_HAND, EnumFacing.UP, 0, 0, 0); break; } } @@ -183,7 +191,8 @@ public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonn } @Override - public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Block blockIn, @Nonnull BlockPos fromPos) { + public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull Block blockIn, @Nonnull BlockPos fromPos) { if (worldIn.isRemote) return; IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null) { @@ -193,7 +202,8 @@ public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, pipeTile.onNeighborChanged(facing); if (!ConfigHolder.machines.gt6StylePipesCables) { boolean open = pipeTile.isConnected(facing); - boolean canConnect = pipeTile.getCoverableImplementation().getCoverAtSide(facing) != null || canConnect(pipeTile, facing); + boolean canConnect = pipeTile.getCoverableImplementation().getCoverAtSide(facing) != null || + canConnect(pipeTile, facing); if (!open && canConnect && state.getBlock() != blockIn) pipeTile.setConnection(facing, true, false); if (open && !canConnect) @@ -215,7 +225,9 @@ public void onNeighborChange(@NotNull IBlockAccess world, @NotNull BlockPos pos, } @Override - public void observedNeighborChange(@Nonnull IBlockState observerState, @Nonnull World world, @Nonnull BlockPos observerPos, @Nonnull Block changedBlock, @Nonnull BlockPos changedBlockPos) { + public void observedNeighborChange(@Nonnull IBlockState observerState, @Nonnull World world, + @Nonnull BlockPos observerPos, @Nonnull Block changedBlock, + @Nonnull BlockPos changedBlockPos) { PipeNet net = getWorldPipeNet(world).getNetFromPos(observerPos); if (net != null) { net.onNeighbourUpdate(changedBlockPos); @@ -223,30 +235,34 @@ public void observedNeighborChange(@Nonnull IBlockState observerState, @Nonnull } @Override - public boolean canConnectRedstone(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nullable EnumFacing side) { + public boolean canConnectRedstone(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nullable EnumFacing side) { IPipeTile pipeTile = getPipeTileEntity(world, pos); return pipeTile != null && pipeTile.getCoverableImplementation().canConnectRedstone(side); } @Override - public boolean shouldCheckWeakPower(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean shouldCheckWeakPower(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side) { // The check in World::getRedstonePower in the vanilla code base is reversed. Setting this to false will // actually cause getWeakPower to be called, rather than prevent it. return false; } @Override - public int getWeakPower(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public int getWeakPower(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, + @Nonnull EnumFacing side) { IPipeTile pipeTile = getPipeTileEntity(blockAccess, pos); return pipeTile == null ? 0 : pipeTile.getCoverableImplementation().getOutputRedstoneSignal(side.getOpposite()); } - public void updateActiveNodeStatus(@Nonnull World worldIn, BlockPos pos, IPipeTile pipeTile) { + public void updateActiveNodeStatus(@Nonnull World worldIn, BlockPos pos, + IPipeTile pipeTile) { if (worldIn.isRemote) return; PipeNet pipeNet = getWorldPipeNet(worldIn).getNetFromPos(pos); if (pipeNet != null && pipeTile != null) { - int activeConnections = pipeTile.getConnections(); //remove blocked connections + int activeConnections = pipeTile.getConnections(); // remove blocked connections boolean isActiveNodeNow = activeConnections != 0; boolean modeChanged = pipeNet.markNodeAsActive(pos, isActiveNodeNow); if (modeChanged) { @@ -265,12 +281,12 @@ public TileEntity createNewTileEntity(@Nonnull World worldIn, int meta) { * Can be used to update tile entity to tickable when node becomes active * usable for fluid pipes, as example */ - protected void onActiveModeChange(World world, BlockPos pos, boolean isActiveNow, boolean isInitialChange) { - } + protected void onActiveModeChange(World world, BlockPos pos, boolean isActiveNow, boolean isInitialChange) {} @Nonnull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { IPipeTile pipeTile = getPipeTileEntity(world, pos); if (pipeTile == null) { return ItemStack.EMPTY; @@ -286,7 +302,9 @@ public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResul } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + float hitX, float hitY, float hitZ) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); CuboidRayTraceResult rayTraceResult = getServerCollisionRayTrace(playerIn, pos, worldIn); @@ -296,7 +314,9 @@ public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @ return onPipeActivated(worldIn, state, pos, playerIn, hand, facing, rayTraceResult, pipeTile); } - public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, EntityPlayer entityPlayer, EnumHand hand, EnumFacing side, CuboidRayTraceResult hit, IPipeTile pipeTile) { + public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, EntityPlayer entityPlayer, + EnumHand hand, EnumFacing side, CuboidRayTraceResult hit, + IPipeTile pipeTile) { ItemStack itemStack = entityPlayer.getHeldItem(hand); if (pipeTile.getFrameMaterial() == null && @@ -304,9 +324,11 @@ public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, Ent pipeTile.getPipeType().getThickness() < 1) { BlockFrame frameBlock = BlockFrame.getFrameBlockFromItem(itemStack); if (frameBlock != null) { - ((TileEntityPipeBase) pipeTile).setFrameMaterial(frameBlock.getGtMaterial(itemStack)); + ((TileEntityPipeBase) pipeTile) + .setFrameMaterial(frameBlock.getGtMaterial(itemStack)); SoundType type = frameBlock.getSoundType(itemStack); - world.playSound(entityPlayer, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); + world.playSound(entityPlayer, pos, type.getPlaceSound(), SoundCategory.BLOCKS, + (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); if (!entityPlayer.capabilities.isCreativeMode) { itemStack.shrink(1); } @@ -320,7 +342,8 @@ public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, Ent ItemBlockPipe itemBlockPipe = (ItemBlockPipe) itemStack.getItem(); if (itemBlockPipe.blockPipe.getItemPipeType(itemStack) == getItemPipeType(itemStack)) { BlockFrame frameBlock = (BlockFrame) blockStateAtSide.getBlock(); - boolean wasPlaced = frameBlock.replaceWithFramedPipe(world, pos.offset(side), blockStateAtSide, entityPlayer, itemStack, side); + boolean wasPlaced = frameBlock.replaceWithFramedPipe(world, pos.offset(side), blockStateAtSide, + entityPlayer, itemStack, side); if (wasPlaced) { pipeTile.setConnection(side, true, false); } @@ -358,7 +381,8 @@ public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, Ent } } - if ((itemStack.isEmpty() && entityPlayer.isSneaking()) || itemStack.getItem().getToolClasses(itemStack).contains(ToolClasses.SCREWDRIVER)) { + if ((itemStack.isEmpty() && entityPlayer.isSneaking()) || + itemStack.getItem().getToolClasses(itemStack).contains(ToolClasses.SCREWDRIVER)) { if (cover.onScrewdriverClick(entityPlayer, hand, hit) == EnumActionResult.SUCCESS) { if (!itemStack.isEmpty()) { ToolHelper.damageItem(itemStack, entityPlayer); @@ -382,24 +406,30 @@ public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, Ent if (activateFrame(world, state, pos, entityPlayer, hand, hit, pipeTile)) { return true; } - return entityPlayer.isSneaking() && entityPlayer.getHeldItemMainhand().isEmpty() && cover.onScrewdriverClick(entityPlayer, hand, hit) != EnumActionResult.PASS; + return entityPlayer.isSneaking() && entityPlayer.getHeldItemMainhand().isEmpty() && + cover.onScrewdriverClick(entityPlayer, hand, hit) != EnumActionResult.PASS; } return true; } - private boolean activateFrame(World world, IBlockState state, BlockPos pos, EntityPlayer entityPlayer, EnumHand hand, CuboidRayTraceResult hit, IPipeTile pipeTile) { - if (pipeTile.getFrameMaterial() != null && !(entityPlayer.getHeldItem(hand).getItem() instanceof ItemBlockPipe)) { + private boolean activateFrame(World world, IBlockState state, BlockPos pos, EntityPlayer entityPlayer, + EnumHand hand, CuboidRayTraceResult hit, IPipeTile pipeTile) { + if (pipeTile.getFrameMaterial() != null && + !(entityPlayer.getHeldItem(hand).getItem() instanceof ItemBlockPipe)) { BlockFrame blockFrame = MetaBlocks.FRAMES.get(pipeTile.getFrameMaterial()); - return blockFrame.onBlockActivated(world, pos, state, entityPlayer, hand, hit.sideHit, (float) hit.hitVec.x, (float) hit.hitVec.y, (float) hit.hitVec.z); + return blockFrame.onBlockActivated(world, pos, state, entityPlayer, hand, hit.sideHit, (float) hit.hitVec.x, + (float) hit.hitVec.y, (float) hit.hitVec.z); } return false; } /** * @return 1 if successfully used tool, 0 if failed to use tool, - * -1 if ItemStack failed the capability check (no action done, continue checks). + * -1 if ItemStack failed the capability check (no action done, continue checks). */ - public EnumActionResult onPipeToolUsed(World world, BlockPos pos, ItemStack stack, EnumFacing coverSide, IPipeTile pipeTile, EntityPlayer entityPlayer, EnumHand hand) { + public EnumActionResult onPipeToolUsed(World world, BlockPos pos, ItemStack stack, EnumFacing coverSide, + IPipeTile pipeTile, EntityPlayer entityPlayer, + EnumHand hand) { if (isPipeTool(stack)) { if (!entityPlayer.world.isRemote) { if (entityPlayer.isSneaking() && pipeTile.canHaveBlockedFaces()) { @@ -453,15 +483,18 @@ public void onEntityCollision(World worldIn, BlockPos pos, IBlockState state, En @SuppressWarnings("unchecked") @Override - public void harvestBlock(@Nonnull World worldIn, @Nonnull EntityPlayer player, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nullable TileEntity te, @Nonnull ItemStack stack) { + public void harvestBlock(@Nonnull World worldIn, @Nonnull EntityPlayer player, @Nonnull BlockPos pos, + @Nonnull IBlockState state, @Nullable TileEntity te, @Nonnull ItemStack stack) { tileEntities.set(te == null ? tileEntities.get() : (IPipeTile) te); super.harvestBlock(worldIn, player, pos, state, te, stack); tileEntities.set(null); } @Override - public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state, int fortune) { - IPipeTile pipeTile = tileEntities.get() == null ? getPipeTileEntity(world, pos) : tileEntities.get(); + public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull IBlockState state, int fortune) { + IPipeTile pipeTile = tileEntities.get() == null ? getPipeTileEntity(world, pos) : + tileEntities.get(); if (pipeTile == null) return; if (pipeTile.getFrameMaterial() != null) { BlockFrame blockFrame = MetaBlocks.FRAMES.get(pipeTile.getFrameMaterial()); @@ -471,7 +504,9 @@ public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAcces } @Override - public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull AxisAlignedBB entityBox, @Nonnull List collidingBoxes, @Nullable Entity entityIn, boolean isActualState) { + public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull AxisAlignedBB entityBox, @Nonnull List collidingBoxes, + @Nullable Entity entityIn, boolean isActualState) { // This iterator causes some heap memory overhead IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null && pipeTile.getFrameMaterial() != null) { @@ -489,7 +524,8 @@ public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World wor @Nullable @Override - public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, World worldIn, @Nonnull BlockPos pos, @Nonnull Vec3d start, @Nonnull Vec3d end) { + public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, World worldIn, @Nonnull BlockPos pos, + @Nonnull Vec3d start, @Nonnull Vec3d end) { if (worldIn.isRemote) { return getClientCollisionRayTrace(worldIn, pos, start, end); } @@ -497,8 +533,10 @@ public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, World w } @SideOnly(Side.CLIENT) - public RayTraceResult getClientCollisionRayTrace(World worldIn, @Nonnull BlockPos pos, @Nonnull Vec3d start, @Nonnull Vec3d end) { - return RayTracer.rayTraceCuboidsClosest(start, end, pos, getCollisionBox(worldIn, pos, Minecraft.getMinecraft().player)); + public RayTraceResult getClientCollisionRayTrace(World worldIn, @Nonnull BlockPos pos, @Nonnull Vec3d start, + @Nonnull Vec3d end) { + return RayTracer.rayTraceCuboidsClosest(start, end, pos, + getCollisionBox(worldIn, pos, Minecraft.getMinecraft().player)); } /** @@ -508,13 +546,13 @@ public RayTraceResult getClientCollisionRayTrace(World worldIn, @Nonnull BlockPo public CuboidRayTraceResult getServerCollisionRayTrace(EntityPlayer playerIn, BlockPos pos, World worldIn) { return RayTracer.rayTraceCuboidsClosest( RayTracer.getStartVec(playerIn), RayTracer.getEndVec(playerIn), - pos, getCollisionBox(worldIn, pos, playerIn) - ); + pos, getCollisionBox(worldIn, pos, playerIn)); } @Nonnull @Override - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EnumFacing face) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null && pipeTile.getCoverableImplementation().getCoverAtSide(face) != null) { return BlockFaceShape.SOLID; @@ -523,7 +561,8 @@ public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull } @Override - public boolean recolorBlock(World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, @Nonnull EnumDyeColor color) { + public boolean recolorBlock(World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, + @Nonnull EnumDyeColor color) { IPipeTile tileEntityPipe = (IPipeTile) world.getTileEntity(pos); if (tileEntityPipe != null && tileEntityPipe.getPipeType() != null && tileEntityPipe.getPipeType().isPaintable() && @@ -547,7 +586,8 @@ public IPipeTile getPipeTileEntity(IBlockAccess world, B } public IPipeTile getPipeTileEntity(TileEntity tileEntityAtPos) { - if (tileEntityAtPos instanceof IPipeTile && isThisPipeBlock(((IPipeTile) tileEntityAtPos).getPipeBlock())) { + if (tileEntityAtPos instanceof IPipeTile && + isThisPipeBlock(((IPipeTile) tileEntityAtPos).getPipeBlock())) { return (IPipeTile) tileEntityAtPos; } return null; @@ -570,9 +610,11 @@ public boolean canConnect(IPipeTile selfTile, EnumFacing return canPipeConnectToBlock(selfTile, facing, other); } - public abstract boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, IPipeTile sideTile); + public abstract boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, + IPipeTile sideTile); - public abstract boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, @Nullable TileEntity tile); + public abstract boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, + @Nullable TileEntity tile); private List getCollisionBox(IBlockAccess world, BlockPos pos, @Nullable Entity entityIn) { IPipeTile pipeTile = getPipeTileEntity(world, pos); @@ -642,7 +684,8 @@ public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRender @Nonnull @Override - public IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nullable EnumFacing side, @Nonnull BlockPos otherPos) { + public IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nullable EnumFacing side, + @Nonnull BlockPos otherPos) { return getFacade(world, pos, side); } @@ -671,11 +714,11 @@ public boolean supportsVisualConnections() { } public static class PipeConnectionData { + public final EnumFacing side; public PipeConnectionData(EnumFacing side) { this.side = side; } } - } diff --git a/src/main/java/gregtech/api/pipenet/block/IPipeType.java b/src/main/java/gregtech/api/pipenet/block/IPipeType.java index 59723b1c371..c0b4caf8121 100644 --- a/src/main/java/gregtech/api/pipenet/block/IPipeType.java +++ b/src/main/java/gregtech/api/pipenet/block/IPipeType.java @@ -9,5 +9,4 @@ public interface IPipeType extends IStringSerializable { NodeDataType modifyProperties(NodeDataType baseProperties); boolean isPaintable(); - } diff --git a/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java b/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java index 6d4a2bd32b0..b9984165cfa 100644 --- a/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java @@ -2,6 +2,7 @@ import gregtech.api.pipenet.tile.IPipeTile; import gregtech.common.ConfigHolder; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -29,8 +30,10 @@ public int getMetadata(int damage) { } @Override - @SuppressWarnings({"rawtypes", "unchecked"}) - public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull IBlockState newState) { + @SuppressWarnings({ "rawtypes", "unchecked" }) + public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + @Nonnull IBlockState newState) { boolean superVal = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState); if (superVal && !world.isRemote) { IPipeTile selfTile = (IPipeTile) world.getTileEntity(pos); @@ -48,9 +51,10 @@ public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer play otherPipe.setConnection(facing.getOpposite(), false, true); } } - } else if (!ConfigHolder.machines.gt6StylePipesCables && selfTile.getPipeBlock().canPipeConnectToBlock(selfTile, facing, te)) { - selfTile.setConnection(facing, true, false); - } + } else if (!ConfigHolder.machines.gt6StylePipesCables && + selfTile.getPipeBlock().canPipeConnectToBlock(selfTile, facing, te)) { + selfTile.setConnection(facing, true, false); + } } } return superVal; diff --git a/src/main/java/gregtech/api/pipenet/block/material/BlockMaterialPipe.java b/src/main/java/gregtech/api/pipenet/block/material/BlockMaterialPipe.java index 11f546be217..7ba754ea746 100644 --- a/src/main/java/gregtech/api/pipenet/block/material/BlockMaterialPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/material/BlockMaterialPipe.java @@ -12,6 +12,7 @@ import gregtech.api.unification.ore.OrePrefix; import gregtech.client.renderer.pipe.PipeRenderer; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; @@ -21,10 +22,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.util.Objects; -public abstract class BlockMaterialPipe & IPipeType & IMaterialPipeType, NodeDataType, WorldPipeNetType extends WorldPipeNet>> extends BlockPipe { +import javax.annotation.Nonnull; + +public abstract class BlockMaterialPipe< + PipeType extends Enum & IPipeType & IMaterialPipeType, NodeDataType, + WorldPipeNetType extends WorldPipeNet>> + extends BlockPipe { protected final PipeType pipeType; private final MaterialRegistry registry; @@ -65,7 +70,8 @@ public Material getItemMaterial(ItemStack itemStack) { @Override public void setTileEntityData(TileEntityPipeBase pipeTile, ItemStack itemStack) { - ((TileEntityMaterialPipeBase) pipeTile).setPipeData(this, pipeType, getItemMaterial(itemStack)); + ((TileEntityMaterialPipeBase) pipeTile).setPipeData(this, pipeType, + getItemMaterial(itemStack)); } @Override @@ -100,7 +106,7 @@ public void onModelRegister() { new ResourceLocation(GTValues.MODID, // force pipe models to always be GT's Objects.requireNonNull(this.getRegistryName()).getPath()), MetaBlocks.statePropertiesToString(state.getProperties())); - //noinspection ConstantConditions + // noinspection ConstantConditions ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), this.getMetaFromState(state), resourceLocation); } diff --git a/src/main/java/gregtech/api/pipenet/block/material/IMaterialPipeTile.java b/src/main/java/gregtech/api/pipenet/block/material/IMaterialPipeTile.java index 7ea113f4cda..bada7d3c132 100644 --- a/src/main/java/gregtech/api/pipenet/block/material/IMaterialPipeTile.java +++ b/src/main/java/gregtech/api/pipenet/block/material/IMaterialPipeTile.java @@ -4,7 +4,8 @@ import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.unification.material.Material; -public interface IMaterialPipeTile & IPipeType, NodeDataType> extends IPipeTile { +public interface IMaterialPipeTile & IPipeType, NodeDataType> + extends IPipeTile { Material getPipeMaterial(); } diff --git a/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java b/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java index 93bafb74e79..6932ebe24ae 100644 --- a/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java @@ -2,11 +2,13 @@ import gregtech.api.pipenet.block.ItemBlockPipe; import gregtech.api.unification.material.Material; + import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; -public class ItemBlockMaterialPipe & IMaterialPipeType, NodeDataType> extends ItemBlockPipe { +public class ItemBlockMaterialPipe & IMaterialPipeType, NodeDataType> + extends ItemBlockPipe { public ItemBlockMaterialPipe(BlockMaterialPipe block) { super(block); diff --git a/src/main/java/gregtech/api/pipenet/block/material/TileEntityMaterialPipeBase.java b/src/main/java/gregtech/api/pipenet/block/material/TileEntityMaterialPipeBase.java index a447f93dae4..fd8d9d43e85 100644 --- a/src/main/java/gregtech/api/pipenet/block/material/TileEntityMaterialPipeBase.java +++ b/src/main/java/gregtech/api/pipenet/block/material/TileEntityMaterialPipeBase.java @@ -6,6 +6,7 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; import gregtech.api.unification.material.registry.MaterialRegistry; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -13,7 +14,9 @@ import static gregtech.api.capability.GregtechDataCodes.UPDATE_PIPE_MATERIAL; -public abstract class TileEntityMaterialPipeBase & IMaterialPipeType, NodeDataType> extends TileEntityPipeBase implements IMaterialPipeTile { +public abstract class TileEntityMaterialPipeBase & IMaterialPipeType, + NodeDataType> extends TileEntityPipeBase + implements IMaterialPipeTile { private Material pipeMaterial = Materials.Aluminium; diff --git a/src/main/java/gregtech/api/pipenet/block/simple/BlockSimplePipe.java b/src/main/java/gregtech/api/pipenet/block/simple/BlockSimplePipe.java index 26d77f17a8a..52e344243c8 100644 --- a/src/main/java/gregtech/api/pipenet/block/simple/BlockSimplePipe.java +++ b/src/main/java/gregtech/api/pipenet/block/simple/BlockSimplePipe.java @@ -6,9 +6,12 @@ import gregtech.api.pipenet.block.IPipeType; import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.pipenet.tile.TileEntityPipeBase; + import net.minecraft.item.ItemStack; -public abstract class BlockSimplePipe & IPipeType, NodeDataType, WorldPipeNetType extends WorldPipeNet>> extends BlockPipe { +public abstract class BlockSimplePipe & IPipeType, NodeDataType, + WorldPipeNetType extends WorldPipeNet>> + extends BlockPipe { @Override public NodeDataType createProperties(IPipeTile pipeTile) { diff --git a/src/main/java/gregtech/api/pipenet/block/simple/EmptyNodeData.java b/src/main/java/gregtech/api/pipenet/block/simple/EmptyNodeData.java index 1fb867c01fa..af6b6a9e076 100644 --- a/src/main/java/gregtech/api/pipenet/block/simple/EmptyNodeData.java +++ b/src/main/java/gregtech/api/pipenet/block/simple/EmptyNodeData.java @@ -5,6 +5,5 @@ public class EmptyNodeData { public static final EmptyNodeData INSTANCE = new EmptyNodeData(); - private EmptyNodeData() { - } + private EmptyNodeData() {} } diff --git a/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java b/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java index 9f6c8756699..418ab91caf7 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java +++ b/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -16,14 +17,16 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class BlockLongDistancePipe extends Block implements ILDNetworkPart { private final LongDistancePipeType pipeType; @@ -37,7 +40,8 @@ public BlockLongDistancePipe(LongDistancePipeType pipeType) { } @Override - public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityLivingBase placer, @Nonnull ItemStack stack) { + public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull EntityLivingBase placer, @Nonnull ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); if (worldIn.isRemote) return; // first find all neighbouring networks @@ -61,7 +65,8 @@ public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonn network.getPipeType() + " is not valid for network type " + network.getPipeType()); } ILDEndpoint endpoint = ILDEndpoint.tryGet(worldIn, offsetPos); - // only count the network as connected if it's not an endpoint or the endpoints input or output face is connected + // only count the network as connected if it's not an endpoint or the endpoints input or output face is + // connected if (endpoint == null || endpoint.getFrontFacing().getAxis() == facing.getAxis()) { networks.add(network); } @@ -104,12 +109,14 @@ public void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList tooltip, @Nonnull ITooltipFlag flagIn) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, + @Nonnull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); tooltip.add(I18n.format("gregtech.block.tooltip.no_mob_spawning")); } diff --git a/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java b/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java index 73bc47eda2a..8b7e506faa7 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java +++ b/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java @@ -2,10 +2,12 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.interfaces.INeighborCache; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -85,6 +87,8 @@ static ILDEndpoint tryGet(World world, BlockPos pos) { } enum IOType { - NONE, INPUT, OUTPUT + NONE, + INPUT, + OUTPUT } } diff --git a/src/main/java/gregtech/api/pipenet/longdist/ILDNetworkPart.java b/src/main/java/gregtech/api/pipenet/longdist/ILDNetworkPart.java index 0a3b9ad9805..2e68fc04ec6 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/ILDNetworkPart.java +++ b/src/main/java/gregtech/api/pipenet/longdist/ILDNetworkPart.java @@ -3,6 +3,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java b/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java index fda17edbd71..486d6b9e5b4 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java +++ b/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java @@ -1,12 +1,7 @@ package gregtech.api.pipenet.longdist; import gregtech.api.pipenet.WorldPipeNet; -import it.unimi.dsi.fastutil.longs.Long2ObjectMap; -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectMaps; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -17,6 +12,13 @@ import net.minecraft.world.World; import net.minecraft.world.storage.WorldSavedData; import net.minecraftforge.common.util.Constants; + +import it.unimi.dsi.fastutil.longs.Long2ObjectMap; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectMaps; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -149,7 +151,8 @@ public void onPlaceEndpoint(ILDEndpoint endpoint) { */ protected void mergePipeNet(LongDistanceNetwork network) { if (getPipeType() != network.getPipeType()) { - throw new IllegalStateException("Can't merge unequal pipe types, " + getPipeType().getName() + " and " + network.getPipeType().getName() + " !"); + throw new IllegalStateException("Can't merge unequal pipe types, " + getPipeType().getName() + " and " + + network.getPipeType().getName() + " !"); } for (BlockPos pos : network.longDistancePipeBlocks) { this.world.putNetwork(pos, this); @@ -261,9 +264,9 @@ private int find(ILDEndpoint endpoint) { } public boolean isIOIndexInvalid() { - return (this.activeInputIndex >= 0 && this.activeInputIndex >= this.endpoints.size()) - || (this.activeOutputIndex >= 0 && this.activeOutputIndex >= this.endpoints.size()) - || this.activeInputIndex < 0 != this.activeOutputIndex < 0; + return (this.activeInputIndex >= 0 && this.activeInputIndex >= this.endpoints.size()) || + (this.activeOutputIndex >= 0 && this.activeOutputIndex >= this.endpoints.size()) || + this.activeInputIndex < 0 != this.activeOutputIndex < 0; } public ILDEndpoint getActiveInputIndex() { diff --git a/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java b/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java index 39c01a82157..65da862e92f 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java +++ b/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java @@ -2,13 +2,16 @@ import gregtech.common.pipelike.fluidpipe.longdistance.LDFluidPipeType; import gregtech.common.pipelike.itempipe.longdistance.LDItemPipeType; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Objects; +import javax.annotation.Nonnull; + /** * This class defines a long distance pipe type. This class MUST be a singleton class! */ diff --git a/src/main/java/gregtech/api/pipenet/longdist/NetworkBuilder.java b/src/main/java/gregtech/api/pipenet/longdist/NetworkBuilder.java index 5c90d866122..2eb375b5c23 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/NetworkBuilder.java +++ b/src/main/java/gregtech/api/pipenet/longdist/NetworkBuilder.java @@ -1,8 +1,5 @@ package gregtech.api.pipenet.longdist; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectList; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -12,6 +9,10 @@ import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.ChunkProviderServer; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectList; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -34,7 +35,8 @@ public class NetworkBuilder extends Thread { private final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); private final ObjectOpenHashSet loadedChunks = new ObjectOpenHashSet<>(); - public NetworkBuilder(LongDistanceNetwork.WorldData worldData, LongDistanceNetwork network, Collection starts) { + public NetworkBuilder(LongDistanceNetwork.WorldData worldData, LongDistanceNetwork network, + Collection starts) { this.worldData = Objects.requireNonNull(worldData); this.originalNetwork = Objects.requireNonNull(network); this.network = network; @@ -52,7 +54,8 @@ public void run() { start = this.starts.remove(0); LongDistanceNetwork ldn = this.worldData.getNetwork(start); if (ldn == this.originalNetwork) { - // this starting point was caught during a previous iteration, so we don't need to create another network here + // this starting point was caught during a previous iteration, so we don't need to create another + // network here continue; } // create a new network, since the current was already calculated diff --git a/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNet.java b/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNet.java index 554327b7459..14246888d7a 100644 --- a/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNet.java +++ b/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNet.java @@ -2,16 +2,19 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; + import net.minecraft.util.ITickable; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; + import org.apache.commons.lang3.tuple.Pair; import java.util.*; import java.util.stream.Collectors; -public abstract class TickableWorldPipeNet & ITickable> extends WorldPipeNet { +public abstract class TickableWorldPipeNet & ITickable> + extends WorldPipeNet { private final Map> loadedChunksByPipeNet = new HashMap<>(); private final Set tickingPipeNets = new HashSet<>(); @@ -33,7 +36,7 @@ public void update() { if (getWorld().getTotalWorldTime() % getUpdateRate() == 0L) { tickingPipeNets.forEach(ITickable::update); } - if(removeLater.size() > 0) { + if (removeLater.size() > 0) { removeLater.forEach(tickingPipeNets::remove); removeLater.clear(); } diff --git a/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNetEventHandler.java b/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNetEventHandler.java index 9762126eb3f..8ee0e7d61bd 100644 --- a/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNetEventHandler.java +++ b/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNetEventHandler.java @@ -1,6 +1,7 @@ package gregtech.api.pipenet.tickable; import gregtech.api.GTValues; + import net.minecraft.world.World; import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; diff --git a/src/main/java/gregtech/api/pipenet/tile/IPipeTile.java b/src/main/java/gregtech/api/pipenet/tile/IPipeTile.java index 0500179f2c3..486ddfa6d8b 100644 --- a/src/main/java/gregtech/api/pipenet/tile/IPipeTile.java +++ b/src/main/java/gregtech/api/pipenet/tile/IPipeTile.java @@ -4,17 +4,19 @@ import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.unification.material.Material; + import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; + import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; -public interface IPipeTile & IPipeType, NodeDataType> extends INeighborCache { +public interface IPipeTile & IPipeType, NodeDataType> + extends INeighborCache { World getPipeWorld(); diff --git a/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java b/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java index c36150247d7..fdf40e93375 100644 --- a/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java +++ b/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java @@ -6,6 +6,7 @@ import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -14,13 +15,15 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; import java.util.EnumMap; import java.util.function.Consumer; +import javax.annotation.Nonnull; + import static gregtech.api.capability.GregtechDataCodes.*; public class PipeCoverableImplementation implements CoverHolder { @@ -97,7 +100,7 @@ public void onLoad() { @Override public final int getInputRedstoneSignal(@NotNull EnumFacing side, boolean ignoreCover) { if (!ignoreCover && getCoverAtSide(side) != null) { - return 0; //covers block input redstone signal for machine + return 0; // covers block input redstone signal for machine } return sidedRedstoneInput[side.getIndex()]; } @@ -162,8 +165,8 @@ public final boolean acceptsCovers() { } public boolean canConnectRedstone(@Nullable EnumFacing side) { - //so far null side means either upwards or downwards redstone wire connection - //so check both top cover and bottom cover + // so far null side means either upwards or downwards redstone wire connection + // so check both top cover and bottom cover if (side == null) { return canConnectRedstone(EnumFacing.UP) || canConnectRedstone(EnumFacing.DOWN); @@ -222,12 +225,12 @@ public void readCustomData(int dataId, PacketBuffer buf) { if (dataId == COVER_ATTACHED_PIPE) { CoverSaveHandler.readCoverPlacement(buf, this); } else if (dataId == COVER_REMOVED_PIPE) { - //cover removed event + // cover removed event EnumFacing placementSide = EnumFacing.VALUES[buf.readByte()]; this.covers.remove(placementSide); holder.scheduleChunkForRenderUpdate(); } else if (dataId == UPDATE_COVER_DATA_PIPE) { - //cover custom data received + // cover custom data received EnumFacing coverSide = EnumFacing.VALUES[buf.readByte()]; Cover cover = getCoverAtSide(coverSide); int internalId = buf.readVarInt(); diff --git a/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java b/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java index 954e425a9b7..9bf3d61e2c1 100644 --- a/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java +++ b/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java @@ -10,6 +10,7 @@ import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.unification.material.Material; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; @@ -25,13 +26,15 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants.NBT; +import java.util.function.Consumer; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.function.Consumer; import static gregtech.api.capability.GregtechDataCodes.*; -public abstract class TileEntityPipeBase & IPipeType, NodeDataType> extends NeighborCacheTileEntityBase implements IPipeTile { +public abstract class TileEntityPipeBase & IPipeType, + NodeDataType> extends NeighborCacheTileEntityBase implements IPipeTile { protected final PipeCoverableImplementation coverableImplementation = new PipeCoverableImplementation(this); protected int paintingColor = -1; @@ -45,8 +48,7 @@ public abstract class TileEntityPipeBase & IPipe // set when this pipe is replaced with a ticking variant to redirect sync packets private TileEntityPipeBase tickingPipe; - public TileEntityPipeBase() { - } + public TileEntityPipeBase() {} public void setPipeData(BlockPipe pipeBlock, PipeType pipeType) { this.pipeBlock = pipeBlock; @@ -129,7 +131,7 @@ public IPipeTile setSupportsTicking() { // reuse ticking pipe return this.tickingPipe; } - //create new tickable tile entity, transfer data, and replace it + // create new tickable tile entity, transfer data, and replace it TileEntityPipeBase newTile = getPipeBlock().createNewTileEntity(true); if (!newTile.supportsTicking()) throw new IllegalStateException("Expected pipe to be ticking, but isn't!"); newTile.transferDataFrom(this); @@ -142,7 +144,7 @@ public IPipeTile setSupportsTicking() { public BlockPipe getPipeBlock() { if (pipeBlock == null) { Block block = getBlockState().getBlock(); - //noinspection unchecked + // noinspection unchecked this.pipeBlock = block instanceof BlockPipe blockPipe ? blockPipe : null; } return pipeBlock; @@ -205,7 +207,8 @@ public static boolean isConnected(int connections, EnumFacing side) { @Override public void setConnection(EnumFacing side, boolean connected, boolean fromNeighbor) { - // fix desync between two connections. Can happen if a pipe side is blocked, and a new pipe is placed next to it. + // fix desync between two connections. Can happen if a pipe side is blocked, and a new pipe is placed next to + // it. if (!getWorld().isRemote) { if (isConnected(side) == connected) { return; @@ -308,7 +311,7 @@ public int getVisualConnections() { float selfThickness = getPipeType().getThickness(); for (EnumFacing facing : EnumFacing.values()) { if (isConnected(facing)) { - if (world.getTileEntity(pos.offset(facing)) instanceof IPipeTile pipeTile && + if (world.getTileEntity(pos.offset(facing)) instanceof IPipeTilepipeTile && pipeTile.isConnected(facing.getOpposite()) && pipeTile.getPipeType().getThickness() < selfThickness) { connections |= 1 << (facing.getIndex() + 6); @@ -362,7 +365,7 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound compound) { super.writeToNBT(compound); BlockPipe pipeBlock = getPipeBlock(); if (pipeBlock != null) { - //noinspection ConstantConditions + // noinspection ConstantConditions compound.setString("PipeBlock", pipeBlock.getRegistryName().toString()); } compound.setInteger("PipeType", pipeType.ordinal()); @@ -385,7 +388,7 @@ public void readFromNBT(@Nonnull NBTTagCompound compound) { super.readFromNBT(compound); if (compound.hasKey("PipeBlock", NBT.TAG_STRING)) { Block block = Block.REGISTRY.getObject(new ResourceLocation(compound.getString("PipeBlock"))); - //noinspection unchecked + // noinspection unchecked this.pipeBlock = block instanceof BlockPipe blockPipe ? blockPipe : null; } this.pipeType = getPipeTypeClass().getEnumConstants()[compound.getInteger("PipeType")]; @@ -531,14 +534,16 @@ public boolean isValidTile() { } @Override - public boolean shouldRefresh(@Nonnull World world, @Nonnull BlockPos pos, IBlockState oldState, IBlockState newSate) { + public boolean shouldRefresh(@Nonnull World world, @Nonnull BlockPos pos, IBlockState oldState, + IBlockState newSate) { return oldState.getBlock() != newSate.getBlock(); } public void doExplosion(float explosionPower) { getWorld().setBlockToAir(getPos()); if (!getWorld().isRemote) { - ((WorldServer) getWorld()).spawnParticle(EnumParticleTypes.SMOKE_LARGE, getPos().getX() + 0.5, getPos().getY() + 0.5, getPos().getZ() + 0.5, + ((WorldServer) getWorld()).spawnParticle(EnumParticleTypes.SMOKE_LARGE, getPos().getX() + 0.5, + getPos().getY() + 0.5, getPos().getZ() + 0.5, 10, 0.2, 0.2, 0.2, 0.0); } getWorld().createExplosion(null, getPos().getX() + 0.5, getPos().getY() + 0.5, getPos().getZ() + 0.5, diff --git a/src/main/java/gregtech/api/recipes/FluidCellInput.java b/src/main/java/gregtech/api/recipes/FluidCellInput.java index c25d6d2eca8..28fdcd02c48 100644 --- a/src/main/java/gregtech/api/recipes/FluidCellInput.java +++ b/src/main/java/gregtech/api/recipes/FluidCellInput.java @@ -2,6 +2,7 @@ import gregtech.api.recipes.ingredients.GTRecipeItemInput; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -21,8 +22,9 @@ public FluidCellInput(Fluid fluid) { public static ItemStack getFilledCell(Fluid fluid, int count) { ItemStack fluidCell = MetaItems.FLUID_CELL.getStackForm().copy(); - IFluidHandlerItem fluidHandlerItem = fluidCell.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); - if (fluidHandlerItem ==null) { + IFluidHandlerItem fluidHandlerItem = fluidCell + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + if (fluidHandlerItem == null) { throw new IllegalStateException("Could not get FluidHandlerItem capability for the fluid cell."); } fluidHandlerItem.fill(new FluidStack(fluid, 1000), true); @@ -41,9 +43,10 @@ public boolean acceptsStack(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.isEmpty()) { return false; } - IFluidHandlerItem stackFluid = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem stackFluid = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); FluidStack drained = stackFluid == null ? null : stackFluid.getTankProperties()[0].getContents(); - return MetaItems.FLUID_CELL.isItemEqual(itemStack) && drained != null && drained.getFluid() == fluid && drained.amount == 1000; + return MetaItems.FLUID_CELL.isItemEqual(itemStack) && drained != null && drained.getFluid() == fluid && + drained.amount == 1000; } - } diff --git a/src/main/java/gregtech/api/recipes/FluidKey.java b/src/main/java/gregtech/api/recipes/FluidKey.java index f5123af881c..79709382769 100644 --- a/src/main/java/gregtech/api/recipes/FluidKey.java +++ b/src/main/java/gregtech/api/recipes/FluidKey.java @@ -24,13 +24,12 @@ public FluidKey copy() { return new FluidKey(new FluidStack(getFluid(), this.amount, tag)); } - @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof FluidKey)) return false; FluidKey fluidKey = (FluidKey) o; - if (!Objects.equals(fluid, fluidKey.fluid) ) + if (!Objects.equals(fluid, fluidKey.fluid)) return false; if (tag == null && fluidKey.tag != null) return false; else return tag == null || tag.equals(fluidKey.tag); diff --git a/src/main/java/gregtech/api/recipes/GTRecipeHandler.java b/src/main/java/gregtech/api/recipes/GTRecipeHandler.java index 714e2ba9ff7..d08e3d6b851 100644 --- a/src/main/java/gregtech/api/recipes/GTRecipeHandler.java +++ b/src/main/java/gregtech/api/recipes/GTRecipeHandler.java @@ -2,6 +2,7 @@ import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -16,14 +17,14 @@ public class GTRecipeHandler { * An example of how to use it: * * - * removeRecipesByInputs(RecipeMaps.CHEMICAL_RECIPES, - * new ItemStack[]{ - * OreDictUnifier.get(OrePrefix.dust, Materials.SodiumHydroxide, 3) - * }, - * new FluidStack[]{ - * Materials.HypochlorousAcid.getFluid(1000), - * Materials.AllylChloride.getFluid(1000) - * }); + * removeRecipesByInputs(RecipeMaps.CHEMICAL_RECIPES, + * new ItemStack[]{ + * OreDictUnifier.get(OrePrefix.dust, Materials.SodiumHydroxide, 3) + * }, + * new FluidStack[]{ + * Materials.HypochlorousAcid.getFluid(1000), + * Materials.AllylChloride.getFluid(1000) + * }); * * * This method also has varargs parameter methods for when there is only ItemStack or FluidStack inputs. @@ -34,15 +35,15 @@ public class GTRecipeHandler { * * @return true if a recipe was removed, false otherwise. */ - public static > boolean removeRecipesByInputs(RecipeMap map, ItemStack[] itemInputs, FluidStack[] fluidInputs) { - + public static > boolean removeRecipesByInputs(RecipeMap map, ItemStack[] itemInputs, + FluidStack[] fluidInputs) { List fluidNames = new ArrayList<>(); List itemNames = new ArrayList<>(); List itemIn = new ArrayList<>(); for (ItemStack s : itemInputs) { itemIn.add(s); - if(ConfigHolder.misc.debug) { + if (ConfigHolder.misc.debug) { itemNames.add(String.format("%s x %d", s.getDisplayName(), s.getCount())); } } @@ -50,7 +51,7 @@ public static > boolean removeRecipesByInputs(RecipeM List fluidIn = new ArrayList<>(); for (FluidStack s : fluidInputs) { fluidIn.add(s); - if(ConfigHolder.misc.debug) { + if (ConfigHolder.misc.debug) { fluidNames.add(String.format("%s x %d", s.getFluid().getName(), s.amount)); } } @@ -65,11 +66,13 @@ public static > boolean removeRecipesByInputs(RecipeM return wasRemoved; } - public static > boolean removeRecipesByInputs(RecipeMap map, ItemStack... itemInputs) { + public static > boolean removeRecipesByInputs(RecipeMap map, + ItemStack... itemInputs) { return removeRecipesByInputs(map, itemInputs, new FluidStack[0]); } - public static > boolean removeRecipesByInputs(RecipeMap map, FluidStack... fluidInputs) { + public static > boolean removeRecipesByInputs(RecipeMap map, + FluidStack... fluidInputs) { return removeRecipesByInputs(map, new ItemStack[0], fluidInputs); } @@ -79,7 +82,7 @@ public static > boolean removeRecipesByInputs(RecipeM * An example of how to use it: * * - * removeAllRecipes(RecipeMaps.BREWING_RECIPES); + * removeAllRecipes(RecipeMaps.BREWING_RECIPES); * * * @param map The RecipeMap to clear all recipes from. diff --git a/src/main/java/gregtech/api/recipes/GTRecipeInputCache.java b/src/main/java/gregtech/api/recipes/GTRecipeInputCache.java index 8f2242dbca4..f72fb572f6e 100644 --- a/src/main/java/gregtech/api/recipes/GTRecipeInputCache.java +++ b/src/main/java/gregtech/api/recipes/GTRecipeInputCache.java @@ -4,6 +4,7 @@ import gregtech.api.recipes.ingredients.GTRecipeInput; import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; + import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import java.util.ArrayList; @@ -54,7 +55,7 @@ public static void disableCache() { * * @param recipeInput ingredient instance to be deduplicated * @return Either previously cached instance, or {@code recipeInput} marked cached; - * or unmodified {@code recipeInput} instance if the cache is disabled + * or unmodified {@code recipeInput} instance if the cache is disabled */ public static GTRecipeInput deduplicate(GTRecipeInput recipeInput) { if (!isCacheEnabled() || recipeInput.isCached()) { diff --git a/src/main/java/gregtech/api/recipes/ModHandler.java b/src/main/java/gregtech/api/recipes/ModHandler.java index 278bfaefd33..bea1f8cf14a 100644 --- a/src/main/java/gregtech/api/recipes/ModHandler.java +++ b/src/main/java/gregtech/api/recipes/ModHandler.java @@ -1,7 +1,5 @@ package gregtech.api.recipes; -import crafttweaker.mc1120.actions.ActionAddFurnaceRecipe; -import crafttweaker.mc1120.furnace.MCFurnaceManager; import gregtech.api.GTValues; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.toolitem.IGTTool; @@ -24,6 +22,7 @@ import gregtech.common.crafting.GTShapedOreRecipe; import gregtech.common.crafting.GTShapelessOreRecipe; import gregtech.common.crafting.ShapedOreEnergyTransferRecipe; + import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; @@ -39,20 +38,25 @@ import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.oredict.ShapelessOreRecipe; import net.minecraftforge.registries.IForgeRegistry; + +import crafttweaker.mc1120.actions.ActionAddFurnaceRecipe; +import crafttweaker.mc1120.furnace.MCFurnaceManager; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.lang.reflect.Field; import java.util.*; import java.util.function.Predicate; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public final class ModHandler { - public static final boolean ERROR_ON_INVALID_RECIPE = GTValues.isDeobfEnvironment() || !ConfigHolder.misc.ignoreErrorOrInvalidRecipes; + public static final boolean ERROR_ON_INVALID_RECIPE = GTValues.isDeobfEnvironment() || + !ConfigHolder.misc.ignoreErrorOrInvalidRecipes; public static boolean hasInvalidRecipe = false; private ModHandler() {} @@ -149,12 +153,14 @@ public static void addSmeltingRecipe(@Nonnull ItemStack input, @Nonnull ItemStac FurnaceRecipes recipes = FurnaceRecipes.instance(); if (recipes.getSmeltingResult(input).isEmpty()) { - //register only if there is no recipe with duplicate input + // register only if there is no recipe with duplicate input recipes.addSmeltingRecipe(input, output, experience); } else { logInvalidRecipe(String.format("Tried to register duplicate Furnace Recipe: %sx %s:%s -> %sx %s:%s, %sexp", - input.getCount(), Objects.requireNonNull(input.getItem().getRegistryName()).getNamespace(), input.getDisplayName(), - output.getCount(), Objects.requireNonNull(output.getItem().getRegistryName()).getNamespace(), output.getDisplayName(), experience)); + input.getCount(), Objects.requireNonNull(input.getItem().getRegistryName()).getNamespace(), + input.getDisplayName(), + output.getCount(), Objects.requireNonNull(output.getItem().getRegistryName()).getNamespace(), + output.getDisplayName(), experience)); } } @@ -173,26 +179,28 @@ public static ItemStack getSmeltingOutput(@Nonnull ItemStack input) { /** * Adds Shaped Crafting Recipes. *

- * {@link MetaItem.MetaValueItem}'s are converted to ItemStack via {@link MetaItem.MetaValueItem#getStackForm()} method. + * {@link MetaItem.MetaValueItem}'s are converted to ItemStack via {@link MetaItem.MetaValueItem#getStackForm()} + * method. *

* For Enums - {@link Enum#name()} is called. *

* For {@link UnificationEntry} - {@link UnificationEntry#toString()} is called. *

- * For Lowercase Characters - gets IGTool from {@link ToolHelper#getToolFromSymbol(Character)}, and calls {@link IGTTool#getOreDictName()} + * For Lowercase Characters - gets IGTool from {@link ToolHelper#getToolFromSymbol(Character)}, and calls + * {@link IGTTool#getOreDictName()} *

* Base tool names are as follows: *

    - *
  • {@code 'c'} - {@code craftingToolCrowbar}
  • - *
  • {@code 'd'} - {@code craftingToolScrewdriver}
  • - *
  • {@code 'f'} - {@code craftingToolFile}
  • - *
  • {@code 'h'} - {@code craftingToolHardHammer}
  • - *
  • {@code 'k'} - {@code craftingToolKnife}
  • - *
  • {@code 'm'} - {@code craftingToolMortar}
  • - *
  • {@code 'r'} - {@code craftingToolSoftHammer}
  • - *
  • {@code 's'} - {@code craftingToolSaw}
  • - *
  • {@code 'w'} - {@code craftingToolWrench}
  • - *
  • {@code 'x'} - {@code craftingToolWireCutter}
  • + *
  • {@code 'c'} - {@code craftingToolCrowbar}
  • + *
  • {@code 'd'} - {@code craftingToolScrewdriver}
  • + *
  • {@code 'f'} - {@code craftingToolFile}
  • + *
  • {@code 'h'} - {@code craftingToolHardHammer}
  • + *
  • {@code 'k'} - {@code craftingToolKnife}
  • + *
  • {@code 'm'} - {@code craftingToolMortar}
  • + *
  • {@code 'r'} - {@code craftingToolSoftHammer}
  • + *
  • {@code 's'} - {@code craftingToolSaw}
  • + *
  • {@code 'w'} - {@code craftingToolWrench}
  • + *
  • {@code 'x'} - {@code craftingToolWireCutter}
  • *
* * @param regName the registry name for the recipe @@ -204,7 +212,8 @@ public static void addShapedRecipe(@Nonnull String regName, @Nonnull ItemStack r } /** - * Adds a shaped recipe with a single fluid container, which gets consumed as input and is output with different contents + * Adds a shaped recipe with a single fluid container, which gets consumed as input and is output with different + * contents * * @see ModHandler#addShapedRecipe(String, ItemStack, Object...) */ @@ -227,7 +236,8 @@ public static void addShapedNBTClearingRecipe(String regName, ItemStack result, * @param withUnificationData whether to use unification data * @see ModHandler#addShapedRecipe(String, ItemStack, Object...) */ - public static void addShapedRecipe(boolean withUnificationData, String regName, ItemStack result, Object... recipe) { + public static void addShapedRecipe(boolean withUnificationData, String regName, ItemStack result, + Object... recipe) { addShapedRecipe(withUnificationData, regName, result, false, false, recipe); } @@ -246,7 +256,8 @@ public static void addMirroredShapedRecipe(String regName, ItemStack result, Obj * @param isMirrored whether the recipe should be mirrored * @see ModHandler#addShapedRecipe(String, ItemStack, Object...) */ - public static void addShapedRecipe(boolean withUnificationData, @Nonnull String regName, @Nonnull ItemStack result, boolean isNBTClearing, boolean isMirrored, @Nonnull Object... recipe) { + public static void addShapedRecipe(boolean withUnificationData, @Nonnull String regName, @Nonnull ItemStack result, + boolean isNBTClearing, boolean isMirrored, @Nonnull Object... recipe) { if (!validateRecipeWithOutput(regName, result, recipe)) return; addRecipe(regName, result, isNBTClearing, isMirrored, recipe); @@ -259,13 +270,14 @@ public static void addShapedRecipe(boolean withUnificationData, @Nonnull String /** * @see ModHandler#addFluidReplaceRecipe(String, ItemStack, Object...) */ - public static void addFluidReplaceRecipe(String regName, ItemStack result, boolean isNBTClearing, Object... recipe) { + public static void addFluidReplaceRecipe(String regName, ItemStack result, boolean isNBTClearing, + Object... recipe) { if (!validateRecipeWithOutput(regName, result, recipe)) return; IRecipe shapedOreRecipe = new FluidReplaceRecipe(isNBTClearing, null, result.copy(), finalizeShapedRecipeInput(recipe)) - .setMirrored(false) //make all recipes not mirrored by default - .setRegistryName(regName); + .setMirrored(false) // make all recipes not mirrored by default + .setRegistryName(regName); registerRecipe(shapedOreRecipe); } @@ -276,28 +288,34 @@ public static void addFluidReplaceRecipe(String regName, ItemStack result, boole * @param transferMaxCharge whether to transfer all the potential charge * @see ModHandler#addShapedRecipe(String, ItemStack, Object...) */ - public static void addShapedEnergyTransferRecipe(String regName, ItemStack result, Predicate chargePredicate, boolean overrideCharge, boolean transferMaxCharge, Object... recipe) { + public static void addShapedEnergyTransferRecipe(String regName, ItemStack result, + Predicate chargePredicate, boolean overrideCharge, + boolean transferMaxCharge, Object... recipe) { if (!validateRecipeWithOutput(regName, result, recipe)) return; - IRecipe shapedOreRecipe = new ShapedOreEnergyTransferRecipe(null, result.copy(), chargePredicate, overrideCharge, transferMaxCharge, finalizeShapedRecipeInput(recipe)) - .setMirrored(false) - .setRegistryName(regName); + IRecipe shapedOreRecipe = new ShapedOreEnergyTransferRecipe(null, result.copy(), chargePredicate, + overrideCharge, transferMaxCharge, finalizeShapedRecipeInput(recipe)) + .setMirrored(false) + .setRegistryName(regName); registerRecipe(shapedOreRecipe); } @SuppressWarnings("BooleanMethodIsAlwaysInverted") - private static boolean validateRecipeWithOutput(@Nonnull String regName, @Nonnull ItemStack result, @Nonnull Object... recipe) { + private static boolean validateRecipeWithOutput(@Nonnull String regName, @Nonnull ItemStack result, + @Nonnull Object... recipe) { if (result.isEmpty()) { if (setErroredInvalidRecipe("Recipe output cannot be an empty ItemStack. Recipe: " + regName)) return false; } return validateRecipe(regName, recipe); } - private static void addRecipe(@Nonnull String regName, @Nonnull ItemStack result, boolean isNBTClearing, boolean isMirrored, @Nonnull Object... recipe) { - IRecipe shapedOreRecipe = new GTShapedOreRecipe(isNBTClearing, null, result.copy(), finalizeShapedRecipeInput(recipe)) - .setMirrored(isMirrored) - .setRegistryName(regName); + private static void addRecipe(@Nonnull String regName, @Nonnull ItemStack result, boolean isNBTClearing, + boolean isMirrored, @Nonnull Object... recipe) { + IRecipe shapedOreRecipe = new GTShapedOreRecipe(isNBTClearing, null, result.copy(), + finalizeShapedRecipeInput(recipe)) + .setMirrored(isMirrored) + .setRegistryName(regName); registerRecipe(shapedOreRecipe); } @@ -323,15 +341,18 @@ private static boolean validateRecipe(String regName, Object... recipe) { .map(Object::toString) .map(s -> "\"" + s + "\"") .collect(Collectors.joining(", ")); - return !setErroredInvalidRecipe("Recipe cannot contain null elements or Empty ItemStacks. Recipe: " + recipeMessage); + return !setErroredInvalidRecipe( + "Recipe cannot contain null elements or Empty ItemStacks. Recipe: " + recipeMessage); } else { ModContainer container = Loader.instance().activeModContainer(); - if (ForgeRegistries.RECIPES.containsKey(new ResourceLocation(container == null ? GTValues.MODID : container.getModId().toLowerCase(), regName))) { + if (ForgeRegistries.RECIPES.containsKey(new ResourceLocation( + container == null ? GTValues.MODID : container.getModId().toLowerCase(), regName))) { String recipeMessage = Arrays.stream(recipe) .map(Object::toString) .map(s -> "\"" + s + "\"") .collect(Collectors.joining(", ")); - logInvalidRecipe("Tried to register recipe, " + regName + ", with duplicate key. Recipe: " + recipeMessage); + logInvalidRecipe( + "Tried to register recipe, " + regName + ", with duplicate key. Recipe: " + recipeMessage); return false; } } @@ -383,15 +404,12 @@ public static Object finalizeIngredient(@Nonnull Object ingredient) { logInvalidRecipe("Attempted to create recipe for invalid/missing Unification Entry " + ingredient); } ingredient = ingredient.toString(); - } else if (!(ingredient instanceof ItemStack - || ingredient instanceof Item - || ingredient instanceof Block - || ingredient instanceof String - || ingredient instanceof Character - || ingredient instanceof Boolean - || ingredient instanceof Ingredient)) { - throw new IllegalArgumentException(ingredient.getClass().getSimpleName() + " type is not suitable for crafting input."); - } + } else if (!(ingredient instanceof ItemStack || ingredient instanceof Item || ingredient instanceof Block || + ingredient instanceof String || ingredient instanceof Character || ingredient instanceof Boolean || + ingredient instanceof Ingredient)) { + throw new IllegalArgumentException( + ingredient.getClass().getSimpleName() + " type is not suitable for crafting input."); + } return ingredient; } @@ -415,7 +433,8 @@ public static ItemMaterialInfo getRecyclingIngredients(int outputCount, @Nonnull * @param result the output of the recipe * @param recipe the recipe to add */ - public static void addShapelessRecipe(@Nonnull String regName, @Nonnull ItemStack result, @Nonnull Object... recipe) { + public static void addShapelessRecipe(@Nonnull String regName, @Nonnull ItemStack result, + @Nonnull Object... recipe) { addShapelessRecipe(regName, result, false, recipe); } @@ -424,7 +443,8 @@ public static void addShapelessRecipe(@Nonnull String regName, @Nonnull ItemStac * * @see ModHandler#addShapelessRecipe(String, ItemStack, boolean, Object...) */ - public static void addShapelessNBTClearingRecipe(@Nonnull String regName, @Nonnull ItemStack result, @Nonnull Object... recipe) { + public static void addShapelessNBTClearingRecipe(@Nonnull String regName, @Nonnull ItemStack result, + @Nonnull Object... recipe) { addShapelessRecipe(regName, result, true, recipe); } @@ -452,12 +472,11 @@ public static void addShapelessRecipe(String regName, ItemStack result, boolean throw new IllegalArgumentException("Tool name is not found for char " + recipe[i]); } recipe[i] = tool.getOreDictName(); - } else if (!(recipe[i] instanceof ItemStack - || recipe[i] instanceof Item - || recipe[i] instanceof Block - || recipe[i] instanceof String)) { - throw new IllegalArgumentException(recipe.getClass().getSimpleName() + " type is not suitable for crafting input."); - } + } else if (!(recipe[i] instanceof ItemStack || recipe[i] instanceof Item || recipe[i] instanceof Block || + recipe[i] instanceof String)) { + throw new IllegalArgumentException( + recipe.getClass().getSimpleName() + " type is not suitable for crafting input."); + } } IRecipe shapelessRecipe = new GTShapelessOreRecipe(isNBTClearing, null, result.copy(), recipe) .setRegistryName(regName); @@ -503,7 +522,10 @@ public static boolean removeFurnaceSmelting(@Nonnull ItemStack input) { if (setErroredInvalidRecipe("Cannot remove furnace recipe with empty input.")) return false; } - boolean wasRemoved = FurnaceRecipes.instance().getSmeltingList().keySet().removeIf(currentStack -> currentStack.getItem() == input.getItem() && (currentStack.getMetadata() == GTValues.W || currentStack.getMetadata() == input.getMetadata())); + boolean wasRemoved = FurnaceRecipes.instance().getSmeltingList().keySet() + .removeIf(currentStack -> currentStack.getItem() == input.getItem() && + (currentStack.getMetadata() == GTValues.W || + currentStack.getMetadata() == input.getMetadata())); if (ConfigHolder.misc.debug) { if (wasRemoved) { @@ -524,7 +546,8 @@ public static boolean removeFurnaceSmelting(@Nonnull ItemStack input) { */ @SuppressWarnings("UnusedReturnValue") public static int removeRecipeByOutput(@Nonnull ItemStack output) { - int recipesRemoved = removeRecipeByOutput(recipe -> ItemStack.areItemStacksEqual(recipe.getRecipeOutput(), output)); + int recipesRemoved = removeRecipeByOutput( + recipe -> ItemStack.areItemStacksEqual(recipe.getRecipeOutput(), output)); if (ConfigHolder.misc.debug) { if (recipesRemoved != 0) { @@ -619,7 +642,7 @@ public static void removeTieredRecipeByName(@Nonnull String recipeName, int star } /////////////////////////////////////////////////// - // Get Recipe Output Helpers // + // Get Recipe Output Helpers // /////////////////////////////////////////////////// /** @@ -679,12 +702,13 @@ public static void removeSmeltingEBFMetals() { if (material.hasProperty(PropertyKey.BLAST)) { ItemStack dust = OreDictUnifier.get(OrePrefix.dust, material); ItemStack ingot = OreDictUnifier.get(OrePrefix.ingot, material); - //Check if the inputs are actually dust -> ingot + // Check if the inputs are actually dust -> ingot if (ingot.isItemEqual(output) && dust.isItemEqual(input)) { if (isCTLoaded) { if (actionAddFurnaceRecipe$output == null) { try { - actionAddFurnaceRecipe$output = ActionAddFurnaceRecipe.class.getDeclaredField("output"); + actionAddFurnaceRecipe$output = ActionAddFurnaceRecipe.class + .getDeclaredField("output"); actionAddFurnaceRecipe$output.setAccessible(true); } catch (NoSuchFieldException e) { GTLog.logger.error("Could not reflect Furnace output field", e); @@ -697,7 +721,9 @@ public static void removeSmeltingEBFMetals() { // ..was a cached stack in an existing ActionAddFurnaceRecipe as well if (actionAddFurnaceRecipe$output.get(aafr) == output) { if (ConfigHolder.misc.debug) { - GTLog.logger.info("Not removing Smelting Recipe for EBF material {} as it is added via CT", LocalizationUtils.format(material.getUnlocalizedName())); + GTLog.logger.info( + "Not removing Smelting Recipe for EBF material {} as it is added via CT", + LocalizationUtils.format(material.getUnlocalizedName())); } continue outer; } @@ -708,7 +734,8 @@ public static void removeSmeltingEBFMetals() { } recipeIterator.remove(); if (ConfigHolder.misc.debug) { - GTLog.logger.info("Removing Smelting Recipe for EBF material {}", LocalizationUtils.format(material.getUnlocalizedName())); + GTLog.logger.info("Removing Smelting Recipe for EBF material {}", + LocalizationUtils.format(material.getUnlocalizedName())); } } } diff --git a/src/main/java/gregtech/api/recipes/Recipe.java b/src/main/java/gregtech/api/recipes/Recipe.java index f38f8baf47f..79290c08806 100644 --- a/src/main/java/gregtech/api/recipes/Recipe.java +++ b/src/main/java/gregtech/api/recipes/Recipe.java @@ -1,6 +1,5 @@ package gregtech.api.recipes; -import com.google.common.collect.ImmutableList; import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.recipes.category.GTRecipeCategory; import gregtech.api.recipes.chance.boost.ChanceBoostFunction; @@ -15,29 +14,41 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.ItemStackHashStrategy; import gregtech.integration.groovy.GroovyScriptModule; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.oredict.OreDictionary; + +import com.google.common.collect.ImmutableList; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; -import javax.annotation.Nonnull; import java.util.*; +import javax.annotation.Nonnull; + /** - * Class that represent machine recipe.

+ * Class that represent machine recipe. + *

+ *

+ * Recipes are created using {@link RecipeBuilder} or its subclasses in builder-alike pattern. To get RecipeBuilder use + * {@link RecipeMap#recipeBuilder()}. *

- * Recipes are created using {@link RecipeBuilder} or its subclasses in builder-alike pattern. To get RecipeBuilder use {@link RecipeMap#recipeBuilder()}.

*

* Example: - * RecipeMap.POLARIZER_RECIPES.recipeBuilder().inputs(new ItemStack(Items.APPLE)).outputs(new ItemStack(Items.GOLDEN_APPLE)).duration(256).EUt(480).buildAndRegister();

- * This will create and register Polarizer recipe with Apple as input and Golden apple as output, duration - 256 ticks and energy consumption of 480 EU/t.

- * To get example for particular RecipeMap see {@link RecipeMap}

+ * RecipeMap.POLARIZER_RECIPES.recipeBuilder().inputs(new ItemStack(Items.APPLE)).outputs(new + * ItemStack(Items.GOLDEN_APPLE)).duration(256).EUt(480).buildAndRegister(); + *

+ * This will create and register Polarizer recipe with Apple as input and Golden apple as output, duration - 256 ticks + * and energy consumption of 480 EU/t. + *

+ * To get example for particular RecipeMap see {@link RecipeMap} + *

*

* Recipes are immutable. */ @@ -102,7 +113,8 @@ public Recipe(@Nonnull List inputs, boolean isCTRecipe, IRecipePropertyStorage recipePropertyStorage, @Nonnull GTRecipeCategory recipeCategory) { - this.recipePropertyStorage = recipePropertyStorage == null ? EmptyRecipePropertyStorage.INSTANCE : recipePropertyStorage; + this.recipePropertyStorage = recipePropertyStorage == null ? EmptyRecipePropertyStorage.INSTANCE : + recipePropertyStorage; this.inputs = GTRecipeInputCache.deduplicateInputs(inputs); if (outputs.isEmpty()) { this.outputs = EMPTY; @@ -139,7 +151,8 @@ public Recipe copy() { * @param fluidTrimLimit The Limit to which fluid outputs should be trimmed to, -1 for no trimming * @return A new Recipe whose outputs have been trimmed. */ - public static Recipe trimRecipeOutputs(Recipe currentRecipe, RecipeMap recipeMap, int itemTrimLimit, int fluidTrimLimit) { + public static Recipe trimRecipeOutputs(Recipe currentRecipe, RecipeMap recipeMap, int itemTrimLimit, + int fluidTrimLimit) { // Fast return early if no trimming desired if (itemTrimLimit == -1 && fluidTrimLimit == -1) { return currentRecipe; @@ -154,24 +167,27 @@ public static Recipe trimRecipeOutputs(Recipe currentRecipe, RecipeMap recipe builder.clearChancedFluidOutputs(); // Chanced outputs are removed in this if they cannot fit the limit - Pair, List> recipeOutputs = currentRecipe.getItemAndChanceOutputs(itemTrimLimit); + Pair, List> recipeOutputs = currentRecipe + .getItemAndChanceOutputs(itemTrimLimit); // Add the trimmed chanced outputs and outputs builder.chancedOutputs(recipeOutputs.getRight()); builder.outputs(recipeOutputs.getLeft()); - Pair, List> recipeFluidOutputs = currentRecipe.getFluidAndChanceOutputs(fluidTrimLimit); + Pair, List> recipeFluidOutputs = currentRecipe + .getFluidAndChanceOutputs(fluidTrimLimit); // Add the trimmed fluid outputs builder.chancedFluidOutputs(recipeFluidOutputs.getRight()); builder.fluidOutputs(recipeFluidOutputs.getLeft()); - return builder.build().getResult(); } - public final boolean matches(boolean consumeIfSuccessful, IItemHandlerModifiable inputs, IMultipleTankHandler fluidInputs) { - return matches(consumeIfSuccessful, GTUtility.itemHandlerToList(inputs), GTUtility.fluidHandlerToList(fluidInputs)); + public final boolean matches(boolean consumeIfSuccessful, IItemHandlerModifiable inputs, + IMultipleTankHandler fluidInputs) { + return matches(consumeIfSuccessful, GTUtility.itemHandlerToList(inputs), + GTUtility.fluidHandlerToList(fluidInputs)); } /** @@ -383,7 +399,7 @@ public String toString() { } /////////////////// - // Getters // + // Getters // /////////////////// public List getInputs() { @@ -451,18 +467,17 @@ public List getResultItemOutputs(int recipeTier, int machineTier, Rec public Pair, List> getItemAndChanceOutputs(int outputLimit) { List outputs = new ArrayList<>(); - // Create an entry for the chanced outputs, and initially populate it List chancedOutputs = new ArrayList<>(getChancedOutputs().getChancedEntries()); - // No limiting if (outputLimit == -1) { outputs.addAll(GTUtility.copyStackList(getOutputs())); } // If just the regular outputs would satisfy the outputLimit else if (getOutputs().size() >= outputLimit) { - outputs.addAll(GTUtility.copyStackList(getOutputs()).subList(0, Math.min(outputLimit, getOutputs().size()))); + outputs.addAll( + GTUtility.copyStackList(getOutputs()).subList(0, Math.min(outputLimit, getOutputs().size()))); // clear the chanced outputs, as we are only getting regular outputs chancedOutputs.clear(); } @@ -503,7 +518,6 @@ public List getAllItemOutputs() { return recipeOutputs; } - public ChancedOutputList getChancedOutputs() { return chancedOutputs; } @@ -541,18 +555,17 @@ public List getFluidOutputs() { public Pair, List> getFluidAndChanceOutputs(int outputLimit) { List outputs = new ArrayList<>(); - // Create an entry for the chanced outputs, and initially populate it List chancedOutputs = new ArrayList<>(getChancedFluidOutputs().getChancedEntries()); - // No limiting if (outputLimit == -1) { outputs.addAll(GTUtility.copyFluidList(getFluidOutputs())); } // If just the regular outputs would satisfy the outputLimit else if (getOutputs().size() >= outputLimit) { - outputs.addAll(GTUtility.copyFluidList(getFluidOutputs()).subList(0, Math.min(outputLimit, getOutputs().size()))); + outputs.addAll( + GTUtility.copyFluidList(getFluidOutputs()).subList(0, Math.min(outputLimit, getOutputs().size()))); // clear the chanced outputs, as we are only getting regular outputs chancedOutputs.clear(); } @@ -678,7 +691,7 @@ public GTRecipeCategory getRecipeCategory() { } /////////////////////////////////////////////////////////// - // Property Helper Methods // + // Property Helper Methods // /////////////////////////////////////////////////////////// public T getProperty(RecipeProperty property, T defaultValue) { return recipePropertyStorage.getRecipePropertyValue(property, defaultValue); @@ -709,11 +722,11 @@ public int getPropertyCount() { } public int getUnhiddenPropertyCount() { - return (int) recipePropertyStorage.getRecipeProperties().stream().filter((property) -> !property.getKey().isHidden()).count(); + return (int) recipePropertyStorage.getRecipeProperties().stream() + .filter((property) -> !property.getKey().isHidden()).count(); } public IRecipePropertyStorage getRecipePropertyStorage() { return recipePropertyStorage; } - } diff --git a/src/main/java/gregtech/api/recipes/RecipeBuilder.java b/src/main/java/gregtech/api/recipes/RecipeBuilder.java index 9de376bd7ca..703bb1a2f13 100644 --- a/src/main/java/gregtech/api/recipes/RecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/RecipeBuilder.java @@ -1,9 +1,5 @@ package gregtech.api.recipes; -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; -import crafttweaker.CraftTweakerAPI; import gregtech.api.GTValues; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.metatileentity.MetaTileEntity; @@ -29,6 +25,7 @@ import gregtech.api.util.ValidationResult; import gregtech.common.ConfigHolder; import gregtech.integration.groovy.GroovyScriptModule; + import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -36,14 +33,20 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Optional; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; +import crafttweaker.CraftTweakerAPI; import org.apache.commons.lang3.builder.ToStringBuilder; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.function.Consumer; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @see Recipe */ @@ -285,7 +288,8 @@ public R inputNBT(Item item, int count, int meta, NBTMatcher matcher, NBTConditi return inputNBT(new GTRecipeItemInput(new ItemStack(item, count, meta)), matcher, condition); } - public R inputNBT(Item item, int count, @SuppressWarnings("unused") boolean wild, NBTMatcher matcher, NBTCondition condition) { + public R inputNBT(Item item, int count, @SuppressWarnings("unused") boolean wild, NBTMatcher matcher, + NBTCondition condition) { return inputNBT(new GTRecipeItemInput(new ItemStack(item, count, GTValues.W)), matcher, condition); } @@ -297,7 +301,8 @@ public R inputNBT(Block block, int count, NBTMatcher matcher, NBTCondition condi return inputNBT(new GTRecipeItemInput(new ItemStack(block, count)), matcher, condition); } - public R inputNBT(Block block, int count, @SuppressWarnings("unused") boolean wild, NBTMatcher matcher, NBTCondition condition) { + public R inputNBT(Block block, int count, @SuppressWarnings("unused") boolean wild, NBTMatcher matcher, + NBTCondition condition) { return inputNBT(new GTRecipeItemInput(new ItemStack(block, count, GTValues.W)), matcher, condition); } @@ -529,7 +534,8 @@ public R chancedOutput(ItemStack stack, int chance, int tierChanceBoost) { return (R) this; } if (0 >= chance || chance > ChancedOutputLogic.getMaxChancedValue()) { - GTLog.logger.error("Chance cannot be less or equal to 0 or more than {}. Actual: {}.", ChancedOutputLogic.getMaxChancedValue(), chance); + GTLog.logger.error("Chance cannot be less or equal to 0 or more than {}. Actual: {}.", + ChancedOutputLogic.getMaxChancedValue(), chance); GTLog.logger.error("Stacktrace:", new IllegalArgumentException()); recipeStatus = EnumValidationResult.INVALID; return (R) this; @@ -576,7 +582,8 @@ public R chancedFluidOutput(FluidStack stack, int chance, int tierChanceBoost) { return (R) this; } if (0 >= chance || chance > ChancedOutputLogic.getMaxChancedValue()) { - GTLog.logger.error("Chance cannot be less or equal to 0 or more than {}. Actual: {}.", ChancedOutputLogic.getMaxChancedValue(), chance); + GTLog.logger.error("Chance cannot be less or equal to 0 or more than {}. Actual: {}.", + ChancedOutputLogic.getMaxChancedValue(), chance); GTLog.logger.error("Stacktrace:", new IllegalArgumentException()); recipeStatus = EnumValidationResult.INVALID; return (R) this; @@ -657,7 +664,8 @@ public void chancedOutputsMultiply(Recipe chancedOutputsFrom, int numberOfOperat int boost = entry.getChanceBoost(); // Add individual chanced outputs per number of parallel operations performed, to mimic regular recipes. - // This is done instead of simply batching the chanced outputs by the number of parallel operations performed + // This is done instead of simply batching the chanced outputs by the number of parallel operations + // performed for (int i = 0; i < numberOfOperations; i++) { this.chancedOutput(entry.getIngredient().copy(), chance, boost); } @@ -667,7 +675,8 @@ public void chancedOutputsMultiply(Recipe chancedOutputsFrom, int numberOfOperat int boost = entry.getChanceBoost(); // Add individual chanced outputs per number of parallel operations performed, to mimic regular recipes. - // This is done instead of simply batching the chanced outputs by the number of parallel operations performed + // This is done instead of simply batching the chanced outputs by the number of parallel operations + // performed for (int i = 0; i < numberOfOperations; i++) { this.chancedFluidOutput(entry.getIngredient().copy(), chance, boost); } @@ -736,13 +745,11 @@ protected static void multiplyInputsAndOutputs(List newRecipeInpu } }); - recipe.getOutputs().forEach(itemStack -> - outputItems.add(copyItemStackWithCount(itemStack, - itemStack.getCount() * numberOfOperations))); + recipe.getOutputs().forEach(itemStack -> outputItems.add(copyItemStackWithCount(itemStack, + itemStack.getCount() * numberOfOperations))); - recipe.getFluidOutputs().forEach(fluidStack -> - outputFluids.add(copyFluidStackWithAmount(fluidStack, - fluidStack.amount * numberOfOperations))); + recipe.getFluidOutputs().forEach(fluidStack -> outputFluids.add(copyFluidStackWithAmount(fluidStack, + fluidStack.amount * numberOfOperations))); } public int getParallel() { @@ -837,7 +844,8 @@ protected EnumValidationResult validate() { } else if (category.getRecipeMap() != this.recipeMap) { GTLog.logger.error("Cannot apply Category with incompatible RecipeMap", new IllegalArgumentException()); if (isCTRecipe) { - CraftTweakerAPI.logError("Cannot apply Category with incompatible RecipeMap", new IllegalArgumentException()); + CraftTweakerAPI.logError("Cannot apply Category with incompatible RecipeMap", + new IllegalArgumentException()); } recipeStatus = EnumValidationResult.INVALID; } @@ -861,8 +869,10 @@ protected void validateGroovy(GroovyLog.Msg errorMsg) { int maxFluidOutput = recipeMap.getMaxFluidOutputs(); errorMsg.add(inputs.size() > maxInput, () -> getRequiredString(maxInput, inputs.size(), "item input")); errorMsg.add(outputs.size() > maxOutput, () -> getRequiredString(maxOutput, outputs.size(), "item output")); - errorMsg.add(fluidInputs.size() > maxFluidInput, () -> getRequiredString(maxFluidInput, fluidInputs.size(), "fluid input")); - errorMsg.add(fluidOutputs.size() > maxFluidOutput, () -> getRequiredString(maxFluidOutput, fluidOutputs.size(), "fluid output")); + errorMsg.add(fluidInputs.size() > maxFluidInput, + () -> getRequiredString(maxFluidInput, fluidInputs.size(), "fluid input")); + errorMsg.add(fluidOutputs.size() > maxFluidOutput, + () -> getRequiredString(maxFluidOutput, fluidOutputs.size(), "fluid output")); } @Nonnull @@ -897,7 +907,7 @@ public void buildAndRegister() { } /////////////////// - // Getters // + // Getters // /////////////////// public List getInputs() { diff --git a/src/main/java/gregtech/api/recipes/RecipeMap.java b/src/main/java/gregtech/api/recipes/RecipeMap.java index ec553bb0bb7..eb45f147c3b 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMap.java +++ b/src/main/java/gregtech/api/recipes/RecipeMap.java @@ -1,12 +1,5 @@ package gregtech.api.recipes; -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.google.common.collect.ImmutableList; -import crafttweaker.CraftTweakerAPI; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.item.IItemStack; -import crafttweaker.api.liquid.ILiquidStack; -import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.capability.IMultipleTankHandler; @@ -33,12 +26,7 @@ import gregtech.integration.groovy.GroovyScriptModule; import gregtech.integration.groovy.VirtualizedRecipeMap; import gregtech.modules.GregTechModules; -import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap; -import it.unimi.dsi.fastutil.bytes.Byte2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.SoundEvent; @@ -46,13 +34,24 @@ import net.minecraftforge.fml.common.Optional.Method; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.oredict.OreDictionary; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.google.common.collect.ImmutableList; +import crafttweaker.CraftTweakerAPI; +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.item.IItemStack; +import crafttweaker.api.liquid.ILiquidStack; +import crafttweaker.api.minecraft.CraftTweakerMC; +import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap; +import it.unimi.dsi.fastutil.bytes.Byte2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.ApiStatus; -import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.*; +import stanhebben.zenscript.annotations.Optional; -import javax.annotation.Nonnegative; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.lang.ref.WeakReference; import java.util.*; import java.util.function.Consumer; @@ -60,6 +59,10 @@ import java.util.function.Predicate; import java.util.stream.Collectors; +import javax.annotation.Nonnegative; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @ZenClass("mods.gregtech.recipe.RecipeMap") @ZenRegister public class RecipeMap> { @@ -173,15 +176,15 @@ public RecipeMap(@Nonnull String unlocalizedName, this.isHidden = isHidden; defaultRecipeBuilder.setRecipeMap(this); - defaultRecipeBuilder.category(GTRecipeCategory.create(GTValues.MODID, unlocalizedName, getTranslationKey(), this)); + defaultRecipeBuilder + .category(GTRecipeCategory.create(GTValues.MODID, unlocalizedName, getTranslationKey(), this)); this.recipeBuilderSample = defaultRecipeBuilder; RECIPE_MAP_REGISTRY.put(unlocalizedName, this); - this.grsVirtualizedRecipeMap = GregTechAPI.moduleManager.isModuleEnabled(GregTechModules.MODULE_GRS) - ? new VirtualizedRecipeMap(this) : null; + this.grsVirtualizedRecipeMap = GregTechAPI.moduleManager.isModuleEnabled(GregTechModules.MODULE_GRS) ? + new VirtualizedRecipeMap(this) : null; } - @ZenMethod public static List> getRecipeMaps() { return ImmutableList.copyOf(RECIPE_MAP_REGISTRY.values()); @@ -206,7 +209,10 @@ public static void setFoundInvalidRecipe(boolean foundInvalidRecipe) { OrePrefix currentOrePrefix = OrePrefix.getCurrentProcessingPrefix(); if (currentOrePrefix != null) { Material currentMaterial = OrePrefix.getCurrentMaterial(); - GTLog.logger.error("Error happened during processing ore registration of prefix {} and material {}. " + "Seems like cross-mod compatibility issue. Report to GTCEu github.", currentOrePrefix, currentMaterial); + GTLog.logger.error( + "Error happened during processing ore registration of prefix {} and material {}. " + + "Seems like cross-mod compatibility issue. Report to GTCEu github.", + currentOrePrefix, currentMaterial); } } @@ -217,7 +223,8 @@ public RecipeMap setProgressBar(TextureArea progressBar, MoveType moveType) { } public RecipeMap setSlotOverlay(boolean isOutput, boolean isFluid, TextureArea slotOverlay) { - return this.setSlotOverlay(isOutput, isFluid, false, slotOverlay).setSlotOverlay(isOutput, isFluid, true, slotOverlay); + return this.setSlotOverlay(isOutput, isFluid, false, slotOverlay).setSlotOverlay(isOutput, isFluid, true, + slotOverlay); } public RecipeMap setSlotOverlay(boolean isOutput, boolean isFluid, boolean isLast, TextureArea slotOverlay) { @@ -374,10 +381,12 @@ protected ValidationResult postValidateRecipe(@Nonnull ValidationResult< int amount = recipe.getInputs().size(); if (amount > getMaxInputs()) { - GTLog.logger.error("Invalid amount of recipe inputs. Actual: {}. Should be at most {}.", amount, getMaxInputs()); + GTLog.logger.error("Invalid amount of recipe inputs. Actual: {}. Should be at most {}.", amount, + getMaxInputs()); GTLog.logger.error("Stacktrace:", new IllegalArgumentException("Invalid number of Inputs")); if (recipe.getIsCTRecipe()) { - CraftTweakerAPI.logError(String.format("Invalid amount of recipe inputs. Actual: %s. Should be at most %s.", amount, getMaxInputs())); + CraftTweakerAPI.logError(String.format( + "Invalid amount of recipe inputs. Actual: %s. Should be at most %s.", amount, getMaxInputs())); CraftTweakerAPI.logError("Stacktrace:", new IllegalArgumentException("Invalid number of Inputs")); } recipeStatus = EnumValidationResult.INVALID; @@ -385,10 +394,13 @@ protected ValidationResult postValidateRecipe(@Nonnull ValidationResult< amount = recipe.getOutputs().size() + recipe.getChancedOutputs().getChancedEntries().size(); if (amount > getMaxOutputs()) { - GTLog.logger.error("Invalid amount of recipe outputs. Actual: {}. Should be at most {}.", amount, getMaxOutputs()); + GTLog.logger.error("Invalid amount of recipe outputs. Actual: {}. Should be at most {}.", amount, + getMaxOutputs()); GTLog.logger.error("Stacktrace:", new IllegalArgumentException("Invalid number of Outputs")); if (recipe.getIsCTRecipe()) { - CraftTweakerAPI.logError(String.format("Invalid amount of recipe outputs. Actual: %s. Should be at most %s.", amount, getMaxOutputs())); + CraftTweakerAPI + .logError(String.format("Invalid amount of recipe outputs. Actual: %s. Should be at most %s.", + amount, getMaxOutputs())); CraftTweakerAPI.logError("Stacktrace:", new IllegalArgumentException("Invalid number of Outputs")); } recipeStatus = EnumValidationResult.INVALID; @@ -396,10 +408,13 @@ protected ValidationResult postValidateRecipe(@Nonnull ValidationResult< amount = recipe.getFluidInputs().size(); if (amount > getMaxFluidInputs()) { - GTLog.logger.error("Invalid amount of recipe fluid inputs. Actual: {}. Should be at most {}.", amount, getMaxFluidInputs()); + GTLog.logger.error("Invalid amount of recipe fluid inputs. Actual: {}. Should be at most {}.", amount, + getMaxFluidInputs()); GTLog.logger.error("Stacktrace:", new IllegalArgumentException("Invalid number of Fluid Inputs")); if (recipe.getIsCTRecipe()) { - CraftTweakerAPI.logError(String.format("Invalid amount of recipe fluid inputs. Actual: %s. Should be at most %s.", amount, getMaxFluidInputs())); + CraftTweakerAPI.logError( + String.format("Invalid amount of recipe fluid inputs. Actual: %s. Should be at most %s.", + amount, getMaxFluidInputs())); CraftTweakerAPI.logError("Stacktrace:", new IllegalArgumentException("Invalid number of Fluid Inputs")); } recipeStatus = EnumValidationResult.INVALID; @@ -407,11 +422,15 @@ protected ValidationResult postValidateRecipe(@Nonnull ValidationResult< amount = recipe.getFluidOutputs().size() + recipe.getChancedFluidOutputs().getChancedEntries().size(); if (amount > getMaxFluidOutputs()) { - GTLog.logger.error("Invalid amount of recipe fluid outputs. Actual: {}. Should be at most {}.", amount, getMaxFluidOutputs()); + GTLog.logger.error("Invalid amount of recipe fluid outputs. Actual: {}. Should be at most {}.", amount, + getMaxFluidOutputs()); GTLog.logger.error("Stacktrace:", new IllegalArgumentException("Invalid number of Fluid Outputs")); if (recipe.getIsCTRecipe()) { - CraftTweakerAPI.logError(String.format("Invalid amount of recipe fluid outputs. Actual: %s. Should be at most %s.", amount, getMaxFluidOutputs())); - CraftTweakerAPI.logError("Stacktrace:", new IllegalArgumentException("Invalid number of Fluid Outputs")); + CraftTweakerAPI.logError( + String.format("Invalid amount of recipe fluid outputs. Actual: %s. Should be at most %s.", + amount, getMaxFluidOutputs())); + CraftTweakerAPI.logError("Stacktrace:", + new IllegalArgumentException("Invalid number of Fluid Outputs")); } recipeStatus = EnumValidationResult.INVALID; } @@ -446,9 +465,11 @@ public Recipe findRecipe(long voltage, List inputs, List * @return the Recipe it has found or null for no matching Recipe */ @Nullable - public Recipe findRecipe(long voltage, final List inputs, final List fluidInputs, boolean exactVoltage) { + public Recipe findRecipe(long voltage, final List inputs, final List fluidInputs, + boolean exactVoltage) { final List items = inputs.stream().filter(s -> !s.isEmpty()).collect(Collectors.toList()); - final List fluids = fluidInputs.stream().filter(f -> f != null && f.amount != 0).collect(Collectors.toList()); + final List fluids = fluidInputs.stream().filter(f -> f != null && f.amount != 0) + .collect(Collectors.toList()); return find(items, fluids, recipe -> { if (exactVoltage && recipe.getEUt() != voltage) { @@ -471,7 +492,8 @@ public Recipe findRecipe(long voltage, final List inputs, final List< * @return a List of Lists of AbstractMapIngredients used for finding recipes */ @Nullable - protected List> prepareRecipeFind(@Nonnull Collection items, @Nonnull Collection fluids) { + protected List> prepareRecipeFind(@Nonnull Collection items, + @Nonnull Collection fluids) { // First, check if items and fluids are valid. if (items.size() == Integer.MAX_VALUE || fluids.size() == Integer.MAX_VALUE) { return null; @@ -499,7 +521,8 @@ protected List> prepareRecipeFind(@Nonnull Collectio * @return the recipe found */ @Nullable - public Recipe find(@Nonnull Collection items, @Nonnull Collection fluids, @Nonnull Predicate canHandle) { + public Recipe find(@Nonnull Collection items, @Nonnull Collection fluids, + @Nonnull Predicate canHandle) { List> list = prepareRecipeFind(items, fluids); // couldn't build any inputs to use for search, so no recipe could be found if (list == null) return null; @@ -621,7 +644,8 @@ private Recipe recurseIngredientTreeFindRecipe(@Nonnull List canHandle.test(potentialRecipe) ? potentialRecipe : null, - potentialBranch -> diveIngredientTreeFindRecipe(ingredients, potentialBranch, canHandle, index, count, skip)); + potentialBranch -> diveIngredientTreeFindRecipe(ingredients, potentialBranch, canHandle, index, + count, skip)); if (r != null) { return r; } @@ -642,8 +666,10 @@ private Recipe recurseIngredientTreeFindRecipe(@Nonnull List> ingredients, @Nonnull Branch map, - @Nonnull Predicate canHandle, int currentIndex, int count, long skip) { + private Recipe diveIngredientTreeFindRecipe(@Nonnull List> ingredients, + @Nonnull Branch map, + @Nonnull Predicate canHandle, int currentIndex, int count, + long skip) { // We loop around ingredients.size() if we reach the end. // only end when all ingredients are exhausted, or a recipe is found int i = (currentIndex + 1) % ingredients.size(); @@ -653,7 +679,8 @@ private Recipe diveIngredientTreeFindRecipe(@Nonnull List findRecipeCollisions(Collection items, Collection< * @param collidingRecipes the list to store recipe collisions */ private void recurseIngredientTreeFindRecipeCollisions(@Nonnull List> ingredients, - @Nonnull Branch branchRoot, @Nonnull Set collidingRecipes) { + @Nonnull Branch branchRoot, + @Nonnull Set collidingRecipes) { // Try each ingredient as a starting point, adding it to the skip-list. // The skip-list is a packed long, where each 1 bit represents an index to skip for (int i = 0; i < ingredients.size(); i++) { @@ -722,7 +750,8 @@ private Recipe recurseIngredientTreeFindRecipeCollisions(@Nonnull List recipe, - right -> diveIngredientTreeFindRecipeCollisions(ingredients, right, index, count, skip, collidingRecipes)); + right -> diveIngredientTreeFindRecipeCollisions(ingredients, right, index, count, skip, + collidingRecipes)); if (r != null) { collidingRecipes.add(r); } @@ -744,7 +773,8 @@ private Recipe recurseIngredientTreeFindRecipeCollisions(@Nonnull List> ingredients, - @Nonnull Branch map, int currentIndex, int count, long skip, @Nonnull Set collidingRecipes) { + @Nonnull Branch map, int currentIndex, int count, long skip, + @Nonnull Set collidingRecipes) { // We loop around ingredients.size() if we reach the end. // only end when all ingredients are exhausted, or a recipe is found int i = (currentIndex + 1) % ingredients.size(); @@ -754,7 +784,8 @@ private Recipe diveIngredientTreeFindRecipeCollisions(@Nonnull List itemSlotsToLeft * itemSlotsToDown) { itemSlotsToDown = itemSlotsToLeft; } } - return new int[]{itemSlotsToLeft, itemSlotsToDown}; + return new int[] { itemSlotsToLeft, itemSlotsToDown }; } /** @@ -907,6 +952,7 @@ private VirtualizedRecipeMap getGroovyScriptRecipeMap() { /** * This height is used to determine Y position to start drawing info on JEI. + * * @deprecated remove overrides, this method is no longer used in any way. */ @Deprecated @@ -924,7 +970,8 @@ public int getPropertyListHeight(Recipe recipe) { * @param index where in the ingredients list we are. * @param count how many branches were added already. */ - private boolean recurseIngredientTreeAdd(@Nonnull Recipe recipe, @Nonnull List> ingredients, + private boolean recurseIngredientTreeAdd(@Nonnull Recipe recipe, + @Nonnull List> ingredients, @Nonnull Branch branchMap, int index, int count) { if (count >= ingredients.size()) return true; if (index >= ingredients.size()) { @@ -951,19 +998,25 @@ private boolean recurseIngredientTreeAdd(@Nonnull Recipe recipe, @Nonnull List recurseIngredientTreeAdd(recipe, ingredients, m, (index + 1) % ingredients.size(), count + 1)) + .filter(m -> recurseIngredientTreeAdd(recipe, ingredients, m, (index + 1) % ingredients.size(), + count + 1)) .isPresent(); if (!addedNextBranch) { @@ -1062,7 +1118,8 @@ protected static Map> determineRoo * @param list the list of MapIngredients to add to * @param fluidInputs the GTRecipeInputs to convert */ - protected void buildFromRecipeFluids(@Nonnull List> list, @Nonnull List fluidInputs) { + protected void buildFromRecipeFluids(@Nonnull List> list, + @Nonnull List fluidInputs) { for (GTRecipeInput fluidInput : fluidInputs) { AbstractMapIngredient ingredient = new MapFluidIngredient(fluidInput); retrieveCachedIngredient(list, ingredient, fluidIngredientRoot); @@ -1076,7 +1133,8 @@ protected void buildFromRecipeFluids(@Nonnull List> * @param defaultIngredient the ingredient to use as a default value, if not cached * @param cache the ingredient root to retrieve from */ - protected static void retrieveCachedIngredient(@Nonnull List> list, @Nonnull AbstractMapIngredient defaultIngredient, + protected static void retrieveCachedIngredient(@Nonnull List> list, + @Nonnull AbstractMapIngredient defaultIngredient, @Nonnull WeakHashMap> cache) { WeakReference cached = cache.get(defaultIngredient); if (cached != null && cached.get() != null) { @@ -1093,7 +1151,8 @@ protected static void retrieveCachedIngredient(@Nonnull List> list, @Nonnull Iterable ingredients) { + protected void buildFromFluidStacks(@Nonnull List> list, + @Nonnull Iterable ingredients) { for (FluidStack t : ingredients) { list.add(Collections.singletonList(new MapFluidIngredient(t))); } @@ -1107,7 +1166,8 @@ protected void buildFromFluidStacks(@Nonnull List> l */ @Nonnull protected List> fromRecipe(@Nonnull Recipe r) { - List> list = new ObjectArrayList<>((r.getInputs().size()) + r.getFluidInputs().size()); + List> list = new ObjectArrayList<>( + (r.getInputs().size()) + r.getFluidInputs().size()); if (r.getInputs().size() > 0) { buildFromRecipeItems(list, uniqueIngredientsList(r.getInputs())); } @@ -1131,7 +1191,8 @@ protected void buildFromRecipeItems(List> list, @Non this.hasOreDictedInputs = true; if (r.hasNBTMatchingCondition()) { hasNBTMatcherInputs = true; - ingredient = new MapOreDictNBTIngredient(r.getOreDict(), r.getNBTMatcher(), r.getNBTMatchingCondition()); + ingredient = new MapOreDictNBTIngredient(r.getOreDict(), r.getNBTMatcher(), + r.getNBTMatchingCondition()); } else { ingredient = new MapOreDictIngredient(r.getOreDict()); } @@ -1169,7 +1230,8 @@ protected void buildFromRecipeItems(List> list, @Non * @param list the list to populate * @param ingredients the ingredients to convert */ - protected void buildFromItemStacks(@Nonnull List> list, @Nonnull ItemStack[] ingredients) { + protected void buildFromItemStacks(@Nonnull List> list, + @Nonnull ItemStack[] ingredients) { AbstractMapIngredient ingredient; for (ItemStack stack : ingredients) { int meta = stack.getMetadata(); @@ -1203,19 +1265,21 @@ protected void buildFromItemStacks(@Nonnull List> li } protected RecipeMap setSpecialTexture(int x, int y, int width, int height, TextureArea area) { - this.specialTexturePosition = new int[]{x, y, width, height}; + this.specialTexturePosition = new int[] { x, y, width, height }; this.specialTexture = area; return this; } protected ModularUI.Builder addSpecialTexture(ModularUI.Builder builder) { - builder.image(specialTexturePosition[0], specialTexturePosition[1], specialTexturePosition[2], specialTexturePosition[3], specialTexture); + builder.image(specialTexturePosition[0], specialTexturePosition[1], specialTexturePosition[2], + specialTexturePosition[3], specialTexture); return builder; } public Collection getRecipeList() { ObjectOpenHashSet recipes = new ObjectOpenHashSet<>(); - return lookup.getRecipes(true).filter(recipes::add).sorted(RECIPE_DURATION_THEN_EU).collect(Collectors.toList()); + return lookup.getRecipes(true).filter(recipes::add).sorted(RECIPE_DURATION_THEN_EU) + .collect(Collectors.toList()); } public SoundEvent getSound() { @@ -1225,9 +1289,12 @@ public SoundEvent getSound() { @ZenMethod("findRecipe") @Method(modid = GTValues.MODID_CT) @Nullable - public CTRecipe ctFindRecipe(long maxVoltage, IItemStack[] itemInputs, ILiquidStack[] fluidInputs, @Optional(valueLong = Integer.MAX_VALUE) int outputFluidTankCapacity) { - List mcItemInputs = itemInputs == null ? Collections.emptyList() : Arrays.stream(itemInputs).map(CraftTweakerMC::getItemStack).collect(Collectors.toList()); - List mcFluidInputs = fluidInputs == null ? Collections.emptyList() : Arrays.stream(fluidInputs).map(CraftTweakerMC::getLiquidStack).collect(Collectors.toList()); + public CTRecipe ctFindRecipe(long maxVoltage, IItemStack[] itemInputs, ILiquidStack[] fluidInputs, + @Optional(valueLong = Integer.MAX_VALUE) int outputFluidTankCapacity) { + List mcItemInputs = itemInputs == null ? Collections.emptyList() : + Arrays.stream(itemInputs).map(CraftTweakerMC::getItemStack).collect(Collectors.toList()); + List mcFluidInputs = fluidInputs == null ? Collections.emptyList() : + Arrays.stream(fluidInputs).map(CraftTweakerMC::getLiquidStack).collect(Collectors.toList()); Recipe backingRecipe = findRecipe(maxVoltage, mcItemInputs, mcFluidInputs, true); return backingRecipe == null ? null : new CTRecipe(this, backingRecipe); } @@ -1265,7 +1332,9 @@ public R recipeBuilder() { * @param branchMap the current branch in the recursion. */ @Nullable - private Recipe recurseIngredientTreeRemove(@Nonnull Recipe recipeToRemove, @Nonnull List> ingredients, @Nonnull Branch branchMap, int depth) { + private Recipe recurseIngredientTreeRemove(@Nonnull Recipe recipeToRemove, + @Nonnull List> ingredients, + @Nonnull Branch branchMap, int depth) { // for every ingredient for (List current : ingredients) { // for all possibilities as keys @@ -1280,7 +1349,8 @@ private Recipe recurseIngredientTreeRemove(@Nonnull Recipe recipeToRemove, @Nonn // if there is a recipe (left mapping), return it immediately as found // otherwise, recurse and go to the next branch. Do so by omitting the current ingredient. Recipe r = result.map(potentialRecipe -> potentialRecipe, - potentialBranch -> recurseIngredientTreeRemove(recipeToRemove, ingredients.subList(1, ingredients.size()), potentialBranch, depth + 1)); + potentialBranch -> recurseIngredientTreeRemove(recipeToRemove, + ingredients.subList(1, ingredients.size()), potentialBranch, depth + 1)); if (r == recipeToRemove) { found = r; } else { @@ -1290,7 +1360,8 @@ private Recipe recurseIngredientTreeRemove(@Nonnull Recipe recipeToRemove, @Nonn this.unlocalizedName, CTRecipeHelper.getRecipeRemoveLine(this, recipeToRemove))); } if (ConfigHolder.misc.debug || GTValues.isDeobfEnvironment()) { - GTLog.logger.warn("Failed to remove recipe from RecipeMap {}. See next lines for details", this.unlocalizedName); + GTLog.logger.warn("Failed to remove recipe from RecipeMap {}. See next lines for details", + this.unlocalizedName); GTLog.logger.warn("Failed to remove Recipe: {}", recipeToRemove.toString()); } } @@ -1376,7 +1447,8 @@ public void setMaxFluidOutputs(@Nonnegative int maxFluidOutputs) { if (modifyFluidOutputs) { this.maxFluidOutputs = Math.max(this.maxFluidOutputs, maxFluidOutputs); } else { - throw new UnsupportedOperationException("Cannot change max fluid output amount for " + getUnlocalizedName()); + throw new UnsupportedOperationException( + "Cannot change max fluid output amount for " + getUnlocalizedName()); } } diff --git a/src/main/java/gregtech/api/recipes/RecipeMaps.java b/src/main/java/gregtech/api/recipes/RecipeMaps.java index 28daab475b7..cd222d4105b 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipes/RecipeMaps.java @@ -1,6 +1,5 @@ package gregtech.api.recipes; -import crafttweaker.annotations.ZenRegister; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.widgets.ProgressWidget; @@ -13,8 +12,11 @@ import gregtech.api.unification.stack.ItemMaterialInfo; import gregtech.api.util.AssemblyLineManager; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; + +import crafttweaker.annotations.ZenRegister; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenProperty; @@ -36,213 +38,239 @@ public class RecipeMaps { /** * Example: + * *

-     * 	 	RecipeMap.ALLOY_SMELTER_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.ingot, Materials.Tin)
-     * 			    .input(OrePrefix.ingot, Materials.Copper, 3)
-     * 			    .output(OrePrefix.ingot, Materials.Bronze, 4)
-     * 				.duration(600)
-     * 				.EUt(5)
-     * 				.buildAndRegister();
+     * RecipeMap.ALLOY_SMELTER_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.ingot, Materials.Tin)
+     *         .input(OrePrefix.ingot, Materials.Copper, 3)
+     *         .output(OrePrefix.ingot, Materials.Bronze, 4)
+     *         .duration(600)
+     *         .EUt(5)
+     *         .buildAndRegister();
      * 
* * This is a relatively simple example for creating Bronze. * Note that the use of OrePrefix ensures that OreDictionary Entries are used for the recipe. */ @ZenProperty - public static final RecipeMap ALLOY_SMELTER_RECIPES = new RecipeMap<>("alloy_smelter", 2, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY_1) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FURNACE); + public static final RecipeMap ALLOY_SMELTER_RECIPES = new RecipeMap<>("alloy_smelter", 2, 1, 0, + 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY_1) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.FURNACE); /** * Example: + * *
-     * 	 	RecipeMap.ARC_FURNACE_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.ingot, Materials.Iron)
-     * 			    .output(OrePrefix.ingot, Materials.WroughtIron)
-     * 				.duration(200)
-     * 				.EUt(GTValues.VA[GTValues.LV])
-     * 				.buildAndRegister();
+     * RecipeMap.ARC_FURNACE_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.ingot, Materials.Iron)
+     *         .output(OrePrefix.ingot, Materials.WroughtIron)
+     *         .duration(200)
+     *         .EUt(GTValues.VA[GTValues.LV])
+     *         .buildAndRegister();
      * 
* - * The Arc Furnace has a special action that is performed when the recipe is built, designated by the onRecipeBuild - * call on the Recipe Map. This action checks that there are no fluid inputs supplied for the recipe, and if true adds - * Oxygen equal to the recipe duration. This behavior can be negated by supplying your own fluid to the recipe, such as + * The Arc Furnace has a special action that is performed when the recipe is built, designated by the + * onRecipeBuild + * call on the Recipe Map. This action checks that there are no fluid inputs supplied for the recipe, and if true + * adds + * Oxygen equal to the recipe duration. This behavior can be negated by supplying your own fluid to the recipe, such + * as * *
-     * 	 	RecipeMap.ARC_FURNACE_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.ingot, Materials.Iron)
-     * 			    .fluidInputs(Materials.Water.getFluid(100))
-     * 			    .output(OrePrefix.ingot, Materials.WroughtIron)
-     * 				.duration(200)
-     * 				.EUt(GTValues.VA[GTValues.LV])
-     * 				.buildAndRegister();
+     * RecipeMap.ARC_FURNACE_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.ingot, Materials.Iron)
+     *         .fluidInputs(Materials.Water.getFluid(100))
+     *         .output(OrePrefix.ingot, Materials.WroughtIron)
+     *         .duration(200)
+     *         .EUt(GTValues.VA[GTValues.LV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap ARC_FURNACE_RECIPES = new RecipeMap<>("arc_furnace", 1, 9, 1, 1, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARC_FURNACE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC) - .onRecipeBuild(recipeBuilder -> { - recipeBuilder.invalidateOnBuildAction(); - if (recipeBuilder.getFluidInputs().isEmpty()) { - recipeBuilder.fluidInputs(Materials.Oxygen.getFluid(recipeBuilder.duration)); - } - }); + public static final RecipeMap ARC_FURNACE_RECIPES = new RecipeMap<>("arc_furnace", 1, 9, 1, 1, + new SimpleRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARC_FURNACE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ARC) + .onRecipeBuild(recipeBuilder -> { + recipeBuilder.invalidateOnBuildAction(); + if (recipeBuilder.getFluidInputs().isEmpty()) { + recipeBuilder.fluidInputs(Materials.Oxygen.getFluid(recipeBuilder.duration)); + } + }); /** * Example: + * *
-     *      RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder()
-     *               .circuitMeta(2)
-     *               .inputs(new ItemStack(Items.COAL, 1, GTValues.W))
-     *               .input(OrePrefix.stick, Materials.Wood, 1)
-     *               .outputs(new ItemStack(Blocks.TORCH, 4))
-     *               .duration(100).EUt(1).buildAndRegister();
+     * RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder()
+     *         .circuitMeta(2)
+     *         .inputs(new ItemStack(Items.COAL, 1, GTValues.W))
+     *         .input(OrePrefix.stick, Materials.Wood, 1)
+     *         .outputs(new ItemStack(Blocks.TORCH, 4))
+     *         .duration(100).EUt(1).buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap ASSEMBLER_RECIPES = new RecipeMap<>("assembler", 9, 1, 1, 0, new AssemblerRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ASSEMBLER) - .onRecipeBuild(recipeBuilder -> { - recipeBuilder.invalidateOnBuildAction(); - if (recipeBuilder.fluidInputs.size() == 1 && recipeBuilder.fluidInputs.get(0).getInputFluidStack().getFluid() == Materials.SolderingAlloy.getFluid()) { - int amount = recipeBuilder.fluidInputs.get(0).getInputFluidStack().amount; - - recipeBuilder.copy().clearFluidInputs().fluidInputs(Materials.Tin.getFluid(amount * 2)).buildAndRegister(); - } - - if (recipeBuilder.isWithRecycling()) { - // ignore input fluids for recycling - ItemStack outputStack = recipeBuilder.getOutputs().get(0); - ItemMaterialInfo info = RecyclingHandler.getRecyclingIngredients(recipeBuilder.getInputs(), outputStack.getCount()); - if (info != null) { - OreDictUnifier.registerOre(outputStack, info); - } - } - }); + public static final RecipeMap ASSEMBLER_RECIPES = new RecipeMap<>("assembler", 9, 1, 1, 0, + new AssemblerRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ASSEMBLER) + .onRecipeBuild(recipeBuilder -> { + recipeBuilder.invalidateOnBuildAction(); + if (recipeBuilder.fluidInputs.size() == 1 && + recipeBuilder.fluidInputs.get(0).getInputFluidStack().getFluid() == + Materials.SolderingAlloy.getFluid()) { + int amount = recipeBuilder.fluidInputs.get(0).getInputFluidStack().amount; + + recipeBuilder.copy().clearFluidInputs().fluidInputs(Materials.Tin.getFluid(amount * 2)) + .buildAndRegister(); + } + + if (recipeBuilder.isWithRecycling()) { + // ignore input fluids for recycling + ItemStack outputStack = recipeBuilder.getOutputs().get(0); + ItemMaterialInfo info = RecyclingHandler.getRecyclingIngredients(recipeBuilder.getInputs(), + outputStack.getCount()); + if (info != null) { + OreDictUnifier.registerOre(outputStack, info); + } + } + }); /** * Example: + * *
-     *      RecipeMaps.ASSEMBLY_LINE_RECIPES.recipeBuilder()
-     *               .input(OrePrefix.stickLong, Materials.SamariumMagnetic)
-     *               .input(OrePrefix.stickLong, Materials.HSSS, 2)
-     *               .input(OrePrefix.ring, Materials.HSSS, 2)
-     *               .input(OrePrefix.round, Materials.HSSS, 4)
-     *               .input(OrePrefix.wireFine, Materials.Ruridit, 64)
-     *               .input(OrePrefix.cableGtSingle, Materials.NiobiumTitanium, 2)
-     *               .fluidInputs(Materials.SolderingAlloy.getFluid(GTValues.L))
-     *               .fluidInputs(Materials.Lubricant.getFluid(250))
-     *               .output(MetaItems.ELECTRIC_MOTOR_LuV)
-     *               .duration(600).EUt(6000).buildAndRegister();
+     * RecipeMaps.ASSEMBLY_LINE_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.stickLong, Materials.SamariumMagnetic)
+     *         .input(OrePrefix.stickLong, Materials.HSSS, 2)
+     *         .input(OrePrefix.ring, Materials.HSSS, 2)
+     *         .input(OrePrefix.round, Materials.HSSS, 4)
+     *         .input(OrePrefix.wireFine, Materials.Ruridit, 64)
+     *         .input(OrePrefix.cableGtSingle, Materials.NiobiumTitanium, 2)
+     *         .fluidInputs(Materials.SolderingAlloy.getFluid(GTValues.L))
+     *         .fluidInputs(Materials.Lubricant.getFluid(250))
+     *         .output(MetaItems.ELECTRIC_MOTOR_LuV)
+     *         .duration(600).EUt(6000).buildAndRegister();
      * 
* * The Assembly Line Recipe Builder has no special properties/build actions yet, but will in the future */ @ZenProperty - public static final RecipeMap ASSEMBLY_LINE_RECIPES = new RecipeMapAssemblyLine<>("assembly_line", 16, false, 1, false, 4, false, 1, false, new AssemblyLineRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ASSEMBLER) - .onRecipeBuild(AssemblyLineManager::createDefaultResearchRecipe); + public static final RecipeMap ASSEMBLY_LINE_RECIPES = new RecipeMapAssemblyLine<>( + "assembly_line", 16, false, 1, false, 4, false, 1, false, new AssemblyLineRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ASSEMBLER) + .onRecipeBuild(AssemblyLineManager::createDefaultResearchRecipe); /** * Example: + * *
-     * 	 	RecipeMap.AUTOCLAVE_RECIPES.recipeBuilder()
-     * 				.inputs(OreDictUnifier.get(OrePrefix.dust, Materials.Carbon, 16))
-     * 				.fluidInputs(Materials.Lutetium.getFluid(4))
-     * 				.chancedOutput(MetaItems.CARBON_FIBERS.getStackForm(2), 3333, 1000)
-     * 				.duration(600)
-     * 				.EUt(5)
-     * 				.buildAndRegister();
+     * RecipeMap.AUTOCLAVE_RECIPES.recipeBuilder()
+     *         .inputs(OreDictUnifier.get(OrePrefix.dust, Materials.Carbon, 16))
+     *         .fluidInputs(Materials.Lutetium.getFluid(4))
+     *         .chancedOutput(MetaItems.CARBON_FIBERS.getStackForm(2), 3333, 1000)
+     *         .duration(600)
+     *         .EUt(5)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap AUTOCLAVE_RECIPES = new RecipeMap<>("autoclave", 2, 2, 1, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.CRYSTAL_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CRYSTALLIZATION, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FURNACE); + public static final RecipeMap AUTOCLAVE_RECIPES = new RecipeMap<>("autoclave", 2, 2, 1, 1, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.CRYSTAL_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_CRYSTALLIZATION, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.FURNACE); /** * Example: + * *
-     * 		RecipeMap.BENDER_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.plate, Materials.Tin, 12)
-     * 			    .circuitMeta(4)
-     * 				.outputs(MetaItems.FLUID_CELL.getStackForm(4))
-     * 				.duration(1200)
-     * 				.EUt(8)
-     * 				.buildAndRegister();
+     * RecipeMap.BENDER_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.plate, Materials.Tin, 12)
+     *         .circuitMeta(4)
+     *         .outputs(MetaItems.FLUID_CELL.getStackForm(4))
+     *         .duration(1200)
+     *         .EUt(8)
+     *         .buildAndRegister();
      * 
* * Just like other SimpleRecipeBuilder RecipeMaps, circuit can be used to easily set a circuit */ @ZenProperty - public static final RecipeMap BENDER_RECIPES = new RecipeMap<>("bender", 2, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, false, GuiTextures.BENDER_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.INT_CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_BENDING, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.MOTOR); + public static final RecipeMap BENDER_RECIPES = new RecipeMap<>("bender", 2, 1, 0, 0, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, false, GuiTextures.BENDER_OVERLAY) + .setSlotOverlay(false, false, true, GuiTextures.INT_CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_BENDING, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.MOTOR); /** * Example: + * *
-     * 	    RecipeMap.BLAST_RECIPES.recipeBuilder()
-     * 				.inputs(OreDictUnifier.get(OrePrefix.dust, Materials.Glass), OreDictUnifier.get(OrePrefix.dust, Materials.Carbon))
-     * 				.fluidInputs(Materials.Electrum.getFluid(16))
-     * 				.outputs(ItemList.Circuit_Board_Fiberglass.get(16))
-     * 				.duration(80)
-     * 				.EUt(480)
-     * 				.blastFurnaceTemp(2600)
-     * 				.buildAndRegister();
+     * RecipeMap.BLAST_RECIPES.recipeBuilder()
+     *         .inputs(OreDictUnifier.get(OrePrefix.dust, Materials.Glass),
+     *                 OreDictUnifier.get(OrePrefix.dust, Materials.Carbon))
+     *         .fluidInputs(Materials.Electrum.getFluid(16))
+     *         .outputs(ItemList.Circuit_Board_Fiberglass.get(16))
+     *         .duration(80)
+     *         .EUt(480)
+     *         .blastFurnaceTemp(2600)
+     *         .buildAndRegister();
      * 
* * The Electric Blast Furnace requires specification of a blast furnace temperature through the builder call of * blastFurnaceTemp. This value will set the temperature required for the recipe to run, restricting recipes * to certain coils. * - * Anything with a Blast Furnace Temperature of greater than 1750K will also autogenerate a hot ingot and a hot ingot + * Anything with a Blast Furnace Temperature of greater than 1750K will also autogenerate a hot ingot and a hot + * ingot * cooling recipe. */ @ZenProperty - public static final RecipeMap BLAST_RECIPES = new RecipeMap<>("electric_blast_furnace", 3, 3, 1, 1, new BlastRecipeBuilder(), false) - .setSound(GTSoundEvents.FURNACE); + public static final RecipeMap BLAST_RECIPES = new RecipeMap<>("electric_blast_furnace", 3, 3, 1, + 1, new BlastRecipeBuilder(), false) + .setSound(GTSoundEvents.FURNACE); /** * Example: + * *
-     *      RecipeMap.BREWING_RECIPES.recipeBuilder()
-     *         		.input(MetaItems.BIO_CHAFF)
-     *         		.fluidInput(Materials.Water.getFluid(750))
-     *         		.fluidOutput(Materials.Biomass.getFluid(750))
-     *         	    .duration(128).EUt(4)
-     *         		.buildAndRegister();
+     * RecipeMap.BREWING_RECIPES.recipeBuilder()
+     *         .input(MetaItems.BIO_CHAFF)
+     *         .fluidInput(Materials.Water.getFluid(750))
+     *         .fluidOutput(Materials.Biomass.getFluid(750))
+     *         .duration(128).EUt(4)
+     *         .buildAndRegister();
      * 
* * Any Recipe added to the Brewery not specifying a duration value will default to 128. * Any Recipe added to the Brewery not specifying an EUt value will default 4. */ @ZenProperty - public static final RecipeMap BREWING_RECIPES = new RecipeMap<>("brewery", 1, 0, 1, 1, new SimpleRecipeBuilder().duration(128).EUt(4), false) - .setSlotOverlay(false, false, GuiTextures.BREWER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CHEMICAL_REACTOR); + public static final RecipeMap BREWING_RECIPES = new RecipeMap<>("brewery", 1, 0, 1, 1, + new SimpleRecipeBuilder().duration(128).EUt(4), false) + .setSlotOverlay(false, false, GuiTextures.BREWER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CHEMICAL_REACTOR); /** * Example: + * *
-     *       RecipeMap.CANNER_RECIPES.recipeBuilder()
-     * 				.input(MetaItems.BATTERY_HULL_LV)
-     * 			    .input(OrePrefix.dust, Materials.Cadmium, 2)
-     * 				.outputs(MetaItems.BATTERY_LV_CADMIUM)
-     * 				.duration(100)
-     * 				.EUt(2)
-     * 				.buildAndRegister();
+     * RecipeMap.CANNER_RECIPES.recipeBuilder()
+     *         .input(MetaItems.BATTERY_HULL_LV)
+     *         .input(OrePrefix.dust, Materials.Cadmium, 2)
+     *         .outputs(MetaItems.BATTERY_LV_CADMIUM)
+     *         .duration(100)
+     *         .EUt(2)
+     *         .buildAndRegister();
      * 
* * The Canner combines the functionality of the item canning machine and the former fluid canning machine. @@ -250,25 +278,27 @@ public class RecipeMaps { * It will empty or fill any fluid handler, so there is no need to add explicit recipes for the fluid handlers. */ @ZenProperty - public static final RecipeMap CANNER_RECIPES = new RecipeMapFluidCanner("canner", 2, 2, 1, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, false, GuiTextures.CANNER_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.CANISTER_OVERLAY) - .setSlotOverlay(false, true, GuiTextures.DARK_CANISTER_OVERLAY) - .setSlotOverlay(true, true, GuiTextures.DARK_CANISTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CANNER, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.BATH); + public static final RecipeMap CANNER_RECIPES = new RecipeMapFluidCanner("canner", 2, 2, 1, 1, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, false, GuiTextures.CANNER_OVERLAY) + .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.CANISTER_OVERLAY) + .setSlotOverlay(false, true, GuiTextures.DARK_CANISTER_OVERLAY) + .setSlotOverlay(true, true, GuiTextures.DARK_CANISTER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_CANNER, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.BATH); /** * Examples: + * *
-     * 		RecipeMap.CENTRIFUGE_RECIPES.recipeBuilder()
-     * 				.fluidInputs(Materials.ImpureNaquadriaSolution.getFluid(2000))
-     * 				.output(OrePrefix.dust, Materials.IndiumPhosphide)
-     * 			    .output(OrePrefix.dust, Materials.AntimonyTrifluoride, 2)
-     * 			    .fluidOutputs(Materials.NaquadriaSolution.getFluid(1000))
-     * 				.duration(400).EUt(GTValues.VA[GTValues.EV])
-     * 				.buildAndRegister();
+     * RecipeMap.CENTRIFUGE_RECIPES.recipeBuilder()
+     *         .fluidInputs(Materials.ImpureNaquadriaSolution.getFluid(2000))
+     *         .output(OrePrefix.dust, Materials.IndiumPhosphide)
+     *         .output(OrePrefix.dust, Materials.AntimonyTrifluoride, 2)
+     *         .fluidOutputs(Materials.NaquadriaSolution.getFluid(1000))
+     *         .duration(400).EUt(GTValues.VA[GTValues.EV])
+     *         .buildAndRegister();
      *
      * 
* @@ -278,34 +308,38 @@ public class RecipeMaps { * Any Centrifuge recipe not specifying an EUt value will have the value default to 5. */ @ZenProperty - public static final RecipeMap CENTRIFUGE_RECIPES = new RecipeMap<>("centrifuge", 2, 6, 1, 6, new SimpleRecipeBuilder().EUt(5), false) - .setSlotOverlay(false, false, false, GuiTextures.EXTRACTOR_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) - .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CENTRIFUGE); + public static final RecipeMap CENTRIFUGE_RECIPES = new RecipeMap<>("centrifuge", 2, 6, 1, 6, + new SimpleRecipeBuilder().EUt(5), false) + .setSlotOverlay(false, false, false, GuiTextures.EXTRACTOR_OVERLAY) + .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) + .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CENTRIFUGE); /** * Example: + * *
-     * 		RecipeMap.CHEMICAL_BATH_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.gem, Materials.EnderEye)
-     * 				.fluidInputs(Materials.Radon.getFluid(250))
-     * 				.output(MetaItems.QUANTUM_EYE)
-     * 				.duration(480).EUt(GTValues.VA[GTValues.HV])
-     * 				.buildAndRegister();
+     * RecipeMap.CHEMICAL_BATH_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.gem, Materials.EnderEye)
+     *         .fluidInputs(Materials.Radon.getFluid(250))
+     *         .output(MetaItems.QUANTUM_EYE)
+     *         .duration(480).EUt(GTValues.VA[GTValues.HV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap CHEMICAL_BATH_RECIPES = new RecipeMap<>("chemical_bath", 1, 6, 1, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, true, GuiTextures.BREWER_OVERLAY) - .setSlotOverlay(true, false, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) - .setSound(GTSoundEvents.BATH); + public static final RecipeMap CHEMICAL_BATH_RECIPES = new RecipeMap<>("chemical_bath", 1, 6, 1, + 1, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, true, GuiTextures.BREWER_OVERLAY) + .setSlotOverlay(true, false, false, GuiTextures.DUST_OVERLAY) + .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) + .setSound(GTSoundEvents.BATH); /** * Example: + * *
      *      RecipeMap.CHEMICAL_RECIPES.recipeBuilder()
      * 				.circuitMeta(1))
@@ -327,43 +361,45 @@ public class RecipeMaps {
      * Any recipe added to the Chemical Reactor not specifying an EUt value will default to 30.
      */
     @ZenProperty
-    public static final RecipeMap CHEMICAL_RECIPES = new RecipeMap<>("chemical_reactor", 2, 2, 3, 2, new SimpleRecipeBuilder().EUt(VA[LV]), false)
-            .setSlotOverlay(false, false, false, GuiTextures.MOLECULAR_OVERLAY_1)
-            .setSlotOverlay(false, false, true, GuiTextures.MOLECULAR_OVERLAY_2)
-            .setSlotOverlay(false, true, false, GuiTextures.MOLECULAR_OVERLAY_3)
-            .setSlotOverlay(false, true, true, GuiTextures.MOLECULAR_OVERLAY_4)
-            .setSlotOverlay(true, false, GuiTextures.VIAL_OVERLAY_1)
-            .setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_2)
-            .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL)
-            .setSound(GTValues.FOOLS.get() ? GTSoundEvents.SCIENCE : GTSoundEvents.CHEMICAL_REACTOR)
-            .onRecipeBuild(recipeBuilder -> {
-                recipeBuilder.invalidateOnBuildAction();
-                RecipeMaps.LARGE_CHEMICAL_RECIPES.recipeBuilder()
-                        .inputs(recipeBuilder.getInputs().toArray(new GTRecipeInput[0]))
-                        .fluidInputs(recipeBuilder.getFluidInputs())
-                        .outputs(recipeBuilder.getOutputs())
-                        .chancedOutputs(recipeBuilder.getChancedOutputs())
-                        .fluidOutputs(recipeBuilder.getFluidOutputs())
-                        .chancedFluidOutputs(recipeBuilder.getChancedFluidOutputs())
-                        .cleanroom(recipeBuilder.getCleanroom())
-                        .duration(recipeBuilder.duration)
-                        .EUt(recipeBuilder.EUt)
-                        .buildAndRegister();
-            });
+    public static final RecipeMap CHEMICAL_RECIPES = new RecipeMap<>("chemical_reactor", 2, 2, 3,
+            2, new SimpleRecipeBuilder().EUt(VA[LV]), false)
+                    .setSlotOverlay(false, false, false, GuiTextures.MOLECULAR_OVERLAY_1)
+                    .setSlotOverlay(false, false, true, GuiTextures.MOLECULAR_OVERLAY_2)
+                    .setSlotOverlay(false, true, false, GuiTextures.MOLECULAR_OVERLAY_3)
+                    .setSlotOverlay(false, true, true, GuiTextures.MOLECULAR_OVERLAY_4)
+                    .setSlotOverlay(true, false, GuiTextures.VIAL_OVERLAY_1)
+                    .setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_2)
+                    .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL)
+                    .setSound(GTValues.FOOLS.get() ? GTSoundEvents.SCIENCE : GTSoundEvents.CHEMICAL_REACTOR)
+                    .onRecipeBuild(recipeBuilder -> {
+                        recipeBuilder.invalidateOnBuildAction();
+                        RecipeMaps.LARGE_CHEMICAL_RECIPES.recipeBuilder()
+                                .inputs(recipeBuilder.getInputs().toArray(new GTRecipeInput[0]))
+                                .fluidInputs(recipeBuilder.getFluidInputs())
+                                .outputs(recipeBuilder.getOutputs())
+                                .chancedOutputs(recipeBuilder.getChancedOutputs())
+                                .fluidOutputs(recipeBuilder.getFluidOutputs())
+                                .chancedFluidOutputs(recipeBuilder.getChancedFluidOutputs())
+                                .cleanroom(recipeBuilder.getCleanroom())
+                                .duration(recipeBuilder.duration)
+                                .EUt(recipeBuilder.EUt)
+                                .buildAndRegister();
+                    });
 
     /**
      * Example:
+     * 
      * 
-     *      RecipeMap.CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder()
-     * 				.input(MetaItems.BASIC_CIRCUIT_BOARD)
-     * 				.input(MetaItems.INTEGRATED_LOGIC_CIRCUIT)
-     * 			    .input(OrePrefix.component, Component.Resistor, 2)
-     * 				.input(OrePrefix.component, Component.Diode, 2)
-     * 				.input(OrePrefix.wireFine, Materials.Copper, 2)
-     * 			    .input(OrePrefix.bolt, Materials.Tin, 2)
-     * 				.duration(200)
-     * 				.EUt(16)
-     * 				.buildAndRegister();
+     * RecipeMap.CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder()
+     *         .input(MetaItems.BASIC_CIRCUIT_BOARD)
+     *         .input(MetaItems.INTEGRATED_LOGIC_CIRCUIT)
+     *         .input(OrePrefix.component, Component.Resistor, 2)
+     *         .input(OrePrefix.component, Component.Diode, 2)
+     *         .input(OrePrefix.wireFine, Materials.Copper, 2)
+     *         .input(OrePrefix.bolt, Materials.Tin, 2)
+     *         .duration(200)
+     *         .EUt(16)
+     *         .buildAndRegister();
      * 
* * The Circuit Assembler has a special action that is performed for any recipe added to its recipe map, seen in its @@ -371,68 +407,79 @@ public class RecipeMaps { * in the recipe will automatically have recipes generated using Soldering Alloy and Tin for the input fluids. * * The amount of these fluids is based on the Soldering Multiplier, which is a special addition to the - * Circuit Assembler Recipe Builder. It is called through .solderMultiplier(int multiplier) on the Recipe Builder. + * Circuit Assembler Recipe Builder. It is called through .solderMultiplier(int multiplier) on the Recipe + * Builder. * The Multiplier itself is limited to numbers between 1 and (64000 / 144) inclusive. * * This action can be negated by simply specifying a fluid input in the recipe. */ @ZenProperty - public static final RecipeMap CIRCUIT_ASSEMBLER_RECIPES = new RecipeMap<>("circuit_assembler", 6, 1, 1, 0, new CircuitAssemblerRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT_ASSEMBLER, ProgressWidget.MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ASSEMBLER) - .onRecipeBuild(recipeBuilder -> { - recipeBuilder.invalidateOnBuildAction(); - if (recipeBuilder.getFluidInputs().isEmpty()) { - recipeBuilder.copy() - .fluidInputs(Materials.SolderingAlloy.getFluid(Math.max(1, (GTValues.L / 2) * ((CircuitAssemblerRecipeBuilder) recipeBuilder).getSolderMultiplier()))) - .buildAndRegister(); - - // Don't call buildAndRegister as we are mutating the original recipe and already in the middle of a buildAndRegister call. - // Adding a second call will result in duplicate recipe generation attempts - recipeBuilder.fluidInputs(Materials.Tin.getFluid(Math.max(1, GTValues.L * ((CircuitAssemblerRecipeBuilder) recipeBuilder).getSolderMultiplier()))); - } - }); + public static final RecipeMap CIRCUIT_ASSEMBLER_RECIPES = new RecipeMap<>( + "circuit_assembler", 6, 1, 1, 0, new CircuitAssemblerRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT_ASSEMBLER, ProgressWidget.MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ASSEMBLER) + .onRecipeBuild(recipeBuilder -> { + recipeBuilder.invalidateOnBuildAction(); + if (recipeBuilder.getFluidInputs().isEmpty()) { + recipeBuilder.copy() + .fluidInputs(Materials.SolderingAlloy.getFluid(Math.max(1, + (GTValues.L / 2) * ((CircuitAssemblerRecipeBuilder) recipeBuilder) + .getSolderMultiplier()))) + .buildAndRegister(); + + // Don't call buildAndRegister as we are mutating the original recipe and already in the + // middle of a buildAndRegister call. + // Adding a second call will result in duplicate recipe generation attempts + recipeBuilder.fluidInputs(Materials.Tin.getFluid(Math.max(1, GTValues.L * + ((CircuitAssemblerRecipeBuilder) recipeBuilder).getSolderMultiplier()))); + } + }); /** * Example: + * *
-     *      RecipeMap.COKE_OVEN_RECIPES.recipeBuilder()
-     *         		.input(OrePrefix.log, Materials.Wood)
-     *         		.output(OrePrefix.gem, Materials.Charcoal)
-     *         	    .fluidOutputs(Materials.Creosote.getFluid(250))
-     *         		.duration(900)
-     *         		.buildAndRegister();
+     * RecipeMap.COKE_OVEN_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.log, Materials.Wood)
+     *         .output(OrePrefix.gem, Materials.Charcoal)
+     *         .fluidOutputs(Materials.Creosote.getFluid(250))
+     *         .duration(900)
+     *         .buildAndRegister();
      * 
* * As a Primitive Machine, the Coke Oven does not need an EUt parameter specified for the Recipe Builder. */ @ZenProperty - public static final RecipeMap COKE_OVEN_RECIPES = new RecipeMapCokeOven<>("coke_oven", 1, false, 1, false, 0, false, 1, false, new PrimitiveRecipeBuilder(), false) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap COKE_OVEN_RECIPES = new RecipeMapCokeOven<>("coke_oven", 1, + false, 1, false, 0, false, 1, false, new PrimitiveRecipeBuilder(), false) + .setSound(GTSoundEvents.FIRE); /** * Example: + * *
-     *      RecipeMap.COMPRESSOR_RECIPES.recipeBuilder()
-     *         		.input(OrePrefix.dust, Materials.Fireclay)
-     *         		.outputs(MetaItems.COMPRESSED_FIRECLAY.getStackForm())
-     *         		.duration(80)
-     *         		.EUt(4)
-     *         		.buildAndRegister();
+     * RecipeMap.COMPRESSOR_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.dust, Materials.Fireclay)
+     *         .outputs(MetaItems.COMPRESSED_FIRECLAY.getStackForm())
+     *         .duration(80)
+     *         .EUt(4)
+     *         .buildAndRegister();
      * 
* * Any Recipe added to the Compressor not specifying an EUt value will default to 2. * Any Recipe added to the Compressor not specifying a duration value will default to 200. */ @ZenProperty - public static final RecipeMap COMPRESSOR_RECIPES = new RecipeMap<>("compressor", 1, 1, 0, 0, new SimpleRecipeBuilder().duration(200).EUt(2), false) - .setSlotOverlay(false, false, GuiTextures.COMPRESSOR_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COMPRESSOR); + public static final RecipeMap COMPRESSOR_RECIPES = new RecipeMap<>("compressor", 1, 1, 0, 0, + new SimpleRecipeBuilder().duration(200).EUt(2), false) + .setSlotOverlay(false, false, GuiTextures.COMPRESSOR_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COMPRESSOR); /** * Example: + * *
      *      RecipeMap.CRACKING_RECIPES.recipeBuilder()
      *              .circuitMeta(1))
@@ -445,22 +492,24 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap CRACKING_RECIPES = new RecipeMapCrackerUnit<>("cracker", 1, true, 0, true, 2, false, 2, true, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, true, GuiTextures.CRACKING_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.CRACKING_OVERLAY_2) - .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CRACKING, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap CRACKING_RECIPES = new RecipeMapCrackerUnit<>("cracker", 1, true, + 0, true, 2, false, 2, true, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, true, GuiTextures.CRACKING_OVERLAY_1) + .setSlotOverlay(true, true, GuiTextures.CRACKING_OVERLAY_2) + .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_CRACKING, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.FIRE); /** * Example: + * *
-     *      RecipeMap.CUTTER_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(Blocks.LOG, 1, GTValues.W))
-     * 				.outputs(new ItemStack(Blocks.PLANKS), OreDictUnifier.get(OrePrefix.dust, Materials.Wood, 1L))
-     * 				.duration(200)
-     * 				.EUt(8)
-     * 				.buildAndRegister();
+     * RecipeMap.CUTTER_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Blocks.LOG, 1, GTValues.W))
+     *         .outputs(new ItemStack(Blocks.PLANKS), OreDictUnifier.get(OrePrefix.dust, Materials.Wood, 1L))
+     *         .duration(200)
+     *         .EUt(8)
+     *         .buildAndRegister();
      * 
* * The Cutting Machine has a special action that will be performed when its recipe is built, signified by the @@ -469,267 +518,299 @@ public class RecipeMaps { * * The amount of these fluids used is some arcane formula, probably copied from GT5 * - * To negate this onRecipeBuild action, simply add a fluid input to the recipe passed to the Cutter Recipe Map. + * To negate this onRecipeBuild action, simply add a fluid input to the recipe passed to the Cutter Recipe + * Map. */ @ZenProperty - public static final RecipeMap CUTTER_RECIPES = new RecipeMap<>("cutter", 1, 2, 1, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.SAWBLADE_OVERLAY) - .setSlotOverlay(true, false, false, GuiTextures.CUTTER_OVERLAY) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_SLICE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CUT) - .onRecipeBuild(recipeBuilder -> { - recipeBuilder.invalidateOnBuildAction(); - if (recipeBuilder.getFluidInputs().isEmpty()) { - - recipeBuilder - .copy() - .fluidInputs(Materials.Water.getFluid(Math.max(4, Math.min(1000, recipeBuilder.duration * recipeBuilder.EUt / 320)))) - .duration(recipeBuilder.duration * 2) - .buildAndRegister(); - - recipeBuilder - .copy() - .fluidInputs(Materials.DistilledWater.getFluid(Math.max(3, Math.min(750, recipeBuilder.duration * recipeBuilder.EUt / 426)))) - .duration((int) (recipeBuilder.duration * 1.5)) - .buildAndRegister(); - - // Don't call buildAndRegister as we are mutating the original recipe and already in the middle of a buildAndRegister call. - // Adding a second call will result in duplicate recipe generation attempts - recipeBuilder - .fluidInputs(Materials.Lubricant.getFluid(Math.max(1, Math.min(250, recipeBuilder.duration * recipeBuilder.EUt / 1280)))) - .duration(Math.max(1, recipeBuilder.duration)); - - } - }); + public static final RecipeMap CUTTER_RECIPES = new RecipeMap<>("cutter", 1, 2, 1, 0, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.SAWBLADE_OVERLAY) + .setSlotOverlay(true, false, false, GuiTextures.CUTTER_OVERLAY) + .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_SLICE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CUT) + .onRecipeBuild(recipeBuilder -> { + recipeBuilder.invalidateOnBuildAction(); + if (recipeBuilder.getFluidInputs().isEmpty()) { + + recipeBuilder + .copy() + .fluidInputs(Materials.Water.getFluid(Math.max(4, + Math.min(1000, recipeBuilder.duration * recipeBuilder.EUt / 320)))) + .duration(recipeBuilder.duration * 2) + .buildAndRegister(); + + recipeBuilder + .copy() + .fluidInputs(Materials.DistilledWater.getFluid(Math.max(3, + Math.min(750, recipeBuilder.duration * recipeBuilder.EUt / 426)))) + .duration((int) (recipeBuilder.duration * 1.5)) + .buildAndRegister(); + + // Don't call buildAndRegister as we are mutating the original recipe and already in the + // middle of a buildAndRegister call. + // Adding a second call will result in duplicate recipe generation attempts + recipeBuilder + .fluidInputs(Materials.Lubricant.getFluid(Math.max(1, + Math.min(250, recipeBuilder.duration * recipeBuilder.EUt / 1280)))) + .duration(Math.max(1, recipeBuilder.duration)); + + } + }); /** * Examples: + * *
-     * 	    RecipeMap.DISTILLATION_RECIPES.recipeBuilder()
-     * 	        	.fluidInputs(Materials.CoalTar.getFluid(1000))
-     * 	        	.output(OrePrefix.dustSmall, Materials.Coke)
-     * 	        	.fluidOutputs(Materials.Naphthalene.getFluid(400))
-     * 	            .fluidOutputs(Materials.HydrogenSulfide.getFluid(300))
-     * 	            .fluidOutputs(Materials.Creosote.getFluid(200))
-     * 	            .fluidOutputs(Materials.Phenol.getFluid(100))
-     * 	        	.duration(80)
-     * 	        	.EUt(GTValues.VA[GTValues.MV])
-     * 	        	.buildAndRegister();
+     * RecipeMap.DISTILLATION_RECIPES.recipeBuilder()
+     *         .fluidInputs(Materials.CoalTar.getFluid(1000))
+     *         .output(OrePrefix.dustSmall, Materials.Coke)
+     *         .fluidOutputs(Materials.Naphthalene.getFluid(400))
+     *         .fluidOutputs(Materials.HydrogenSulfide.getFluid(300))
+     *         .fluidOutputs(Materials.Creosote.getFluid(200))
+     *         .fluidOutputs(Materials.Phenol.getFluid(100))
+     *         .duration(80)
+     *         .EUt(GTValues.VA[GTValues.MV])
+     *         .buildAndRegister();
      * 
* - * The Distillation Tower is a special Multiblock, as it will create recipes in the Distillery breaking down its multi- - * fluid output recipes. EG, a recipe in the Distillation tower outputs two different fluids from input fluid A. When - * this recipe is built, 2 separate recipes will be created in the Distillery. One for fluid A into the first output, - * and the second for fluid A into the second output. + * The Distillation Tower is a special Multiblock, as it will create recipes in the Distillery breaking down its + * multi- + * fluid output recipes. EG, a recipe in the Distillation tower outputs two different fluids from input fluid A. + * When + * this recipe is built, 2 separate recipes will be created in the Distillery. One for fluid A into the first + * output, + * and the second for fluid A into the second output. * - * This behavior can be disabled by adding a .disableDistilleryRecipes() onto the recipe builder. + * This behavior can be disabled by adding a .disableDistilleryRecipes() onto the recipe builder. */ @ZenProperty - public static final RecipeMap DISTILLATION_RECIPES = new RecipeMapDistillationTower("distillation_tower", 0, true, 1, true, 1, true, 12, false, new UniversalDistillationRecipeBuilder(), false) - .setSound(GTSoundEvents.CHEMICAL_REACTOR); + public static final RecipeMap DISTILLATION_RECIPES = new RecipeMapDistillationTower( + "distillation_tower", 0, true, 1, true, 1, true, 12, false, new UniversalDistillationRecipeBuilder(), false) + .setSound(GTSoundEvents.CHEMICAL_REACTOR); /** * Example: + * *
-     * 	 	RecipeMap.DISTILLERY_RECIPES.recipeBuilder()
-     * 	 			.circuitMeta(1)
-     * 	 			.fluidInputs(Materials.Toluene.getFluid(30))
-     * 	 			.fluidOutputs(Materials.LightFuel.getFluid(30))
-     * 	 			.duration(160)
-     * 	 			.EUt(24)
-     * 	 			.buildAndRegister();
+     * RecipeMap.DISTILLERY_RECIPES.recipeBuilder()
+     *         .circuitMeta(1)
+     *         .fluidInputs(Materials.Toluene.getFluid(30))
+     *         .fluidOutputs(Materials.LightFuel.getFluid(30))
+     *         .duration(160)
+     *         .EUt(24)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap DISTILLERY_RECIPES = new RecipeMap<>("distillery", 1, 1, 1, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, true, GuiTextures.BEAKER_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.BEAKER_OVERLAY_4) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.BOILER); + public static final RecipeMap DISTILLERY_RECIPES = new RecipeMap<>("distillery", 1, 1, 1, 1, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, true, GuiTextures.BEAKER_OVERLAY_1) + .setSlotOverlay(true, true, GuiTextures.BEAKER_OVERLAY_4) + .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) + .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.BOILER); /** * Examples: + * *
-     * 		RecipeMap.ELECTROLYZER_RECIPES.recipeBuilder()
-     * 				.fluidInputs(Materials.SaltWater.getFluid(1000))
-     * 				.output(OrePrefix.dust, Materials.SodiumHydroxide, 3)
-     * 				.fluidOutputs(Materials.Chlorine.getFluid(1000))
-     * 				.fluidOutputs(Materials.Hydrogen.getFluid(1000))
-     * 				.duration(720)
-     * 				.EUt(GTValues.VA[GTValues.LV])
-     * 				.buildAndRegister();
+     * RecipeMap.ELECTROLYZER_RECIPES.recipeBuilder()
+     *         .fluidInputs(Materials.SaltWater.getFluid(1000))
+     *         .output(OrePrefix.dust, Materials.SodiumHydroxide, 3)
+     *         .fluidOutputs(Materials.Chlorine.getFluid(1000))
+     *         .fluidOutputs(Materials.Hydrogen.getFluid(1000))
+     *         .duration(720)
+     *         .EUt(GTValues.VA[GTValues.LV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap ELECTROLYZER_RECIPES = new RecipeMap<>("electrolyzer", 2, 6, 1, 6, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, false, GuiTextures.LIGHTNING_OVERLAY_1) - .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) - .setSlotOverlay(false, true, true, GuiTextures.LIGHTNING_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ELECTROLYZER); + public static final RecipeMap ELECTROLYZER_RECIPES = new RecipeMap<>("electrolyzer", 2, 6, 1, + 6, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, false, GuiTextures.LIGHTNING_OVERLAY_1) + .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) + .setSlotOverlay(false, true, true, GuiTextures.LIGHTNING_OVERLAY_2) + .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ELECTROLYZER); /** * Example: + * *
-     * 	    RecipeMap.ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.dustPure, Materials.Aluminium)
-     * 				.outputs(OrePrefix.dust, Materials.Aluminium)
-     * 				.chancedOutput(OreDictUnifier.get(OrePrefix.dustSmall, Materials.Aluminium), 4000, 850)
-     * 				.chancedOutput(OreDictUnifier.get(OrePrefix.dustSmall, Materials.Aluminium), 2000, 600)
-     * 				.duration(200)
-     * 				.EUt(24)
-     * 				.buildAndRegister();
+     * RecipeMap.ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.dustPure, Materials.Aluminium)
+     *         .outputs(OrePrefix.dust, Materials.Aluminium)
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.dustSmall, Materials.Aluminium), 4000, 850)
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.dustSmall, Materials.Aluminium), 2000, 600)
+     *         .duration(200)
+     *         .EUt(24)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap ELECTROMAGNETIC_SEPARATOR_RECIPES = new RecipeMap<>("electromagnetic_separator", 1, 3, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC); + public static final RecipeMap ELECTROMAGNETIC_SEPARATOR_RECIPES = new RecipeMap<>( + "electromagnetic_separator", 1, 3, 0, 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ARC); /** * Example: + * *
-     *      RecipeMap.EXTRACTOR_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(MetaBlocks.RUBBER_LEAVES, 16))
-     * 				.output(OrePrefix.dust, Materials.RawRubber)
-     * 				.duration(300)
-     * 				.buildAndRegister();
+     * RecipeMap.EXTRACTOR_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(MetaBlocks.RUBBER_LEAVES, 16))
+     *         .output(OrePrefix.dust, Materials.RawRubber)
+     *         .duration(300)
+     *         .buildAndRegister();
      * 
* * Any Recipe added to the Extractor not specifying an EUt value will default to 2. * Any Recipe added to the Extractor not specifying an duration value will default to 400. */ @ZenProperty - public static final RecipeMap EXTRACTOR_RECIPES = new RecipeMap<>("extractor", 1, 1, 0, 1, new SimpleRecipeBuilder().duration(400).EUt(2), false) - .setSlotOverlay(false, false, GuiTextures.EXTRACTOR_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COMPRESSOR); + public static final RecipeMap EXTRACTOR_RECIPES = new RecipeMap<>("extractor", 1, 1, 0, 1, + new SimpleRecipeBuilder().duration(400).EUt(2), false) + .setSlotOverlay(false, false, GuiTextures.EXTRACTOR_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COMPRESSOR); /** * Example: + * *
-     *      RecipeMap.EXTRUDER_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.ingot, Materials.BorosilicateGlass)
-     * 				.notConsumable(MetaItems.SHAPE_EXTRUDER_WIRE)
-     * 				.output(OrePrefix.wireFine, Materials.BorosilicateGlass, 8)
-     * 				.duration(160)
-     * 				.EUt(96)
-     * 				.buildAndRegister();
+     * RecipeMap.EXTRUDER_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.ingot, Materials.BorosilicateGlass)
+     *         .notConsumable(MetaItems.SHAPE_EXTRUDER_WIRE)
+     *         .output(OrePrefix.wireFine, Materials.BorosilicateGlass, 8)
+     *         .duration(160)
+     *         .EUt(96)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap EXTRUDER_RECIPES = new RecipeMap<>("extruder", 2, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, true, GuiTextures.MOLD_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRUDER, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC); + public static final RecipeMap EXTRUDER_RECIPES = new RecipeMap<>("extruder", 2, 1, 0, 0, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, true, GuiTextures.MOLD_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRUDER, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ARC); /** * Example: + * *
-     *      RecipeMap.FERMENTING_RECIPES.recipeBuilder()
-     * 				.fluidInputs(Materials.Biomass.getFluid(100))
-     * 				.fluidOutputs(Materials.FermentedBiomass.getFluid(100))
-     * 				.duration(150)
-     * 				.buildAndRegister();
+     * RecipeMap.FERMENTING_RECIPES.recipeBuilder()
+     *         .fluidInputs(Materials.Biomass.getFluid(100))
+     *         .fluidOutputs(Materials.FermentedBiomass.getFluid(100))
+     *         .duration(150)
+     *         .buildAndRegister();
      * 
* * Any Recipe added to the Fermenter not specifying an EUt value will default to 2. */ @ZenProperty - public static final RecipeMap FERMENTING_RECIPES = new RecipeMap<>("fermenter", 1, 1, 1, 1, new SimpleRecipeBuilder().EUt(2), false) - .setSlotOverlay(false, false, true, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CHEMICAL_REACTOR); + public static final RecipeMap FERMENTING_RECIPES = new RecipeMap<>("fermenter", 1, 1, 1, 1, + new SimpleRecipeBuilder().EUt(2), false) + .setSlotOverlay(false, false, true, GuiTextures.DUST_OVERLAY) + .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CHEMICAL_REACTOR); /** * Example: + * *
-     * 		RecipeMap.FLUID_HEATER_RECIPES.recipeBuilder()
-     * 				.circuitMeta(1)
-     * 				.fluidInputs(Materials.Water.getFluid(6))
-     * 				.fluidOutputs(Materials.Steam.getFluid(960))
-     * 				.duration(30)
-     * 				.EUt(GTValues.VA[GTValues.LV])
-     * 				.buildAndRegister();
+     * RecipeMap.FLUID_HEATER_RECIPES.recipeBuilder()
+     *         .circuitMeta(1)
+     *         .fluidInputs(Materials.Water.getFluid(6))
+     *         .fluidOutputs(Materials.Steam.getFluid(960))
+     *         .duration(30)
+     *         .EUt(GTValues.VA[GTValues.LV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap FLUID_HEATER_RECIPES = new RecipeMap<>("fluid_heater", 1, 0, 1, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, true, GuiTextures.HEATING_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.HEATING_OVERLAY_2) - .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.BOILER); + public static final RecipeMap FLUID_HEATER_RECIPES = new RecipeMap<>("fluid_heater", 1, 0, 1, + 1, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, true, GuiTextures.HEATING_OVERLAY_1) + .setSlotOverlay(true, true, GuiTextures.HEATING_OVERLAY_2) + .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.BOILER); /** * Example: + * *
-     *  	RecipeMap.FLUID_SOLIDFICATION_RECIPES.recipeBuilder()
-     * 				.notConsumable(MetaItems.SHAPE_MOLD_CYLINDER)
-     * 				.fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L / 8))
-     * 				.output(MetaItems.PETRI_DISH, 2)
-     * 				.duration(40)
-     * 				.EUt(GTValues.VA[GTValues.HV])
-     * 				.buildAndRegister();
+     * RecipeMap.FLUID_SOLIDFICATION_RECIPES.recipeBuilder()
+     *         .notConsumable(MetaItems.SHAPE_MOLD_CYLINDER)
+     *         .fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L / 8))
+     *         .output(MetaItems.PETRI_DISH, 2)
+     *         .duration(40)
+     *         .EUt(GTValues.VA[GTValues.HV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap FLUID_SOLIDFICATION_RECIPES = new RecipeMap<>("fluid_solidifier", 1, 1, 1, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.SOLIDIFIER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COOLING); + public static final RecipeMap FLUID_SOLIDFICATION_RECIPES = new RecipeMap<>("fluid_solidifier", + 1, 1, 1, 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.SOLIDIFIER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COOLING); /** * Example: + * *
-     *      RecipeMap.FORGE_HAMMER_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(Blocks.STONE))
-     * 				.outputs(new ItemStack(Blocks.COBBLESTONE))
-     * 				.duration(16)
-     * 				.EUt(10)
-     * 				.buildAndRegister();
+     * RecipeMap.FORGE_HAMMER_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Blocks.STONE))
+     *         .outputs(new ItemStack(Blocks.COBBLESTONE))
+     *         .duration(16)
+     *         .EUt(10)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap FORGE_HAMMER_RECIPES = new RecipeMap<>("forge_hammer", 1, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.HAMMER_OVERLAY) - .setSpecialTexture(78, 42, 20, 6, GuiTextures.PROGRESS_BAR_HAMMER_BASE) - .setProgressBar(GuiTextures.PROGRESS_BAR_HAMMER, MoveType.VERTICAL_DOWNWARDS) - .setSound(GTSoundEvents.FORGE_HAMMER); + public static final RecipeMap FORGE_HAMMER_RECIPES = new RecipeMap<>("forge_hammer", 1, 1, 0, + 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.HAMMER_OVERLAY) + .setSpecialTexture(78, 42, 20, 6, GuiTextures.PROGRESS_BAR_HAMMER_BASE) + .setProgressBar(GuiTextures.PROGRESS_BAR_HAMMER, MoveType.VERTICAL_DOWNWARDS) + .setSound(GTSoundEvents.FORGE_HAMMER); /** * Example: + * *
-     *      RecipeMap.FORMING_PRESS_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(Blocks.STONE))
-     * 				.outputs(new ItemStack(Blocks.COBBLESTONE))
-     * 				.duration(16)
-     * 				.EUt(10)
-     * 				.buildAndRegister();
+     * RecipeMap.FORMING_PRESS_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Blocks.STONE))
+     *         .outputs(new ItemStack(Blocks.COBBLESTONE))
+     *         .duration(16)
+     *         .EUt(10)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap FORMING_PRESS_RECIPES = new RecipeMapFormingPress("forming_press", 6, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COMPRESSOR); + public static final RecipeMap FORMING_PRESS_RECIPES = new RecipeMapFormingPress( + "forming_press", 6, 1, 0, 0, new SimpleRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COMPRESSOR); /** * * Example: + * *
-     * 		RecipeMap.FURNACE_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(Blocks.SAND))
-     * 				.outputs(new ItemStack(Blocks.COBBLESTONE))
-     * 				.duration(128)
-     * 				.EUt(4)
-     * 				.buildAndRegister();
+     * RecipeMap.FURNACE_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Blocks.SAND))
+     *         .outputs(new ItemStack(Blocks.COBBLESTONE))
+     *         .duration(128)
+     *         .EUt(4)
+     *         .buildAndRegister();
      * 
* * When looking up recipes from the GTCEu Furnaces, they will first check the Vanilla Furnace Recipe list, therefore @@ -740,24 +821,27 @@ public class RecipeMaps { * Recipe List, so any recipes added will be exclusive to the GTCEu Furnaces. */ @ZenProperty - public static final RecipeMap FURNACE_RECIPES = new RecipeMapFurnace("electric_furnace", 1, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY_1) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FURNACE); + public static final RecipeMap FURNACE_RECIPES = new RecipeMapFurnace("electric_furnace", 1, 1, + 0, 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY_1) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.FURNACE); /** * Example: + * *
-     * 		RecipeMap.FUSION_RECIPES.recipeBuilder()
-     * 				.fluidInputs(Materials.Lithium.getFluid(16), Materials.Tungsten.getFluid(16))
-     * 				.fluidOutputs(Materials.Iridium.getFluid(16))
-     * 				.duration(32)
-     * 				.EUt(GTValues.VA[GTValues.LuV])
-     * 				.EUToStart(300000000)
-     * 				.buildAndRegister();
+     * RecipeMap.FUSION_RECIPES.recipeBuilder()
+     *         .fluidInputs(Materials.Lithium.getFluid(16), Materials.Tungsten.getFluid(16))
+     *         .fluidOutputs(Materials.Iridium.getFluid(16))
+     *         .duration(32)
+     *         .EUt(GTValues.VA[GTValues.LuV])
+     *         .EUToStart(300000000)
+     *         .buildAndRegister();
      * 
* - * The Fusion Reactor requires an EUToStart call, which is used to gate recipes behind requiring different tier + * The Fusion Reactor requires an EUToStart call, which is used to gate recipes behind requiring different + * tier * Fusion Reactors. This value must be greater than 0. * * The Breakpoints for this value currently are: @@ -766,65 +850,74 @@ public class RecipeMaps { * MK3: 320MEU - 640MEU */ @ZenProperty - public static final RecipeMap FUSION_RECIPES = new RecipeMap<>("fusion_reactor", 0, 0, 2, 1, new FusionRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC); + public static final RecipeMap FUSION_RECIPES = new RecipeMap<>("fusion_reactor", 0, 0, 2, 1, + new FusionRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ARC); @ZenProperty - public static final RecipeMap GAS_COLLECTOR_RECIPES = new RecipeMap<>("gas_collector", 1, 0, 0, 1, new GasCollectorRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) - .setSlotOverlay(true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COOLING); + public static final RecipeMap GAS_COLLECTOR_RECIPES = new RecipeMap<>("gas_collector", 1, + 0, 0, 1, new GasCollectorRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) + .setSlotOverlay(true, true, GuiTextures.CENTRIFUGE_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COOLING); /** * Example: + * *
-     *      RecipeMap.IMPLOSION_RECIPES.recipeBuilder()
-     *         		.input(OreDictUnifier.get(OrePrefix.gem, Materials.Coal, 64))
-     *         		.explosivesAmount(8)
-     *         		.outputs(OreDictUnifier.get(OrePrefix.gem, Materials.Diamond, 1), OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh, 4))
-     *         	    .duration(400)
-     *         	    .EUt(GTValues.VA[GTValues.HV])
-     *         		.buildAndRegister();
+     * RecipeMap.IMPLOSION_RECIPES.recipeBuilder()
+     *         .input(OreDictUnifier.get(OrePrefix.gem, Materials.Coal, 64))
+     *         .explosivesAmount(8)
+     *         .outputs(OreDictUnifier.get(OrePrefix.gem, Materials.Diamond, 1),
+     *                 OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh, 4))
+     *         .duration(400)
+     *         .EUt(GTValues.VA[GTValues.HV])
+     *         .buildAndRegister();
      * 
* *
-     *      RecipeMap.IMPLOSION_RECIPES.recipeBuilder()
-     *         		.input(OreDictUnifier.get(OrePrefix.gem, Materials.Coal, 64))
-     *         		.explosivesType(MetaItems.DYNAMITE.getStackForm(4))
-     *         		.outputs(OreDictUnifier.get(OrePrefix.gem, Materials.Diamond, 1), OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh, 4))
-     *         	    .duration(400)
-     *         	    .EUt(GTValues.VA[GTValues.HV])
-     *         		.buildAndRegister();
+     * RecipeMap.IMPLOSION_RECIPES.recipeBuilder()
+     *         .input(OreDictUnifier.get(OrePrefix.gem, Materials.Coal, 64))
+     *         .explosivesType(MetaItems.DYNAMITE.getStackForm(4))
+     *         .outputs(OreDictUnifier.get(OrePrefix.gem, Materials.Diamond, 1),
+     *                 OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh, 4))
+     *         .duration(400)
+     *         .EUt(GTValues.VA[GTValues.HV])
+     *         .buildAndRegister();
      * 
* * The Implosion Compressor can specify explosives used for its recipes in two different ways. The first is using - * explosivesAmount(int amount), which will generate a recipe using TNT as the explosive, with the count of TNT + * explosivesAmount(int amount), which will generate a recipe using TNT as the explosive, with the count of + * TNT * being the passed amount. Note that this must be between 1 and 64 inclusive. * - * The second method is to use explosivesType(ItemStack item). In this case, the passed ItemStack will be used + * The second method is to use explosivesType(ItemStack item). In this case, the passed ItemStack will be + * used * as the explosive, with the number of explosives being the count of the passed ItemStack. * Note that the count must be between 1 and 64 inclusive */ @ZenProperty - public static final RecipeMap IMPLOSION_RECIPES = new RecipeMap<>("implosion_compressor", 3, 2, 0, 0, new ImplosionRecipeBuilder().duration(20).EUt(VA[LV]), false) - .setSlotOverlay(false, false, true, GuiTextures.IMPLOSION_OVERLAY_1) - .setSlotOverlay(false, false, false, GuiTextures.IMPLOSION_OVERLAY_2) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setSound(SoundEvents.ENTITY_GENERIC_EXPLODE); + public static final RecipeMap IMPLOSION_RECIPES = new RecipeMap<>("implosion_compressor", 3, + 2, 0, 0, new ImplosionRecipeBuilder().duration(20).EUt(VA[LV]), false) + .setSlotOverlay(false, false, true, GuiTextures.IMPLOSION_OVERLAY_1) + .setSlotOverlay(false, false, false, GuiTextures.IMPLOSION_OVERLAY_2) + .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) + .setSound(SoundEvents.ENTITY_GENERIC_EXPLODE); /** * Example: + * *
-     *      RecipeMap.LARGE_CHEMICAL_RECIPES.recipeBuilder()
-     * 			    .fluidInputs(Materials.NitrogenDioxide.getFluid(4000))
-     * 			    .fluidInputs(Materials.Oxygen.getFluid(1000))
-     * 				.fluidInputs(Materials.Water.getFluid(2000))
-     * 				.fluidOutputs(Materials.NitricAcid.getFluid(4000))
-     * 				.duration(950)
-     * 				.EUt(GTValues.VA[GTValues.HV])
-     * 				.buildAndRegister();
+     * RecipeMap.LARGE_CHEMICAL_RECIPES.recipeBuilder()
+     *         .fluidInputs(Materials.NitrogenDioxide.getFluid(4000))
+     *         .fluidInputs(Materials.Oxygen.getFluid(1000))
+     *         .fluidInputs(Materials.Water.getFluid(2000))
+     *         .fluidOutputs(Materials.NitricAcid.getFluid(4000))
+     *         .duration(950)
+     *         .EUt(GTValues.VA[GTValues.HV])
+     *         .buildAndRegister();
      * 
* * Note that any recipes added to the Large Chemical Reactor recipe map will be exclusive to the LCR, unlike @@ -833,91 +926,99 @@ public class RecipeMaps { * Any Recipe added to the Large Chemical Reactor not specifying an EUt value will default to 30. */ @ZenProperty - public static final RecipeMap LARGE_CHEMICAL_RECIPES = new RecipeMap<>("large_chemical_reactor", 3, 3, 5, 4, new SimpleRecipeBuilder().EUt(VA[LV]), false) - .setSlotOverlay(false, false, false, GuiTextures.MOLECULAR_OVERLAY_1) - .setSlotOverlay(false, false, true, GuiTextures.MOLECULAR_OVERLAY_2) - .setSlotOverlay(false, true, false, GuiTextures.MOLECULAR_OVERLAY_3) - .setSlotOverlay(false, true, true, GuiTextures.MOLECULAR_OVERLAY_4) - .setSlotOverlay(true, false, GuiTextures.VIAL_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CHEMICAL_REACTOR) - .setSmallRecipeMap(CHEMICAL_RECIPES); + public static final RecipeMap LARGE_CHEMICAL_RECIPES = new RecipeMap<>( + "large_chemical_reactor", 3, 3, 5, 4, new SimpleRecipeBuilder().EUt(VA[LV]), false) + .setSlotOverlay(false, false, false, GuiTextures.MOLECULAR_OVERLAY_1) + .setSlotOverlay(false, false, true, GuiTextures.MOLECULAR_OVERLAY_2) + .setSlotOverlay(false, true, false, GuiTextures.MOLECULAR_OVERLAY_3) + .setSlotOverlay(false, true, true, GuiTextures.MOLECULAR_OVERLAY_4) + .setSlotOverlay(true, false, GuiTextures.VIAL_OVERLAY_1) + .setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_2) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CHEMICAL_REACTOR) + .setSmallRecipeMap(CHEMICAL_RECIPES); /** * Example: + * *
-     * 		RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder()
-     * 				.input(MetaItems.SILICON_WAFER)
-     * 				.notConsumable(OrePrefix.craftingLens, MarkerMaterials.Color.Red)
-     * 				.output(MetaItems.INTEGRATED_LOGIC_CIRCUIT_WAFER)
-     * 				.duration(900)
-     * 				.EUt(GTValues.VA[GTValues.MV])
-     * 				.buildAndRegister();
+     * RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder()
+     *         .input(MetaItems.SILICON_WAFER)
+     *         .notConsumable(OrePrefix.craftingLens, MarkerMaterials.Color.Red)
+     *         .output(MetaItems.INTEGRATED_LOGIC_CIRCUIT_WAFER)
+     *         .duration(900)
+     *         .EUt(GTValues.VA[GTValues.MV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap LASER_ENGRAVER_RECIPES = new RecipeMap<>("laser_engraver", 2, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, true, GuiTextures.LENS_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ELECTROLYZER); + public static final RecipeMap LASER_ENGRAVER_RECIPES = new RecipeMap<>("laser_engraver", 2, 1, + 0, 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, true, GuiTextures.LENS_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ELECTROLYZER); /** * Example: + * *
-     * 	     RecipeMap.LATHE_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(Blocks.WOODEN_SLAB, 1, GTValues.W))
-     * 				.outputs(new ItemStack(Items.BOWL))
-     * 				.output(OrePrefix.dustSmall, Materials.Wood)
-     * 				.duration(50).EUt(GTValues.VA[GTValues.ULV])
-     * 				.buildAndRegister();
+     * RecipeMap.LATHE_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Blocks.WOODEN_SLAB, 1, GTValues.W))
+     *         .outputs(new ItemStack(Items.BOWL))
+     *         .output(OrePrefix.dustSmall, Materials.Wood)
+     *         .duration(50).EUt(GTValues.VA[GTValues.ULV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap LATHE_RECIPES = new RecipeMap<>("lathe", 1, 2, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.PIPE_OVERLAY_1) - .setSlotOverlay(true, false, false, GuiTextures.PIPE_OVERLAY_2) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setSpecialTexture(98, 24, 5, 18, GuiTextures.PROGRESS_BAR_LATHE_BASE) - .setProgressBar(GuiTextures.PROGRESS_BAR_LATHE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CUT); + public static final RecipeMap LATHE_RECIPES = new RecipeMap<>("lathe", 1, 2, 0, 0, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.PIPE_OVERLAY_1) + .setSlotOverlay(true, false, false, GuiTextures.PIPE_OVERLAY_2) + .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) + .setSpecialTexture(98, 24, 5, 18, GuiTextures.PROGRESS_BAR_LATHE_BASE) + .setProgressBar(GuiTextures.PROGRESS_BAR_LATHE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CUT); /** * Example: + * *
-     * 		RecipeMap.MACERATOR_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(Items.CHICKEN))
-     * 				.output(OrePrefix.dust, Materials.Meat)
-     * 				.output(OrePrefix.dustTiny, Materials.Bone)
-     * 				.duration(102).buildAndRegister();
+     * RecipeMap.MACERATOR_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Items.CHICKEN))
+     *         .output(OrePrefix.dust, Materials.Meat)
+     *         .output(OrePrefix.dustTiny, Materials.Bone)
+     *         .duration(102).buildAndRegister();
      * 
* * Any Recipe added to the Macerator not specifying an EUt value will default to 2. * Any Recipe added to the Macerator not specifying a duration value will default to 150. */ @ZenProperty - public static final RecipeMap MACERATOR_RECIPES = new RecipeMap<>("macerator", 1, 4, 0, 0, new SimpleRecipeBuilder().duration(150).EUt(2), false) - .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.MACERATOR); - + public static final RecipeMap MACERATOR_RECIPES = new RecipeMap<>("macerator", 1, 4, 0, 0, + new SimpleRecipeBuilder().duration(150).EUt(2), false) + .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.MACERATOR); /** * Currently unused */ @ZenProperty @SuppressWarnings("unused") - public static final RecipeMap MASS_FABRICATOR_RECIPES = new RecipeMap<>("mass_fabricator", 1, 0, 1, 2, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.ATOMIC_OVERLAY_1) - .setSlotOverlay(false, true, GuiTextures.ATOMIC_OVERLAY_2) - .setSlotOverlay(true, true, GuiTextures.POSITIVE_MATTER_OVERLAY) - .setSlotOverlay(true, true, true, GuiTextures.NEUTRAL_MATTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MASS_FAB, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.REPLICATOR); + public static final RecipeMap MASS_FABRICATOR_RECIPES = new RecipeMap<>("mass_fabricator", 1, + 0, 1, 2, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.ATOMIC_OVERLAY_1) + .setSlotOverlay(false, true, GuiTextures.ATOMIC_OVERLAY_2) + .setSlotOverlay(true, true, GuiTextures.POSITIVE_MATTER_OVERLAY) + .setSlotOverlay(true, true, true, GuiTextures.NEUTRAL_MATTER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_MASS_FAB, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.REPLICATOR); /** * Example: + * *
      * 		RecipeMap.MIXER_RECIPES.recipeBuilder()
      * 				.input(OrePrefix.dust, Materials.Redstone, 5)
@@ -929,14 +1030,16 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap MIXER_RECIPES = new RecipeMap<>("mixer", 6, 1, 2, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) - .setSound(GTSoundEvents.MIXER); + public static final RecipeMap MIXER_RECIPES = new RecipeMap<>("mixer", 6, 1, 2, 1, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) + .setSound(GTSoundEvents.MIXER); /** * Example: + * *
      * 		RecipeMap.ORE_WASHER_RECIPES.recipeBuilder()
      * 				.input(OrePrefix.crushed, Materials.Aluminum)
@@ -950,14 +1053,16 @@ public class RecipeMaps {
      * Any Recipe added to the Ore Washer not specifying a duration value will default to 400.
      */
     @ZenProperty
-    public static final RecipeMap ORE_WASHER_RECIPES = new RecipeMap<>("ore_washer", 2, 3, 1, 0, new SimpleRecipeBuilder().duration(400).EUt(16), false)
-            .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY)
-            .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY)
-            .setProgressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.CIRCULAR)
-            .setSound(GTSoundEvents.BATH);
+    public static final RecipeMap ORE_WASHER_RECIPES = new RecipeMap<>("ore_washer", 2, 3, 1, 0,
+            new SimpleRecipeBuilder().duration(400).EUt(16), false)
+                    .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY)
+                    .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY)
+                    .setProgressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.CIRCULAR)
+                    .setSound(GTSoundEvents.BATH);
 
     /**
      * Example:
+     * 
      * 
      * 		RecipeMap.PACKER_RECIPES.recipeBuilder()
      * 				.inputs(new ItemStack(Items.WHEAT, 9))
@@ -971,30 +1076,34 @@ public class RecipeMaps {
      * Any Recipe added to the Packer not specifying a duration value will default to 10.
      */
     @ZenProperty
-    public static final RecipeMap PACKER_RECIPES = new RecipeMap<>("packer", 2, 2, 0, 0, new SimpleRecipeBuilder().EUt(12).duration(10), false)
-            .setSlotOverlay(false, false, true, GuiTextures.BOX_OVERLAY)
-            .setSlotOverlay(true, false, GuiTextures.BOXED_OVERLAY)
-            .setProgressBar(GuiTextures.PROGRESS_BAR_UNPACKER, MoveType.HORIZONTAL)
-            .setSound(GTSoundEvents.ASSEMBLER);
+    public static final RecipeMap PACKER_RECIPES = new RecipeMap<>("packer", 2, 2, 0, 0,
+            new SimpleRecipeBuilder().EUt(12).duration(10), false)
+                    .setSlotOverlay(false, false, true, GuiTextures.BOX_OVERLAY)
+                    .setSlotOverlay(true, false, GuiTextures.BOXED_OVERLAY)
+                    .setProgressBar(GuiTextures.PROGRESS_BAR_UNPACKER, MoveType.HORIZONTAL)
+                    .setSound(GTSoundEvents.ASSEMBLER);
 
     /**
      * Example:
+     * 
      * 
-     * 		RecipeMap.POLARIZER_RECIPES.recipeBuilder()
-     * 				.inputs(OreDictUnifier.get(OrePrefix.plate, Materials.Iron))
-     * 				.outputs(OreDictUnifier.get(OrePrefix.plate, Materials.IronMagnetic))
-     * 				.duration(100)
-     * 				.EUt(16)
-     * 				.buildAndRegister();
+     * RecipeMap.POLARIZER_RECIPES.recipeBuilder()
+     *         .inputs(OreDictUnifier.get(OrePrefix.plate, Materials.Iron))
+     *         .outputs(OreDictUnifier.get(OrePrefix.plate, Materials.IronMagnetic))
+     *         .duration(100)
+     *         .EUt(16)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap POLARIZER_RECIPES = new RecipeMap<>("polarizer", 1, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC); + public static final RecipeMap POLARIZER_RECIPES = new RecipeMap<>("polarizer", 1, 1, 0, 0, + new SimpleRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ARC); /** * Example: + * *
      *      RecipeMap.PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder()
      *     			.input(OrePrefix.ingot, Materials.Iron)
@@ -1005,188 +1114,211 @@ public class RecipeMaps {
      *     			.buildAndRegister();
      * 
* - * As a Primitive Machine, the Primitive Blast Furnace does not need an EUt parameter specified for the Recipe Builder. + * As a Primitive Machine, the Primitive Blast Furnace does not need an EUt parameter specified for the + * Recipe Builder. */ @ZenProperty - public static final RecipeMap PRIMITIVE_BLAST_FURNACE_RECIPES = new RecipeMap<>("primitive_blast_furnace", 3, false, 3, false, 0, false, 0, false, new PrimitiveRecipeBuilder(), false) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap PRIMITIVE_BLAST_FURNACE_RECIPES = new RecipeMap<>( + "primitive_blast_furnace", 3, false, 3, false, 0, false, 0, false, new PrimitiveRecipeBuilder(), false) + .setSound(GTSoundEvents.FIRE); /** * Example: + * *
-     *      RecipeMap.PYROLYSE_RECIPES.recipeBuilder()
-     *     			.input(OrePrefix.log, Materials.Wood, 16)
-     *     			.circuitMeta(2)
-     *     			.fluidInputs(Materials.Nitrogen.getFluid(1000))
-     *     			.outputs(new ItemStack(Items.COAL, 20, 1))
-     *     			.fluidOutputs(Materials.Creosote.getFluid(4000))
-     *     			.duration(320)
-     *     			.EUt(96)
-     *     			.buildAndRegister();
+     * RecipeMap.PYROLYSE_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.log, Materials.Wood, 16)
+     *         .circuitMeta(2)
+     *         .fluidInputs(Materials.Nitrogen.getFluid(1000))
+     *         .outputs(new ItemStack(Items.COAL, 20, 1))
+     *         .fluidOutputs(Materials.Creosote.getFluid(4000))
+     *         .duration(320)
+     *         .EUt(96)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap PYROLYSE_RECIPES = new RecipeMap<>("pyrolyse_oven", 2, 1, 1, 1, new SimpleRecipeBuilder(), false) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap PYROLYSE_RECIPES = new RecipeMap<>("pyrolyse_oven", 2, 1, 1, 1, + new SimpleRecipeBuilder(), false) + .setSound(GTSoundEvents.FIRE); /** * Currently unused */ @ZenProperty - public static final RecipeMap REPLICATOR_RECIPES = new RecipeMap<>("replicator", 1, 1, 2, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DATA_ORB_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.ATOMIC_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.ATOMIC_OVERLAY_2) - .setSlotOverlay(false, true, GuiTextures.NEUTRAL_MATTER_OVERLAY) - .setSlotOverlay(false, true, true, GuiTextures.POSITIVE_MATTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_REPLICATOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.REPLICATOR); + public static final RecipeMap REPLICATOR_RECIPES = new RecipeMap<>("replicator", 1, 1, 2, 1, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.DATA_ORB_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.ATOMIC_OVERLAY_1) + .setSlotOverlay(true, true, GuiTextures.ATOMIC_OVERLAY_2) + .setSlotOverlay(false, true, GuiTextures.NEUTRAL_MATTER_OVERLAY) + .setSlotOverlay(false, true, true, GuiTextures.POSITIVE_MATTER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_REPLICATOR, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.REPLICATOR); @ZenProperty - public static final RecipeMap RESEARCH_STATION_RECIPES = new RecipeMapResearchStation<>("research_station", 2, 1, 0, 0, new ComputationRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSlotOverlay(false, false, GuiTextures.SCANNER_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.RESEARCH_STATION_OVERLAY) - .setSound(GTValues.FOOLS.get() ? GTSoundEvents.SCIENCE : GTSoundEvents.COMPUTATION); + public static final RecipeMap RESEARCH_STATION_RECIPES = new RecipeMapResearchStation<>( + "research_station", 2, 1, 0, 0, new ComputationRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSlotOverlay(false, false, GuiTextures.SCANNER_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.RESEARCH_STATION_OVERLAY) + .setSound(GTValues.FOOLS.get() ? GTSoundEvents.SCIENCE : GTSoundEvents.COMPUTATION); @ZenProperty - public static final RecipeMap ROCK_BREAKER_RECIPES = new RecipeMap<>("rock_breaker", 1, 4, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.CRUSHED_ORE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap ROCK_BREAKER_RECIPES = new RecipeMap<>("rock_breaker", 1, 4, 0, + 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.CRUSHED_ORE_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.FIRE); /** * Example: + * *
      * RecipeMaps.SCANNER_RECIPES.recipeBuilder()
-     *              .inputNBT(MetaItems.TOOL_DATA_STICK, NBTMatcher.ANY, NBTCondition.ANY)
-     *              .input(MetaItems.ELECTRIC_MOTOR_IV)
-     *              .output(MetaItems.TOOL_DATA_STICK)
-     *              .duration(100)
-     *              .EUt(2)
-     *              .buildAndRegister();
+     *         .inputNBT(MetaItems.TOOL_DATA_STICK, NBTMatcher.ANY, NBTCondition.ANY)
+     *         .input(MetaItems.ELECTRIC_MOTOR_IV)
+     *         .output(MetaItems.TOOL_DATA_STICK)
+     *         .duration(100)
+     *         .EUt(2)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap SCANNER_RECIPES = new RecipeMapScanner("scanner", 2, 1, 1, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DATA_ORB_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.SCANNER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ELECTROLYZER); + public static final RecipeMap SCANNER_RECIPES = new RecipeMapScanner("scanner", 2, 1, 1, 0, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.DATA_ORB_OVERLAY) + .setSlotOverlay(false, false, true, GuiTextures.SCANNER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ELECTROLYZER); /** * Example: + * *
-     *     RecipeMap.SIFTER_RECIPES.recipeBuilder()
-     *     			.inputs(new ItemStack(Blocks.SAND))
-     *     			.chancedOutput(OreDictUnifier.get(OrePrefix.gemExquisite, Materials.Ruby, 1L), 300)
-     *     			.chancedOutput(OreDictUnifier.get(OrePrefix.gemFlawless, Materials.Ruby, 1L), 1200)
-     *     			.chancedOutput(OreDictUnifier.get(OrePrefix.gemFlawed, Materials.Ruby, 1L), 4500)
-     *     			.chancedOutput(OreDictUnifier.get(OrePrefix.gemChipped, Materials.Ruby, 1L), 1400)
-     *     			.chancedOutput(OreDictUnifier.get(OrePrefix.dust, Materials.Ruby, 1L), 2800)
-     *     			.duration(800)
-     *     			.EUt(16)
-     *     			.buildAndRegister();
+     * RecipeMap.SIFTER_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Blocks.SAND))
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.gemExquisite, Materials.Ruby, 1L), 300)
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.gemFlawless, Materials.Ruby, 1L), 1200)
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.gemFlawed, Materials.Ruby, 1L), 4500)
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.gemChipped, Materials.Ruby, 1L), 1400)
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.dust, Materials.Ruby, 1L), 2800)
+     *         .duration(800)
+     *         .EUt(16)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap SIFTER_RECIPES = new RecipeMap<>("sifter", 1, 6, 0, 0, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_SIFT, MoveType.VERTICAL_DOWNWARDS) - .setSound(SoundEvents.BLOCK_SAND_PLACE); + public static final RecipeMap SIFTER_RECIPES = new RecipeMap<>("sifter", 1, 6, 0, 0, + new SimpleRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_SIFT, MoveType.VERTICAL_DOWNWARDS) + .setSound(SoundEvents.BLOCK_SAND_PLACE); /** * Example: + * *
-     *     RecipeMap.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder()
-     *     			.input(OrePrefix.crushed, Materials.Aluminum)
-     *     			.outputs(OreDictUnifier.get(OrePrefix.crushedPurified, Materials.Aluminum), OreDictUnifier.get(OrePrefix.dustTiny, Materials.Bauxite, 3), OreDictUnifier.get(OrePrefix.dust, Materials.Stone))
-     *     			.duration(800)
-     *     			.EUt(16)
-     *     			.buildAndRegister();
+     * RecipeMap.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.crushed, Materials.Aluminum)
+     *         .outputs(OreDictUnifier.get(OrePrefix.crushedPurified, Materials.Aluminum),
+     *                 OreDictUnifier.get(OrePrefix.dustTiny, Materials.Bauxite, 3),
+     *                 OreDictUnifier.get(OrePrefix.dust, Materials.Stone))
+     *         .duration(800)
+     *         .EUt(16)
+     *         .buildAndRegister();
      * 
* * Any Recipe added to the Thermal Centrifuge not specifying an EUt value will default to 30. * Any Recipe added to the Thermal Centrifuge not specifying a duration value will default to 400. */ @ZenProperty - public static final RecipeMap THERMAL_CENTRIFUGE_RECIPES = new RecipeMap<>("thermal_centrifuge", 1, 3, 0, 0, new SimpleRecipeBuilder().duration(400).EUt(30), false) - .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CENTRIFUGE); + public static final RecipeMap THERMAL_CENTRIFUGE_RECIPES = new RecipeMap<>( + "thermal_centrifuge", 1, 3, 0, 0, new SimpleRecipeBuilder().duration(400).EUt(30), false) + .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CENTRIFUGE); /** * Example: + * *
-     * 		RecipeMap.VACUUM_RECIPES.recipeBuilder()
-     * 				.fluidInputs(Air.getFluid(4000))
-     * 				.fluidOutputs(LiquidAir.getFluid(4000))
-     * 				.duration(80).EUt(GTValues.VA[GTValues.HV])
-     * 				.buildAndRegister();
+     * RecipeMap.VACUUM_RECIPES.recipeBuilder()
+     *         .fluidInputs(Air.getFluid(4000))
+     *         .fluidOutputs(LiquidAir.getFluid(4000))
+     *         .duration(80).EUt(GTValues.VA[GTValues.HV])
+     *         .buildAndRegister();
      * 
* * Any Recipe added to the Thermal Centrifuge not specifying an EUt value will default to 120. */ @ZenProperty - public static final RecipeMap VACUUM_RECIPES = new RecipeMap<>("vacuum_freezer", 1, 1, 2, 1, new SimpleRecipeBuilder().EUt(VA[MV]), false) - .setSound(GTSoundEvents.COOLING); + public static final RecipeMap VACUUM_RECIPES = new RecipeMap<>("vacuum_freezer", 1, 1, 2, 1, + new SimpleRecipeBuilder().EUt(VA[MV]), false) + .setSound(GTSoundEvents.COOLING); /** * Example: + * *
-     * 		RecipeMap.WIREMILL_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.ingot, Materials.Iron)
-     * 				.output(OrePrefix.wireGtSingle, Materials.Iron, 2)
-     * 				.duration(200)
-     * 				.EUt(GTValues.VA[GTValues.ULV])
-     * 				.buildAndRegister();
+     * RecipeMap.WIREMILL_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.ingot, Materials.Iron)
+     *         .output(OrePrefix.wireGtSingle, Materials.Iron, 2)
+     *         .duration(200)
+     *         .EUt(GTValues.VA[GTValues.ULV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap WIREMILL_RECIPES = new RecipeMap<>("wiremill", 2, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.WIREMILL_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.INT_CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_WIREMILL, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.MOTOR); - + public static final RecipeMap WIREMILL_RECIPES = new RecipeMap<>("wiremill", 2, 1, 0, 0, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.WIREMILL_OVERLAY) + .setSlotOverlay(false, false, true, GuiTextures.INT_CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_WIREMILL, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.MOTOR); ////////////////////////////////////// - // Fuel Recipe Maps // + // Fuel Recipe Maps // ////////////////////////////////////// @ZenProperty - public static final RecipeMap COMBUSTION_GENERATOR_FUELS = new RecipeMap<>("combustion_generator", 0, 0, 1, 0, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.FURNACE_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COMBUSTION) - .allowEmptyOutput(); + public static final RecipeMap COMBUSTION_GENERATOR_FUELS = new RecipeMap<>( + "combustion_generator", 0, 0, 1, 0, new FuelRecipeBuilder(), false) + .setSlotOverlay(false, true, true, GuiTextures.FURNACE_OVERLAY_2) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COMBUSTION) + .allowEmptyOutput(); @ZenProperty - public static final RecipeMap GAS_TURBINE_FUELS = new RecipeMap<>("gas_turbine", 0, 0, 1, 0, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.DARK_CANISTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.TURBINE) - .allowEmptyOutput(); + public static final RecipeMap GAS_TURBINE_FUELS = new RecipeMap<>("gas_turbine", 0, 0, 1, 0, + new FuelRecipeBuilder(), false) + .setSlotOverlay(false, true, true, GuiTextures.DARK_CANISTER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.TURBINE) + .allowEmptyOutput(); @ZenProperty - public static final RecipeMap STEAM_TURBINE_FUELS = new RecipeMap<>("steam_turbine", 0, 0, 1, 1, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.TURBINE) - .allowEmptyOutput(); + public static final RecipeMap STEAM_TURBINE_FUELS = new RecipeMap<>("steam_turbine", 0, 0, 1, 1, + new FuelRecipeBuilder(), false) + .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.TURBINE) + .allowEmptyOutput(); @ZenProperty - public static final RecipeMap SEMI_FLUID_GENERATOR_FUELS = new RecipeMap<>("semi_fluid_generator", 0, 0, 1, 0, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.FURNACE_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COMBUSTION) - .allowEmptyOutput(); + public static final RecipeMap SEMI_FLUID_GENERATOR_FUELS = new RecipeMap<>( + "semi_fluid_generator", 0, 0, 1, 0, new FuelRecipeBuilder(), false) + .setSlotOverlay(false, true, true, GuiTextures.FURNACE_OVERLAY_2) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COMBUSTION) + .allowEmptyOutput(); @ZenProperty - public static final RecipeMap PLASMA_GENERATOR_FUELS = new RecipeMap<>("plasma_generator", 0, 0, 1, 1, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.TURBINE) - .allowEmptyOutput(); + public static final RecipeMap PLASMA_GENERATOR_FUELS = new RecipeMap<>("plasma_generator", 0, 0, + 1, 1, new FuelRecipeBuilder(), false) + .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.TURBINE) + .allowEmptyOutput(); } diff --git a/src/main/java/gregtech/api/recipes/RecyclingHandler.java b/src/main/java/gregtech/api/recipes/RecyclingHandler.java index ae803b51a13..a075bede3c8 100644 --- a/src/main/java/gregtech/api/recipes/RecyclingHandler.java +++ b/src/main/java/gregtech/api/recipes/RecyclingHandler.java @@ -10,12 +10,14 @@ import gregtech.api.unification.stack.ItemMaterialInfo; import gregtech.api.unification.stack.MaterialStack; import gregtech.api.unification.stack.UnificationEntry; -import it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2LongMap; -import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; + import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; + +import it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2LongMap; +import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -75,8 +77,7 @@ public class RecyclingHandler { return new ItemMaterialInfo(materialStacksExploded.entrySet().stream() .map(e -> new MaterialStack(e.getKey(), e.getValue() / outputCount)) .sorted(Comparator.comparingLong(m -> -m.amount)) - .collect(Collectors.toList()) - ); + .collect(Collectors.toList())); } public static @Nullable ItemMaterialInfo getRecyclingIngredients(List inputs, int outputCount) { diff --git a/src/main/java/gregtech/api/recipes/builders/AssemblyLineRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/AssemblyLineRecipeBuilder.java index e97ee27176a..cd43f285278 100644 --- a/src/main/java/gregtech/api/recipes/builders/AssemblyLineRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/AssemblyLineRecipeBuilder.java @@ -10,14 +10,16 @@ import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.function.UnaryOperator; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class AssemblyLineRecipeBuilder extends RecipeBuilder { private final Collection recipeEntries = new ArrayList<>(); @@ -62,13 +64,15 @@ private boolean applyResearchProperty(ResearchPropertyData.ResearchEntry researc } if (!generatingRecipes) { - GTLog.logger.error("Cannot generate recipes when using researchWithoutRecipe()", new IllegalArgumentException()); + GTLog.logger.error("Cannot generate recipes when using researchWithoutRecipe()", + new IllegalArgumentException()); recipeStatus = EnumValidationResult.INVALID; return false; } if (recipePropertyStorage != null && recipePropertyStorage.hasRecipeProperty(ResearchProperty.getInstance())) { - ResearchPropertyData property = recipePropertyStorage.getRecipePropertyValue(ResearchProperty.getInstance(), null); + ResearchPropertyData property = recipePropertyStorage.getRecipePropertyValue(ResearchProperty.getInstance(), + null); if (property == null) throw new IllegalStateException("Property storage has a null property"); property.add(researchEntry); return true; @@ -97,7 +101,7 @@ public AssemblyLineRecipeBuilder researchWithoutRecipe(@Nonnull String researchI * Does not generate a research recipe. * * @param researchId the researchId for the recipe - * @param dataStack the stack to hold the data. Must have the {@link IDataItem} behavior. + * @param dataStack the stack to hold the data. Must have the {@link IDataItem} behavior. * @return this */ public AssemblyLineRecipeBuilder researchWithoutRecipe(@Nonnull String researchId, @Nonnull ItemStack dataStack) { @@ -156,14 +160,15 @@ public static class ResearchRecipeEntry { private final int CWUt; /** - * @param researchId the id of the research to store + * @param researchId the id of the research to store * @param researchStack the stack to scan for research - * @param dataStack the stack to contain the data - * @param duration the duration of the recipe - * @param EUt the EUt of the recipe - * @param CWUt how much computation per tick this recipe needs if in Research Station + * @param dataStack the stack to contain the data + * @param duration the duration of the recipe + * @param EUt the EUt of the recipe + * @param CWUt how much computation per tick this recipe needs if in Research Station */ - public ResearchRecipeEntry(@Nonnull String researchId, @Nonnull ItemStack researchStack, @Nonnull ItemStack dataStack, int duration, int EUt, int CWUt) { + public ResearchRecipeEntry(@Nonnull String researchId, @Nonnull ItemStack researchStack, + @Nonnull ItemStack dataStack, int duration, int EUt, int CWUt) { this.researchId = researchId; this.researchStack = researchStack; this.dataStack = dataStack; diff --git a/src/main/java/gregtech/api/recipes/builders/BlastRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/BlastRecipeBuilder.java index e51469da6ee..c330c3fc23d 100644 --- a/src/main/java/gregtech/api/recipes/builders/BlastRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/BlastRecipeBuilder.java @@ -6,14 +6,14 @@ import gregtech.api.recipes.recipeproperties.TemperatureProperty; import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; + import org.apache.commons.lang3.builder.ToStringBuilder; import javax.annotation.Nonnull; public class BlastRecipeBuilder extends RecipeBuilder { - public BlastRecipeBuilder() { - } + public BlastRecipeBuilder() {} public BlastRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); @@ -39,7 +39,8 @@ public boolean applyProperty(@Nonnull String key, Object value) { public BlastRecipeBuilder blastFurnaceTemp(int blastFurnaceTemp) { if (blastFurnaceTemp <= 0) { - GTLog.logger.error("Blast Furnace Temperature cannot be less than or equal to 0", new IllegalArgumentException()); + GTLog.logger.error("Blast Furnace Temperature cannot be less than or equal to 0", + new IllegalArgumentException()); recipeStatus = EnumValidationResult.INVALID; } this.applyProperty(TemperatureProperty.getInstance(), blastFurnaceTemp); diff --git a/src/main/java/gregtech/api/recipes/builders/CircuitAssemblerRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/CircuitAssemblerRecipeBuilder.java index 99ea4a73501..f8b383a2b37 100644 --- a/src/main/java/gregtech/api/recipes/builders/CircuitAssemblerRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/CircuitAssemblerRecipeBuilder.java @@ -13,8 +13,7 @@ public class CircuitAssemblerRecipeBuilder extends RecipeBuilder recipeMap) { super(recipe, recipeMap); @@ -43,5 +42,4 @@ public CircuitAssemblerRecipeBuilder solderMultiplier(int multiplier) { public int getSolderMultiplier() { return this.solderMultiplier; } - } diff --git a/src/main/java/gregtech/api/recipes/builders/ComputationRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/ComputationRecipeBuilder.java index a00e7a502d7..d6cadabc988 100644 --- a/src/main/java/gregtech/api/recipes/builders/ComputationRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/ComputationRecipeBuilder.java @@ -7,6 +7,7 @@ import gregtech.api.recipes.recipeproperties.TotalComputationProperty; import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; + import org.jetbrains.annotations.NotNull; public class ComputationRecipeBuilder extends RecipeBuilder { diff --git a/src/main/java/gregtech/api/recipes/builders/FuelRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/FuelRecipeBuilder.java index a535dc54403..c905e10af14 100644 --- a/src/main/java/gregtech/api/recipes/builders/FuelRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/FuelRecipeBuilder.java @@ -6,9 +6,7 @@ public class FuelRecipeBuilder extends RecipeBuilder { - public FuelRecipeBuilder() { - - } + public FuelRecipeBuilder() {} public FuelRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); @@ -22,5 +20,4 @@ public FuelRecipeBuilder(RecipeBuilder recipeBuilder) { public FuelRecipeBuilder copy() { return new FuelRecipeBuilder(this); } - } diff --git a/src/main/java/gregtech/api/recipes/builders/FusionRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/FusionRecipeBuilder.java index 589ce4d29b4..8f3e5adf6df 100644 --- a/src/main/java/gregtech/api/recipes/builders/FusionRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/FusionRecipeBuilder.java @@ -6,14 +6,14 @@ import gregtech.api.recipes.recipeproperties.FusionEUToStartProperty; import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; + import org.apache.commons.lang3.builder.ToStringBuilder; import javax.annotation.Nonnull; public class FusionRecipeBuilder extends RecipeBuilder { - public FusionRecipeBuilder() { - } + public FusionRecipeBuilder() {} public FusionRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); diff --git a/src/main/java/gregtech/api/recipes/builders/GasCollectorRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/GasCollectorRecipeBuilder.java index 9b1b4d51e5a..5bebddca8f7 100644 --- a/src/main/java/gregtech/api/recipes/builders/GasCollectorRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/GasCollectorRecipeBuilder.java @@ -1,22 +1,23 @@ package gregtech.api.recipes.builders; -import crafttweaker.CraftTweakerAPI; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipeproperties.GasCollectorDimensionProperty; + +import crafttweaker.CraftTweakerAPI; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; import org.apache.commons.lang3.builder.ToStringBuilder; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class GasCollectorRecipeBuilder extends RecipeBuilder { - public GasCollectorRecipeBuilder() { - } + public GasCollectorRecipeBuilder() {} public GasCollectorRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); @@ -36,20 +37,21 @@ public boolean applyProperty(@Nonnull String key, Object value) { if (key.equals(GasCollectorDimensionProperty.KEY)) { if (value instanceof Integer) { this.dimension((Integer) value); - } else if (value instanceof List && !((List) value).isEmpty() && ((List) value).get(0) instanceof Integer) { - IntList dimensionIDs = getDimensionIDs(); - if (dimensionIDs == IntLists.EMPTY_LIST) { - dimensionIDs = new IntArrayList(); - this.applyProperty(GasCollectorDimensionProperty.getInstance(), dimensionIDs); - } - dimensionIDs.addAll((List) value); - } else { - if (isCTRecipe) { - CraftTweakerAPI.logError("Dimension for Gas Collector needs to be a Integer"); - return false; - } - throw new IllegalArgumentException("Invalid Dimension Property Type!"); - } + } else if (value instanceof List && !((List) value).isEmpty() && + ((List) value).get(0) instanceof Integer) { + IntList dimensionIDs = getDimensionIDs(); + if (dimensionIDs == IntLists.EMPTY_LIST) { + dimensionIDs = new IntArrayList(); + this.applyProperty(GasCollectorDimensionProperty.getInstance(), dimensionIDs); + } + dimensionIDs.addAll((List) value); + } else { + if (isCTRecipe) { + CraftTweakerAPI.logError("Dimension for Gas Collector needs to be a Integer"); + return false; + } + throw new IllegalArgumentException("Invalid Dimension Property Type!"); + } return true; } return super.applyProperty(key, value); diff --git a/src/main/java/gregtech/api/recipes/builders/ImplosionRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/ImplosionRecipeBuilder.java index 885f86f1355..a4d1b308881 100644 --- a/src/main/java/gregtech/api/recipes/builders/ImplosionRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/ImplosionRecipeBuilder.java @@ -8,8 +8,10 @@ import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; import gregtech.api.util.ValidationResult; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; + import org.apache.commons.lang3.builder.ToStringBuilder; import stanhebben.zenscript.annotations.ZenMethod; @@ -17,9 +19,7 @@ public class ImplosionRecipeBuilder extends RecipeBuilder { - public ImplosionRecipeBuilder() { - - } + public ImplosionRecipeBuilder() {} public ImplosionRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); @@ -71,7 +71,8 @@ public ItemStack getExplosivesType() { if (this.recipePropertyStorage == null) { return ItemStack.EMPTY; } - return this.recipePropertyStorage.getRecipePropertyValue(ImplosionExplosiveProperty.getInstance(), ItemStack.EMPTY); + return this.recipePropertyStorage.getRecipePropertyValue(ImplosionExplosiveProperty.getInstance(), + ItemStack.EMPTY); } public ValidationResult build() { diff --git a/src/main/java/gregtech/api/recipes/builders/PrimitiveRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/PrimitiveRecipeBuilder.java index 317f1bb8c85..858a94d1177 100644 --- a/src/main/java/gregtech/api/recipes/builders/PrimitiveRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/PrimitiveRecipeBuilder.java @@ -8,8 +8,7 @@ public class PrimitiveRecipeBuilder extends RecipeBuilder { - public PrimitiveRecipeBuilder() { - } + public PrimitiveRecipeBuilder() {} public PrimitiveRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); diff --git a/src/main/java/gregtech/api/recipes/builders/ResearchRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/ResearchRecipeBuilder.java index 333394bb716..3563ab3798d 100644 --- a/src/main/java/gregtech/api/recipes/builders/ResearchRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/ResearchRecipeBuilder.java @@ -6,6 +6,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.util.AssemblyLineManager; import gregtech.api.util.GTStringUtils; + import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; @@ -55,7 +56,7 @@ protected void validateResearchItem() { } boolean foundBehavior = false; - if (dataStack.getItem() instanceof MetaItem metaItem) { + if (dataStack.getItem() instanceof MetaItemmetaItem) { for (IItemBehaviour behaviour : metaItem.getBehaviours(dataStack)) { if (behaviour instanceof IDataItem) { foundBehavior = true; @@ -98,7 +99,8 @@ protected AssemblyLineRecipeBuilder.ResearchRecipeEntry build() { validateResearchItem(); if (duration <= 0) duration = DEFAULT_SCANNER_DURATION; if (eut <= 0) eut = DEFAULT_SCANNER_EUT; - return new AssemblyLineRecipeBuilder.ResearchRecipeEntry(researchId, researchStack, dataStack, duration, eut, 0); + return new AssemblyLineRecipeBuilder.ResearchRecipeEntry(researchId, researchStack, dataStack, duration, + eut, 0); } } @@ -146,7 +148,8 @@ protected AssemblyLineRecipeBuilder.ResearchRecipeEntry build() { int duration = totalCWU; if (eut <= 0) eut = DEFAULT_STATION_EUT; - return new AssemblyLineRecipeBuilder.ResearchRecipeEntry(researchId, researchStack, dataStack, duration, eut, cwut); + return new AssemblyLineRecipeBuilder.ResearchRecipeEntry(researchId, researchStack, dataStack, duration, + eut, cwut); } } } diff --git a/src/main/java/gregtech/api/recipes/builders/SimpleRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/SimpleRecipeBuilder.java index 013389aefb7..61bcfdf1015 100644 --- a/src/main/java/gregtech/api/recipes/builders/SimpleRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/SimpleRecipeBuilder.java @@ -6,8 +6,7 @@ public class SimpleRecipeBuilder extends RecipeBuilder { - public SimpleRecipeBuilder() { - } + public SimpleRecipeBuilder() {} public SimpleRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); @@ -21,5 +20,4 @@ public SimpleRecipeBuilder(RecipeBuilder recipeBuilder) { public SimpleRecipeBuilder copy() { return new SimpleRecipeBuilder(this); } - } diff --git a/src/main/java/gregtech/api/recipes/builders/UniversalDistillationRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/UniversalDistillationRecipeBuilder.java index 8f0bc60a3de..88b0549212f 100644 --- a/src/main/java/gregtech/api/recipes/builders/UniversalDistillationRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/UniversalDistillationRecipeBuilder.java @@ -4,6 +4,7 @@ import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.RecipeMaps; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -15,8 +16,7 @@ public class UniversalDistillationRecipeBuilder extends RecipeBuilder recipeMap) { super(recipe, recipeMap); @@ -39,19 +39,24 @@ public void buildAndRegister() { } for (int i = 0; i < fluidOutputs.size(); i++) { - SimpleRecipeBuilder builder = RecipeMaps.DISTILLERY_RECIPES.recipeBuilder().copy().EUt(Math.max(1, this.EUt / 4)).circuitMeta(i + 1); + SimpleRecipeBuilder builder = RecipeMaps.DISTILLERY_RECIPES.recipeBuilder().copy() + .EUt(Math.max(1, this.EUt / 4)).circuitMeta(i + 1); - int ratio = getRatioForDistillery(this.fluidInputs.get(0).getInputFluidStack(), this.fluidOutputs.get(i), !this.outputs.isEmpty() ? this.outputs.get(0) : null); + int ratio = getRatioForDistillery(this.fluidInputs.get(0).getInputFluidStack(), this.fluidOutputs.get(i), + !this.outputs.isEmpty() ? this.outputs.get(0) : null); int recipeDuration = (int) (this.duration * STANDARD_OVERCLOCK_DURATION_DIVISOR); boolean shouldDivide = ratio != 1; - boolean fluidsDivisible = isFluidStackDivisibleForDistillery(this.fluidInputs.get(0).getInputFluidStack(), ratio) && + boolean fluidsDivisible = isFluidStackDivisibleForDistillery(this.fluidInputs.get(0).getInputFluidStack(), + ratio) && isFluidStackDivisibleForDistillery(this.fluidOutputs.get(i), ratio); - FluidStack dividedInputFluid = new FluidStack(this.fluidInputs.get(0).getInputFluidStack(), Math.max(1, this.fluidInputs.get(0).getAmount() / ratio)); - FluidStack dividedOutputFluid = new FluidStack(this.fluidOutputs.get(i), Math.max(1, this.fluidOutputs.get(i).amount / ratio)); + FluidStack dividedInputFluid = new FluidStack(this.fluidInputs.get(0).getInputFluidStack(), + Math.max(1, this.fluidInputs.get(0).getAmount() / ratio)); + FluidStack dividedOutputFluid = new FluidStack(this.fluidOutputs.get(i), + Math.max(1, this.fluidOutputs.get(i).amount / ratio)); if (shouldDivide && fluidsDivisible) builder.fluidInputs(dividedInputFluid) @@ -84,8 +89,9 @@ else if (!shouldDivide) { super.buildAndRegister(); } - private static int getRatioForDistillery(FluidStack fluidInput, FluidStack fluidOutput, @Nullable ItemStack output) { - int[] divisors = new int[]{2, 5, 10, 25, 50}; + private static int getRatioForDistillery(FluidStack fluidInput, FluidStack fluidOutput, + @Nullable ItemStack output) { + int[] divisors = new int[] { 2, 5, 10, 25, 50 }; int ratio = -1; for (int divisor : divisors) { @@ -114,5 +120,4 @@ public UniversalDistillationRecipeBuilder disableDistilleryRecipes() { this.doDistilleryRecipes = false; return this; } - } diff --git a/src/main/java/gregtech/api/recipes/category/GTRecipeCategory.java b/src/main/java/gregtech/api/recipes/category/GTRecipeCategory.java index 1e188e1ff26..acf8057649f 100644 --- a/src/main/java/gregtech/api/recipes/category/GTRecipeCategory.java +++ b/src/main/java/gregtech/api/recipes/category/GTRecipeCategory.java @@ -1,11 +1,13 @@ package gregtech.api.recipes.category; import gregtech.api.recipes.RecipeMap; + import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import java.util.Map; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Map; public final class GTRecipeCategory { @@ -28,8 +30,10 @@ public final class GTRecipeCategory { * @return the new category */ @Nonnull - public static GTRecipeCategory create(@Nonnull String modid, @Nonnull String categoryName, @Nonnull String translationKey, @Nonnull RecipeMap recipeMap) { - return categories.computeIfAbsent(categoryName, (k) -> new GTRecipeCategory(modid, categoryName, translationKey, recipeMap)); + public static GTRecipeCategory create(@Nonnull String modid, @Nonnull String categoryName, + @Nonnull String translationKey, @Nonnull RecipeMap recipeMap) { + return categories.computeIfAbsent(categoryName, + (k) -> new GTRecipeCategory(modid, categoryName, translationKey, recipeMap)); } /** @@ -41,7 +45,8 @@ public static GTRecipeCategory getByName(@Nonnull String categoryName) { return categories.get(categoryName); } - private GTRecipeCategory(@Nonnull String modid, @Nonnull String name, @Nonnull String translationKey, @Nonnull RecipeMap recipeMap) { + private GTRecipeCategory(@Nonnull String modid, @Nonnull String name, @Nonnull String translationKey, + @Nonnull RecipeMap recipeMap) { this.modid = modid; this.name = name; this.uniqueID = modid + ':' + this.name; diff --git a/src/main/java/gregtech/api/recipes/category/RecipeCategories.java b/src/main/java/gregtech/api/recipes/category/RecipeCategories.java index a965a8f9399..1eee70a5607 100644 --- a/src/main/java/gregtech/api/recipes/category/RecipeCategories.java +++ b/src/main/java/gregtech/api/recipes/category/RecipeCategories.java @@ -7,21 +7,21 @@ public final class RecipeCategories { public static final GTRecipeCategory ARC_FURNACE_RECYCLING = GTRecipeCategory.create(GTValues.MODID, - "arc_furnace_recycling", - "gregtech.recipe.category.arc_furnace_recycling", - RecipeMaps.ARC_FURNACE_RECIPES) + "arc_furnace_recycling", + "gregtech.recipe.category.arc_furnace_recycling", + RecipeMaps.ARC_FURNACE_RECIPES) .jeiIcon(GuiTextures.ARC_FURNACE_RECYLCING_CATEGORY); public static final GTRecipeCategory MACERATOR_RECYCLING = GTRecipeCategory.create(GTValues.MODID, - "macerator_recycling", - "gregtech.recipe.category.macerator_recycling", - RecipeMaps.MACERATOR_RECIPES) + "macerator_recycling", + "gregtech.recipe.category.macerator_recycling", + RecipeMaps.MACERATOR_RECIPES) .jeiIcon(GuiTextures.MACERATOR_RECYLCING_CATEGORY); public static final GTRecipeCategory EXTRACTOR_RECYCLING = GTRecipeCategory.create(GTValues.MODID, - "extractor_recycling", - "gregtech.recipe.category.extractor_recycling", - RecipeMaps.EXTRACTOR_RECIPES) + "extractor_recycling", + "gregtech.recipe.category.extractor_recycling", + RecipeMaps.EXTRACTOR_RECIPES) .jeiIcon(GuiTextures.EXTRACTOR_RECYLCING_CATEGORY); private RecipeCategories() {} diff --git a/src/main/java/gregtech/api/recipes/chance/ChanceEntry.java b/src/main/java/gregtech/api/recipes/chance/ChanceEntry.java index 0d36789cedb..e5eeda1a875 100644 --- a/src/main/java/gregtech/api/recipes/chance/ChanceEntry.java +++ b/src/main/java/gregtech/api/recipes/chance/ChanceEntry.java @@ -12,7 +12,8 @@ public interface ChanceEntry { /** * @return the ingredient */ - @NotNull T getIngredient(); + @NotNull + T getIngredient(); /** * @return the chance of operating with the ingredient @@ -22,5 +23,6 @@ public interface ChanceEntry { /** * @return a copy of the chance entry */ - @NotNull ChanceEntry copy(); + @NotNull + ChanceEntry copy(); } diff --git a/src/main/java/gregtech/api/recipes/chance/boost/ChanceBoostFunction.java b/src/main/java/gregtech/api/recipes/chance/boost/ChanceBoostFunction.java index 8e4983d69be..e885f08af58 100644 --- a/src/main/java/gregtech/api/recipes/chance/boost/ChanceBoostFunction.java +++ b/src/main/java/gregtech/api/recipes/chance/boost/ChanceBoostFunction.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.chance.boost; import gregtech.api.GTValues; + import org.jetbrains.annotations.NotNull; /** diff --git a/src/main/java/gregtech/api/recipes/chance/output/BoostableChanceOutput.java b/src/main/java/gregtech/api/recipes/chance/output/BoostableChanceOutput.java index 1a973e4ffbd..c7cadf8bc7c 100644 --- a/src/main/java/gregtech/api/recipes/chance/output/BoostableChanceOutput.java +++ b/src/main/java/gregtech/api/recipes/chance/output/BoostableChanceOutput.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.chance.output; import gregtech.api.recipes.chance.boost.BoostableChanceEntry; + import org.jetbrains.annotations.NotNull; /** diff --git a/src/main/java/gregtech/api/recipes/chance/output/ChancedOutput.java b/src/main/java/gregtech/api/recipes/chance/output/ChancedOutput.java index b275239f6d1..9689fc1b208 100644 --- a/src/main/java/gregtech/api/recipes/chance/output/ChancedOutput.java +++ b/src/main/java/gregtech/api/recipes/chance/output/ChancedOutput.java @@ -1,8 +1,7 @@ package gregtech.api.recipes.chance.output; -import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.recipes.chance.BaseChanceEntry; -import net.minecraftforge.items.IItemHandler; + import org.jetbrains.annotations.NotNull; /** diff --git a/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputList.java b/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputList.java index 23d0308ea09..71856282127 100644 --- a/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputList.java +++ b/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputList.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.chance.output; import gregtech.api.recipes.chance.boost.ChanceBoostFunction; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Unmodifiable; @@ -37,7 +38,8 @@ public ChancedOutputList(@NotNull ChancedOutputLogic chancedOutputLogic, @NotNul * @param machineTier the tier the recipe is run at * @return a list of the rolled outputs */ - public @Nullable @Unmodifiable List roll(@NotNull ChanceBoostFunction boostFunction, int baseTier, int machineTier) { + public @Nullable @Unmodifiable List roll(@NotNull ChanceBoostFunction boostFunction, int baseTier, + int machineTier) { return chancedOutputLogic.roll(getChancedEntries(), boostFunction, baseTier, machineTier); } diff --git a/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputLogic.java b/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputLogic.java index 00819432a14..738d9176233 100644 --- a/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputLogic.java +++ b/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputLogic.java @@ -1,9 +1,10 @@ package gregtech.api.recipes.chance.output; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.recipes.chance.boost.BoostableChanceEntry; import gregtech.api.recipes.chance.boost.ChanceBoostFunction; + +import com.google.common.collect.ImmutableList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Unmodifiable; @@ -20,8 +21,12 @@ public interface ChancedOutputLogic { * Chanced Output Logic where any ingredients succeeding their roll will be produced */ ChancedOutputLogic OR = new ChancedOutputLogic() { + @Override - public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, @NotNull ChanceBoostFunction boostFunction, int baseTier, int machineTier) { + public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, + @NotNull ChanceBoostFunction boostFunction, + int baseTier, int machineTier) { ImmutableList.Builder builder = null; for (T entry : chancedEntries) { if (passesChance(getChance(entry, boostFunction, baseTier, machineTier))) { @@ -47,8 +52,12 @@ public String toString() { * Chanced Output Logic where all ingredients must succeed their roll in order for any to be produced */ ChancedOutputLogic AND = new ChancedOutputLogic() { + @Override - public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, @NotNull ChanceBoostFunction boostFunction, int baseTier, int machineTier) { + public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, + @NotNull ChanceBoostFunction boostFunction, + int baseTier, int machineTier) { for (T entry : chancedEntries) { if (!passesChance(getChance(entry, boostFunction, baseTier, machineTier))) { return null; @@ -72,8 +81,12 @@ public String toString() { * Chanced Output Logic where only the first ingredient succeeding its roll will be produced */ ChancedOutputLogic XOR = new ChancedOutputLogic() { + @Override - public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, @NotNull ChanceBoostFunction boostFunction, int baseTier, int machineTier) { + public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, + @NotNull ChanceBoostFunction boostFunction, + int baseTier, int machineTier) { for (T entry : chancedEntries) { if (passesChance(getChance(entry, boostFunction, baseTier, machineTier))) { return Collections.singletonList(entry); @@ -97,8 +110,12 @@ public String toString() { * Chanced Output Logic where nothing is produced */ ChancedOutputLogic NONE = new ChancedOutputLogic() { + @Override - public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, @NotNull ChanceBoostFunction boostFunction, int baseTier, int machineTier) { + public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, + @NotNull ChanceBoostFunction boostFunction, + int baseTier, int machineTier) { return null; } @@ -110,19 +127,19 @@ public String toString() { @Override public String toString() { return "ChancedOutputLogic{NONE}"; - } }; /** * @param entry the entry to get the complete chance for * @param boostFunction the function boosting the entry's chance - * @param baseTier the base tier of the recipe - * @param machineTier the tier the recipe is run at + * @param baseTier the base tier of the recipe + * @param machineTier the tier the recipe is run at * @return the total chance for the entry */ - static int getChance(@NotNull ChancedOutput entry, @NotNull ChanceBoostFunction boostFunction, int baseTier, int machineTier) { - if (entry instanceof BoostableChanceEntry boostableChanceEntry) { + static int getChance(@NotNull ChancedOutput entry, @NotNull ChanceBoostFunction boostFunction, int baseTier, + int machineTier) { + if (entry instanceof BoostableChanceEntryboostableChanceEntry) { return boostFunction.getBoostedChance(boostableChanceEntry, baseTier, machineTier); } return entry.getChance(); @@ -153,8 +170,10 @@ static int getMaxChancedValue() { * @return a list of the produced outputs */ > @Nullable @Unmodifiable List<@NotNull T> roll( - @NotNull @Unmodifiable List<@NotNull T> chancedEntries, @NotNull ChanceBoostFunction boostFunction, - int baseTier, int machineTier); + @NotNull @Unmodifiable List<@NotNull T> chancedEntries, + @NotNull ChanceBoostFunction boostFunction, + int baseTier, int machineTier); - @NotNull String getTranslationKey(); + @NotNull + String getTranslationKey(); } diff --git a/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedFluidOutput.java b/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedFluidOutput.java index 38a8c6c3433..81a145fe1c8 100644 --- a/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedFluidOutput.java +++ b/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedFluidOutput.java @@ -1,7 +1,9 @@ package gregtech.api.recipes.chance.output.impl; import gregtech.api.recipes.chance.output.BoostableChanceOutput; + import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.NotNull; /** diff --git a/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedItemOutput.java b/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedItemOutput.java index d01407b3954..b49e640d942 100644 --- a/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedItemOutput.java +++ b/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedItemOutput.java @@ -2,7 +2,9 @@ import gregtech.api.recipes.chance.output.BoostableChanceOutput; import gregtech.api.util.GTStringUtils; + import net.minecraft.item.ItemStack; + import org.jetbrains.annotations.NotNull; /** diff --git a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeFluidInput.java b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeFluidInput.java index ccd9ee7f9fd..db02945d430 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeFluidInput.java +++ b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeFluidInput.java @@ -3,9 +3,10 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; import java.util.Objects; +import javax.annotation.Nullable; + public class GTRecipeFluidInput extends GTRecipeInput { private final FluidStack inputStack; diff --git a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeInput.java b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeInput.java index f7e1ac45180..76f18cc39fc 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeInput.java +++ b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeInput.java @@ -2,20 +2,23 @@ import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectLists; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectLists; + import java.util.Collection; import java.util.Comparator; import java.util.List; +import javax.annotation.Nullable; + /** * Definition of ItemStacks, Ore dicts, of ingredients for * use on RecipeMaps Recipes go here. @@ -44,7 +47,8 @@ public abstract class GTRecipeInput { */ public static final int SORTING_ORDER_INT_CIRCUIT = 10; - public static final Comparator RECIPE_INPUT_COMPARATOR = Comparator.comparingInt(GTRecipeInput::getSortingOrder); + public static final Comparator RECIPE_INPUT_COMPARATOR = Comparator + .comparingInt(GTRecipeInput::getSortingOrder); /** * All items will initially match the with is NBT (OreDicts have a null tag?) @@ -180,9 +184,9 @@ public int hashCode() { /** * @return true if the input matches another input, while ignoring its amount field and - * non-consumable status. - *

- * used for unique input matching in RecipeMap + * non-consumable status. + *

+ * used for unique input matching in RecipeMap * @see gregtech.api.recipes.RecipeMap#uniqueIngredientsList(Collection) RecipeMap#uniqueIngredientsList(Collection) */ public abstract boolean equalIgnoreAmount(GTRecipeInput input); @@ -200,6 +204,7 @@ public int getSortingOrder() { } protected static class ItemToMetaList implements Object2ObjectMap.Entry> { + protected Item item; protected List metaToTAGList; @@ -232,6 +237,7 @@ public List setValue(List value) { } protected static class MetaToTAGList implements Int2ObjectMap.Entry> { + protected int meta; protected List tagToStack; @@ -269,6 +275,7 @@ public List setValue(List value) { } protected static class TagToStack implements Object2ObjectMap.Entry { + NBTTagCompound tag; ItemStack stack; diff --git a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeItemInput.java b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeItemInput.java index bb159449d59..8fed7a4d4c5 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeItemInput.java +++ b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeItemInput.java @@ -1,12 +1,14 @@ package gregtech.api.recipes.ingredients; import gregtech.api.GTValues; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.NonNullList; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -18,11 +20,11 @@ public class GTRecipeItemInput extends GTRecipeInput { private final List itemList = new ObjectArrayList<>(); public GTRecipeItemInput(ItemStack stack) { - this(new ItemStack[]{stack}, stack.getCount()); + this(new ItemStack[] { stack }, stack.getCount()); } public GTRecipeItemInput(ItemStack stack, int amount) { - this(new ItemStack[]{stack}, amount); + this(new ItemStack[] { stack }, amount); } public GTRecipeItemInput(GTRecipeInput input) { @@ -218,7 +220,8 @@ public boolean equalIgnoreAmount(GTRecipeInput input) { if (this.inputStacks.length != other.inputStacks.length) return false; for (int i = 0; i < this.inputStacks.length; i++) { - if (!ItemStack.areItemsEqual(this.inputStacks[i], other.inputStacks[i]) || !ItemStack.areItemStackTagsEqual(this.inputStacks[i], other.inputStacks[i])) + if (!ItemStack.areItemsEqual(this.inputStacks[i], other.inputStacks[i]) || + !ItemStack.areItemStackTagsEqual(this.inputStacks[i], other.inputStacks[i])) return false; } return true; diff --git a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeOreInput.java b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeOreInput.java index 1f36a8c48d2..8596b80d955 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeOreInput.java +++ b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeOreInput.java @@ -3,12 +3,14 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.UnificationEntry; + import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import javax.annotation.Nullable; import java.util.Objects; +import javax.annotation.Nullable; + public class GTRecipeOreInput extends GTRecipeInput { private final int ore; @@ -86,8 +88,9 @@ public GTRecipeInput copyWithAmount(int amount) { return copy; } - //The items returned here are not updated after its first call, so they are not suitable for use while recipes are being processed and - //the OreDicts being modified. + // The items returned here are not updated after its first call, so they are not suitable for use while recipes are + // being processed and + // the OreDicts being modified. @Override public ItemStack[] getInputStacks() { if (this.inputStacks == null) { @@ -157,7 +160,7 @@ public boolean equalIgnoreAmount(GTRecipeInput input) { @Override public String toString() { - //noinspection StringConcatenationMissingWhitespace + // noinspection StringConcatenationMissingWhitespace return amount + "x" + OreDictionary.getOreName(ore); } } diff --git a/src/main/java/gregtech/api/recipes/ingredients/IntCircuitIngredient.java b/src/main/java/gregtech/api/recipes/ingredients/IntCircuitIngredient.java index 989fa04b55a..4181b978d03 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/IntCircuitIngredient.java +++ b/src/main/java/gregtech/api/recipes/ingredients/IntCircuitIngredient.java @@ -4,13 +4,15 @@ import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.MathHelper; -import javax.annotation.Nullable; import java.util.Objects; +import javax.annotation.Nullable; + public class IntCircuitIngredient extends GTRecipeInput { public static final int CIRCUIT_MIN = 0; @@ -72,7 +74,7 @@ public int getAmount() { @Override public ItemStack[] getInputStacks() { if (this.inputStacks == null) { - this.inputStacks = new ItemStack[]{getIntegratedCircuit(this.matchingConfigurations)}; + this.inputStacks = new ItemStack[] { getIntegratedCircuit(this.matchingConfigurations) }; } return this.inputStacks; } diff --git a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/ListNBTCondition.java b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/ListNBTCondition.java index 6472d9c4625..ee8b61833a8 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/ListNBTCondition.java +++ b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/ListNBTCondition.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.ingredients.nbtmatch; import gregtech.api.util.GTLog; + import net.minecraft.nbt.NBTBase; import java.util.List; @@ -25,7 +26,7 @@ protected ListNBTCondition(NBTTagType listTagType, String nbtKey, Object value) @Override public String toString() { - return nbtKey + " (type " + listTagType + ") :" + value; + return nbtKey + " (type " + listTagType + ") :" + value; } @Override @@ -45,5 +46,4 @@ public boolean equals(Object obj) { } return false; } - } diff --git a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTCondition.java b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTCondition.java index fda0330bdac..f8c5010c5a9 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTCondition.java +++ b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTCondition.java @@ -2,9 +2,10 @@ import gregtech.api.util.GTLog; -import javax.annotation.Nullable; import java.util.Objects; +import javax.annotation.Nullable; + /** * This class is used to check if a NBT tag matches a condition, not necessarily matching the original item tag */ diff --git a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTMatcher.java b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTMatcher.java index e11eafec087..fccda3c820d 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTMatcher.java +++ b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTMatcher.java @@ -5,9 +5,10 @@ import net.minecraft.nbt.NBTTagLongArray; import net.minecraftforge.fluids.FluidStack; +import java.util.Objects; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Objects; /** * This class is used to match NBT tags. Used to match a MapItemStackNBTIngredient NBT tag to a given NBT tag value. @@ -107,7 +108,8 @@ static boolean hasKey(NBTTagCompound tag, String key, int tagType) { return tag.getString(condition.nbtKey).equals(condition.value); case LIST: if (condition instanceof ListNBTCondition) { - return tag.getTagList(condition.nbtKey, ((ListNBTCondition) condition).listTagType.typeId).tagList.equals(condition.value); + return tag.getTagList(condition.nbtKey, + ((ListNBTCondition) condition).listTagType.typeId).tagList.equals(condition.value); } else { return false; } @@ -127,8 +129,9 @@ static boolean hasKey(NBTTagCompound tag, String key, int tagType) { * If NBTTagCompound is found, evaluates recursively. */ NBTMatcher RECURSIVE_EQUAL_TO = new NBTMatcher() { + @Override - public boolean evaluate(@Nullable NBTTagCompound tag, @Nullable NBTCondition condition) { + public boolean evaluate(@Nullable NBTTagCompound tag, @Nullable NBTCondition condition) { if (condition == null || condition.tagType == null) { return false; } @@ -145,7 +148,8 @@ public boolean evaluate(@Nullable NBTTagCompound tag, @Nullable NBTCondition con return tag.getString(condition.nbtKey).equals(condition.value); case LIST: if (condition instanceof ListNBTCondition) { - return tag.getTagList(condition.nbtKey, ((ListNBTCondition) condition).listTagType.typeId).tagList.equals(condition.value); + return tag.getTagList(condition.nbtKey, + ((ListNBTCondition) condition).listTagType.typeId).tagList.equals(condition.value); } else { return false; } @@ -184,7 +188,8 @@ public boolean evaluate(@Nullable NBTTagCompound tag, @Nullable NBTCondition con return tag.getString(condition.nbtKey).isEmpty(); case LIST: if (condition instanceof ListNBTCondition) { - return tag.getTagList(condition.nbtKey, ((ListNBTCondition) condition).listTagType.typeId).isEmpty(); + return tag.getTagList(condition.nbtKey, ((ListNBTCondition) condition).listTagType.typeId) + .isEmpty(); } else { return false; } @@ -218,5 +223,4 @@ default boolean evaluate(@Nonnull ItemStack stack, @Nullable NBTCondition nbtCon default boolean evaluate(@Nonnull FluidStack stack, @Nullable NBTCondition nbtCondition) { return evaluate(stack.tag, nbtCondition); } - } diff --git a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTTagType.java b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTTagType.java index 12efee5d722..139ceb4f742 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTTagType.java +++ b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTTagType.java @@ -18,13 +18,13 @@ public enum NBTTagType { NUMBER(99); public static boolean isNumeric(NBTTagType type) { - return type == BYTE || type == SHORT || type == INT || type == LONG || type == FLOAT || type == DOUBLE || type == NUMBER; + return type == BYTE || type == SHORT || type == INT || type == LONG || type == FLOAT || type == DOUBLE || + type == NUMBER; } - + public final int typeId; - + NBTTagType(int typeId) { this.typeId = typeId; } - } diff --git a/src/main/java/gregtech/api/recipes/logic/IParallelableRecipeLogic.java b/src/main/java/gregtech/api/recipes/logic/IParallelableRecipeLogic.java index 7b0e605c1dd..f9c5e139222 100644 --- a/src/main/java/gregtech/api/recipes/logic/IParallelableRecipeLogic.java +++ b/src/main/java/gregtech/api/recipes/logic/IParallelableRecipeLogic.java @@ -7,6 +7,7 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; + import net.minecraftforge.items.IItemHandlerModifiable; import javax.annotation.Nonnull; @@ -23,7 +24,8 @@ public interface IParallelableRecipeLogic { default void applyParallelBonus(@Nonnull RecipeBuilder builder) {} /** - * Method which finds a recipe which can be parallelized, works by multiplying the recipe by the parallelization factor, + * Method which finds a recipe which can be parallelized, works by multiplying the recipe by the parallelization + * factor, * and shrinking the recipe till its outputs can fit * * @param recipeMap the recipe map @@ -37,7 +39,13 @@ default void applyParallelBonus(@Nonnull RecipeBuilder builder) {} * @param voidable the voidable performing the parallel recipe * @return the recipe builder with the parallelized recipe. returns null the recipe can't fit */ - default RecipeBuilder findMultipliedParallelRecipe(@Nonnull RecipeMap recipeMap, @Nonnull Recipe currentRecipe, @Nonnull IItemHandlerModifiable inputs, @Nonnull IMultipleTankHandler fluidInputs, @Nonnull IItemHandlerModifiable outputs, @Nonnull IMultipleTankHandler fluidOutputs, int parallelLimit, long maxVoltage, @Nonnull IVoidable voidable) { + default RecipeBuilder findMultipliedParallelRecipe(@Nonnull RecipeMap recipeMap, + @Nonnull Recipe currentRecipe, + @Nonnull IItemHandlerModifiable inputs, + @Nonnull IMultipleTankHandler fluidInputs, + @Nonnull IItemHandlerModifiable outputs, + @Nonnull IMultipleTankHandler fluidOutputs, int parallelLimit, + long maxVoltage, @Nonnull IVoidable voidable) { return ParallelLogic.doParallelRecipes( currentRecipe, recipeMap, @@ -62,7 +70,10 @@ default RecipeBuilder findMultipliedParallelRecipe(@Nonnull RecipeMap reci * @param voidable the voidable performing the parallel recipe * @return the recipe builder with the parallelized recipe. returns null the recipe can't fit */ - default RecipeBuilder findAppendedParallelItemRecipe(@Nonnull RecipeMap recipeMap, @Nonnull IItemHandlerModifiable inputs, @Nonnull IItemHandlerModifiable outputs, int parallelLimit, long maxVoltage, @Nonnull IVoidable voidable) { + default RecipeBuilder findAppendedParallelItemRecipe(@Nonnull RecipeMap recipeMap, + @Nonnull IItemHandlerModifiable inputs, + @Nonnull IItemHandlerModifiable outputs, int parallelLimit, + long maxVoltage, @Nonnull IVoidable voidable) { return ParallelLogic.appendItemRecipes( recipeMap, inputs, @@ -73,11 +84,16 @@ default RecipeBuilder findAppendedParallelItemRecipe(@Nonnull RecipeMap re } // Recipes passed in here should be already trimmed, if desired - default Recipe findParallelRecipe(@Nonnull Recipe currentRecipe, @Nonnull IItemHandlerModifiable inputs, @Nonnull IMultipleTankHandler fluidInputs, @Nonnull IItemHandlerModifiable outputs, @Nonnull IMultipleTankHandler fluidOutputs, long maxVoltage, int parallelLimit) { + default Recipe findParallelRecipe(@Nonnull Recipe currentRecipe, @Nonnull IItemHandlerModifiable inputs, + @Nonnull IMultipleTankHandler fluidInputs, + @Nonnull IItemHandlerModifiable outputs, + @Nonnull IMultipleTankHandler fluidOutputs, long maxVoltage, int parallelLimit) { if (parallelLimit > 1 && getRecipeMap() != null) { RecipeBuilder parallelBuilder = switch (getParallelLogicType()) { - case MULTIPLY -> findMultipliedParallelRecipe(getRecipeMap(), currentRecipe, inputs, fluidInputs, outputs, fluidOutputs, parallelLimit, maxVoltage, getMetaTileEntity()); - case APPEND_ITEMS -> findAppendedParallelItemRecipe(getRecipeMap(), inputs, outputs, parallelLimit, maxVoltage, getMetaTileEntity()); + case MULTIPLY -> findMultipliedParallelRecipe(getRecipeMap(), currentRecipe, inputs, fluidInputs, + outputs, fluidOutputs, parallelLimit, maxVoltage, getMetaTileEntity()); + case APPEND_ITEMS -> findAppendedParallelItemRecipe(getRecipeMap(), inputs, outputs, parallelLimit, + maxVoltage, getMetaTileEntity()); }; // if the builder returned is null, no recipe was found. @@ -85,13 +101,13 @@ default Recipe findParallelRecipe(@Nonnull Recipe currentRecipe, @Nonnull IItemH invalidateInputs(); return null; } else { - //if the builder returned does not parallel, its outputs are full + // if the builder returned does not parallel, its outputs are full if (parallelBuilder.getParallel() == 0) { invalidateOutputs(); return null; } else { setParallelRecipesPerformed(parallelBuilder.getParallel()); - //apply any parallel bonus + // apply any parallel bonus applyParallelBonus(parallelBuilder); return parallelBuilder.build().getResult(); } diff --git a/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java b/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java index 3d23c6ee91b..bb9a6787954 100644 --- a/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java +++ b/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java @@ -27,7 +27,8 @@ public class OverclockingLogic { * @return an int array of {OverclockedEUt, OverclockedDuration} */ @Nonnull - public static int[] standardOverclockingLogic(int recipeEUt, long maxVoltage, int recipeDuration, int numberOfOCs, double durationDivisor, double voltageMultiplier) { + public static int[] standardOverclockingLogic(int recipeEUt, long maxVoltage, int recipeDuration, int numberOfOCs, + double durationDivisor, double voltageMultiplier) { double resultDuration = recipeDuration; double resultVoltage = recipeEUt; @@ -53,7 +54,7 @@ public static int[] standardOverclockingLogic(int recipeEUt, long maxVoltage, in resultVoltage = potentialVoltage; } - return new int[]{(int) resultVoltage, (int) resultDuration}; + return new int[] { (int) resultVoltage, (int) resultDuration }; } /** @@ -68,7 +69,7 @@ private static int calculateAmountCoilEUtDiscount(int providedTemp, int required /** * Handles applying the coil EU/t discount. Call before overclocking. * - * @param recipeEUt the EU/t of the recipe + * @param recipeEUt the EU/t of the recipe * @param providedTemp the temperate provided by the machine * @param requiredTemp the required temperature of the recipe * @return the discounted EU/t @@ -81,19 +82,24 @@ public static int applyCoilEUtDiscount(int recipeEUt, int providedTemp, int requ } @Nonnull - public static int[] heatingCoilOverclockingLogic(int recipeEUt, long maximumVoltage, int recipeDuration, int maxOverclocks, int currentTemp, int recipeRequiredTemp) { + public static int[] heatingCoilOverclockingLogic(int recipeEUt, long maximumVoltage, int recipeDuration, + int maxOverclocks, int currentTemp, int recipeRequiredTemp) { int amountPerfectOC = calculateAmountCoilEUtDiscount(currentTemp, recipeRequiredTemp) / 2; // perfect overclock for every 1800k over recipe temperature if (amountPerfectOC > 0) { // use the normal overclock logic to do perfect OCs up to as many times as calculated - int[] overclock = standardOverclockingLogic(recipeEUt, maximumVoltage, recipeDuration, amountPerfectOC, PERFECT_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); + int[] overclock = standardOverclockingLogic(recipeEUt, maximumVoltage, recipeDuration, amountPerfectOC, + PERFECT_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); // overclock normally as much as possible after perfects are exhausted - return standardOverclockingLogic(overclock[0], maximumVoltage, overclock[1], maxOverclocks - amountPerfectOC, STANDARD_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); + return standardOverclockingLogic(overclock[0], maximumVoltage, overclock[1], + maxOverclocks - amountPerfectOC, STANDARD_OVERCLOCK_DURATION_DIVISOR, + STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); } // no perfects are performed, do normal overclocking - return standardOverclockingLogic(recipeEUt, maximumVoltage, recipeDuration, maxOverclocks, STANDARD_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); + return standardOverclockingLogic(recipeEUt, maximumVoltage, recipeDuration, maxOverclocks, + STANDARD_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); } } diff --git a/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java b/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java index 7d6baa4a9d7..9640df1db80 100644 --- a/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java +++ b/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java @@ -11,18 +11,21 @@ import gregtech.api.util.ItemStackHashStrategy; import gregtech.api.util.OverlayedFluidHandler; import gregtech.api.util.OverlayedItemHandler; -import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.*; +import javax.annotation.Nonnull; + public abstract class ParallelLogic { /** @@ -33,7 +36,8 @@ public abstract class ParallelLogic { * @return returns the amount of possible time a recipe can be made from a given input inventory */ - public static int getMaxRecipeMultiplier(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable inputs, @Nonnull IMultipleTankHandler fluidInputs, int parallelAmount) { + public static int getMaxRecipeMultiplier(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable inputs, + @Nonnull IMultipleTankHandler fluidInputs, int parallelAmount) { // Find all the items in the combined Item Input inventories and create oversized ItemStacks Object2IntMap ingredientStacks = GTHashMaps.fromItemHandler(inputs); @@ -62,11 +66,14 @@ public static int getMaxRecipeMultiplier(@Nonnull Recipe recipe, @Nonnull IItemH * @param voidFluids If the result of the fluid parallel limiting should be ignored * @return returns the amount of recipes that can be merged successfully into a given output inventory */ - public static int limitByOutputMerging(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable outputs, @Nonnull IMultipleTankHandler fluidOutputs, int parallelAmount, boolean voidItems, boolean voidFluids) { + public static int limitByOutputMerging(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable outputs, + @Nonnull IMultipleTankHandler fluidOutputs, int parallelAmount, + boolean voidItems, boolean voidFluids) { int modifiedItemParallelAmount = Integer.MAX_VALUE; int modifiedFluidParallelAmount = Integer.MAX_VALUE; - // If we are voiding both items and fluids, return the maximum number of parallels that can be performed from the inputs + // If we are voiding both items and fluids, return the maximum number of parallels that can be performed from + // the inputs if (voidItems && voidFluids) { return parallelAmount; } @@ -77,7 +84,8 @@ public static int limitByOutputMerging(@Nonnull Recipe recipe, @Nonnull IItemHan if (voidItems) { modifiedItemParallelAmount = parallelAmount; } else { - modifiedItemParallelAmount = limitParallelByItems(recipe, new OverlayedItemHandler(outputs), parallelAmount); + modifiedItemParallelAmount = limitParallelByItems(recipe, new OverlayedItemHandler(outputs), + parallelAmount); } // If we are not voiding, and cannot fit any items, return 0 @@ -91,7 +99,8 @@ public static int limitByOutputMerging(@Nonnull Recipe recipe, @Nonnull IItemHan if (voidFluids) { modifiedFluidParallelAmount = parallelAmount; } else { - modifiedFluidParallelAmount = limitParallelByFluids(recipe, new OverlayedFluidHandler(fluidOutputs), modifiedItemParallelAmount); + modifiedFluidParallelAmount = limitParallelByFluids(recipe, new OverlayedFluidHandler(fluidOutputs), + modifiedItemParallelAmount); } // If we are not voiding, and cannot fit any fluids, return 0 @@ -106,11 +115,13 @@ public static int limitByOutputMerging(@Nonnull Recipe recipe, @Nonnull IItemHan /** * @param recipe the recipe from which we get the input to product ratio * @param multiplier the maximum possible multiplied we can get from the input inventory - * see {@link ParallelLogic#getMaxRecipeMultiplier(Recipe, IItemHandlerModifiable, IMultipleTankHandler, int)} + * see + * {@link ParallelLogic#getMaxRecipeMultiplier(Recipe, IItemHandlerModifiable, IMultipleTankHandler, int)} * @return the amount of times a {@link Recipe} outputs can be merged into an inventory without - * voiding products. + * voiding products. */ - public static int limitParallelByItems(@Nonnull Recipe recipe, @Nonnull OverlayedItemHandler overlayedItemHandler, int multiplier) { + public static int limitParallelByItems(@Nonnull Recipe recipe, @Nonnull OverlayedItemHandler overlayedItemHandler, + int multiplier) { int minMultiplier = 0; int maxMultiplier = multiplier; @@ -150,11 +161,15 @@ public static int limitParallelByItems(@Nonnull Recipe recipe, @Nonnull Overlaye * @param recipeOutputList the recipe outputs from the recipe we are building up to its maximum parallel limit * @param outputsToAppend the recipe outputs from the recipe we want to append to the recipe we are building * @param multiplier the maximum possible multiplied we can get from the input inventory - * see {@link ParallelLogic#getMaxRecipeMultiplier(Recipe, IItemHandlerModifiable, IMultipleTankHandler, int)} + * see + * {@link ParallelLogic#getMaxRecipeMultiplier(Recipe, IItemHandlerModifiable, IMultipleTankHandler, int)} * @return the amount of times a {@link Recipe} outputs can be merged into an inventory without - * voiding products. + * voiding products. */ - public static int limitParallelByItemsIncremental(@Nonnull List recipeOutputList, @Nonnull List outputsToAppend, @Nonnull OverlayedItemHandler overlayedItemHandler, final int multiplier) { + public static int limitParallelByItemsIncremental(@Nonnull List recipeOutputList, + @Nonnull List outputsToAppend, + @Nonnull OverlayedItemHandler overlayedItemHandler, + final int multiplier) { int minMultiplier = 0; int currentMultiplier = multiplier; int maxMultiplier = multiplier; @@ -163,8 +178,10 @@ public static int limitParallelByItemsIncremental(@Nonnull List recip Object2IntMap recipeOutputs = GTHashMaps.fromItemStackCollection(recipeOutputList); Object2IntMap recipeOutputsToAppend = GTHashMaps.fromItemStackCollection(outputsToAppend); - Object2IntMap appendedResultMap = new Object2IntLinkedOpenCustomHashMap<>(recipeOutputs, ItemStackHashStrategy.comparingAllButCount()); - recipeOutputsToAppend.forEach((stackKey, amt) -> appendedResultMap.merge(stackKey, amt * multiplier, Integer::sum)); + Object2IntMap appendedResultMap = new Object2IntLinkedOpenCustomHashMap<>(recipeOutputs, + ItemStackHashStrategy.comparingAllButCount()); + recipeOutputsToAppend + .forEach((stackKey, amt) -> appendedResultMap.merge(stackKey, amt * multiplier, Integer::sum)); while (minMultiplier != maxMultiplier) { overlayedItemHandler.reset(); @@ -210,7 +227,7 @@ public static int limitParallelByItemsIncremental(@Nonnull List recip * @param multiplier the current multiplier * @param maxMultiplier the last know multiplier that resulted in simulation failure * @return an array consisting of the last known multiplier, new multiplier to be attempted and - * the last know multiplier that resulted in failure + * the last know multiplier that resulted in failure */ @Nonnull public static int[] adjustMultiplier(boolean mergedAll, int minMultiplier, int multiplier, int maxMultiplier) { @@ -225,17 +242,19 @@ public static int[] adjustMultiplier(boolean mergedAll, int minMultiplier, int m if (maxMultiplier - minMultiplier <= 1) { multiplier = maxMultiplier = minMultiplier; } - return new int[]{minMultiplier, multiplier, maxMultiplier}; + return new int[] { minMultiplier, multiplier, maxMultiplier }; } /** * @param recipe the recipe from which we get the fluid input to product ratio * @param multiplier the maximum possible multiplied we can get from the input tanks - * see {@link ParallelLogic#getMaxRecipeMultiplier(Recipe, IItemHandlerModifiable, IMultipleTankHandler, int)} + * see + * {@link ParallelLogic#getMaxRecipeMultiplier(Recipe, IItemHandlerModifiable, IMultipleTankHandler, int)} * @return the amount of times a {@link Recipe} outputs can be merged into a fluid handler without - * voiding products. + * voiding products. */ - public static int limitParallelByFluids(@Nonnull Recipe recipe, @Nonnull OverlayedFluidHandler overlayedFluidHandler, int multiplier) { + public static int limitParallelByFluids(@Nonnull Recipe recipe, + @Nonnull OverlayedFluidHandler overlayedFluidHandler, int multiplier) { int minMultiplier = 0; int maxMultiplier = multiplier; @@ -271,17 +290,20 @@ public static int limitParallelByFluids(@Nonnull Recipe recipe, @Nonnull Overlay } /** - * Finds the maximum number of Recipes that can be performed at the same time based on the items in the item input inventory + * Finds the maximum number of Recipes that can be performed at the same time based on the items in the item input + * inventory * - * @param countIngredients a {@link Map} of {@link ItemStack}s that is the result of calling {@link GTHashMaps#fromItemHandler(IItemHandler)} + * @param countIngredients a {@link Map} of {@link ItemStack}s that is the result of calling + * {@link GTHashMaps#fromItemHandler(IItemHandler)} * @param recipe The {@link Recipe} for which to find the maximum that can be run simultaneously * @param parallelAmount The limit on the amount of recipes that can be performed at one time * @return The Maximum number of Recipes that can be performed at a single time based on the available Items */ - protected static int getMaxRatioItem(@Nonnull Object2IntMap countIngredients, @Nonnull Recipe recipe, int parallelAmount) { + protected static int getMaxRatioItem(@Nonnull Object2IntMap countIngredients, @Nonnull Recipe recipe, + int parallelAmount) { int minMultiplier = Integer.MAX_VALUE; - //map the recipe ingredients to account for duplicated and notConsumable ingredients. - //notConsumable ingredients are not counted towards the max ratio + // map the recipe ingredients to account for duplicated and notConsumable ingredients. + // notConsumable ingredients are not counted towards the max ratio Object2IntOpenHashMap notConsumableMap = new Object2IntOpenHashMap<>(); Object2IntOpenHashMap countableMap = new Object2IntOpenHashMap<>(); for (GTRecipeInput recipeIngredient : recipe.getInputs()) { @@ -315,16 +337,20 @@ protected static int getMaxRatioItem(@Nonnull Object2IntMap countIngr } } } - // We need to check >= available here because of Non-Consumable inputs with stack size. If there is a NC input - // with size 2, and only 1 in the input, needed will be equal to available, but this situation should still fail + // We need to check >= available here because of Non-Consumable inputs with stack size. If there is a NC + // input + // with size 2, and only 1 in the input, needed will be equal to available, but this situation should still + // fail // as not all inputs are present if (needed >= available) { return 0; } } - // Return the maximum parallel limit here if there are only non-consumed inputs, which are all found in the input bus - // At this point, we would have already returned 0 if we were missing any non-consumable inputs, so we can omit that check + // Return the maximum parallel limit here if there are only non-consumed inputs, which are all found in the + // input bus + // At this point, we would have already returned 0 if we were missing any non-consumable inputs, so we can omit + // that check if (countableMap.isEmpty() && !notConsumableMap.isEmpty()) { return parallelAmount; } @@ -354,24 +380,28 @@ protected static int getMaxRatioItem(@Nonnull Object2IntMap countIngr /** * Finds the maximum number of a specific recipe that can be performed based upon the fluids in the fluid inputs * - * @param countFluid a {@link Set} of {@link FluidStack}s that is the result of calling {@link GTHashMaps#fromFluidHandler(IFluidHandler)} + * @param countFluid a {@link Set} of {@link FluidStack}s that is the result of calling + * {@link GTHashMaps#fromFluidHandler(IFluidHandler)} * @param recipe The {@link Recipe} for which to find the maximum that can be run simultaneously * @param parallelAmount The limit on the amount of recipes that can be performed at one time * @return The Maximum number of Recipes that can be performed at a single time based on the available Fluids */ - protected static int getMaxRatioFluid(@Nonnull Map countFluid, @Nonnull Recipe recipe, int parallelAmount) { + protected static int getMaxRatioFluid(@Nonnull Map countFluid, @Nonnull Recipe recipe, + int parallelAmount) { int minMultiplier = Integer.MAX_VALUE; - //map the recipe input fluids to account for duplicated fluids, - //so their sum is counted against the total of fluids available in the input + // map the recipe input fluids to account for duplicated fluids, + // so their sum is counted against the total of fluids available in the input Map fluidCountMap = new HashMap<>(); Map notConsumableMap = new HashMap<>(); for (GTRecipeInput fluidInput : recipe.getFluidInputs()) { int fluidAmount = fluidInput.getAmount(); if (fluidInput.isNonConsumable()) { - notConsumableMap.computeIfPresent(new FluidKey(fluidInput.getInputFluidStack()), (k, v) -> v + fluidAmount); + notConsumableMap.computeIfPresent(new FluidKey(fluidInput.getInputFluidStack()), + (k, v) -> v + fluidAmount); notConsumableMap.putIfAbsent(new FluidKey(fluidInput.getInputFluidStack()), fluidAmount); } else { - fluidCountMap.computeIfPresent(new FluidKey(fluidInput.getInputFluidStack()), (k, v) -> v + fluidAmount); + fluidCountMap.computeIfPresent(new FluidKey(fluidInput.getInputFluidStack()), + (k, v) -> v + fluidAmount); fluidCountMap.putIfAbsent(new FluidKey(fluidInput.getInputFluidStack()), fluidAmount); } } @@ -382,7 +412,8 @@ protected static int getMaxRatioFluid(@Nonnull Map countFluid int available = 0; // For every fluid gathered from the fluid inputs. for (Map.Entry inputFluid : countFluid.entrySet()) { - // Strip the Non-consumable tags here, as FluidKey compares the tags, which causes finding matching fluids + // Strip the Non-consumable tags here, as FluidKey compares the tags, which causes finding matching + // fluids // in the input tanks to fail, because there is nothing in those hatches with a non-consumable tag if (notConsumableFluid.getKey().equals(inputFluid.getKey())) { available = inputFluid.getValue(); @@ -397,16 +428,20 @@ protected static int getMaxRatioFluid(@Nonnull Map countFluid } } } - // We need to check >= available here because of Non-Consumable inputs with stack size. If there is a NC input - // with size 1000, and only 500 in the input, needed will be equal to available, but this situation should still fail + // We need to check >= available here because of Non-Consumable inputs with stack size. If there is a NC + // input + // with size 1000, and only 500 in the input, needed will be equal to available, but this situation should + // still fail // as not all inputs are present if (needed >= available) { return 0; } } - // Return the maximum parallel limit here if there are only non-consumed inputs, which are all found in the input bus - // At this point, we would have already returned 0 if we were missing any non-consumable inputs, so we can omit that check + // Return the maximum parallel limit here if there are only non-consumed inputs, which are all found in the + // input bus + // At this point, we would have already returned 0 if we were missing any non-consumable inputs, so we can omit + // that check if (fluidCountMap.isEmpty() && !notConsumableMap.isEmpty()) { return parallelAmount; } @@ -433,8 +468,14 @@ protected static int getMaxRatioFluid(@Nonnull Map countFluid return minMultiplier; } - // At this point, the recipe is already trimmed according to the item and fluid output limit, so we just need to take care of voiding - public static RecipeBuilder doParallelRecipes(@Nonnull Recipe currentRecipe, @Nonnull RecipeMap recipeMap, @Nonnull IItemHandlerModifiable importInventory, @Nonnull IMultipleTankHandler importFluids, @Nonnull IItemHandlerModifiable exportInventory, @Nonnull IMultipleTankHandler exportFluids, int parallelAmount, long maxVoltage, @Nonnull IVoidable voidable) { + // At this point, the recipe is already trimmed according to the item and fluid output limit, so we just need to + // take care of voiding + public static RecipeBuilder doParallelRecipes(@Nonnull Recipe currentRecipe, @Nonnull RecipeMap recipeMap, + @Nonnull IItemHandlerModifiable importInventory, + @Nonnull IMultipleTankHandler importFluids, + @Nonnull IItemHandlerModifiable exportInventory, + @Nonnull IMultipleTankHandler exportFluids, int parallelAmount, + long maxVoltage, @Nonnull IVoidable voidable) { // First check if we are limited by recipe inputs. This can short circuit a lot of consecutive checking int multiplierByInputs = getMaxRecipeMultiplier(currentRecipe, importInventory, importFluids, parallelAmount); if (multiplierByInputs == 0) { @@ -450,18 +491,19 @@ public static RecipeBuilder doParallelRecipes(@Nonnull Recipe currentRecipe, boolean voidItems = voidable.canVoidRecipeItemOutputs(); boolean voidFluids = voidable.canVoidRecipeFluidOutputs(); - // Simulate the merging of the maximum amount of recipes that can be run with these items // and limit by the amount we can successfully merge int limitByOutput; - limitByOutput = ParallelLogic.limitByOutputMerging(currentRecipe, exportInventory, exportFluids, multiplierByInputs, voidItems, voidFluids); + limitByOutput = ParallelLogic.limitByOutputMerging(currentRecipe, exportInventory, exportFluids, + multiplierByInputs, voidItems, voidFluids); int recipeEUt = currentRecipe.getEUt(); if (recipeEUt != 0) { int limitByVoltage = Math.abs((int) (maxVoltage / recipeEUt)); int parallelizable = Math.min(limitByVoltage, limitByOutput); if (parallelizable != 0) - // Use the minimum between the amount of recipes we can run with available inputs and amount of recipe outputs that can fit + // Use the minimum between the amount of recipes we can run with available inputs and amount of recipe + // outputs that can fit recipeBuilder.append(currentRecipe, Math.min(parallelizable, multiplierByInputs), false); } else if (limitByOutput > 0) { recipeBuilder.append(currentRecipe, limitByOutput, false); @@ -471,7 +513,8 @@ public static RecipeBuilder doParallelRecipes(@Nonnull Recipe currentRecipe, } /** - * Constructs a {@link RecipeBuilder} containing the recipes from the ItemStacks available in the {@code importInventory} + * Constructs a {@link RecipeBuilder} containing the recipes from the ItemStacks available in the + * {@code importInventory} * Does NOT take fluids into account whatsoever * * @param recipeMap The {@link RecipeMap} to search for recipes @@ -480,9 +523,13 @@ public static RecipeBuilder doParallelRecipes(@Nonnull Recipe currentRecipe, * @param parallelAmount The maximum amount of recipes that can be performed at one time * @param maxVoltage The maximum voltage of the machine * @param voidable The MetaTileEntity performing the parallel recipe - * @return A {@link RecipeBuilder} containing the recipes that can be performed in parallel, limited by the ingredients available, and the output space available. + * @return A {@link RecipeBuilder} containing the recipes that can be performed in parallel, limited by the + * ingredients available, and the output space available. */ - public static RecipeBuilder appendItemRecipes(@Nonnull RecipeMap recipeMap, @Nonnull IItemHandlerModifiable importInventory, @Nonnull IItemHandlerModifiable exportInventory, int parallelAmount, long maxVoltage, IVoidable voidable) { + public static RecipeBuilder appendItemRecipes(@Nonnull RecipeMap recipeMap, + @Nonnull IItemHandlerModifiable importInventory, + @Nonnull IItemHandlerModifiable exportInventory, + int parallelAmount, long maxVoltage, IVoidable voidable) { RecipeBuilder recipeBuilder = null; OverlayedItemHandler overlayedItemHandler = new OverlayedItemHandler(exportInventory); @@ -506,11 +553,11 @@ public static RecipeBuilder appendItemRecipes(@Nonnull RecipeMap recipeMap if (matchingRecipe != null) { inputIngredient = matchingRecipe.getInputs().get(0); if (recipeBuilder == null) { - //here we make a copy of the recipe builder of the current recipe map, while zeroing - //the recipe builder EUt, since we're going to add to the total EUt of the recipes appended. - //not zeroing means there is a base cost of 1 recipe EUt while doing parallel recipes - //for example running 2 parallel recipes would cost the EUt of doing 3 recipes. - //same should apply for the recipe map duration + // here we make a copy of the recipe builder of the current recipe map, while zeroing + // the recipe builder EUt, since we're going to add to the total EUt of the recipes appended. + // not zeroing means there is a base cost of 1 recipe EUt while doing parallel recipes + // for example running 2 parallel recipes would cost the EUt of doing 3 recipes. + // same should apply for the recipe map duration recipeBuilder = recipeMap.recipeBuilder().EUt(0).duration(0); } @@ -521,22 +568,24 @@ public static RecipeBuilder appendItemRecipes(@Nonnull RecipeMap recipeMap throw new IllegalStateException( String.format("Got recipe with null ingredient %s", matchingRecipe)); - // Trim the recipe outputs here if required - matchingRecipe = Recipe.trimRecipeOutputs(matchingRecipe, recipeMap, voidable.getItemOutputLimit(), voidable.getFluidOutputLimit()); - + matchingRecipe = Recipe.trimRecipeOutputs(matchingRecipe, recipeMap, voidable.getItemOutputLimit(), + voidable.getFluidOutputLimit()); - //equivalent of getting the max ratio from the inputs from Parallel logic - int ingredientRatio = Math.min(parallelAmount - engagedItems, currentInputItem.getCount() / Math.max(matchingRecipe.getInputs().get(0).getAmount(), 1)); + // equivalent of getting the max ratio from the inputs from Parallel logic + int ingredientRatio = Math.min(parallelAmount - engagedItems, + currentInputItem.getCount() / Math.max(matchingRecipe.getInputs().get(0).getAmount(), 1)); - //how much we can add to the output inventory + // how much we can add to the output inventory int limitByOutput = Integer.MAX_VALUE; if (!voidable.canVoidRecipeItemOutputs()) { - // Limit by the number of recipe outputs and chanced outputs, to simulate cases where 100% chanced outputs were obtained - limitByOutput = limitParallelByItemsIncremental(recipeBuilder.getAllItemOutputs(), matchingRecipe.getOutputs(), overlayedItemHandler, ingredientRatio); + // Limit by the number of recipe outputs and chanced outputs, to simulate cases where 100% chanced + // outputs were obtained + limitByOutput = limitParallelByItemsIncremental(recipeBuilder.getAllItemOutputs(), + matchingRecipe.getOutputs(), overlayedItemHandler, ingredientRatio); } - //amount to actually multiply the recipe by + // amount to actually multiply the recipe by int multiplierRecipeAmount = Math.min(ingredientRatio, limitByOutput); if (multiplierRecipeAmount > 0) { diff --git a/src/main/java/gregtech/api/recipes/machines/IResearchRecipeMap.java b/src/main/java/gregtech/api/recipes/machines/IResearchRecipeMap.java index 197900a00c8..fead3278c62 100644 --- a/src/main/java/gregtech/api/recipes/machines/IResearchRecipeMap.java +++ b/src/main/java/gregtech/api/recipes/machines/IResearchRecipeMap.java @@ -2,9 +2,10 @@ import gregtech.api.recipes.Recipe; +import java.util.Collection; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Collection; public interface IResearchRecipeMap { @@ -12,7 +13,7 @@ public interface IResearchRecipeMap { * Add a recipe to the data stick registry for the {@link gregtech.api.recipes.RecipeMap} * * @param researchId the ID to match recipes to, typically derived from the recipe output - * @param recipe the recipe to add to the registry + * @param recipe the recipe to add to the registry */ void addDataStickEntry(@Nonnull String researchId, @Nonnull Recipe recipe); @@ -27,7 +28,7 @@ public interface IResearchRecipeMap { * Remove a recipe from the data stick registry for the {@link gregtech.api.recipes.RecipeMap} * * @param researchId the ID to match recipes to, typically derived from the recipe output - * @param recipe the recipe to remove from the registry + * @param recipe the recipe to remove from the registry * @return true if the recipe was successfully removed, otherwise false */ boolean removeDataStickEntry(@Nonnull String researchId, @Nonnull Recipe recipe); diff --git a/src/main/java/gregtech/api/recipes/machines/IScannerRecipeMap.java b/src/main/java/gregtech/api/recipes/machines/IScannerRecipeMap.java index f213e2c96b4..e5ae0f57ca3 100644 --- a/src/main/java/gregtech/api/recipes/machines/IScannerRecipeMap.java +++ b/src/main/java/gregtech/api/recipes/machines/IScannerRecipeMap.java @@ -1,8 +1,10 @@ package gregtech.api.recipes.machines; import gregtech.api.recipes.Recipe; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -26,7 +28,8 @@ interface ICustomScannerLogic { * recipe is not found to run. Return null if no recipe should be run by your logic. */ @Nullable - Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage); + Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, + boolean exactVoltage); /** * @return A list of Recipes that are never registered, but are added to JEI to demonstrate the custom logic. diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java index d255e14a345..a3650667c9b 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java @@ -10,38 +10,48 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipeproperties.ResearchProperty; import gregtech.api.recipes.recipeproperties.ResearchPropertyData; + +import net.minecraftforge.items.IItemHandlerModifiable; + import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collection; import java.util.Map; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class RecipeMapAssemblyLine> extends RecipeMap implements IResearchRecipeMap { /** Contains the recipes for each research key */ private final Map> researchEntries = new Object2ObjectOpenHashMap<>(); - public RecipeMapAssemblyLine(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, boolean modifyItemOutputs, - int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); + public RecipeMapAssemblyLine(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, + boolean modifyItemOutputs, + int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, + boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { + super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, + modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); } @Override @Nonnull - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 176) - .widget(new ProgressWidget(200, 80, 1, 54, 72, GuiTextures.PROGRESS_BAR_ASSEMBLY_LINE, ProgressWidget.MoveType.HORIZONTAL)) - .widget(new ProgressWidget(200, 138, 19, 10, 18, GuiTextures.PROGRESS_BAR_ASSEMBLY_LINE_ARROW, ProgressWidget.MoveType.VERTICAL)); + .widget(new ProgressWidget(200, 80, 1, 54, 72, GuiTextures.PROGRESS_BAR_ASSEMBLY_LINE, + ProgressWidget.MoveType.HORIZONTAL)) + .widget(new ProgressWidget(200, 138, 19, 10, 18, GuiTextures.PROGRESS_BAR_ASSEMBLY_LINE_ARROW, + ProgressWidget.MoveType.VERTICAL)); this.addInventorySlotGroup(builder, importItems, importFluids, false, yOffset); this.addInventorySlotGroup(builder, exportItems, exportFluids, true, yOffset); return builder; } @Override - protected void addInventorySlotGroup(ModularUI.Builder builder, @Nonnull IItemHandlerModifiable itemHandler, @Nonnull FluidTankList fluidHandler, boolean isOutputs, int yOffset) { + protected void addInventorySlotGroup(ModularUI.Builder builder, @Nonnull IItemHandlerModifiable itemHandler, + @Nonnull FluidTankList fluidHandler, boolean isOutputs, int yOffset) { int startInputsX = 80 - 4 * 18; int fluidInputsCount = fluidHandler.getTanks(); int startInputsY = 37 - 2 * 18; @@ -55,7 +65,8 @@ protected void addInventorySlotGroup(ModularUI.Builder builder, @Nonnull IItemHa for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { int slotIndex = i * 4 + j; - addSlot(builder, startInputsX + 18 * j, startInputsY + 18 * i, slotIndex, itemHandler, fluidHandler, false, false); + addSlot(builder, startInputsX + 18 * j, startInputsY + 18 * i, slotIndex, itemHandler, fluidHandler, + false, false); } } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapCokeOven.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapCokeOven.java index 8d736bd3b55..034ec60c4b9 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapCokeOven.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapCokeOven.java @@ -6,19 +6,25 @@ import gregtech.api.gui.widgets.ProgressWidget; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; + import net.minecraftforge.items.IItemHandlerModifiable; public class RecipeMapCokeOven> extends RecipeMap { - public RecipeMapCokeOven(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, boolean modifyItemOutputs, - int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); + public RecipeMapCokeOven(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, + boolean modifyItemOutputs, + int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, + boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { + super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, + modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); } @Override - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 100) - .widget(new ProgressWidget(200, 70, 19, 36, 18, GuiTextures.PROGRESS_BAR_COKE_OVEN, ProgressWidget.MoveType.HORIZONTAL)); + .widget(new ProgressWidget(200, 70, 19, 36, 18, GuiTextures.PROGRESS_BAR_COKE_OVEN, + ProgressWidget.MoveType.HORIZONTAL)); addSlot(builder, 52, 10, 0, importItems, null, false, false); addSlot(builder, 106, 10, 0, exportItems, null, false, true); addSlot(builder, 106, 28, 0, null, exportFluids, true, true); diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapCrackerUnit.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapCrackerUnit.java index 0a18c706f30..a0af84c51dc 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapCrackerUnit.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapCrackerUnit.java @@ -1,6 +1,5 @@ package gregtech.api.recipes.machines; -import com.google.common.util.concurrent.AtomicDouble; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -8,20 +7,27 @@ import gregtech.api.gui.widgets.RecipeProgressWidget; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; + import net.minecraftforge.items.IItemHandlerModifiable; + +import com.google.common.util.concurrent.AtomicDouble; import org.apache.commons.lang3.tuple.Pair; import java.util.function.DoubleSupplier; public class RecipeMapCrackerUnit> extends RecipeMap { - public RecipeMapCrackerUnit(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, boolean modifyItemOutputs, - int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); + public RecipeMapCrackerUnit(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, + boolean modifyItemOutputs, + int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, + boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { + super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, + modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); } @Override - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { ModularUI.Builder builder = ModularUI.defaultBuilder(yOffset); if (getMaxInputs() == 1) { addSlot(builder, 52, 24 + yOffset, 0, importItems, importFluids, false, false); @@ -29,7 +35,8 @@ public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, int[] grid = determineSlotsGrid(getMaxInputs()); for (int y = 0; y < grid[1]; y++) { for (int x = 0; x < grid[0]; x++) { - addSlot(builder, 34 + (x * 18) - (Math.max(0, grid[0] - 2) * 18), 24 + (y * 18) - (Math.max(0, grid[1] - 1) * 18) + yOffset, + addSlot(builder, 34 + (x * 18) - (Math.max(0, grid[0] - 2) * 18), + 24 + (y * 18) - (Math.max(0, grid[1] - 1) * 18) + yOffset, y * grid[0] + x, importItems, importFluids, false, false); } } @@ -40,14 +47,18 @@ public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, addSlot(builder, 34, 24 + yOffset + 19 + 18, 1, importItems, importFluids, true, false); Pair suppliers = createPairedSupplier(200, 41, 0.5); - builder.widget(new RecipeProgressWidget(suppliers.getLeft(), 42, 24 + yOffset + 18, 21, 19, GuiTextures.PROGRESS_BAR_CRACKING_INPUT, ProgressWidget.MoveType.VERTICAL, this)); - builder.widget(new RecipeProgressWidget(suppliers.getRight(), 78, 23 + yOffset, 20, 20, progressBarTexture, moveType, this)); + builder.widget(new RecipeProgressWidget(suppliers.getLeft(), 42, 24 + yOffset + 18, 21, 19, + GuiTextures.PROGRESS_BAR_CRACKING_INPUT, ProgressWidget.MoveType.VERTICAL, this)); + builder.widget(new RecipeProgressWidget(suppliers.getRight(), 78, 23 + yOffset, 20, 20, progressBarTexture, + moveType, this)); return builder; } - public static Pair createPairedSupplier(int ticksPerCycle, int width, double splitPoint) { + public static Pair createPairedSupplier(int ticksPerCycle, int width, + double splitPoint) { AtomicDouble tracker = new AtomicDouble(0.0); DoubleSupplier supplier1 = new ProgressWidget.TimedProgressSupplier(ticksPerCycle, width, false) { + @Override public double getAsDouble() { double val = super.getAsDouble(); @@ -55,7 +66,8 @@ public double getAsDouble() { return val >= splitPoint ? 1.0 : (1.0 / splitPoint) * val; } }; - DoubleSupplier supplier2 = () -> tracker.get() >= splitPoint ? (1.0 / (1 - splitPoint)) * (tracker.get() - splitPoint) : 0; + DoubleSupplier supplier2 = () -> tracker.get() >= splitPoint ? + (1.0 / (1 - splitPoint)) * (tracker.get() - splitPoint) : 0; return Pair.of(supplier1, supplier2); } } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapDistillationTower.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapDistillationTower.java index 8fc71d7bb51..d338f8c5898 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapDistillationTower.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapDistillationTower.java @@ -9,22 +9,27 @@ import gregtech.api.gui.widgets.TankWidget; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.builders.UniversalDistillationRecipeBuilder; + import net.minecraftforge.items.IItemHandlerModifiable; public class RecipeMapDistillationTower extends RecipeMap { - public RecipeMapDistillationTower(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, boolean modifyItemOutputs, - int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, boolean modifyFluidOutputs, UniversalDistillationRecipeBuilder defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); + public RecipeMapDistillationTower(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, + boolean modifyItemOutputs, + int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, + boolean modifyFluidOutputs, UniversalDistillationRecipeBuilder defaultRecipe, + boolean isHidden) { + super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, + modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); } @Override - protected void addSlot(ModularUI.Builder builder, int x, int y, int slotIndex, IItemHandlerModifiable itemHandler, FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) { + protected void addSlot(ModularUI.Builder builder, int x, int y, int slotIndex, IItemHandlerModifiable itemHandler, + FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) { if (isFluid) { TankWidget tankWidget = new TankWidget(fluidHandler.getTankAt(slotIndex), x, y, 18, 18); TextureArea base = GuiTextures.FLUID_SLOT; - if (!isOutputs) tankWidget.setBackgroundTexture(base, GuiTextures.BEAKER_OVERLAY_1); else if (slotIndex == 0 || slotIndex == 3 || slotIndex == 6 || slotIndex == 9) @@ -47,10 +52,12 @@ else if (slotIndex == 2 || slotIndex == 5 || slotIndex == 8 || slotIndex == 11) } @Override - //this DOES NOT include machine control widgets or binds player inventory - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + // this DOES NOT include machine control widgets or binds player inventory + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { ModularUI.Builder builder = ModularUI.defaultBuilder(yOffset); - builder.widget(new ProgressWidget(200, 47, 8, 66, 58, GuiTextures.PROGRESS_BAR_DISTILLATION_TOWER, ProgressWidget.MoveType.HORIZONTAL)); + builder.widget(new ProgressWidget(200, 47, 8, 66, 58, GuiTextures.PROGRESS_BAR_DISTILLATION_TOWER, + ProgressWidget.MoveType.HORIZONTAL)); addInventorySlotGroup(builder, importItems, importFluids, false, 9); addInventorySlotGroup(builder, exportItems, exportFluids, true, 9); if (this.specialTexture != null && this.specialTexturePosition != null) @@ -59,7 +66,8 @@ public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, } @Override - protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModifiable itemHandler, FluidTankList fluidHandler, boolean isOutputs, int yOffset) { + protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModifiable itemHandler, + FluidTankList fluidHandler, boolean isOutputs, int yOffset) { int itemInputsCount = itemHandler.getSlots(); int fluidInputsCount = fluidHandler.getTanks(); boolean invertFluids = false; @@ -78,9 +86,11 @@ protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModi if (wasGroupOutput && isOutputs) startInputsY -= 9; if (itemHandler.getSlots() == 6 && fluidHandler.getTanks() == 2 && !isOutputs) startInputsY -= 9; if (!isOutputs) - addSlot(builder, 40, startInputsY + (itemSlotsToDown - 1) * 18 - 18, 0, itemHandler, fluidHandler, invertFluids, false); + addSlot(builder, 40, startInputsY + (itemSlotsToDown - 1) * 18 - 18, 0, itemHandler, fluidHandler, + invertFluids, false); else - addSlot(builder, 94, startInputsY + (itemSlotsToDown - 1) * 18, 0, itemHandler, fluidHandler, invertFluids, true); + addSlot(builder, 94, startInputsY + (itemSlotsToDown - 1) * 18, 0, itemHandler, fluidHandler, invertFluids, + true); if (wasGroupOutput) startInputsY += 2; diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java index 22f63862a4b..561bb506f06 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java @@ -4,17 +4,20 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.builders.SimpleRecipeBuilder; import gregtech.api.recipes.ingredients.GTRecipeItemInput; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public class RecipeMapFluidCanner extends RecipeMap { - public RecipeMapFluidCanner(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { + public RecipeMapFluidCanner(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, + int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); } @@ -25,7 +28,8 @@ public Recipe findRecipe(long voltage, List inputs, List if (recipe != null) return recipe; for (ItemStack input : inputs) { - if (input != null && input != ItemStack.EMPTY && input.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { + if (input != null && input != ItemStack.EMPTY && + input.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { // Make a copy to use for creating recipes ItemStack inputStack = input.copy(); @@ -33,15 +37,16 @@ public Recipe findRecipe(long voltage, List inputs, List // Make another copy to use for draining and filling ItemStack fluidHandlerItemStack = inputStack.copy(); - IFluidHandlerItem fluidHandlerItem = fluidHandlerItemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = fluidHandlerItemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) return null; FluidStack containerFluid = fluidHandlerItem.drain(Integer.MAX_VALUE, true); if (containerFluid != null) { - //if we actually drained something, then it's draining recipe + // if we actually drained something, then it's draining recipe return recipeBuilder() - //we can reuse recipe as long as input container stack fully matches our one + // we can reuse recipe as long as input container stack fully matches our one .inputs(new GTRecipeItemInput(inputStack, 1)) .outputs(fluidHandlerItem.getContainer()) .fluidOutputs(containerFluid) @@ -49,13 +54,13 @@ public Recipe findRecipe(long voltage, List inputs, List .build().getResult(); } - //if we didn't drain anything, try filling container + // if we didn't drain anything, try filling container if (!fluidInputs.isEmpty() && fluidInputs.get(0) != null) { FluidStack inputFluid = fluidInputs.get(0).copy(); inputFluid.amount = fluidHandlerItem.fill(inputFluid, true); if (inputFluid.amount > 0) { return recipeBuilder() - //we can reuse recipe as long as input container stack fully matches our one + // we can reuse recipe as long as input container stack fully matches our one .inputs(new GTRecipeItemInput(inputStack, 1)) .fluidInputs(inputFluid) .outputs(fluidHandlerItem.getContainer()) diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java index 6efc42853c9..bb44e5842d5 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java @@ -11,19 +11,22 @@ import gregtech.api.recipes.ingredients.GTRecipeItemInput; import gregtech.api.util.GTUtility; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.Constants; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public class RecipeMapFormingPress extends RecipeMap { private static ItemStack NAME_MOLD = ItemStack.EMPTY; - public RecipeMapFormingPress(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { + public RecipeMapFormingPress(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, + int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); } @@ -49,7 +52,8 @@ public Recipe findRecipe(long voltage, List inputs, List if (moldStack.isEmpty() && inputStack.isItemEqual(NAME_MOLD)) { // only valid if the name mold has a name, which is stored in the "display" sub-compound - if (inputStack.getTagCompound() != null && inputStack.getTagCompound().hasKey("display", Constants.NBT.TAG_COMPOUND)) { + if (inputStack.getTagCompound() != null && + inputStack.getTagCompound().hasKey("display", Constants.NBT.TAG_COMPOUND)) { moldStack = inputStack; } } else if (itemStack.isEmpty()) { @@ -62,7 +66,8 @@ public Recipe findRecipe(long voltage, List inputs, List ItemStack output = GTUtility.copy(1, itemStack); output.setStackDisplayName(moldStack.getDisplayName()); return this.recipeBuilder() - .notConsumable(new GTRecipeItemInput(moldStack)) //recipe is reusable as long as mold stack matches + .notConsumable(new GTRecipeItemInput(moldStack)) // recipe is reusable as long as mold stack + // matches .inputs(GTUtility.copy(1, itemStack)) .outputs(output) .duration(40).EUt(4) @@ -74,7 +79,8 @@ public Recipe findRecipe(long voltage, List inputs, List } @Override - protected void addSlot(ModularUI.Builder builder, int x, int y, int slotIndex, IItemHandlerModifiable itemHandler, FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) { + protected void addSlot(ModularUI.Builder builder, int x, int y, int slotIndex, IItemHandlerModifiable itemHandler, + FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) { SlotWidget slotWidget = new SlotWidget(itemHandler, slotIndex, x, y, true, !isOutputs); TextureArea base = GuiTextures.SLOT; if (isOutputs) diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java index 513f6a3d400..4d27dd2bca5 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java @@ -5,18 +5,21 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.builders.SimpleRecipeBuilder; import gregtech.api.util.GTUtility; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public class RecipeMapFurnace extends RecipeMap { public static final int RECIPE_EUT = 4; public static final int RECIPE_DURATION = 128; - public RecipeMapFurnace(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { + public RecipeMapFurnace(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, + int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapResearchStation.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapResearchStation.java index ea3a7099d37..f75138d6f27 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapResearchStation.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapResearchStation.java @@ -8,7 +8,9 @@ import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; + import net.minecraftforge.items.IItemHandlerModifiable; + import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; @@ -17,18 +19,22 @@ public class RecipeMapResearchStation> extends RecipeMap implements IScannerRecipeMap { public RecipeMapResearchStation(@NotNull String unlocalizedName, int maxInputs, int maxOutputs, - int maxFluidInputs, int maxFluidOutputs, @NotNull R defaultRecipeBuilder, boolean isHidden) { + int maxFluidInputs, int maxFluidOutputs, @NotNull R defaultRecipeBuilder, + boolean isHidden) { super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipeBuilder, isHidden); } @Override @NotNull - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { Pair pairedSuppliers = RecipeMapCrackerUnit.createPairedSupplier(200, 90, 0.75); return ModularUI.builder(GuiTextures.BACKGROUND, 176, 166) .widget(new ImageWidget(10, 0, 84, 60, GuiTextures.PROGRESS_BAR_RESEARCH_STATION_BASE)) - .widget(new ProgressWidget(pairedSuppliers.getLeft(), 72, 28, 54, 5, GuiTextures.PROGRESS_BAR_RESEARCH_STATION_1, ProgressWidget.MoveType.HORIZONTAL)) - .widget(new ProgressWidget(pairedSuppliers.getRight(), 119, 32, 10, 18, GuiTextures.PROGRESS_BAR_RESEARCH_STATION_2, ProgressWidget.MoveType.VERTICAL_DOWNWARDS)) + .widget(new ProgressWidget(pairedSuppliers.getLeft(), 72, 28, 54, 5, + GuiTextures.PROGRESS_BAR_RESEARCH_STATION_1, ProgressWidget.MoveType.HORIZONTAL)) + .widget(new ProgressWidget(pairedSuppliers.getRight(), 119, 32, 10, 18, + GuiTextures.PROGRESS_BAR_RESEARCH_STATION_2, ProgressWidget.MoveType.VERTICAL_DOWNWARDS)) .widget(new SlotWidget(importItems, 0, 115, 50, true, true) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.DATA_ORB_OVERLAY)) .widget(new SlotWidget(importItems, 1, 43, 21, true, true) diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java index c404b7d173a..a0b297d8a83 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java @@ -3,19 +3,23 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.builders.SimpleRecipeBuilder; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + public class RecipeMapScanner extends RecipeMap implements IScannerRecipeMap { private static final List CUSTOM_SCANNER_LOGICS = new ArrayList<>(); - public RecipeMapScanner(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { + public RecipeMapScanner(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, + int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); } diff --git a/src/main/java/gregtech/api/recipes/map/Branch.java b/src/main/java/gregtech/api/recipes/map/Branch.java index de452fbbc42..f6e61e15689 100644 --- a/src/main/java/gregtech/api/recipes/map/Branch.java +++ b/src/main/java/gregtech/api/recipes/map/Branch.java @@ -1,13 +1,16 @@ package gregtech.api.recipes.map; import gregtech.api.recipes.Recipe; + import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import javax.annotation.Nonnull; import java.util.Map; import java.util.stream.Stream; +import javax.annotation.Nonnull; + public class Branch { + // Keys on this have *(should)* unique hashcodes. private Map> nodes; // Keys on this have collisions, and must be differentiated by equality. @@ -16,13 +19,16 @@ public class Branch { public Stream getRecipes(boolean filterHidden) { Stream stream = null; if (nodes != null) { - stream = nodes.values().stream().flatMap(either -> either.map(Stream::of, right -> right.getRecipes(filterHidden))); + stream = nodes.values().stream() + .flatMap(either -> either.map(Stream::of, right -> right.getRecipes(filterHidden))); } if (specialNodes != null) { if (stream == null) { - stream = specialNodes.values().stream().flatMap(either -> either.map(Stream::of, right -> right.getRecipes(filterHidden))); + stream = specialNodes.values().stream() + .flatMap(either -> either.map(Stream::of, right -> right.getRecipes(filterHidden))); } else { - stream = Stream.concat(stream, specialNodes.values().stream().flatMap(either -> either.map(Stream::of, right -> right.getRecipes(filterHidden)))); + stream = Stream.concat(stream, specialNodes.values().stream() + .flatMap(either -> either.map(Stream::of, right -> right.getRecipes(filterHidden)))); } } if (stream == null) { diff --git a/src/main/java/gregtech/api/recipes/map/Either.java b/src/main/java/gregtech/api/recipes/map/Either.java index c9cbf0b8987..cfe5e1356a6 100644 --- a/src/main/java/gregtech/api/recipes/map/Either.java +++ b/src/main/java/gregtech/api/recipes/map/Either.java @@ -7,6 +7,7 @@ public abstract class Either { private static final class Left extends Either { + private final L value; public Left(final L value) { @@ -14,7 +15,8 @@ public Left(final L value) { } @Override - public Either mapBoth(final Function f1, final Function f2) { + public Either mapBoth(final Function f1, + final Function f2) { return new Left<>(f1.apply(value)); } @@ -67,8 +69,8 @@ public int hashCode() { } } - private static final class Right extends Either { + private final R value; public Right(final R value) { @@ -76,7 +78,8 @@ public Right(final R value) { } @Override - public Either mapBoth(final Function f1, final Function f2) { + public Either mapBoth(final Function f1, + final Function f2) { return new Right<>(f2.apply(value)); } @@ -129,10 +132,10 @@ public int hashCode() { } } - private Either() { - } + private Either() {} - public abstract Either mapBoth(final Function f1, final Function f2); + public abstract Either mapBoth(final Function f1, + final Function f2); public abstract T map(final Function l, Function r); diff --git a/src/main/java/gregtech/api/recipes/map/MapFluidIngredient.java b/src/main/java/gregtech/api/recipes/map/MapFluidIngredient.java index 0e12e99b277..354358916bc 100644 --- a/src/main/java/gregtech/api/recipes/map/MapFluidIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapFluidIngredient.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.map; import gregtech.api.recipes.ingredients.GTRecipeInput; + import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -25,7 +26,8 @@ public MapFluidIngredient(FluidStack fluidStack) { @Override protected int hash() { - //the Fluid registered to the fluidName on game load might not be the same Fluid after loading the world, but will still have the same fluidName. + // the Fluid registered to the fluidName on game load might not be the same Fluid after loading the world, but + // will still have the same fluidName. int hash = 31 + fluid.getName().hashCode(); if (tag != null) { return 31 * hash + tag.hashCode(); @@ -37,7 +39,8 @@ protected int hash() { public boolean equals(Object o) { if (super.equals(o)) { MapFluidIngredient other = (MapFluidIngredient) o; - //the Fluid registered to the fluidName on game load might not be the same Fluid after loading the world, but will still have the same fluidName. + // the Fluid registered to the fluidName on game load might not be the same Fluid after loading the world, + // but will still have the same fluidName. if (this.fluid.getName().equals(other.fluid.getName())) { return Objects.equals(tag, other.tag); } diff --git a/src/main/java/gregtech/api/recipes/map/MapItemStackIngredient.java b/src/main/java/gregtech/api/recipes/map/MapItemStackIngredient.java index 9681f28ce80..ec9dffd4b36 100644 --- a/src/main/java/gregtech/api/recipes/map/MapItemStackIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapItemStackIngredient.java @@ -1,15 +1,17 @@ package gregtech.api.recipes.map; import gregtech.api.recipes.ingredients.GTRecipeInput; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import java.util.List; -public class MapItemStackIngredient extends AbstractMapIngredient { +import javax.annotation.Nonnull; +public class MapItemStackIngredient extends AbstractMapIngredient { protected ItemStack stack; protected int meta; @@ -69,6 +71,7 @@ protected int hash() { @Override public String toString() { - return "MapItemStackIngredient{" + "item=" + stack.getItem().getRegistryName() + "} {meta=" + meta + "} {tag=" + tag + "}"; + return "MapItemStackIngredient{" + "item=" + stack.getItem().getRegistryName() + "} {meta=" + meta + "} {tag=" + + tag + "}"; } } diff --git a/src/main/java/gregtech/api/recipes/map/MapItemStackNBTIngredient.java b/src/main/java/gregtech/api/recipes/map/MapItemStackNBTIngredient.java index 1b6b0df3ed8..8261cb94461 100644 --- a/src/main/java/gregtech/api/recipes/map/MapItemStackNBTIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapItemStackNBTIngredient.java @@ -1,14 +1,18 @@ package gregtech.api.recipes.map; import gregtech.api.recipes.ingredients.GTRecipeInput; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import java.util.List; +import javax.annotation.Nonnull; + public class MapItemStackNBTIngredient extends MapItemStackIngredient { + protected GTRecipeInput gtRecipeInput = null; public MapItemStackNBTIngredient(ItemStack stack, int meta, NBTTagCompound tag) { diff --git a/src/main/java/gregtech/api/recipes/map/MapOreDictIngredient.java b/src/main/java/gregtech/api/recipes/map/MapOreDictIngredient.java index 4814f5bdfc0..f02df80bc9c 100644 --- a/src/main/java/gregtech/api/recipes/map/MapOreDictIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapOreDictIngredient.java @@ -20,5 +20,4 @@ public boolean equals(Object obj) { } return false; } - } diff --git a/src/main/java/gregtech/api/recipes/map/MapOreDictNBTIngredient.java b/src/main/java/gregtech/api/recipes/map/MapOreDictNBTIngredient.java index 953c19b2a4d..e0dc3939107 100644 --- a/src/main/java/gregtech/api/recipes/map/MapOreDictNBTIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapOreDictNBTIngredient.java @@ -1,7 +1,8 @@ package gregtech.api.recipes.map; -import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; +import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; + import net.minecraft.nbt.NBTTagCompound; import javax.annotation.Nullable; diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/CleanroomProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/CleanroomProperty.java index 0418211d0db..1235a278cf7 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/CleanroomProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/CleanroomProperty.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.recipeproperties; import gregtech.api.metatileentity.multiblock.CleanroomType; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/ComputationProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/ComputationProperty.java index 47542ab97bb..20fa33c1a05 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/ComputationProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/ComputationProperty.java @@ -22,6 +22,7 @@ public static ComputationProperty getInstance() { @Override public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.computation_per_tick", castValue(value)), x, y, color); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.computation_per_tick", castValue(value)), x, y, + color); } } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java index 7c444f32bc8..9620d1b6a22 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java @@ -13,5 +13,4 @@ public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe." + getKey(), castValue(value)), x, y, color); } - } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/EmptyRecipePropertyStorage.java b/src/main/java/gregtech/api/recipes/recipeproperties/EmptyRecipePropertyStorage.java index 2310d82d6ad..89f6bb201d6 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/EmptyRecipePropertyStorage.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/EmptyRecipePropertyStorage.java @@ -8,9 +8,7 @@ public final class EmptyRecipePropertyStorage implements IRecipePropertyStorage public static final EmptyRecipePropertyStorage INSTANCE = new EmptyRecipePropertyStorage(); - private EmptyRecipePropertyStorage() { - - } + private EmptyRecipePropertyStorage() {} @Override public boolean store(RecipeProperty recipeProperty, Object value) { @@ -23,9 +21,7 @@ public boolean remove(RecipeProperty recipeProperty) { } @Override - public void freeze(boolean frozen) { - - } + public void freeze(boolean frozen) {} @Override public IRecipePropertyStorage copy() { diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/FusionEUToStartProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/FusionEUToStartProperty.java index d1742922576..12fd90e7748 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/FusionEUToStartProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/FusionEUToStartProperty.java @@ -1,8 +1,10 @@ package gregtech.api.recipes.recipeproperties; import gregtech.api.util.TextFormattingUtil; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; + import org.apache.commons.lang3.Validate; import java.util.Map; @@ -31,7 +33,8 @@ public static FusionEUToStartProperty getInstance() { @Override public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.eu_to_start", - TextFormattingUtil.formatLongToCompactString(castValue(value))) + getFusionTier(castValue(value)), x, y, color); + TextFormattingUtil.formatLongToCompactString(castValue(value))) + getFusionTier(castValue(value)), x, y, + color); } private static String getFusionTier(Long eu) { @@ -48,6 +51,5 @@ public static void registerFusionTier(int tier, String shortName) { Validate.notNull(shortName); long maxEU = 16 * 10000000L * (long) Math.pow(2, tier - 6); registeredFusionTiers.put(maxEU, shortName); - } } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/GasCollectorDimensionProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/GasCollectorDimensionProperty.java index 7d12ad2f138..94bb810e3b1 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/GasCollectorDimensionProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/GasCollectorDimensionProperty.java @@ -1,15 +1,15 @@ package gregtech.api.recipes.recipeproperties; import gregtech.api.worldgen.config.WorldGenRegistry; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.IntList; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; -import java.util.List; -import java.util.Map; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.IntList; public class GasCollectorDimensionProperty extends RecipeProperty { + public static final String KEY = "dimension"; private static GasCollectorDimensionProperty INSTANCE; @@ -45,5 +45,4 @@ private static String getDimensionsForRecipe(IntList value) { } return str; } - } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/IRecipePropertyStorage.java b/src/main/java/gregtech/api/recipes/recipeproperties/IRecipePropertyStorage.java index bdcbdce5576..234434bf003 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/IRecipePropertyStorage.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/IRecipePropertyStorage.java @@ -59,5 +59,4 @@ public interface IRecipePropertyStorage { * @return {@link Object} value on success; otherwise {@code null} */ Object getRawRecipePropertyValue(String key); - } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/ImplosionExplosiveProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/ImplosionExplosiveProperty.java index 512e837e58d..725129e8843 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/ImplosionExplosiveProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/ImplosionExplosiveProperty.java @@ -10,7 +10,6 @@ public class ImplosionExplosiveProperty extends RecipeProperty { private static ImplosionExplosiveProperty INSTANCE; - private ImplosionExplosiveProperty() { super(KEY, ItemStack.class); } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/PrimitiveProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/PrimitiveProperty.java index 13f689e9401..524fd7180fe 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/PrimitiveProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/PrimitiveProperty.java @@ -22,8 +22,7 @@ public static PrimitiveProperty getInstance() { } @Override - public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { - } + public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) {} @Override public boolean hideTotalEU() { diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/RecipeProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/RecipeProperty.java index a04120bc509..9dde81bb195 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/RecipeProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/RecipeProperty.java @@ -8,6 +8,7 @@ import java.util.Objects; public abstract class RecipeProperty { + private final Class type; private final String key; @@ -25,8 +26,7 @@ public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value, } @SideOnly(Side.CLIENT) - public void getTooltipStrings(List tooltip, int mouseX, int mouseY, Object value) { - } + public void getTooltipStrings(List tooltip, int mouseX, int mouseY, Object value) {} public int getInfoHeight(Object value) { return 10; // GTRecipeWrapper#LINE_HEIGHT diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorage.java b/src/main/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorage.java index 2645053bd93..a74ba78da6d 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorage.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorage.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.recipeproperties; import gregtech.api.util.GTLog; + import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; import java.util.HashSet; @@ -131,5 +132,4 @@ private RecipeProperty getRecipePropertyValue(String key) { return null; } - } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/ResearchPropertyData.java b/src/main/java/gregtech/api/recipes/recipeproperties/ResearchPropertyData.java index 4b60e4f0283..d69a8ec7332 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/ResearchPropertyData.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/ResearchPropertyData.java @@ -2,11 +2,12 @@ import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import javax.annotation.Nonnull; + public final class ResearchPropertyData implements Iterable { private final Collection entries = new ArrayList<>(); @@ -38,7 +39,7 @@ public static final class ResearchEntry { /** * @param researchId the id of the research - * @param dataItem the item allowed to contain the research + * @param dataItem the item allowed to contain the research */ public ResearchEntry(@Nonnull String researchId, @Nonnull ItemStack dataItem) { this.researchId = researchId; diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/TemperatureProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/TemperatureProperty.java index e3cc67122e1..e364e5c0d7e 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/TemperatureProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/TemperatureProperty.java @@ -1,15 +1,19 @@ package gregtech.api.recipes.recipeproperties; import gregtech.api.unification.material.Material; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; + import org.apache.commons.lang3.Validate; -import javax.annotation.Nonnull; import java.util.Map; import java.util.TreeMap; +import javax.annotation.Nonnull; + public class TemperatureProperty extends RecipeProperty { + public static final String KEY = "temperature"; private static final TreeMap registeredCoilTypes = new TreeMap<>((x, y) -> y - x); @@ -65,5 +69,4 @@ public static void registerCoilType(int temperature, Material coilMaterial, Stri registeredCoilTypes.put(temperature, coilMaterial); } } - } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/TotalComputationProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/TotalComputationProperty.java index 32088b197e9..3557539d1ee 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/TotalComputationProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/TotalComputationProperty.java @@ -22,7 +22,8 @@ public static TotalComputationProperty getInstance() { @Override public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.total_computation", castValue(value)), x, y, color); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.total_computation", castValue(value)), x, y, + color); } @Override diff --git a/src/main/java/gregtech/api/storage/ICraftingStorage.java b/src/main/java/gregtech/api/storage/ICraftingStorage.java index 355c26f714a..15d49e87511 100644 --- a/src/main/java/gregtech/api/storage/ICraftingStorage.java +++ b/src/main/java/gregtech/api/storage/ICraftingStorage.java @@ -1,10 +1,12 @@ package gregtech.api.storage; import gregtech.common.metatileentities.storage.CraftingRecipeMemory; + import net.minecraft.world.World; import net.minecraftforge.items.ItemStackHandler; public interface ICraftingStorage { + World getWorld(); ItemStackHandler getCraftingGrid(); diff --git a/src/main/java/gregtech/api/terminal/TerminalRegistry.java b/src/main/java/gregtech/api/terminal/TerminalRegistry.java index b23bfbae207..7e99e758a8a 100644 --- a/src/main/java/gregtech/api/terminal/TerminalRegistry.java +++ b/src/main/java/gregtech/api/terminal/TerminalRegistry.java @@ -30,6 +30,7 @@ import gregtech.common.terminal.app.worldprospector.WorldProspectorARApp; import gregtech.common.terminal.hardware.BatteryHardware; import gregtech.common.terminal.hardware.DeviceHardware; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.SimpleReloadableResourceManager; @@ -40,12 +41,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.io.File; import java.util.*; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class TerminalRegistry { + public static final Map APP_REGISTER = new LinkedHashMap<>(); public static final Map HW_REGISTER = new LinkedHashMap<>(); public static final Map[]> APP_HW_DEMAND = new HashMap<>(); @@ -161,10 +164,10 @@ public static void init() { @SideOnly(Side.CLIENT) public static void initTerminalFiles() { - ((SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(TerminalRegistry::onResourceManagerReload); + ((SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()) + .registerReloadListener(TerminalRegistry::onResourceManagerReload); } - @SideOnly(Side.CLIENT) public static void onResourceManagerReload(IResourceManager resourceManager) { FileUtility.extractJarFiles(String.format("/assets/%s/%s", GTValues.MODID, "terminal"), TERMINAL_PATH, false); @@ -188,7 +191,8 @@ public static void registerHardware(Hardware hardware) { HW_REGISTER.put(name, hardware); } - public static void registerHardwareDemand(String name, boolean isDefaultApp, @Nonnull List[] hardware, @Nonnull List[] upgrade) { + public static void registerHardwareDemand(String name, boolean isDefaultApp, @Nonnull List[] hardware, + @Nonnull List[] upgrade) { if (name != null && APP_REGISTER.containsKey(name)) { if (isDefaultApp) { DEFAULT_APPS.add(name); @@ -225,17 +229,19 @@ public static List getAppHardwareDemand(String name, int tier) { } public static List getAppHardwareUpgradeConditions(String name, int tier) { - return APP_UPGRADE_CONDITIONS.get(name)[tier] != null ? APP_UPGRADE_CONDITIONS.get(name)[tier] : Collections.emptyList(); + return APP_UPGRADE_CONDITIONS.get(name)[tier] != null ? APP_UPGRADE_CONDITIONS.get(name)[tier] : + Collections.emptyList(); } private static class AppRegistryBuilder { + AbstractApplication app; boolean isDefaultApp; BatteryHardware[] battery; List[] hardware; List[] upgrade; - public static AppRegistryBuilder create(AbstractApplication app){ + public static AppRegistryBuilder create(AbstractApplication app) { AppRegistryBuilder builder = new AppRegistryBuilder(); builder.app = app; builder.battery = new BatteryHardware[app.getMaxTier() + 1]; @@ -244,7 +250,7 @@ public static AppRegistryBuilder create(AbstractApplication app){ return builder; } - public AppRegistryBuilder defaultApp(){ + public AppRegistryBuilder defaultApp() { this.isDefaultApp = true; return this; } diff --git a/src/main/java/gregtech/api/terminal/app/ARApplication.java b/src/main/java/gregtech/api/terminal/app/ARApplication.java index 273e11fa631..c5bd9a4e564 100644 --- a/src/main/java/gregtech/api/terminal/app/ARApplication.java +++ b/src/main/java/gregtech/api/terminal/app/ARApplication.java @@ -2,6 +2,7 @@ import gregtech.api.terminal.os.SystemCall; import gregtech.common.items.behaviors.TerminalBehaviour; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.RenderWorldLastEvent; @@ -14,14 +15,19 @@ * @Author: KilaBash * @Date: 2021/09/13 * @Description: Application for AR. - * When AR is running, {@link #tickAR(EntityPlayer)} and {@link #drawARScreen(RenderWorldLastEvent)} will be called when you hold the terminal in one of your hands. - * Therefore, at most one AR app is active on the terminal at any one time. And when you open the terminal GUI it automatically closes the currently running AR. - * You have access to the app's NBT of the handheld terminal when the AR is active, to load configs, init and so on. - * Don't try to write NBT, you should always be aware that the AR is running on the client side. - * if you really want to do something on the server side when AR is running, plz send packets. Because it's always running on the client side!!!!!!!!!! - * (If you need data from NBT, dont forget to write nbt when closeApp {@link #closeApp()}) + * When AR is running, {@link #tickAR(EntityPlayer)} and {@link #drawARScreen(RenderWorldLastEvent)} will + * be called when you hold the terminal in one of your hands. + * Therefore, at most one AR app is active on the terminal at any one time. And when you open the terminal + * GUI it automatically closes the currently running AR. + * You have access to the app's NBT of the handheld terminal when the AR is active, to load configs, init + * and so on. + * Don't try to write NBT, you should always be aware that the AR is running on the client side. + * if you really want to do something on the server side when AR is running, plz send packets. Because + * it's always running on the client side!!!!!!!!!! + * (If you need data from NBT, dont forget to write nbt when closeApp {@link #closeApp()}) */ -public abstract class ARApplication extends AbstractApplication{ +public abstract class ARApplication extends AbstractApplication { + protected ItemStack heldStack; public ARApplication(String name) { @@ -69,9 +75,7 @@ protected final void openAR() { * this will be fired every time you first switch selected slot to the held terminal. */ @SideOnly(Side.CLIENT) - public void onAROpened() { - - } + public void onAROpened() {} /** * this will be fired when switch the current slot (terminal) to other slots or open this terminal. @@ -84,17 +88,17 @@ public void onARClosed() { /** * Be careful! do not try to use non-static field or call a non-static function here. - * This method is called with the registered instance. {@link gregtech.api.terminal.TerminalRegistry#registerApp(AbstractApplication)} + * This method is called with the registered instance. + * {@link gregtech.api.terminal.TerminalRegistry#registerApp(AbstractApplication)} */ @SideOnly(Side.CLIENT) - public void tickAR(EntityPlayer player) { - } + public void tickAR(EntityPlayer player) {} /** * Be careful! do not try to use non-static field or call a non-static function here. - * This method is called with the registered instance. {@link gregtech.api.terminal.TerminalRegistry#registerApp(AbstractApplication)} + * This method is called with the registered instance. + * {@link gregtech.api.terminal.TerminalRegistry#registerApp(AbstractApplication)} */ @SideOnly(Side.CLIENT) public abstract void drawARScreen(RenderWorldLastEvent event); - } diff --git a/src/main/java/gregtech/api/terminal/app/AbstractApplication.java b/src/main/java/gregtech/api/terminal/app/AbstractApplication.java index ae4c53a5d0b..30f5878f829 100644 --- a/src/main/java/gregtech/api/terminal/app/AbstractApplication.java +++ b/src/main/java/gregtech/api/terminal/app/AbstractApplication.java @@ -12,6 +12,7 @@ import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.common.items.behaviors.TerminalBehaviour; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.CompressedStreamTools; @@ -81,7 +82,8 @@ public IGuiTexture getIcon() { @SideOnly(Side.CLIENT) public String getDescription() { if (I18n.hasKey("terminal." + getRegistryName() + ".description")) { - return NEW_LINE_PATTERN.matcher(I18n.format("terminal." + getRegistryName() + ".description")).replaceAll("\n"); + return NEW_LINE_PATTERN.matcher(I18n.format("terminal." + getRegistryName() + ".description")) + .replaceAll("\n"); } return I18n.format("terminal.app_name.description"); } @@ -145,6 +147,7 @@ public AbstractApplication initApp() { /** * you should store the persistent data for both side here. + * * @return nbt data. if its a clientSideApp and the nbt not null, this nbt should be synced to the server side. */ public NBTTagCompound closeApp() { @@ -163,7 +166,9 @@ public boolean isBackgroundApp() { * If the app doesn't require server execution, it better be a client side app. * For details about data synchronization, see {@link #closeApp()} */ - public boolean isClientSideApp() {return false;} + public boolean isClientSideApp() { + return false; + } public TerminalOSWidget getOs() { return os; @@ -171,6 +176,7 @@ public TerminalOSWidget getOs() { /** * Add components to menu bar. + * * @see IMenuComponent */ public List getMenuComponents() { @@ -218,7 +224,8 @@ protected void loadLocalConfig(Consumer reader) { if (isClient && reader != null) { NBTTagCompound nbt = null; try { - nbt = CompressedStreamTools.read(new File(TerminalRegistry.TERMINAL_PATH, String.format("config/%S.nbt", getRegistryName()))); + nbt = CompressedStreamTools.read( + new File(TerminalRegistry.TERMINAL_PATH, String.format("config/%S.nbt", getRegistryName()))); } catch (IOException e) { GTLog.logger.error("error while loading local nbt for {}", getRegistryName(), e); } @@ -238,7 +245,8 @@ protected void saveLocalConfig(Consumer writer) { try { writer.accept(nbt); if (!nbt.isEmpty()) { - CompressedStreamTools.safeWrite(nbt, new File(TerminalRegistry.TERMINAL_PATH, String.format("config/%S.nbt", getRegistryName()))); + CompressedStreamTools.safeWrite(nbt, new File(TerminalRegistry.TERMINAL_PATH, + String.format("config/%S.nbt", getRegistryName()))); } } catch (IOException e) { GTLog.logger.error("error while saving local nbt for {}", getRegistryName(), e); @@ -250,7 +258,8 @@ protected void saveLocalConfig(Consumer writer) { * Fired when you open this app or terminal's size updated. (maximize) */ public void onOSSizeUpdate(int width, int height) { - setSelfPosition(Position.ORIGIN.add(new Position((width - getSize().width) / 2, (height - getSize().height) / 2))); + setSelfPosition( + Position.ORIGIN.add(new Position((width - getSize().width) / 2, (height - getSize().height) / 2))); } public boolean canLaunchConcurrently(AbstractApplication application) { diff --git a/src/main/java/gregtech/api/terminal/gui/CustomTabListRenderer.java b/src/main/java/gregtech/api/terminal/gui/CustomTabListRenderer.java index 6e529bc3725..c3cf0733e93 100644 --- a/src/main/java/gregtech/api/terminal/gui/CustomTabListRenderer.java +++ b/src/main/java/gregtech/api/terminal/gui/CustomTabListRenderer.java @@ -5,17 +5,19 @@ import gregtech.api.gui.widgets.tab.ITabInfo; import gregtech.api.gui.widgets.tab.TabListRenderer; import gregtech.api.util.Position; + import net.minecraft.client.renderer.GlStateManager; import java.util.List; public class CustomTabListRenderer extends TabListRenderer { + private final IGuiTexture unSelected; private final IGuiTexture selected; private final int width; private final int height; - public CustomTabListRenderer(IGuiTexture unSelected, IGuiTexture selected, int width, int height){ + public CustomTabListRenderer(IGuiTexture unSelected, IGuiTexture selected, int width, int height) { this.unSelected = unSelected; this.selected = selected; this.width = width; @@ -23,24 +25,27 @@ public CustomTabListRenderer(IGuiTexture unSelected, IGuiTexture selected, int w } @Override - public void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight, int selectedTabIndex) { + public void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight, + int selectedTabIndex) { int y = offset.y - height; GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), 1.0F); for (int i = 0; i < tabInfos.size(); i++) { int x = offset.x + i * width; if (selectedTabIndex == i && selected != null) { tabInfos.get(i).renderTab(selected, x, y, width, height, true); - GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), 1.0F); + GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), + 1.0F); } if (selectedTabIndex != i && unSelected != null) { tabInfos.get(i).renderTab(unSelected, x, y, width, height, false); - GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), 1.0F); + GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), + 1.0F); } } } @Override public int[] getTabPos(int guiWidth, int guiHeight, int tabIndex) { - return new int[]{width * guiWidth, -height, width, height}; + return new int[] { width * guiWidth, -height, width, height }; } } diff --git a/src/main/java/gregtech/api/terminal/gui/IDraggable.java b/src/main/java/gregtech/api/terminal/gui/IDraggable.java index 5366276a536..33b6cf41719 100644 --- a/src/main/java/gregtech/api/terminal/gui/IDraggable.java +++ b/src/main/java/gregtech/api/terminal/gui/IDraggable.java @@ -1,8 +1,14 @@ package gregtech.api.terminal.gui; public interface IDraggable { + boolean allowDrag(int mouseX, int mouseY, int button); + default void startDrag(int mouseX, int mouseY) {} - default boolean dragging(int mouseX, int mouseY, int deltaX, int deltaY) {return true;} + + default boolean dragging(int mouseX, int mouseY, int deltaX, int deltaY) { + return true; + } + default void endDrag(int mouseX, int mouseY) {} } diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/AnimaWidgetGroup.java b/src/main/java/gregtech/api/terminal/gui/widgets/AnimaWidgetGroup.java index 0083a6c5313..acd2a58bed4 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/AnimaWidgetGroup.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/AnimaWidgetGroup.java @@ -6,6 +6,7 @@ import gregtech.api.util.Size; import gregtech.api.util.interpolate.Eases; import gregtech.api.util.interpolate.Interpolator; + import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -13,6 +14,7 @@ import java.util.function.Consumer; public abstract class AnimaWidgetGroup extends WidgetGroup { + @SideOnly(Side.CLIENT) protected Interpolator interpolator; protected float scale = 1; @@ -38,8 +40,8 @@ public final void maximizeWidget(Consumer callback) { this.scale = 0; setVisible(true); interpolator = new Interpolator(0, 1, 10, Eases.LINEAR, - value-> scale = value.floatValue(), - value-> { + value -> scale = value.floatValue(), + value -> { interpolator = null; if (callback != null) { callback.accept(this); @@ -52,8 +54,8 @@ public final void maximizeWidget(Consumer callback) { public final void minimizeWidget(Consumer callback) { this.scale = 1; interpolator = new Interpolator(1, 0, 10, Eases.LINEAR, - value-> scale = value.floatValue(), - value-> { + value -> scale = value.floatValue(), + value -> { setVisible(false); interpolator = null; if (callback != null) { @@ -77,7 +79,8 @@ protected void hookDrawInForeground(int mouseX, int mouseY) { public final void drawInForeground(int mouseX, int mouseY) { if (scale == 0) { return; - } if (scale != 1) { + } + if (scale != 1) { GlStateManager.pushMatrix(); GlStateManager.translate((this.gui.getScreenWidth() - this.gui.getScreenWidth() * scale) / 2, (this.gui.getScreenHeight() - this.gui.getScreenHeight() * scale) / 2, 0); @@ -93,7 +96,8 @@ public final void drawInForeground(int mouseX, int mouseY) { public final void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { if (scale == 0) { return; - }if (scale != 1) { + } + if (scale != 1) { GlStateManager.pushMatrix(); GlStateManager.translate((this.gui.getScreenWidth() - this.gui.getScreenWidth() * scale) / 2, (this.gui.getScreenHeight() - this.gui.getScreenHeight() * scale) / 2, 0); diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/CircleButtonWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/CircleButtonWidget.java index d6908dd4419..98d6b27b5ab 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/CircleButtonWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/CircleButtonWidget.java @@ -5,9 +5,11 @@ import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; + import org.lwjgl.input.Mouse; import java.awt.*; @@ -16,6 +18,7 @@ import java.util.stream.Collectors; public class CircleButtonWidget extends Widget { + protected int border; protected int hoverTick; protected boolean isHover; @@ -119,7 +122,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender @Override public void drawInForeground(int mouseX, int mouseY) { if (hoverText != null && hoverText.length > 0 && this.isMouseOverElement(mouseX, mouseY)) { - this.drawHoveringText(ItemStack.EMPTY, Arrays.stream(hoverText).map(I18n::format).collect(Collectors.toList()), 300, mouseX, mouseY); + this.drawHoveringText(ItemStack.EMPTY, + Arrays.stream(hoverText).map(I18n::format).collect(Collectors.toList()), 300, mouseX, mouseY); } } @@ -146,5 +150,4 @@ public void handleClientAction(int id, PacketBuffer buffer) { } } } - } diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/ColorWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/ColorWidget.java index 66286bdc2de..673c049b5f6 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/ColorWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/ColorWidget.java @@ -8,6 +8,7 @@ import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.network.PacketBuffer; import net.minecraft.util.math.MathHelper; @@ -15,6 +16,7 @@ import java.util.function.Supplier; public class ColorWidget extends WidgetGroup { + private int red = 255; private int green = 255; private int blue = 255; @@ -46,44 +48,50 @@ public ColorWidget(int x, int y, int barWidth, int barHeight) { }, true) .setTextSupplier(() -> Integer.toString(red), true) .setValidator(ColorWidget::checkValid); - TextFieldWidget greenField = new TextFieldWidget(barWidth + 5, barHeight + 5, 30, barHeight, textFieldBackground, null, null) - .setTextResponder((t) -> { - setGreen(t.isEmpty() ? 0 : Integer.parseInt(t)); - if (onColorChanged != null) { - onColorChanged.accept(getColor()); - } - writeClientAction(2, buffer -> buffer.writeInt(getColor())); - }, true) - .setTextSupplier(() -> Integer.toString(green), true) - .setValidator(ColorWidget::checkValid); - TextFieldWidget blueField = new TextFieldWidget(barWidth + 5, (barHeight + 5) * 2, 30, barHeight, textFieldBackground, null, null) - .setTextResponder((t) -> { - setBlue(t.isEmpty() ? 0 : Integer.parseInt(t)); - if (onColorChanged != null) { - onColorChanged.accept(getColor()); - } - writeClientAction(2, buffer -> buffer.writeInt(getColor())); - }, true) - .setTextSupplier(() -> Integer.toString(blue), true) - .setValidator(ColorWidget::checkValid); - TextFieldWidget alphaField = new TextFieldWidget(barWidth + 5, (barHeight + 5) * 3, 30, barHeight, textFieldBackground, null, null) - .setTextResponder((t) -> { - setAlpha(t.isEmpty() ? 0 : Integer.parseInt(t)); - if (onColorChanged != null) { - onColorChanged.accept(getColor()); - } - writeClientAction(2, buffer -> buffer.writeInt(getColor())); - }, true) - .setTextSupplier(() -> Integer.toString(alpha), true) - .setValidator(ColorWidget::checkValid); + TextFieldWidget greenField = new TextFieldWidget(barWidth + 5, barHeight + 5, 30, barHeight, + textFieldBackground, null, null) + .setTextResponder((t) -> { + setGreen(t.isEmpty() ? 0 : Integer.parseInt(t)); + if (onColorChanged != null) { + onColorChanged.accept(getColor()); + } + writeClientAction(2, buffer -> buffer.writeInt(getColor())); + }, true) + .setTextSupplier(() -> Integer.toString(green), true) + .setValidator(ColorWidget::checkValid); + TextFieldWidget blueField = new TextFieldWidget(barWidth + 5, (barHeight + 5) * 2, 30, barHeight, + textFieldBackground, null, null) + .setTextResponder((t) -> { + setBlue(t.isEmpty() ? 0 : Integer.parseInt(t)); + if (onColorChanged != null) { + onColorChanged.accept(getColor()); + } + writeClientAction(2, buffer -> buffer.writeInt(getColor())); + }, true) + .setTextSupplier(() -> Integer.toString(blue), true) + .setValidator(ColorWidget::checkValid); + TextFieldWidget alphaField = new TextFieldWidget(barWidth + 5, (barHeight + 5) * 3, 30, barHeight, + textFieldBackground, null, null) + .setTextResponder((t) -> { + setAlpha(t.isEmpty() ? 0 : Integer.parseInt(t)); + if (onColorChanged != null) { + onColorChanged.accept(getColor()); + } + writeClientAction(2, buffer -> buffer.writeInt(getColor())); + }, true) + .setTextSupplier(() -> Integer.toString(alpha), true) + .setValidator(ColorWidget::checkValid); this.addWidget(redField); this.addWidget(greenField); this.addWidget(blueField); this.addWidget(alphaField); redButton = new CircleButtonWidget(barWidth, barHeight / 2, 4, 1, 0).setFill(0xffff0000).setStrokeAnima(-1); - greenButton = new CircleButtonWidget(barWidth, barHeight / 2 + barHeight + 5, 4, 1, 0).setFill(0xff00ff00).setStrokeAnima(-1); - blueButton = new CircleButtonWidget(barWidth, barHeight / 2 + 2 * (barHeight + 5), 4, 1, 0).setFill(0xff0000ff).setStrokeAnima(-1); - alphaButton = new CircleButtonWidget(barWidth, barHeight / 2 + 3 * (barHeight + 5), 4, 1, 0).setFill(-1).setStrokeAnima(-1); + greenButton = new CircleButtonWidget(barWidth, barHeight / 2 + barHeight + 5, 4, 1, 0).setFill(0xff00ff00) + .setStrokeAnima(-1); + blueButton = new CircleButtonWidget(barWidth, barHeight / 2 + 2 * (barHeight + 5), 4, 1, 0).setFill(0xff0000ff) + .setStrokeAnima(-1); + alphaButton = new CircleButtonWidget(barWidth, barHeight / 2 + 3 * (barHeight + 5), 4, 1, 0).setFill(-1) + .setStrokeAnima(-1); this.addWidget(redButton); this.addWidget(greenButton); this.addWidget(blueButton); @@ -226,10 +234,14 @@ private static boolean checkValid(String input) { public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { int x = getPosition().x; int y = getPosition().y; - drawGradientRect(x, y + 2, barWidth, 5, (255 << 24) | (0) | (green << 8) | (blue), (255 << 24) | (255 << 16) | (green << 8) | (blue), true); - drawGradientRect(x, y + barHeight + 5 + 2, barWidth, 5, (255 << 24) | (red << 16) | (0) | (blue), (255 << 24) | (red << 16) | (255 << 8) | (blue), true); - drawGradientRect(x, y + 2 * (barHeight + 5) + 2, barWidth, 5, (255 << 24) | (red << 16) | (green << 8) | (0), (255 << 24) | (red << 16) | (green << 8) | (255), true); - drawGradientRect(x, y + 3 * (barHeight + 5) + 2, barWidth, 5, (0) | (red << 16) | (green << 8) | (blue), (255 << 24) | (red << 16) | (green << 8) | (blue), true); + drawGradientRect(x, y + 2, barWidth, 5, (255 << 24) | (0) | (green << 8) | (blue), + (255 << 24) | (255 << 16) | (green << 8) | (blue), true); + drawGradientRect(x, y + barHeight + 5 + 2, barWidth, 5, (255 << 24) | (red << 16) | (0) | (blue), + (255 << 24) | (red << 16) | (255 << 8) | (blue), true); + drawGradientRect(x, y + 2 * (barHeight + 5) + 2, barWidth, 5, (255 << 24) | (red << 16) | (green << 8) | (0), + (255 << 24) | (red << 16) | (green << 8) | (255), true); + drawGradientRect(x, y + 3 * (barHeight + 5) + 2, barWidth, 5, (0) | (red << 16) | (green << 8) | (blue), + (255 << 24) | (red << 16) | (green << 8) | (blue), true); super.drawInBackground(mouseX, mouseY, partialTicks, context); } diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/CustomPositionSizeWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/CustomPositionSizeWidget.java index 8de8f36477e..a499d12ebb0 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/CustomPositionSizeWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/CustomPositionSizeWidget.java @@ -9,6 +9,7 @@ import java.util.function.BiConsumer; public class CustomPositionSizeWidget extends Widget implements IDraggable { + private Widget controlled; private final int borderColor; private final int hoverColor; @@ -21,7 +22,6 @@ public class CustomPositionSizeWidget extends Widget implements IDraggable { private BiConsumer onUpdated; - public CustomPositionSizeWidget(Widget controlled, int borderColor, int hoverColor, int border) { super(controlled.getSelfPosition(), controlled.getSize()); this.controlled = controlled; @@ -128,20 +128,26 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender } // UP drawSolidRect(x, y, width / 5, border, hoverUp && !hoverRight ? hoverColor : borderColor); - drawSolidRect(x + width * 2 / 5, y, width / 5, border, hoverUp && !hoverLeft && !hoverRight ? hoverColor : borderColor); + drawSolidRect(x + width * 2 / 5, y, width / 5, border, + hoverUp && !hoverLeft && !hoverRight ? hoverColor : borderColor); drawSolidRect(x + width * 4 / 5, y, width / 5, border, hoverUp && !hoverLeft ? hoverColor : borderColor); // DOWN drawSolidRect(x, y + height - border, width / 5, border, hoverDown && !hoverRight ? hoverColor : borderColor); - drawSolidRect(x + width * 2 / 5, y + height - border, width / 5, border, hoverDown && !hoverLeft && !hoverRight ? hoverColor : borderColor); - drawSolidRect(x + width * 4 / 5, y + height - border, width / 5, border, hoverDown && !hoverLeft ? hoverColor : borderColor); + drawSolidRect(x + width * 2 / 5, y + height - border, width / 5, border, + hoverDown && !hoverLeft && !hoverRight ? hoverColor : borderColor); + drawSolidRect(x + width * 4 / 5, y + height - border, width / 5, border, + hoverDown && !hoverLeft ? hoverColor : borderColor); // LEFT drawSolidRect(x, y, border, height / 5, hoverLeft && !hoverDown ? hoverColor : borderColor); - drawSolidRect(x, y + height * 2 / 5, border, height / 5, hoverLeft && !hoverDown && !hoverUp ? hoverColor : borderColor); + drawSolidRect(x, y + height * 2 / 5, border, height / 5, + hoverLeft && !hoverDown && !hoverUp ? hoverColor : borderColor); drawSolidRect(x, y + height * 4 / 5, border, height / 5, hoverLeft && !hoverUp ? hoverColor : borderColor); // RIGHT drawSolidRect(x + width - border, y, border, height / 5, hoverRight && !hoverDown ? hoverColor : borderColor); - drawSolidRect(x + width - border, y + height * 2 / 5, border, height / 5, hoverRight && !hoverDown && !hoverUp ? hoverColor : borderColor); - drawSolidRect(x + width - border, y + height * 4 / 5, border, height / 5, hoverRight && !hoverUp ? hoverColor : borderColor); + drawSolidRect(x + width - border, y + height * 2 / 5, border, height / 5, + hoverRight && !hoverDown && !hoverUp ? hoverColor : borderColor); + drawSolidRect(x + width - border, y + height * 4 / 5, border, height / 5, + hoverRight && !hoverUp ? hoverColor : borderColor); } @Override diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/DraggableScrollableWidgetGroup.java b/src/main/java/gregtech/api/terminal/gui/widgets/DraggableScrollableWidgetGroup.java index b2bf0549497..7adb35a9e56 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/DraggableScrollableWidgetGroup.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/DraggableScrollableWidgetGroup.java @@ -6,12 +6,14 @@ import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.terminal.gui.IDraggable; import gregtech.api.util.Position; -import gregtech.client.utils.RenderUtil; import gregtech.api.util.Size; +import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; + import net.minecraft.util.math.MathHelper; public class DraggableScrollableWidgetGroup extends WidgetGroup { + protected int scrollXOffset; protected int scrollYOffset; protected int xBarHeight; @@ -34,7 +36,6 @@ public class DraggableScrollableWidgetGroup extends WidgetGroup { private boolean draggedOnXScrollBar; private boolean draggedOnYScrollBar; - public DraggableScrollableWidgetGroup(int x, int y, int width, int height) { super(new Position(x, y), new Size(width, height)); maxHeight = height; @@ -90,7 +91,7 @@ public int getScrollXOffset() { public void addWidget(Widget widget) { maxHeight = Math.max(maxHeight, widget.getSize().height + widget.getSelfPosition().y); maxWidth = Math.max(maxWidth, widget.getSize().width + widget.getSelfPosition().x); - Position newPos = widget.addSelfPosition(- scrollXOffset, - scrollYOffset); + Position newPos = widget.addSelfPosition(-scrollXOffset, -scrollYOffset); widget.setVisible(newPos.x < getSize().width - yBarWidth && newPos.x + widget.getSize().width > 0); widget.setVisible(newPos.y < getSize().height - xBarHeight && newPos.y + widget.getSize().height > 0); super.addWidget(widget); @@ -116,7 +117,7 @@ public void setSize(Size size) { super.setSize(size); maxHeight = Math.max(size.height, maxHeight); maxWidth = Math.max(size.width, maxWidth); -// computeMax(); + // computeMax(); for (Widget widget : widgets) { Position newPos = widget.getSelfPosition(); widget.setVisible(newPos.x < getSize().width - yBarWidth && newPos.x + widget.getSize().width > 0); @@ -155,7 +156,7 @@ public void computeMax() { offsetX = scrollXOffset; } scrollXOffset -= offsetX; - }else if (mw < getSize().width) { + } else if (mw < getSize().width) { offsetX = maxWidth - getSize().width; maxWidth = getSize().width; if (scrollXOffset - offsetX < 0) { @@ -193,7 +194,7 @@ protected void setScrollXOffset(int scrollXOffset) { int offset = scrollXOffset - this.scrollXOffset; this.scrollXOffset = scrollXOffset; for (Widget widget : widgets) { - Position newPos = widget.addSelfPosition( - offset, 0); + Position newPos = widget.addSelfPosition(-offset, 0); widget.setVisible(newPos.x < getSize().width - yBarWidth && newPos.x + widget.getSize().width > 0); } } @@ -204,7 +205,7 @@ protected void setScrollYOffset(int scrollYOffset) { int offset = scrollYOffset - this.scrollYOffset; this.scrollYOffset = scrollYOffset; for (Widget widget : widgets) { - Position newPos = widget.addSelfPosition(0, - offset); + Position newPos = widget.addSelfPosition(0, -offset); widget.setVisible(newPos.y < getSize().height - xBarHeight && newPos.y + widget.getSize().height > 0); } } @@ -235,13 +236,13 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender background.draw(x, y, width, height); } if (useScissor) { - RenderUtil.useScissor(x, y, width - yBarWidth, height - xBarHeight, ()->{ - if(!hookDrawInBackground(mouseX, mouseY, partialTicks, context)) { + RenderUtil.useScissor(x, y, width - yBarWidth, height - xBarHeight, () -> { + if (!hookDrawInBackground(mouseX, mouseY, partialTicks, context)) { super.drawInBackground(mouseX, mouseY, partialTicks, context); } }); } else { - if(!hookDrawInBackground(mouseX, mouseY, partialTicks, context)) { + if (!hookDrawInBackground(mouseX, mouseY, partialTicks, context)) { super.drawInBackground(mouseX, mouseY, partialTicks, context); } } @@ -252,16 +253,18 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender } if (xBarF != null) { int barWidth = (int) (width * 1.0f / getMaxWidth() * width); - xBarF.draw(x + scrollXOffset * width * 1.0f / getMaxWidth(), y + height - xBarHeight, barWidth, xBarHeight); + xBarF.draw(x + scrollXOffset * width * 1.0f / getMaxWidth(), y + height - xBarHeight, barWidth, + xBarHeight); } } if (yBarWidth > 0) { if (yBarB != null) { - yBarB.draw(x + width - yBarWidth, y, yBarWidth, height); + yBarB.draw(x + width - yBarWidth, y, yBarWidth, height); } if (yBarF != null) { int barHeight = (int) (height * 1.0f / getMaxHeight() * height); - yBarF.draw(x + width - yBarWidth, y + scrollYOffset * height * 1.0f / getMaxHeight(), yBarWidth, barHeight); + yBarF.draw(x + width - yBarWidth, y + scrollYOffset * height * 1.0f / getMaxHeight(), yBarWidth, + barHeight); } } } @@ -274,12 +277,11 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { this.draggedOnXScrollBar = true; focus = true; return true; - } - else if (yBarWidth > 0 && isOnYScrollPane(mouseX, mouseY)) { + } else if (yBarWidth > 0 && isOnYScrollPane(mouseX, mouseY)) { this.draggedOnYScrollBar = true; focus = true; return true; - } else if(isMouseOverElement(mouseX, mouseY)){ + } else if (isMouseOverElement(mouseX, mouseY)) { focus = true; if (checkClickedDragged(mouseX, mouseY, button)) { return true; @@ -300,8 +302,8 @@ protected boolean checkClickedDragged(int mouseX, int mouseY, int button) { draggedWidget = null; for (int i = widgets.size() - 1; i >= 0; i--) { Widget widget = widgets.get(i); - if(widget.isVisible()) { - if(widget.mouseClicked(mouseX, mouseY, button)) { + if (widget.isVisible()) { + if (widget.mouseClicked(mouseX, mouseY, button)) { return true; } else if (widget instanceof IDraggable && ((IDraggable) widget).allowDrag(mouseX, mouseY, button)) { draggedWidget = widget; @@ -335,23 +337,30 @@ public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged int deltaY = mouseY - lastMouseY; lastMouseX = mouseX; lastMouseY = mouseY; - if (draggedOnXScrollBar && (getMaxWidth() - getSize().width > 0 || scrollYOffset > getMaxWidth() - getSize().width)) { - setScrollXOffset(MathHelper.clamp(scrollXOffset + deltaX * getMaxWidth() / getSize().width, 0, getMaxWidth() - getSize().width)); + if (draggedOnXScrollBar && + (getMaxWidth() - getSize().width > 0 || scrollYOffset > getMaxWidth() - getSize().width)) { + setScrollXOffset(MathHelper.clamp(scrollXOffset + deltaX * getMaxWidth() / getSize().width, 0, + getMaxWidth() - getSize().width)); return true; - } else if (draggedOnYScrollBar && (getMaxHeight() - getSize().height > 0 || scrollYOffset > getMaxHeight() - getSize().height)) { - setScrollYOffset(MathHelper.clamp(scrollYOffset + deltaY * getMaxHeight() / getSize().height, 0, getMaxHeight() - getSize().height)); - return true; - } else if (draggedWidget != null) { - if (((IDraggable)draggedWidget).dragging(mouseX, mouseY, deltaX, deltaY)) { - draggedWidget.addSelfPosition(deltaX, deltaY); + } else if (draggedOnYScrollBar && + (getMaxHeight() - getSize().height > 0 || scrollYOffset > getMaxHeight() - getSize().height)) { + setScrollYOffset(MathHelper.clamp(scrollYOffset + deltaY * getMaxHeight() / getSize().height, 0, + getMaxHeight() - getSize().height)); + return true; + } else + if (draggedWidget != null) { + if (((IDraggable) draggedWidget).dragging(mouseX, mouseY, deltaX, deltaY)) { + draggedWidget.addSelfPosition(deltaX, deltaY); + } + computeMax(); + return true; + } else if (draggedPanel) { + setScrollXOffset(MathHelper.clamp(scrollXOffset - deltaX, 0, + Math.max(getMaxWidth() - yBarWidth - getSize().width, 0))); + setScrollYOffset(MathHelper.clamp(scrollYOffset - deltaY, 0, + Math.max(getMaxHeight() - xBarHeight - getSize().height, 0))); + return true; } - computeMax(); - return true; - } else if (draggedPanel) { - setScrollXOffset(MathHelper.clamp(scrollXOffset - deltaX, 0, Math.max(getMaxWidth() - yBarWidth - getSize().width, 0))); - setScrollYOffset(MathHelper.clamp(scrollYOffset - deltaY, 0, Math.max(getMaxHeight() - xBarHeight - getSize().height, 0))); - return true; - } return super.mouseDragged(mouseX, mouseY, button, timeDragged); } @@ -362,7 +371,7 @@ public boolean mouseReleased(int mouseX, int mouseY, int button) { } else if (draggedOnYScrollBar) { draggedOnYScrollBar = false; } else if (draggedWidget != null) { - ((IDraggable)draggedWidget).endDrag(mouseX, mouseY); + ((IDraggable) draggedWidget).endDrag(mouseX, mouseY); draggedWidget = null; } else if (draggedPanel) { draggedPanel = false; diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/MachineSceneWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/MachineSceneWidget.java index d1cee57bb46..43fceb358f9 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/MachineSceneWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/MachineSceneWidget.java @@ -14,6 +14,7 @@ import gregtech.client.renderer.scene.FBOWorldSceneRenderer; import gregtech.client.renderer.scene.WorldSceneRenderer; import gregtech.client.utils.RenderUtil; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; @@ -28,16 +29,18 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; -import javax.vecmath.Vector3f; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.function.BiConsumer; import java.util.stream.Collectors; +import javax.vecmath.Vector3f; + /** * Created with IntelliJ IDEA. * @@ -46,6 +49,7 @@ * @Description: */ public class MachineSceneWidget extends WidgetGroup { + private static FBOWorldSceneRenderer worldSceneRenderer; private boolean dragging; private int lastMouseX; @@ -79,8 +83,8 @@ public MachineSceneWidget(int x, int y, int width, int height, BlockPos pos) { this.addWidget(new ScrollBarWidget(5, height - 13, width - 50, 8, 0, 1, 0.05f) .setOnChanged(value -> alpha = value, true).setInitValue(1f)); this.addWidget(new RectButtonWidget(width - 40, height - 15, 35, 12, 1) - .setToggleButton(new TextTexture("COLOR", -1), (c, b)->blendColor=b) - .setValueSupplier(true, ()->blendColor) + .setToggleButton(new TextTexture("COLOR", -1), (c, b) -> blendColor = b) + .setValueSupplier(true, () -> blendColor) .setColors(TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_F_1.getColor(), 0) .setIcon(new TextTexture("ALPHA", -1))); if (worldSceneRenderer != null) { @@ -154,12 +158,15 @@ private void renderBlockOverLay(WorldSceneRenderer renderer) { GlStateManager.popMatrix(); } GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); } private static void drawFacingBorder(FacingPos posFace, int color) { GlStateManager.pushMatrix(); - RenderUtil.moveToFace(posFace.getPos().getX(), posFace.getPos().getY(), posFace.getPos().getZ(), posFace.getFacing()); + RenderUtil.moveToFace(posFace.getPos().getX(), posFace.getPos().getY(), posFace.getPos().getZ(), + posFace.getFacing()); RenderUtil.rotateToFace(posFace.getFacing(), null); GlStateManager.scale(1f / 16, 1f / 16, 0); GlStateManager.translate(-8, -8, 0); @@ -173,7 +180,8 @@ public void updateScreen() { if (mte == null) { World world = this.gui.entityPlayer.world; TileEntity tileEntity = world.getTileEntity(pos); - if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).getMetaTileEntity() != null) { + if (tileEntity instanceof IGregTechTileEntity && + ((IGregTechTileEntity) tileEntity).getMetaTileEntity() != null) { mte = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); updateScene(); } @@ -199,7 +207,8 @@ private void updateScene() { PatternMatchContext context = multi.structurePattern.checkPatternFastAt( world, pos, mte.getFrontFacing().getOpposite(), multi.getUpwardsFacing(), multi.allowsFlip()); if (context != null) { - List validPos = multi.structurePattern.cache.keySet().stream().map(BlockPos::fromLong).collect(Collectors.toList()); + List validPos = multi.structurePattern.cache.keySet().stream().map(BlockPos::fromLong) + .collect(Collectors.toList()); Set parts = context.getOrCreate("MultiblockParts", HashSet::new); for (IMultiblockPart part : parts) { if (part instanceof MetaTileEntity) { @@ -207,7 +216,7 @@ private void updateScene() { } } for (EnumFacing facing : EnumFacing.VALUES) { - cores.forEach(pos->around.add(pos.offset(facing))); + cores.forEach(pos -> around.add(pos.offset(facing))); } int minX = Integer.MAX_VALUE; int minY = Integer.MAX_VALUE; @@ -283,7 +292,8 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { if (isMouseOverElement(mouseX, mouseY)) { zoom = (float) MathHelper.clamp(zoom + (wheelDelta < 0 ? 0.5 : -0.5), 3, 999); if (worldSceneRenderer != null) { - worldSceneRenderer.setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + worldSceneRenderer.setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); } } return super.mouseWheelMove(mouseX, mouseY, wheelDelta); @@ -298,7 +308,8 @@ public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged lastMouseY = mouseY; lastMouseX = mouseX; if (worldSceneRenderer != null) { - worldSceneRenderer.setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + worldSceneRenderer.setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); } return true; } diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/RectButtonWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/RectButtonWidget.java index 1c2bbd2e8d3..d49b5a3c25d 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/RectButtonWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/RectButtonWidget.java @@ -4,23 +4,25 @@ import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.network.PacketBuffer; + import org.lwjgl.input.Mouse; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Supplier; -public class RectButtonWidget extends CircleButtonWidget{ +public class RectButtonWidget extends CircleButtonWidget { + private IGuiTexture pressedIcon; private BiConsumer onPressed; private boolean isPressed; private Supplier supplier; private boolean isClient; - public RectButtonWidget(int x, int y, int width, int height) { - this(x, y, width, height,2); + this(x, y, width, height, 2); } public RectButtonWidget(int x, int y, int width, int height, int border) { @@ -38,7 +40,7 @@ public RectButtonWidget setToggleButton(IGuiTexture pressedIcon, BiConsumer onPressed) { this.pressedIcon = pressedIcon; - this.onPressed = onPressed != null ? (c, p)-> onPressed.accept(p) : null; + this.onPressed = onPressed != null ? (c, p) -> onPressed.accept(p) : null; return this; } @@ -64,7 +66,7 @@ public void updateScreen() { @Override public void detectAndSendChanges() { if (!isClient && supplier != null) { - if(supplier.get() != isPressed) { + if (supplier.get() != isPressed) { isPressed = !isPressed; writeUpdateInfo(1, buffer -> buffer.writeBoolean(isPressed)); } @@ -123,7 +125,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender drawBorder(x + border, y + border, width - 2 * border, height - 2 * border, colors[0], border); isHover = this.isMouseOverElement(mouseX, mouseY); if (isHover || hoverTick != 0) { - float per = Math. min ((hoverTick + partialTicks) / 8, 1); + float per = Math.min((hoverTick + partialTicks) / 8, 1); drawSolidRect(x, y, (int) (width * per), border, colors[1]); drawSolidRect(x + width - border, y, border, (int) (height * per), colors[1]); drawSolidRect((int) ((1 - per) * width) + x, y + height - border, (int) (width * per), border, colors[1]); diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/ScrollBarWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/ScrollBarWidget.java index 273738e2ac2..619fd1cbd6d 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/ScrollBarWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/ScrollBarWidget.java @@ -7,12 +7,14 @@ import gregtech.api.gui.resources.TextureArea; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.network.PacketBuffer; import net.minecraft.util.math.MathHelper; import java.util.function.Consumer; public class ScrollBarWidget extends Widget { + protected final float min; protected final float max; protected final float dur; @@ -25,7 +27,6 @@ public class ScrollBarWidget extends Widget { protected Consumer onChanged; protected boolean isClient; - public ScrollBarWidget(int x, int y, int width, int height, float min, float max, float dur) { super(new Position(x, y), new Size(width, height)); this.max = max; @@ -85,13 +86,15 @@ private boolean isOnScrollPane(int mouseX, int mouseY) { } private float getValue() { - return (float) (min + Math.floor((max - min) * xOffset * 1.0f / (this.getSize().width - buttonWidth) / dur) * dur) ; + return (float) (min + + Math.floor((max - min) * xOffset * 1.0f / (this.getSize().width - buttonWidth) / dur) * dur); } @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { if (this.isOnScrollPane(mouseX, mouseY)) { - this.xOffset = MathHelper.clamp(mouseX - this.getPosition().x - buttonWidth / 2, 0, this.getSize().width - buttonWidth); + this.xOffset = MathHelper.clamp(mouseX - this.getPosition().x - buttonWidth / 2, 0, + this.getSize().width - buttonWidth); this.draggedOnScrollBar = true; } return this.isMouseOverElement(mouseX, mouseY); @@ -100,7 +103,8 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { @Override public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged) { if (draggedOnScrollBar) { - this.xOffset = MathHelper.clamp(mouseX - this.getPosition().x - buttonWidth / 2, 0, this.getSize().width - buttonWidth); + this.xOffset = MathHelper.clamp(mouseX - this.getPosition().x - buttonWidth / 2, 0, + this.getSize().width - buttonWidth); if (onChanged != null) { onChanged.accept(getValue()); } @@ -111,7 +115,7 @@ public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged @Override public boolean mouseReleased(int mouseX, int mouseY, int button) { - if(this.draggedOnScrollBar) { + if (this.draggedOnScrollBar) { if (!isClient) { this.writeClientAction(2, packetBuffer -> packetBuffer.writeFloat(getValue())); } @@ -125,7 +129,7 @@ public void handleClientAction(int id, PacketBuffer buffer) { super.handleClientAction(id, buffer); if (id == 2) { float value = buffer.readFloat(); - if(this.onChanged != null) { + if (this.onChanged != null) { onChanged.accept(value); } } diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/SelectorWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/SelectorWidget.java index 020a44ff8e8..c5f35429f01 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/SelectorWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/SelectorWidget.java @@ -5,6 +5,7 @@ import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.resources.I18n; @@ -15,6 +16,7 @@ import java.util.function.Supplier; public class SelectorWidget extends WidgetGroup { + protected RectButtonWidget button; protected List candidates; protected boolean isShow; @@ -24,13 +26,14 @@ public class SelectorWidget extends WidgetGroup { private boolean isUp; private final int fontColor; - public SelectorWidget(int x, int y, int width, int height, List candidates, int fontColor, Supplier supplier, boolean isClient) { + public SelectorWidget(int x, int y, int width, int height, List candidates, int fontColor, + Supplier supplier, boolean isClient) { super(new Position(x, y), new Size(width, height)); - this.button = new RectButtonWidget(0,0,width,height); + this.button = new RectButtonWidget(0, 0, width, height); this.candidates = candidates; this.fontColor = fontColor; button.setClickListener(d -> { - if(onShowChange != null) { + if (onShowChange != null) { onShowChange.accept(!isShow); } isShow = !isShow; @@ -81,7 +84,7 @@ public void hide() { @Override public void drawInForeground(int mouseX, int mouseY) { super.drawInForeground(mouseX, mouseY); - if(isShow) { + if (isShow) { int x = getPosition().x; int width = getSize().width; int height = getSize().height; @@ -93,7 +96,8 @@ public void drawInForeground(int mouseX, int mouseY) { } else { drawSolidRect(x, y, width, height, 0xAA000000); } - fontRenderer.drawString(I18n.format(candidate), x + 4, y + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, fontColor); + fontRenderer.drawString(I18n.format(candidate), x + 4, y + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, + fontColor); y += height; } y = (isUp ? -candidates.size() : 1) * height + getPosition().y; @@ -132,9 +136,9 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { public void handleClientAction(int id, PacketBuffer buffer) { super.handleClientAction(id, buffer); if (id == 2) { - if (onChanged != null) { - onChanged.accept(buffer.readString(Short.MAX_VALUE)); - } + if (onChanged != null) { + onChanged.accept(buffer.readString(Short.MAX_VALUE)); + } } } } diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/TextEditorWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/TextEditorWidget.java index 255a3641c22..4837420bcc5 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/TextEditorWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/TextEditorWidget.java @@ -8,6 +8,7 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; @@ -23,22 +24,29 @@ import java.util.regex.Pattern; public class TextEditorWidget extends WidgetGroup { + private static final TextureArea PALETTE = TextureArea.fullImage("textures/gui/widget/palette.png"); private static final TextureArea STYLE = TextureArea.fullImage("textures/gui/widget/formatting.png"); private final TextPanelWidget textPanelWidget; private static final Pattern COMMENT = Pattern.compile("(//.*|/\\*[\\s\\S]*?\\*/)|(#.*)"); - private static final Pattern STRING = Pattern.compile("(\"(?:[^\"\\\\]|\\\\[\\s\\S])*\"|'(?:[^'\\\\]|\\\\[\\s\\S])*')"); + private static final Pattern STRING = Pattern + .compile("(\"(?:[^\"\\\\]|\\\\[\\s\\S])*\"|'(?:[^'\\\\]|\\\\[\\s\\S])*')"); private static final Pattern BOOL = Pattern.compile("\\b(true|false|null|undefined|NaN)\\b"); - private static final Pattern KEYWORD = Pattern.compile("\\b(import|var|for|if|else|return|this|while|new|function|switch|case|typeof|do|in|throw|try|catch|finally|with|instance|delete|void|break|continue)\\b"); - private static final Pattern KEYWORD_2 = Pattern.compile("\\b(String|int|long|boolean|float|double|byte|short|document|Date|Math|window|Object|location|navigator|Array|Number|Boolean|Function|RegExp)\\b"); + private static final Pattern KEYWORD = Pattern.compile( + "\\b(import|var|for|if|else|return|this|while|new|function|switch|case|typeof|do|in|throw|try|catch|finally|with|instance|delete|void|break|continue)\\b"); + private static final Pattern KEYWORD_2 = Pattern.compile( + "\\b(String|int|long|boolean|float|double|byte|short|document|Date|Math|window|Object|location|navigator|Array|Number|Boolean|Function|RegExp)\\b"); private static final Pattern VARIABLE = Pattern.compile("(?:[^\\W\\d]|\\$)[\\$\\w]*"); - private static final Pattern NUMBER = Pattern.compile("(0[xX][0-9a-fA-F]+|\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?|\\.\\d+(?:[eE][+-]?\\d+)?)"); + private static final Pattern NUMBER = Pattern + .compile("(0[xX][0-9a-fA-F]+|\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?|\\.\\d+(?:[eE][+-]?\\d+)?)"); private static final Pattern ANY = Pattern.compile("[\\s\\S]"); - public TextEditorWidget(int x, int y, int width, int height,Consumer stringUpdate, boolean allowToolBox) { - super(new Position(x, y), new Size(Math.max(width, allowToolBox ? 80 : width), Math.max(height, allowToolBox ? 32 : height))); - textPanelWidget = new TextPanelWidget(0, 32, Math.max(width, allowToolBox ? 80 : width), Math.max(height, allowToolBox ? 32 : height) - 32, stringUpdate); + public TextEditorWidget(int x, int y, int width, int height, Consumer stringUpdate, boolean allowToolBox) { + super(new Position(x, y), + new Size(Math.max(width, allowToolBox ? 80 : width), Math.max(height, allowToolBox ? 32 : height))); + textPanelWidget = new TextPanelWidget(0, 32, Math.max(width, allowToolBox ? 80 : width), + Math.max(height, allowToolBox ? 32 : height) - 32, stringUpdate); this.addWidget(textPanelWidget); if (allowToolBox) { initToolBox(); @@ -89,33 +97,38 @@ private void initToolBox() { if (styleFormatting == TextFormatting.RESET) break; this.addWidget(new RectButtonWidget(x * 16 + 32, y * 16, 16, 16, 1) .setToggleButton(STYLE.getSubArea(0.5 + x * 1.0 / 6, y * 0.5, 1.0 / 6, 0.5), - (cd, pressed)-> { + (cd, pressed) -> { if (pressed) { textPanelWidget.addFormatting(styleFormatting); } else { textPanelWidget.removeFormatting(styleFormatting); } }) - .setValueSupplier(true, ()-> textPanelWidget.getFrontStyleFormatting().contains(styleFormatting)) + .setValueSupplier(true, + () -> textPanelWidget.getFrontStyleFormatting().contains(styleFormatting)) .setIcon(STYLE.getSubArea(x * 1.0 / 6, y * 0.5, 1.0 / 6, 0.5)) .setColors(0, -1, 0) .setHoverText(styleFormatting.getFriendlyName())); } } this.addWidget(new RectButtonWidget(3 * 16 + 32, 0, 16, 16, 3) - .setToggleButton(new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()), (c, p)-> textPanelWidget.allowMarkdown = !p) + .setToggleButton(new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()), + (c, p) -> textPanelWidget.allowMarkdown = !p) .setValueSupplier(true, () -> !textPanelWidget.allowMarkdown) - .setColors(TerminalTheme.COLOR_B_3.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_3.getColor()) + .setColors(TerminalTheme.COLOR_B_3.getColor(), TerminalTheme.COLOR_1.getColor(), + TerminalTheme.COLOR_B_3.getColor()) .setIcon(new ColorRectTexture(TerminalTheme.COLOR_7.getColor())) .setHoverText("Check Markdown when Ctrl+V")); this.addWidget(new RectButtonWidget(3 * 16 + 32, 16, 16, 16, 3) .setClickListener(clickData -> textPanelWidget.pageSetCurrent("")) - .setColors(TerminalTheme.COLOR_B_3.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_3.getColor()) + .setColors(TerminalTheme.COLOR_B_3.getColor(), TerminalTheme.COLOR_1.getColor(), + TerminalTheme.COLOR_B_3.getColor()) .setIcon(new ColorRectTexture(TerminalTheme.COLOR_7.getColor())) .setHoverText("Clean Up")); } private static class TextPanelWidget extends DraggableScrollableWidgetGroup { + public final static int SPACE = 0; public int updateCount; public String content; @@ -134,7 +147,6 @@ private static class TextPanelWidget extends DraggableScrollableWidgetGroup { @SideOnly(Side.CLIENT) private static final Pattern COLOR_CODE_PATTERN = Pattern.compile("(?i)" + SECTION_SIGN + "[0-9A-F]"); - public TextPanelWidget(int x, int y, int width, int height, Consumer stringUpdate) { super(x, y, width, height); this.stringUpdate = stringUpdate; @@ -160,12 +172,13 @@ public void updateScreen() { @Override public boolean keyTyped(char typedChar, int keyCode) { - if(!focus || !isActive()) return false; + if (!focus || !isActive()) return false; if (GuiScreen.isKeyComboCtrlV(keyCode)) { - this.pageInsertIntoCurrent(allowMarkdown ? formatFromMarkdown(GuiScreen.getClipboardString()) : GuiScreen.getClipboardString()); + this.pageInsertIntoCurrent(allowMarkdown ? formatFromMarkdown(GuiScreen.getClipboardString()) : + GuiScreen.getClipboardString()); findFrontFormatting(); } else { - switch(keyCode) { + switch (keyCode) { case 14: if (!content.isEmpty()) { this.pageSetCurrent(content.substring(0, content.length() - 1)); @@ -194,7 +207,7 @@ private static String formatFromMarkdown(String markdown) { Deque stack = new ArrayDeque<>(); int[] chars = markdown.chars().toArray(); for (int i = 0; i < chars.length; i++) { - if (chars[i] == '\\' && i + 1 < chars.length){ + if (chars[i] == '\\' && i + 1 < chars.length) { if (chars[i + 1] == '*' || chars[i + 1] == '_' || chars[i + 1] == '~' || chars[i + 1] == '`') { builder.append(chars[i + 1]); i++; @@ -202,54 +215,57 @@ private static String formatFromMarkdown(String markdown) { builder.append('\\'); } } else if (chars[i] == '*' && i + 1 < chars.length && chars[i + 1] == ' ') { // SUBLINE - builder.append(' ').append(TextFormatting.BOLD).append('*').append(TextFormatting.RESET).append(' '); + builder.append(' ').append(TextFormatting.BOLD).append('*').append(TextFormatting.RESET) + .append(' '); i++; } else if (chars[i] == '*' && i + 1 < chars.length && chars[i + 1] == '*') { // BOLD checkTextFormatting(builder, TextFormatting.BOLD, stack); i++; - } else if (chars[i] == '_'){ - if (i - 1 == -1 || !Character.isLetterOrDigit(chars[i-1])) { // ITALIC + } else if (chars[i] == '_') { + if (i - 1 == -1 || !Character.isLetterOrDigit(chars[i - 1])) { // ITALIC checkTextFormatting(builder, TextFormatting.ITALIC, stack); - } else if (i + 1 == chars.length || !Character.isLetterOrDigit(chars[i+1])) { + } else if (i + 1 == chars.length || !Character.isLetterOrDigit(chars[i + 1])) { checkTextFormatting(builder, TextFormatting.ITALIC, stack); } else { builder.append('_'); } } else if (chars[i] == '~') { // STRIKETHROUGH checkTextFormatting(builder, TextFormatting.STRIKETHROUGH, stack); - } else if (chars[i] == '`' && i + 1 < chars.length && chars[i + 1] == '`' && i + 2 < chars.length && chars[i + 2] == '`') { // code - boolean find = false; - for (int j = i + 3; j < chars.length - 2; j++) { - if (chars[j] == '`' && chars[j + 1] == '`' && chars[j + 2] == '`') { - find = true; - builder.append(checkCode(markdown.substring(i + 3, j))); - i += j - i; - } - } - if (!find) { - builder.append("```"); + } else if (chars[i] == '`' && i + 1 < chars.length && chars[i + 1] == '`' && i + 2 < chars.length && + chars[i + 2] == '`') { // code + boolean find = false; + for (int j = i + 3; j < chars.length - 2; j++) { + if (chars[j] == '`' && chars[j + 1] == '`' && chars[j + 2] == '`') { + find = true; + builder.append(checkCode(markdown.substring(i + 3, j))); + i += j - i; + } + } + if (!find) { + builder.append("```"); + } + i += 2; + } else + if (chars[i] == '`') { + checkTextFormatting(builder, TextFormatting.UNDERLINE, stack); + } else { + builder.append((char) chars[i]); } - i += 2; - } else if (chars[i] == '`') { - checkTextFormatting(builder, TextFormatting.UNDERLINE, stack); - } else { - builder.append((char) chars[i]); - } } return builder.toString(); } private static String checkCode(String code) { - Pattern[] patterns = new Pattern[]{COMMENT, STRING, BOOL, KEYWORD, KEYWORD_2, VARIABLE, NUMBER, ANY}; - TextFormatting[] colors = new TextFormatting[]{ + Pattern[] patterns = new Pattern[] { COMMENT, STRING, BOOL, KEYWORD, KEYWORD_2, VARIABLE, NUMBER, ANY }; + TextFormatting[] colors = new TextFormatting[] { TextFormatting.DARK_GRAY, // comment - TextFormatting.DARK_GREEN, //string + TextFormatting.DARK_GREEN, // string TextFormatting.RED, // value TextFormatting.BLUE, // keyword TextFormatting.LIGHT_PURPLE, // keyword2 TextFormatting.BLACK, // variable TextFormatting.RED, // variable - TextFormatting.DARK_PURPLE}; // else + TextFormatting.DARK_PURPLE }; // else StringBuilder builder = new StringBuilder(); while (code.length() > 0) { boolean find = false; @@ -270,7 +286,8 @@ private static String checkCode(String code) { return builder.toString(); } - private static void checkTextFormatting(StringBuilder builder, TextFormatting formatting, Deque stack) { + private static void checkTextFormatting(StringBuilder builder, TextFormatting formatting, + Deque stack) { if (!stack.isEmpty() && stack.peek() == formatting) { builder.append(TextFormatting.RESET); stack.pop(); @@ -286,9 +303,9 @@ private static void checkTextFormatting(StringBuilder builder, TextFormatting fo private static TextFormatting lookAheadChars(final String content, int index) { if (index > 1 && content.charAt(index - 2) == SECTION_SIGN) { int t = content.charAt(index - 1); - if ('0' <= t && t <= '9'){ + if ('0' <= t && t <= '9') { return TextFormatting.values()[t - '0']; - } else if ('a' <= t && t <= 'f'){ + } else if ('a' <= t && t <= 'f') { return TextFormatting.values()[t - 'a' + 10]; } else if ('k' <= t && t <= 'o') { return TextFormatting.values()[t - 'k' + 16]; @@ -301,8 +318,8 @@ private static TextFormatting lookAheadChars(final String content, int index) { public static String cleanUpFormatting(final String content) { Set removed = new HashSet<>(); - Matcher marcher = R_CODE_PATTERN.matcher(content); - while (marcher.find()) { + Matcher marcher = R_CODE_PATTERN.matcher(content); + while (marcher.find()) { int index = marcher.start(); while (index > 1) { TextFormatting ahead = lookAheadChars(content, index); @@ -321,7 +338,7 @@ public static String cleanUpFormatting(final String content) { TextFormatting ahead = lookAheadChars(content, index); if (ahead == null) { break; - } else if (TextFormatting.RESET != ahead){ + } else if (TextFormatting.RESET != ahead) { if (!removed.add(index - 2)) { break; } @@ -333,7 +350,7 @@ public static String cleanUpFormatting(final String content) { } StringBuilder builder = new StringBuilder(); AtomicInteger start = new AtomicInteger(); - removed.stream().sorted().forEach(remove->{ + removed.stream().sorted().forEach(remove -> { builder.append(content, start.get(), remove); start.set(remove + 2); }); @@ -368,7 +385,7 @@ public void addFormatting(TextFormatting formatting) { for (TextFormatting style : frontStyle) { pageInsertIntoCurrent(style.toString()); } - } else if (formatting.isFancyStyling()){ + } else if (formatting.isFancyStyling()) { if (frontStyle.contains(formatting)) { return; } @@ -381,14 +398,14 @@ public void removeFormatting(TextFormatting formatting) { if (formatting.isColor()) { frontColor = null; pageInsertIntoCurrent(TextFormatting.RESET.toString()); - frontStyle.forEach(style->pageInsertIntoCurrent(style.toString())); + frontStyle.forEach(style -> pageInsertIntoCurrent(style.toString())); } else if (formatting.isFancyStyling()) { pageInsertIntoCurrent(TextFormatting.RESET.toString()); if (frontColor != null) { pageInsertIntoCurrent(frontColor.toString()); } frontStyle.remove(formatting); - frontStyle.forEach(style->pageInsertIntoCurrent(style.toString())); + frontStyle.forEach(style -> pageInsertIntoCurrent(style.toString())); } } @@ -404,19 +421,21 @@ public void pageSetCurrent(String string) { if (!content.equals(string)) { content = cleanUpFormatting(string); findFrontFormatting(); - if(stringUpdate != null) { + if (stringUpdate != null) { stringUpdate.accept(content); } - textHeight = this.fontRenderer.getWordWrappedHeight(content + TextFormatting.BLACK + "_", this.getSize().width - yBarWidth); + textHeight = this.fontRenderer.getWordWrappedHeight(content + TextFormatting.BLACK + "_", + this.getSize().width - yBarWidth); } } public void pageInsertIntoCurrent(String string) { content = cleanUpFormatting(content + string); - if(stringUpdate != null) { + if (stringUpdate != null) { stringUpdate.accept(content); } - textHeight = this.fontRenderer.getWordWrappedHeight(content + TextFormatting.BLACK + "_", this.getSize().width - yBarWidth); + textHeight = this.fontRenderer.getWordWrappedHeight(content + TextFormatting.BLACK + "_", + this.getSize().width - yBarWidth); } @Override @@ -433,7 +452,8 @@ public boolean hookDrawInBackground(int mouseX, int mouseY, float partialTicks, } int x = getPosition().x - scrollXOffset; int y = getPosition().y + SPACE - scrollYOffset; - for (String textLine : this.fontRenderer.listFormattedStringToWidth(contentString, getSize().width - yBarWidth)) { + for (String textLine : this.fontRenderer.listFormattedStringToWidth(contentString, + getSize().width - yBarWidth)) { fontRenderer.drawString(textLine, x, y, 0xff000000, false); y += fontRenderer.FONT_HEIGHT; } @@ -441,5 +461,3 @@ public boolean hookDrawInBackground(int mouseX, int mouseY, float partialTicks, } } } - - diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/TreeListWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/TreeListWidget.java index 661769fbe8c..45e5c12d55e 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/TreeListWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/TreeListWidget.java @@ -5,8 +5,9 @@ import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.terminal.util.TreeNode; import gregtech.api.util.Position; -import gregtech.client.utils.RenderUtil; import gregtech.api.util.Size; +import gregtech.client.utils.RenderUtil; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; @@ -19,6 +20,7 @@ import java.util.function.Function; public class TreeListWidget extends Widget { + private static final int ITEM_HEIGHT = 11; protected int scrollOffset; protected List> list; @@ -94,7 +96,8 @@ public void updateScreen() { public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { if (this.isMouseOverElement(mouseX, mouseY)) { int moveDelta = -MathHelper.clamp(wheelDelta, -1, 1) * 5; - this.scrollOffset = MathHelper.clamp(scrollOffset + moveDelta, 0, Math.max(list.size() * ITEM_HEIGHT - getSize().height, 0)); + this.scrollOffset = MathHelper.clamp(scrollOffset + moveDelta, 0, + Math.max(list.size() * ITEM_HEIGHT - getSize().height, 0)); return true; } return false; @@ -111,12 +114,12 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender } else { drawGradientRect(x, y, width, height, 0x8f000000, 0x8f000000); } - RenderUtil.useScissor(x, y, width, height, ()->{ + RenderUtil.useScissor(x, y, width, height, () -> { FontRenderer fr = Minecraft.getMinecraft().fontRenderer; int minToRender = scrollOffset / ITEM_HEIGHT; int maxToRender = Math.min(list.size(), height / ITEM_HEIGHT + 2 + minToRender); for (int i = minToRender; i < maxToRender; i++) { - GlStateManager.color(1,1,1,1); + GlStateManager.color(1, 1, 1, 1); TreeNode node = list.get(i); int sX = x + 10 * node.dimension; int sY = y - scrollOffset + i * ITEM_HEIGHT; @@ -128,9 +131,11 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender drawSolidRect(x, sY, width, ITEM_HEIGHT, 0xffff0000); } if (node.getContent() != null) { - String nameS = contentNameSupplier == null ? null : contentNameSupplier.apply(node.getContent()); + String nameS = contentNameSupplier == null ? null : + contentNameSupplier.apply(node.getContent()); name = nameS == null ? name : nameS; - IGuiTexture icon = contentIconSupplier == null ? null : contentIconSupplier.apply(node.getContent()); + IGuiTexture icon = contentIconSupplier == null ? null : + contentIconSupplier.apply(node.getContent()); if (icon != null) { icon.draw(sX - 9, sY + 1, 8, 8); } @@ -157,11 +162,11 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender } }); GlStateManager.enableBlend(); - GlStateManager.color(1,1,1,1); + GlStateManager.color(1, 1, 1, 1); } public TreeNode jumpTo(List path) { - list.removeIf(node->node.dimension != 1); + list.removeIf(node -> node.dimension != 1); this.selected = null; int dim = 1; int index = 0; @@ -173,8 +178,8 @@ public TreeNode jumpTo(List path) { node = list.get(i); if (node.dimension != dim) { return null; - } else if (node.getKey().equals(key)) { //expand - if(!node.isLeaf() && path.size() > dim) { + } else if (node.getKey().equals(key)) { // expand + if (!node.isLeaf() && path.size() > dim) { for (int j = 0; j < node.getChildren().size(); j++) { list.add(index + 1 + j, node.getChildren().get(j)); } @@ -191,7 +196,8 @@ public TreeNode jumpTo(List path) { } if (flag) { this.selected = node; - this.scrollOffset = MathHelper.clamp(ITEM_HEIGHT * (index - 1), 0, Math.max(list.size() * ITEM_HEIGHT - getSize().height, 0)); + this.scrollOffset = MathHelper.clamp(ITEM_HEIGHT * (index - 1), 0, + Math.max(list.size() * ITEM_HEIGHT - getSize().height, 0)); return this.selected; } return null; @@ -206,17 +212,17 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { if (node.isLeaf()) { if (node != this.selected) { this.selected = node; - if (onSelected != null){ + if (onSelected != null) { onSelected.accept(node); } } } else { if (canSelectNode && this.selected != node) { this.selected = node; - if (onSelected != null){ + if (onSelected != null) { onSelected.accept(node); } - } else if (node.getChildren().size() > 0 && list.contains(node.getChildren().get(0))){ + } else if (node.getChildren().size() > 0 && list.contains(node.getChildren().get(0))) { removeNode(node); } else { for (int i = 0; i < node.getChildren().size(); i++) { @@ -232,7 +238,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { } private void removeNode(TreeNode node) { - if(node.isLeaf()) return; + if (node.isLeaf()) return; for (TreeNode child : node.getChildren()) { list.remove(child); removeNode(child); diff --git a/src/main/java/gregtech/api/terminal/hardware/Hardware.java b/src/main/java/gregtech/api/terminal/hardware/Hardware.java index e2ba69db547..6a34ff4de48 100644 --- a/src/main/java/gregtech/api/terminal/hardware/Hardware.java +++ b/src/main/java/gregtech/api/terminal/hardware/Hardware.java @@ -2,6 +2,7 @@ import gregtech.api.gui.GuiTextures; import gregtech.api.gui.resources.IGuiTexture; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -15,7 +16,8 @@ * @Date: 2021/08/27 * @Description: Hardware */ -public abstract class Hardware { +public abstract class Hardware { + protected HardwareProvider provider; public abstract String getRegistryName(); @@ -58,12 +60,13 @@ public final NBTTagCompound getNBT() { /** * Check whether the terminal is in creative mode. */ - public final boolean isCreative(){ + public final boolean isCreative() { return provider != null && provider.isCreative(); } /** * information added to tooltips + * * @return null->nothing added. */ @SideOnly(Side.CLIENT) @@ -73,6 +76,7 @@ public String addInformation() { /** * Create the hardware instance, NOTE!!! do not check nbt or anything here. Terminal has not been initialized here. + * * @param itemStack terminal * @return instance */ @@ -80,12 +84,14 @@ public String addInformation() { /** * Use the item to install this hardware. + * * @return The NBT of the hardware is returned if the item is valid, otherwise NULL is returned */ public abstract NBTTagCompound acceptItemStack(ItemStack itemStack); /** * Called when the hardware is removed and back to the player inventory. + * * @param itemStack (original one) * @return result */ diff --git a/src/main/java/gregtech/api/terminal/hardware/HardwareProvider.java b/src/main/java/gregtech/api/terminal/hardware/HardwareProvider.java index 72a9e7d2b7e..b385e0051e8 100644 --- a/src/main/java/gregtech/api/terminal/hardware/HardwareProvider.java +++ b/src/main/java/gregtech/api/terminal/hardware/HardwareProvider.java @@ -4,17 +4,19 @@ import gregtech.api.items.metaitem.stats.IItemCapabilityProvider; import gregtech.api.terminal.TerminalRegistry; import gregtech.common.items.behaviors.TerminalBehaviour; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Created with IntelliJ IDEA. * @@ -23,16 +25,14 @@ * @Description: */ public class HardwareProvider implements ICapabilityProvider, IItemCapabilityProvider { + private Map providers; private Map itemCache; private Boolean isCreative; private ItemStack itemStack; private NBTTagCompound tag; - - public HardwareProvider() { - - } + public HardwareProvider() {} public void cleanCache(String name) { itemCache.remove(name); @@ -68,11 +68,13 @@ public List getHardware() { if (TerminalBehaviour.isCreative(itemStack)) { return new ArrayList<>(providers.values()); } - return getOrCreateHardwareCompound().getKeySet().stream().map(providers::get).filter(Objects::nonNull).collect(Collectors.toList()); + return getOrCreateHardwareCompound().getKeySet().stream().map(providers::get).filter(Objects::nonNull) + .collect(Collectors.toList()); } public boolean hasHardware(String name) { - return itemStack != null && (TerminalBehaviour.isCreative(getItemStack()) || getOrCreateHardwareCompound().hasKey(name)); + return itemStack != null && + (TerminalBehaviour.isCreative(getItemStack()) || getOrCreateHardwareCompound().hasKey(name)); } public NBTTagCompound getHardwareNBT(String name) { @@ -135,6 +137,7 @@ public T getCapability(@Nonnull Capability capability, @Nullable EnumFaci } } } - return capability == GregtechCapabilities.CAPABILITY_HARDWARE_PROVIDER ? GregtechCapabilities.CAPABILITY_HARDWARE_PROVIDER.cast(this) : null; + return capability == GregtechCapabilities.CAPABILITY_HARDWARE_PROVIDER ? + GregtechCapabilities.CAPABILITY_HARDWARE_PROVIDER.cast(this) : null; } } diff --git a/src/main/java/gregtech/api/terminal/hardware/IHardwareCapability.java b/src/main/java/gregtech/api/terminal/hardware/IHardwareCapability.java index 2ef7c4b1732..ed9a1027614 100644 --- a/src/main/java/gregtech/api/terminal/hardware/IHardwareCapability.java +++ b/src/main/java/gregtech/api/terminal/hardware/IHardwareCapability.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; public interface IHardwareCapability { + default boolean hasCapability(@Nonnull Capability capability) { return getCapability(capability) != null; } diff --git a/src/main/java/gregtech/api/terminal/os/SystemCall.java b/src/main/java/gregtech/api/terminal/os/SystemCall.java index dc5a14f0ea9..2110775b5db 100644 --- a/src/main/java/gregtech/api/terminal/os/SystemCall.java +++ b/src/main/java/gregtech/api/terminal/os/SystemCall.java @@ -5,12 +5,13 @@ import gregtech.api.util.function.TriConsumer; public enum SystemCall { - CALL_MENU("call_menu", 0, (os, side, args)->os.callMenu(side)), - FULL_SCREEN("full_screen", 1, (os, side, args)->os.maximize(side)), - MINIMIZE_FOCUS_APP("minimize_focus_app", 2, (os, side, args)->os.minimizeApplication(os.getFocusApp(), side)), - CLOSE_FOCUS_APP("close_focus_app", 3, (os, side, args)->os.closeApplication(os.getFocusApp(), side)), - SHUT_DOWN("shutdown", 4, (os, side, args)->os.shutdown(side)), - OPEN_APP("open_app", 5, (os, side, args)->{ + + CALL_MENU("call_menu", 0, (os, side, args) -> os.callMenu(side)), + FULL_SCREEN("full_screen", 1, (os, side, args) -> os.maximize(side)), + MINIMIZE_FOCUS_APP("minimize_focus_app", 2, (os, side, args) -> os.minimizeApplication(os.getFocusApp(), side)), + CLOSE_FOCUS_APP("close_focus_app", 3, (os, side, args) -> os.closeApplication(os.getFocusApp(), side)), + SHUT_DOWN("shutdown", 4, (os, side, args) -> os.shutdown(side)), + OPEN_APP("open_app", 5, (os, side, args) -> { if (args.length > 0 && args[0] != null) { AbstractApplication app = TerminalRegistry.getApplication(args[0]); if (app != null) { @@ -19,12 +20,11 @@ public enum SystemCall { } }); - TriConsumer action; String name; int index; - SystemCall(String name, int index, TriConsumer action){ + SystemCall(String name, int index, TriConsumer action) { this.action = action; this.name = name; this.index = index; @@ -32,7 +32,6 @@ public enum SystemCall { public void call(TerminalOSWidget os, boolean isClient, String... args) { action.accept(os, isClient, args); - } public String getTranslateKey() { @@ -43,7 +42,7 @@ public static SystemCall getFromName(String name) { for (SystemCall value : SystemCall.values()) { if (value.name.equalsIgnoreCase(name)) { return value; - } else if(value.getTranslateKey().equals(name)) { + } else if (value.getTranslateKey().equals(name)) { return value; } } diff --git a/src/main/java/gregtech/api/terminal/os/TerminalDesktopWidget.java b/src/main/java/gregtech/api/terminal/os/TerminalDesktopWidget.java index 30db199c216..19ad7f969b2 100644 --- a/src/main/java/gregtech/api/terminal/os/TerminalDesktopWidget.java +++ b/src/main/java/gregtech/api/terminal/os/TerminalDesktopWidget.java @@ -6,6 +6,7 @@ import gregtech.api.terminal.gui.widgets.CircleButtonWidget; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -13,6 +14,7 @@ import java.util.List; public class TerminalDesktopWidget extends WidgetGroup { + private final TerminalOSWidget os; private final WidgetGroup appDiv; private final List topWidgets; @@ -26,12 +28,12 @@ public TerminalDesktopWidget(Position position, Size size, TerminalOSWidget os) this.topWidgets = new LinkedList<>(); } - public void installApplication(AbstractApplication application){ + public void installApplication(AbstractApplication application) { int r = 12; int index = appDiv.widgets.size(); int x = this.getSize().width / 2 + (3 * r) * (index % rowCount - rowCount / 2); int y = (index / rowCount) * (3 * r) + 40; - CircleButtonWidget button = new CircleButtonWidget(x,y) + CircleButtonWidget button = new CircleButtonWidget(x, y) .setColors(TerminalTheme.COLOR_B_2.getColor(), application.getThemeColor(), TerminalTheme.COLOR_B_2.getColor()) diff --git a/src/main/java/gregtech/api/terminal/os/TerminalDialogWidget.java b/src/main/java/gregtech/api/terminal/os/TerminalDialogWidget.java index 04960c6cec9..30cd7ee1150 100644 --- a/src/main/java/gregtech/api/terminal/os/TerminalDialogWidget.java +++ b/src/main/java/gregtech/api/terminal/os/TerminalDialogWidget.java @@ -15,6 +15,7 @@ import gregtech.api.util.GTLog; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraft.inventory.IInventory; @@ -31,13 +32,18 @@ import java.util.function.Predicate; public class TerminalDialogWidget extends AnimaWidgetGroup { - private static final IGuiTexture DIALOG_BACKGROUND = TextureArea.fullImage("textures/gui/terminal/terminal_dialog.png"); + + private static final IGuiTexture DIALOG_BACKGROUND = TextureArea + .fullImage("textures/gui/terminal/terminal_dialog.png"); private static final IGuiTexture OK_NORMAL = TextureArea.fullImage("textures/gui/terminal/icon/ok_normal.png"); private static final IGuiTexture OK_HOVER = TextureArea.fullImage("textures/gui/terminal/icon/ok_hover.png"); -// private static final IGuiTexture OK_DISABLE = TextureArea.fullImage("textures/gui/terminal/icon/ok_disable.png"); - private static final IGuiTexture CANCEL_NORMAL = TextureArea.fullImage("textures/gui/terminal/icon/cancel_normal.png"); - private static final IGuiTexture CANCEL_HOVER = TextureArea.fullImage("textures/gui/terminal/icon/cancel_hover.png"); -// private static final IGuiTexture CANCEL_DISABLE = TextureArea.fullImage("textures/gui/terminal/icon/cancel_disable.png"); + // private static final IGuiTexture OK_DISABLE = TextureArea.fullImage("textures/gui/terminal/icon/ok_disable.png"); + private static final IGuiTexture CANCEL_NORMAL = TextureArea + .fullImage("textures/gui/terminal/icon/cancel_normal.png"); + private static final IGuiTexture CANCEL_HOVER = TextureArea + .fullImage("textures/gui/terminal/icon/cancel_hover.png"); + // private static final IGuiTexture CANCEL_DISABLE = + // TextureArea.fullImage("textures/gui/terminal/icon/cancel_disable.png"); private static final int HEIGHT = 128; private static final int WIDTH = 184; @@ -131,16 +137,19 @@ public TerminalDialogWidget addTitle(String title) { } public TerminalDialogWidget addInfo(String info) { - this.addWidget(new LabelWidget(WIDTH / 2, HEIGHT / 2, info, -1).setWidth(WIDTH - 16).setYCentered(true).setXCentered(true)); + this.addWidget(new LabelWidget(WIDTH / 2, HEIGHT / 2, info, -1).setWidth(WIDTH - 16).setYCentered(true) + .setXCentered(true)); return this; } public static TerminalDialogWidget createEmptyTemplate(TerminalOSWidget os) { Size size = os.getSize(); - return new TerminalDialogWidget(os, (size.width - WIDTH) / 2, (size.height - HEIGHT) / 2, WIDTH, HEIGHT).setBackground(DIALOG_BACKGROUND); + return new TerminalDialogWidget(os, (size.width - WIDTH) / 2, (size.height - HEIGHT) / 2, WIDTH, HEIGHT) + .setBackground(DIALOG_BACKGROUND); } - public static TerminalDialogWidget showInfoDialog(TerminalOSWidget os, String title, String info, Runnable callback) { + public static TerminalDialogWidget showInfoDialog(TerminalOSWidget os, String title, String info, + Runnable callback) { return createEmptyTemplate(os).addTitle(title).addInfo(info).addOkButton(callback); } @@ -148,12 +157,15 @@ public static TerminalDialogWidget showInfoDialog(TerminalOSWidget os, String ti return createEmptyTemplate(os).addTitle(title).addInfo(info).addOkButton(null); } - public static TerminalDialogWidget showConfirmDialog(TerminalOSWidget os, String title, String info, Consumer result) { + public static TerminalDialogWidget showConfirmDialog(TerminalOSWidget os, String title, String info, + Consumer result) { return createEmptyTemplate(os).addConfirmButton(result).addTitle(title).addInfo(info); } - public static TerminalDialogWidget showTextFieldDialog(TerminalOSWidget os, String title, Predicate validator, Consumer result) { - TextFieldWidget textFieldWidget = new TextFieldWidget(WIDTH / 2 - 50, HEIGHT / 2 - 15, 100, 20, new ColorRectTexture(0x2fffffff), null, null).setValidator(validator); + public static TerminalDialogWidget showTextFieldDialog(TerminalOSWidget os, String title, + Predicate validator, Consumer result) { + TextFieldWidget textFieldWidget = new TextFieldWidget(WIDTH / 2 - 50, HEIGHT / 2 - 15, 100, 20, + new ColorRectTexture(0x2fffffff), null, null).setValidator(validator); TerminalDialogWidget dialog = createEmptyTemplate(os).addTitle(title).addConfirmButton(b -> { if (b) { if (result != null) @@ -169,9 +181,11 @@ public static TerminalDialogWidget showTextFieldDialog(TerminalOSWidget os, Stri /** * Show Color Dialog + * * @return color (rgba) */ - public static TerminalDialogWidget showColorDialog(TerminalOSWidget os, String title, Consumer result, int startColor) { + public static TerminalDialogWidget showColorDialog(TerminalOSWidget os, String title, Consumer result, + int startColor) { TerminalDialogWidget dialog = createEmptyTemplate(os).addTitle(title); ColorWidget colorWidget = new ColorWidget(WIDTH / 2 - 60, HEIGHT / 2 - 35, 80, 10); colorWidget.setStartColor(startColor); @@ -190,11 +204,13 @@ public static TerminalDialogWidget showColorDialog(TerminalOSWidget os, String t /** * Show FileDialog - * @param dir root directory + * + * @param dir root directory * @param isSelector select a file or save a file - * @param result selected file or (saved) + * @param result selected file or (saved) */ - public static TerminalDialogWidget showFileDialog(TerminalOSWidget os, String title, File dir, boolean isSelector, Consumer result) { + public static TerminalDialogWidget showFileDialog(TerminalOSWidget os, String title, File dir, boolean isSelector, + Consumer result) { Size size = os.getSize(); TerminalDialogWidget dialog = new TerminalDialogWidget(os, 0, 0, size.width, size.height) .setBackground(new ColorRectTexture(0x4f000000)); @@ -205,9 +221,11 @@ public static TerminalDialogWidget showFileDialog(TerminalOSWidget os, String ti } AtomicReference selected = new AtomicReference<>(); selected.set(dir); - dialog.addWidget(new TreeListWidget<>(0, 0, 130, size.height, new FileTree(dir), node -> selected.set(node.getKey())).setNodeTexture(GuiTextures.BORDERED_BACKGROUND) - .canSelectNode(true) - .setLeafTexture(GuiTextures.SLOT_DARKENED)); + dialog.addWidget( + new TreeListWidget<>(0, 0, 130, size.height, new FileTree(dir), node -> selected.set(node.getKey())) + .setNodeTexture(GuiTextures.BORDERED_BACKGROUND) + .canSelectNode(true) + .setLeafTexture(GuiTextures.SLOT_DARKENED)); int x = 130 + (size.width - 133 - WIDTH) / 2; int y = (size.height - HEIGHT) / 2; dialog.addWidget(new ImageWidget(x, y, WIDTH, HEIGHT, DIALOG_BACKGROUND)); @@ -237,25 +255,26 @@ public static TerminalDialogWidget showFileDialog(TerminalOSWidget os, String ti return "terminal.dialog.no_file_selected"; }, true).setWidth(WIDTH - 16)); } else { - dialog.addWidget(new TextFieldWidget(x + WIDTH / 2 - 38, y + HEIGHT / 2 - 10, 76, 20, new ColorRectTexture(0x4f000000), null, null) - .setTextResponder(res->{ - File file = selected.get(); - if (file == null) return; - if (file.isDirectory()) { - selected.set(new File(file, res)); - } else { - selected.set(new File(file.getParent(), res)); - } - },true) - .setTextSupplier(()->{ - File file = selected.get(); - if (file != null && !file.isDirectory()) { - return selected.get().getName(); - } - return ""; - }, true) - .setMaxStringLength(Integer.MAX_VALUE) - .setValidator(s->true)); + dialog.addWidget(new TextFieldWidget(x + WIDTH / 2 - 38, y + HEIGHT / 2 - 10, 76, 20, + new ColorRectTexture(0x4f000000), null, null) + .setTextResponder(res -> { + File file = selected.get(); + if (file == null) return; + if (file.isDirectory()) { + selected.set(new File(file, res)); + } else { + selected.set(new File(file.getParent(), res)); + } + }, true) + .setTextSupplier(() -> { + File file = selected.get(); + if (file != null && !file.isDirectory()) { + return selected.get().getName(); + } + return ""; + }, true) + .setMaxStringLength(Integer.MAX_VALUE) + .setValidator(s -> true)); } dialog.addWidget(new CircleButtonWidget(x + 17, y + 15, 10, 1, 16) .setClickListener(cd -> { @@ -278,7 +297,8 @@ public static TerminalDialogWidget showFileDialog(TerminalOSWidget os, String ti return dialog.setClientSide(); } - public static TerminalDialogWidget showItemSelector(TerminalOSWidget os, String title, boolean cost, Predicate filter, Consumer result) { + public static TerminalDialogWidget showItemSelector(TerminalOSWidget os, String title, boolean cost, + Predicate filter, Consumer result) { TerminalDialogWidget dialog = createEmptyTemplate(os); dialog.addWidget(new LabelWidget(WIDTH / 2, -7, title, -1).setShadow(true).setXCentered(true)); IInventory inventoryPlayer = os.getModularUI().entityPlayer.inventory; @@ -287,11 +307,13 @@ public static TerminalDialogWidget showItemSelector(TerminalOSWidget os, String } int x = 11; int y = 30; - final SlotWidget[] selected = {null}; + final SlotWidget[] selected = { null }; for (int row = 0; row < 4; row++) { for (int col = 0; col < 9; col++) { boolean pass = filter == null || filter.test(inventoryPlayer.getStackInSlot(col + row * 9)); - SlotWidget slotWidget = new SlotWidget(inventoryPlayer, col + row * 9, x + col * 18, (int) (y + (row == 0 ? -1.2 : (row - 1)) * 18), false, false) { + SlotWidget slotWidget = new SlotWidget(inventoryPlayer, col + row * 9, x + col * 18, + (int) (y + (row == 0 ? -1.2 : (row - 1)) * 18), false, false) { + @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { super.drawInBackground(mouseX, mouseY, partialTicks, context); @@ -329,7 +351,7 @@ public void handleClientAction(int id, PacketBuffer buffer) { dialog.iNativeWidgets.add(slotWidget); } } - dialog.addConfirmButton(confirm->{ + dialog.addConfirmButton(confirm -> { if (result != null && confirm && selected[0] != null && !selected[0].getHandle().getStack().isEmpty()) { ItemStack stack = selected[0].getHandle().getStack().copy(); if (cost) { @@ -357,7 +379,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { for (int i = widgets.size() - 1; i >= 0; i--) { Widget widget = widgets.get(i); if (widget.isVisible()) { - if(widget.mouseClicked(mouseX, mouseY, button)){ + if (widget.mouseClicked(mouseX, mouseY, button)) { return true; } } @@ -393,6 +415,7 @@ public boolean keyTyped(char charTyped, int keyCode) { } public void onOSSizeUpdate(int width, int height) { - setSelfPosition(Position.ORIGIN.add(new Position((width - getSize().width) / 2, (height - getSize().height) / 2))); + setSelfPosition( + Position.ORIGIN.add(new Position((width - getSize().width) / 2, (height - getSize().height) / 2))); } } diff --git a/src/main/java/gregtech/api/terminal/os/TerminalHomeButtonWidget.java b/src/main/java/gregtech/api/terminal/os/TerminalHomeButtonWidget.java index 79c785bd7d4..0b9c7683e4c 100644 --- a/src/main/java/gregtech/api/terminal/os/TerminalHomeButtonWidget.java +++ b/src/main/java/gregtech/api/terminal/os/TerminalHomeButtonWidget.java @@ -3,10 +3,12 @@ import gregtech.api.terminal.TerminalRegistry; import gregtech.api.terminal.gui.widgets.CircleButtonWidget; import gregtech.api.util.GTLog; + import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.common.FMLCommonHandler; + import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; @@ -14,6 +16,7 @@ import java.io.IOException; public class TerminalHomeButtonWidget extends CircleButtonWidget { + private final TerminalOSWidget os; private int mouseClickTime = -1; private final Pair[] actions; @@ -37,7 +40,8 @@ public TerminalHomeButtonWidget(TerminalOSWidget os) { for (int i = 0; i < actions.length; i++) { if (nbt.hasKey(String.valueOf(i))) { NBTTagCompound tag = nbt.getCompoundTag(String.valueOf(i)); - actions[i] = new MutablePair<>(SystemCall.getFromIndex(tag.getInteger("action")), tag.hasKey("arg") ? tag.getString("arg") : null); + actions[i] = new MutablePair<>(SystemCall.getFromIndex(tag.getInteger("action")), + tag.hasKey("arg") ? tag.getString("arg") : null); } } } @@ -67,7 +71,8 @@ public void saveConfig() { } try { if (!nbt.isEmpty()) { - CompressedStreamTools.safeWrite(nbt, new File(TerminalRegistry.TERMINAL_PATH, "config/home_button.nbt")); + CompressedStreamTools.safeWrite(nbt, + new File(TerminalRegistry.TERMINAL_PATH, "config/home_button.nbt")); } } catch (IOException e) { GTLog.logger.error("error while saving local nbt for the home button", e); @@ -127,7 +132,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { private void sendToServer(Pair pair) { if (pair != null) { String[] args = pair.getValue() == null ? new String[0] : pair.getValue().split(" "); - writeClientAction(1, buffer->{ + writeClientAction(1, buffer -> { buffer.writeVarInt(pair.getKey().index); buffer.writeVarInt(args.length); for (String arg : args) { @@ -137,5 +142,4 @@ private void sendToServer(Pair pair) { click(pair.getKey().index, true, args); } } - } diff --git a/src/main/java/gregtech/api/terminal/os/TerminalOSWidget.java b/src/main/java/gregtech/api/terminal/os/TerminalOSWidget.java index 187e5fd7c16..518609c585a 100644 --- a/src/main/java/gregtech/api/terminal/os/TerminalOSWidget.java +++ b/src/main/java/gregtech/api/terminal/os/TerminalOSWidget.java @@ -21,6 +21,7 @@ import gregtech.common.terminal.app.settings.widgets.OsSettings; import gregtech.common.terminal.hardware.BatteryHardware; import gregtech.common.terminal.hardware.DeviceHardware; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -38,6 +39,7 @@ import java.util.stream.Collectors; public class TerminalOSWidget extends AbstractWidgetGroup { + public static final TextureArea TERMINAL_FRAME = TextureArea.fullImage("textures/gui/terminal/terminal_frame.png"); public static final TextureArea TERMINAL_HOME = TextureArea.fullImage("textures/gui/terminal/terminal_home.png"); public static final int DEFAULT_WIDTH = 333; @@ -65,7 +67,8 @@ public TerminalOSWidget(int xPosition, int yPosition, ItemStack itemStack) { this.openedApps = new ArrayList<>(); this.installedApps = new ArrayList<>(); this.desktop = new TerminalDesktopWidget(Position.ORIGIN, new Size(DEFAULT_WIDTH, DEFAULT_HEIGHT), this); - this.menu = new TerminalMenuWidget(Position.ORIGIN, new Size(31, DEFAULT_HEIGHT), this).setBackground(TerminalTheme.COLOR_B_2); + this.menu = new TerminalMenuWidget(Position.ORIGIN, new Size(31, DEFAULT_HEIGHT), this) + .setBackground(TerminalTheme.COLOR_B_2); this.home = new TerminalHomeButtonWidget(this); this.addWidget(desktop); this.addWidget(menu); @@ -116,7 +119,8 @@ public List getHardware() { } public List getHardware(Class clazz) { - return getHardware().stream().filter(hw -> hw.getClass() == clazz).map(hw -> (T) hw).collect(Collectors.toList()); + return getHardware().stream().filter(hw -> hw.getClass() == clazz).map(hw -> (T) hw) + .collect(Collectors.toList()); } public void installApplication(AbstractApplication application) { @@ -128,8 +132,11 @@ public void openApplication(AbstractApplication application, boolean isClient) { desktop.removeAllDialogs(); NBTTagCompound nbt = tabletNBT.getCompoundTag(application.getRegistryName()); if (!TerminalBehaviour.isCreative(itemStack)) { - List hwDemand = TerminalRegistry.getAppHardwareDemand(application.getRegistryName(), Math.min(nbt.getInteger("_tier"), application.getMaxTier())); - List unMatch = hwDemand.stream().filter(demand -> getHardware().stream().noneMatch(hw -> hw.isHardwareAdequate(demand))).collect(Collectors.toList()); + List hwDemand = TerminalRegistry.getAppHardwareDemand(application.getRegistryName(), + Math.min(nbt.getInteger("_tier"), application.getMaxTier())); + List unMatch = hwDemand.stream() + .filter(demand -> getHardware().stream().noneMatch(hw -> hw.isHardwareAdequate(demand))) + .collect(Collectors.toList()); if (unMatch.size() > 0) { if (isClient) { StringBuilder tooltips = new StringBuilder("\n"); @@ -139,7 +146,8 @@ public void openApplication(AbstractApplication application, boolean isClient) { if (info == null) { tooltips.append(name); } else if (match instanceof BatteryHardware) { - IElectricItem energyItem = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem energyItem = itemStack + .getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (energyItem != null && energyItem.getCharge() <= 0) { tooltips.append(I18n.format("terminal.battery.low_energy")); } else { @@ -261,15 +269,15 @@ public void shutdown(boolean isClient) { NBTTagCompound synced = openedApp.closeApp(); if (synced != null && !synced.isEmpty()) { tabletNBT.setTag(appName, synced); - if (openedApp.isClientSideApp()) {//if its a clientSideApp and the nbt not null, meaning this nbt should be synced to the server side. + if (openedApp.isClientSideApp()) {// if its a clientSideApp and the nbt not null, meaning this nbt + // should be synced to the server side. nbt.setTag(appName, synced); } } } writeClientAction(-1, buffer -> buffer.writeCompoundTag(nbt)); - } else { //request shutdown from the server side - writeUpdateInfo(-2, packetBuffer -> { - }); + } else { // request shutdown from the server side + writeUpdateInfo(-2, packetBuffer -> {}); } } @@ -293,7 +301,7 @@ protected void closeDialog(TerminalDialogWidget widget) { @Override public void handleClientAction(int id, PacketBuffer buffer) { - if (id == -1) { //shutdown + if (id == -1) { // shutdown NBTTagCompound nbt = null; try { nbt = buffer.readCompoundTag(); @@ -344,7 +352,8 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { for (AbstractApplication close : toClosed) { this.closeApplication(close, true); } - TerminalDialogWidget.showInfoDialog(this, "terminal.component.warning", "terminal.battery.low_energy").setClientSide().open(); + TerminalDialogWidget.showInfoDialog(this, "terminal.component.warning", "terminal.battery.low_energy") + .setClientSide().open(); } } else if (id == -2) { // shutdown shutdown(true); @@ -376,7 +385,8 @@ public void detectAndSendChanges() { } private long disCharge() { - IElectricItem electricItem = hardwareProvider.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem electricItem = hardwareProvider.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (electricItem != null && !TerminalBehaviour.isCreative(itemStack)) { AtomicLong costs = new AtomicLong(0); List charged = new ArrayList<>(); @@ -409,15 +419,17 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender Size size = getSize(); // show menu when mouse near the left edge - if ((focusApp == null || focusApp.canOpenMenuOnEdge()) && isMouseOver(position.x, position.y, 7, size.height, mouseX, mouseY)) { + if ((focusApp == null || focusApp.canOpenMenuOnEdge()) && + isMouseOver(position.x, position.y, 7, size.height, mouseX, mouseY)) { if (menu.isHide && !showMenuHover) { menu.showMenu(); showMenuHover = true; } - } else if (!menu.isHide && showMenuHover && !isMouseOver(position.x - 10, position.y, 41, size.height, mouseX, mouseY)) { - menu.hideMenu(); - showMenuHover = false; - } + } else if (!menu.isHide && showMenuHover && + !isMouseOver(position.x - 10, position.y, 41, size.height, mouseX, mouseY)) { + menu.hideMenu(); + showMenuHover = false; + } if (background != null) { background.draw(position.x, position.y, size.width, size.height); @@ -445,26 +457,31 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender @Override public boolean keyTyped(char charTyped, int keyCode) { - if (waitShutdown && (keyCode == 1 || Minecraft.getMinecraft().gameSettings.keyBindInventory.isActiveAndMatches(keyCode))) { + if (waitShutdown && + (keyCode == 1 || Minecraft.getMinecraft().gameSettings.keyBindInventory.isActiveAndMatches(keyCode))) { shutdown(true); return true; } if (super.keyTyped(charTyped, keyCode)) { return true; } - if (keyCode == 1 || Minecraft.getMinecraft().gameSettings.keyBindInventory.isActiveAndMatches(keyCode)) { // hook esc and e + if (keyCode == 1 || Minecraft.getMinecraft().gameSettings.keyBindInventory.isActiveAndMatches(keyCode)) { // hook + // esc + // and + // e waitShutdown = true; if (!OsSettings.DOUBLE_CHECK) { shutdown(true); return true; } - TerminalDialogWidget.showConfirmDialog(this, "terminal.component.warning", "terminal.os.shutdown_confirm", result -> { - if (result) { - shutdown(true); - } else { - waitShutdown = false; - } - }).setClientSide().open(); + TerminalDialogWidget + .showConfirmDialog(this, "terminal.component.warning", "terminal.os.shutdown_confirm", result -> { + if (result) { + shutdown(true); + } else { + waitShutdown = false; + } + }).setClientSide().open(); return true; } waitShutdown = false; @@ -490,7 +507,9 @@ private void updateOSSize() { this.setSize(new Size(osWidth, osHeight)); this.desktop.setSize(new Size(osWidth, osHeight)); this.menu.setSize(new Size(31, osHeight)); - this.home.setSelfPosition(this.maximize ? new Position((osWidth - this.home.getSize().width) / 2, osHeight - this.home.getSize().height - 10) : new Position(340, 104)); + this.home.setSelfPosition(this.maximize ? + new Position((osWidth - this.home.getSize().width) / 2, osHeight - this.home.getSize().height - 10) : + new Position(340, 104)); this.home.setIcon(this.maximize ? TERMINAL_HOME : null); gui.setSize(this.maximize ? osWidth : 380, this.maximize ? osHeight : 256); if (this.focusApp != null) { diff --git a/src/main/java/gregtech/api/terminal/os/TerminalTheme.java b/src/main/java/gregtech/api/terminal/os/TerminalTheme.java index ff46a6b9e1b..66bf68c5bfd 100644 --- a/src/main/java/gregtech/api/terminal/os/TerminalTheme.java +++ b/src/main/java/gregtech/api/terminal/os/TerminalTheme.java @@ -1,19 +1,22 @@ package gregtech.api.terminal.os; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.gui.resources.ModifyGuiTexture; import gregtech.api.gui.resources.TextureArea; import gregtech.api.util.FileUtility; + import net.minecraftforge.fml.common.FMLCommonHandler; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.awt.*; import java.io.File; import static gregtech.api.terminal.TerminalRegistry.TERMINAL_PATH; public class TerminalTheme { + private static final String FILE_PATH = "config/theme.json"; public static final ColorRectTexture COLOR_1 = new ColorRectTexture(new Color(144, 243, 116)); public static final ColorRectTexture COLOR_2 = new ColorRectTexture(new Color(243, 208, 116)); @@ -30,7 +33,8 @@ public class TerminalTheme { public static final ColorRectTexture COLOR_B_2 = new ColorRectTexture(new Color(0, 0, 0, 160)); public static final ColorRectTexture COLOR_B_3 = new ColorRectTexture(new Color(246, 120, 120, 160)); - public static final ModifyGuiTexture WALL_PAPER = new ModifyGuiTexture(TextureArea.fullImage("textures/gui/terminal/terminal_background.png")); + public static final ModifyGuiTexture WALL_PAPER = new ModifyGuiTexture( + TextureArea.fullImage("textures/gui/terminal/terminal_background.png")); static { if (FMLCommonHandler.instance().getSide().isClient()) { @@ -39,19 +43,45 @@ public class TerminalTheme { saveConfig(); } else { JsonObject config = element.getAsJsonObject(); - if (config.has("COLOR_1")) { COLOR_1.setColor(config.get("COLOR_1").getAsInt()); } - if (config.has("COLOR_2")) { COLOR_2.setColor(config.get("COLOR_2").getAsInt()); } - if (config.has("COLOR_3")) { COLOR_3.setColor(config.get("COLOR_3").getAsInt()); } - if (config.has("COLOR_4")) { COLOR_4.setColor(config.get("COLOR_4").getAsInt()); } - if (config.has("COLOR_5")) { COLOR_5.setColor(config.get("COLOR_5").getAsInt()); } - if (config.has("COLOR_6")) { COLOR_6.setColor(config.get("COLOR_6").getAsInt()); } - if (config.has("COLOR_7")) { COLOR_7.setColor(config.get("COLOR_7").getAsInt()); } - if (config.has("COLOR_F_1")) { COLOR_F_1.setColor(config.get("COLOR_F_1").getAsInt()); } - if (config.has("COLOR_F_2")) { COLOR_F_2.setColor(config.get("COLOR_F_2").getAsInt()); } - if (config.has("COLOR_B_1")) { COLOR_B_1.setColor(config.get("COLOR_B_1").getAsInt()); } - if (config.has("COLOR_B_2")) { COLOR_B_2.setColor(config.get("COLOR_B_2").getAsInt()); } - if (config.has("COLOR_B_3")) { COLOR_B_3.setColor(config.get("COLOR_B_3").getAsInt()); } - if (config.has("WALL_PAPER")) { WALL_PAPER.loadConfig(config.get("WALL_PAPER").getAsJsonObject()); } + if (config.has("COLOR_1")) { + COLOR_1.setColor(config.get("COLOR_1").getAsInt()); + } + if (config.has("COLOR_2")) { + COLOR_2.setColor(config.get("COLOR_2").getAsInt()); + } + if (config.has("COLOR_3")) { + COLOR_3.setColor(config.get("COLOR_3").getAsInt()); + } + if (config.has("COLOR_4")) { + COLOR_4.setColor(config.get("COLOR_4").getAsInt()); + } + if (config.has("COLOR_5")) { + COLOR_5.setColor(config.get("COLOR_5").getAsInt()); + } + if (config.has("COLOR_6")) { + COLOR_6.setColor(config.get("COLOR_6").getAsInt()); + } + if (config.has("COLOR_7")) { + COLOR_7.setColor(config.get("COLOR_7").getAsInt()); + } + if (config.has("COLOR_F_1")) { + COLOR_F_1.setColor(config.get("COLOR_F_1").getAsInt()); + } + if (config.has("COLOR_F_2")) { + COLOR_F_2.setColor(config.get("COLOR_F_2").getAsInt()); + } + if (config.has("COLOR_B_1")) { + COLOR_B_1.setColor(config.get("COLOR_B_1").getAsInt()); + } + if (config.has("COLOR_B_2")) { + COLOR_B_2.setColor(config.get("COLOR_B_2").getAsInt()); + } + if (config.has("COLOR_B_3")) { + COLOR_B_3.setColor(config.get("COLOR_B_3").getAsInt()); + } + if (config.has("WALL_PAPER")) { + WALL_PAPER.loadConfig(config.get("WALL_PAPER").getAsJsonObject()); + } } } } diff --git a/src/main/java/gregtech/api/terminal/os/menu/IMenuComponent.java b/src/main/java/gregtech/api/terminal/os/menu/IMenuComponent.java index 9af2f88f693..519d09b2231 100644 --- a/src/main/java/gregtech/api/terminal/os/menu/IMenuComponent.java +++ b/src/main/java/gregtech/api/terminal/os/menu/IMenuComponent.java @@ -5,6 +5,7 @@ import gregtech.api.gui.resources.IGuiTexture; public interface IMenuComponent { + /** * Component Icon */ @@ -22,5 +23,5 @@ default String hoverText() { /** * Click Event. Side see {@link Widget.ClickData#isClient} */ - default void click(Widget.ClickData clickData){} + default void click(Widget.ClickData clickData) {} } diff --git a/src/main/java/gregtech/api/terminal/os/menu/TerminalMenuWidget.java b/src/main/java/gregtech/api/terminal/os/menu/TerminalMenuWidget.java index 75ea235e1a4..daeaf572d4e 100644 --- a/src/main/java/gregtech/api/terminal/os/menu/TerminalMenuWidget.java +++ b/src/main/java/gregtech/api/terminal/os/menu/TerminalMenuWidget.java @@ -13,6 +13,7 @@ import gregtech.api.util.Size; import gregtech.api.util.interpolate.Eases; import gregtech.api.util.interpolate.Interpolator; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.Tuple; import net.minecraftforge.fml.relauncher.Side; @@ -21,8 +22,8 @@ import java.util.ArrayList; import java.util.List; - public class TerminalMenuWidget extends WidgetGroup { + @SideOnly(Side.CLIENT) private Interpolator interpolator; private IGuiTexture background; @@ -30,10 +31,9 @@ public class TerminalMenuWidget extends WidgetGroup { private final List> components; public boolean isHide; - public TerminalMenuWidget(Position position, Size size, TerminalOSWidget os) { super(position, size); - addSelfPosition( -size.width, 0); + addSelfPosition(-size.width, 0); setVisible(false); isHide = true; this.os = os; @@ -83,25 +83,25 @@ public void addComponent(IMenuComponent component) { .setColors(0, 0xFFFFFFFF, 0) .setHoverText(component.hoverText()) .setIcon(component.buttonIcon()); - button.setClickListener(c->{ - components.forEach(tuple -> { - if (tuple.getFirst() instanceof Widget && tuple.getFirst() != component){ - ((Widget) tuple.getFirst()).setActive(false); - ((Widget) tuple.getFirst()).setVisible(false); - ((CircleButtonWidget) tuple.getSecond().widgets.get(0)).setFill(0); - } - }); - if (component instanceof Widget) { - Widget widget = (Widget)component; - widget.setVisible(!widget.isVisible()); - widget.setActive(!widget.isActive()); - button.setFill(widget.isVisible() ? 0xFF94E2C1 : 0); - } - component.click(c); - }); + button.setClickListener(c -> { + components.forEach(tuple -> { + if (tuple.getFirst() instanceof Widget && tuple.getFirst() != component) { + ((Widget) tuple.getFirst()).setActive(false); + ((Widget) tuple.getFirst()).setVisible(false); + ((CircleButtonWidget) tuple.getSecond().widgets.get(0)).setFill(0); + } + }); + if (component instanceof Widget) { + Widget widget = (Widget) component; + widget.setVisible(!widget.isVisible()); + widget.setActive(!widget.isActive()); + button.setFill(widget.isVisible() ? 0xFF94E2C1 : 0); + } + component.click(c); + }); group.addWidget(button); if (component instanceof Widget) { - Widget widget = (Widget)component; + Widget widget = (Widget) component; widget.setSelfPosition(new Position(x + 20, 0)); widget.setVisible(false); widget.setActive(false); @@ -119,7 +119,7 @@ public void loadComponents(AbstractApplication app) { } public void removeComponents() { - components.forEach(component->this.removeWidget(component.getSecond())); + components.forEach(component -> this.removeWidget(component.getSecond())); components.clear(); } @@ -128,8 +128,8 @@ public void hideMenu() { if (!isHide && interpolator == null) { int y = getSelfPosition().y; interpolator = new Interpolator(getSelfPosition().x, getSelfPosition().x - getSize().width, 6, Eases.LINEAR, - value-> setSelfPosition(new Position(value.intValue(), y)), - value-> { + value -> setSelfPosition(new Position(value.intValue(), y)), + value -> { setVisible(false); interpolator = null; isHide = true; @@ -145,8 +145,8 @@ public void showMenu() { setVisible(true); int y = getSelfPosition().y; interpolator = new Interpolator(getSelfPosition().x, getSelfPosition().x + getSize().width, 6, Eases.LINEAR, - value-> setSelfPosition(new Position(value.intValue(), y)), - value-> { + value -> setSelfPosition(new Position(value.intValue(), y)), + value -> { interpolator = null; isHide = false; }); @@ -157,19 +157,20 @@ public void showMenu() { @Override public void updateScreenOnFrame() { - if(interpolator != null) interpolator.update(); + if (interpolator != null) interpolator.update(); super.updateScreenOnFrame(); } @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { - GlStateManager.color(1,1,1,0.5f); - if( background != null) { + GlStateManager.color(1, 1, 1, 0.5f); + if (background != null) { background.draw(this.getPosition().x, this.getPosition().y, this.getSize().width, this.getSize().height); } else { - drawGradientRect(this.getPosition().x, this.getPosition().y, this.getSize().width, this.getSize().height, 0xff000000, 0xff000000); + drawGradientRect(this.getPosition().x, this.getPosition().y, this.getSize().width, this.getSize().height, + 0xff000000, 0xff000000); } - GlStateManager.color(1,1,1,1); + GlStateManager.color(1, 1, 1, 1); super.drawInBackground(mouseX, mouseY, partialTicks, context); } diff --git a/src/main/java/gregtech/api/terminal/util/FileTree.java b/src/main/java/gregtech/api/terminal/util/FileTree.java index 34e57cbe175..5097c478aff 100644 --- a/src/main/java/gregtech/api/terminal/util/FileTree.java +++ b/src/main/java/gregtech/api/terminal/util/FileTree.java @@ -7,7 +7,7 @@ public class FileTree extends TreeNode { - public FileTree(File dir){ + public FileTree(File dir) { this(0, dir); } diff --git a/src/main/java/gregtech/api/terminal/util/ISearch.java b/src/main/java/gregtech/api/terminal/util/ISearch.java index eaa8e0abd85..2ae8c26569b 100644 --- a/src/main/java/gregtech/api/terminal/util/ISearch.java +++ b/src/main/java/gregtech/api/terminal/util/ISearch.java @@ -3,6 +3,10 @@ import java.util.function.Consumer; public interface ISearch { - default boolean isManualInterrupt() {return false;} + + default boolean isManualInterrupt() { + return false; + } + void search(String word, Consumer find); } diff --git a/src/main/java/gregtech/api/terminal/util/SearchEngine.java b/src/main/java/gregtech/api/terminal/util/SearchEngine.java index 1cfe7a28bb1..316aba3ce6d 100644 --- a/src/main/java/gregtech/api/terminal/util/SearchEngine.java +++ b/src/main/java/gregtech/api/terminal/util/SearchEngine.java @@ -1,21 +1,23 @@ package gregtech.api.terminal.util; -import javax.annotation.Nonnull; import java.util.function.Consumer; -public class SearchEngine { +import javax.annotation.Nonnull; + +public class SearchEngine { + private final ISearch search; private final Consumer result; private Thread thread; - public SearchEngine(@Nonnull ISearch search, @Nonnull Consumer result){ + public SearchEngine(@Nonnull ISearch search, @Nonnull Consumer result) { this.search = search; this.result = result; } public void searchWord(String word) { dispose(); - thread = new Thread(()-> search.search(word, result)); + thread = new Thread(() -> search.search(word, result)); thread.start(); } @@ -33,5 +35,4 @@ public void dispose() { } thread = null; } - } diff --git a/src/main/java/gregtech/api/terminal/util/TreeNode.java b/src/main/java/gregtech/api/terminal/util/TreeNode.java index d54b56d9925..7f99ac830ae 100644 --- a/src/main/java/gregtech/api/terminal/util/TreeNode.java +++ b/src/main/java/gregtech/api/terminal/util/TreeNode.java @@ -1,34 +1,34 @@ package gregtech.api.terminal.util; - import java.util.ArrayList; import java.util.List; /*** * Tree + * * @param key * @param leaf */ public class TreeNode { + public final int dimension; protected final T key; protected K content; protected List> children; - public TreeNode(int dimension, T key) { this.dimension = dimension; this.key = key; } - public boolean isLeaf(){ + public boolean isLeaf() { return getChildren() == null || getChildren().isEmpty(); } - public TreeNode getOrCreateChild (T childKey) { + public TreeNode getOrCreateChild(T childKey) { TreeNode result; if (getChildren() != null) { - result = getChildren().stream().filter(child->child.key.equals(childKey)).findFirst().orElseGet(()->{ + result = getChildren().stream().filter(child -> child.key.equals(childKey)).findFirst().orElseGet(() -> { TreeNode newNode = new TreeNode<>(dimension + 1, childKey); getChildren().add(newNode); return newNode; @@ -52,7 +52,7 @@ public TreeNode getChild(T key) { return null; } - public void addContent (T key, K content) { + public void addContent(T key, K content) { getOrCreateChild(key).content = content; } diff --git a/src/main/java/gregtech/api/unification/Element.java b/src/main/java/gregtech/api/unification/Element.java index 607d56862aa..2826212ecc0 100644 --- a/src/main/java/gregtech/api/unification/Element.java +++ b/src/main/java/gregtech/api/unification/Element.java @@ -27,13 +27,15 @@ public class Element { /** * @param protons Amount of Protons - * @param neutrons Amount of Neutrons (I could have made mistakes with the Neutron amount calculation, please tell me if I did something wrong) + * @param neutrons Amount of Neutrons (I could have made mistakes with the Neutron amount calculation, please + * tell me if I did something wrong) * @param halfLifeSeconds Amount of Half Life this Material has in Seconds. -1 for stable Materials * @param decayTo String representing the Elements it decays to. Separated by an '&' Character * @param name Name of the Element * @param symbol Symbol of the Element */ - public Element(long protons, long neutrons, long halfLifeSeconds, String decayTo, String name, String symbol, boolean isIsotope) { + public Element(long protons, long neutrons, long halfLifeSeconds, String decayTo, String name, String symbol, + boolean isIsotope) { this.protons = protons; this.neutrons = neutrons; this.halfLifeSeconds = halfLifeSeconds; diff --git a/src/main/java/gregtech/api/unification/Elements.java b/src/main/java/gregtech/api/unification/Elements.java index 7b4232048ce..d49203d32f6 100644 --- a/src/main/java/gregtech/api/unification/Elements.java +++ b/src/main/java/gregtech/api/unification/Elements.java @@ -13,8 +13,7 @@ public class Elements { private static final Map elements = new HashMap<>(); - private Elements() { - } + private Elements() {} public static final Element H = add(1, 0, -1, null, "Hydrogen", "H", false); public static final Element D = add(1, 1, -1, "H", "Deuterium", "D", true); @@ -142,7 +141,7 @@ private Elements() { public static final Element Ts = add(117, 177, -1, null, "Tennessine", "Ts", false); public static final Element Og = add(118, 176, -1, null, "Oganesson", "Og", false); - //fantasy todo Naquadah element names + // fantasy todo Naquadah element names public static final Element Tr = add(119, 178, -1, null, "Tritanium", "Tr", false); public static final Element Dr = add(120, 180, -1, null, "Duranium", "Dr", false); public static final Element Ke = add(125, 198, -1, null, "Trinium", "Ke", false); @@ -156,13 +155,13 @@ private Elements() { // TODO Cosmic Neutronium, other Gregicality Elements @ZenMethod - public static Element add(long protons, long neutrons, long halfLifeSeconds, String decayTo, String name, String symbol, boolean isIsotope) { + public static Element add(long protons, long neutrons, long halfLifeSeconds, String decayTo, String name, + String symbol, boolean isIsotope) { Element element = new Element(protons, neutrons, halfLifeSeconds, decayTo, name, symbol, isIsotope); elements.put(name, element); return element; } - public static List getAllElements() { return Collections.unmodifiableList(new ArrayList<>(elements.values())); } diff --git a/src/main/java/gregtech/api/unification/FluidUnifier.java b/src/main/java/gregtech/api/unification/FluidUnifier.java index 5d8dcfd4b59..ffc916c4237 100644 --- a/src/main/java/gregtech/api/unification/FluidUnifier.java +++ b/src/main/java/gregtech/api/unification/FluidUnifier.java @@ -1,9 +1,11 @@ package gregtech.api.unification; import gregtech.api.unification.material.Material; + +import net.minecraftforge.fluids.Fluid; + import it.unimi.dsi.fastutil.Hash; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; -import net.minecraftforge.fluids.Fluid; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -20,24 +22,26 @@ @ApiStatus.Experimental public final class FluidUnifier { - private static final Map fluidToMaterial = new Object2ObjectOpenCustomHashMap<>(new Hash.Strategy<>() { + private static final Map fluidToMaterial = new Object2ObjectOpenCustomHashMap<>( + new Hash.Strategy<>() { - @Override - public int hashCode(@Nullable Fluid o) { - return o == null ? 0 : o.getName().hashCode(); - } + @Override + public int hashCode(@Nullable Fluid o) { + return o == null ? 0 : o.getName().hashCode(); + } - @Override - public boolean equals(@Nullable Fluid a, @Nullable Fluid b) { - return Objects.equals(a == null ? null : a.getName(), b == null ? null : b.getName()); - } - }); + @Override + public boolean equals(@Nullable Fluid a, @Nullable Fluid b) { + return Objects.equals(a == null ? null : a.getName(), b == null ? null : b.getName()); + } + }); private FluidUnifier() {} /** * Register a material to associate with a fluid. Will overwrite existing associations. - * @param fluid the fluid + * + * @param fluid the fluid * @param material the material to associate */ @ApiStatus.Experimental diff --git a/src/main/java/gregtech/api/unification/OreDictUnifier.java b/src/main/java/gregtech/api/unification/OreDictUnifier.java index 1759c89c270..82a63335b70 100644 --- a/src/main/java/gregtech/api/unification/OreDictUnifier.java +++ b/src/main/java/gregtech/api/unification/OreDictUnifier.java @@ -1,7 +1,5 @@ package gregtech.api.unification; -import com.google.common.base.Joiner; -import com.google.common.collect.Sets; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.unification.material.Material; @@ -12,8 +10,7 @@ import gregtech.api.util.CustomModPriorityComparator; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; @@ -22,14 +19,20 @@ import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.AbstractMap.SimpleEntry; +import com.google.common.base.Joiner; +import com.google.common.collect.Sets; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.*; +import java.util.AbstractMap.SimpleEntry; import java.util.Map.Entry; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.M; public class OreDictUnifier { @@ -49,7 +52,7 @@ public static Comparator getSimpleItemStackComparator() { if (stackComparator == null) { List modPriorities = Arrays.asList(ConfigHolder.compat.modPriorities); if (modPriorities.isEmpty()) { - //noinspection ConstantConditions + // noinspection ConstantConditions Function modIdExtractor = stack -> stack.item.getRegistryName().getNamespace(); stackComparator = Comparator.comparing(modIdExtractor); } else { @@ -96,7 +99,7 @@ public static void init() { @SubscribeEvent public static void onItemRegistration(OreRegisterEvent event) { String oreName = event.getName(); - //cache this registration by name + // cache this registration by name ItemVariantMap.Mutable> entry = stackOreDictName.computeIfAbsent(event.getOre().getItem(), item -> item.getHasSubtypes() ? new MultiItemVariantMap<>() : new SingleItemVariantMap<>()); Set set = entry.get(event.getOre()); @@ -105,15 +108,16 @@ public static void onItemRegistration(OreRegisterEvent event) { entry.put(event.getOre(), set); } set.add(oreName); - List itemStackListForOreDictName = oreDictNameStacks.computeIfAbsent(oreName, k -> new ArrayList<>()); + List itemStackListForOreDictName = oreDictNameStacks.computeIfAbsent(oreName, + k -> new ArrayList<>()); addAndSort(itemStackListForOreDictName, event.getOre().copy(), getItemStackComparator()); - //and try to transform registration name into OrePrefix + Material pair + // and try to transform registration name into OrePrefix + Material pair OrePrefix orePrefix = OrePrefix.getPrefix(oreName); Material material = null; if (orePrefix == null) { - //split ore dict name to parts - //oreBasalticMineralSand -> ore, Basaltic, Mineral, Sand + // split ore dict name to parts + // oreBasalticMineralSand -> ore, Basaltic, Mineral, Sand ArrayList splits = new ArrayList<>(); StringBuilder builder = new StringBuilder(); for (char character : oreName.toCharArray()) { @@ -128,17 +132,17 @@ public static void onItemRegistration(OreRegisterEvent event) { splits.add(builder.toString()); } for (MaterialRegistry registry : GregTechAPI.materialManager.getRegistries()) { - //try to combine in different manners - //oreBasaltic MineralSand , ore BasalticMineralSand + // try to combine in different manners + // oreBasaltic MineralSand , ore BasalticMineralSand StringBuilder buffer = new StringBuilder(); for (int i = 0; i < splits.size(); i++) { buffer.append(splits.get(i)); - OrePrefix maybePrefix = OrePrefix.getPrefix(buffer.toString()); //ore -> OrePrefix.ore - String possibleMaterialName = Joiner.on("").join(splits.subList(i + 1, splits.size())); //BasalticMineralSand - String underscoreName = GTUtility.toLowerCaseUnderscore(possibleMaterialName); //basaltic_mineral_sand - Material possibleMaterial = registry.getObject(underscoreName); //Materials.BasalticSand + OrePrefix maybePrefix = OrePrefix.getPrefix(buffer.toString()); // ore -> OrePrefix.ore + String possibleMaterialName = Joiner.on("").join(splits.subList(i + 1, splits.size())); // BasalticMineralSand + String underscoreName = GTUtility.toLowerCaseUnderscore(possibleMaterialName); // basaltic_mineral_sand + Material possibleMaterial = registry.getObject(underscoreName); // Materials.BasalticSand if (possibleMaterial == null) { - //if we didn't find real material, try using marker material registry + // if we didn't find real material, try using marker material registry possibleMaterial = GregTechAPI.markerMaterialRegistry.getMarkerMaterial(underscoreName); } if (maybePrefix != null && possibleMaterial != null) { @@ -151,11 +155,12 @@ public static void onItemRegistration(OreRegisterEvent event) { } } - //finally register item + // finally register item if (orePrefix != null && (material != null || orePrefix.isSelfReferencing)) { ItemAndMetadata key = new ItemAndMetadata(event.getOre()); UnificationEntry unificationEntry = new UnificationEntry(orePrefix, material); - ArrayList itemListForUnifiedEntry = stackUnificationItems.computeIfAbsent(unificationEntry, p -> new ArrayList<>()); + ArrayList itemListForUnifiedEntry = stackUnificationItems.computeIfAbsent(unificationEntry, + p -> new ArrayList<>()); addAndSort(itemListForUnifiedEntry, key, getSimpleItemStackComparator()); if (!unificationEntry.orePrefix.isMarkerPrefix()) { @@ -259,7 +264,8 @@ public static UnificationEntry getUnificationEntry(ItemStack itemStack) { public static ItemStack getUnificated(ItemStack itemStack) { if (itemStack.isEmpty()) return ItemStack.EMPTY; UnificationEntry unificationEntry = getUnificationEntry(itemStack); - if (unificationEntry == null || !stackUnificationItems.containsKey(unificationEntry) || !unificationEntry.orePrefix.isUnificationEnabled) + if (unificationEntry == null || !stackUnificationItems.containsKey(unificationEntry) || + !unificationEntry.orePrefix.isUnificationEnabled) return itemStack; ArrayList keys = stackUnificationItems.get(unificationEntry); return keys.size() > 0 ? keys.get(0).toItemStack(itemStack.getCount()) : itemStack; @@ -347,9 +353,8 @@ public static ItemStack getIngotOrDust(MaterialStack materialStack) { } public static ItemStack getGem(MaterialStack materialStack) { - if (materialStack.material.hasProperty(PropertyKey.GEM) - && !OrePrefix.gem.isIgnored(materialStack.material) - && materialStack.amount == OrePrefix.gem.getMaterialAmount(materialStack.material)) { + if (materialStack.material.hasProperty(PropertyKey.GEM) && !OrePrefix.gem.isIgnored(materialStack.material) && + materialStack.amount == OrePrefix.gem.getMaterialAmount(materialStack.material)) { return get(OrePrefix.gem, materialStack.material, (int) (materialStack.amount / M)); } return getDust(materialStack); diff --git a/src/main/java/gregtech/api/unification/material/MarkerMaterial.java b/src/main/java/gregtech/api/unification/material/MarkerMaterial.java index f6ceebf45d8..aa5c8045a52 100644 --- a/src/main/java/gregtech/api/unification/material/MarkerMaterial.java +++ b/src/main/java/gregtech/api/unification/material/MarkerMaterial.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.util.GTUtility; + import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; @@ -9,7 +10,8 @@ /** * MarkerMaterial is type of material used for generic things like material re-registration and use in recipes * Marker material cannot be used to generate any meta items - * Marker material can be used only for marking other materials (re-registering) equal to it and then using it in recipes or in getting items + * Marker material can be used only for marking other materials (re-registering) equal to it and then using it in + * recipes or in getting items * Marker material is not presented in material registry and cannot be used for persistence */ public final class MarkerMaterial extends Material { @@ -30,10 +32,8 @@ private MarkerMaterial(@Nonnull String name) { } @Override - protected void registerMaterial() { - } + protected void registerMaterial() {} @Override - public void verifyMaterial() { - } + public void verifyMaterial() {} } diff --git a/src/main/java/gregtech/api/unification/material/MarkerMaterials.java b/src/main/java/gregtech/api/unification/material/MarkerMaterials.java index bd5d4ee839e..566ad41f840 100644 --- a/src/main/java/gregtech/api/unification/material/MarkerMaterials.java +++ b/src/main/java/gregtech/api/unification/material/MarkerMaterials.java @@ -1,9 +1,11 @@ package gregtech.api.unification.material; -import com.google.common.collect.HashBiMap; import gregtech.api.GTValues; + import net.minecraft.item.EnumDyeColor; +import com.google.common.collect.HashBiMap; + public class MarkerMaterials { @SuppressWarnings("ResultOfMethodCallIgnored") @@ -51,7 +53,8 @@ public static class Color { * Arrays containing all possible color values (without Colorless!) */ public static final MarkerMaterial[] VALUES = { - White, Orange, Magenta, LightBlue, Yellow, Lime, Pink, Gray, LightGray, Cyan, Purple, Blue, Brown, Green, Red, Black + White, Orange, Magenta, LightBlue, Yellow, Lime, Pink, Gray, LightGray, Cyan, Purple, Blue, Brown, + Green, Red, Black }; /** @@ -77,13 +80,13 @@ public static MarkerMaterial valueOf(String string) { COLORS.put(color, Color.valueOf(color.getName())); } } - } /** * Circuitry, batteries and other technical things */ public static class Tier { + public static final Material ULV = MarkerMaterial.create(GTValues.VN[GTValues.ULV].toLowerCase()); public static final Material LV = MarkerMaterial.create(GTValues.VN[GTValues.LV].toLowerCase()); public static final Material MV = MarkerMaterial.create(GTValues.VN[GTValues.MV].toLowerCase()); @@ -103,11 +106,11 @@ public static class Tier { } public static class Component { + public static final Material Resistor = MarkerMaterial.create("resistor"); public static final Material Transistor = MarkerMaterial.create("transistor"); public static final Material Capacitor = MarkerMaterial.create("capacitor"); public static final Material Diode = MarkerMaterial.create("diode"); public static final Material Inductor = MarkerMaterial.create("inductor"); } - } diff --git a/src/main/java/gregtech/api/unification/material/Material.java b/src/main/java/gregtech/api/unification/material/Material.java index 56c6b9e1a54..3b02e0e3ddd 100644 --- a/src/main/java/gregtech/api/unification/material/Material.java +++ b/src/main/java/gregtech/api/unification/material/Material.java @@ -1,8 +1,5 @@ package gregtech.api.unification.material; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; -import crafttweaker.annotations.ZenRegister; import gregtech.api.GregTechAPI; import gregtech.api.fluids.FluidBuilder; import gregtech.api.fluids.FluidState; @@ -19,18 +16,24 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.LocalizationUtils; import gregtech.api.util.SmallDigits; + import net.minecraft.enchantment.Enchantment; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import crafttweaker.annotations.ZenRegister; import org.jetbrains.annotations.ApiStatus; import stanhebben.zenscript.annotations.*; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.function.UnaryOperator; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @ZenClass("mods.gregtech.material.Material") @ZenRegister public class Material implements Comparable { @@ -111,7 +114,8 @@ public MaterialStack[] getMaterialComponentsCt() { return getMaterialComponents().toArray(new MaterialStack[0]); } - private Material(@Nonnull MaterialInfo materialInfo, @Nonnull MaterialProperties properties, @Nonnull MaterialFlags flags) { + private Material(@Nonnull MaterialInfo materialInfo, @Nonnull MaterialProperties properties, + @Nonnull MaterialFlags flags) { this.materialInfo = materialInfo; this.properties = properties; this.flags = flags; @@ -177,7 +181,7 @@ protected void calculateDecompositionType() { Material material = materialStack.material; onlyMetalMaterials &= material.hasProperty(PropertyKey.INGOT); } - //allow centrifuging of alloy materials only + // allow centrifuging of alloy materials only if (onlyMetalMaterials) { flags.addFlags(MaterialFlags.DECOMPOSITION_BY_CENTRIFUGING); } else { @@ -190,6 +194,7 @@ protected void calculateDecompositionType() { * Retrieves a fluid from the material. * Attempts to retrieve with {@link FluidProperty#getPrimaryKey()}, {@link FluidStorageKeys#LIQUID} and * {@link FluidStorageKeys#GAS}. + * * @return the fluid * @see #getFluid(FluidStorageKey) */ @@ -235,7 +240,7 @@ public FluidStack getFluid(int amount) { /** * - * @param key the key for the fluid + * @param key the key for the fluid * @param amount the amount the FluidStack should have * @return a FluidStack with the fluid and amount */ @@ -245,7 +250,8 @@ public FluidStack getFluid(@Nonnull FluidStorageKey key, int amount) { public int getBlockHarvestLevel() { if (!hasProperty(PropertyKey.DUST)) { - throw new IllegalArgumentException("Material " + getResourceLocation() + " does not have a harvest level! Is probably a Fluid"); + throw new IllegalArgumentException( + "Material " + getResourceLocation() + " does not have a harvest level! Is probably a Fluid"); } int harvestLevel = getProperty(PropertyKey.DUST).getHarvestLevel(); return harvestLevel > 0 ? harvestLevel - 1 : harvestLevel; @@ -253,7 +259,8 @@ public int getBlockHarvestLevel() { public int getToolHarvestLevel() { if (!hasProperty(PropertyKey.TOOL)) { - throw new IllegalArgumentException("Material " + getResourceLocation() + " does not have a tool harvest level! Is probably not a Tool Material"); + throw new IllegalArgumentException("Material " + getResourceLocation() + + " does not have a tool harvest level! Is probably not a Tool Material"); } return getProperty(PropertyKey.TOOL).getToolHarvestLevel(); } @@ -313,7 +320,6 @@ public long getNeutrons() { return totalNeutrons / totalAmount; } - @ZenGetter("mass") public long getMass() { if (materialInfo.element != null) @@ -338,7 +344,7 @@ public FluidStack getPlasma(int amount) { return getFluid(FluidStorageKeys.PLASMA, amount); } - //TODO clean up the name-related methods + // TODO clean up the name-related methods @ZenGetter("name") @Nonnull public String getName() { @@ -515,6 +521,7 @@ public Builder fluid(@Nonnull FluidStorageKey key, @Nonnull FluidBuilder builder /** * Add a liquid for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder liquid() { @@ -523,6 +530,7 @@ public Builder liquid() { /** * Add a liquid for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder liquid(@Nonnull FluidBuilder builder) { @@ -531,6 +539,7 @@ public Builder liquid(@Nonnull FluidBuilder builder) { /** * Add a plasma for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder plasma() { @@ -539,6 +548,7 @@ public Builder plasma() { /** * Add a plasma for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder plasma(@Nonnull FluidBuilder builder) { @@ -547,6 +557,7 @@ public Builder plasma(@Nonnull FluidBuilder builder) { /** * Add a gas for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder gas() { @@ -555,6 +566,7 @@ public Builder gas() { /** * Add a gas for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder gas(@Nonnull FluidBuilder builder) { @@ -652,7 +664,8 @@ public Builder ingot() { * * @param harvestLevel The Harvest Level of this block for Mining. 2 will make it require a iron tool.
* If this Material also has a {@link ToolProperty}, this value will - * also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest diamonds.
+ * also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest + * diamonds.
* If this Material already had a Harvest Level defined, it will be overridden. * @throws IllegalArgumentException If an {@link IngotProperty} has already been added to this Material. */ @@ -666,7 +679,8 @@ public Builder ingot(int harvestLevel) { * * @param harvestLevel The Harvest Level of this block for Mining. 2 will make it require a iron tool.
* If this Material also has a {@link ToolProperty}, this value will - * also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest diamonds.
+ * also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest + * diamonds.
* If this Material already had a Harvest Level defined, it will be overridden. * @param burnTime The Burn Time (in ticks) of this Material as a Furnace Fuel.
* If this Material already had a Burn Time defined, it will be overridden. @@ -794,9 +808,9 @@ public Builder colorAverage() { * Set the {@link MaterialIconSet} of this Material.
* Defaults vary depending on if the Material has a:
*

    - *
  • {@link GemProperty}, it will default to {@link MaterialIconSet#GEM_VERTICAL} - *
  • {@link IngotProperty} or {@link DustProperty}, it will default to {@link MaterialIconSet#DULL} - *
  • {@link FluidProperty}, it will default to {@link MaterialIconSet#FLUID} + *
  • {@link GemProperty}, it will default to {@link MaterialIconSet#GEM_VERTICAL} + *
  • {@link IngotProperty} or {@link DustProperty}, it will default to {@link MaterialIconSet#DULL} + *
  • {@link FluidProperty}, it will default to {@link MaterialIconSet#FLUID} *
* Default will be determined by first-found Property in this order, unless specified. * @@ -810,18 +824,16 @@ public Builder iconSet(MaterialIconSet iconSet) { public Builder components(Object... components) { Preconditions.checkArgument( components.length % 2 == 0, - "Material Components list malformed!" - ); + "Material Components list malformed!"); for (int i = 0; i < components.length; i += 2) { if (components[i] == null) { - throw new IllegalArgumentException("Material in Components List is null for Material " - + this.materialInfo.resourceLocation); + throw new IllegalArgumentException( + "Material in Components List is null for Material " + this.materialInfo.resourceLocation); } composition.add(new MaterialStack( (Material) components[i], - (Integer) components[i + 1] - )); + (Integer) components[i + 1])); } return this; } @@ -851,8 +863,10 @@ public Builder flags(MaterialFlag... flags) { * Dependent Flags (for example, {@link MaterialFlags#GENERATE_LONG_ROD} requiring * {@link MaterialFlags#GENERATE_ROD}) will be automatically applied. * - * @param f1 A {@link Collection} of {@link MaterialFlag}. Provided this way for easy Flag presets to be applied. - * @param f2 An Array of {@link MaterialFlag}. If no {@link Collection} is required, use {@link Builder#flags(MaterialFlag...)}. + * @param f1 A {@link Collection} of {@link MaterialFlag}. Provided this way for easy Flag presets to be + * applied. + * @param f2 An Array of {@link MaterialFlag}. If no {@link Collection} is required, use + * {@link Builder#flags(MaterialFlag...)}. */ public Builder flags(Collection f1, MaterialFlag... f2) { this.flags.addFlags(f1.toArray(new MaterialFlag[0])); @@ -906,12 +920,12 @@ public Builder blastTemp(int temp, BlastProperty.GasTier gasTier, int eutOverrid public Builder blastTemp(int temp, BlastProperty.GasTier gasTier, int eutOverride, int durationOverride) { return blast(b -> b.temp(temp, gasTier).blastStats(eutOverride, durationOverride)); } - + public Builder blast(int temp) { properties.setProperty(PropertyKey.BLAST, new BlastProperty(temp)); return this; } - + public Builder blast(int temp, BlastProperty.GasTier gasTier) { properties.setProperty(PropertyKey.BLAST, new BlastProperty(temp, gasTier)); return this; @@ -1006,8 +1020,10 @@ public Builder cableProperties(long voltage, int amperage, int loss, boolean isS return this; } - public Builder cableProperties(long voltage, int amperage, int loss, boolean isSuperCon, int criticalTemperature) { - properties.setProperty(PropertyKey.WIRE, new WireProperties((int) voltage, amperage, loss, isSuperCon, criticalTemperature)); + public Builder cableProperties(long voltage, int amperage, int loss, boolean isSuperCon, + int criticalTemperature) { + properties.setProperty(PropertyKey.WIRE, + new WireProperties((int) voltage, amperage, loss, isSuperCon, criticalTemperature)); return this; } @@ -1015,8 +1031,10 @@ public Builder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof return fluidPipeProperties(maxTemp, throughput, gasProof, false, false, false); } - public Builder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { - properties.setProperty(PropertyKey.FLUID_PIPE, new FluidPipeProperties(maxTemp, throughput, gasProof, acidProof, cryoProof, plasmaProof)); + public Builder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof) { + properties.setProperty(PropertyKey.FLUID_PIPE, + new FluidPipeProperties(maxTemp, throughput, gasProof, acidProof, cryoProof, plasmaProof)); return this; } @@ -1045,6 +1063,7 @@ public Material build() { * Holds the basic info for a Material, like the name, color, id, etc.. */ private static class MaterialInfo { + /** * The modid and unlocalized name of this Material. *

@@ -1093,24 +1112,26 @@ private MaterialInfo(int metaItemSubId, @Nonnull ResourceLocation resourceLocati this.metaItemSubId = metaItemSubId; String name = resourceLocation.getPath(); if (!GTUtility.toLowerCaseUnderscore(GTUtility.lowerUnderscoreToUpperCamel(name)).equals(name)) { - throw new IllegalArgumentException("Cannot add materials with names like 'materialnumber'! Use 'material_number' instead."); + throw new IllegalArgumentException( + "Cannot add materials with names like 'materialnumber'! Use 'material_number' instead."); } this.resourceLocation = resourceLocation; } private void verifyInfo(MaterialProperties p, boolean averageRGB) { - // Verify IconSet if (iconSet == null) { if (p.hasProperty(PropertyKey.GEM)) { iconSet = MaterialIconSet.GEM_VERTICAL; - } else if (p.hasProperty(PropertyKey.DUST) || p.hasProperty(PropertyKey.INGOT) || p.hasProperty(PropertyKey.POLYMER)) { - iconSet = MaterialIconSet.DULL; - } else if (p.hasProperty(PropertyKey.FLUID)) { - iconSet = MaterialIconSet.FLUID; - } else { - iconSet = MaterialIconSet.DULL; - } + } else if (p.hasProperty(PropertyKey.DUST) || p.hasProperty(PropertyKey.INGOT) || + p.hasProperty(PropertyKey.POLYMER)) { + iconSet = MaterialIconSet.DULL; + } else + if (p.hasProperty(PropertyKey.FLUID)) { + iconSet = MaterialIconSet.FLUID; + } else { + iconSet = MaterialIconSet.DULL; + } } // Verify MaterialRGB diff --git a/src/main/java/gregtech/api/unification/material/Materials.java b/src/main/java/gregtech/api/unification/material/Materials.java index 3a8767bb383..d2d65e81f72 100644 --- a/src/main/java/gregtech/api/unification/material/Materials.java +++ b/src/main/java/gregtech/api/unification/material/Materials.java @@ -17,14 +17,14 @@ * All Material Builders should follow this general formatting: *

* material = new MaterialBuilder(id, name) - * .ingot().fluid().ore() <--- types - * .color().iconSet() <--- appearance - * .flags() <--- special generation - * .element() / .components() <--- composition - * .toolStats() <--- - * .oreByProducts() | additional properties - * ... <--- - * .blastTemp() <--- blast temperature + * .ingot().fluid().ore() <--- types + * .color().iconSet() <--- appearance + * .flags() <--- special generation + * .element() / .components() <--- composition + * .toolStats() <--- + * .oreByProducts() | additional properties + * ... <--- + * .blastTemp() <--- blast temperature * .build(); *

* Use defaults to your advantage! Some defaults: @@ -99,7 +99,7 @@ public static void register() { * - Reserved for CraftTweaker: 32000-32767 */ - CHEMICAL_DYES = new Material[]{ + CHEMICAL_DYES = new Material[] { Materials.DyeWhite, Materials.DyeOrange, Materials.DyeMagenta, Materials.DyeLightBlue, Materials.DyeYellow, Materials.DyeLime, @@ -340,7 +340,6 @@ public static void register() { public static Material Tantalite; public static Material Coke; - public static Material SolderingAlloy; public static Material Spessartine; public static Material Sphalerite; diff --git a/src/main/java/gregtech/api/unification/material/event/MaterialEvent.java b/src/main/java/gregtech/api/unification/material/event/MaterialEvent.java index 8bef5861255..71476090916 100644 --- a/src/main/java/gregtech/api/unification/material/event/MaterialEvent.java +++ b/src/main/java/gregtech/api/unification/material/event/MaterialEvent.java @@ -1,6 +1,7 @@ package gregtech.api.unification.material.event; import gregtech.api.unification.material.Material; + import net.minecraftforge.fml.common.eventhandler.GenericEvent; /** diff --git a/src/main/java/gregtech/api/unification/material/event/MaterialRegistryEvent.java b/src/main/java/gregtech/api/unification/material/event/MaterialRegistryEvent.java index 3aee4e72004..1989347a1b3 100644 --- a/src/main/java/gregtech/api/unification/material/event/MaterialRegistryEvent.java +++ b/src/main/java/gregtech/api/unification/material/event/MaterialRegistryEvent.java @@ -1,7 +1,8 @@ package gregtech.api.unification.material.event; -import gregtech.api.unification.material.registry.MaterialRegistry; import gregtech.api.unification.material.registry.IMaterialRegistryManager; +import gregtech.api.unification.material.registry.MaterialRegistry; + import net.minecraftforge.fml.common.eventhandler.GenericEvent; /** diff --git a/src/main/java/gregtech/api/unification/material/event/PostMaterialEvent.java b/src/main/java/gregtech/api/unification/material/event/PostMaterialEvent.java index 82172d8ae6a..23a501a69ab 100644 --- a/src/main/java/gregtech/api/unification/material/event/PostMaterialEvent.java +++ b/src/main/java/gregtech/api/unification/material/event/PostMaterialEvent.java @@ -1,6 +1,7 @@ package gregtech.api.unification.material.event; import gregtech.api.unification.material.Material; + import net.minecraftforge.fml.common.eventhandler.GenericEvent; /** diff --git a/src/main/java/gregtech/api/unification/material/info/MaterialFlag.java b/src/main/java/gregtech/api/unification/material/info/MaterialFlag.java index 098fbe0b8e0..dffbd6d29b9 100644 --- a/src/main/java/gregtech/api/unification/material/info/MaterialFlag.java +++ b/src/main/java/gregtech/api/unification/material/info/MaterialFlag.java @@ -3,6 +3,7 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.util.GTLog; + import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import java.util.Arrays; @@ -30,7 +31,8 @@ private MaterialFlag(String name, Set requiredFlags, Set verifyFlag(Material material) { requiredProperties.forEach(key -> { if (!material.hasProperty(key)) { - GTLog.logger.warn("Material {} does not have required property {} for flag {}!", material.getUnlocalizedName(), key.toString(), this.name); + GTLog.logger.warn("Material {} does not have required property {} for flag {}!", + material.getUnlocalizedName(), key.toString(), this.name); } }); diff --git a/src/main/java/gregtech/api/unification/material/info/MaterialFlags.java b/src/main/java/gregtech/api/unification/material/info/MaterialFlags.java index cf6bdf14075..2bed36b06a4 100644 --- a/src/main/java/gregtech/api/unification/material/info/MaterialFlags.java +++ b/src/main/java/gregtech/api/unification/material/info/MaterialFlags.java @@ -37,7 +37,7 @@ public String toString() { } ///////////////// - // GENERIC // + // GENERIC // ///////////////// /** @@ -48,12 +48,14 @@ public String toString() { /** * Enables electrolyzer decomposition recipe generation */ - public static final MaterialFlag DECOMPOSITION_BY_ELECTROLYZING = new MaterialFlag.Builder("decomposition_by_electrolyzing").build(); + public static final MaterialFlag DECOMPOSITION_BY_ELECTROLYZING = new MaterialFlag.Builder( + "decomposition_by_electrolyzing").build(); /** * Enables centrifuge decomposition recipe generation */ - public static final MaterialFlag DECOMPOSITION_BY_CENTRIFUGING = new MaterialFlag.Builder("decomposition_by_centrifuging").build(); + public static final MaterialFlag DECOMPOSITION_BY_CENTRIFUGING = new MaterialFlag.Builder( + "decomposition_by_centrifuging").build(); /** * Disables decomposition recipe generation for this material @@ -81,7 +83,7 @@ public String toString() { public static final MaterialFlag GLOWING = new MaterialFlag.Builder("glowing").build(); ////////////////// - // DUST // + // DUST // ////////////////// /** @@ -136,28 +138,32 @@ public String toString() { * This will prevent material from creating Shapeless recipes for dust to block and vice versa * Also preventing extruding and alloy smelting recipes via SHAPE_EXTRUDING/MOLD_BLOCK */ - public static final MaterialFlag EXCLUDE_BLOCK_CRAFTING_RECIPES = new MaterialFlag.Builder("exclude_block_crafting_recipes") - .requireProps(PropertyKey.DUST) - .build(); + public static final MaterialFlag EXCLUDE_BLOCK_CRAFTING_RECIPES = new MaterialFlag.Builder( + "exclude_block_crafting_recipes") + .requireProps(PropertyKey.DUST) + .build(); - public static final MaterialFlag EXCLUDE_PLATE_COMPRESSOR_RECIPE = new MaterialFlag.Builder("exclude_plate_compressor_recipe") - .requireFlags(GENERATE_PLATE) - .requireProps(PropertyKey.DUST) - .build(); + public static final MaterialFlag EXCLUDE_PLATE_COMPRESSOR_RECIPE = new MaterialFlag.Builder( + "exclude_plate_compressor_recipe") + .requireFlags(GENERATE_PLATE) + .requireProps(PropertyKey.DUST) + .build(); /** * This will prevent material from creating Shapeless recipes for dust to block and vice versa */ - public static final MaterialFlag EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES = new MaterialFlag.Builder("exclude_block_crafting_by_hand_recipes") - .requireProps(PropertyKey.DUST) - .build(); + public static final MaterialFlag EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES = new MaterialFlag.Builder( + "exclude_block_crafting_by_hand_recipes") + .requireProps(PropertyKey.DUST) + .build(); public static final MaterialFlag MORTAR_GRINDABLE = new MaterialFlag.Builder("mortar_grindable") .requireProps(PropertyKey.DUST) .build(); /** - * Add to material if it cannot be worked by any other means, than smashing or smelting. This is used for coated Materials. + * Add to material if it cannot be worked by any other means, than smashing or smelting. This is used for coated + * Materials. */ public static final MaterialFlag NO_WORKING = new MaterialFlag.Builder("no_working") .requireProps(PropertyKey.DUST) @@ -178,19 +184,22 @@ public String toString() { .build(); /** - * Add this to your Material if you want to have its Ore Calcite heated in a Blast Furnace for more output. Already listed are: + * Add this to your Material if you want to have its Ore Calcite heated in a Blast Furnace for more output. Already + * listed are: * Iron, Pyrite, PigIron, WroughtIron. */ - public static final MaterialFlag BLAST_FURNACE_CALCITE_DOUBLE = new MaterialFlag.Builder("blast_furnace_calcite_double") - .requireProps(PropertyKey.DUST) - .build(); + public static final MaterialFlag BLAST_FURNACE_CALCITE_DOUBLE = new MaterialFlag.Builder( + "blast_furnace_calcite_double") + .requireProps(PropertyKey.DUST) + .build(); - public static final MaterialFlag BLAST_FURNACE_CALCITE_TRIPLE = new MaterialFlag.Builder("blast_furnace_calcite_triple") - .requireProps(PropertyKey.DUST) - .build(); + public static final MaterialFlag BLAST_FURNACE_CALCITE_TRIPLE = new MaterialFlag.Builder( + "blast_furnace_calcite_triple") + .requireProps(PropertyKey.DUST) + .build(); ///////////////// - // FLUID // + // FLUID // ///////////////// public static final MaterialFlag SOLDER_MATERIAL = new MaterialFlag.Builder("solder_material") @@ -206,7 +215,7 @@ public String toString() { .build(); ///////////////// - // INGOT // + // INGOT // ///////////////// public static final MaterialFlag GENERATE_FOIL = new MaterialFlag.Builder("generate_foil") @@ -256,7 +265,7 @@ public String toString() { .build(); ///////////////// - // GEM // + // GEM // ///////////////// /** @@ -272,7 +281,7 @@ public String toString() { .build(); ///////////////// - // ORE // + // ORE // ///////////////// public static final MaterialFlag HIGH_SIFTER_OUTPUT = new MaterialFlag.Builder("high_sifter_output") diff --git a/src/main/java/gregtech/api/unification/material/info/MaterialIconSet.java b/src/main/java/gregtech/api/unification/material/info/MaterialIconSet.java index feb46381865..7f9626e7c12 100644 --- a/src/main/java/gregtech/api/unification/material/info/MaterialIconSet.java +++ b/src/main/java/gregtech/api/unification/material/info/MaterialIconSet.java @@ -6,12 +6,13 @@ import stanhebben.zenscript.annotations.ZenGetter; import stanhebben.zenscript.annotations.ZenMethod; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @ZenClass("mods.gregtech.material.MaterialIconSet") @ZenRegister public class MaterialIconSet { @@ -77,13 +78,15 @@ public MaterialIconSet(@Nonnull String name, @Nonnull MaterialIconSet parentIcon /** * Create a new MaterialIconSet which is a root + * * @param name the name of the iconset * @param parentIconset the parent iconset, should be null if this should be a root iconset * @param isRootIconset true if this should be a root iconset, otherwise false */ public MaterialIconSet(@Nonnull String name, @Nullable MaterialIconSet parentIconset, boolean isRootIconset) { this.name = name.toLowerCase(Locale.ENGLISH); - Preconditions.checkArgument(!ICON_SETS.containsKey(this.name), "MaterialIconSet " + this.name + " already registered!"); + Preconditions.checkArgument(!ICON_SETS.containsKey(this.name), + "MaterialIconSet " + this.name + " already registered!"); this.id = idCounter++; this.isRootIconset = isRootIconset; this.parentIconset = parentIconset; diff --git a/src/main/java/gregtech/api/unification/material/info/MaterialIconType.java b/src/main/java/gregtech/api/unification/material/info/MaterialIconType.java index a825319df7c..8f749b587cc 100644 --- a/src/main/java/gregtech/api/unification/material/info/MaterialIconType.java +++ b/src/main/java/gregtech/api/unification/material/info/MaterialIconType.java @@ -1,18 +1,21 @@ package gregtech.api.unification.material.info; -import com.google.common.base.CaseFormat; -import com.google.common.base.Preconditions; -import com.google.common.collect.HashBasedTable; -import com.google.common.collect.Table; import gregtech.api.gui.resources.ResourceHelper; import gregtech.api.util.GTUtility; + import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLCommonHandler; -import javax.annotation.Nonnull; +import com.google.common.base.CaseFormat; +import com.google.common.base.Preconditions; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; + import java.util.HashMap; import java.util.Map; +import javax.annotation.Nonnull; + public class MaterialIconType { public static final Map ICON_TYPES = new HashMap<>(); @@ -99,9 +102,12 @@ public class MaterialIconType { public static final MaterialIconType crop = new MaterialIconType("crop"); public static final MaterialIconType essence = new MaterialIconType("essence"); - private static final Table ITEM_MODEL_CACHE = HashBasedTable.create(); - private static final Table BLOCK_TEXTURE_CACHE = HashBasedTable.create(); - private static final Table BLOCK_MODEL_CACHE = HashBasedTable.create(); + private static final Table ITEM_MODEL_CACHE = HashBasedTable + .create(); + private static final Table BLOCK_TEXTURE_CACHE = HashBasedTable + .create(); + private static final Table BLOCK_MODEL_CACHE = HashBasedTable + .create(); private static final String BLOCK_TEXTURE_PATH_FULL = "textures/blocks/material_sets/%s/%s.png"; private static final String BLOCK_TEXTURE_PATH = "blocks/material_sets/%s/%s"; @@ -117,7 +123,8 @@ public class MaterialIconType { public MaterialIconType(String name) { this.name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name); - Preconditions.checkArgument(!ICON_TYPES.containsKey(this.name), "MaterialIconType " + this.name + " already registered!"); + Preconditions.checkArgument(!ICON_TYPES.containsKey(this.name), + "MaterialIconType " + this.name + " already registered!"); this.id = idCounter++; ICON_TYPES.put(this.name, this); } diff --git a/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java b/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java index 79d24e8d3a1..f199f2c5a3d 100644 --- a/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java @@ -297,7 +297,8 @@ public static void register() { .ore() .color(0xFFE650).iconSet(SHINY) .flags(EXT2_METAL, GENERATE_RING, MORTAR_GRINDABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, - GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FINE_WIRE, GENERATE_FOIL, GENERATE_DOUBLE_PLATE) + GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FINE_WIRE, GENERATE_FOIL, + GENERATE_DOUBLE_PLATE) .element(Elements.Au) .cableProperties(V[HV], 3, 2) .fluidPipeProperties(1671, 25, true, true, false, false) @@ -377,7 +378,9 @@ public static void register() { .plasma() .ore() .color(0xC8C8C8).iconSet(METALLIC) - .flags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_GEAR, GENERATE_SPRING_SMALL, GENERATE_SPRING, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, BLAST_FURNACE_CALCITE_TRIPLE) + .flags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_GEAR, + GENERATE_SPRING_SMALL, GENERATE_SPRING, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + BLAST_FURNACE_CALCITE_TRIPLE) .element(Elements.Fe) .toolStats(ToolProperty.Builder.of(2.0F, 2.0F, 256, 2) .enchantability(14).build()) @@ -820,10 +823,12 @@ public static void register() { .itemPipeProperties(4096, 0.5f) .build(); - Titanium = new Material.Builder(113, gregtechId("titanium")) // todo Ore? Look at EBF recipe here if we do Ti ores + Titanium = new Material.Builder(113, gregtechId("titanium")) // todo Ore? Look at EBF recipe here if we do Ti + // ores .ingot(3).fluid() .color(0xDCA0F0).iconSet(METALLIC) - .flags(EXT2_METAL, GENERATE_DOUBLE_PLATE, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_GEAR, GENERATE_FRAME) + .flags(EXT2_METAL, GENERATE_DOUBLE_PLATE, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_GEAR, + GENERATE_FRAME) .element(Elements.Ti) .toolStats(ToolProperty.Builder.of(8.0F, 6.0F, 1536, 3) .enchantability(14).build()) @@ -846,7 +851,8 @@ public static void register() { .ingot(3) .liquid(new FluidBuilder().temperature(3695)) .color(0x323232).iconSet(METALLIC) - .flags(EXT2_METAL, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FOIL, GENERATE_GEAR, GENERATE_DOUBLE_PLATE) + .flags(EXT2_METAL, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FOIL, GENERATE_GEAR, + GENERATE_DOUBLE_PLATE) .element(Elements.W) .rotorStats(7.0f, 3.0f, 2560) .cableProperties(V[IV], 2, 2) @@ -916,7 +922,8 @@ public static void register() { .liquid(new FluidBuilder().customStill()) .ore() .color(0x323232).iconSet(METALLIC) - .flags(EXT_METAL, GENERATE_FOIL, GENERATE_SPRING, GENERATE_FINE_WIRE, GENERATE_BOLT_SCREW, GENERATE_DOUBLE_PLATE) + .flags(EXT_METAL, GENERATE_FOIL, GENERATE_SPRING, GENERATE_FINE_WIRE, GENERATE_BOLT_SCREW, + GENERATE_DOUBLE_PLATE) .element(Elements.Nq) .rotorStats(6.0f, 4.0f, 1280) .cableProperties(V[ZPM], 2, 2) @@ -943,7 +950,8 @@ public static void register() { .ingot(3) .liquid(new FluidBuilder().customStill()) .color(0x1E1E1E).iconSet(SHINY) - .flags(EXT_METAL, GENERATE_DOUBLE_PLATE, GENERATE_FOIL, GENERATE_GEAR, GENERATE_FINE_WIRE, GENERATE_BOLT_SCREW) + .flags(EXT_METAL, GENERATE_DOUBLE_PLATE, GENERATE_FOIL, GENERATE_GEAR, GENERATE_FINE_WIRE, + GENERATE_BOLT_SCREW) .element(Elements.Nq2) .blast(b -> b .temp(9000, GasTier.HIGH) @@ -955,7 +963,8 @@ public static void register() { .ingot(6) .liquid(new FluidBuilder().temperature(100_000)) .color(0xFAFAFA) - .flags(EXT_METAL, GENERATE_BOLT_SCREW, GENERATE_FRAME, GENERATE_GEAR, GENERATE_LONG_ROD, GENERATE_DOUBLE_PLATE) + .flags(EXT_METAL, GENERATE_BOLT_SCREW, GENERATE_FRAME, GENERATE_GEAR, GENERATE_LONG_ROD, + GENERATE_DOUBLE_PLATE) .element(Elements.Nt) .toolStats(ToolProperty.Builder.of(180.0F, 100.0F, 65535, 6) .attackSpeed(0.5F).enchantability(33).magnetic().unbreakable().build()) @@ -967,7 +976,8 @@ public static void register() { .ingot(6) .liquid(new FluidBuilder().temperature(25_000)) .color(0x600000).iconSet(METALLIC) - .flags(EXT2_METAL, GENERATE_FRAME, GENERATE_RING, GENERATE_SMALL_GEAR, GENERATE_ROUND, GENERATE_FOIL, GENERATE_FINE_WIRE, GENERATE_GEAR) + .flags(EXT2_METAL, GENERATE_FRAME, GENERATE_RING, GENERATE_SMALL_GEAR, GENERATE_ROUND, GENERATE_FOIL, + GENERATE_FINE_WIRE, GENERATE_GEAR) .element(Elements.Tr) .cableProperties(V[UV], 1, 8) .rotorStats(20.0f, 6.0f, 10240) @@ -995,6 +1005,5 @@ public static void register() { .blastStats(VA[LuV], 1500) .vacuumStats(VA[IV], 300)) .build(); - } } diff --git a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java index d9df7df44fc..61aec7180c3 100644 --- a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java @@ -7,6 +7,7 @@ import gregtech.api.unification.material.properties.BlastProperty.GasTier; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.material.properties.ToolProperty; + import net.minecraft.init.Enchantments; import static gregtech.api.GTValues.*; @@ -136,7 +137,7 @@ public static void register() { .build(); Charcoal = new Material.Builder(266, gregtechId("charcoal")) - .gem(1, 1600) //default charcoal burn time in vanilla + .gem(1, 1600) // default charcoal burn time in vanilla .color(0x644646).iconSet(FINE) .flags(FLAMMABLE, NO_SMELTING, NO_SMASHING, MORTAR_GRINDABLE) .components(Carbon, 1) @@ -165,9 +166,10 @@ public static void register() { // FREE ID 270 Coal = new Material.Builder(271, gregtechId("coal")) - .gem(1, 1600).ore(2, 1) //default coal burn time in vanilla + .gem(1, 1600).ore(2, 1) // default coal burn time in vanilla .color(0x464646).iconSet(LIGNITE) - .flags(FLAMMABLE, NO_SMELTING, NO_SMASHING, MORTAR_GRINDABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, DISABLE_DECOMPOSITION) + .flags(FLAMMABLE, NO_SMELTING, NO_SMASHING, MORTAR_GRINDABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + DISABLE_DECOMPOSITION) .components(Carbon, 1) .build(); @@ -223,7 +225,8 @@ public static void register() { Emerald = new Material.Builder(278, gregtechId("emerald")) .gem().ore(2, 1) .color(0x50FF50).iconSet(EMERALD) - .flags(EXT_METAL, NO_SMASHING, NO_SMELTING, HIGH_SIFTER_OUTPUT, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, GENERATE_LENS) + .flags(EXT_METAL, NO_SMASHING, NO_SMELTING, HIGH_SIFTER_OUTPUT, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + GENERATE_LENS) .components(Beryllium, 3, Aluminium, 2, Silicon, 6, Oxygen, 18) .build(); @@ -310,7 +313,8 @@ public static void register() { Lazurite = new Material.Builder(289, gregtechId("lazurite")) .gem(1).ore(6, 4) .color(0x6478FF).iconSet(LAPIS) - .flags(GENERATE_PLATE, NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, GENERATE_ROD, DECOMPOSITION_BY_ELECTROLYZING) + .flags(GENERATE_PLATE, NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, GENERATE_ROD, + DECOMPOSITION_BY_ELECTROLYZING) .components(Aluminium, 6, Silicon, 6, Calcium, 8, Sodium, 8) .build(); @@ -537,7 +541,8 @@ public static void register() { Sodalite = new Material.Builder(316, gregtechId("sodalite")) .gem(1).ore(6, 4) .color(0x1414FF).iconSet(LAPIS) - .flags(GENERATE_PLATE, GENERATE_ROD, NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, DECOMPOSITION_BY_ELECTROLYZING) + .flags(GENERATE_PLATE, GENERATE_ROD, NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, + DECOMPOSITION_BY_ELECTROLYZING) .components(Aluminium, 3, Silicon, 3, Sodium, 4, Chlorine, 1) .build(); @@ -720,7 +725,8 @@ public static void register() { .ingot() .liquid(new FluidBuilder().temperature(1799)) .color(0x504046).iconSet(METALLIC) - .flags(EXT_METAL, GENERATE_FINE_WIRE, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FOIL, GENERATE_BOLT_SCREW) + .flags(EXT_METAL, GENERATE_FINE_WIRE, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FOIL, + GENERATE_BOLT_SCREW) .components(Yttrium, 1, Barium, 2, Copper, 3, Oxygen, 7) .cableProperties(V[UV], 4, 4) .blast(b -> b @@ -732,7 +738,8 @@ public static void register() { NetherQuartz = new Material.Builder(339, gregtechId("nether_quartz")) .gem(1).ore(2, 1) .color(0xE6D2D2).iconSet(QUARTZ) - .flags(GENERATE_PLATE, NO_SMELTING, CRYSTALLIZABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, DISABLE_DECOMPOSITION) + .flags(GENERATE_PLATE, NO_SMELTING, CRYSTALLIZABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + DISABLE_DECOMPOSITION) .components(Silicon, 1, Oxygen, 2) .build(); @@ -1385,31 +1392,33 @@ public static void register() { .build() .setFormula("URhNq2", true); - EnrichedNaquadahTriniumEuropiumDuranide = new Material.Builder(431, gregtechId("enriched_naquadah_trinium_europium_duranide")) - .ingot() - .liquid(new FluidBuilder().temperature(5930)) - .color(0x7D9673).iconSet(METALLIC) - .flags(DECOMPOSITION_BY_CENTRIFUGING, GENERATE_FINE_WIRE) - .components(NaquadahEnriched, 4, Trinium, 3, Europium, 2, Duranium, 1) - .cableProperties(GTValues.V[GTValues.UV], 16, 0, true, 3) - .blast(b -> b - .temp(9900, GasTier.HIGH) - .blastStats(VA[LuV], 1200) - .vacuumStats(VA[UV], 200)) - .build(); - - RutheniumTriniumAmericiumNeutronate = new Material.Builder(432, gregtechId("ruthenium_trinium_americium_neutronate")) - .ingot() - .liquid(new FluidBuilder().temperature(23691)) - .color(0xFFFFFF).iconSet(BRIGHT) - .flags(DECOMPOSITION_BY_ELECTROLYZING) - .components(Ruthenium, 1, Trinium, 2, Americium, 1, Neutronium, 2, Oxygen, 8) - .cableProperties(GTValues.V[GTValues.UHV], 24, 0, true, 3) - .blast(b -> b - .temp(10800, GasTier.HIGHER) - .blastStats(VA[ZPM], 1000) - .vacuumStats(VA[UHV], 200)) - .build(); + EnrichedNaquadahTriniumEuropiumDuranide = new Material.Builder(431, + gregtechId("enriched_naquadah_trinium_europium_duranide")) + .ingot() + .liquid(new FluidBuilder().temperature(5930)) + .color(0x7D9673).iconSet(METALLIC) + .flags(DECOMPOSITION_BY_CENTRIFUGING, GENERATE_FINE_WIRE) + .components(NaquadahEnriched, 4, Trinium, 3, Europium, 2, Duranium, 1) + .cableProperties(GTValues.V[GTValues.UV], 16, 0, true, 3) + .blast(b -> b + .temp(9900, GasTier.HIGH) + .blastStats(VA[LuV], 1200) + .vacuumStats(VA[UV], 200)) + .build(); + + RutheniumTriniumAmericiumNeutronate = new Material.Builder(432, + gregtechId("ruthenium_trinium_americium_neutronate")) + .ingot() + .liquid(new FluidBuilder().temperature(23691)) + .color(0xFFFFFF).iconSet(BRIGHT) + .flags(DECOMPOSITION_BY_ELECTROLYZING) + .components(Ruthenium, 1, Trinium, 2, Americium, 1, Neutronium, 2, Oxygen, 8) + .cableProperties(GTValues.V[GTValues.UHV], 24, 0, true, 3) + .blast(b -> b + .temp(10800, GasTier.HIGHER) + .blastStats(VA[ZPM], 1000) + .vacuumStats(VA[UHV], 200)) + .build(); InertMetalMixture = new Material.Builder(433, gregtechId("inert_metal_mixture")) .dust() diff --git a/src/main/java/gregtech/api/unification/material/materials/HigherDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/HigherDegreeMaterials.java index c3d3fb064d7..eae825e44d3 100644 --- a/src/main/java/gregtech/api/unification/material/materials/HigherDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/HigherDegreeMaterials.java @@ -15,7 +15,6 @@ public class HigherDegreeMaterials { public static void register() { - Electrotine = new Material.Builder(2507, gregtechId("electrotine")) .dust().ore(5, 1, true) .color(0x3CB4C8).iconSet(SHINY) @@ -86,7 +85,8 @@ public static void register() { HSSG = new Material.Builder(2516, gregtechId("hssg")) .ingot(3).fluid() .color(0x999900).iconSet(METALLIC) - .flags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_FRAME, GENERATE_SPRING, GENERATE_FINE_WIRE, GENERATE_FOIL, GENERATE_GEAR) + .flags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_FRAME, GENERATE_SPRING, GENERATE_FINE_WIRE, + GENERATE_FOIL, GENERATE_GEAR) .components(TungstenSteel, 5, Chrome, 1, Molybdenum, 2, Vanadium, 1) .rotorStats(10.0f, 5.5f, 4000) .cableProperties(V[LuV], 4, 2) @@ -129,7 +129,8 @@ public static void register() { HSSS = new Material.Builder(2520, gregtechId("hsss")) .ingot(4).fluid() .color(0x660033).iconSet(METALLIC) - .flags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_RING, GENERATE_FRAME, GENERATE_ROTOR, GENERATE_ROUND, GENERATE_FOIL, GENERATE_GEAR) + .flags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_RING, GENERATE_FRAME, GENERATE_ROTOR, GENERATE_ROUND, + GENERATE_FOIL, GENERATE_GEAR) .components(HSSG, 6, Iridium, 2, Osmium, 1) .rotorStats(15.0f, 7.0f, 3000) .blast(b -> b diff --git a/src/main/java/gregtech/api/unification/material/materials/MaterialFlagAddition.java b/src/main/java/gregtech/api/unification/material/materials/MaterialFlagAddition.java index 138d27bbc1d..8dbb3b48c6d 100644 --- a/src/main/java/gregtech/api/unification/material/materials/MaterialFlagAddition.java +++ b/src/main/java/gregtech/api/unification/material/materials/MaterialFlagAddition.java @@ -40,12 +40,12 @@ public static void register() { oreProp = Molybdenum.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(Molybdenum); - //oreProp = Magnesium.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(Olivine); + // oreProp = Magnesium.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(Olivine); - //oreProp = Manganese.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(Chrome, Iron); - //oreProp.setSeparatedInto(Iron); + // oreProp = Manganese.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(Chrome, Iron); + // oreProp.setSeparatedInto(Iron); oreProp = Neodymium.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(RareEarth); @@ -62,8 +62,8 @@ public static void register() { oreProp = Plutonium239.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(Uraninite, Lead, Uraninite); - //oreProp = Silicon.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(SiliconDioxide); + // oreProp = Silicon.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(SiliconDioxide); oreProp = Silver.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(Lead, Sulfur, Sulfur, Gold); @@ -80,11 +80,11 @@ public static void register() { oreProp.setSeparatedInto(Iron); oreProp.setWashedIn(SodiumPersulfate); - //oreProp = Titanium.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(Almandine); + // oreProp = Titanium.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(Almandine); - //oreProp = Tungsten.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(Manganese, Molybdenum); + // oreProp = Tungsten.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(Manganese, Molybdenum); oreProp = Naquadah.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(Sulfur, Barite, NaquadahEnriched); diff --git a/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java b/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java index 0c36894670f..729df027e64 100644 --- a/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java @@ -10,6 +10,7 @@ import static gregtech.api.util.GTUtility.gregtechId; public class OrganicChemistryMaterials { + /** * ID RANGE: 1000-1068 (incl.) */ @@ -109,7 +110,7 @@ public static void register() { .build() .setFormula("Si(CH3)2O", true); - Polyethylene = new Material.Builder(1012, gregtechId("plastic")) //todo add polyethylene oredicts + Polyethylene = new Material.Builder(1012, gregtechId("plastic")) // todo add polyethylene oredicts .polymer(1) .liquid(new FluidBuilder().temperature(408)) .color(0xC8C8C8) diff --git a/src/main/java/gregtech/api/unification/material/materials/SecondDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/SecondDegreeMaterials.java index 1fa0d004596..cd24317b9bf 100644 --- a/src/main/java/gregtech/api/unification/material/materials/SecondDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/SecondDegreeMaterials.java @@ -1,12 +1,12 @@ package gregtech.api.unification.material.materials; -import gregtech.api.GTValues; import gregtech.api.fluids.FluidBuilder; import gregtech.api.fluids.attribute.FluidAttributes; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.BlastProperty.GasTier; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.material.properties.ToolProperty; + import net.minecraft.init.Enchantments; import static gregtech.api.GTValues.*; @@ -18,7 +18,6 @@ public class SecondDegreeMaterials { public static void register() { - Glass = new Material.Builder(2000, gregtechId("glass")) .gem(0) .liquid(new FluidBuilder().temperature(1200).customStill()) @@ -70,7 +69,8 @@ public static void register() { Lapis = new Material.Builder(2007, gregtechId("lapis")) .gem(1).ore(6, 4) .color(0x4646DC).iconSet(LAPIS) - .flags(NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, NO_WORKING, DECOMPOSITION_BY_ELECTROLYZING, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + .flags(NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, NO_WORKING, DECOMPOSITION_BY_ELECTROLYZING, + EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, GENERATE_PLATE, GENERATE_ROD) .components(Lazurite, 12, Sodalite, 2, Pyrite, 1, Calcite, 1) .build(); @@ -79,7 +79,7 @@ public static void register() { .dust(1) .liquid(new FluidBuilder().temperature(4000).customStill()) .color(0xFFC800).iconSet(FINE) - .flags(NO_SMELTING, MORTAR_GRINDABLE, DECOMPOSITION_BY_CENTRIFUGING) //todo burning flag + .flags(NO_SMELTING, MORTAR_GRINDABLE, DECOMPOSITION_BY_CENTRIFUGING) // todo burning flag .components(DarkAsh, 1, Sulfur, 1) .build(); @@ -415,7 +415,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(58)) .color(0x4C3434) .flags(DISABLE_DECOMPOSITION) - .components(CarbonMonoxide, 144, CoalGas, 20, HydrogenSulfide, 15, SulfurDioxide, 15, Helium3, 5, Neon, 1, Ash, 1) + .components(CarbonMonoxide, 144, CoalGas, 20, HydrogenSulfide, 15, SulfurDioxide, 15, Helium3, 5, Neon, + 1, Ash, 1) .build(); EnderAir = new Material.Builder(2054, gregtechId("ender_air")) @@ -429,7 +430,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(36)) .color(0x283454) .flags(DISABLE_DECOMPOSITION) - .components(NitrogenDioxide, 122, Deuterium, 50, Helium, 15, Tritium, 10, Krypton, 1, Xenon, 1, Radon, 1, EnderPearl, 1) + .components(NitrogenDioxide, 122, Deuterium, 50, Helium, 15, Tritium, 10, Krypton, 1, Xenon, 1, Radon, + 1, EnderPearl, 1) .build(); AquaRegia = new Material.Builder(2056, gregtechId("aqua_regia")) diff --git a/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java b/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java index 009dafa37e4..f26fc316290 100644 --- a/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java @@ -12,7 +12,6 @@ public class UnknownCompositionMaterials { public static void register() { - WoodGas = new Material.Builder(1500, gregtechId("wood_gas")) .gas().color(0xDECD87).build(); @@ -328,7 +327,7 @@ public static void register() { .flags(FLAMMABLE) .build(); - //Free IDs 1560-1575 + // Free IDs 1560-1575 LPG = new Material.Builder(1576, gregtechId("lpg")) .liquid(new FluidBuilder().customStill()) @@ -513,7 +512,8 @@ public static void register() { Wood = new Material.Builder(1617, gregtechId("wood")) .wood() .color(0x896727).iconSet(WOOD) - .flags(GENERATE_PLATE, GENERATE_ROD, GENERATE_BOLT_SCREW, GENERATE_LONG_ROD, GENERATE_GEAR, GENERATE_FRAME) + .flags(GENERATE_PLATE, GENERATE_ROD, GENERATE_BOLT_SCREW, GENERATE_LONG_ROD, GENERATE_GEAR, + GENERATE_FRAME) .fluidPipeProperties(340, 5, false) .build(); diff --git a/src/main/java/gregtech/api/unification/material/properties/BlastProperty.java b/src/main/java/gregtech/api/unification/material/properties/BlastProperty.java index 188357b0939..74d0834eb27 100644 --- a/src/main/java/gregtech/api/unification/material/properties/BlastProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/BlastProperty.java @@ -60,7 +60,8 @@ public BlastProperty(int blastTemperature, GasTier gasTier) { this.gasTier = gasTier; } - private BlastProperty(int blastTemperature, GasTier gasTier, int eutOverride, int durationOverride, int vacuumEUtOverride, int vacuumDurationOverride) { + private BlastProperty(int blastTemperature, GasTier gasTier, int eutOverride, int durationOverride, + int vacuumEUtOverride, int vacuumDurationOverride) { this.blastTemperature = blastTemperature; this.gasTier = gasTier; this.eutOverride = eutOverride; @@ -140,16 +141,21 @@ public static GasTier validateGasTier(String gasTierName) { else { String message = "Gas Tier must be either \"LOW\", \"MID\", \"HIGH\", \"HIGHER\", or \"HIGHEST\""; CraftTweakerAPI.logError(message); - throw new IllegalArgumentException("Could not find valid gas tier for name: " + gasTierName + ". " + message); + throw new IllegalArgumentException( + "Could not find valid gas tier for name: " + gasTierName + ". " + message); } } public enum GasTier { + // Tiers used by GTCEu - LOW, MID, HIGH, + LOW, + MID, + HIGH, // Tiers reserved for addons - HIGHER, HIGHEST; + HIGHER, + HIGHEST; public static final GasTier[] VALUES = values(); } @@ -199,7 +205,8 @@ public Builder vacuumStats(int eutOverride, int durationOverride) { } public BlastProperty build() { - return new BlastProperty(temp, gasTier, eutOverride, durationOverride, vacuumEUtOverride, vacuumDurationOverride); + return new BlastProperty(temp, gasTier, eutOverride, durationOverride, vacuumEUtOverride, + vacuumDurationOverride); } } } diff --git a/src/main/java/gregtech/api/unification/material/properties/FluidPipeProperties.java b/src/main/java/gregtech/api/unification/material/properties/FluidPipeProperties.java index d5abed168ba..5bd1ce7e1ec 100644 --- a/src/main/java/gregtech/api/unification/material/properties/FluidPipeProperties.java +++ b/src/main/java/gregtech/api/unification/material/properties/FluidPipeProperties.java @@ -4,6 +4,7 @@ import gregtech.api.fluids.FluidState; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.api.fluids.attribute.FluidAttributes; + import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; import org.jetbrains.annotations.NotNull; @@ -24,14 +25,17 @@ public class FluidPipeProperties implements IMaterialProperty, IPropertyFluidFil private boolean cryoProof; private boolean plasmaProof; - public FluidPipeProperties(int maxFluidTemperature, int throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { + public FluidPipeProperties(int maxFluidTemperature, int throughput, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof) { this(maxFluidTemperature, throughput, gasProof, acidProof, cryoProof, plasmaProof, 1); } /** - * Should only be called from {@link gregtech.common.pipelike.fluidpipe.FluidPipeType#modifyProperties(FluidPipeProperties)} + * Should only be called from + * {@link gregtech.common.pipelike.fluidpipe.FluidPipeType#modifyProperties(FluidPipeProperties)} */ - public FluidPipeProperties(int maxFluidTemperature, int throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof, int tanks) { + public FluidPipeProperties(int maxFluidTemperature, int throughput, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof, int tanks) { this.maxFluidTemperature = maxFluidTemperature; this.throughput = throughput; this.gasProof = gasProof; @@ -149,7 +153,8 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(getThroughput(), getTanks(), getMaxFluidTemperature(), gasProof, cryoProof, plasmaProof, containmentPredicate); + return Objects.hash(getThroughput(), getTanks(), getMaxFluidTemperature(), gasProof, cryoProof, plasmaProof, + containmentPredicate); } @Override diff --git a/src/main/java/gregtech/api/unification/material/properties/FluidProperty.java b/src/main/java/gregtech/api/unification/material/properties/FluidProperty.java index c8000bd0fac..48f92084252 100644 --- a/src/main/java/gregtech/api/unification/material/properties/FluidProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/FluidProperty.java @@ -2,6 +2,7 @@ import gregtech.api.fluids.store.FluidStorage; import gregtech.api.fluids.store.FluidStorageKey; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/api/unification/material/properties/MaterialProperties.java b/src/main/java/gregtech/api/unification/material/properties/MaterialProperties.java index 66f16401195..b3ea19b4c8b 100644 --- a/src/main/java/gregtech/api/unification/material/properties/MaterialProperties.java +++ b/src/main/java/gregtech/api/unification/material/properties/MaterialProperties.java @@ -10,8 +10,7 @@ public class MaterialProperties { private static final Set> baseTypes = new HashSet<>(Arrays.asList( PropertyKey.FLUID, PropertyKey.DUST, - PropertyKey.INGOT, PropertyKey.GEM, PropertyKey.EMPTY - )); + PropertyKey.INGOT, PropertyKey.GEM, PropertyKey.EMPTY)); @SuppressWarnings("unused") public static void addBaseType(PropertyKey baseTypeKey) { @@ -70,7 +69,8 @@ public void verify() { GTLog.logger.debug("Creating empty placeholder Material {}", material); } propertyMap.put(PropertyKey.EMPTY, PropertyKey.EMPTY.constructDefault()); - } else throw new IllegalArgumentException("Material must have at least one of: " + baseTypes + " specified!"); + } else + throw new IllegalArgumentException("Material must have at least one of: " + baseTypes + " specified!"); } } diff --git a/src/main/java/gregtech/api/unification/material/properties/OreProperty.java b/src/main/java/gregtech/api/unification/material/properties/OreProperty.java index 2d064d0d47a..d48d3fd78f5 100644 --- a/src/main/java/gregtech/api/unification/material/properties/OreProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/OreProperty.java @@ -1,16 +1,19 @@ package gregtech.api.unification.material.properties; import gregtech.api.unification.material.Material; + import net.minecraft.util.math.MathHelper; + import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class OreProperty implements IMaterialProperty { /** @@ -18,7 +21,7 @@ public class OreProperty implements IMaterialProperty { *

* Default: none, meaning only this property's Material. */ - //@ZenProperty + // @ZenProperty private final List oreByProducts = new ArrayList<>(); /** @@ -26,7 +29,7 @@ public class OreProperty implements IMaterialProperty { *

* Default: 1 (no multiplier). */ - //@ZenProperty + // @ZenProperty private int oreMultiplier; /** @@ -34,7 +37,7 @@ public class OreProperty implements IMaterialProperty { *

* Default: 1 (no multiplier). */ - //@ZenProperty + // @ZenProperty private int byProductMultiplier; /** @@ -42,7 +45,7 @@ public class OreProperty implements IMaterialProperty { *

* Default: false. */ - //@ZenProperty + // @ZenProperty private boolean emissive; /** @@ -51,7 +54,7 @@ public class OreProperty implements IMaterialProperty { * Material will have a Dust Property. * Default: none. */ - //@ZenProperty + // @ZenProperty @Nullable private Material directSmeltResult; @@ -61,7 +64,7 @@ public class OreProperty implements IMaterialProperty { * Material will have a Fluid Property. * Default: none. */ - //@ZenProperty + // @ZenProperty @Nullable private Material washedIn; @@ -81,7 +84,7 @@ public class OreProperty implements IMaterialProperty { * Material will have a Dust Property. * Default: none. */ - //@ZenProperty + // @ZenProperty private final List separatedInto = new ArrayList<>(); public OreProperty(int oreMultiplier, int byProductMultiplier) { diff --git a/src/main/java/gregtech/api/unification/material/properties/PolymerProperty.java b/src/main/java/gregtech/api/unification/material/properties/PolymerProperty.java index 1ec5d57e886..c2878b6e3f9 100644 --- a/src/main/java/gregtech/api/unification/material/properties/PolymerProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/PolymerProperty.java @@ -6,11 +6,10 @@ public class PolymerProperty implements IMaterialProperty { @Override public void verifyProperty(MaterialProperties properties) { - properties.ensureSet(PropertyKey.DUST, true); properties.ensureSet(PropertyKey.INGOT, true); - properties.getMaterial().addFlags(MaterialFlags.FLAMMABLE, MaterialFlags.NO_SMASHING, MaterialFlags.DISABLE_DECOMPOSITION); - + properties.getMaterial().addFlags(MaterialFlags.FLAMMABLE, MaterialFlags.NO_SMASHING, + MaterialFlags.DISABLE_DECOMPOSITION); } } diff --git a/src/main/java/gregtech/api/unification/material/properties/PropertyKey.java b/src/main/java/gregtech/api/unification/material/properties/PropertyKey.java index 2f60e41bcfb..5dc2234a40e 100644 --- a/src/main/java/gregtech/api/unification/material/properties/PropertyKey.java +++ b/src/main/java/gregtech/api/unification/material/properties/PropertyKey.java @@ -4,12 +4,14 @@ public class PropertyKey { public static final PropertyKey BLAST = new PropertyKey<>("blast", BlastProperty.class); public static final PropertyKey DUST = new PropertyKey<>("dust", DustProperty.class); - public static final PropertyKey FLUID_PIPE = new PropertyKey<>("fluid_pipe", FluidPipeProperties.class); + public static final PropertyKey FLUID_PIPE = new PropertyKey<>("fluid_pipe", + FluidPipeProperties.class); public static final PropertyKey FLUID = new PropertyKey<>("fluid", FluidProperty.class); public static final PropertyKey GEM = new PropertyKey<>("gem", GemProperty.class); public static final PropertyKey INGOT = new PropertyKey<>("ingot", IngotProperty.class); public static final PropertyKey POLYMER = new PropertyKey<>("polymer", PolymerProperty.class); - public static final PropertyKey ITEM_PIPE = new PropertyKey<>("item_pipe", ItemPipeProperties.class); + public static final PropertyKey ITEM_PIPE = new PropertyKey<>("item_pipe", + ItemPipeProperties.class); public static final PropertyKey ORE = new PropertyKey<>("ore", OreProperty.class); public static final PropertyKey TOOL = new PropertyKey<>("tool", ToolProperty.class); public static final PropertyKey ROTOR = new PropertyKey<>("rotor", RotorProperty.class); diff --git a/src/main/java/gregtech/api/unification/material/properties/ToolProperty.java b/src/main/java/gregtech/api/unification/material/properties/ToolProperty.java index aa29410aa75..99264c592e4 100644 --- a/src/main/java/gregtech/api/unification/material/properties/ToolProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/ToolProperty.java @@ -1,9 +1,11 @@ package gregtech.api.unification.material.properties; import gregtech.api.items.toolitem.EnchantmentLevel; + +import net.minecraft.enchantment.Enchantment; + import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import net.minecraft.enchantment.Enchantment; public class ToolProperty implements IMaterialProperty { diff --git a/src/main/java/gregtech/api/unification/material/properties/WireProperties.java b/src/main/java/gregtech/api/unification/material/properties/WireProperties.java index e93e0a32e76..7335be2e0c7 100644 --- a/src/main/java/gregtech/api/unification/material/properties/WireProperties.java +++ b/src/main/java/gregtech/api/unification/material/properties/WireProperties.java @@ -23,7 +23,8 @@ public WireProperties(int voltage, int baseAmperage, int lossPerBlock, boolean i this(voltage, baseAmperage, lossPerBlock, isSuperCon, 0); } - public WireProperties(int voltage, int baseAmperage, int lossPerBlock, boolean isSuperCon, int criticalTemperature) { + public WireProperties(int voltage, int baseAmperage, int lossPerBlock, boolean isSuperCon, + int criticalTemperature) { this.voltage = voltage; this.amperage = baseAmperage; this.lossPerBlock = isSuperCon ? 0 : lossPerBlock; @@ -111,11 +112,12 @@ public void setSuperconductor(boolean isSuperconductor) { } /** - * Retrieves the critical temperature of the superconductor (the temperature at which the superconductive phase transition happens) + * Retrieves the critical temperature of the superconductor (the temperature at which the superconductive phase + * transition happens) * * @return Critical temperature of the material */ - public int getSuperconductorCriticalTemperature(){ + public int getSuperconductorCriticalTemperature() { return superconductorCriticalTemperature; } @@ -124,7 +126,7 @@ public int getSuperconductorCriticalTemperature(){ * * @param criticalTemperature The new critical temperature */ - public void setSuperconductorCriticalTemperature(int criticalTemperature){ + public void setSuperconductorCriticalTemperature(int criticalTemperature) { this.superconductorCriticalTemperature = this.isSuperconductor ? criticalTemperature : 0; } diff --git a/src/main/java/gregtech/api/unification/material/properties/package-info.java b/src/main/java/gregtech/api/unification/material/properties/package-info.java index c3d9b752f5b..038d52336be 100644 --- a/src/main/java/gregtech/api/unification/material/properties/package-info.java +++ b/src/main/java/gregtech/api/unification/material/properties/package-info.java @@ -1,9 +1,12 @@ /** * Material Properties are a replacement for the old nested hierarchy of Material Types - * (IngotMaterial, DustMaterial, etc.).

+ * (IngotMaterial, DustMaterial, etc.).
+ *
*

* To create your own Material Property, it should follow this general structure: - *

{@code
+ * 
+ * 
+ * {@code
  *     public class MyProperty extends IMaterialProperty {
  *
  *         ... private, non-final fields ...
@@ -38,10 +41,16 @@
  *             // Like above, ensure you call "ensureSet(Key, true)" to re-verify.
  *         }
  *     }
- * }


+ * } + *
+ * + *
+ *
*

* You must also create a new {@link gregtech.api.unification.material.properties.PropertyKey} Object, like: - *

{@code
+ * 
+ * 
+ * {@code
  *     public static final PropertyKey MY_PROPERTY = new PropertyKey<>("my_property", MyProperty.class);
  * }
  *
diff --git a/src/main/java/gregtech/api/unification/material/registry/IMaterialRegistryManager.java b/src/main/java/gregtech/api/unification/material/registry/IMaterialRegistryManager.java
index 6b9e6e1fe8d..9ca2c54314b 100644
--- a/src/main/java/gregtech/api/unification/material/registry/IMaterialRegistryManager.java
+++ b/src/main/java/gregtech/api/unification/material/registry/IMaterialRegistryManager.java
@@ -3,9 +3,10 @@
 import gregtech.api.GTValues;
 import gregtech.api.unification.material.Material;
 
-import javax.annotation.Nonnull;
 import java.util.Collection;
 
+import javax.annotation.Nonnull;
+
 public interface IMaterialRegistryManager {
 
     /**
diff --git a/src/main/java/gregtech/api/unification/material/registry/MarkerMaterialRegistry.java b/src/main/java/gregtech/api/unification/material/registry/MarkerMaterialRegistry.java
index 77bdd9f9949..25b58fe74b5 100644
--- a/src/main/java/gregtech/api/unification/material/registry/MarkerMaterialRegistry.java
+++ b/src/main/java/gregtech/api/unification/material/registry/MarkerMaterialRegistry.java
@@ -1,6 +1,7 @@
 package gregtech.api.unification.material.registry;
 
 import gregtech.api.unification.material.MarkerMaterial;
+
 import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
diff --git a/src/main/java/gregtech/api/unification/material/registry/MaterialRegistry.java b/src/main/java/gregtech/api/unification/material/registry/MaterialRegistry.java
index 988f892d61a..9f441dabea6 100644
--- a/src/main/java/gregtech/api/unification/material/registry/MaterialRegistry.java
+++ b/src/main/java/gregtech/api/unification/material/registry/MaterialRegistry.java
@@ -3,9 +3,10 @@
 import gregtech.api.unification.material.Material;
 import gregtech.api.util.GTControlledRegistry;
 
-import javax.annotation.Nonnull;
 import java.util.Collection;
 
+import javax.annotation.Nonnull;
+
 public abstract class MaterialRegistry extends GTControlledRegistry {
 
     public MaterialRegistry() {
diff --git a/src/main/java/gregtech/api/unification/ore/IOreRegistrationHandler.java b/src/main/java/gregtech/api/unification/ore/IOreRegistrationHandler.java
index 4479d5d3715..be4acc37f92 100644
--- a/src/main/java/gregtech/api/unification/ore/IOreRegistrationHandler.java
+++ b/src/main/java/gregtech/api/unification/ore/IOreRegistrationHandler.java
@@ -6,5 +6,4 @@
 public interface IOreRegistrationHandler {
 
     void processMaterial(OrePrefix orePrefix, Material material);
-
 }
diff --git a/src/main/java/gregtech/api/unification/ore/OrePrefix.java b/src/main/java/gregtech/api/unification/ore/OrePrefix.java
index 345e8c9be78..64eb11cd7fa 100644
--- a/src/main/java/gregtech/api/unification/ore/OrePrefix.java
+++ b/src/main/java/gregtech/api/unification/ore/OrePrefix.java
@@ -1,7 +1,5 @@
 package gregtech.api.unification.ore;
 
-import com.google.common.base.Preconditions;
-import crafttweaker.annotations.ZenRegister;
 import gregtech.api.unification.material.MarkerMaterials;
 import gregtech.api.unification.material.Material;
 import gregtech.api.unification.material.Materials;
@@ -12,9 +10,13 @@
 import gregtech.api.util.LocalizationUtils;
 import gregtech.api.util.function.TriConsumer;
 import gregtech.common.ConfigHolder;
+
+import net.minecraft.client.resources.I18n;
+
+import com.google.common.base.Preconditions;
+import crafttweaker.annotations.ZenRegister;
 import it.unimi.dsi.fastutil.objects.Object2FloatMap;
 import it.unimi.dsi.fastutil.objects.Object2FloatOpenHashMap;
-import net.minecraft.client.resources.I18n;
 import org.apache.commons.lang3.Validate;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -40,27 +42,43 @@ public class OrePrefix {
     private final static AtomicInteger idCounter = new AtomicInteger(0);
 
     // Regular Ore Prefix. Ore -> Material is a Oneway Operation! Introduced by Eloraam
-    public static final OrePrefix ore = new OrePrefix("ore", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreGranite = new OrePrefix("oreGranite", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreDiorite = new OrePrefix("oreDiorite", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreAndesite = new OrePrefix("oreAndesite", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreBlackgranite = new OrePrefix("oreBlackgranite", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreRedgranite = new OrePrefix("oreRedgranite", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreMarble = new OrePrefix("oreMarble", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreBasalt = new OrePrefix("oreBasalt", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix ore = new OrePrefix("ore", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION,
+            hasOreProperty);
+    public static final OrePrefix oreGranite = new OrePrefix("oreGranite", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreDiorite = new OrePrefix("oreDiorite", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreAndesite = new OrePrefix("oreAndesite", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreBlackgranite = new OrePrefix("oreBlackgranite", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreRedgranite = new OrePrefix("oreRedgranite", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreMarble = new OrePrefix("oreMarble", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreBasalt = new OrePrefix("oreBasalt", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
 
     // In case of an Sand-Ores Mod. Ore -> Material is a Oneway Operation!
-    public static final OrePrefix oreSand = new OrePrefix("oreSand", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, null);
-    public static final OrePrefix oreRedSand = new OrePrefix("oreRedSand", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, null);
+    public static final OrePrefix oreSand = new OrePrefix("oreSand", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix oreRedSand = new OrePrefix("oreRedSand", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, null);
 
     // Prefix of the Nether-Ores Mod. Causes Ores to double. Ore -> Material is a Oneway Operation!
-    public static final OrePrefix oreNetherrack = new OrePrefix("oreNetherrack", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreNetherrack = new OrePrefix("oreNetherrack", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
     // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation!
-    public static final OrePrefix oreEndstone = new OrePrefix("oreEndstone", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreEndstone = new OrePrefix("oreEndstone", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
 
-    public static final OrePrefix crushedCentrifuged = new OrePrefix("crushedCentrifuged", -1, null, MaterialIconType.crushedCentrifuged, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix crushedPurified = new OrePrefix("crushedPurified", -1, null, MaterialIconType.crushedPurified, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix crushed = new OrePrefix("crushed", -1, null, MaterialIconType.crushed, ENABLE_UNIFICATION, hasOreProperty, mat -> Collections.singletonList(I18n.format("metaitem.crushed.tooltip.purify")));
+    public static final OrePrefix crushedCentrifuged = new OrePrefix("crushedCentrifuged", -1, null,
+            MaterialIconType.crushedCentrifuged, ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix crushedPurified = new OrePrefix("crushedPurified", -1, null,
+            MaterialIconType.crushedPurified, ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix crushed = new OrePrefix("crushed", -1, null, MaterialIconType.crushed,
+            ENABLE_UNIFICATION, hasOreProperty,
+            mat -> Collections.singletonList(I18n.format("metaitem.crushed.tooltip.purify")));
 
     // Introduced by Mekanism
     public static final OrePrefix shard = new OrePrefix("shard", -1, null, null, ENABLE_UNIFICATION, null);
@@ -72,89 +90,138 @@ public class OrePrefix {
     public static final OrePrefix dirtyGravel = new OrePrefix("dirtyGravel", -1, null, null, ENABLE_UNIFICATION, null);
 
     // A hot Ingot, which has to be cooled down by a Vacuum Freezer.
-    public static final OrePrefix ingotHot = new OrePrefix("ingotHot", M, null, MaterialIconType.ingotHot, ENABLE_UNIFICATION, hasBlastProperty.and(mat -> mat.getProperty(PropertyKey.BLAST).getBlastTemperature() > 1750));
+    public static final OrePrefix ingotHot = new OrePrefix("ingotHot", M, null, MaterialIconType.ingotHot,
+            ENABLE_UNIFICATION,
+            hasBlastProperty.and(mat -> mat.getProperty(PropertyKey.BLAST).getBlastTemperature() > 1750));
     // A regular Ingot. Introduced by Eloraam
-    public static final OrePrefix ingot = new OrePrefix("ingot", M, null, MaterialIconType.ingot, ENABLE_UNIFICATION, hasIngotProperty);
+    public static final OrePrefix ingot = new OrePrefix("ingot", M, null, MaterialIconType.ingot, ENABLE_UNIFICATION,
+            hasIngotProperty);
 
     // A regular Gem worth one Dust. Introduced by Eloraam
-    public static final OrePrefix gem = new OrePrefix("gem", M, null, MaterialIconType.gem, ENABLE_UNIFICATION, hasGemProperty);
+    public static final OrePrefix gem = new OrePrefix("gem", M, null, MaterialIconType.gem, ENABLE_UNIFICATION,
+            hasGemProperty);
     // A regular Gem worth one small Dust. Introduced by TerraFirmaCraft
-    public static final OrePrefix gemChipped = new OrePrefix("gemChipped", M / 4, null, MaterialIconType.gemChipped, ENABLE_UNIFICATION, hasGemProperty.and(unused -> ConfigHolder.recipes.generateLowQualityGems));
+    public static final OrePrefix gemChipped = new OrePrefix("gemChipped", M / 4, null, MaterialIconType.gemChipped,
+            ENABLE_UNIFICATION, hasGemProperty.and(unused -> ConfigHolder.recipes.generateLowQualityGems));
     // A regular Gem worth two small Dusts. Introduced by TerraFirmaCraft
-    public static final OrePrefix gemFlawed = new OrePrefix("gemFlawed", M / 2, null, MaterialIconType.gemFlawed, ENABLE_UNIFICATION, hasGemProperty.and(unused -> ConfigHolder.recipes.generateLowQualityGems));
+    public static final OrePrefix gemFlawed = new OrePrefix("gemFlawed", M / 2, null, MaterialIconType.gemFlawed,
+            ENABLE_UNIFICATION, hasGemProperty.and(unused -> ConfigHolder.recipes.generateLowQualityGems));
     // A regular Gem worth two Dusts. Introduced by TerraFirmaCraft
-    public static final OrePrefix gemFlawless = new OrePrefix("gemFlawless", M * 2, null, MaterialIconType.gemFlawless, ENABLE_UNIFICATION, hasGemProperty);
+    public static final OrePrefix gemFlawless = new OrePrefix("gemFlawless", M * 2, null, MaterialIconType.gemFlawless,
+            ENABLE_UNIFICATION, hasGemProperty);
     // A regular Gem worth four Dusts. Introduced by TerraFirmaCraft
-    public static final OrePrefix gemExquisite = new OrePrefix("gemExquisite", M * 4, null, MaterialIconType.gemExquisite, ENABLE_UNIFICATION, hasGemProperty);
+    public static final OrePrefix gemExquisite = new OrePrefix("gemExquisite", M * 4, null,
+            MaterialIconType.gemExquisite, ENABLE_UNIFICATION, hasGemProperty);
 
     // 1/4th of a Dust.
-    public static final OrePrefix dustSmall = new OrePrefix("dustSmall", M / 4, null, MaterialIconType.dustSmall, ENABLE_UNIFICATION, hasDustProperty);
+    public static final OrePrefix dustSmall = new OrePrefix("dustSmall", M / 4, null, MaterialIconType.dustSmall,
+            ENABLE_UNIFICATION, hasDustProperty);
     // 1/9th of a Dust.
-    public static final OrePrefix dustTiny = new OrePrefix("dustTiny", M / 9, null, MaterialIconType.dustTiny, ENABLE_UNIFICATION, hasDustProperty);
+    public static final OrePrefix dustTiny = new OrePrefix("dustTiny", M / 9, null, MaterialIconType.dustTiny,
+            ENABLE_UNIFICATION, hasDustProperty);
     // Dust with impurities. 1 Unit of Main Material and 1/9 - 1/4 Unit of secondary Material
-    public static final OrePrefix dustImpure = new OrePrefix("dustImpure", M, null, MaterialIconType.dustImpure, ENABLE_UNIFICATION, hasOreProperty, mat -> Collections.singletonList(I18n.format("metaitem.dust.tooltip.purify")));
+    public static final OrePrefix dustImpure = new OrePrefix("dustImpure", M, null, MaterialIconType.dustImpure,
+            ENABLE_UNIFICATION, hasOreProperty,
+            mat -> Collections.singletonList(I18n.format("metaitem.dust.tooltip.purify")));
     // Pure Dust worth of one Ingot or Gem. Introduced by Alblaka.
-    public static final OrePrefix dustPure = new OrePrefix("dustPure", M, null, MaterialIconType.dustPure, ENABLE_UNIFICATION, hasOreProperty, mat -> Collections.singletonList(I18n.format("metaitem.dust.tooltip.purify")));
-    public static final OrePrefix dust = new OrePrefix("dust", M, null, MaterialIconType.dust, ENABLE_UNIFICATION, hasDustProperty);
+    public static final OrePrefix dustPure = new OrePrefix("dustPure", M, null, MaterialIconType.dustPure,
+            ENABLE_UNIFICATION, hasOreProperty,
+            mat -> Collections.singletonList(I18n.format("metaitem.dust.tooltip.purify")));
+    public static final OrePrefix dust = new OrePrefix("dust", M, null, MaterialIconType.dust, ENABLE_UNIFICATION,
+            hasDustProperty);
 
     // A Nugget. Introduced by Eloraam
-    public static final OrePrefix nugget = new OrePrefix("nugget", M / 9, null, MaterialIconType.nugget, ENABLE_UNIFICATION, hasIngotProperty);
+    public static final OrePrefix nugget = new OrePrefix("nugget", M / 9, null, MaterialIconType.nugget,
+            ENABLE_UNIFICATION, hasIngotProperty);
 
     // 9 Plates combined in one Item.
-    public static final OrePrefix plateDense = new OrePrefix("plateDense", M * 9, null, MaterialIconType.plateDense, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_DENSE));
+    public static final OrePrefix plateDense = new OrePrefix("plateDense", M * 9, null, MaterialIconType.plateDense,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_DENSE));
     // 2 Plates combined in one Item
-    public static final OrePrefix plateDouble = new OrePrefix("plateDouble", M * 2, null, MaterialIconType.plateDouble, ENABLE_UNIFICATION, hasIngotProperty.and(mat -> mat.hasFlags(GENERATE_PLATE, GENERATE_DOUBLE_PLATE) && !mat.hasFlag(NO_SMASHING)));
+    public static final OrePrefix plateDouble = new OrePrefix("plateDouble", M * 2, null, MaterialIconType.plateDouble,
+            ENABLE_UNIFICATION, hasIngotProperty
+                    .and(mat -> mat.hasFlags(GENERATE_PLATE, GENERATE_DOUBLE_PLATE) && !mat.hasFlag(NO_SMASHING)));
     // Regular Plate made of one Ingot/Dust. Introduced by Calclavia
-    public static final OrePrefix plate = new OrePrefix("plate", M, null, MaterialIconType.plate, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_PLATE));
+    public static final OrePrefix plate = new OrePrefix("plate", M, null, MaterialIconType.plate, ENABLE_UNIFICATION,
+            mat -> mat.hasFlag(GENERATE_PLATE));
 
     // Round made of 1 Nugget
-    public static final OrePrefix round = new OrePrefix("round", M / 9, null, MaterialIconType.round, OrePrefix.Flags.ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_ROUND));
+    public static final OrePrefix round = new OrePrefix("round", M / 9, null, MaterialIconType.round,
+            OrePrefix.Flags.ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_ROUND));
     // Foil made of 1/4 Ingot/Dust.
-    public static final OrePrefix foil = new OrePrefix("foil", M / 4, null, MaterialIconType.foil, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_FOIL));
+    public static final OrePrefix foil = new OrePrefix("foil", M / 4, null, MaterialIconType.foil, ENABLE_UNIFICATION,
+            mat -> mat.hasFlag(GENERATE_FOIL));
 
     // Stick made of an Ingot.
-    public static final OrePrefix stickLong = new OrePrefix("stickLong", M, null, MaterialIconType.stickLong, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_LONG_ROD));
+    public static final OrePrefix stickLong = new OrePrefix("stickLong", M, null, MaterialIconType.stickLong,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_LONG_ROD));
     // Stick made of half an Ingot. Introduced by Eloraam
-    public static final OrePrefix stick = new OrePrefix("stick", M / 2, null, MaterialIconType.stick, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_ROD));
+    public static final OrePrefix stick = new OrePrefix("stick", M / 2, null, MaterialIconType.stick,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_ROD));
 
     // consisting out of 1/8 Ingot or 1/4 Stick.
-    public static final OrePrefix bolt = new OrePrefix("bolt", M / 8, null, MaterialIconType.bolt, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_BOLT_SCREW));
+    public static final OrePrefix bolt = new OrePrefix("bolt", M / 8, null, MaterialIconType.bolt, ENABLE_UNIFICATION,
+            mat -> mat.hasFlag(GENERATE_BOLT_SCREW));
     // consisting out of 1/9 Ingot.
-    public static final OrePrefix screw = new OrePrefix("screw", M / 9, null, MaterialIconType.screw, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_BOLT_SCREW));
+    public static final OrePrefix screw = new OrePrefix("screw", M / 9, null, MaterialIconType.screw,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_BOLT_SCREW));
     // consisting out of 1/2 Stick.
-    public static final OrePrefix ring = new OrePrefix("ring", M / 4, null, MaterialIconType.ring, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_RING));
+    public static final OrePrefix ring = new OrePrefix("ring", M / 4, null, MaterialIconType.ring, ENABLE_UNIFICATION,
+            mat -> mat.hasFlag(GENERATE_RING));
     // consisting out of 1 Fine Wire.
-    public static final OrePrefix springSmall = new OrePrefix("springSmall", M / 4, null, MaterialIconType.springSmall, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_SPRING_SMALL) && !mat.hasFlag(NO_SMASHING));
+    public static final OrePrefix springSmall = new OrePrefix("springSmall", M / 4, null, MaterialIconType.springSmall,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_SPRING_SMALL) && !mat.hasFlag(NO_SMASHING));
     // consisting out of 2 Sticks.
-    public static final OrePrefix spring = new OrePrefix("spring", M, null, MaterialIconType.spring, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_SPRING) && !mat.hasFlag(NO_SMASHING));
+    public static final OrePrefix spring = new OrePrefix("spring", M, null, MaterialIconType.spring, ENABLE_UNIFICATION,
+            mat -> mat.hasFlag(GENERATE_SPRING) && !mat.hasFlag(NO_SMASHING));
     // consisting out of 1/8 Ingot or 1/4 Wire.
-    public static final OrePrefix wireFine = new OrePrefix("wireFine", M / 8, null, MaterialIconType.wireFine, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_FINE_WIRE));
+    public static final OrePrefix wireFine = new OrePrefix("wireFine", M / 8, null, MaterialIconType.wireFine,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_FINE_WIRE));
     // consisting out of 4 Plates, 1 Ring and 1 Screw.
-    public static final OrePrefix rotor = new OrePrefix("rotor", M * 4, null, MaterialIconType.rotor, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_ROTOR));
-    public static final OrePrefix gearSmall = new OrePrefix("gearSmall", M, null, MaterialIconType.gearSmall, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_SMALL_GEAR));
+    public static final OrePrefix rotor = new OrePrefix("rotor", M * 4, null, MaterialIconType.rotor,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_ROTOR));
+    public static final OrePrefix gearSmall = new OrePrefix("gearSmall", M, null, MaterialIconType.gearSmall,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_SMALL_GEAR));
     // Introduced by me because BuildCraft has ruined the gear Prefix...
-    public static final OrePrefix gear = new OrePrefix("gear", M * 4, null, MaterialIconType.gear, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_GEAR));
+    public static final OrePrefix gear = new OrePrefix("gear", M * 4, null, MaterialIconType.gear, ENABLE_UNIFICATION,
+            mat -> mat.hasFlag(GENERATE_GEAR));
     // 3/4 of a Plate or Gem used to shape a Lens. Normally only used on Transparent Materials.
-    public static final OrePrefix lens = new OrePrefix("lens", (M * 3) / 4, null, MaterialIconType.lens, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_LENS));
+    public static final OrePrefix lens = new OrePrefix("lens", (M * 3) / 4, null, MaterialIconType.lens,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_LENS));
 
     // made of 4 Ingots.
-    public static final OrePrefix toolHeadBuzzSaw = new OrePrefix("toolHeadBuzzSaw", M * 4, null, MaterialIconType.toolHeadBuzzSaw, ENABLE_UNIFICATION, hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
+    public static final OrePrefix toolHeadBuzzSaw = new OrePrefix("toolHeadBuzzSaw", M * 4, null,
+            MaterialIconType.toolHeadBuzzSaw, ENABLE_UNIFICATION,
+            hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
     // made of 1 Ingots.
-    public static final OrePrefix toolHeadScrewdriver = new OrePrefix("toolHeadScrewdriver", M, null, MaterialIconType.toolHeadScrewdriver, ENABLE_UNIFICATION, hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_LONG_ROD)));
+    public static final OrePrefix toolHeadScrewdriver = new OrePrefix("toolHeadScrewdriver", M, null,
+            MaterialIconType.toolHeadScrewdriver, ENABLE_UNIFICATION,
+            hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_LONG_ROD)));
     // made of 4 Ingots.
-    public static final OrePrefix toolHeadDrill = new OrePrefix("toolHeadDrill", M * 4, null, MaterialIconType.toolHeadDrill, ENABLE_UNIFICATION, hasToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
+    public static final OrePrefix toolHeadDrill = new OrePrefix("toolHeadDrill", M * 4, null,
+            MaterialIconType.toolHeadDrill, ENABLE_UNIFICATION,
+            hasToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
     // made of 2 Ingots.
-    public static final OrePrefix toolHeadChainsaw = new OrePrefix("toolHeadChainsaw", M * 2, null, MaterialIconType.toolHeadChainsaw, ENABLE_UNIFICATION, hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
+    public static final OrePrefix toolHeadChainsaw = new OrePrefix("toolHeadChainsaw", M * 2, null,
+            MaterialIconType.toolHeadChainsaw, ENABLE_UNIFICATION,
+            hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
     // made of 4 Ingots.
-    public static final OrePrefix toolHeadWrench = new OrePrefix("toolHeadWrench", M * 4, null, MaterialIconType.toolHeadWrench, ENABLE_UNIFICATION, hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
+    public static final OrePrefix toolHeadWrench = new OrePrefix("toolHeadWrench", M * 4, null,
+            MaterialIconType.toolHeadWrench, ENABLE_UNIFICATION,
+            hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
     // made of 5 Ingots.
-    public static final OrePrefix turbineBlade = new OrePrefix("turbineBlade", M * 10, null, MaterialIconType.turbineBlade, ENABLE_UNIFICATION, hasRotorProperty.and(m -> m.hasFlags(GENERATE_BOLT_SCREW, GENERATE_PLATE) && !m.hasProperty(PropertyKey.GEM)));
+    public static final OrePrefix turbineBlade = new OrePrefix("turbineBlade", M * 10, null,
+            MaterialIconType.turbineBlade, ENABLE_UNIFICATION, hasRotorProperty
+                    .and(m -> m.hasFlags(GENERATE_BOLT_SCREW, GENERATE_PLATE) && !m.hasProperty(PropertyKey.GEM)));
 
-    public static final OrePrefix paneGlass = new OrePrefix("paneGlass", -1, MarkerMaterials.Color.Colorless, null, SELF_REFERENCING, null);
-    public static final OrePrefix blockGlass = new OrePrefix("blockGlass", -1, MarkerMaterials.Color.Colorless, null, SELF_REFERENCING, null);
+    public static final OrePrefix paneGlass = new OrePrefix("paneGlass", -1, MarkerMaterials.Color.Colorless, null,
+            SELF_REFERENCING, null);
+    public static final OrePrefix blockGlass = new OrePrefix("blockGlass", -1, MarkerMaterials.Color.Colorless, null,
+            SELF_REFERENCING, null);
 
     // Storage Block consisting out of 9 Ingots/Gems/Dusts. Introduced by CovertJaguar
-    public static final OrePrefix block = new OrePrefix("block", M * 9, null, MaterialIconType.block, ENABLE_UNIFICATION, null);
+    public static final OrePrefix block = new OrePrefix("block", M * 9, null, MaterialIconType.block,
+            ENABLE_UNIFICATION, null);
 
     // Prefix used for Logs. Usually as "logWood". Introduced by Eloraam
     public static final OrePrefix log = new OrePrefix("log", -1, null, null, 0, null);
@@ -177,38 +244,62 @@ public class OrePrefix {
     // Prefix to determine which kind of Rock this is.
     public static final OrePrefix stone = new OrePrefix("stone", -1, Materials.Stone, null, SELF_REFERENCING, null);
 
-    public static final OrePrefix frameGt = new OrePrefix("frameGt", M * 2, null, null, ENABLE_UNIFICATION, material -> material.hasFlag(GENERATE_FRAME));
-
-    public static final OrePrefix pipeTinyFluid = new OrePrefix("pipeTinyFluid", M / 2, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeSmallFluid = new OrePrefix("pipeSmallFluid", M, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeNormalFluid = new OrePrefix("pipeNormalFluid", M * 3, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeLargeFluid = new OrePrefix("pipeLargeFluid", M * 6, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeHugeFluid = new OrePrefix("pipeHugeFluid", M * 12, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeQuadrupleFluid = new OrePrefix("pipeQuadrupleFluid", M * 4, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeNonupleFluid = new OrePrefix("pipeNonupleFluid", M * 9, null, null, ENABLE_UNIFICATION, null);
-
-    public static final OrePrefix pipeTinyItem = new OrePrefix("pipeTinyItem", M / 2, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeSmallItem = new OrePrefix("pipeSmallItem", M, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeNormalItem = new OrePrefix("pipeNormalItem", M * 3, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeLargeItem = new OrePrefix("pipeLargeItem", M * 6, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeHugeItem = new OrePrefix("pipeHugeItem", M * 12, null, null, ENABLE_UNIFICATION, null);
-
-    public static final OrePrefix pipeSmallRestrictive = new OrePrefix("pipeSmallRestrictive", M, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeNormalRestrictive = new OrePrefix("pipeNormalRestrictive", M * 3, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeLargeRestrictive = new OrePrefix("pipeLargeRestrictive", M * 6, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeHugeRestrictive = new OrePrefix("pipeHugeRestrictive", M * 12, null, null, ENABLE_UNIFICATION, null);
+    public static final OrePrefix frameGt = new OrePrefix("frameGt", M * 2, null, null, ENABLE_UNIFICATION,
+            material -> material.hasFlag(GENERATE_FRAME));
+
+    public static final OrePrefix pipeTinyFluid = new OrePrefix("pipeTinyFluid", M / 2, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix pipeSmallFluid = new OrePrefix("pipeSmallFluid", M, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix pipeNormalFluid = new OrePrefix("pipeNormalFluid", M * 3, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeLargeFluid = new OrePrefix("pipeLargeFluid", M * 6, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeHugeFluid = new OrePrefix("pipeHugeFluid", M * 12, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix pipeQuadrupleFluid = new OrePrefix("pipeQuadrupleFluid", M * 4, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeNonupleFluid = new OrePrefix("pipeNonupleFluid", M * 9, null, null,
+            ENABLE_UNIFICATION, null);
+
+    public static final OrePrefix pipeTinyItem = new OrePrefix("pipeTinyItem", M / 2, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix pipeSmallItem = new OrePrefix("pipeSmallItem", M, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix pipeNormalItem = new OrePrefix("pipeNormalItem", M * 3, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeLargeItem = new OrePrefix("pipeLargeItem", M * 6, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix pipeHugeItem = new OrePrefix("pipeHugeItem", M * 12, null, null, ENABLE_UNIFICATION,
+            null);
+
+    public static final OrePrefix pipeSmallRestrictive = new OrePrefix("pipeSmallRestrictive", M, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeNormalRestrictive = new OrePrefix("pipeNormalRestrictive", M * 3, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeLargeRestrictive = new OrePrefix("pipeLargeRestrictive", M * 6, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeHugeRestrictive = new OrePrefix("pipeHugeRestrictive", M * 12, null, null,
+            ENABLE_UNIFICATION, null);
 
     public static final OrePrefix wireGtHex = new OrePrefix("wireGtHex", M * 8, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix wireGtOctal = new OrePrefix("wireGtOctal", M * 4, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix wireGtQuadruple = new OrePrefix("wireGtQuadruple", M * 2, null, null, ENABLE_UNIFICATION, null);
+    public static final OrePrefix wireGtOctal = new OrePrefix("wireGtOctal", M * 4, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix wireGtQuadruple = new OrePrefix("wireGtQuadruple", M * 2, null, null,
+            ENABLE_UNIFICATION, null);
     public static final OrePrefix wireGtDouble = new OrePrefix("wireGtDouble", M, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix wireGtSingle = new OrePrefix("wireGtSingle", M / 2, null, null, ENABLE_UNIFICATION, null);
+    public static final OrePrefix wireGtSingle = new OrePrefix("wireGtSingle", M / 2, null, null, ENABLE_UNIFICATION,
+            null);
 
     public static final OrePrefix cableGtHex = new OrePrefix("cableGtHex", M * 8, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix cableGtOctal = new OrePrefix("cableGtOctal", M * 4, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix cableGtQuadruple = new OrePrefix("cableGtQuadruple", M * 2, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix cableGtDouble = new OrePrefix("cableGtDouble", M, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix cableGtSingle = new OrePrefix("cableGtSingle", M / 2, null, null, ENABLE_UNIFICATION, null);
+    public static final OrePrefix cableGtOctal = new OrePrefix("cableGtOctal", M * 4, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix cableGtQuadruple = new OrePrefix("cableGtQuadruple", M * 2, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix cableGtDouble = new OrePrefix("cableGtDouble", M, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix cableGtSingle = new OrePrefix("cableGtSingle", M / 2, null, null, ENABLE_UNIFICATION,
+            null);
 
     // Special Prefix used mainly for the Crafting Handler.
     public static final OrePrefix craftingLens = new OrePrefix("craftingLens", -1, null, null, 0, null);
@@ -227,13 +318,16 @@ public class OrePrefix {
     public static final OrePrefix component = new OrePrefix("component", -1, null, null, ENABLE_UNIFICATION, null);
 
     public static class Flags {
+
         public static final long ENABLE_UNIFICATION = 1;
         public static final long SELF_REFERENCING = 1 << 1;
     }
 
     public static class Conditions {
+
         public static final Predicate hasToolProperty = mat -> mat.hasProperty(PropertyKey.TOOL);
-        public static final Predicate hasNoCraftingToolProperty = hasToolProperty.and(mat -> !mat.getProperty(PropertyKey.TOOL).getShouldIgnoreCraftingTools());
+        public static final Predicate hasNoCraftingToolProperty = hasToolProperty
+                .and(mat -> !mat.getProperty(PropertyKey.TOOL).getShouldIgnoreCraftingTools());
         public static final Predicate hasOreProperty = mat -> mat.hasProperty(PropertyKey.ORE);
         public static final Predicate hasGemProperty = mat -> mat.hasProperty(PropertyKey.GEM);
         public static final Predicate hasDustProperty = mat -> mat.hasProperty(PropertyKey.DUST);
@@ -349,8 +443,10 @@ public static void init() {
         crushed.addSecondaryMaterial(new MaterialStack(Materials.Stone, dust.materialAmount));
 
         toolHeadDrill.addSecondaryMaterial(new MaterialStack(Materials.Steel, plate.materialAmount * 4));
-        toolHeadChainsaw.addSecondaryMaterial(new MaterialStack(Materials.Steel, plate.materialAmount * 4 + ring.materialAmount * 2));
-        toolHeadWrench.addSecondaryMaterial(new MaterialStack(Materials.Steel, ring.materialAmount + screw.materialAmount * 2));
+        toolHeadChainsaw.addSecondaryMaterial(
+                new MaterialStack(Materials.Steel, plate.materialAmount * 4 + ring.materialAmount * 2));
+        toolHeadWrench.addSecondaryMaterial(
+                new MaterialStack(Materials.Steel, ring.materialAmount + screw.materialAmount * 2));
 
         pipeSmallRestrictive.addSecondaryMaterial(new MaterialStack(Materials.Iron, ring.materialAmount * 2));
         pipeNormalRestrictive.addSecondaryMaterial(new MaterialStack(Materials.Iron, ring.materialAmount * 2));
@@ -400,10 +496,8 @@ private static void excludeAllGemsButNormal(Material material) {
     public final boolean isUnificationEnabled;
     public final boolean isSelfReferencing;
 
-    private @Nullable
-    Predicate generationCondition;
-    public final @Nullable
-    MaterialIconType materialIconType;
+    private @Nullable Predicate generationCondition;
+    public final @Nullable MaterialIconType materialIconType;
 
     private final long materialAmount;
 
@@ -413,8 +507,7 @@ private static void excludeAllGemsButNormal(Material material) {
      * 

* NOTE: Ore registrations with self-referencing OrePrefix still can occur with other materials */ - public @Nullable - Material materialType; + public @Nullable Material materialType; private final List oreProcessingHandlers = new ArrayList<>(); private final Set ignoredMaterials = new HashSet<>(); @@ -429,11 +522,14 @@ private static void excludeAllGemsButNormal(Material material) { private String alternativeOreName = null; - public OrePrefix(String name, long materialAmount, @Nullable Material material, @Nullable MaterialIconType materialIconType, long flags, @Nullable Predicate condition) { + public OrePrefix(String name, long materialAmount, @Nullable Material material, + @Nullable MaterialIconType materialIconType, long flags, @Nullable Predicate condition) { this(name, materialAmount, material, materialIconType, flags, condition, null); } - public OrePrefix(String name, long materialAmount, @Nullable Material material, @Nullable MaterialIconType materialIconType, long flags, @Nullable Predicate condition, @Nullable Function> tooltipFunc) { + public OrePrefix(String name, long materialAmount, @Nullable Material material, + @Nullable MaterialIconType materialIconType, long flags, @Nullable Predicate condition, + @Nullable Function> tooltipFunc) { Preconditions.checkArgument(!PREFIXES.containsKey(name), "OrePrefix " + name + " already registered!"); this.name = name; this.id = idCounter.getAndIncrement(); @@ -480,7 +576,8 @@ public static OrePrefix getPrefix(String prefixName, @Nullable OrePrefix replace } public boolean doGenerateItem(Material material) { - return !isSelfReferencing && !isIgnored(material) && (generationCondition == null || generationCondition.test(material)); + return !isSelfReferencing && !isIgnored(material) && + (generationCondition == null || generationCondition.test(material)); } public void setGenerationCondition(@Nullable Predicate in) { @@ -493,7 +590,8 @@ public boolean addProcessingHandler(IOreRegistrationHandler... processingHandler return oreProcessingHandlers.addAll(Arrays.asList(processingHandler)); } - public void addProcessingHandler(PropertyKey propertyKey, TriConsumer handler) { + public void addProcessingHandler(PropertyKey propertyKey, + TriConsumer handler) { addProcessingHandler((orePrefix, material) -> { if (material.hasProperty(propertyKey) && !material.hasFlag(NO_UNIFICATION)) { handler.accept(orePrefix, material, material.getProperty(propertyKey)); @@ -503,7 +601,7 @@ public void addProcessingHandler(PropertyKey pr public void processOreRegistration(@Nullable Material material) { if (this.isSelfReferencing && material == null) { - material = materialType; //append default material for self-referencing OrePrefix + material = materialType; // append default material for self-referencing OrePrefix } if (material != null) generatedMaterials.add(material); } @@ -534,7 +632,7 @@ private void runGeneratedMaterialHandlers() { } currentMaterial.set(null); } - //clear generated materials for next pass + // clear generated materials for next pass generatedMaterials.clear(); currentProcessingPrefix.set(null); } diff --git a/src/main/java/gregtech/api/unification/ore/StoneType.java b/src/main/java/gregtech/api/unification/ore/StoneType.java index 4e2519bd325..60751e660a9 100644 --- a/src/main/java/gregtech/api/unification/ore/StoneType.java +++ b/src/main/java/gregtech/api/unification/ore/StoneType.java @@ -1,22 +1,25 @@ package gregtech.api.unification.ore; -import com.google.common.base.Preconditions; import gregtech.api.GTValues; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.util.GTControlledRegistry; import gregtech.common.ConfigHolder; import gregtech.integration.jei.basic.OreByProduct; + import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.common.Loader; -import javax.annotation.Nonnull; +import com.google.common.base.Preconditions; + import java.util.function.Predicate; import java.util.function.Supplier; +import javax.annotation.Nonnull; + /** * For ore generation */ @@ -28,18 +31,18 @@ public class StoneType implements Comparable { public final Material stoneMaterial; public final Supplier stone; public final SoundType soundType; - //we are using guava predicate because isReplaceableOreGen uses it + // we are using guava predicate because isReplaceableOreGen uses it @SuppressWarnings("Guava") private final com.google.common.base.Predicate predicate; public final boolean shouldBeDroppedAsItem; public static final GTControlledRegistry STONE_TYPE_REGISTRY = new GTControlledRegistry<>(128); - public StoneType(int id, String name, SoundType soundType, OrePrefix processingPrefix, Material stoneMaterial, Supplier stone, Predicate predicate, boolean shouldBeDroppedAsItem) { + public StoneType(int id, String name, SoundType soundType, OrePrefix processingPrefix, Material stoneMaterial, + Supplier stone, Predicate predicate, boolean shouldBeDroppedAsItem) { Preconditions.checkArgument( stoneMaterial.hasProperty(PropertyKey.DUST), - "Stone type must be made with a Material with the Dust Property!" - ); + "Stone type must be made with a Material with the Dust Property!"); this.name = name; this.soundType = soundType; this.processingPrefix = processingPrefix; @@ -65,7 +68,7 @@ public int compareTo(@Nonnull StoneType stoneType) { }; public static void init() { - //noinspection ResultOfMethodCallIgnored + // noinspection ResultOfMethodCallIgnored StoneTypes.STONE.name.getBytes(); } @@ -84,7 +87,8 @@ public static StoneType computeStoneType(IBlockState state, IBlockAccess world, } } } else if (dummy$isReplaceableOreGen) { - // It is not considered, but the test still returned true (this means the impl was probably very lazily done) + // It is not considered, but the test still returned true (this means the impl was probably very lazily + // done) // We have to test against the IBlockState ourselves to see if there's a suitable StoneType for (StoneType stoneType : STONE_TYPE_REGISTRY) { if (stoneType.predicate.test(state)) { diff --git a/src/main/java/gregtech/api/unification/ore/StoneTypes.java b/src/main/java/gregtech/api/unification/ore/StoneTypes.java index d8f7a4cdd87..bbfae9e9c80 100755 --- a/src/main/java/gregtech/api/unification/ore/StoneTypes.java +++ b/src/main/java/gregtech/api/unification/ore/StoneTypes.java @@ -4,6 +4,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.blocks.StoneVariantBlock; import gregtech.common.blocks.StoneVariantBlock.StoneVariant; + import net.minecraft.block.BlockRedSandstone; import net.minecraft.block.BlockSandStone; import net.minecraft.block.BlockStone; @@ -18,44 +19,62 @@ public class StoneTypes { public static final StoneType STONE = new StoneType(0, "stone", SoundType.STONE, OrePrefix.ore, Materials.Stone, () -> Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, EnumType.STONE), - state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == BlockStone.EnumType.STONE, true); + state -> state.getBlock() instanceof BlockStone && + state.getValue(BlockStone.VARIANT) == BlockStone.EnumType.STONE, + true); - public static StoneType NETHERRACK = new StoneType(1, "netherrack", SoundType.STONE, OrePrefix.oreNetherrack, Materials.Netherrack, + public static StoneType NETHERRACK = new StoneType(1, "netherrack", SoundType.STONE, OrePrefix.oreNetherrack, + Materials.Netherrack, Blocks.NETHERRACK::getDefaultState, state -> state.getBlock() == Blocks.NETHERRACK, true); - public static StoneType ENDSTONE = new StoneType(2, "endstone", SoundType.STONE, OrePrefix.oreEndstone, Materials.Endstone, + public static StoneType ENDSTONE = new StoneType(2, "endstone", SoundType.STONE, OrePrefix.oreEndstone, + Materials.Endstone, Blocks.END_STONE::getDefaultState, state -> state.getBlock() == Blocks.END_STONE, true); - // Dummy Types used for better world generation - public static StoneType SANDSTONE = new StoneType(3, "sandstone", SoundType.STONE, OrePrefix.oreSand, Materials.SiliconDioxide, + public static StoneType SANDSTONE = new StoneType(3, "sandstone", SoundType.STONE, OrePrefix.oreSand, + Materials.SiliconDioxide, () -> Blocks.SANDSTONE.getDefaultState().withProperty(BlockSandStone.TYPE, BlockSandStone.EnumType.DEFAULT), - state -> state.getBlock() instanceof BlockSandStone && state.getValue(BlockSandStone.TYPE) == BlockSandStone.EnumType.DEFAULT, false); - - public static StoneType RED_SANDSTONE = new StoneType(4, "red_sandstone", SoundType.STONE, OrePrefix.oreRedSand, Materials.SiliconDioxide, - () -> Blocks.RED_SANDSTONE.getDefaultState().withProperty(BlockRedSandstone.TYPE, BlockRedSandstone.EnumType.DEFAULT), - state -> state.getBlock() instanceof BlockRedSandstone && state.getValue(BlockRedSandstone.TYPE) == BlockRedSandstone.EnumType.DEFAULT, false); - - public static StoneType GRANITE = new StoneType(5, "granite", SoundType.STONE, OrePrefix.oreGranite, Materials.Granite, + state -> state.getBlock() instanceof BlockSandStone && + state.getValue(BlockSandStone.TYPE) == BlockSandStone.EnumType.DEFAULT, + false); + + public static StoneType RED_SANDSTONE = new StoneType(4, "red_sandstone", SoundType.STONE, OrePrefix.oreRedSand, + Materials.SiliconDioxide, + () -> Blocks.RED_SANDSTONE.getDefaultState().withProperty(BlockRedSandstone.TYPE, + BlockRedSandstone.EnumType.DEFAULT), + state -> state.getBlock() instanceof BlockRedSandstone && + state.getValue(BlockRedSandstone.TYPE) == BlockRedSandstone.EnumType.DEFAULT, + false); + + public static StoneType GRANITE = new StoneType(5, "granite", SoundType.STONE, OrePrefix.oreGranite, + Materials.Granite, () -> Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, EnumType.GRANITE), - state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == EnumType.GRANITE, false); + state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == EnumType.GRANITE, + false); - public static StoneType DIORITE = new StoneType(6, "diorite", SoundType.STONE, OrePrefix.oreDiorite, Materials.Diorite, + public static StoneType DIORITE = new StoneType(6, "diorite", SoundType.STONE, OrePrefix.oreDiorite, + Materials.Diorite, () -> Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, EnumType.DIORITE), - state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == EnumType.DIORITE, false); + state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == EnumType.DIORITE, + false); - public static StoneType ANDESITE = new StoneType(7, "andesite", SoundType.STONE, OrePrefix.oreAndesite, Materials.Andesite, + public static StoneType ANDESITE = new StoneType(7, "andesite", SoundType.STONE, OrePrefix.oreAndesite, + Materials.Andesite, () -> Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.ANDESITE), - state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == EnumType.ANDESITE, false); + state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == EnumType.ANDESITE, + false); - public static StoneType BLACK_GRANITE = new StoneType(8, "black_granite", SoundType.STONE, OrePrefix.oreBlackgranite, Materials.GraniteBlack, + public static StoneType BLACK_GRANITE = new StoneType(8, "black_granite", SoundType.STONE, + OrePrefix.oreBlackgranite, Materials.GraniteBlack, () -> gtStoneState(StoneVariantBlock.StoneType.BLACK_GRANITE), state -> gtStonePredicate(state, StoneVariantBlock.StoneType.BLACK_GRANITE), false); - public static StoneType RED_GRANITE = new StoneType(9, "red_granite", SoundType.STONE, OrePrefix.oreRedgranite, Materials.GraniteRed, + public static StoneType RED_GRANITE = new StoneType(9, "red_granite", SoundType.STONE, OrePrefix.oreRedgranite, + Materials.GraniteRed, () -> gtStoneState(StoneVariantBlock.StoneType.RED_GRANITE), state -> gtStonePredicate(state, StoneVariantBlock.StoneType.RED_GRANITE), false); diff --git a/src/main/java/gregtech/api/unification/stack/ItemAndMetadata.java b/src/main/java/gregtech/api/unification/stack/ItemAndMetadata.java index 22880b79cca..287f5c42d72 100644 --- a/src/main/java/gregtech/api/unification/stack/ItemAndMetadata.java +++ b/src/main/java/gregtech/api/unification/stack/ItemAndMetadata.java @@ -1,6 +1,7 @@ package gregtech.api.unification.stack; import gregtech.api.GTValues; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/api/unification/stack/ItemVariantMap.java b/src/main/java/gregtech/api/unification/stack/ItemVariantMap.java index d817737ac4e..bad615f0888 100644 --- a/src/main/java/gregtech/api/unification/stack/ItemVariantMap.java +++ b/src/main/java/gregtech/api/unification/stack/ItemVariantMap.java @@ -1,11 +1,13 @@ package gregtech.api.unification.stack; import gregtech.api.GTValues; + import net.minecraft.item.ItemStack; +import java.util.Set; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Set; /** * An abstraction of dictionary-like collection with each item variant as keys. @@ -23,7 +25,7 @@ public interface ItemVariantMap { /** * @return {@code true} if there's any nonnull value associated with some item - * metadata, excluding metadata value of {@link GTValues#W} {@code (32767)}. + * metadata, excluding metadata value of {@link GTValues#W} {@code (32767)}. * @see #hasWildcardEntry() */ boolean hasNonWildcardEntry(); @@ -31,7 +33,7 @@ public interface ItemVariantMap { /** * @param meta item metadata * @return {@code true} if there's a nonnull value associated with given item - * metadata, {@code false} otherwise. + * metadata, {@code false} otherwise. */ boolean has(short meta); @@ -42,7 +44,7 @@ public interface ItemVariantMap { * * @param meta item metadata * @return value associated with given item metadata, or {@code null} if there's no - * values associated. + * values associated. */ @Nullable E get(short meta); @@ -56,7 +58,7 @@ default boolean isEmpty() { /** * @return {@code true} if there's a nonnull value associated with item - * metadata {@link GTValues#W} {@code (32767)}. + * metadata {@link GTValues#W} {@code (32767)}. * @see #hasNonWildcardEntry() */ default boolean hasWildcardEntry() { @@ -66,7 +68,7 @@ default boolean hasWildcardEntry() { /** * @param stack item stack * @return {@code true} if there's a nonnull value associated with item damage of - * the item, {@code false} otherwise. + * the item, {@code false} otherwise. */ default boolean has(@Nonnull ItemStack stack) { return has((short) stack.getItemDamage()); @@ -79,7 +81,7 @@ default boolean has(@Nonnull ItemStack stack) { * * @param stack item stack * @return value associated with item damage of the item, or {@code null} if there's - * no values associated. + * no values associated. */ @Nullable default E get(@Nonnull ItemStack stack) { @@ -129,7 +131,7 @@ interface Mutable extends ItemVariantMap { * @param meta item metadata * @param e new value, or {@code null} for entry removal * @return previous value associated with given item metadata, or {@code null} if - * there was no such value. + * there was no such value. */ @Nullable E put(short meta, @Nullable E e); @@ -142,7 +144,7 @@ interface Mutable extends ItemVariantMap { * @param stack item stack * @param e new value, or {@code null} for entry removal * @return previous value associated with given item metadata, or {@code null} if - * there was no such value. + * there was no such value. */ @Nullable default E put(@Nonnull ItemStack stack, @Nullable E e) { diff --git a/src/main/java/gregtech/api/unification/stack/MaterialStack.java b/src/main/java/gregtech/api/unification/stack/MaterialStack.java index bdb4611e330..8398d4361be 100644 --- a/src/main/java/gregtech/api/unification/stack/MaterialStack.java +++ b/src/main/java/gregtech/api/unification/stack/MaterialStack.java @@ -1,8 +1,9 @@ package gregtech.api.unification.stack; -import crafttweaker.annotations.ZenRegister; import gregtech.api.unification.material.Material; import gregtech.api.util.SmallDigits; + +import crafttweaker.annotations.ZenRegister; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenProperty; diff --git a/src/main/java/gregtech/api/unification/stack/MultiItemVariantMap.java b/src/main/java/gregtech/api/unification/stack/MultiItemVariantMap.java index 77630397bd9..714984b0cd3 100644 --- a/src/main/java/gregtech/api/unification/stack/MultiItemVariantMap.java +++ b/src/main/java/gregtech/api/unification/stack/MultiItemVariantMap.java @@ -1,6 +1,7 @@ package gregtech.api.unification.stack; import gregtech.api.GTValues; + import it.unimi.dsi.fastutil.shorts.Short2ObjectMap; import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap; diff --git a/src/main/java/gregtech/api/unification/stack/UnificationEntry.java b/src/main/java/gregtech/api/unification/stack/UnificationEntry.java index d290fa91483..70e5193490b 100644 --- a/src/main/java/gregtech/api/unification/stack/UnificationEntry.java +++ b/src/main/java/gregtech/api/unification/stack/UnificationEntry.java @@ -3,9 +3,10 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.ore.OrePrefix; -import javax.annotation.Nullable; import java.util.Objects; +import javax.annotation.Nullable; + public class UnificationEntry { public final OrePrefix orePrefix; @@ -44,5 +45,4 @@ public int hashCode() { public String toString() { return orePrefix.name() + (material != null ? material.toCamelCaseString() : ""); } - } diff --git a/src/main/java/gregtech/api/unification/stack/UnmodifiableSetViewVariantMap.java b/src/main/java/gregtech/api/unification/stack/UnmodifiableSetViewVariantMap.java index cf4acd9d223..09f5400347b 100644 --- a/src/main/java/gregtech/api/unification/stack/UnmodifiableSetViewVariantMap.java +++ b/src/main/java/gregtech/api/unification/stack/UnmodifiableSetViewVariantMap.java @@ -1,10 +1,11 @@ package gregtech.api.unification.stack; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Unmodifiable view of another {@link ItemVariantMap} with {@link Set} of elements as values. * diff --git a/src/main/java/gregtech/api/util/AssemblyLineManager.java b/src/main/java/gregtech/api/util/AssemblyLineManager.java index ae1459842db..5275d23e690 100644 --- a/src/main/java/gregtech/api/util/AssemblyLineManager.java +++ b/src/main/java/gregtech/api/util/AssemblyLineManager.java @@ -14,17 +14,20 @@ import gregtech.api.recipes.recipeproperties.ScanProperty; import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.Constants; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.ApiStatus; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public final class AssemblyLineManager { public static final String RESEARCH_NBT_TAG = "assemblylineResearch"; @@ -80,7 +83,7 @@ public static String readResearchId(@Nonnull ItemStack stack) { * @return if the stack is a data item */ public static boolean isStackDataItem(@Nonnull ItemStack stack, boolean isDataBank) { - if (stack.getItem() instanceof MetaItem metaItem) { + if (stack.getItem() instanceof MetaItemmetaItem) { MetaItem.MetaValueItem valueItem = metaItem.getItem(stack); if (valueItem == null) return false; for (IItemBehaviour behaviour : valueItem.getBehaviours()) { @@ -102,7 +105,7 @@ public static boolean hasResearchTag(@Nonnull ItemStack stack) { /** * @param compound the compound to check - * @return if the tag has the research NBTTagCompound + * @return if the tag has the research NBTTagCompound */ private static boolean hasResearchTag(@Nullable NBTTagCompound compound) { if (compound == null || compound.isEmpty()) return false; @@ -118,11 +121,13 @@ public static void createDefaultResearchRecipe(@Nonnull AssemblyLineRecipeBuilde if (!ConfigHolder.machines.enableResearch) return; for (AssemblyLineRecipeBuilder.ResearchRecipeEntry entry : builder.getRecipeEntries()) { - createDefaultResearchRecipe(entry.getResearchId(), entry.getResearchStack(), entry.getDataStack(), entry.getDuration(), entry.getEUt(), entry.getCWUt()); + createDefaultResearchRecipe(entry.getResearchId(), entry.getResearchStack(), entry.getDataStack(), + entry.getDuration(), entry.getEUt(), entry.getCWUt()); } } - public static void createDefaultResearchRecipe(@Nonnull String researchId, @Nonnull ItemStack researchItem, @Nonnull ItemStack dataItem, int duration, int EUt, int CWUt) { + public static void createDefaultResearchRecipe(@Nonnull String researchId, @Nonnull ItemStack researchItem, + @Nonnull ItemStack dataItem, int duration, int EUt, int CWUt) { if (!ConfigHolder.machines.enableResearch) return; NBTTagCompound compound = GTUtility.getOrCreateNbtCompound(dataItem); @@ -155,7 +160,8 @@ public static class DataStickCopyScannerLogic implements IScannerRecipeMap.ICust private static final int DURATION = 100; @Override - public Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage) { + public Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, + boolean exactVoltage) { if (inputs.size() > 1) { // try the data recipe both ways, prioritizing overwriting the first Recipe recipe = createDataRecipe(inputs.get(0), inputs.get(1)); diff --git a/src/main/java/gregtech/api/util/BaseCreativeTab.java b/src/main/java/gregtech/api/util/BaseCreativeTab.java index 22d02449fc3..17ef48931f8 100644 --- a/src/main/java/gregtech/api/util/BaseCreativeTab.java +++ b/src/main/java/gregtech/api/util/BaseCreativeTab.java @@ -4,9 +4,10 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; import java.util.function.Supplier; +import javax.annotation.Nonnull; + public class BaseCreativeTab extends CreativeTabs { private final boolean hasSearchBar; diff --git a/src/main/java/gregtech/api/util/BlockInfo.java b/src/main/java/gregtech/api/util/BlockInfo.java index 49150b02ca1..2f2340db46d 100644 --- a/src/main/java/gregtech/api/util/BlockInfo.java +++ b/src/main/java/gregtech/api/util/BlockInfo.java @@ -1,6 +1,5 @@ package gregtech.api.util; -import com.google.common.base.Preconditions; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -8,6 +7,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import com.google.common.base.Preconditions; + /** * BlockInfo represents immutable information for block in world * This includes block state and tile entity, and needed for complete representation diff --git a/src/main/java/gregtech/api/util/BlockUtility.java b/src/main/java/gregtech/api/util/BlockUtility.java index 70a75f0c0dd..2e9854ebc42 100644 --- a/src/main/java/gregtech/api/util/BlockUtility.java +++ b/src/main/java/gregtech/api/util/BlockUtility.java @@ -31,5 +31,4 @@ public static void startCaptureDrops() { public static NonNullList stopCaptureDrops() { return WRAPPER.captureDrops(false); } - } diff --git a/src/main/java/gregtech/api/util/CapesRegistry.java b/src/main/java/gregtech/api/util/CapesRegistry.java index 2f92b017ea6..50972a56236 100644 --- a/src/main/java/gregtech/api/util/CapesRegistry.java +++ b/src/main/java/gregtech/api/util/CapesRegistry.java @@ -1,10 +1,10 @@ package gregtech.api.util; -import crafttweaker.annotations.ZenRegister; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.client.renderer.texture.Textures; import gregtech.core.network.packets.PacketNotifyCapeChange; + import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementManager; import net.minecraft.entity.player.EntityPlayer; @@ -22,6 +22,8 @@ import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import crafttweaker.annotations.ZenRegister; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -98,7 +100,8 @@ public static void save() { } comp.setTag("WornCapesValList", wornCapesTag); try { - CompressedStreamTools.safeWrite(comp, new File(FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(0).getSaveHandler().getWorldDirectory(), "gregtech_cape.dat")); + CompressedStreamTools.safeWrite(comp, new File(FMLCommonHandler.instance().getMinecraftServerInstance() + .getWorld(0).getSaveHandler().getWorldDirectory(), "gregtech_cape.dat")); } catch (IOException exception) { GTLog.logger.error(exception); } @@ -107,7 +110,8 @@ public static void save() { public static void load() { NBTTagCompound comp = null; try { - comp = CompressedStreamTools.read(new File(FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(0).getSaveHandler().getWorldDirectory(), "gregtech_cape.dat")); + comp = CompressedStreamTools.read(new File(FMLCommonHandler.instance().getMinecraftServerInstance() + .getWorld(0).getSaveHandler().getWorldDirectory(), "gregtech_cape.dat")); } catch (IOException exception) { GTLog.logger.error(exception); } @@ -145,9 +149,11 @@ public static void load() { } public static void checkAdvancements(World world) { - registerCape(GTUtility.gregtechId("ultimate_voltage/74_wetware_mainframe"), Textures.GREGTECH_CAPE_TEXTURE, world); + registerCape(GTUtility.gregtechId("ultimate_voltage/74_wetware_mainframe"), Textures.GREGTECH_CAPE_TEXTURE, + world); registerCape(GTUtility.gregtechId("steam/12_electronic_circuit"), Textures.RED_CAPE_TEXTURE, world); - registerCape(GTUtility.gregtechId("high_voltage/82_large_chemical_reactor"), Textures.YELLOW_CAPE_TEXTURE, world); + registerCape(GTUtility.gregtechId("high_voltage/82_large_chemical_reactor"), Textures.YELLOW_CAPE_TEXTURE, + world); registerCape(GTUtility.gregtechId("ludicrous_voltage/60_fusion"), Textures.GREEN_CAPE_TEXTURE, world); for (Tuple tuple : ctRegisterCapes) { registerCape(tuple.getFirst(), tuple.getSecond(), world); @@ -169,6 +175,7 @@ public static void checkAdvancements(World world) { /** * Allows one to check what capes a specific player has unlocked through CapesRegistry. + * * @param uuid The player data used to get what capes the player has through internal maps. * @return A list of ResourceLocations containing the cape textures that the player has unlocked. */ @@ -176,17 +183,18 @@ public static List getUnlockedCapes(UUID uuid) { return UNLOCKED_CAPES.getOrDefault(uuid, Collections.emptyList()); } - /** * Links an advancement with a cape, which allows a player to unlock it when they receive the advancement. * This should only be called on world load, since advancements are only accessible then. + * * @param advancement A ResourceLocation pointing to the advancement that is to be used for getting a cape. * @param cape The ResourceLocation that points to the cape that can be unlocked through the advancement. * @param world The world that may contain the advancement used for getting a cape. */ public static void registerCape(ResourceLocation advancement, ResourceLocation cape, World world) { if (!world.isRemote) { - AdvancementManager advManager = ObfuscationReflectionHelper.getPrivateValue(World.class, world, "field_191951_C"); + AdvancementManager advManager = ObfuscationReflectionHelper.getPrivateValue(World.class, world, + "field_191951_C"); Advancement advObject = advManager.getAdvancement(advancement); if (advObject != null) { CAPE_ADVANCEMENTS.put(advObject, cape); @@ -196,6 +204,7 @@ public static void registerCape(ResourceLocation advancement, ResourceLocation c /** * Adds a cape that will always be unlocked for all players. + * * @param cape A ResourceLocation pointing to the cape texture. */ public static void addFreeCape(ResourceLocation cape) { @@ -220,6 +229,7 @@ public static void registerFreeCape(String cape) { /** * Automatically gives a cape to a player, which may be used for a reward for something other than an advancement * DOES NOT SAVE AUTOMATICALLY; PLEASE CALL SAVE AFTER THIS FUNCTION IS USED IF THIS DATA IS MEANT TO PERSIST. + * * @param uuid The UUID of the player to be given the cape. * @param cape The ResourceLocation that holds the cape used here. */ @@ -261,10 +271,13 @@ public static void giveCape(UUID uuid, ResourceLocation cape) { public static void loadWornCapeOnLogin(EntityPlayer player) { if (player instanceof EntityPlayerMP) { UUID uuid = player.getPersistentID(); - GregTechAPI.networkHandler.sendToAll(new PacketNotifyCapeChange(uuid, WORN_CAPES.get(uuid))); // sync to others - for (EntityPlayerMP otherPlayer : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayers()) { // sync to login + GregTechAPI.networkHandler.sendToAll(new PacketNotifyCapeChange(uuid, WORN_CAPES.get(uuid))); // sync to + // others + for (EntityPlayerMP otherPlayer : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList() + .getPlayers()) { // sync to login uuid = otherPlayer.getPersistentID(); - GregTechAPI.networkHandler.sendTo(new PacketNotifyCapeChange(uuid, WORN_CAPES.get(uuid)), (EntityPlayerMP) player); + GregTechAPI.networkHandler.sendTo(new PacketNotifyCapeChange(uuid, WORN_CAPES.get(uuid)), + (EntityPlayerMP) player); } } } @@ -273,12 +286,14 @@ public static void loadWornCapeOnLogin(EntityPlayer player) { public static void detectNewCapes(EntityPlayer player) { if (player instanceof EntityPlayerMP) { for (Map.Entry capeEntry : CAPE_ADVANCEMENTS.entrySet()) { - if ((UNLOCKED_CAPES.get(player.getPersistentID()) == null || !UNLOCKED_CAPES.get(player.getPersistentID()).contains(capeEntry.getValue())) && + if ((UNLOCKED_CAPES.get(player.getPersistentID()) == null || + !UNLOCKED_CAPES.get(player.getPersistentID()).contains(capeEntry.getValue())) && ((EntityPlayerMP) player).getAdvancements().getProgress(capeEntry.getKey()).isDone()) { unlockCapeOnAdvancement(player, capeEntry.getKey()); } } - if (UNLOCKED_CAPES.get(player.getPersistentID()) == null || !new HashSet<>(UNLOCKED_CAPES.get(player.getPersistentID())).containsAll(FREE_CAPES)) { + if (UNLOCKED_CAPES.get(player.getPersistentID()) == null || + !new HashSet<>(UNLOCKED_CAPES.get(player.getPersistentID())).containsAll(FREE_CAPES)) { for (ResourceLocation cape : FREE_CAPES) { unlockCape(player.getPersistentID(), cape); } @@ -286,5 +301,4 @@ public static void detectNewCapes(EntityPlayer player) { } } } - } diff --git a/src/main/java/gregtech/api/util/ClipboardUtil.java b/src/main/java/gregtech/api/util/ClipboardUtil.java index 31215ca1508..07736bd68e2 100755 --- a/src/main/java/gregtech/api/util/ClipboardUtil.java +++ b/src/main/java/gregtech/api/util/ClipboardUtil.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.core.network.packets.PacketClipboard; + import net.minecraft.entity.player.EntityPlayerMP; import java.awt.*; diff --git a/src/main/java/gregtech/api/util/CustomModPriorityComparator.java b/src/main/java/gregtech/api/util/CustomModPriorityComparator.java index 5424a8e2605..6bc173b2754 100644 --- a/src/main/java/gregtech/api/util/CustomModPriorityComparator.java +++ b/src/main/java/gregtech/api/util/CustomModPriorityComparator.java @@ -22,19 +22,18 @@ public int compare(ItemAndMetadata first, ItemAndMetadata second) { int firstModIndex = modPriorityList.indexOf(firstModId); int secondModIndex = modPriorityList.indexOf(secondModId); if (firstModIndex == -1 && secondModIndex == -1) { - //if both mod ids are not in mod priority list, compare them alphabetically + // if both mod ids are not in mod priority list, compare them alphabetically return firstModId.compareTo(secondModId); } else if (firstModIndex == -1) { - //if first mod is not in priority list, it has lower priority than second + // if first mod is not in priority list, it has lower priority than second return -1; } else if (secondModIndex == -1) { - //if second mod is not in priority list, it has lower priority than first + // if second mod is not in priority list, it has lower priority than first return 1; } else { - //otherwise, both mods are in priority list, so compare their indexes - //we invert compare arguments, because lower index should have higher priority + // otherwise, both mods are in priority list, so compare their indexes + // we invert compare arguments, because lower index should have higher priority return Integer.compare(secondModIndex, firstModIndex); } } - } diff --git a/src/main/java/gregtech/api/util/DummyContainer.java b/src/main/java/gregtech/api/util/DummyContainer.java index 1f2f4fa66d7..5b523937c90 100644 --- a/src/main/java/gregtech/api/util/DummyContainer.java +++ b/src/main/java/gregtech/api/util/DummyContainer.java @@ -7,16 +7,13 @@ public class DummyContainer extends Container { - public DummyContainer() { - } + public DummyContainer() {} @Override - public void detectAndSendChanges() { - } + public void detectAndSendChanges() {} @Override public boolean canInteractWith(@Nonnull EntityPlayer playerIn) { return true; } - } diff --git a/src/main/java/gregtech/api/util/DyeUtil.java b/src/main/java/gregtech/api/util/DyeUtil.java index 5573c840a45..372ef625b18 100644 --- a/src/main/java/gregtech/api/util/DyeUtil.java +++ b/src/main/java/gregtech/api/util/DyeUtil.java @@ -36,23 +36,40 @@ public static EnumDyeColor determineDyeColor(int rgbColor) { @Nonnull public static String getOredictColorName(@Nonnull EnumDyeColor dyeColor) { switch (dyeColor) { - case WHITE: return "dyeWhite"; - case ORANGE: return "dyeOrange"; - case MAGENTA: return "dyeMagenta"; - case LIGHT_BLUE: return "dyeLightBlue"; - case YELLOW: return "dyeYellow"; - case LIME: return "dyeLime"; - case PINK: return "dyePink"; - case GRAY: return "dyeGray"; - case SILVER: return "dyeLightGray"; - case CYAN: return "dyeCyan"; - case PURPLE: return "dyePurple"; - case BLUE: return "dyeBlue"; - case BROWN: return "dyeBrown"; - case GREEN: return "dyeGreen"; - case RED: return "dyeRed"; - case BLACK: return "dyeBlack"; - default: throw new IllegalStateException("Unreachable"); + case WHITE: + return "dyeWhite"; + case ORANGE: + return "dyeOrange"; + case MAGENTA: + return "dyeMagenta"; + case LIGHT_BLUE: + return "dyeLightBlue"; + case YELLOW: + return "dyeYellow"; + case LIME: + return "dyeLime"; + case PINK: + return "dyePink"; + case GRAY: + return "dyeGray"; + case SILVER: + return "dyeLightGray"; + case CYAN: + return "dyeCyan"; + case PURPLE: + return "dyePurple"; + case BLUE: + return "dyeBlue"; + case BROWN: + return "dyeBrown"; + case GREEN: + return "dyeGreen"; + case RED: + return "dyeRed"; + case BLACK: + return "dyeBlack"; + default: + throw new IllegalStateException("Unreachable"); } } } diff --git a/src/main/java/gregtech/api/util/EntityDamageUtil.java b/src/main/java/gregtech/api/util/EntityDamageUtil.java index 9263e39e572..48322611ece 100644 --- a/src/main/java/gregtech/api/util/EntityDamageUtil.java +++ b/src/main/java/gregtech/api/util/EntityDamageUtil.java @@ -2,6 +2,7 @@ import gregtech.api.damagesources.DamageSources; import gregtech.core.advancement.AdvancementTriggers; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.monster.*; @@ -25,7 +26,8 @@ public class EntityDamageUtil { * @param multiplier the multiplier on the damage taken * @param maximum the maximum damage to apply to the entity, use -1 for no maximum */ - public static void applyTemperatureDamage(@Nonnull EntityLivingBase entity, int temperature, float multiplier, int maximum) { + public static void applyTemperatureDamage(@Nonnull EntityLivingBase entity, int temperature, float multiplier, + int maximum) { if (temperature > 320) { int damage = (int) ((multiplier * (temperature - 300)) / 50.0F); if (maximum > 0) { @@ -50,7 +52,8 @@ public static void applyHeatDamage(@Nonnull EntityLivingBase entity, int damage) if (damage <= 0) return; if (!entity.isEntityAlive()) return; // fire/lava mobs cannot be burned - if (entity instanceof EntityBlaze || entity instanceof EntityMagmaCube || entity instanceof EntityWitherSkeleton || entity instanceof EntityWither) + if (entity instanceof EntityBlaze || entity instanceof EntityMagmaCube || + entity instanceof EntityWitherSkeleton || entity instanceof EntityWither) return; // fire resistance entities cannot be burned if (entity.getActivePotionEffect(MobEffects.FIRE_RESISTANCE) != null) return; diff --git a/src/main/java/gregtech/api/util/FileUtility.java b/src/main/java/gregtech/api/util/FileUtility.java index 7f6e82d2ede..f9015755416 100644 --- a/src/main/java/gregtech/api/util/FileUtility.java +++ b/src/main/java/gregtech/api/util/FileUtility.java @@ -1,8 +1,9 @@ package gregtech.api.util; +import gregtech.api.worldgen.config.WorldGenRegistry; + import com.google.gson.*; import com.google.gson.stream.JsonReader; -import gregtech.api.worldgen.config.WorldGenRegistry; import org.apache.commons.io.IOUtils; import java.io.*; @@ -10,8 +11,8 @@ import java.net.URISyntaxException; import java.net.URL; import java.nio.charset.StandardCharsets; -import java.nio.file.FileSystem; import java.nio.file.*; +import java.nio.file.FileSystem; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; @@ -20,12 +21,12 @@ import java.util.stream.Stream; public class FileUtility { + public static final JsonParser jsonParser = new JsonParser(); public static final Gson gson = new GsonBuilder().setPrettyPrinting().create(); private static final Pattern UNDERSCORE_REGEX = Pattern.compile("_"); - private FileUtility() { - } + private FileUtility() {} public static String readInputStream(InputStream inputStream) throws IOException { byte[] streamData = IOUtils.toByteArray(inputStream); @@ -73,7 +74,7 @@ public static JsonElement loadJson(File file) { public static boolean saveJson(File file, JsonElement element) { try { if (!file.getParentFile().isDirectory()) { - if (!file.getParentFile().mkdirs()){ + if (!file.getParentFile().mkdirs()) { GTLog.logger.error("Failed to create file dirs on path {}", file); } } @@ -87,7 +88,7 @@ public static boolean saveJson(File file, JsonElement element) { return false; } - public static void extractJarFiles(String resource, File targetPath, boolean replace) { //terminal/guide + public static void extractJarFiles(String resource, File targetPath, boolean replace) { // terminal/guide FileSystem zipFileSystem = null; try { URL sampleUrl = WorldGenRegistry.class.getResource("/assets/gregtech/.gtassetsroot"); @@ -127,17 +128,14 @@ public static void extractJarFiles(String resource, File targetPath, boolean rep throw new RuntimeException(impossible); } catch (IOException exception) { GTLog.logger.error("error while extracting jar files: {} {}", resource, targetPath, exception); - } - finally { + } finally { if (zipFileSystem != null) { - //close zip file system to avoid issues + // close zip file system to avoid issues IOUtils.closeQuietly(zipFileSystem); } } - } - /** * Takes a file path to a json file and trims the path down to the actual file name * Replaces all _ in the file name with spaces and capitalizes the file name @@ -149,17 +147,17 @@ public static String trimFileName(String name) { // this method is passed deposit names, which need to be converted first name = slashToNativeSep(name); - //Remove the leading "folderName\" + // Remove the leading "folderName\" String[] tempName = name.split(Matcher.quoteReplacement(File.separator)); - //Take the last entry in case of nested folders + // Take the last entry in case of nested folders String newName = tempName[tempName.length - 1]; - //Remove the ".json" + // Remove the ".json" tempName = newName.split("\\."); - //Take the first entry + // Take the first entry newName = tempName[0]; - //Replace all "_" with a space + // Replace all "_" with a space newName = UNDERSCORE_REGEX.matcher(newName).replaceAll(" "); - //Capitalize the first letter + // Capitalize the first letter newName = newName.substring(0, 1).toUpperCase() + newName.substring(1); return newName; diff --git a/src/main/java/gregtech/api/util/FluidTooltipUtil.java b/src/main/java/gregtech/api/util/FluidTooltipUtil.java index 7def7126b70..b73b335e162 100644 --- a/src/main/java/gregtech/api/util/FluidTooltipUtil.java +++ b/src/main/java/gregtech/api/util/FluidTooltipUtil.java @@ -2,11 +2,13 @@ import gregtech.api.fluids.GTFluid; import gregtech.api.unification.material.Material; + import net.minecraft.client.resources.I18n; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.NotNull; import java.util.*; diff --git a/src/main/java/gregtech/api/util/GTControlledRegistry.java b/src/main/java/gregtech/api/util/GTControlledRegistry.java index 0495b4ffb0f..5c605758e97 100644 --- a/src/main/java/gregtech/api/util/GTControlledRegistry.java +++ b/src/main/java/gregtech/api/util/GTControlledRegistry.java @@ -1,6 +1,7 @@ package gregtech.api.util; import gregtech.api.GTValues; + import net.minecraft.util.registry.RegistryNamespaced; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; @@ -58,8 +59,9 @@ public void register(int id, @Nonnull K key, @Nonnull V value) { V objectWithId = getObjectById(id); if (objectWithId != null) { - throw new IllegalArgumentException(String.format("Tried to reassign id %d to %s (%s), but it is already assigned to %s (%s)!", - id, value, key, objectWithId, getNameForObject(objectWithId))); + throw new IllegalArgumentException( + String.format("Tried to reassign id %d to %s (%s), but it is already assigned to %s (%s)!", + id, value, key, objectWithId, getNameForObject(objectWithId))); } underlyingIntegerMap.put(value, id); } diff --git a/src/main/java/gregtech/api/util/GTHashMaps.java b/src/main/java/gregtech/api/util/GTHashMaps.java index 430e2ad8439..32f4a49185c 100644 --- a/src/main/java/gregtech/api/util/GTHashMaps.java +++ b/src/main/java/gregtech/api/util/GTHashMaps.java @@ -1,20 +1,23 @@ package gregtech.api.util; import gregtech.api.recipes.FluidKey; -import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandler; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; + import java.util.Collection; import java.util.Map; import java.util.Set; +import javax.annotation.Nonnull; + public final class GTHashMaps { private GTHashMaps() {} @@ -54,7 +57,8 @@ public static Object2IntMap fromItemHandler(@Nonnull IItemHandler inp } /** - * Maps all items in the {@link ItemStack} {@link Collection} into a {@link ItemStack}, {@link Integer} value as amount + * Maps all items in the {@link ItemStack} {@link Collection} into a {@link ItemStack}, {@link Integer} value as + * amount * * @param inputs The inventory handler of the inventory * @return a {@link Map} of {@link ItemStack} and {@link Integer} as amount on the inventory @@ -65,14 +69,16 @@ public static Object2IntMap fromItemStackCollection(@Nonnull Iterable } /** - * Maps all items in the {@link ItemStack} {@link Collection} into a {@link ItemStack}, {@link Integer} value as amount + * Maps all items in the {@link ItemStack} {@link Collection} into a {@link ItemStack}, {@link Integer} value as + * amount * * @param inputs The inventory handler of the inventory * @param linked If the Map should be a Linked Map to preserve insertion order * @return a {@link Map} of {@link ItemStack} and {@link Integer} as amount on the inventory */ @Nonnull - public static Object2IntMap fromItemStackCollection(@Nonnull Iterable inputs, boolean linked) { + public static Object2IntMap fromItemStackCollection(@Nonnull Iterable inputs, + boolean linked) { final Object2IntMap map = createItemStackMap(linked); // Create a single stack of the combined count for each item @@ -96,7 +102,8 @@ private static Object2IntMap createItemStackMap(boolean linked) { * Maps all fluids in the {@link IFluidHandler} into a {@link FluidKey}, {@link Integer} value as amount * * @param fluidInputs The combined fluid input inventory handler, in the form of an {@link IFluidHandler} - * @return a {@link Set} of unique {@link FluidKey}s for each fluid in the handler. Will be oversized stacks if required + * @return a {@link Set} of unique {@link FluidKey}s for each fluid in the handler. Will be oversized stacks if + * required */ public static Map fromFluidHandler(IFluidHandler fluidInputs) { final Object2IntMap map = new Object2IntLinkedOpenHashMap<>(); @@ -115,10 +122,12 @@ public static Map fromFluidHandler(IFluidHandler fluidInputs) } /** - * Maps all fluids in the {@link FluidStack} {@link Collection} into a {@link FluidKey}, {@link Integer} value as amount + * Maps all fluids in the {@link FluidStack} {@link Collection} into a {@link FluidKey}, {@link Integer} value as + * amount * * @param fluidInputs The combined fluid input inventory handler, in the form of an {@link IFluidHandler} - * @return a {@link Set} of unique {@link FluidKey}s for each fluid in the handler. Will be oversized stacks if required + * @return a {@link Set} of unique {@link FluidKey}s for each fluid in the handler. Will be oversized stacks if + * required */ public static Map fromFluidCollection(Collection fluidInputs) { final Object2IntMap map = new Object2IntLinkedOpenHashMap<>(); diff --git a/src/main/java/gregtech/api/util/GTLog.java b/src/main/java/gregtech/api/util/GTLog.java index b2611c23a81..56a003fde5b 100644 --- a/src/main/java/gregtech/api/util/GTLog.java +++ b/src/main/java/gregtech/api/util/GTLog.java @@ -11,6 +11,5 @@ public class GTLog { public static Logger logger = LogManager.getLogger("GregTech"); - private GTLog() { - } + private GTLog() {} } diff --git a/src/main/java/gregtech/api/util/GTStringUtils.java b/src/main/java/gregtech/api/util/GTStringUtils.java index 01cf73fc942..615bd9704c5 100644 --- a/src/main/java/gregtech/api/util/GTStringUtils.java +++ b/src/main/java/gregtech/api/util/GTStringUtils.java @@ -11,6 +11,7 @@ import gregtech.common.blocks.BlockCompressed; import gregtech.common.blocks.BlockFrame; import gregtech.common.items.MetaItems; + import net.minecraft.block.Block; import net.minecraft.client.gui.FontRenderer; import net.minecraft.item.ItemStack; @@ -30,7 +31,8 @@ public static String prettyPrintItemStack(@Nonnull ItemStack stack) { if (metaItem instanceof MetaPrefixItem metaPrefixItem) { Material material = metaPrefixItem.getMaterial(stack); OrePrefix orePrefix = metaPrefixItem.getOrePrefix(); - return "(MetaItem) OrePrefix: " + orePrefix.name + ", Material: " + material + " * " + stack.getCount(); + return "(MetaItem) OrePrefix: " + orePrefix.name + ", Material: " + material + " * " + + stack.getCount(); } } else { if (MetaItems.INTEGRATED_CIRCUIT.isItemEqual(stack)) { @@ -61,8 +63,9 @@ public static String prettyPrintItemStack(@Nonnull ItemStack stack) { return "(MetaBlock) " + id + " * " + stack.getCount(); } } - //noinspection ConstantConditions - return stack.getItem().getRegistryName().toString() + " * " + stack.getCount() + " (Meta " + stack.getItemDamage() + ")"; + // noinspection ConstantConditions + return stack.getItem().getRegistryName().toString() + " * " + stack.getCount() + " (Meta " + + stack.getItemDamage() + ")"; } /** @@ -89,7 +92,7 @@ public static String ticksToElapsedTime(int ticks) { int seconds = ticks / 20; int minutes = seconds / 60; seconds = seconds % 60; - //noinspection StringConcatenationMissingWhitespace + // noinspection StringConcatenationMissingWhitespace return seconds < 10 ? minutes + ":0" + seconds : minutes + ":" + seconds; } @@ -102,13 +105,12 @@ public static String ticksToElapsedTime(int ticks) { * @param maxLength The maximum width of the String */ public static void drawCenteredStringWithCutoff(String stringToDraw, FontRenderer fontRenderer, int maxLength) { - - //Account for really long names + // Account for really long names if (fontRenderer.getStringWidth(stringToDraw) > maxLength) { stringToDraw = fontRenderer.trimStringToWidth(stringToDraw, maxLength - 3, false) + "..."; } - //Ensure that the string is centered + // Ensure that the string is centered int startPosition = (maxLength - fontRenderer.getStringWidth(stringToDraw)) / 2; fontRenderer.drawString(stringToDraw, startPosition, 1, 0x111111); diff --git a/src/main/java/gregtech/api/util/GTTeleporter.java b/src/main/java/gregtech/api/util/GTTeleporter.java index 3520bcb3d36..02ac311bd40 100644 --- a/src/main/java/gregtech/api/util/GTTeleporter.java +++ b/src/main/java/gregtech/api/util/GTTeleporter.java @@ -6,6 +6,7 @@ import net.minecraft.world.WorldServer; public class GTTeleporter extends Teleporter { + private final WorldServer worldServerInstance; private final double x, y, z; diff --git a/src/main/java/gregtech/api/util/GTTransferUtils.java b/src/main/java/gregtech/api/util/GTTransferUtils.java index eec4eefdeda..cc5fc6b8b10 100644 --- a/src/main/java/gregtech/api/util/GTTransferUtils.java +++ b/src/main/java/gregtech/api/util/GTTransferUtils.java @@ -1,9 +1,7 @@ package gregtech.api.util; import gregtech.api.capability.IMultipleTankHandler; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import it.unimi.dsi.fastutil.objects.Object2IntMap; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidActionResult; import net.minecraftforge.fluids.FluidStack; @@ -14,21 +12,28 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.objects.Object2IntMap; + import java.util.List; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class GTTransferUtils { public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler) { return transferFluids(sourceHandler, destHandler, Integer.MAX_VALUE, fluidStack -> true); } - public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler, int transferLimit) { + public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler, + int transferLimit) { return transferFluids(sourceHandler, destHandler, transferLimit, fluidStack -> true); } - public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler, int transferLimit, @Nonnull Predicate fluidFilter) { + public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler, + int transferLimit, @Nonnull Predicate fluidFilter) { int fluidLeftToTransfer = transferLimit; for (IFluidTankProperties tankProperties : sourceHandler.getTankProperties()) { @@ -60,7 +65,8 @@ public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull return transferLimit - fluidLeftToTransfer; } - public static boolean transferExactFluidStack(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler, FluidStack fluidStack) { + public static boolean transferExactFluidStack(@Nonnull IFluidHandler sourceHandler, + @Nonnull IFluidHandler destHandler, FluidStack fluidStack) { int amount = fluidStack.amount; FluidStack sourceFluid = sourceHandler.drain(fluidStack, false); if (sourceFluid == null || sourceFluid.amount != amount) { @@ -94,7 +100,8 @@ public static void moveInventoryItems(IItemHandler sourceInventory, IItemHandler /** * Simulates the insertion of items into a target inventory, then optionally performs the insertion. - *

+ *
+ *
* Simulating will not modify any of the input parameters. Insertion will either succeed completely, or fail * without modifying anything. * This method should be called with {@code simulate} {@code true} first, then {@code simulate} {@code false}, @@ -130,7 +137,8 @@ public static boolean addItemsToItemHandler(final IItemHandler handler, /** * Simulates the insertion of fluid into a target fluid handler, then optionally performs the insertion. - *

+ *
+ *
* Simulating will not modify any of the input parameters. Insertion will either succeed completely, or fail * without modifying anything. * This method should be called with {@code simulate} {@code true} first, then {@code simulate} {@code false}, @@ -217,15 +225,18 @@ public static ItemStack insertToEmpty(IItemHandler handler, ItemStack stack, boo } // TODO try to remove this one day - public static void fillInternalTankFromFluidContainer(IFluidHandler fluidHandler, IItemHandlerModifiable itemHandler, int inputSlot, int outputSlot) { + public static void fillInternalTankFromFluidContainer(IFluidHandler fluidHandler, + IItemHandlerModifiable itemHandler, int inputSlot, + int outputSlot) { ItemStack inputContainerStack = itemHandler.extractItem(inputSlot, 1, true); - FluidActionResult result = FluidUtil.tryEmptyContainer(inputContainerStack, fluidHandler, Integer.MAX_VALUE, null, false); + FluidActionResult result = FluidUtil.tryEmptyContainer(inputContainerStack, fluidHandler, Integer.MAX_VALUE, + null, false); if (result.isSuccess()) { ItemStack remainingItem = result.getResult(); if (ItemStack.areItemStacksEqual(inputContainerStack, remainingItem)) - return; //do not fill if item stacks match + return; // do not fill if item stacks match if (!remainingItem.isEmpty() && !itemHandler.insertItem(outputSlot, remainingItem, true).isEmpty()) - return; //do not fill if can't put remaining item + return; // do not fill if can't put remaining item FluidUtil.tryEmptyContainer(inputContainerStack, fluidHandler, Integer.MAX_VALUE, null, true); itemHandler.extractItem(inputSlot, 1, false); itemHandler.insertItem(outputSlot, remainingItem, false); diff --git a/src/main/java/gregtech/api/util/GTUtility.java b/src/main/java/gregtech/api/util/GTUtility.java index b5daa38c18c..2db721ce4af 100644 --- a/src/main/java/gregtech/api/util/GTUtility.java +++ b/src/main/java/gregtech/api/util/GTUtility.java @@ -1,6 +1,5 @@ package gregtech.api.util; -import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.block.machines.MachineItemBlock; @@ -18,7 +17,7 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.ore.OrePrefix; -import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; + import net.minecraft.block.BlockRedstoneWire; import net.minecraft.block.BlockSnow; import net.minecraft.block.material.MapColor; @@ -52,18 +51,22 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; + +import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.Map.Entry; import java.util.function.BooleanSupplier; import java.util.function.Function; import java.util.function.Predicate; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.V; public class GTUtility { @@ -76,8 +79,8 @@ public static String[] mapToString(T[] array, Function mapper) { return result; } - //just because CCL uses a different color format - //0xRRGGBBAA + // just because CCL uses a different color format + // 0xRRGGBBAA public static int convertRGBtoOpaqueRGBA_CL(int colorValue) { return convertRGBtoRGBA_CL(colorValue, 255); } @@ -90,7 +93,7 @@ public static int convertOpaqueRGBA_CLtoRGB(int colorAlpha) { return colorAlpha >>> 8; } - //0xAARRGGBB + // 0xAARRGGBB public static int convertRGBtoOpaqueRGBA_MC(int colorValue) { return convertRGBtoOpaqueRGBA_MC(colorValue, 255); } @@ -119,24 +122,25 @@ public static int convertRGBtoARGB(int colorValue, int opacity) { */ public static boolean mergeItemStack(ItemStack itemStack, List slots, boolean simulate) { if (itemStack.isEmpty()) - return false; //if we are merging empty stack, return + return false; // if we are merging empty stack, return boolean merged = false; - //iterate non-empty slots first - //to try to insert stack into them + // iterate non-empty slots first + // to try to insert stack into them for (Slot slot : slots) { if (!slot.isItemValid(itemStack)) - continue; //if itemstack cannot be placed into that slot, continue + continue; // if itemstack cannot be placed into that slot, continue ItemStack stackInSlot = slot.getStack(); if (!ItemStack.areItemsEqual(itemStack, stackInSlot) || !ItemStack.areItemStackTagsEqual(itemStack, stackInSlot)) - continue; //if itemstacks don't match, continue + continue; // if itemstacks don't match, continue int slotMaxStackSize = Math.min(stackInSlot.getMaxStackSize(), slot.getItemStackLimit(stackInSlot)); int amountToInsert = Math.min(itemStack.getCount(), slotMaxStackSize - stackInSlot.getCount()); - // Need to check <= 0 for the PA, which could have this value negative due to slot limits in the Machine Access Interface + // Need to check <= 0 for the PA, which could have this value negative due to slot limits in the Machine + // Access Interface if (amountToInsert <= 0) - continue; //if we can't insert anything, continue - //shrink our stack, grow slot's stack and mark slot as changed + continue; // if we can't insert anything, continue + // shrink our stack, grow slot's stack and mark slot as changed if (!simulate) { stackInSlot.grow(amountToInsert); } @@ -144,27 +148,27 @@ public static boolean mergeItemStack(ItemStack itemStack, List slots, bool slot.onSlotChanged(); merged = true; if (itemStack.isEmpty()) - return true; //if we inserted all items, return + return true; // if we inserted all items, return } - //then try to insert itemstack into empty slots - //breaking it into pieces if needed + // then try to insert itemstack into empty slots + // breaking it into pieces if needed for (Slot slot : slots) { if (!slot.isItemValid(itemStack)) - continue; //if itemstack cannot be placed into that slot, continue + continue; // if itemstack cannot be placed into that slot, continue if (slot.getHasStack()) - continue; //if slot contains something, continue + continue; // if slot contains something, continue int amountToInsert = Math.min(itemStack.getCount(), slot.getItemStackLimit(itemStack)); if (amountToInsert == 0) - continue; //if we can't insert anything, continue - //split our stack and put result in slot + continue; // if we can't insert anything, continue + // split our stack and put result in slot ItemStack stackInSlot = itemStack.splitStack(amountToInsert); if (!simulate) { slot.putStack(stackInSlot); } merged = true; if (itemStack.isEmpty()) - return true; //if we inserted all items, return + return true; // if we inserted all items, return } return merged; } @@ -202,7 +206,7 @@ public static void readItems(IItemHandlerModifiable handler, String tagName, NBT * @param array Array sorted with natural order * @param value Value to search for * @return Index of the nearest value lesser or equal than {@code value}, - * or {@code -1} if there's no entry matching the condition + * or {@code -1} if there's no entry matching the condition */ public static int nearestLesserOrEqual(@Nonnull long[] array, long value) { int low = 0, high = array.length - 1; @@ -222,7 +226,7 @@ public static int nearestLesserOrEqual(@Nonnull long[] array, long value) { * @param array Array sorted with natural order * @param value Value to search for * @return Index of the nearest value lesser than {@code value}, - * or {@code -1} if there's no entry matching the condition + * or {@code -1} if there's no entry matching the condition */ public static int nearestLesser(@Nonnull long[] array, long value) { int low = 0, high = array.length - 1; @@ -240,8 +244,8 @@ public static int nearestLesser(@Nonnull long[] array, long value) { /** * @return Lowest tier of the voltage that can handle {@code voltage}; that is, - * a voltage with value greater than equal than {@code voltage}. If there's no - * tier that can handle it, {@code MAX} is returned. + * a voltage with value greater than equal than {@code voltage}. If there's no + * tier that can handle it, {@code MAX} is returned. */ public static byte getTierByVoltage(long voltage) { return (byte) Math.min(GTValues.MAX, nearestLesser(V, voltage) + 1); @@ -251,7 +255,7 @@ public static byte getTierByVoltage(long voltage) { * Ex: This method turns both 1024 and 512 into HV. * * @return the highest voltage tier with value below or equal to {@code voltage}, or - * {@code ULV} if there's no tier below + * {@code ULV} if there's no tier below */ public static byte getFloorTierByVoltage(long voltage) { return (byte) Math.max(GTValues.ULV, nearestLesserOrEqual(V, voltage)); @@ -259,7 +263,8 @@ public static byte getFloorTierByVoltage(long voltage) { @SuppressWarnings("deprecation") public static BiomeDictionary.Type getBiomeTypeTagByName(String name) { - Map byName = ReflectionHelper.getPrivateValue(BiomeDictionary.Type.class, null, "byName"); + Map byName = ReflectionHelper.getPrivateValue(BiomeDictionary.Type.class, null, + "byName"); return byName.get(name); } @@ -370,10 +375,11 @@ public static EnumFacing getFacingToNeighbor(@NotNull BlockPos main, @NotNull Bl /** * @return a list of itemstack linked with given item handler - * modifications in list will reflect on item handler and wise-versa + * modifications in list will reflect on item handler and wise-versa */ public static List itemHandlerToList(IItemHandlerModifiable inputs) { return new AbstractList() { + @Override public ItemStack set(int index, ItemStack element) { ItemStack oldStack = inputs.getStackInSlot(index); @@ -395,11 +401,12 @@ public int size() { /** * @return a list of fluidstack linked with given fluid handler - * modifications in list will reflect on fluid handler and wise-versa + * modifications in list will reflect on fluid handler and wise-versa */ public static List fluidHandlerToList(IMultipleTankHandler fluidInputs) { List backedList = fluidInputs.getFluidTanks(); return new AbstractList() { + @Override public FluidStack set(int index, FluidStack element) { IFluidTank fluidTank = backedList.get(index).getDelegate(); @@ -533,7 +540,8 @@ public static boolean arePosEqual(BlockPos pos1, BlockPos pos2) { return pos1.getX() == pos2.getX() & pos1.getY() == pos2.getY() & pos1.getZ() == pos2.getZ(); } - public static boolean isCoverBehaviorItem(ItemStack itemStack, @Nullable BooleanSupplier hasCoverSupplier, @Nullable Predicate canPlaceCover) { + public static boolean isCoverBehaviorItem(ItemStack itemStack, @Nullable BooleanSupplier hasCoverSupplier, + @Nullable Predicate canPlaceCover) { Item item = itemStack.getItem(); if (item instanceof MetaItem) { MetaItem metaItem = (MetaItem) itemStack.getItem(); @@ -602,9 +610,11 @@ public static boolean isCoverBehaviorItem(ItemStack itemStack, @Nullable Boolean *

* This function is meant for use with generators */ - public static final Function steamGeneratorTankSizeFunction = tier -> Math.min(16000 * (1 << (tier - 1)), 64000); + public static final Function steamGeneratorTankSizeFunction = tier -> Math + .min(16000 * (1 << (tier - 1)), 64000); - public static final Function genericGeneratorTankSizeFunction = tier -> Math.min(4000 * (1 << (tier - 1)), 16000); + public static final Function genericGeneratorTankSizeFunction = tier -> Math + .min(4000 * (1 << (tier - 1)), 16000); public static ItemStack toItem(IBlockState state) { return toItem(state, 1); @@ -640,16 +650,18 @@ public static boolean isMachineValidForMachineHatch(ItemStack machineStack, Stri } /** - * Does almost the same thing as .to(LOWER_UNDERSCORE, string), but it also inserts underscores between words and numbers. + * Does almost the same thing as .to(LOWER_UNDERSCORE, string), but it also inserts underscores between words and + * numbers. * * @param string Any string with ASCII characters. - * @return A string that is all lowercase, with underscores inserted before word/number boundaries: "maragingSteel300" -> "maraging_steel_300" + * @return A string that is all lowercase, with underscores inserted before word/number boundaries: + * "maragingSteel300" -> "maraging_steel_300" */ public static String toLowerCaseUnderscore(String string) { StringBuilder result = new StringBuilder(); for (int i = 0; i < string.length(); i++) { - if (i != 0 && (Character.isUpperCase(string.charAt(i)) || ( - Character.isDigit(string.charAt(i - 1)) ^ Character.isDigit(string.charAt(i))))) + if (i != 0 && (Character.isUpperCase(string.charAt(i)) || + (Character.isDigit(string.charAt(i - 1)) ^ Character.isDigit(string.charAt(i))))) result.append("_"); result.append(Character.toLowerCase(string.charAt(i))); } @@ -657,10 +669,12 @@ public static String toLowerCaseUnderscore(String string) { } /** - * Does almost the same thing as LOWER_UNDERSCORE.to(UPPER_CAMEL, string), but it also removes underscores before numbers. + * Does almost the same thing as LOWER_UNDERSCORE.to(UPPER_CAMEL, string), but it also removes underscores before + * numbers. * * @param string Any string with ASCII characters. - * @return A string that is all lowercase, with underscores inserted before word/number boundaries: "maraging_steel_300" -> "maragingSteel300" + * @return A string that is all lowercase, with underscores inserted before word/number boundaries: + * "maraging_steel_300" -> "maragingSteel300" */ public static String lowerUnderscoreToUpperCamel(String string) { StringBuilder result = new StringBuilder(); @@ -749,7 +763,8 @@ public static boolean isBlockSnow(@Nonnull IBlockState blockState) { * * @return true if the passed IBlockState was valid snow block */ - public static boolean tryBreakSnow(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, boolean playSound) { + public static boolean tryBreakSnow(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, + boolean playSound) { boolean success = false; if (state.getBlock() == Blocks.SNOW) { world.setBlockState(pos, Blocks.SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, 7)); @@ -759,13 +774,15 @@ public static boolean tryBreakSnow(@Nonnull World world, @Nonnull BlockPos pos, if (layers == 1) { world.destroyBlock(pos, false); } else { - world.setBlockState(pos, Blocks.SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, layers - 1)); + world.setBlockState(pos, + Blocks.SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, layers - 1)); } success = true; } if (success && playSound) { - world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_LAVA_EXTINGUISH, + SoundCategory.BLOCKS, 1.0f, 1.0f); } return success; @@ -806,7 +823,8 @@ public static FluidStack getFluidFromContainer(Object ingredient) { return (FluidStack) ingredient; } else if (ingredient instanceof ItemStack) { ItemStack itemStack = (ItemStack) ingredient; - IFluidHandlerItem fluidHandler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandler = itemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandler != null) return fluidHandler.drain(Integer.MAX_VALUE, false); } diff --git a/src/main/java/gregtech/api/util/GradientUtil.java b/src/main/java/gregtech/api/util/GradientUtil.java index 35dba0b6665..def37c80c42 100644 --- a/src/main/java/gregtech/api/util/GradientUtil.java +++ b/src/main/java/gregtech/api/util/GradientUtil.java @@ -6,8 +6,7 @@ public class GradientUtil { - private GradientUtil() { - } + private GradientUtil() {} public static Pair getGradient(Color rgb, int luminanceDifference) { float[] hsl = RGBtoHSL(rgb); @@ -64,7 +63,7 @@ public static float[] RGBtoHSL(Color rgbColor) { s = (max - min) / (2 - max - min); } - return new float[] {h, s * 100, l * 100}; + return new float[] { h, s * 100, l * 100 }; } public static Color toRGB(float[] hsv) { @@ -109,10 +108,10 @@ private static float hueToRGB(float p, float q, float h) { return p + ((q - p) * 6 * h); } if (2 * h < 1) { - return q; + return q; } if (3 * h < 2) { - return p + ( (q - p) * 6 * ((2.0F / 3.0F) - h) ); + return p + ((q - p) * 6 * ((2.0F / 3.0F) - h)); } return p; } diff --git a/src/main/java/gregtech/api/util/GregFakePlayer.java b/src/main/java/gregtech/api/util/GregFakePlayer.java index fc903ccc85b..672f8be98dc 100644 --- a/src/main/java/gregtech/api/util/GregFakePlayer.java +++ b/src/main/java/gregtech/api/util/GregFakePlayer.java @@ -1,6 +1,5 @@ package gregtech.api.util; -import com.mojang.authlib.GameProfile; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -16,12 +15,15 @@ import net.minecraftforge.common.util.ITeleporter; import net.minecraftforge.fml.common.FMLCommonHandler; +import com.mojang.authlib.GameProfile; + import java.lang.ref.WeakReference; import java.util.UUID; public class GregFakePlayer extends EntityPlayer { - private static final GameProfile GREGTECH = new GameProfile(UUID.fromString("518FDF18-EC2A-4322-832A-58ED1721309B"), "[GregTech]"); + private static final GameProfile GREGTECH = new GameProfile(UUID.fromString("518FDF18-EC2A-4322-832A-58ED1721309B"), + "[GregTech]"); private static WeakReference GREGTECH_PLAYER = null; public static FakePlayer get(WorldServer world) { @@ -58,20 +60,16 @@ public boolean canUseCommand(int i, String s) { } @Override - public void sendStatusMessage(ITextComponent chatComponent, boolean actionBar) { - } + public void sendStatusMessage(ITextComponent chatComponent, boolean actionBar) {} @Override - public void sendMessage(ITextComponent component) { - } + public void sendMessage(ITextComponent component) {} @Override - public void addStat(StatBase par1StatBase, int par2) { - } + public void addStat(StatBase par1StatBase, int par2) {} @Override - public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) { - } + public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) {} @Override public boolean isEntityInvulnerable(DamageSource source) { @@ -100,5 +98,5 @@ public MinecraftServer getServer() { } @Override - protected void playEquipSound(ItemStack stack) { } + protected void playEquipSound(ItemStack stack) {} } diff --git a/src/main/java/gregtech/api/util/IBlockOre.java b/src/main/java/gregtech/api/util/IBlockOre.java index 5e3eb65b67c..936a31d3569 100644 --- a/src/main/java/gregtech/api/util/IBlockOre.java +++ b/src/main/java/gregtech/api/util/IBlockOre.java @@ -1,10 +1,10 @@ package gregtech.api.util; import gregtech.api.unification.ore.StoneType; + import net.minecraft.block.state.IBlockState; public interface IBlockOre { IBlockState getOreBlock(StoneType stoneType); - } diff --git a/src/main/java/gregtech/api/util/IDirtyNotifiable.java b/src/main/java/gregtech/api/util/IDirtyNotifiable.java index 98164a0b11c..cdb6b4299c9 100644 --- a/src/main/java/gregtech/api/util/IDirtyNotifiable.java +++ b/src/main/java/gregtech/api/util/IDirtyNotifiable.java @@ -1,5 +1,6 @@ package gregtech.api.util; public interface IDirtyNotifiable { + void markAsDirty(); } diff --git a/src/main/java/gregtech/api/util/IFluidTankPropertiesHashStrategy.java b/src/main/java/gregtech/api/util/IFluidTankPropertiesHashStrategy.java index d2124ee7ca8..ab6e355007f 100644 --- a/src/main/java/gregtech/api/util/IFluidTankPropertiesHashStrategy.java +++ b/src/main/java/gregtech/api/util/IFluidTankPropertiesHashStrategy.java @@ -1,16 +1,19 @@ package gregtech.api.util; -import it.unimi.dsi.fastutil.Hash; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.Hash; + import java.util.Objects; +import javax.annotation.Nonnull; + public interface IFluidTankPropertiesHashStrategy extends Hash.Strategy { @Nonnull static IFluidTankPropertiesHashStrategy create() { return new IFluidTankPropertiesHashStrategy() { + @Override public int hashCode(IFluidTankProperties o) { int result = 17; @@ -27,7 +30,6 @@ public boolean equals(IFluidTankProperties a, IFluidTankProperties b) { if (b == null || a.getClass() != b.getClass()) return false; return a.getCapacity() == b.getCapacity() && a.canFill() == b.canFill() && a.canDrain() == b.canDrain() && Objects.equals(a.getContents(), b.getContents()); - } }; } diff --git a/src/main/java/gregtech/api/util/ItemStackHashStrategy.java b/src/main/java/gregtech/api/util/ItemStackHashStrategy.java index d84e94bdc9d..69adc4575a3 100644 --- a/src/main/java/gregtech/api/util/ItemStackHashStrategy.java +++ b/src/main/java/gregtech/api/util/ItemStackHashStrategy.java @@ -1,16 +1,19 @@ package gregtech.api.util; -import it.unimi.dsi.fastutil.Hash; import net.minecraft.item.ItemStack; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.Hash; + import java.util.Objects; +import javax.annotation.Nullable; + /** * A configurable generator of hashing strategies, allowing for consideration of select properties of ItemStacks when * considering equality. */ public interface ItemStackHashStrategy extends Hash.Strategy { + /** * @return a builder object for producing a custom ItemStackHashStrategy. */ @@ -55,6 +58,7 @@ static ItemStackHashStrategy comparingItemDamageCount() { * Builder pattern class for generating customized ItemStackHashStrategy */ class ItemStackHashStrategyBuilder { + private boolean item, count, damage, tag; /** @@ -106,14 +110,14 @@ public ItemStackHashStrategyBuilder compareTag(boolean choice) { */ public ItemStackHashStrategy build() { return new ItemStackHashStrategy() { + @Override public int hashCode(@Nullable ItemStack o) { return o == null || o.isEmpty() ? 0 : Objects.hash( item ? o.getItem() : null, count ? o.getCount() : null, damage ? o.getItemDamage() : null, - tag ? o.getTagCompound() : null - ); + tag ? o.getTagCompound() : null); } @Override diff --git a/src/main/java/gregtech/api/util/LargeStackSizeItemStackHandler.java b/src/main/java/gregtech/api/util/LargeStackSizeItemStackHandler.java index ac5dd55c5c9..9c440fd7d03 100644 --- a/src/main/java/gregtech/api/util/LargeStackSizeItemStackHandler.java +++ b/src/main/java/gregtech/api/util/LargeStackSizeItemStackHandler.java @@ -28,7 +28,7 @@ public NBTTagCompound serializeNBT() { NBTTagCompound stackSizes = new NBTTagCompound(); NBTTagList items = tagCompound.getTagList(ITEM_LIST_TAG_KEY, 10); - //save big stack size data + // save big stack size data for (int i = 0; i < stacks.size(); i++) { ItemStack itemStack = stacks.get(i); @@ -38,7 +38,7 @@ public NBTTagCompound serializeNBT() { } tagCompound.setTag(BIG_STACK_SIZE_TAG_KEY, stackSizes); - //fix size overflow of existing item tags + // fix size overflow of existing item tags for (NBTBase itemBase : items) { NBTTagCompound item = (NBTTagCompound) itemBase; diff --git a/src/main/java/gregtech/api/util/LocalizationUtils.java b/src/main/java/gregtech/api/util/LocalizationUtils.java index e87d2437873..b4fd853c813 100644 --- a/src/main/java/gregtech/api/util/LocalizationUtils.java +++ b/src/main/java/gregtech/api/util/LocalizationUtils.java @@ -3,9 +3,10 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nonnull; import java.util.regex.Pattern; +import javax.annotation.Nonnull; + @SuppressWarnings("deprecation") public class LocalizationUtils { @@ -13,12 +14,16 @@ public class LocalizationUtils { /** * This function calls {@link net.minecraft.client.resources.I18n#format(String, Object...)} when called on client - * or {@link net.minecraft.util.text.translation.I18n#translateToLocalFormatted(String, Object...)} when called on server. + * or {@link net.minecraft.util.text.translation.I18n#translateToLocalFormatted(String, Object...)} when called on + * server. *

    - *
  • It is intended that translations should be done using {@link net.minecraft.client.resources.I18n} on the client.
  • - *
  • For setting up translations on the server you should use {@link net.minecraft.util.text.TextComponentTranslation}.
  • - *
  • {@code LocalizationUtils} is only for cases where some kind of translation is required on the server and there is no client/player in context.
  • - *
  • {@code LocalizationUtils} is "best effort" and will probably only work properly with {@code en-us}.
  • + *
  • It is intended that translations should be done using {@link net.minecraft.client.resources.I18n} on the + * client.
  • + *
  • For setting up translations on the server you should use + * {@link net.minecraft.util.text.TextComponentTranslation}.
  • + *
  • {@code LocalizationUtils} is only for cases where some kind of translation is required on the server and + * there is no client/player in context.
  • + *
  • {@code LocalizationUtils} is "best effort" and will probably only work properly with {@code en-us}.
  • *
* * @param key the localization key passed to the underlying hasKey function @@ -36,10 +41,13 @@ public static String format(String key, Object... format) { * This function calls {@link net.minecraft.client.resources.I18n#hasKey(String)} when called on client * or {@link net.minecraft.util.text.translation.I18n#canTranslate(String)} when called on server. *
    - *
  • It is intended that translations should be done using {@link net.minecraft.client.resources.I18n} on the client.
  • - *
  • For setting up translations on the server you should use {@link net.minecraft.util.text.TextComponentTranslation}.
  • - *
  • {@code LocalizationUtils} is only for cases where some kind of translation is required on the server and there is no client/player in context.
  • - *
  • {@code LocalizationUtils} is "best effort" and will probably only work properly with {@code en-us}.
  • + *
  • It is intended that translations should be done using {@link net.minecraft.client.resources.I18n} on the + * client.
  • + *
  • For setting up translations on the server you should use + * {@link net.minecraft.util.text.TextComponentTranslation}.
  • + *
  • {@code LocalizationUtils} is only for cases where some kind of translation is required on the server and + * there is no client/player in context.
  • + *
  • {@code LocalizationUtils} is "best effort" and will probably only work properly with {@code en-us}.
  • *
* * @param key the localization key passed to the underlying hasKey function diff --git a/src/main/java/gregtech/api/util/MCGuiUtil.java b/src/main/java/gregtech/api/util/MCGuiUtil.java index 3b75ddd7bdd..5a7e53549b2 100644 --- a/src/main/java/gregtech/api/util/MCGuiUtil.java +++ b/src/main/java/gregtech/api/util/MCGuiUtil.java @@ -2,24 +2,25 @@ import net.minecraft.client.gui.GuiPageButtonList.GuiResponder; -import javax.annotation.Nonnull; import java.util.function.Consumer; +import javax.annotation.Nonnull; + /** - * This class exists to avoid java always trying to load client classes when loading {@link gregtech.api.gui.widgets.TextFieldWidget}. + * This class exists to avoid java always trying to load client classes when loading + * {@link gregtech.api.gui.widgets.TextFieldWidget}. * Do not remove */ public class MCGuiUtil { public static GuiResponder createTextFieldResponder(Consumer onChanged) { return new GuiResponder() { + @Override - public void setEntryValue(int id, boolean value) { - } + public void setEntryValue(int id, boolean value) {} @Override - public void setEntryValue(int id, float value) { - } + public void setEntryValue(int id, float value) {} @Override public void setEntryValue(int id, @Nonnull String value) { @@ -27,6 +28,4 @@ public void setEntryValue(int id, @Nonnull String value) { } }; } - - } diff --git a/src/main/java/gregtech/api/util/ModCompatibility.java b/src/main/java/gregtech/api/util/ModCompatibility.java index df1f9900360..9881948147d 100644 --- a/src/main/java/gregtech/api/util/ModCompatibility.java +++ b/src/main/java/gregtech/api/util/ModCompatibility.java @@ -1,6 +1,7 @@ package gregtech.api.util; import gregtech.api.util.world.DummyWorld; + import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -36,11 +37,13 @@ public static ItemStack getRealItemStack(ItemStack itemStack) { } private static class RefinedStorage { + private final Method getPatternFromCacheMethod; private final Method getOutputsMethod; public RefinedStorage(Class itemPatternClass) throws ReflectiveOperationException { - this.getPatternFromCacheMethod = itemPatternClass.getMethod("getPatternFromCache", World.class, ItemStack.class); + this.getPatternFromCacheMethod = itemPatternClass.getMethod("getPatternFromCache", World.class, + ItemStack.class); this.getOutputsMethod = getPatternFromCacheMethod.getReturnType().getMethod("getOutputs"); } diff --git a/src/main/java/gregtech/api/util/OverlayedFluidHandler.java b/src/main/java/gregtech/api/util/OverlayedFluidHandler.java index 309371a0286..408117c3740 100644 --- a/src/main/java/gregtech/api/util/OverlayedFluidHandler.java +++ b/src/main/java/gregtech/api/util/OverlayedFluidHandler.java @@ -2,15 +2,17 @@ import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.capability.IMultipleTankHandler.MultiFluidTankEntry; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Simulates consecutive fills to {@link IMultipleTankHandler} instance. */ diff --git a/src/main/java/gregtech/api/util/OverlayedItemHandler.java b/src/main/java/gregtech/api/util/OverlayedItemHandler.java index f930d5359b0..af322e9bcf3 100644 --- a/src/main/java/gregtech/api/util/OverlayedItemHandler.java +++ b/src/main/java/gregtech/api/util/OverlayedItemHandler.java @@ -6,6 +6,7 @@ import javax.annotation.Nonnull; public class OverlayedItemHandler { + private final OverlayedItemHandlerSlot[] originalSlots; private final OverlayedItemHandlerSlot[] slots; private final IItemHandler overlayedHandler; @@ -38,7 +39,6 @@ public int getSlots() { * @param slot the slot to populate */ - private void initSlot(int slot) { if (this.originalSlots[slot] == null) { ItemStack stackToMirror = overlayedHandler.getStackInSlot(slot); @@ -48,17 +48,16 @@ private void initSlot(int slot) { } } - public int insertStackedItemStack(@Nonnull ItemStack stack, int amountToInsert) { int lastKnownPopulatedSlot = 0; - //loop through all slots, looking for ones matching the key + // loop through all slots, looking for ones matching the key for (int i = 0; i < this.slots.length; i++) { - //populate the slot if it's not already populated + // populate the slot if it's not already populated initSlot(i); // if it's the same item or there is no item in the slot ItemStack slotKey = this.slots[i].getItemStack(); if (slotKey.isEmpty() || ItemStackHashStrategy.comparingAllButCount().equals(slotKey, stack)) { - //if the slot is not full + // if the slot is not full int canInsertUpTo = this.slots[i].getSlotLimit() - this.slots[i].getCount(); if (canInsertUpTo > 0) { int insertedAmount = Math.min(canInsertUpTo, amountToInsert); @@ -77,10 +76,10 @@ public int insertStackedItemStack(@Nonnull ItemStack stack, int amountToInsert) // if the amountToInsert is still greater than 0, we need to insert it into a new slot if (amountToInsert > 0) { - //loop through all slots, starting from after the last seen slot with items in it, looking for empty ones. + // loop through all slots, starting from after the last seen slot with items in it, looking for empty ones. for (int i = lastKnownPopulatedSlot + 1; i < this.slots.length; i++) { OverlayedItemHandlerSlot slot = this.slots[i]; - //if the slot is empty + // if the slot is empty if (slot.getItemStack().isEmpty()) { int canInsertUpTo = Math.min(stack.getMaxStackSize(), slot.getSlotLimit()); if (canInsertUpTo > 0) { @@ -95,11 +94,12 @@ public int insertStackedItemStack(@Nonnull ItemStack stack, int amountToInsert) } } } - //return the amount that wasn't inserted + // return the amount that wasn't inserted return amountToInsert; } private static class OverlayedItemHandlerSlot { + private ItemStack itemStack = ItemStack.EMPTY; private int count = 0; private int slotLimit; @@ -130,6 +130,7 @@ public int getCount() { /** * Storage of this ItemStack elsewhere will require copying it + * * @return the stored ItemStack */ @Nonnull diff --git a/src/main/java/gregtech/api/util/ParticleHandlerUtil.java b/src/main/java/gregtech/api/util/ParticleHandlerUtil.java index b143c2b3ba9..a747455456c 100644 --- a/src/main/java/gregtech/api/util/ParticleHandlerUtil.java +++ b/src/main/java/gregtech/api/util/ParticleHandlerUtil.java @@ -1,10 +1,7 @@ package gregtech.api.util; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.particle.DigIconParticle; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Vector3; import gregtech.api.GTValues; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.ParticleManager; @@ -18,10 +15,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.particle.DigIconParticle; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Vector3; + @SideOnly(Side.CLIENT) public class ParticleHandlerUtil { - public static void addBlockRunningEffects(World worldObj, Entity entity, TextureAtlasSprite atlasSprite, int spriteColor) { + public static void addBlockRunningEffects(World worldObj, Entity entity, TextureAtlasSprite atlasSprite, + int spriteColor) { if (atlasSprite == null) return; double posX = entity.posX + (GTValues.RNG.nextFloat() - 0.5) * entity.width; double posY = entity.getEntityBoundingBox().minY + 0.1; @@ -32,12 +35,14 @@ public static void addBlockRunningEffects(World worldObj, Entity entity, Texture float green = (spriteColor >> 8 & 255) / 255.0F; float blue = (spriteColor & 255) / 255.0F; - DigIconParticle digIconParticle = new DigIconParticle(worldObj, posX, posY, posZ, -entity.motionX * 4.0, 1.5, -entity.motionZ * 4.0, atlasSprite); + DigIconParticle digIconParticle = new DigIconParticle(worldObj, posX, posY, posZ, -entity.motionX * 4.0, 1.5, + -entity.motionZ * 4.0, atlasSprite); digIconParticle.setRBGColorF(red, green, blue); manager.addEffect(digIconParticle); } - public static void addBlockLandingEffects(World worldObj, Vector3 entityPos, TextureAtlasSprite atlasSprite, int spriteColor, ParticleManager manager, int numParticles) { + public static void addBlockLandingEffects(World worldObj, Vector3 entityPos, TextureAtlasSprite atlasSprite, + int spriteColor, ParticleManager manager, int numParticles) { if (atlasSprite == null) return; Vector3 start = entityPos.copy(); Vector3 end = start.copy().add(Vector3.down.copy().multiply(4)); @@ -53,27 +58,34 @@ public static void addBlockLandingEffects(World worldObj, Vector3 entityPos, Tex double mX = GTValues.RNG.nextGaussian() * speed; double mY = GTValues.RNG.nextGaussian() * speed; double mZ = GTValues.RNG.nextGaussian() * speed; - DigIconParticle digIconParticle = DigIconParticle.newLandingParticle(worldObj, entityPos.x, entityPos.y, entityPos.z, mX, mY, mZ, atlasSprite); + DigIconParticle digIconParticle = DigIconParticle.newLandingParticle(worldObj, entityPos.x, entityPos.y, + entityPos.z, mX, mY, mZ, atlasSprite); digIconParticle.setRBGColorF(red, green, blue); manager.addEffect(digIconParticle); } } } - public static void addBlockDestroyEffects(World worldObj, CuboidRayTraceResult result, TextureAtlasSprite atlasSprite, int spriteColor, ParticleManager manager) { + public static void addBlockDestroyEffects(World worldObj, CuboidRayTraceResult result, + TextureAtlasSprite atlasSprite, int spriteColor, + ParticleManager manager) { addBlockDestroyEffects(worldObj, result.cuboid6, atlasSprite, spriteColor, manager); } - public static void addBlockDestroyEffects(IBlockState blockState, World worldObj, BlockPos blockPos, TextureAtlasSprite atlasSprite, int spriteColor, ParticleManager manager) { + public static void addBlockDestroyEffects(IBlockState blockState, World worldObj, BlockPos blockPos, + TextureAtlasSprite atlasSprite, int spriteColor, + ParticleManager manager) { Cuboid6 cuboid6 = new Cuboid6(blockState.getBoundingBox(worldObj, blockPos)).add(blockPos); addBlockDestroyEffects(worldObj, cuboid6, atlasSprite, spriteColor, manager); } - public static void addHitEffects(World worldObj, CuboidRayTraceResult result, TextureAtlasSprite atlasSprite, int spriteColor, ParticleManager manager) { + public static void addHitEffects(World worldObj, CuboidRayTraceResult result, TextureAtlasSprite atlasSprite, + int spriteColor, ParticleManager manager) { addBlockHitEffects(worldObj, result.cuboid6, result.sideHit, atlasSprite, spriteColor, manager); } - public static void addHitEffects(IBlockState blockState, World worldObj, RayTraceResult target, TextureAtlasSprite atlasSprite, int spriteColor, ParticleManager manager) { + public static void addHitEffects(IBlockState blockState, World worldObj, RayTraceResult target, + TextureAtlasSprite atlasSprite, int spriteColor, ParticleManager manager) { Cuboid6 cuboid6 = getBoundingBox(blockState, worldObj, target); addBlockHitEffects(worldObj, cuboid6, target.sideHit, atlasSprite, spriteColor, manager); } @@ -86,9 +98,10 @@ private static Cuboid6 getBoundingBox(IBlockState blockState, World world, RayTr return new Cuboid6(blockState.getBoundingBox(world, blockPos)).add(blockPos); } - //Straight copied from CustomParticleHandler with color parameter added + // Straight copied from CustomParticleHandler with color parameter added - public static void addBlockHitEffects(World world, Cuboid6 bounds, EnumFacing side, TextureAtlasSprite icon, int spriteColor, ParticleManager particleManager) { + public static void addBlockHitEffects(World world, Cuboid6 bounds, EnumFacing side, TextureAtlasSprite icon, + int spriteColor, ParticleManager particleManager) { if (icon == null) return; float border = 0.1F; Vector3 diff = bounds.max.copy().subtract(bounds.min).add(-2 * border); @@ -127,7 +140,8 @@ public static void addBlockHitEffects(World world, Cuboid6 bounds, EnumFacing si particleManager.addEffect(digIconParticle); } - public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAtlasSprite icon, int spriteColor, ParticleManager particleManager) { + public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAtlasSprite icon, int spriteColor, + ParticleManager particleManager) { if (icon == null) return; Vector3 diff = bounds.max.copy().subtract(bounds.min); Vector3 center = bounds.min.copy().add(bounds.max).multiply(0.5); @@ -143,7 +157,8 @@ public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAt double x = bounds.min.x + (i + 0.5) * diff.x / density.x; double y = bounds.min.y + (j + 0.5) * diff.y / density.y; double z = bounds.min.z + (k + 0.5) * diff.z / density.z; - DigIconParticle digIconParticle = new DigIconParticle(world, x, y, z, x - center.x, y - center.y, z - center.z, icon); + DigIconParticle digIconParticle = new DigIconParticle(world, x, y, z, x - center.x, y - center.y, + z - center.z, icon); digIconParticle.setRBGColorF(red, green, blue); particleManager.addEffect(digIconParticle); } diff --git a/src/main/java/gregtech/api/util/PerTickIntCounter.java b/src/main/java/gregtech/api/util/PerTickIntCounter.java index d2041074c4e..86e08839b72 100644 --- a/src/main/java/gregtech/api/util/PerTickIntCounter.java +++ b/src/main/java/gregtech/api/util/PerTickIntCounter.java @@ -21,11 +21,11 @@ private void checkValueState(World world) { long currentWorldTime = world.getTotalWorldTime(); if (currentWorldTime != lastUpdatedWorldTime) { if (currentWorldTime == lastUpdatedWorldTime + 1) { - //last updated time is 1 tick ago, so we can move current value to last - //before resetting it to default value + // last updated time is 1 tick ago, so we can move current value to last + // before resetting it to default value this.lastValue = currentValue; } else { - //otherwise, set last value as default value + // otherwise, set last value as default value this.lastValue = defaultValue; } this.lastUpdatedWorldTime = currentWorldTime; diff --git a/src/main/java/gregtech/api/util/PositionedRect.java b/src/main/java/gregtech/api/util/PositionedRect.java index d76cec88be6..a8a7fd50cc7 100644 --- a/src/main/java/gregtech/api/util/PositionedRect.java +++ b/src/main/java/gregtech/api/util/PositionedRect.java @@ -5,6 +5,7 @@ import java.util.Objects; public class PositionedRect { + public final Position position; public final Size size; diff --git a/src/main/java/gregtech/api/util/RandomPotionEffect.java b/src/main/java/gregtech/api/util/RandomPotionEffect.java index 1b0ba5e37d7..1724a2f1816 100644 --- a/src/main/java/gregtech/api/util/RandomPotionEffect.java +++ b/src/main/java/gregtech/api/util/RandomPotionEffect.java @@ -34,5 +34,4 @@ public int hashCode() { result = 31 * result + chance; return result; } - } diff --git a/src/main/java/gregtech/api/util/RedstoneUtil.java b/src/main/java/gregtech/api/util/RedstoneUtil.java index 3341f89af61..f952e29aec9 100644 --- a/src/main/java/gregtech/api/util/RedstoneUtil.java +++ b/src/main/java/gregtech/api/util/RedstoneUtil.java @@ -9,7 +9,8 @@ public class RedstoneUtil { * @param maxValue the max that the value can be * @param minValue the min that the value can be * @param isInverted whether to invert the logic of this method - * @return an int from 0 (value <= min) to 15 (value >= max) normally, with a ratio when the value is between min and max + * @return an int from 0 (value <= min) to 15 (value >= max) normally, with a ratio when the value is between min + * and max */ public static int computeRedstoneBetweenValues(int value, float maxValue, float minValue, boolean isInverted) { if (value >= maxValue) { @@ -37,7 +38,8 @@ public static int computeRedstoneBetweenValues(int value, float maxValue, float * @param output the output value the function modifies * @return returns the modified output value */ - public static int computeLatchedRedstoneBetweenValues(float value, float maxValue, float minValue, boolean isInverted, int output) { + public static int computeLatchedRedstoneBetweenValues(float value, float maxValue, float minValue, + boolean isInverted, int output) { if (value >= maxValue) { output = !isInverted ? 0 : 15; // value above maxValue should normally be 0, otherwise 15 } else if (value <= minValue) { diff --git a/src/main/java/gregtech/api/util/RelativeDirection.java b/src/main/java/gregtech/api/util/RelativeDirection.java index 8879e39da97..1e4b2102761 100644 --- a/src/main/java/gregtech/api/util/RelativeDirection.java +++ b/src/main/java/gregtech/api/util/RelativeDirection.java @@ -124,7 +124,8 @@ public Function getSorter(EnumFacing frontFacing, EnumFacing * * @return Returns the new upwards facing. */ - public static EnumFacing simulateAxisRotation(EnumFacing newFrontFacing, EnumFacing oldFrontFacing, EnumFacing upwardsFacing) { + public static EnumFacing simulateAxisRotation(EnumFacing newFrontFacing, EnumFacing oldFrontFacing, + EnumFacing upwardsFacing) { if (newFrontFacing == oldFrontFacing) return upwardsFacing; EnumFacing.Axis newAxis = newFrontFacing.getAxis(); @@ -141,7 +142,8 @@ public static EnumFacing simulateAxisRotation(EnumFacing newFrontFacing, EnumFac case EAST -> oldFrontFacing.rotateYCCW(); default -> oldFrontFacing.rotateY(); // WEST }; - return newFrontFacing == EnumFacing.DOWN && upwardsFacing.getAxis() == Axis.Z ? newUpwardsFacing.getOpposite() : newUpwardsFacing; + return newFrontFacing == EnumFacing.DOWN && upwardsFacing.getAxis() == Axis.Z ? + newUpwardsFacing.getOpposite() : newUpwardsFacing; } else if (newAxis != Axis.Y) { // going from vertical to horizontal axis EnumFacing newUpwardsFacing; @@ -154,7 +156,8 @@ public static EnumFacing simulateAxisRotation(EnumFacing newFrontFacing, EnumFac } else { // rotateYCCW newUpwardsFacing = EnumFacing.EAST; } - return oldFrontFacing == EnumFacing.DOWN && newUpwardsFacing.getAxis() == Axis.Z ? newUpwardsFacing.getOpposite() : newUpwardsFacing; + return oldFrontFacing == EnumFacing.DOWN && newUpwardsFacing.getAxis() == Axis.Z ? + newUpwardsFacing.getOpposite() : newUpwardsFacing; } else { // was on vertical axis and still is. Must have flipped from up to down or vice versa return upwardsFacing.getOpposite(); diff --git a/src/main/java/gregtech/api/util/TaskScheduler.java b/src/main/java/gregtech/api/util/TaskScheduler.java index 9b25eac1952..dfd28cf120d 100644 --- a/src/main/java/gregtech/api/util/TaskScheduler.java +++ b/src/main/java/gregtech/api/util/TaskScheduler.java @@ -2,18 +2,20 @@ import gregtech.api.GTValues; import gregtech.api.util.function.Task; + import net.minecraft.world.World; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.Nullable; + @EventBusSubscriber(modid = GTValues.MODID) public class TaskScheduler { diff --git a/src/main/java/gregtech/api/util/TeleportHandler.java b/src/main/java/gregtech/api/util/TeleportHandler.java index 83aba235b38..1a5d1f4fce3 100644 --- a/src/main/java/gregtech/api/util/TeleportHandler.java +++ b/src/main/java/gregtech/api/util/TeleportHandler.java @@ -8,12 +8,11 @@ import net.minecraftforge.common.util.ITeleporter; import net.minecraftforge.fml.common.FMLCommonHandler; -//Uses code from: -//github.com/CleanroomMC/Airlock/blob/master/src/main/java/com/cleanroommc/airlock/common/util/TeleportUtil.java +// Uses code from: +// github.com/CleanroomMC/Airlock/blob/master/src/main/java/com/cleanroommc/airlock/common/util/TeleportUtil.java public class TeleportHandler { - private TeleportHandler() { - } + private TeleportHandler() {} public static WorldServer getWorldByDimensionID(int id) { WorldServer world = DimensionManager.getWorld(id); @@ -53,7 +52,8 @@ public static void teleport(Entity teleporter, int dimension, BlockPos teleportT * @param teleportToY y position that the entity is teleporting to * @param teleportToZ z position that the entity is teleporting to */ - public static void teleport(Entity teleporter, int dimension, double teleportToX, double teleportToY, double teleportToZ) { + public static void teleport(Entity teleporter, int dimension, double teleportToX, double teleportToY, + double teleportToZ) { if (teleporter.world.isRemote || teleporter.isDead) { return; } @@ -85,7 +85,8 @@ public static void teleport(Entity teleporter, int dimension, double teleportToX * @param teleportToY y position that the entity is teleporting to * @param teleportToZ z position that the entity is teleporting to */ - public static void teleport(Entity teleporter, int dimension, ITeleporter customTeleporter, double teleportToX, double teleportToY, double teleportToZ) { + public static void teleport(Entity teleporter, int dimension, ITeleporter customTeleporter, double teleportToX, + double teleportToY, double teleportToZ) { if (teleporter.world.isRemote || teleporter.isDead) { return; } diff --git a/src/main/java/gregtech/api/util/TextFormattingUtil.java b/src/main/java/gregtech/api/util/TextFormattingUtil.java index d2e4ad4595a..00a1f5f0aea 100644 --- a/src/main/java/gregtech/api/util/TextFormattingUtil.java +++ b/src/main/java/gregtech/api/util/TextFormattingUtil.java @@ -26,7 +26,7 @@ public static String formatLongToCompactString(long value, int precision) { StringBuilder stb = new StringBuilder(); if (value < 0) { stb.append('-'); - //Long.MIN_VALUE == -Long.MIN_VALUE so we need an adjustment here + // Long.MIN_VALUE == -Long.MIN_VALUE so we need an adjustment here value = value == Long.MIN_VALUE ? Long.MAX_VALUE : -value; } @@ -61,8 +61,10 @@ public static String formatNumbers(Object number) { } /** - * Formats a string to multiple lines, attempting to place a new line at the closest space from "maxLength" characters away. - * @param toFormat the string to be formatted to multiple lines. + * Formats a string to multiple lines, attempting to place a new line at the closest space from "maxLength" + * characters away. + * + * @param toFormat the string to be formatted to multiple lines. * @param maxLength the length where a newline should be placed in the nearest space. * @return a string formatted with newlines. */ diff --git a/src/main/java/gregtech/api/util/ValidationResult.java b/src/main/java/gregtech/api/util/ValidationResult.java index d60b2740421..2441dd10c02 100644 --- a/src/main/java/gregtech/api/util/ValidationResult.java +++ b/src/main/java/gregtech/api/util/ValidationResult.java @@ -1,6 +1,7 @@ package gregtech.api.util; public class ValidationResult { + private final EnumValidationResult type; private final T result; diff --git a/src/main/java/gregtech/api/util/VirtualTankRegistry.java b/src/main/java/gregtech/api/util/VirtualTankRegistry.java index 70b44ab9ac1..5fb7b52f6b0 100644 --- a/src/main/java/gregtech/api/util/VirtualTankRegistry.java +++ b/src/main/java/gregtech/api/util/VirtualTankRegistry.java @@ -1,6 +1,7 @@ package gregtech.api.util; import gregtech.api.GTValues; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraft.world.storage.MapStorage; @@ -11,15 +12,16 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class VirtualTankRegistry extends WorldSavedData { - private static final int DEFAULT_CAPACITY = 64000; //64B + private static final int DEFAULT_CAPACITY = 64000; // 64B private static final String DATA_ID = GTValues.MODID + ".vtank_data"; protected static Map> tankMap = new HashMap<>(); @@ -36,7 +38,8 @@ public VirtualTankRegistry(String name) { /** * Retrieves a tank from the registry - * @param key The name of the tank + * + * @param key The name of the tank * @param uuid The uuid of the player the tank is private to, or null if the tank is public * @return The tank object */ @@ -46,7 +49,7 @@ public static IFluidTank getTank(String key, UUID uuid) { /** * @return the internal Map of tanks. - * Do not use to modify the map! + * Do not use to modify the map! */ public static Map> getTankMap() { return tankMap; @@ -54,8 +57,9 @@ public static Map> getTankMap() { /** * Retrieves a tank from the registry, creating it if it does not exist - * @param key The name of the tank - * @param uuid The uuid of the player the tank is private to, or null if the tank is public + * + * @param key The name of the tank + * @param uuid The uuid of the player the tank is private to, or null if the tank is public * @param capacity The initial capacity of the tank * @return The tank object */ @@ -67,8 +71,10 @@ public static IFluidTank getTankCreate(String key, UUID uuid, int capacity) { } /** - * Retrieves a tank from the registry, creating it with {@link #DEFAULT_CAPACITY the default capacity} if it does not exist - * @param key The name of the tank + * Retrieves a tank from the registry, creating it with {@link #DEFAULT_CAPACITY the default capacity} if it does + * not exist + * + * @param key The name of the tank * @param uuid The uuid of the player the tank is private to, or null if the tank is public * @return The tank object */ @@ -78,13 +84,15 @@ public static IFluidTank getTankCreate(String key, UUID uuid) { /** * Adds a tank to the registry - * @param key The name of the tank - * @param uuid The uuid of the player the tank is private to, or null if the tank is public + * + * @param key The name of the tank + * @param uuid The uuid of the player the tank is private to, or null if the tank is public * @param capacity The initial capacity of the tank */ public static void addTank(String key, UUID uuid, int capacity) { - if(tankMap.containsKey(uuid) && tankMap.get(uuid).containsKey(key)) { - GTLog.logger.warn("Overwriting virtual tank " + key + "/" + (uuid == null ? "null" :uuid.toString()) + ", this might cause fluid loss!"); + if (tankMap.containsKey(uuid) && tankMap.get(uuid).containsKey(key)) { + GTLog.logger.warn("Overwriting virtual tank " + key + "/" + (uuid == null ? "null" : uuid.toString()) + + ", this might cause fluid loss!"); } else if (!tankMap.containsKey(uuid)) { tankMap.put(uuid, new HashMap<>()); } @@ -93,7 +101,8 @@ public static void addTank(String key, UUID uuid, int capacity) { /** * Adds a tank to the registry with {@link #DEFAULT_CAPACITY the default capacity} - * @param key The name of the tank + * + * @param key The name of the tank * @param uuid The uuid of the player the tank is private to, or null if the tank is public */ public static void addTank(String key, UUID uuid) { @@ -102,8 +111,9 @@ public static void addTank(String key, UUID uuid) { /** * Removes a tank from the registry. Use with caution! - * @param key The name of the tank - * @param uuid The uuid of the player the tank is private to, or null if the tank is public + * + * @param key The name of the tank + * @param uuid The uuid of the player the tank is private to, or null if the tank is public * @param removeFluid Whether to remove the tank if it has fluid in it */ public static void delTank(String key, UUID uuid, boolean removeFluid) { @@ -115,7 +125,8 @@ public static void delTank(String key, UUID uuid, boolean removeFluid) { } } } else { - GTLog.logger.warn("Attempted to delete tank " + key + "/" + (uuid == null ? "null" :uuid.toString()) + ", which does not exist!"); + GTLog.logger.warn("Attempted to delete tank " + key + "/" + (uuid == null ? "null" : uuid.toString()) + + ", which does not exist!"); } } @@ -147,7 +158,8 @@ public void readFromNBT(NBTTagCompound nbt) { NBTTagCompound tankCompound = privateTanks.getCompoundTag(key); VirtualTankRegistry.addTank(key, uuid, tankCompound.getInteger("Capacity")); if (!tankCompound.hasKey("Empty")) { - VirtualTankRegistry.getTank(key, uuid).fill(FluidStack.loadFluidStackFromNBT(tankCompound), true); + VirtualTankRegistry.getTank(key, uuid).fill(FluidStack.loadFluidStackFromNBT(tankCompound), + true); } } } @@ -158,9 +170,9 @@ public void readFromNBT(NBTTagCompound nbt) { @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { compound.setTag("Private", new NBTTagCompound()); - tankMap.forEach( (uuid, map) -> { + tankMap.forEach((uuid, map) -> { NBTTagCompound mapCompound = new NBTTagCompound(); - map.forEach( (key, tank) -> { + map.forEach((key, tank) -> { if (tank.getFluid() != null || tank.getCapacity() != DEFAULT_CAPACITY) { NBTTagCompound tankCompound = new NBTTagCompound(); tankCompound.setInteger("Capacity", tank.getCapacity()); @@ -237,14 +249,15 @@ public FluidTankInfo getInfo() { @Override public IFluidTankProperties[] getTankProperties() { if (this.tankProperties == null) { - this.tankProperties = new IFluidTankProperties[]{ new VirtualTankProperties(this) }; + this.tankProperties = new IFluidTankProperties[] { new VirtualTankProperties(this) }; } return this.tankProperties; } @Override public int fill(FluidStack fluidStack, boolean doFill) { - if (fluidStack == null || fluidStack.amount <= 0 || (this.fluid != null && !fluidStack.isFluidEqual(this.fluid))) + if (fluidStack == null || fluidStack.amount <= 0 || + (this.fluid != null && !fluidStack.isFluidEqual(this.fluid))) return 0; int fillAmt = Math.min(fluidStack.amount, this.capacity - this.getFluidAmount()); diff --git a/src/main/java/gregtech/api/util/XSTR.java b/src/main/java/gregtech/api/util/XSTR.java index 9bce78e74ce..cea25a4ced5 100644 --- a/src/main/java/gregtech/api/util/XSTR.java +++ b/src/main/java/gregtech/api/util/XSTR.java @@ -1,4 +1,5 @@ package gregtech.api.util; + /** * A subclass of java.util.random that implements the Xorshift random number * generator @@ -18,10 +19,10 @@ * http://demesos.blogspot.com/2011/09/pseudo-random-number-generators.html * * @author Wilfried Elmenreich University of Klagenfurt/Lakeside Labs - * http://www.elmenreich.tk - *

- * This code is released under the GNU Lesser General Public License Version 3 - * http://www.gnu.org/licenses/lgpl-3.0.txt + * http://www.elmenreich.tk + *

+ * This code is released under the GNU Lesser General Public License Version 3 + * http://www.gnu.org/licenses/lgpl-3.0.txt */ import java.util.Random; @@ -36,12 +37,12 @@ public class XSTR extends Random { private static final long serialVersionUID = 6208727693524452904L; private long seed; - private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) + private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) /* - MODIFIED BY: Robotia - Modification: Implemented Random class seed generator + * MODIFIED BY: Robotia + * Modification: Implemented Random class seed generator */ /** @@ -53,13 +54,12 @@ public XSTR() { this(seedUniquifier() ^ System.nanoTime()); } - private static final AtomicLong seedUniquifier - = new AtomicLong(8682522807148012L); + private static final AtomicLong seedUniquifier = new AtomicLong(8682522807148012L); private static long seedUniquifier() { // L'Ecuyer, "Tables of Linear Congruential Generators of // Different Sizes and Good Lattice Structure", 1999 - for (; ; ) { + for (;;) { long current = seedUniquifier.get(); long next = current * 181783497276652981L; if (seedUniquifier.compareAndSet(current, next)) { @@ -160,7 +160,9 @@ synchronized public double nextGaussian() { * produced with (approximately) equal probability. The method * {@code nextInt(int bound)} is implemented by class {@code Random} as if * by: - *

 {@code
+     * 
+     * 
+     *  {@code
      * public int nextInt(int bound) {
      *   if (bound <= 0)
      *     throw new IllegalArgumentException("bound must be positive");
@@ -174,9 +176,11 @@ synchronized public double nextGaussian() {
      *       val = bits % bound;
      *   } while (bits - val + (bound-1) < 0);
      *   return val;
-     * }}
+ * }} + *
* - *

The hedge "approx + *

+ * The hedge "approx * imately" is used in the foregoing description only because the next * method is only approximately an unbiased source of independently chosen * bits. If it were a perfect source of randomly chosen bits, then the @@ -201,8 +205,8 @@ synchronized public double nextGaussian() { * * @param bound the upper bound (exclusive). Must be positive. * @return the next pseudorandom, uniformly distributed {@code int} value - * between zero (inclusive) and {@code bound} (exclusive) from this random - * number generator's sequence + * between zero (inclusive) and {@code bound} (exclusive) from this random + * number generator's sequence * @throws IllegalArgumentException if bound is not positive * @since 1.2 */ @@ -229,10 +233,9 @@ public long nextLong() { } public void nextBytes(byte[] bytes_arr) { - for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) + for (int iba = 0, lenba = bytes_arr.length; iba < lenba;) for (int rndba = nextInt(), - nba = Math.min(lenba - iba, Integer.SIZE / Byte.SIZE); - nba-- > 0; rndba >>= Byte.SIZE) + nba = Math.min(lenba - iba, Integer.SIZE / Byte.SIZE); nba-- > 0; rndba >>= Byte.SIZE) bytes_arr[iba++] = (byte) rndba; } } diff --git a/src/main/java/gregtech/api/util/function/FloatConsumer.java b/src/main/java/gregtech/api/util/function/FloatConsumer.java index 0fec67f89df..edd172332d7 100644 --- a/src/main/java/gregtech/api/util/function/FloatConsumer.java +++ b/src/main/java/gregtech/api/util/function/FloatConsumer.java @@ -4,5 +4,4 @@ public interface FloatConsumer { void apply(float value); - } diff --git a/src/main/java/gregtech/api/util/function/Task.java b/src/main/java/gregtech/api/util/function/Task.java index 906d1acab3d..d8a352542b3 100644 --- a/src/main/java/gregtech/api/util/function/Task.java +++ b/src/main/java/gregtech/api/util/function/Task.java @@ -9,5 +9,4 @@ public interface Task { * @return {@code true} if the task should be run again, otherwise {@code false} */ boolean run(); - } diff --git a/src/main/java/gregtech/api/util/function/TriConsumer.java b/src/main/java/gregtech/api/util/function/TriConsumer.java index c6787cfa328..7a240998797 100644 --- a/src/main/java/gregtech/api/util/function/TriConsumer.java +++ b/src/main/java/gregtech/api/util/function/TriConsumer.java @@ -2,5 +2,6 @@ @FunctionalInterface public interface TriConsumer { + void accept(T t, U u, S s); } diff --git a/src/main/java/gregtech/api/util/input/KeyBind.java b/src/main/java/gregtech/api/util/input/KeyBind.java index 1ef2edcfd9f..309a4d28c1c 100644 --- a/src/main/java/gregtech/api/util/input/KeyBind.java +++ b/src/main/java/gregtech/api/util/input/KeyBind.java @@ -1,8 +1,9 @@ package gregtech.api.util.input; import gregtech.api.GregTechAPI; -import gregtech.core.network.packets.PacketKeysPressed; import gregtech.api.util.GTLog; +import gregtech.core.network.packets.PacketKeysPressed; + import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; @@ -11,12 +12,12 @@ import net.minecraftforge.client.settings.KeyConflictContext; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.registry.ClientRegistry; - import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.MutablePair; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -152,5 +153,4 @@ public boolean isKeyDown(EntityPlayer player) { return pair != null && pair.right; } } - } diff --git a/src/main/java/gregtech/api/util/interpolate/Eases.java b/src/main/java/gregtech/api/util/interpolate/Eases.java index a631c47ab13..e3c3a7f4a0a 100644 --- a/src/main/java/gregtech/api/util/interpolate/Eases.java +++ b/src/main/java/gregtech/api/util/interpolate/Eases.java @@ -3,19 +3,23 @@ import org.jetbrains.annotations.ApiStatus; public enum Eases implements IEase { + LINEAR { + @Override public float getInterpolation(float t) { return t; } }, QUAD_IN { + @Override public float getInterpolation(float t) { return t * t; } }, QUAD_IN_OUT { + @Override public float getInterpolation(float t) { if (t <= 0.5f) return 2f * t * t; @@ -24,6 +28,7 @@ public float getInterpolation(float t) { } }, QUAD_OUT { + @Override public float getInterpolation(float t) { return -t * (t - 2); diff --git a/src/main/java/gregtech/api/util/interpolate/IEase.java b/src/main/java/gregtech/api/util/interpolate/IEase.java index 86ff5a06a46..8d7b511c841 100644 --- a/src/main/java/gregtech/api/util/interpolate/IEase.java +++ b/src/main/java/gregtech/api/util/interpolate/IEase.java @@ -1,12 +1,15 @@ package gregtech.api.util.interpolate; /** - * Object representation of an easing function.

+ * Object representation of an easing function. + *

* Easing functions describe numerical change rate of values, on a timescale of {@code 0 ~ 1}. + * * @see Eases */ @FunctionalInterface public interface IEase { + /** * Get change rate of values on specific time {@code t}. * diff --git a/src/main/java/gregtech/api/util/interpolate/Interpolator.java b/src/main/java/gregtech/api/util/interpolate/Interpolator.java index 2938d381f9c..676f8413538 100644 --- a/src/main/java/gregtech/api/util/interpolate/Interpolator.java +++ b/src/main/java/gregtech/api/util/interpolate/Interpolator.java @@ -5,6 +5,7 @@ import java.util.function.Consumer; public class Interpolator implements ITickable { + private final float from; private final float to; private final int duration; @@ -18,7 +19,8 @@ public Interpolator(float from, float to, int duration, IEase ease, Consumer interpolate, Consumer callback) { + public Interpolator(float from, float to, int duration, IEase ease, Consumer interpolate, + Consumer callback) { this.from = from; this.to = to; this.duration = duration; @@ -36,7 +38,7 @@ public Interpolator start() { return this; } - public boolean isFinish(){ + public boolean isFinish() { return tick == duration; } diff --git a/src/main/java/gregtech/api/util/interpolate/RGBInterpolator.java b/src/main/java/gregtech/api/util/interpolate/RGBInterpolator.java index d12a86c8dfc..356d8a98d53 100644 --- a/src/main/java/gregtech/api/util/interpolate/RGBInterpolator.java +++ b/src/main/java/gregtech/api/util/interpolate/RGBInterpolator.java @@ -1,9 +1,11 @@ package gregtech.api.util.interpolate; import gregtech.api.util.function.TriConsumer; + import net.minecraft.util.ITickable; public class RGBInterpolator implements ITickable { + private final int speed; private float r = 255; private float g = 0; @@ -12,7 +14,8 @@ public class RGBInterpolator implements ITickable { private final TriConsumer callback; private boolean isOn = false; - public RGBInterpolator(int speed, TriConsumer interpolate, TriConsumer callback) { + public RGBInterpolator(int speed, TriConsumer interpolate, + TriConsumer callback) { this.speed = speed; this.interpolate = interpolate; this.callback = callback; diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlob.java b/src/main/java/gregtech/api/util/oreglob/OreGlob.java index 0d3470faf1c..d9138e18da8 100644 --- a/src/main/java/gregtech/api/util/oreglob/OreGlob.java +++ b/src/main/java/gregtech/api/util/oreglob/OreGlob.java @@ -1,14 +1,17 @@ package gregtech.api.util.oreglob; import gregtech.api.unification.OreDictUnifier; + import net.minecraft.item.ItemStack; + import org.jetbrains.annotations.ApiStatus; -import javax.annotation.Nonnull; import java.util.List; import java.util.Set; import java.util.function.Function; +import javax.annotation.Nonnull; + /** * Glob-like string matcher language designed for ore dictionary matching. *

@@ -80,7 +83,7 @@ public final boolean matches(@Nonnull ItemStack stack) { } /** - * Visualize this instance with standard Minecraft text formatting. Two spaces (' ') will + * Visualize this instance with standard Minecraft text formatting. Two spaces (' ') will * be used as indentation. * * @return Formatted visualization diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java b/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java index adc4b760df6..bd617fa541b 100644 --- a/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java +++ b/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java @@ -1,11 +1,12 @@ package gregtech.api.util.oreglob; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; +import javax.annotation.Nonnull; + /** * Builder for OreGlob instance visualization. */ @@ -54,5 +55,4 @@ public List getLines() { finishLine(); return Collections.unmodifiableList(finishedLines); } - } diff --git a/src/main/java/gregtech/api/util/world/DummyChunkProvider.java b/src/main/java/gregtech/api/util/world/DummyChunkProvider.java index ddfb01ee396..71497bb8892 100644 --- a/src/main/java/gregtech/api/util/world/DummyChunkProvider.java +++ b/src/main/java/gregtech/api/util/world/DummyChunkProvider.java @@ -1,12 +1,13 @@ package gregtech.api.util.world; -import io.netty.util.collection.LongObjectHashMap; -import io.netty.util.collection.LongObjectMap; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; +import io.netty.util.collection.LongObjectHashMap; +import io.netty.util.collection.LongObjectMap; + import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/gregtech/api/util/world/DummySaveHandler.java b/src/main/java/gregtech/api/util/world/DummySaveHandler.java index 974a1e5a5d4..f4090b7b4ec 100644 --- a/src/main/java/gregtech/api/util/world/DummySaveHandler.java +++ b/src/main/java/gregtech/api/util/world/DummySaveHandler.java @@ -12,9 +12,10 @@ import net.minecraft.world.storage.ISaveHandler; import net.minecraft.world.storage.WorldInfo; +import java.io.File; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.io.File; public class DummySaveHandler implements ISaveHandler, IPlayerFileData, IChunkLoader { @@ -25,8 +26,7 @@ public WorldInfo loadWorldInfo() { } @Override - public void checkSessionLock() { - } + public void checkSessionLock() {} @Nonnull @Override @@ -40,7 +40,6 @@ public IPlayerFileData getPlayerNBTManager() { return this; } - @Nonnull @Override public TemplateManager getStructureTemplateManager() { @@ -48,12 +47,10 @@ public TemplateManager getStructureTemplateManager() { } @Override - public void saveWorldInfoWithPlayer(@Nonnull WorldInfo worldInformation, @Nonnull NBTTagCompound tagCompound) { - } + public void saveWorldInfoWithPlayer(@Nonnull WorldInfo worldInformation, @Nonnull NBTTagCompound tagCompound) {} @Override - public void saveWorldInfo(@Nonnull WorldInfo worldInformation) { - } + public void saveWorldInfo(@Nonnull WorldInfo worldInformation) {} @Nonnull @Override @@ -67,7 +64,6 @@ public File getMapFileFromName(@Nonnull String mapName) { return null; } - @Nullable @Override public Chunk loadChunk(@Nonnull World worldIn, int x, int z) { @@ -75,20 +71,16 @@ public Chunk loadChunk(@Nonnull World worldIn, int x, int z) { } @Override - public void saveChunk(@Nonnull World worldIn, @Nonnull Chunk chunkIn) { - } + public void saveChunk(@Nonnull World worldIn, @Nonnull Chunk chunkIn) {} @Override - public void saveExtraChunkData(@Nonnull World worldIn, @Nonnull Chunk chunkIn) { - } + public void saveExtraChunkData(@Nonnull World worldIn, @Nonnull Chunk chunkIn) {} @Override - public void chunkTick() { - } + public void chunkTick() {} @Override - public void flush() { - } + public void flush() {} @Override public boolean isChunkGeneratedAt(int x, int z) { @@ -96,8 +88,7 @@ public boolean isChunkGeneratedAt(int x, int z) { } @Override - public void writePlayerData(@Nonnull EntityPlayer player) { - } + public void writePlayerData(@Nonnull EntityPlayer player) {} @Nullable @Override diff --git a/src/main/java/gregtech/api/util/world/DummyWorld.java b/src/main/java/gregtech/api/util/world/DummyWorld.java index c34e122cd3d..c59234e5141 100644 --- a/src/main/java/gregtech/api/util/world/DummyWorld.java +++ b/src/main/java/gregtech/api/util/world/DummyWorld.java @@ -23,7 +23,8 @@ public class DummyWorld extends World { public static final DummyWorld INSTANCE = new DummyWorld(); public DummyWorld() { - super(new DummySaveHandler(), new WorldInfo(DEFAULT_SETTINGS, "DummyServer"), new WorldProviderSurface(), new Profiler(), false); + super(new DummySaveHandler(), new WorldInfo(DEFAULT_SETTINGS, "DummyServer"), new WorldProviderSurface(), + new Profiler(), false); // Guarantee the dimension ID was not reset by the provider this.provider.setDimension(Integer.MAX_VALUE); int providerDim = this.provider.getDimension(); @@ -40,39 +41,38 @@ public DummyWorld() { @Override public void notifyNeighborsRespectDebug(@Nonnull BlockPos pos, @Nonnull Block blockType, boolean p_175722_3_) { - //NOOP - do not trigger forge events + // NOOP - do not trigger forge events } @Override public void notifyNeighborsOfStateChange(@Nonnull BlockPos pos, @Nonnull Block blockType, boolean updateObservers) { - //NOOP - do not trigger forge events + // NOOP - do not trigger forge events } @Override - public void notifyNeighborsOfStateExcept(@Nonnull BlockPos pos, @Nonnull Block blockType, @Nonnull EnumFacing skipSide) { - //NOOP - do not trigger forge events + public void notifyNeighborsOfStateExcept(@Nonnull BlockPos pos, @Nonnull Block blockType, + @Nonnull EnumFacing skipSide) { + // NOOP - do not trigger forge events } @Override - public void markAndNotifyBlock(@Nonnull BlockPos pos, @Nullable Chunk chunk, @Nonnull IBlockState iblockstate, @Nonnull IBlockState newState, int flags) { - //NOOP - do not trigger forge events + public void markAndNotifyBlock(@Nonnull BlockPos pos, @Nullable Chunk chunk, @Nonnull IBlockState iblockstate, + @Nonnull IBlockState newState, int flags) { + // NOOP - do not trigger forge events } @Override - public void notifyBlockUpdate(@Nonnull BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState, int flags) { - } + public void notifyBlockUpdate(@Nonnull BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState, + int flags) {} @Override - public void markBlockRangeForRenderUpdate(@Nonnull BlockPos rangeMin, @Nonnull BlockPos rangeMax) { - } + public void markBlockRangeForRenderUpdate(@Nonnull BlockPos rangeMin, @Nonnull BlockPos rangeMax) {} @Override - public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) { - } + public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) {} @Override - public void updateObservingBlocksAt(@Nonnull BlockPos pos, @Nonnull Block blockType) { - } + public void updateObservingBlocksAt(@Nonnull BlockPos pos, @Nonnull Block blockType) {} @Nonnull @Override diff --git a/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinHandler.java b/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinHandler.java index ea12d93dc30..377838891ef 100644 --- a/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinHandler.java +++ b/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinHandler.java @@ -7,6 +7,7 @@ import gregtech.api.util.XSTR; import gregtech.api.worldgen.config.BedrockFluidDepositDefinition; import gregtech.core.network.packets.PacketFluidVeinList; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -16,13 +17,14 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Random; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class BedrockFluidVeinHandler { public final static LinkedHashMap veinList = new LinkedHashMap<>(); @@ -36,7 +38,6 @@ public class BedrockFluidVeinHandler { */ public static int saveDataVersion; - public static final int MAX_FLUID_SAVE_DATA_VERSION = 2; public static final int VEIN_CHUNK_SIZE = 8; // veins are 8x8 chunk squares @@ -56,7 +57,8 @@ public static FluidVeinWorldEntry getFluidVeinWorldEntry(@Nonnull World world, i if (world.isRemote) return null; - ChunkPosDimension coords = new ChunkPosDimension(world.provider.getDimension(), getVeinCoord(chunkX), getVeinCoord(chunkZ)); + ChunkPosDimension coords = new ChunkPosDimension(world.provider.getDimension(), getVeinCoord(chunkX), + getVeinCoord(chunkZ)); FluidVeinWorldEntry worldEntry = veinCache.get(coords); if (worldEntry == null) { @@ -87,7 +89,8 @@ public static FluidVeinWorldEntry getFluidVeinWorldEntry(@Nonnull World world, i if (definition.getMaximumYield() - definition.getMinimumYield() <= 0) { maximumYield = definition.getMinimumYield(); } else { - maximumYield = random.nextInt(definition.getMaximumYield() - definition.getMinimumYield()) + definition.getMinimumYield(); + maximumYield = random.nextInt(definition.getMaximumYield() - definition.getMinimumYield()) + + definition.getMinimumYield(); } maximumYield = Math.min(maximumYield, definition.getMaximumYield()); } @@ -147,7 +150,8 @@ public static void recalculateChances(boolean mutePackets) { totalWeightMap.clear(); if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && !mutePackets) { HashMap packetMap = new HashMap<>(); - for (Map.Entry entry : BedrockFluidVeinHandler.veinCache.entrySet()) { + for (Map.Entry entry : BedrockFluidVeinHandler.veinCache + .entrySet()) { if (entry.getKey() != null && entry.getValue() != null) packetMap.put(entry.getValue(), entry.getValue().getDefinition().getWeight()); } @@ -250,6 +254,7 @@ public static int getVeinCoord(int chunkCoord) { } public static class FluidVeinWorldEntry { + private BedrockFluidDepositDefinition vein; private int fluidYield; private int operationsRemaining; @@ -260,9 +265,7 @@ public FluidVeinWorldEntry(BedrockFluidDepositDefinition vein, int fluidYield, i this.operationsRemaining = operationsRemaining; } - private FluidVeinWorldEntry() { - - } + private FluidVeinWorldEntry() {} public BedrockFluidDepositDefinition getDefinition() { return this.vein; diff --git a/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinSaveData.java b/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinSaveData.java index 2dfd92ff3c4..40d1e7539d2 100644 --- a/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinSaveData.java +++ b/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinSaveData.java @@ -1,15 +1,17 @@ package gregtech.api.worldgen.bedrockFluids; import gregtech.api.GTValues; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.storage.WorldSavedData; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nonnull; import java.util.Map; +import javax.annotation.Nonnull; + public class BedrockFluidVeinSaveData extends WorldSavedData { private static BedrockFluidVeinSaveData INSTANCE; @@ -27,7 +29,8 @@ public void readFromNBT(NBTTagCompound nbt) { NBTTagCompound tag = veinList.getCompoundTagAt(i); ChunkPosDimension coords = ChunkPosDimension.readFromNBT(tag); if (coords != null) { - BedrockFluidVeinHandler.FluidVeinWorldEntry info = BedrockFluidVeinHandler.FluidVeinWorldEntry.readFromNBT(tag.getCompoundTag("info")); + BedrockFluidVeinHandler.FluidVeinWorldEntry info = BedrockFluidVeinHandler.FluidVeinWorldEntry + .readFromNBT(tag.getCompoundTag("info")); BedrockFluidVeinHandler.veinCache.put(coords, info); } } @@ -44,10 +47,10 @@ public void readFromNBT(NBTTagCompound nbt) { } @Override - public @Nonnull - NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) { + public @Nonnull NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) { NBTTagList oilList = new NBTTagList(); - for (Map.Entry e : BedrockFluidVeinHandler.veinCache.entrySet()) { + for (Map.Entry e : BedrockFluidVeinHandler.veinCache + .entrySet()) { if (e.getKey() != null && e.getValue() != null) { NBTTagCompound tag = e.getKey().writeToNBT(); tag.setTag("info", e.getValue().writeToNBT()); @@ -60,7 +63,6 @@ NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) { return nbt; } - public static void setDirty() { if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && INSTANCE != null) INSTANCE.markDirty(); diff --git a/src/main/java/gregtech/api/worldgen/bedrockFluids/ChunkPosDimension.java b/src/main/java/gregtech/api/worldgen/bedrockFluids/ChunkPosDimension.java index 3f24a0d3829..2527ede40bb 100644 --- a/src/main/java/gregtech/api/worldgen/bedrockFluids/ChunkPosDimension.java +++ b/src/main/java/gregtech/api/worldgen/bedrockFluids/ChunkPosDimension.java @@ -6,6 +6,7 @@ import javax.annotation.Nonnull; public class ChunkPosDimension extends ChunkPos { + public int dimension; public ChunkPosDimension(int dimension, int x, int z) { diff --git a/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java b/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java index 0fd7ad18398..e7e199e4c9e 100644 --- a/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java +++ b/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java @@ -1,18 +1,21 @@ package gregtech.api.worldgen.config; -import com.google.gson.JsonObject; import gregtech.api.util.GTLog; import gregtech.api.util.LocalizationUtils; import gregtech.api.worldgen.bedrockFluids.BedrockFluidVeinHandler; + import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.Biome; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; -import javax.annotation.Nonnull; +import com.google.gson.JsonObject; + import java.util.function.Function; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class BedrockFluidDepositDefinition implements IWorldgenDefinition { private final String depositName; @@ -27,8 +30,10 @@ public class BedrockFluidDepositDefinition implements IWorldgenDefinition { private Fluid storedFluid; // the fluid which the vein contains - private Function biomeWeightModifier = OreDepositDefinition.NO_BIOME_INFLUENCE; // weighting of biomes - private Predicate dimensionFilter = OreDepositDefinition.PREDICATE_SURFACE_WORLD; // filtering of dimensions + private Function biomeWeightModifier = OreDepositDefinition.NO_BIOME_INFLUENCE; // weighting of + // biomes + private Predicate dimensionFilter = OreDepositDefinition.PREDICATE_SURFACE_WORLD; // filtering of + // dimensions public BedrockFluidDepositDefinition(String depositName) { this.depositName = depositName; @@ -44,14 +49,16 @@ public boolean initializeFromConfig(@Nonnull JsonObject configRoot) { // amount of fluid the vein gets depleted by this.depletionAmount = configRoot.get("depletion").getAsJsonObject().get("amount").getAsInt(); // the chance [0, 100] that the vein will deplete by depletionAmount - this.depletionChance = Math.max(0, Math.min(100, configRoot.get("depletion").getAsJsonObject().get("chance").getAsInt())); + this.depletionChance = Math.max(0, + Math.min(100, configRoot.get("depletion").getAsJsonObject().get("chance").getAsInt())); // the fluid which the vein contains Fluid fluid = FluidRegistry.getFluid(configRoot.get("fluid").getAsString()); if (fluid != null) { this.storedFluid = fluid; } else { - GTLog.logger.error("Bedrock Fluid Vein {} cannot have a null fluid!", this.depositName, new RuntimeException()); + GTLog.logger.error("Bedrock Fluid Vein {} cannot have a null fluid!", this.depositName, + new RuntimeException()); return false; } // vein name for JEI display @@ -156,21 +163,25 @@ public boolean equals(Object obj) { return false; if ((this.assignedName == null && objDeposit.getAssignedName() != null) || (this.assignedName != null && objDeposit.getAssignedName() == null) || - (this.assignedName != null && objDeposit.getAssignedName() != null && !this.assignedName.equals(objDeposit.getAssignedName()))) + (this.assignedName != null && objDeposit.getAssignedName() != null && + !this.assignedName.equals(objDeposit.getAssignedName()))) return false; if ((this.description == null && objDeposit.getDescription() != null) || (this.description != null && objDeposit.getDescription() == null) || - (this.description != null && objDeposit.getDescription() != null && !this.description.equals(objDeposit.getDescription()))) + (this.description != null && objDeposit.getDescription() != null && + !this.description.equals(objDeposit.getDescription()))) return false; if (this.depletedYield != objDeposit.getDepletedYield()) return false; if ((this.biomeWeightModifier == null && objDeposit.getBiomeWeightModifier() != null) || (this.biomeWeightModifier != null && objDeposit.getBiomeWeightModifier() == null) || - (this.biomeWeightModifier != null && objDeposit.getBiomeWeightModifier() != null && !this.biomeWeightModifier.equals(objDeposit.getBiomeWeightModifier()))) + (this.biomeWeightModifier != null && objDeposit.getBiomeWeightModifier() != null && + !this.biomeWeightModifier.equals(objDeposit.getBiomeWeightModifier()))) return false; if ((this.dimensionFilter == null && objDeposit.getDimensionFilter() != null) || (this.dimensionFilter != null && objDeposit.getDimensionFilter() == null) || - (this.dimensionFilter != null && objDeposit.getDimensionFilter() != null && !this.dimensionFilter.equals(objDeposit.getDimensionFilter()))) + (this.dimensionFilter != null && objDeposit.getDimensionFilter() != null && + !this.dimensionFilter.equals(objDeposit.getDimensionFilter()))) return false; return super.equals(obj); diff --git a/src/main/java/gregtech/api/worldgen/config/FillerConfigUtils.java b/src/main/java/gregtech/api/worldgen/config/FillerConfigUtils.java index fb1370300e6..f8cbb3b69d4 100644 --- a/src/main/java/gregtech/api/worldgen/config/FillerConfigUtils.java +++ b/src/main/java/gregtech/api/worldgen/config/FillerConfigUtils.java @@ -1,17 +1,11 @@ package gregtech.api.worldgen.config; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; import gregtech.api.unification.ore.StoneType; import gregtech.api.unification.ore.StoneTypes; import gregtech.api.util.GTUtility; import gregtech.api.util.WorldBlockPredicate; import gregtech.api.worldgen.filler.FillerEntry; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -19,6 +13,14 @@ import net.minecraft.world.IBlockAccess; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; import org.apache.commons.lang3.tuple.Pair; import java.util.*; @@ -83,9 +85,11 @@ private static FillerEntry createStateMatchFiller(JsonObject object) { ArrayList> matchers = new ArrayList<>(); for (JsonElement valueDefinition : valuesArray) { - Preconditions.checkArgument(valueDefinition.isJsonObject(), "Found invalid value definition: %s", valueDefinition.toString()); + Preconditions.checkArgument(valueDefinition.isJsonObject(), "Found invalid value definition: %s", + valueDefinition.toString()); JsonObject valueObject = valueDefinition.getAsJsonObject(); - WorldBlockPredicate predicate = PredicateConfigUtils.createBlockStatePredicate(valueObject.get("predicate")); + WorldBlockPredicate predicate = PredicateConfigUtils + .createBlockStatePredicate(valueObject.get("predicate")); FillerEntry filler = createBlockStateFiller(valueObject.get("value")); matchers.add(Pair.of(predicate, filler)); } @@ -119,14 +123,14 @@ private static FillerEntry createWeightRandomStateFiller(JsonObject object) { public static LayeredFillerEntry createLayeredFiller(JsonObject object) { JsonArray values = object.get("values").getAsJsonArray(); - Preconditions.checkArgument(values.size() == 4, "Invalid number of ores in a Layered vein (should be 4, is actually %d", values.size()); + Preconditions.checkArgument(values.size() == 4, + "Invalid number of ores in a Layered vein (should be 4, is actually %d", values.size()); return new LayeredFillerEntry( readLayerFiller(values.get(0).getAsJsonObject(), "primary"), readLayerFiller(values.get(1).getAsJsonObject(), "secondary"), readLayerFiller(values.get(2).getAsJsonObject(), "between"), - createBlockStateFiller(values.get(3).getAsJsonObject().get("sporadic")) - ); + createBlockStateFiller(values.get(3).getAsJsonObject().get("sporadic"))); } private static Pair readLayerFiller(JsonObject object, String layerType) { @@ -147,7 +151,8 @@ private static class OreFilterEntry implements FillerEntry { public OreFilterEntry(Map blockStateMap) { this.blockStateMap = blockStateMap; - this.defaultValue = blockStateMap.containsKey(StoneTypes.STONE) ? StoneTypes.STONE : blockStateMap.keySet().iterator().next(); + this.defaultValue = blockStateMap.containsKey(StoneTypes.STONE) ? StoneTypes.STONE : + blockStateMap.keySet().iterator().next(); this.allowedStates = ImmutableSet.copyOf(blockStateMap.values()); } @@ -243,7 +248,8 @@ public static class LayeredFillerEntry implements FillerEntry { private final ImmutableList blockStates; - public LayeredFillerEntry(Pair primary, Pair secondary, Pair between, FillerEntry sporadic) { + public LayeredFillerEntry(Pair primary, Pair secondary, + Pair between, FillerEntry sporadic) { this.primary = primary.getLeft(); this.secondary = secondary.getLeft(); this.between = between.getLeft(); @@ -275,7 +281,8 @@ public IBlockState apply(IBlockState source, IBlockAccess blockAccess, BlockPos return apply(source, blockAccess, blockPos, 1.0, new Random(), 0); } - public IBlockState apply(IBlockState source, IBlockAccess blockAccess, BlockPos blockPos, double density, Random random, int layer) { + public IBlockState apply(IBlockState source, IBlockAccess blockAccess, BlockPos blockPos, double density, + Random random, int layer) { // First try to spawn "between" if (layer >= startBetween && layer - startBetween + 1 <= betweenLayers) { if (random.nextFloat() <= density / 2) { diff --git a/src/main/java/gregtech/api/worldgen/config/IWorldgenDefinition.java b/src/main/java/gregtech/api/worldgen/config/IWorldgenDefinition.java index 4a7765ec4fc..b401ae97d34 100644 --- a/src/main/java/gregtech/api/worldgen/config/IWorldgenDefinition.java +++ b/src/main/java/gregtech/api/worldgen/config/IWorldgenDefinition.java @@ -6,7 +6,7 @@ public interface IWorldgenDefinition { - //This is the file name + // This is the file name /** * Must be converted using {@link gregtech.api.util.FileUtility#slashToNativeSep(String)} * before it can be used as a file path diff --git a/src/main/java/gregtech/api/worldgen/config/OreConfigUtils.java b/src/main/java/gregtech/api/worldgen/config/OreConfigUtils.java index b0fc836d83b..7e604d891e6 100644 --- a/src/main/java/gregtech/api/worldgen/config/OreConfigUtils.java +++ b/src/main/java/gregtech/api/worldgen/config/OreConfigUtils.java @@ -1,8 +1,5 @@ package gregtech.api.worldgen.config; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.GregTechAPI; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; @@ -10,6 +7,7 @@ import gregtech.api.unification.ore.StoneType; import gregtech.common.blocks.BlockOre; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -17,13 +15,18 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry; -import javax.annotation.Nonnull; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class OreConfigUtils { @SuppressWarnings("deprecation") @@ -93,15 +96,15 @@ public static int[] getIntRange(JsonElement element) { JsonArray dataArray = element.getAsJsonArray(); int max = dataArray.get(1).getAsInt(); int min = Math.min(max, dataArray.get(0).getAsInt()); - return new int[]{min, max}; + return new int[] { min, max }; } else if (element.isJsonObject()) { JsonObject dataObject = element.getAsJsonObject(); int max = dataObject.get("max").getAsInt(); int min = Math.min(max, dataObject.get("min").getAsInt()); - return new int[]{min, max}; + return new int[] { min, max }; } else if (element.isJsonPrimitive()) { int size = element.getAsInt(); - return new int[]{size, size}; + return new int[] { size, size }; } else { throw new IllegalArgumentException("size range not defined"); } diff --git a/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java b/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java index dd1da1463f2..efdc8e8f8ee 100644 --- a/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java +++ b/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java @@ -1,24 +1,28 @@ package gregtech.api.worldgen.config; -import com.google.gson.JsonObject; import gregtech.api.unification.ore.StoneType; import gregtech.api.util.LocalizationUtils; import gregtech.api.util.WorldBlockPredicate; import gregtech.api.worldgen.filler.BlockFiller; import gregtech.api.worldgen.populator.IVeinPopulator; import gregtech.api.worldgen.shape.ShapeGenerator; + import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.Biome; -import javax.annotation.Nonnull; +import com.google.gson.JsonObject; + import java.util.function.Function; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class OreDepositDefinition implements IWorldgenDefinition { public static final Function NO_BIOME_INFLUENCE = biome -> 0; public static final Predicate PREDICATE_SURFACE_WORLD = WorldProvider::isSurfaceWorld; - public static final WorldBlockPredicate PREDICATE_STONE_TYPE = (state, world, pos) -> StoneType.computeStoneType(state, world, pos) != null; + public static final WorldBlockPredicate PREDICATE_STONE_TYPE = (state, world, pos) -> StoneType + .computeStoneType(state, world, pos) != null; private final String depositName; @@ -27,7 +31,7 @@ public class OreDepositDefinition implements IWorldgenDefinition { private float density; private String assignedName; private String description; - private final int[] heightLimit = new int[]{Integer.MIN_VALUE, Integer.MAX_VALUE}; + private final int[] heightLimit = new int[] { Integer.MIN_VALUE, Integer.MAX_VALUE }; private boolean countAsVein = true; private Function biomeWeightModifier = NO_BIOME_INFLUENCE; @@ -71,14 +75,16 @@ public boolean initializeFromConfig(@Nonnull JsonObject configRoot) { this.dimensionFilter = WorldConfigUtils.createWorldPredicate(configRoot.get("dimension_filter")); } if (configRoot.has("generation_predicate")) { - this.generationPredicate = PredicateConfigUtils.createBlockStatePredicate(configRoot.get("generation_predicate")); + this.generationPredicate = PredicateConfigUtils + .createBlockStatePredicate(configRoot.get("generation_predicate")); } if (configRoot.has("vein_populator")) { JsonObject object = configRoot.get("vein_populator").getAsJsonObject(); this.veinPopulator = WorldGenRegistry.INSTANCE.createVeinPopulator(object); } this.blockFiller = WorldGenRegistry.INSTANCE.createBlockFiller(configRoot.get("filler").getAsJsonObject()); - this.shapeGenerator = WorldGenRegistry.INSTANCE.createShapeGenerator(configRoot.get("generator").getAsJsonObject()); + this.shapeGenerator = WorldGenRegistry.INSTANCE + .createShapeGenerator(configRoot.get("generator").getAsJsonObject()); if (veinPopulator != null) { veinPopulator.initializeForVein(this); @@ -179,27 +185,33 @@ public boolean equals(Object obj) { return false; if ((this.assignedName == null && objDeposit.getAssignedName() != null) || (this.assignedName != null && objDeposit.getAssignedName() == null) || - (this.assignedName != null && objDeposit.getAssignedName() != null && !this.assignedName.equals(objDeposit.getAssignedName()))) + (this.assignedName != null && objDeposit.getAssignedName() != null && + !this.assignedName.equals(objDeposit.getAssignedName()))) return false; if ((this.description == null && objDeposit.getDescription() != null) || (this.description != null && objDeposit.getDescription() == null) || - (this.description != null && objDeposit.getDescription() != null && !this.description.equals(objDeposit.getDescription()))) + (this.description != null && objDeposit.getDescription() != null && + !this.description.equals(objDeposit.getDescription()))) return false; if ((this.biomeWeightModifier == null && objDeposit.getBiomeWeightModifier() != null) || (this.biomeWeightModifier != null && objDeposit.getBiomeWeightModifier() == null) || - (this.biomeWeightModifier != null && objDeposit.getBiomeWeightModifier() != null && !this.biomeWeightModifier.equals(objDeposit.getBiomeWeightModifier()))) + (this.biomeWeightModifier != null && objDeposit.getBiomeWeightModifier() != null && + !this.biomeWeightModifier.equals(objDeposit.getBiomeWeightModifier()))) return false; if ((this.dimensionFilter == null && objDeposit.getDimensionFilter() != null) || (this.dimensionFilter != null && objDeposit.getDimensionFilter() == null) || - (this.dimensionFilter != null && objDeposit.getDimensionFilter() != null && !this.dimensionFilter.equals(objDeposit.getDimensionFilter()))) + (this.dimensionFilter != null && objDeposit.getDimensionFilter() != null && + !this.dimensionFilter.equals(objDeposit.getDimensionFilter()))) return false; if ((this.generationPredicate == null && objDeposit.getGenerationPredicate() != null) || (this.generationPredicate != null && objDeposit.getGenerationPredicate() == null) || - (this.generationPredicate != null && objDeposit.getGenerationPredicate() != null && !this.generationPredicate.equals(objDeposit.getGenerationPredicate()))) + (this.generationPredicate != null && objDeposit.getGenerationPredicate() != null && + !this.generationPredicate.equals(objDeposit.getGenerationPredicate()))) return false; if ((this.veinPopulator == null && objDeposit.getVeinPopulator() != null) || (this.veinPopulator != null && objDeposit.getVeinPopulator() == null) || - (this.veinPopulator != null && objDeposit.getVeinPopulator() != null && !this.veinPopulator.equals(objDeposit.getVeinPopulator()))) + (this.veinPopulator != null && objDeposit.getVeinPopulator() != null && + !this.veinPopulator.equals(objDeposit.getVeinPopulator()))) return false; return super.equals(obj); diff --git a/src/main/java/gregtech/api/worldgen/config/PredicateConfigUtils.java b/src/main/java/gregtech/api/worldgen/config/PredicateConfigUtils.java index 38c43ed4316..2c7ce8effcb 100644 --- a/src/main/java/gregtech/api/worldgen/config/PredicateConfigUtils.java +++ b/src/main/java/gregtech/api/worldgen/config/PredicateConfigUtils.java @@ -1,16 +1,18 @@ package gregtech.api.worldgen.config; -import com.google.common.base.Optional; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; import gregtech.api.unification.ore.StoneType; import gregtech.api.util.WorldBlockPredicate; + import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; +import com.google.common.base.Optional; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -29,13 +31,14 @@ public static IBlockState parseBlockStateDefinition(JsonObject object) { String stringValue = valueElement.getAsString(); Optional parsedValue = property.parseValue(stringValue); if (!parsedValue.isPresent()) { - throw new IllegalArgumentException("Couldn't parse property " + property.getName() + " value " + valueElement); + throw new IllegalArgumentException( + "Couldn't parse property " + property.getName() + " value " + valueElement); } // idk what this is @SuppressWarnings("UnnecessaryLocalVariable") IProperty propertyVar = property; Comparable comparableVar = (Comparable) parsedValue.get(); - //noinspection unchecked + // noinspection unchecked blockState = blockState.withProperty(propertyVar, comparableVar); } } @@ -114,7 +117,8 @@ private static Predicate parseBlockStatePropertyPredicate(JsonObjec } Optional parsedValue = property.parseValue(elementValue); if (!parsedValue.isPresent()) { - throw new IllegalArgumentException("Couldn't parse property " + property.getName() + " value " + valueElement); + throw new IllegalArgumentException( + "Couldn't parse property " + property.getName() + " value " + valueElement); } allValues.add(parsedValue.get()); } @@ -130,7 +134,7 @@ private static Predicate parseBlockStatePropertyPredicate(JsonObjec return blockState -> { for (IProperty property : blockState.getPropertyKeys()) { if (!allowedValues.containsKey(property)) - continue; //do not check unspecified properties + continue; // do not check unspecified properties Object propertyValue = blockState.getValue(property); if (!allowedValues.get(property).contains(propertyValue)) return false; diff --git a/src/main/java/gregtech/api/worldgen/config/WorldConfigUtils.java b/src/main/java/gregtech/api/worldgen/config/WorldConfigUtils.java index 3f28de19eac..9718a0d29bf 100644 --- a/src/main/java/gregtech/api/worldgen/config/WorldConfigUtils.java +++ b/src/main/java/gregtech/api/worldgen/config/WorldConfigUtils.java @@ -1,10 +1,7 @@ package gregtech.api.worldgen.config; -import com.google.common.base.Preconditions; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.util.GTUtility; + import net.minecraft.util.ResourceLocation; import net.minecraft.world.DimensionType; import net.minecraft.world.WorldProvider; @@ -13,6 +10,11 @@ import net.minecraftforge.common.BiomeDictionary.Type; import net.minecraftforge.fml.common.registry.GameRegistry; +import com.google.common.base.Preconditions; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; @@ -45,9 +47,12 @@ public static Predicate createWorldPredicate(JsonElement element) } else { int indexOf = filterValue.indexOf(':'); int indexOfExclusive = indexOf + 1; - int minDimensionId = indexOf == 0 ? -Integer.MAX_VALUE : Integer.parseInt(filterValue.substring(0, indexOf)); - int maxDimensionId = indexOfExclusive == filterValue.length() ? Integer.MAX_VALUE : Integer.parseInt(filterValue.substring(indexOfExclusive)); - allPredicates.add(provider -> provider.getDimension() >= minDimensionId && provider.getDimension() <= maxDimensionId); + int minDimensionId = indexOf == 0 ? -Integer.MAX_VALUE : + Integer.parseInt(filterValue.substring(0, indexOf)); + int maxDimensionId = indexOfExclusive == filterValue.length() ? Integer.MAX_VALUE : + Integer.parseInt(filterValue.substring(indexOfExclusive)); + allPredicates.add(provider -> provider.getDimension() >= minDimensionId && + provider.getDimension() <= maxDimensionId); } } else if (stringValue.startsWith("name:")) { stringSupplier = provider -> provider.getDimensionType().getName(); @@ -64,7 +69,8 @@ public static Predicate createWorldPredicate(JsonElement element) } else { String finalStringValue = stringValue; Function finalStringSupplier1 = stringSupplier; - allPredicates.add(provider -> finalStringValue.equalsIgnoreCase(finalStringSupplier1.apply(provider))); + allPredicates + .add(provider -> finalStringValue.equalsIgnoreCase(finalStringSupplier1.apply(provider))); } } } @@ -82,7 +88,7 @@ public static Function createBiomeWeightModifier(JsonElement ele case "biome_map": { HashMap backedMap = new HashMap<>(); for (Entry elementEntry : object.entrySet()) { - if (elementEntry.getKey().equals("type")) continue; //skip type + if (elementEntry.getKey().equals("type")) continue; // skip type ResourceLocation biomeName = new ResourceLocation(elementEntry.getKey()); Biome biome = GameRegistry.findRegistry(Biome.class).getValue(biomeName); if (biome == null) @@ -94,7 +100,7 @@ public static Function createBiomeWeightModifier(JsonElement ele case "biome_dictionary": { HashMap backedMap = new HashMap<>(); for (Entry elementEntry : object.entrySet()) { - if (elementEntry.getKey().equals("type")) continue; //skip type + if (elementEntry.getKey().equals("type")) continue; // skip type String tagName = elementEntry.getKey().toUpperCase(); Type type = GTUtility.getBiomeTypeTagByName(tagName); if (type == null) diff --git a/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java b/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java index ae548cf1239..5c324f8598b 100644 --- a/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java +++ b/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java @@ -1,9 +1,5 @@ package gregtech.api.worldgen.config; -import com.google.common.collect.Lists; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.GTValues; import gregtech.api.util.FileUtility; import gregtech.api.util.GTLog; @@ -17,8 +13,7 @@ import gregtech.api.worldgen.populator.SurfaceBlockPopulator; import gregtech.api.worldgen.populator.SurfaceRockPopulator; import gregtech.api.worldgen.shape.*; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import net.minecraft.init.Blocks; import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.Biome; @@ -26,9 +21,15 @@ import net.minecraftforge.fml.common.IWorldGenerator; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.registry.GameRegistry; + +import com.google.common.collect.Lists; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import org.apache.commons.io.IOUtils; -import javax.annotation.Nonnull; import java.io.FileNotFoundException; import java.io.IOException; import java.lang.reflect.Field; @@ -36,13 +37,15 @@ import java.net.URISyntaxException; import java.net.URL; import java.nio.file.*; -import java.util.AbstractMap.SimpleEntry; import java.util.*; +import java.util.AbstractMap.SimpleEntry; import java.util.Map.Entry; import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.Nonnull; + public class WorldGenRegistry { public static final WorldGenRegistry INSTANCE = new WorldGenRegistry(); @@ -52,9 +55,11 @@ public class WorldGenRegistry { private WorldGenRegistry() {} - private final Map> shapeGeneratorRegistry = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + private final Map> shapeGeneratorRegistry = new TreeMap<>( + String.CASE_INSENSITIVE_ORDER); private final Map> blockFillerRegistry = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - private final Map> veinPopulatorRegistry = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + private final Map> veinPopulatorRegistry = new TreeMap<>( + String.CASE_INSENSITIVE_ORDER); private final Int2ObjectMap namedDimensions = new Int2ObjectOpenHashMap<>(); private final List registeredVeinDefinitions = new ArrayList<>(); @@ -66,6 +71,7 @@ private WorldGenRegistry() {} private final Map oreVeinCache = new WeakHashMap<>(); private class WorldOreVeinCache { + private final List worldVeins; private final Map>> biomeVeins = new HashMap<>(); @@ -105,7 +111,8 @@ public void initializeRegistry() { registerShapeGenerator("layered", LayeredGenerator::new); registerBlockFiller("simple", SimpleBlockFiller::new); registerBlockFiller("layered", LayeredBlockFiller::new); - registerBlockFiller("ignore_bedrock", () -> new BlacklistedBlockFiller(Lists.newArrayList(Blocks.BEDROCK.getDefaultState()))); + registerBlockFiller("ignore_bedrock", + () -> new BlacklistedBlockFiller(Lists.newArrayList(Blocks.BEDROCK.getDefaultState()))); registerVeinPopulator("surface_rock", SurfaceRockPopulator::new); registerVeinPopulator("fluid_spring", FluidSpringPopulator::new); registerVeinPopulator("surface_block", SurfaceBlockPopulator::new); @@ -120,9 +127,11 @@ public void initializeRegistry() { if (Loader.isModLoaded("galacticraftcore")) { try { Class transformerHooksClass = Class.forName("micdoodle8.mods.galacticraft.core.TransformerHooks"); - Field otherModGeneratorsWhitelistField = transformerHooksClass.getDeclaredField("otherModGeneratorsWhitelist"); + Field otherModGeneratorsWhitelistField = transformerHooksClass + .getDeclaredField("otherModGeneratorsWhitelist"); otherModGeneratorsWhitelistField.setAccessible(true); - List otherModGeneratorsWhitelist = (List) otherModGeneratorsWhitelistField.get(null); + List otherModGeneratorsWhitelist = (List) otherModGeneratorsWhitelistField + .get(null); otherModGeneratorsWhitelist.add(WorldGeneratorImpl.INSTANCE); } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { GTLog.logger.fatal("Failed to inject world generator into Galacticraft's whitelist.", e); @@ -204,7 +213,7 @@ public void reinitializeRegisteredVeins() throws IOException { extractJarVeinDefinitions(configPath, jarFileExtractLock); } - //attempt extraction if worldgen root directory is empty + // attempt extraction if worldgen root directory is empty boolean shouldExtract; try (Stream stream = Files.list(worldgenRootPath.resolve(veinPath))) { shouldExtract = !stream.findFirst().isPresent(); @@ -252,13 +261,15 @@ public void reinitializeRegisteredVeins() throws IOException { String depositName = FileUtility.nativeSepToSlash(veinPath.relativize(worldgenDefinition).toString()); try { - // Creates the deposit definition and initializes various components based on the json entries in the file + // Creates the deposit definition and initializes various components based on the json entries in the + // file OreDepositDefinition deposit = new OreDepositDefinition(depositName); deposit.initializeFromConfig(element); // Adds the registered definition to the list of all registered definitions registeredVeinDefinitions.add(deposit); } catch (RuntimeException exception) { - GTLog.logger.error("Failed to parse worldgen definition {} on path {}", depositName, worldgenDefinition, exception); + GTLog.logger.error("Failed to parse worldgen definition {} on path {}", depositName, worldgenDefinition, + exception); } } GTLog.logger.info("Loaded {} vein worldgen definitions", registeredVeinDefinitions.size()); @@ -280,17 +291,20 @@ public void reinitializeRegisteredVeins() throws IOException { } // Finds the file name to create the Definition with, using a consistent separator character - String depositName = FileUtility.nativeSepToSlash(bedrockVeinPath.relativize(worldgenDefinition).toString()); + String depositName = FileUtility + .nativeSepToSlash(bedrockVeinPath.relativize(worldgenDefinition).toString()); try { - // Creates the deposit definition and initializes various components based on the json entries in the file + // Creates the deposit definition and initializes various components based on the json entries in the + // file BedrockFluidDepositDefinition deposit = new BedrockFluidDepositDefinition(depositName); // Adds the registered definition to the list of all registered definitions if (deposit.initializeFromConfig(element)) { registeredBedrockVeinDefinitions.add(deposit); } } catch (RuntimeException exception) { - GTLog.logger.error("Failed to parse worldgen definition {} on path {}", depositName, worldgenDefinition, exception); + GTLog.logger.error("Failed to parse worldgen definition {} on path {}", depositName, worldgenDefinition, + exception); } } @@ -299,9 +313,10 @@ public void reinitializeRegisteredVeins() throws IOException { GTLog.logger.info("Loaded {} bedrock worldgen definitions", registeredBedrockVeinDefinitions.size()); GTLog.logger.info("Loaded {} worldgen definitions from addon mods", addonRegisteredDefinitions.size()); - GTLog.logger.info("Loaded {} bedrock worldgen definitions from addon mods", addonRegisteredBedrockVeinDefinitions.size()); - GTLog.logger.info("Loaded {} total worldgen definitions", registeredVeinDefinitions.size() + registeredBedrockVeinDefinitions.size()); - + GTLog.logger.info("Loaded {} bedrock worldgen definitions from addon mods", + addonRegisteredBedrockVeinDefinitions.size()); + GTLog.logger.info("Loaded {} total worldgen definitions", + registeredVeinDefinitions.size() + registeredBedrockVeinDefinitions.size()); } /** @@ -327,11 +342,14 @@ private static void extractJarVeinDefinitions(Path configPath, Path targetPath) URL sampleUrl = WorldGenRegistry.class.getResource("/assets/gregtech/.gtassetsroot"); if (sampleUrl == null) throw new FileNotFoundException("Could not find .gtassetsroot"); URI sampleUri = sampleUrl.toURI(); - // The Path for representing the worldgen folder in the assets folder in the Gregtech resources folder in the jar + // The Path for representing the worldgen folder in the assets folder in the Gregtech resources folder in + // the jar Path worldgenJarRootPath; - // The Path for representing the vein folder in the vein folder in the assets folder in the Gregtech resources folder in the jar + // The Path for representing the vein folder in the vein folder in the assets folder in the Gregtech + // resources folder in the jar Path oreVeinJarRootPath; - // The Path for representing the fluid folder in the vein folder in the assets folder in the Gregtech resources folder in the jar + // The Path for representing the fluid folder in the vein folder in the assets folder in the Gregtech + // resources folder in the jar Path bedrockFluidJarRootPath; if (sampleUri.getScheme().equals("jar") || sampleUri.getScheme().equals("zip")) { zipFileSystem = FileSystems.newFileSystem(sampleUri, Collections.emptyMap()); @@ -351,7 +369,8 @@ private static void extractJarVeinDefinitions(Path configPath, Path targetPath) if (url == null) throw new FileNotFoundException("Could not find /assets/gregtech/worldgen/fluid"); bedrockFluidJarRootPath = Paths.get(url.toURI()); } else { - throw new IllegalStateException("Unable to locate absolute path to worldgen root directory: " + sampleUri); + throw new IllegalStateException( + "Unable to locate absolute path to worldgen root directory: " + sampleUri); } // Attempts to extract the worldgen definition jsons @@ -382,11 +401,13 @@ private static void extractJarVeinDefinitions(Path configPath, Path targetPath) // Replaces or creates the default worldgen files for (Path jarFile : jarFiles) { - Path worldgenPath = bedrockFluidVeinRootPath.resolve(bedrockFluidJarRootPath.relativize(jarFile).toString()); + Path worldgenPath = bedrockFluidVeinRootPath + .resolve(bedrockFluidJarRootPath.relativize(jarFile).toString()); Files.createDirectories(worldgenPath.getParent()); Files.copy(jarFile, worldgenPath, StandardCopyOption.REPLACE_EXISTING); } - GTLog.logger.info("Extracted {} builtin worldgen bedrock fluid definitions into fluid folder", jarFiles.size()); + GTLog.logger.info("Extracted {} builtin worldgen bedrock fluid definitions into fluid folder", + jarFiles.size()); } // Attempts to extract the named dimensions json folder else if (targetPath.compareTo(dimensionsRootPath) == 0) { @@ -395,7 +416,8 @@ else if (targetPath.compareTo(dimensionsRootPath) == 0) { Path dimensionFile = worldgenJarRootPath.resolve("dimensions.json"); - Path worldgenPath = dimensionsRootPath.resolve(worldgenJarRootPath.relativize(worldgenJarRootPath).toString()); + Path worldgenPath = dimensionsRootPath + .resolve(worldgenJarRootPath.relativize(worldgenJarRootPath).toString()); Files.copy(dimensionFile, worldgenPath, StandardCopyOption.REPLACE_EXISTING); GTLog.logger.info("Extracted builtin dimension definitions into worldgen folder"); @@ -404,18 +426,19 @@ else if (targetPath.compareTo(dimensionsRootPath) == 0) { else if (targetPath.compareTo(extractLockPath) == 0) { Path extractLockFile = worldgenJarRootPath.resolve("worldgen_extracted.json"); - Path worldgenPath = extractLockPath.resolve(worldgenJarRootPath.relativize(worldgenJarRootPath).toString()); + Path worldgenPath = extractLockPath + .resolve(worldgenJarRootPath.relativize(worldgenJarRootPath).toString()); Files.copy(extractLockFile, worldgenPath, StandardCopyOption.REPLACE_EXISTING); GTLog.logger.info("Extracted jar lock file into worldgen folder"); } } catch (URISyntaxException impossible) { - //this is impossible, since getResource always returns valid URI + // this is impossible, since getResource always returns valid URI throw new RuntimeException(impossible); } finally { if (zipFileSystem != null) { - //close zip file system to avoid issues + // close zip file system to avoid issues IOUtils.closeQuietly(zipFileSystem); } } @@ -436,12 +459,14 @@ private static void removeExistingFiles(Path root, @Nonnull List void addAddonFiles(Path root, @Nonnull List definitions, @Nonnull List registeredDefinitions) { + private static void addAddonFiles(Path root, @Nonnull List definitions, + @Nonnull List registeredDefinitions) { Iterator it = definitions.iterator(); while (it.hasNext()) { T definition = it.next(); - JsonObject element = FileUtility.tryExtractFromFile(root.resolve(FileUtility.slashToNativeSep(definition.getDepositName()))); + JsonObject element = FileUtility + .tryExtractFromFile(root.resolve(FileUtility.slashToNativeSep(definition.getDepositName()))); if (element == null) { GTLog.logger.error("Addon mod tried to register bad ore definition at {}", definition.getDepositName()); @@ -453,7 +478,8 @@ private static void addAddonFiles(Path root, @No definition.initializeFromConfig(element); registeredDefinitions.add(definition); } catch (RuntimeException exception) { - GTLog.logger.error("Failed to parse addon worldgen definition {}", definition.getDepositName(), exception); + GTLog.logger.error("Failed to parse addon worldgen definition {}", definition.getDepositName(), + exception); } } } @@ -472,7 +498,8 @@ private void gatherNamedDimensions(Path dimensionsFile) { try { JsonArray dims = element.getAsJsonArray("dims"); for (JsonElement dim : dims) { - namedDimensions.put(dim.getAsJsonObject().get("dimID").getAsInt(), dim.getAsJsonObject().get("dimName").getAsString()); + namedDimensions.put(dim.getAsJsonObject().get("dimID").getAsInt(), + dim.getAsJsonObject().get("dimName").getAsString()); } } catch (RuntimeException exception) { GTLog.logger.error("Failed to parse named dimensions", exception); @@ -483,7 +510,8 @@ private void gatherNamedDimensions(Path dimensionsFile) { * Called to remove veins from the list of registered vein definitions * Can fail if called on default veins when the veins have been modified by modpack makers *

- * After removing all desired veins, call {@link WorldGenRegistry#reinitializeRegisteredVeins()} to delete the existing files + * After removing all desired veins, call {@link WorldGenRegistry#reinitializeRegisteredVeins()} to delete the + * existing files * * @param definition The {@link OreDepositDefinition} to remove */ @@ -495,14 +523,18 @@ public void removeVeinDefinitions(IWorldgenDefinition definition) { registeredVeinDefinitions.remove(definition); removedVeinDefinitions.add((OreDepositDefinition) definition); } else { - GTLog.logger.error("Failed to remove OreDepositDefinition at {}. Deposit was not in list of registered veins.", definition.getDepositName()); + GTLog.logger.error( + "Failed to remove OreDepositDefinition at {}. Deposit was not in list of registered veins.", + definition.getDepositName()); } } else if (definition instanceof BedrockFluidDepositDefinition) { if (registeredBedrockVeinDefinitions.contains(definition)) { registeredBedrockVeinDefinitions.remove(definition); removedBedrockVeinDefinitions.add((BedrockFluidDepositDefinition) definition); } else { - GTLog.logger.error("Failed to remove BedrockFluidDepositDefinition at {}. Deposit was not in list of registered veins.", definition.getDepositName()); + GTLog.logger.error( + "Failed to remove BedrockFluidDepositDefinition at {}. Deposit was not in list of registered veins.", + definition.getDepositName()); } } @@ -513,7 +545,8 @@ public void removeVeinDefinitions(IWorldgenDefinition definition) { * Will not create an entry if a file already exists for the provided definition *

* After adding all veins, call {@link WorldGenRegistry#reinitializeRegisteredVeins()} to initialize the new veins - * Or, register veins before {@link WorldGenRegistry#initializeRegistry()} is called, and the veins will be loaded with the + * Or, register veins before {@link WorldGenRegistry#initializeRegistry()} is called, and the veins will be loaded + * with the * default veins * * @param definition The OreDepositDefinition to add to the list of registered veins @@ -523,7 +556,8 @@ public void addVeinDefinitions(OreDepositDefinition definition) { if (!registeredVeinDefinitions.contains(definition)) { addonRegisteredDefinitions.add(definition); } else { - GTLog.logger.error("Failed to add ore vein definition at {}. Definition already exists", definition.getDepositName()); + GTLog.logger.error("Failed to add ore vein definition at {}. Definition already exists", + definition.getDepositName()); } } @@ -532,7 +566,8 @@ public void addVeinDefinitions(OreDepositDefinition definition) { * Will not create an entry if a file already exists for the provided definition *

* After adding all veins, call {@link WorldGenRegistry#reinitializeRegisteredVeins()} to initialize the new veins - * Or, register veins before {@link WorldGenRegistry#initializeRegistry()} is called, and the veins will be loaded with the + * Or, register veins before {@link WorldGenRegistry#initializeRegistry()} is called, and the veins will be loaded + * with the * default veins * * @param definition The BedrockFluidDepositDefinition to add to the list of registered veins @@ -542,7 +577,8 @@ public void addVeinDefinitions(BedrockFluidDepositDefinition definition) { if (!addonRegisteredBedrockVeinDefinitions.contains(definition)) { addonRegisteredBedrockVeinDefinitions.add(definition); } else { - GTLog.logger.error("Failed to add bedrock fluid deposit definition at {}. Definition already exists", definition.getDepositName()); + GTLog.logger.error("Failed to add bedrock fluid deposit definition at {}. Definition already exists", + definition.getDepositName()); } } diff --git a/src/main/java/gregtech/api/worldgen/filler/BlacklistedBlockFiller.java b/src/main/java/gregtech/api/worldgen/filler/BlacklistedBlockFiller.java index 572d2cfc789..8b17f6baaad 100644 --- a/src/main/java/gregtech/api/worldgen/filler/BlacklistedBlockFiller.java +++ b/src/main/java/gregtech/api/worldgen/filler/BlacklistedBlockFiller.java @@ -1,11 +1,13 @@ package gregtech.api.worldgen.filler; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.FillerConfigUtils; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import com.google.gson.JsonObject; + import java.util.Collections; import java.util.List; import java.util.Random; @@ -34,7 +36,8 @@ public void loadFromConfig(JsonObject object) { } @Override - public IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, int relativeY, int relativeZ, double density, Random gridRandom, int layer) { + public IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, + int relativeY, int relativeZ, double density, Random gridRandom, int layer) { for (IBlockState blockState : blacklist) { if (blockState == currentState) { return currentState; diff --git a/src/main/java/gregtech/api/worldgen/filler/BlockFiller.java b/src/main/java/gregtech/api/worldgen/filler/BlockFiller.java index 5590faca7b6..10fa5238693 100644 --- a/src/main/java/gregtech/api/worldgen/filler/BlockFiller.java +++ b/src/main/java/gregtech/api/worldgen/filler/BlockFiller.java @@ -1,10 +1,11 @@ package gregtech.api.worldgen.filler; -import com.google.gson.JsonObject; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import com.google.gson.JsonObject; + import java.util.List; import java.util.Random; @@ -12,7 +13,9 @@ public abstract class BlockFiller { public abstract void loadFromConfig(JsonObject object); - public abstract IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, int relativeY, int relativeZ, double density, Random gridRandom, int layer); + public abstract IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, + int relativeX, int relativeY, int relativeZ, double density, Random gridRandom, + int layer); public abstract List getAllPossibleStates(); } diff --git a/src/main/java/gregtech/api/worldgen/filler/FillerEntry.java b/src/main/java/gregtech/api/worldgen/filler/FillerEntry.java index 6eb0765f967..de5465b3b47 100644 --- a/src/main/java/gregtech/api/worldgen/filler/FillerEntry.java +++ b/src/main/java/gregtech/api/worldgen/filler/FillerEntry.java @@ -1,9 +1,10 @@ package gregtech.api.worldgen.filler; -import com.google.common.collect.ImmutableList; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; + +import com.google.common.collect.ImmutableList; import org.apache.commons.lang3.tuple.Pair; import java.util.ArrayList; @@ -23,6 +24,7 @@ default List> getEntries() { static FillerEntry createSimpleFiller(IBlockState blockState) { List possibleResults = ImmutableList.of(blockState); return new FillerEntry() { + @Override public IBlockState apply(IBlockState source, IBlockAccess blockAccess, BlockPos blockPos) { return blockState; diff --git a/src/main/java/gregtech/api/worldgen/filler/LayeredBlockFiller.java b/src/main/java/gregtech/api/worldgen/filler/LayeredBlockFiller.java index 2f1b9127c3d..25bfc2ac805 100644 --- a/src/main/java/gregtech/api/worldgen/filler/LayeredBlockFiller.java +++ b/src/main/java/gregtech/api/worldgen/filler/LayeredBlockFiller.java @@ -1,12 +1,14 @@ package gregtech.api.worldgen.filler; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.FillerConfigUtils; import gregtech.api.worldgen.config.FillerConfigUtils.LayeredFillerEntry; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import com.google.gson.JsonObject; + import java.util.Collections; import java.util.List; import java.util.Random; @@ -15,8 +17,7 @@ public class LayeredBlockFiller extends BlockFiller { private LayeredFillerEntry fillerEntry; - public LayeredBlockFiller() { - } + public LayeredBlockFiller() {} @Override public void loadFromConfig(JsonObject object) { @@ -24,7 +25,8 @@ public void loadFromConfig(JsonObject object) { } @Override - public IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, int relativeY, int relativeZ, double density, Random gridRandom, int layer) { + public IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, + int relativeY, int relativeZ, double density, Random gridRandom, int layer) { return fillerEntry.apply(currentState, blockAccess, blockPos, density, gridRandom, layer); } diff --git a/src/main/java/gregtech/api/worldgen/filler/SimpleBlockFiller.java b/src/main/java/gregtech/api/worldgen/filler/SimpleBlockFiller.java index c9f0f569574..c9cb3574d77 100644 --- a/src/main/java/gregtech/api/worldgen/filler/SimpleBlockFiller.java +++ b/src/main/java/gregtech/api/worldgen/filler/SimpleBlockFiller.java @@ -1,11 +1,13 @@ package gregtech.api.worldgen.filler; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.FillerConfigUtils; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import com.google.gson.JsonObject; + import java.util.Collections; import java.util.List; import java.util.Random; @@ -14,8 +16,7 @@ public class SimpleBlockFiller extends BlockFiller { private FillerEntry fillerEntry; - public SimpleBlockFiller() { - } + public SimpleBlockFiller() {} public SimpleBlockFiller(FillerEntry blockStateFiller) { this.fillerEntry = blockStateFiller; @@ -27,7 +28,8 @@ public void loadFromConfig(JsonObject object) { } @Override - public IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, int relativeY, int relativeZ, double density, Random gridRandom, int layer) { + public IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, + int relativeY, int relativeZ, double density, Random gridRandom, int layer) { return fillerEntry.apply(currentState, blockAccess, blockPos); } diff --git a/src/main/java/gregtech/api/worldgen/generator/CachedGridEntry.java b/src/main/java/gregtech/api/worldgen/generator/CachedGridEntry.java index 7bce5bff734..8fe39b4ceaf 100644 --- a/src/main/java/gregtech/api/worldgen/generator/CachedGridEntry.java +++ b/src/main/java/gregtech/api/worldgen/generator/CachedGridEntry.java @@ -1,7 +1,5 @@ package gregtech.api.worldgen.generator; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; import gregtech.api.util.GTUtility; import gregtech.api.util.XSTR; import gregtech.api.worldgen.config.OreDepositDefinition; @@ -12,8 +10,7 @@ import gregtech.api.worldgen.populator.VeinChunkPopulator; import gregtech.api.worldgen.shape.IBlockGeneratorAccess; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.longs.*; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; @@ -21,6 +18,11 @@ import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; + +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import it.unimi.dsi.fastutil.longs.*; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.apache.commons.lang3.tuple.MutablePair; import java.util.*; @@ -31,7 +33,8 @@ public class CachedGridEntry implements GridEntryInfo, IBlockGeneratorAccess, IB private static final Map> gridEntryCache = new WeakHashMap<>(); - public static CachedGridEntry getOrCreateEntry(World world, int gridX, int gridZ, int primerChunkX, int primerChunkZ) { + public static CachedGridEntry getOrCreateEntry(World world, int gridX, int gridZ, int primerChunkX, + int primerChunkZ) { Cache currentValue = gridEntryCache.get(world); if (currentValue == null) { currentValue = createGridCache(); @@ -54,7 +57,8 @@ private static Cache createGridCache() { } private final Long2ObjectMap dataByChunkPos = new Long2ObjectOpenHashMap<>(); - private static final Comparator COMPARATOR = Comparator.comparing(OreDepositDefinition::getPriority).reversed(); + private static final Comparator COMPARATOR = Comparator + .comparing(OreDepositDefinition::getPriority).reversed(); private static final BlockPos[] CHUNK_CORNER_SPOTS = { new BlockPos(0, 0, 0), new BlockPos(15, 0, 0), @@ -81,9 +85,11 @@ public CachedGridEntry(World world, int gridX, int gridZ, int primerChunkX, int int gridSizeX = WorldGeneratorImpl.GRID_SIZE_X * 16; int gridSizeZ = WorldGeneratorImpl.GRID_SIZE_Z * 16; - BlockPos blockPos = new BlockPos(gridX * gridSizeX + gridSizeX / 2, world.getActualHeight(), gridZ * gridSizeZ + gridSizeZ / 2); + BlockPos blockPos = new BlockPos(gridX * gridSizeX + gridSizeX / 2, world.getActualHeight(), + gridZ * gridSizeZ + gridSizeZ / 2); Biome currentBiome = world.getBiomeProvider().getBiome(blockPos); - this.cachedDepositMap = new ArrayList<>(WorldGenRegistry.INSTANCE.getCachedBiomeVeins(world.provider, currentBiome)); + this.cachedDepositMap = new ArrayList<>( + WorldGenRegistry.INSTANCE.getCachedBiomeVeins(world.provider, currentBiome)); this.worldSeaLevel = world.getSeaLevel(); this.masterEntry = searchMasterOrNull(world); @@ -94,7 +100,7 @@ public CachedGridEntry(World world, int gridX, int gridZ, int primerChunkX, int int masterHeight = world.getHeight(heightSpot).getY(); int masterBottomHeight = world.getTopSolidOrLiquidBlock(heightSpot).getY(); this.masterEntry = primerChunk.getCapability(GTWorldGenCapability.CAPABILITY, null); - if(this.masterEntry == null) { + if (this.masterEntry == null) { this.masterEntry = new GTWorldGenCapability(); } this.masterEntry.setMaxHeight(masterHeight, masterBottomHeight); @@ -204,15 +210,18 @@ public void triggerVeinsGeneration() { this.veinGeneratedMap = new Object2ObjectOpenHashMap<>(); if (!cachedDepositMap.isEmpty()) { int currentCycle = 0; - int maxCycles = ConfigHolder.worldgen.minVeinsInSection + (ConfigHolder.worldgen.additionalVeinsInSection == 0 ? 0 : gridRandom.nextInt(ConfigHolder.worldgen.additionalVeinsInSection + 1)); + int maxCycles = ConfigHolder.worldgen.minVeinsInSection + + (ConfigHolder.worldgen.additionalVeinsInSection == 0 ? 0 : + gridRandom.nextInt(ConfigHolder.worldgen.additionalVeinsInSection + 1)); List veins = new ArrayList<>(); while (currentCycle < cachedDepositMap.size() && currentCycle < maxCycles) { - //instead of removing already generated veins, we swap last element with one we selected - int randomEntryIndex = GTUtility.getRandomItem(gridRandom, cachedDepositMap, cachedDepositMap.size() - currentCycle); + // instead of removing already generated veins, we swap last element with one we selected + int randomEntryIndex = GTUtility.getRandomItem(gridRandom, cachedDepositMap, + cachedDepositMap.size() - currentCycle); OreDepositDefinition randomEntry = cachedDepositMap.get(randomEntryIndex).getValue(); Collections.swap(cachedDepositMap, randomEntryIndex, cachedDepositMap.size() - 1 - currentCycle); - //need to put into list first to apply priority properly, so - //red granite vein will be properly filled with ores from other veins + // need to put into list first to apply priority properly, so + // red granite vein will be properly filled with ores from other veins veins.add(randomEntry); if (!randomEntry.isVein()) maxCycles++; @@ -229,7 +238,8 @@ private void doGenerateVein(OreDepositDefinition definition) { this.currentOreVein = definition; int topHeightOffset = currentOreVein.getShapeGenerator().getMaxSize().getY() / 2 + 4; - int maximumHeight = Math.min(masterEntry.getMaxBottomHeight(), currentOreVein.getHeightLimit()[1] - topHeightOffset); + int maximumHeight = Math.min(masterEntry.getMaxBottomHeight(), + currentOreVein.getHeightLimit()[1] - topHeightOffset); int minimumHeight = Math.max(3, currentOreVein.getHeightLimit()[0]); if (minimumHeight >= maximumHeight) { return; @@ -248,13 +258,15 @@ private void doGenerateVein(OreDepositDefinition definition) { private int calculateVeinCenterX() { int gridSizeX = WorldGeneratorImpl.GRID_SIZE_X * 16; - int offset = (ConfigHolder.worldgen.generateVeinsInCenterOfChunk && currentOreVein.isVein()) ? gridSizeX / 2 : gridRandom.nextInt(gridSizeX); + int offset = (ConfigHolder.worldgen.generateVeinsInCenterOfChunk && currentOreVein.isVein()) ? gridSizeX / 2 : + gridRandom.nextInt(gridSizeX); return gridX * gridSizeX + offset; } private int calculateVeinCenterZ() { int gridSizeZ = WorldGeneratorImpl.GRID_SIZE_Z * 16; - int offset = (ConfigHolder.worldgen.generateVeinsInCenterOfChunk && currentOreVein.isVein()) ? gridSizeZ / 2 : gridRandom.nextInt(gridSizeZ); + int offset = (ConfigHolder.worldgen.generateVeinsInCenterOfChunk && currentOreVein.isVein()) ? gridSizeZ / 2 : + gridRandom.nextInt(gridSizeZ); return gridZ * gridSizeZ + offset; } @@ -265,11 +277,11 @@ public boolean generateBlock(int x, int y, int z, boolean withRandom) { int globalBlockX = veinCenterX + x; int globalBlockY = veinCenterY + y; int globalBlockZ = veinCenterZ + z; - //we should do all random-related things here, otherwise it gets corrupted by current chunk information + // we should do all random-related things here, otherwise it gets corrupted by current chunk information float randomDensityValue = gridRandom.nextFloat(); if (withRandom && currentOreVein.getDensity() < randomDensityValue) - return false; //only place blocks in positions matching density + return false; // only place blocks in positions matching density setBlock(globalBlockX, globalBlockY, globalBlockZ, currentOreVein, 0); return true; } @@ -301,7 +313,6 @@ private void setBlock(int worldX, int worldY, int worldZ, OreDepositDefinition d } } - public static class ChunkDataEntry { private final Map> oreBlocks = new Object2ObjectOpenHashMap<>(); @@ -344,7 +355,7 @@ public boolean populateChunk(World world) { LongSet generatedBlocks = new LongOpenHashSet(); boolean generatedOreVein = false; // enhanced for loops cause boxing and unboxing with FastUtil collections - //noinspection ForLoopReplaceableByForEach + // noinspection ForLoopReplaceableByForEach for (int i = 0; i < blockIndexList.size(); i++) { long blockIndex = blockIndexList.get(i); int xyzValue = (int) (blockIndex >> 32); @@ -356,16 +367,17 @@ public boolean populateChunk(World world) { IBlockState currentState = world.getBlockState(blockPos); IBlockState newState; if (index == 0) { - //it's primary ore block + // it's primary ore block if (!definition.getGenerationPredicate().test(currentState, world, blockPos)) - continue; //do not generate if predicate didn't match - newState = definition.getBlockFiller().apply(currentState, world, blockPos, blockX, blockY, blockZ, definition.getDensity(), gridRandom, blockY - lowestY); + continue; // do not generate if predicate didn't match + newState = definition.getBlockFiller().apply(currentState, world, blockPos, blockX, blockY, + blockZ, definition.getDensity(), gridRandom, blockY - lowestY); } else { - //it's populator-generated block with index + // it's populator-generated block with index VeinBufferPopulator populator = (VeinBufferPopulator) definition.getVeinPopulator(); newState = populator.getBlockByIndex(world, blockPos, index - 1); } - //set flags as 16 to avoid observer updates loading neighbour chunks + // set flags as 16 to avoid observer updates loading neighbour chunks world.setBlockState(blockPos, newState, 16); generatedBlocks.add(Block.getStateId(newState)); generatedOreVein = true; diff --git a/src/main/java/gregtech/api/worldgen/generator/GTWorldGenCapability.java b/src/main/java/gregtech/api/worldgen/generator/GTWorldGenCapability.java index 52a5ada8c74..d541a31b1fd 100644 --- a/src/main/java/gregtech/api/worldgen/generator/GTWorldGenCapability.java +++ b/src/main/java/gregtech/api/worldgen/generator/GTWorldGenCapability.java @@ -1,6 +1,7 @@ package gregtech.api.worldgen.generator; import gregtech.api.util.GTUtility; + import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; @@ -15,9 +16,10 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.util.concurrent.Callable; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.concurrent.Callable; @EventBusSubscriber public class GTWorldGenCapability { @@ -65,13 +67,16 @@ public void setMaxHeight(int maxHeight, int maxLiquidHeight) { public static final Callable FACTORY = GTWorldGenCapability::new; public static final IStorage STORAGE = new IStorage() { + @Override - public NBTBase writeNBT(Capability capability, GTWorldGenCapability instance, EnumFacing side) { + public NBTBase writeNBT(Capability capability, GTWorldGenCapability instance, + EnumFacing side) { return instance.writeToNBT(); } @Override - public void readNBT(Capability capability, GTWorldGenCapability instance, EnumFacing side, NBTBase nbt) { + public void readNBT(Capability capability, GTWorldGenCapability instance, EnumFacing side, + NBTBase nbt) { instance.readFromNBT((NBTTagCompound) nbt); } }; diff --git a/src/main/java/gregtech/api/worldgen/generator/GridEntryInfo.java b/src/main/java/gregtech/api/worldgen/generator/GridEntryInfo.java index 568d59b4e17..521cfe46cab 100644 --- a/src/main/java/gregtech/api/worldgen/generator/GridEntryInfo.java +++ b/src/main/java/gregtech/api/worldgen/generator/GridEntryInfo.java @@ -1,6 +1,7 @@ package gregtech.api.worldgen.generator; import gregtech.api.worldgen.config.OreDepositDefinition; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; @@ -20,5 +21,4 @@ public interface GridEntryInfo { BlockPos getCenterPos(OreDepositDefinition definition); Collection getGeneratedBlocks(OreDepositDefinition definition, int chunkX, int chunkZ); - } diff --git a/src/main/java/gregtech/api/worldgen/generator/WorldGeneratorImpl.java b/src/main/java/gregtech/api/worldgen/generator/WorldGeneratorImpl.java index 0cdc0d31a71..3ba6879ac0b 100644 --- a/src/main/java/gregtech/api/worldgen/generator/WorldGeneratorImpl.java +++ b/src/main/java/gregtech/api/worldgen/generator/WorldGeneratorImpl.java @@ -1,8 +1,8 @@ package gregtech.api.worldgen.generator; -import com.google.common.collect.ImmutableSet; import gregtech.common.ConfigHolder; import gregtech.common.worldgen.WorldGenRubberTree; + import net.minecraft.init.Biomes; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -18,6 +18,8 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import com.google.common.collect.ImmutableSet; + import java.util.Random; import java.util.Set; @@ -27,11 +29,12 @@ public class WorldGeneratorImpl implements IWorldGenerator { public static final WorldGeneratorImpl INSTANCE = new WorldGeneratorImpl(); - private static final Set ORE_EVENT_TYPES = ImmutableSet.of(COAL, DIAMOND, GOLD, IRON, LAPIS, REDSTONE, QUARTZ, EMERALD); + private static final Set ORE_EVENT_TYPES = ImmutableSet.of(COAL, DIAMOND, GOLD, IRON, LAPIS, REDSTONE, + QUARTZ, EMERALD); public static final int GRID_SIZE_X = 3; public static final int GRID_SIZE_Z = 3; - private WorldGeneratorImpl() { } + private WorldGeneratorImpl() {} @SubscribeEvent(priority = EventPriority.HIGH) public static void onOreGenerate(OreGenEvent.GenerateMinable event) { @@ -42,23 +45,27 @@ public static void onOreGenerate(OreGenEvent.GenerateMinable event) { } @Override - public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { + public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, + IChunkProvider chunkProvider) { int selfGridX = Math.floorDiv(chunkX, GRID_SIZE_X); int selfGridZ = Math.floorDiv(chunkZ, GRID_SIZE_Z); generateInternal(world, selfGridX, selfGridZ, chunkX, chunkZ, random); long rubberTreeSeed = random.nextLong(); if (!ConfigHolder.worldgen.disableRubberTreeGeneration) { - generateRubberTree(random, rubberTreeSeed, chunkProvider.provideChunk(chunkX, chunkZ), ConfigHolder.worldgen.rubberTreeRateIncrease); + generateRubberTree(random, rubberTreeSeed, chunkProvider.provideChunk(chunkX, chunkZ), + ConfigHolder.worldgen.rubberTreeRateIncrease); } } - private static void generateInternal(World world, int selfGridX, int selfGridZ, int chunkX, int chunkZ, Random random) { + private static void generateInternal(World world, int selfGridX, int selfGridZ, int chunkX, int chunkZ, + Random random) { int halfSizeX = (GRID_SIZE_X - 1) / 2; int halfSizeZ = (GRID_SIZE_Z - 1) / 2; for (int gridX = -halfSizeX; gridX <= halfSizeX; gridX++) { for (int gridZ = -halfSizeZ; gridZ <= halfSizeZ; gridZ++) { - CachedGridEntry cachedGridEntry = CachedGridEntry.getOrCreateEntry(world, selfGridX + gridX, selfGridZ + gridZ, chunkX, chunkZ); + CachedGridEntry cachedGridEntry = CachedGridEntry.getOrCreateEntry(world, selfGridX + gridX, + selfGridZ + gridZ, chunkX, chunkZ); cachedGridEntry.populateChunk(world, chunkX, chunkZ, random); } } @@ -79,7 +86,8 @@ private static void generateRubberTree(Random random, long seed, Chunk chunk, do if (biome != null) { if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.SWAMP)) rubberTrees += random.nextInt(10) + 5; - if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.FOREST) || BiomeDictionary.hasType(biome, BiomeDictionary.Type.JUNGLE)) + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.FOREST) || + BiomeDictionary.hasType(biome, BiomeDictionary.Type.JUNGLE)) rubberTrees += random.nextInt(5) + 1; } } diff --git a/src/main/java/gregtech/api/worldgen/populator/FluidSpringPopulator.java b/src/main/java/gregtech/api/worldgen/populator/FluidSpringPopulator.java index 1f51db73b2b..42bcb518ae0 100644 --- a/src/main/java/gregtech/api/worldgen/populator/FluidSpringPopulator.java +++ b/src/main/java/gregtech/api/worldgen/populator/FluidSpringPopulator.java @@ -1,13 +1,15 @@ package gregtech.api.worldgen.populator; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.generator.GridEntryInfo; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidBase; +import com.google.gson.JsonObject; + import java.util.List; import java.util.Random; import java.util.stream.Collectors; @@ -17,8 +19,7 @@ public class FluidSpringPopulator implements VeinBufferPopulator { private IBlockState fluidState; private float springGenerationChance; - public FluidSpringPopulator() { - } + public FluidSpringPopulator() {} public FluidSpringPopulator(IBlockState fluidState, float springGenerationChance) { this.fluidState = fluidState; @@ -35,7 +36,8 @@ public void initializeForVein(OreDepositDefinition definition) { List possibleStates = definition.getBlockFiller().getAllPossibleStates().stream() .flatMap(it -> it.getPossibleResults().stream()) .collect(Collectors.toList()); - this.fluidState = possibleStates.stream().filter(it -> it.getPropertyKeys().contains(BlockFluidBase.LEVEL)).findFirst().orElse(null); + this.fluidState = possibleStates.stream().filter(it -> it.getPropertyKeys().contains(BlockFluidBase.LEVEL)) + .findFirst().orElse(null); if (fluidState == null) { String message = "Can't find fluid block for spring in vein %s. Blocks in vein: %s"; throw new IllegalArgumentException(String.format(message, definition.getDepositName(), possibleStates)); @@ -43,7 +45,8 @@ public void initializeForVein(OreDepositDefinition definition) { } @Override - public void populateBlockBuffer(Random random, GridEntryInfo gridEntryInfo, IBlockModifierAccess modifier, OreDepositDefinition depositDefinition) { + public void populateBlockBuffer(Random random, GridEntryInfo gridEntryInfo, IBlockModifierAccess modifier, + OreDepositDefinition depositDefinition) { if (random.nextFloat() <= springGenerationChance) { int groundLevel = gridEntryInfo.getTerrainHeight(); int springUndergroundHeight = groundLevel - gridEntryInfo.getCenterPos(depositDefinition).getY(); diff --git a/src/main/java/gregtech/api/worldgen/populator/IBlockModifierAccess.java b/src/main/java/gregtech/api/worldgen/populator/IBlockModifierAccess.java index e4a9020c6c6..381e6e41b6e 100644 --- a/src/main/java/gregtech/api/worldgen/populator/IBlockModifierAccess.java +++ b/src/main/java/gregtech/api/worldgen/populator/IBlockModifierAccess.java @@ -3,5 +3,4 @@ public interface IBlockModifierAccess { boolean setBlock(int x, int y, int z, int index); - } diff --git a/src/main/java/gregtech/api/worldgen/populator/IVeinPopulator.java b/src/main/java/gregtech/api/worldgen/populator/IVeinPopulator.java index 4490eb40590..16107900073 100644 --- a/src/main/java/gregtech/api/worldgen/populator/IVeinPopulator.java +++ b/src/main/java/gregtech/api/worldgen/populator/IVeinPopulator.java @@ -1,12 +1,12 @@ package gregtech.api.worldgen.populator; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.OreDepositDefinition; +import com.google.gson.JsonObject; + public interface IVeinPopulator { void loadFromConfig(JsonObject object); void initializeForVein(OreDepositDefinition definition); - } diff --git a/src/main/java/gregtech/api/worldgen/populator/SurfaceBlockPopulator.java b/src/main/java/gregtech/api/worldgen/populator/SurfaceBlockPopulator.java index 61a0ad96297..8e628808776 100644 --- a/src/main/java/gregtech/api/worldgen/populator/SurfaceBlockPopulator.java +++ b/src/main/java/gregtech/api/worldgen/populator/SurfaceBlockPopulator.java @@ -1,10 +1,10 @@ package gregtech.api.worldgen.populator; -import com.google.gson.JsonObject; import gregtech.api.util.GTLog; import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.config.PredicateConfigUtils; import gregtech.api.worldgen.generator.GridEntryInfo; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.util.JsonUtils; @@ -12,6 +12,8 @@ import net.minecraft.world.World; import net.minecraft.world.WorldType; +import com.google.gson.JsonObject; + import java.util.Random; public class SurfaceBlockPopulator implements VeinChunkPopulator { @@ -21,8 +23,7 @@ public class SurfaceBlockPopulator implements VeinChunkPopulator { private int maxIndicatorAmount; private int failedGenerationCounter = 0; - public SurfaceBlockPopulator() { - } + public SurfaceBlockPopulator() {} public SurfaceBlockPopulator(IBlockState blockState) { this.blockState = blockState; @@ -36,23 +37,26 @@ public void loadFromConfig(JsonObject object) { } @Override - public void initializeForVein(OreDepositDefinition definition) { - } + public void initializeForVein(OreDepositDefinition definition) {} /** - * Generates the Surface Block for an underground vein. Spawns the Surface Block on top of the applicable topmost block in + * Generates the Surface Block for an underground vein. Spawns the Surface Block on top of the applicable topmost + * block in * the chunk, at a random position in the chunk. Does not run on a Flat world type * * @param world - The Minecraft world. Used for finding the top most block and its state * @param chunkX - The X chunk coordinate * @param chunkZ - The Z chunk coordinate - * @param random - A Random parameter. Used for determining the number of spawned Surface Blocks and their position + * @param random - A Random parameter. Used for determining the number of spawned Surface Blocks and their + * position * @param definition - The Ore Vein definition * @param gridEntryInfo - Information about the ore generation grid for the current generation section */ @Override - public void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, GridEntryInfo gridEntryInfo) { - int stonesCount = minIndicatorAmount + (minIndicatorAmount >= maxIndicatorAmount ? 0 : random.nextInt(maxIndicatorAmount - minIndicatorAmount)); + public void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, + GridEntryInfo gridEntryInfo) { + int stonesCount = minIndicatorAmount + (minIndicatorAmount >= maxIndicatorAmount ? 0 : + random.nextInt(maxIndicatorAmount - minIndicatorAmount)); if (stonesCount > 0 && world.getWorldType() != WorldType.FLAT) { for (int i = 0; i < stonesCount; i++) { int randomX = chunkX * 16 + random.nextInt(8); @@ -70,9 +74,12 @@ public void populateChunk(World world, int chunkX, int chunkZ, Random random, Or } - //Log if all Surface Block generation attempts were failed - if (failedGenerationCounter == stonesCount && maxIndicatorAmount > 0 && world.getWorldType() != WorldType.FLAT) { - GTLog.logger.debug("Failed all Surface Block generation attempts for vein {} at chunk with position: x: {}, z: {}", definition.getDepositName(), chunkX, chunkZ); + // Log if all Surface Block generation attempts were failed + if (failedGenerationCounter == stonesCount && maxIndicatorAmount > 0 && + world.getWorldType() != WorldType.FLAT) { + GTLog.logger.debug( + "Failed all Surface Block generation attempts for vein {} at chunk with position: x: {}, z: {}", + definition.getDepositName(), chunkX, chunkZ); } } @@ -81,23 +88,22 @@ private boolean generateSurfaceBlock(World world, BlockPos pos) { IBlockState blockState = world.getBlockState(topBlockPos.down()); Block blockAtPos = blockState.getBlock(); - if(topBlockPos.getY() >= world.provider.getActualHeight()) { + if (topBlockPos.getY() >= world.provider.getActualHeight()) { return false; } - //Check to see if the selected block has special rendering parameters (like glass) or a special model + // Check to see if the selected block has special rendering parameters (like glass) or a special model if (!blockState.isOpaqueCube() || !blockState.isFullBlock()) { return false; } - //Checks if the block is a replaceable feature like grass or snow layers. Liquids are replaceable, so + // Checks if the block is a replaceable feature like grass or snow layers. Liquids are replaceable, so // exclude one deep liquid blocks, for looks if (!blockAtPos.isReplaceable(world, topBlockPos) || blockState.getMaterial().isLiquid()) { return false; } return world.setBlockState(topBlockPos, this.blockState, 16); - } public IBlockState getBlockState() { diff --git a/src/main/java/gregtech/api/worldgen/populator/SurfaceRockPopulator.java b/src/main/java/gregtech/api/worldgen/populator/SurfaceRockPopulator.java index 027ada7b335..7085350c828 100644 --- a/src/main/java/gregtech/api/worldgen/populator/SurfaceRockPopulator.java +++ b/src/main/java/gregtech/api/worldgen/populator/SurfaceRockPopulator.java @@ -1,6 +1,5 @@ package gregtech.api.worldgen.populator; -import com.google.gson.JsonObject; import gregtech.api.unification.FluidUnifier; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; @@ -11,6 +10,7 @@ import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.generator.GridEntryInfo; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.block.state.IBlockState; @@ -24,6 +24,8 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.IFluidBlock; +import com.google.gson.JsonObject; + import java.util.Collection; import java.util.Random; @@ -32,8 +34,7 @@ public class SurfaceRockPopulator implements VeinChunkPopulator { private Material material; private int failedGenerationCounter = 0; - public SurfaceRockPopulator() { - } + public SurfaceRockPopulator() {} public SurfaceRockPopulator(Material material) { this.material = material; @@ -45,8 +46,7 @@ public void loadFromConfig(JsonObject object) { } @Override - public void initializeForVein(OreDepositDefinition definition) { - } + public void initializeForVein(OreDepositDefinition definition) {} private static boolean hasUndergroundMaterials(Collection generatedBlocks) { for (IBlockState blockState : generatedBlocks) { @@ -56,7 +56,8 @@ private static boolean hasUndergroundMaterials(Collection generated return true; } } else { - ItemStack itemStack = new ItemStack(blockState.getBlock(), 1, blockState.getBlock().damageDropped(blockState)); + ItemStack itemStack = new ItemStack(blockState.getBlock(), 1, + blockState.getBlock().damageDropped(blockState)); UnificationEntry entry = OreDictUnifier.getUnificationEntry(itemStack); if (entry != null && entry.material != null && entry.material.hasProperty(PropertyKey.ORE)) { return true; @@ -67,7 +68,8 @@ private static boolean hasUndergroundMaterials(Collection generated } private void setStoneBlock(World world, BlockPos blockPos) { - boolean surfaceRockPlaced = world.setBlockState(blockPos, MetaBlocks.SURFACE_ROCK.get(this.material).getBlock(this.material)); + boolean surfaceRockPlaced = world.setBlockState(blockPos, + MetaBlocks.SURFACE_ROCK.get(this.material).getBlock(this.material)); if (!surfaceRockPlaced) failedGenerationCounter++; } @@ -79,12 +81,14 @@ private void setStoneBlock(World world, BlockPos blockPos) { * @param world - The Minecraft world. Used for finding the top most block and its state * @param chunkX - The X chunk coordinate * @param chunkZ - The Z chunk coordinate - * @param random - A Random parameter. Used for determining the number of spawned Surface Blocks and their position + * @param random - A Random parameter. Used for determining the number of spawned Surface Blocks and their + * position * @param definition - The Ore Vein definition * @param gridEntryInfo - Information about the ore generation grid for the current generation section */ @Override - public void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, GridEntryInfo gridEntryInfo) { + public void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, + GridEntryInfo gridEntryInfo) { int stonesCount = random.nextInt(2) + 1; if (world.getWorldType() != WorldType.FLAT) { if (!hasUndergroundMaterials(gridEntryInfo.getGeneratedBlocks(definition, chunkX, chunkZ))) { @@ -105,25 +109,27 @@ public void populateChunk(World world, int chunkX, int chunkZ, Random random, Or generateSurfaceRock(world, gridEntryInfo.getCenterPos(definition)); } - //Log if all Surface Rock generation attempts were failed + // Log if all Surface Rock generation attempts were failed if (failedGenerationCounter == stonesCount && world.getWorldType() != WorldType.FLAT) { - GTLog.logger.debug("Failed to generate surface rocks for vein {} at chunk with position: x: {}, z: {}", definition.getDepositName(), chunkX, chunkZ); + GTLog.logger.debug("Failed to generate surface rocks for vein {} at chunk with position: x: {}, z: {}", + definition.getDepositName(), chunkX, chunkZ); } } public void generateSurfaceRock(World world, BlockPos pos) { BlockPos topBlockPos = findSpawnHeight(world, pos); - if(topBlockPos.getY() <= 20) { // don't generate below y20 + if (topBlockPos.getY() <= 20) { // don't generate below y20 return; } Block blockAtPos = world.getBlockState(topBlockPos).getBlock(); - if(topBlockPos.getY() >= world.provider.getActualHeight()) { + if (topBlockPos.getY() >= world.provider.getActualHeight()) { return; } - //Checks if the block is a replaceable feature like grass, snow layers, or Air. Liquids are replaceable, so + // Checks if the block is a replaceable feature like grass, snow layers, or Air. Liquids are replaceable, so // exclude one deep liquid blocks, for looks - if (!blockAtPos.isReplaceable(world, topBlockPos) || world.getBlockState(topBlockPos).getMaterial().isLiquid()) { + if (!blockAtPos.isReplaceable(world, topBlockPos) || + world.getBlockState(topBlockPos).getMaterial().isLiquid()) { return; } @@ -142,13 +148,13 @@ public static BlockPos findSpawnHeight(World world, BlockPos pos) { while (blockpos.getY() > 20) { blockpos.move(EnumFacing.DOWN); IBlockState state = chunk.getBlockState(blockpos); - if(state.getMaterial() == net.minecraft.block.material.Material.AIR || + if (state.getMaterial() == net.minecraft.block.material.Material.AIR || state.getMaterial() == net.minecraft.block.material.Material.LEAVES || state.getMaterial() == net.minecraft.block.material.Material.VINE || state.getBlock().isFoliage(world, blockpos)) { airBlocks++; } else { - if(airBlocks >= 10 && state.isSideSolid(world, blockpos, EnumFacing.UP)) { + if (airBlocks >= 10 && state.isSideSolid(world, blockpos, EnumFacing.UP)) { blockpos.move(EnumFacing.UP); break; } diff --git a/src/main/java/gregtech/api/worldgen/populator/VeinBufferPopulator.java b/src/main/java/gregtech/api/worldgen/populator/VeinBufferPopulator.java index abcc7653090..a26b95cf4aa 100644 --- a/src/main/java/gregtech/api/worldgen/populator/VeinBufferPopulator.java +++ b/src/main/java/gregtech/api/worldgen/populator/VeinBufferPopulator.java @@ -2,6 +2,7 @@ import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.generator.GridEntryInfo; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -10,7 +11,8 @@ public interface VeinBufferPopulator extends IVeinPopulator { - void populateBlockBuffer(Random random, GridEntryInfo gridEntryInfo, IBlockModifierAccess modifier, OreDepositDefinition depositDefinition); + void populateBlockBuffer(Random random, GridEntryInfo gridEntryInfo, IBlockModifierAccess modifier, + OreDepositDefinition depositDefinition); IBlockState getBlockByIndex(World world, BlockPos pos, int index); } diff --git a/src/main/java/gregtech/api/worldgen/populator/VeinChunkPopulator.java b/src/main/java/gregtech/api/worldgen/populator/VeinChunkPopulator.java index f4f69f02a23..09e2b3a9ea5 100644 --- a/src/main/java/gregtech/api/worldgen/populator/VeinChunkPopulator.java +++ b/src/main/java/gregtech/api/worldgen/populator/VeinChunkPopulator.java @@ -2,11 +2,13 @@ import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.generator.GridEntryInfo; + import net.minecraft.world.World; import java.util.Random; public interface VeinChunkPopulator extends IVeinPopulator { - void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, GridEntryInfo gridEntryInfo); + void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, + GridEntryInfo gridEntryInfo); } diff --git a/src/main/java/gregtech/api/worldgen/shape/EllipsoidGenerator.java b/src/main/java/gregtech/api/worldgen/shape/EllipsoidGenerator.java index 3a0af9c1eaa..c5c2fe57568 100644 --- a/src/main/java/gregtech/api/worldgen/shape/EllipsoidGenerator.java +++ b/src/main/java/gregtech/api/worldgen/shape/EllipsoidGenerator.java @@ -1,9 +1,11 @@ package gregtech.api.worldgen.shape; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.OreConfigUtils; + import net.minecraft.util.math.Vec3i; +import com.google.gson.JsonObject; + import java.util.Random; public class EllipsoidGenerator extends ShapeGenerator { @@ -11,8 +13,7 @@ public class EllipsoidGenerator extends ShapeGenerator { private int radiusMin; private int radiusMax; - public EllipsoidGenerator() { - } + public EllipsoidGenerator() {} @Override public void loadFromConfig(JsonObject object) { diff --git a/src/main/java/gregtech/api/worldgen/shape/LayeredGenerator.java b/src/main/java/gregtech/api/worldgen/shape/LayeredGenerator.java index 5cb1e53c048..7372c9457ba 100644 --- a/src/main/java/gregtech/api/worldgen/shape/LayeredGenerator.java +++ b/src/main/java/gregtech/api/worldgen/shape/LayeredGenerator.java @@ -1,15 +1,15 @@ package gregtech.api.worldgen.shape; +import net.minecraft.util.math.Vec3i; + import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import net.minecraft.util.math.Vec3i; public class LayeredGenerator extends EllipsoidGenerator { private int yRadius; - public LayeredGenerator() { - } + public LayeredGenerator() {} @Override public void loadFromConfig(JsonObject object) { diff --git a/src/main/java/gregtech/api/worldgen/shape/PlateGenerator.java b/src/main/java/gregtech/api/worldgen/shape/PlateGenerator.java index ad1f6f443e3..7ceb052e67d 100644 --- a/src/main/java/gregtech/api/worldgen/shape/PlateGenerator.java +++ b/src/main/java/gregtech/api/worldgen/shape/PlateGenerator.java @@ -1,9 +1,11 @@ package gregtech.api.worldgen.shape; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.OreConfigUtils; + import net.minecraft.util.math.Vec3i; +import com.google.gson.JsonObject; + import java.util.Random; public class PlateGenerator extends ShapeGenerator { @@ -17,8 +19,7 @@ public class PlateGenerator extends ShapeGenerator { private float floorSharpness; private float roofSharpness; - public PlateGenerator() { - } + public PlateGenerator() {} @Override public void loadFromConfig(JsonObject object) { diff --git a/src/main/java/gregtech/api/worldgen/shape/ShapeGenerator.java b/src/main/java/gregtech/api/worldgen/shape/ShapeGenerator.java index e00c86b514b..c35c7f7baf9 100644 --- a/src/main/java/gregtech/api/worldgen/shape/ShapeGenerator.java +++ b/src/main/java/gregtech/api/worldgen/shape/ShapeGenerator.java @@ -1,8 +1,9 @@ package gregtech.api.worldgen.shape; -import com.google.gson.JsonObject; import net.minecraft.util.math.Vec3i; +import com.google.gson.JsonObject; + import java.util.Random; public abstract class ShapeGenerator { diff --git a/src/main/java/gregtech/api/worldgen/shape/SingleBlockGenerator.java b/src/main/java/gregtech/api/worldgen/shape/SingleBlockGenerator.java index eb84444f3dc..ac77299c6bb 100644 --- a/src/main/java/gregtech/api/worldgen/shape/SingleBlockGenerator.java +++ b/src/main/java/gregtech/api/worldgen/shape/SingleBlockGenerator.java @@ -1,10 +1,12 @@ package gregtech.api.worldgen.shape; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.OreConfigUtils; + import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos.MutableBlockPos; import net.minecraft.util.math.Vec3i; + +import com.google.gson.JsonObject; import org.apache.commons.lang3.ArrayUtils; import java.util.Random; @@ -14,8 +16,7 @@ public class SingleBlockGenerator extends ShapeGenerator { private int minBlocksCount; private int maxBlocksCount; - public SingleBlockGenerator() { - } + public SingleBlockGenerator() {} public SingleBlockGenerator(int minBlocksCount, int maxBlocksCount) { this.minBlocksCount = minBlocksCount; @@ -37,7 +38,8 @@ public Vec3i getMaxSize() { @Override public void generate(Random gridRandom, IBlockGeneratorAccess relativeBlockAccess) { MutableBlockPos relativePos = new MutableBlockPos(); - int blocksCount = minBlocksCount == maxBlocksCount ? maxBlocksCount : minBlocksCount + gridRandom.nextInt(maxBlocksCount - minBlocksCount); + int blocksCount = minBlocksCount == maxBlocksCount ? maxBlocksCount : + minBlocksCount + gridRandom.nextInt(maxBlocksCount - minBlocksCount); EnumFacing prevDirection = null; for (int i = 0; i < blocksCount; i++) { EnumFacing[] allowedFacings = ArrayUtils.removeElement(EnumFacing.VALUES, prevDirection); diff --git a/src/main/java/gregtech/api/worldgen/shape/SphereGenerator.java b/src/main/java/gregtech/api/worldgen/shape/SphereGenerator.java index dde72305ebd..e774723d9e9 100644 --- a/src/main/java/gregtech/api/worldgen/shape/SphereGenerator.java +++ b/src/main/java/gregtech/api/worldgen/shape/SphereGenerator.java @@ -1,9 +1,11 @@ package gregtech.api.worldgen.shape; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.OreConfigUtils; + import net.minecraft.util.math.Vec3i; +import com.google.gson.JsonObject; + import java.util.Random; public class SphereGenerator extends ShapeGenerator { @@ -11,8 +13,7 @@ public class SphereGenerator extends ShapeGenerator { private int radiusMin; private int radiusMax; - public SphereGenerator() { - } + public SphereGenerator() {} public SphereGenerator(int radiusMin, int radiusMax) { this.radiusMin = radiusMin; diff --git a/src/main/java/gregtech/asm/GregTechLoadingPlugin.java b/src/main/java/gregtech/asm/GregTechLoadingPlugin.java index 0265b879c43..795e02e9244 100644 --- a/src/main/java/gregtech/asm/GregTechLoadingPlugin.java +++ b/src/main/java/gregtech/asm/GregTechLoadingPlugin.java @@ -7,17 +7,19 @@ import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.SortingIndex; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; -import javax.annotation.Nullable; import java.util.Map; +import javax.annotation.Nullable; + @Name("GregTechLoadingPlugin") @MCVersion(ForgeVersion.mcVersion) @TransformerExclusions("gregtech.asm.") @SortingIndex(1001) public class GregTechLoadingPlugin implements IFMLLoadingPlugin { + @Override public String[] getASMTransformerClass() { - return new String[]{"gregtech.asm.GregTechTransformer"}; + return new String[] { "gregtech.asm.GregTechTransformer" }; } @Override @@ -32,8 +34,7 @@ public String getSetupClass() { } @Override - public void injectData(Map data) { - } + public void injectData(Map data) {} @Override public String getAccessTransformerClass() { diff --git a/src/main/java/gregtech/asm/GregTechTransformer.java b/src/main/java/gregtech/asm/GregTechTransformer.java index 64fa7371ab4..4d98621cfa8 100644 --- a/src/main/java/gregtech/asm/GregTechTransformer.java +++ b/src/main/java/gregtech/asm/GregTechTransformer.java @@ -5,10 +5,12 @@ import gregtech.asm.util.TargetClassVisitor; import gregtech.asm.visitors.*; import gregtech.common.ConfigHolder; + import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.Launch; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; + import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; @@ -33,44 +35,52 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) if (ConfigHolder.recipes.disableConcreteInWorld) { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, ConcretePowderVisitor.TARGET_METHOD, ConcretePowderVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, ConcretePowderVisitor.TARGET_METHOD, + ConcretePowderVisitor::new), 0); return classWriter.toByteArray(); } break; case LayerCustomHeadVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, LayerCustomHeadVisitor.TARGET_METHOD, LayerCustomHeadVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, LayerCustomHeadVisitor.TARGET_METHOD, + LayerCustomHeadVisitor::new), 0); return classWriter.toByteArray(); } case SpecialArmorApplyVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new SpecialArmorClassVisitor(classWriter, SpecialArmorApplyVisitor.TARGET_METHOD, SpecialArmorApplyVisitor::new), 0); + classReader.accept(new SpecialArmorClassVisitor(classWriter, SpecialArmorApplyVisitor.TARGET_METHOD, + SpecialArmorApplyVisitor::new), 0); return classWriter.toByteArray(); } case LayerArmorBaseVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, LayerArmorBaseVisitor.TARGET_METHOD, LayerArmorBaseVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, LayerArmorBaseVisitor.TARGET_METHOD, + LayerArmorBaseVisitor::new), 0); return classWriter.toByteArray(); } case RegionRenderCacheBuilderVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, RegionRenderCacheBuilderVisitor.TARGET_METHOD, RegionRenderCacheBuilderVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, RegionRenderCacheBuilderVisitor.TARGET_METHOD, + RegionRenderCacheBuilderVisitor::new), 0); return classWriter.toByteArray(); } case RenderChunkVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, RenderChunkVisitor.TARGET_METHOD, RenderChunkVisitor::new), 0); + classReader.accept( + new TargetClassVisitor(classWriter, RenderChunkVisitor.TARGET_METHOD, RenderChunkVisitor::new), + 0); return classWriter.toByteArray(); } case EntityRendererVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, EntityRendererVisitor.TARGET_METHOD, EntityRendererVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, EntityRendererVisitor.TARGET_METHOD, + EntityRendererVisitor::new), 0); return classWriter.toByteArray(); } case BlockVisitor.TARGET_CLASS_NAME: { @@ -90,25 +100,30 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) case WorldVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, WorldVisitor.TARGET_METHOD, WorldVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, WorldVisitor.TARGET_METHOD, WorldVisitor::new), + 0); return classWriter.toByteArray(); } case ModelCTMVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, ModelCTMVisitor.TARGET_METHOD, ModelCTMVisitor::new), 0); + classReader.accept( + new TargetClassVisitor(classWriter, ModelCTMVisitor.TARGET_METHOD, ModelCTMVisitor::new), 0); return classWriter.toByteArray(); } case AbstractCTMBakedModelVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, AbstractCTMBakedModelVisitor.TARGET_METHOD, AbstractCTMBakedModelVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, AbstractCTMBakedModelVisitor.TARGET_METHOD, + AbstractCTMBakedModelVisitor::new), 0); return classWriter.toByteArray(); } case LittleTilesVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, LittleTilesVisitor.TARGET_METHOD, LittleTilesVisitor::new), 0); + classReader.accept( + new TargetClassVisitor(classWriter, LittleTilesVisitor.TARGET_METHOD, LittleTilesVisitor::new), + 0); return classWriter.toByteArray(); } case CCLVisitor.TARGET_CLASS_NAME: { @@ -124,9 +139,12 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) // fix NC recipe compat different depending on overhaul vs underhaul ModContainer container = Loader.instance().getIndexedModList().get(GTValues.MODID_NC); if (container.getVersion().contains("2o")) { // overhauled - classReader.accept(new TargetClassVisitor(classWriter, NuclearCraftRecipeHelperVisitor.TARGET_METHOD_NCO, NuclearCraftRecipeHelperVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, + NuclearCraftRecipeHelperVisitor.TARGET_METHOD_NCO, NuclearCraftRecipeHelperVisitor::new), + 0); } else { - classReader.accept(new TargetClassVisitor(classWriter, NuclearCraftRecipeHelperVisitor.TARGET_METHOD_NC, NuclearCraftRecipeHelperVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, + NuclearCraftRecipeHelperVisitor.TARGET_METHOD_NC, NuclearCraftRecipeHelperVisitor::new), 0); } return classWriter.toByteArray(); } @@ -159,19 +177,24 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) case TheOneProbeVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(0); - classReader.accept(new TargetClassVisitor(classWriter, TheOneProbeVisitor.TARGET_METHOD, TheOneProbeVisitor::new), 0); + classReader.accept( + new TargetClassVisitor(classWriter, TheOneProbeVisitor.TARGET_METHOD, TheOneProbeVisitor::new), + 0); return classWriter.toByteArray(); } case MinecraftVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(0); - classReader.accept(new TargetClassVisitor(classWriter, MinecraftVisitor.PROCESS_KEY_F3, MinecraftVisitor::new), ClassReader.EXPAND_FRAMES); + classReader.accept( + new TargetClassVisitor(classWriter, MinecraftVisitor.PROCESS_KEY_F3, MinecraftVisitor::new), + ClassReader.EXPAND_FRAMES); return classWriter.toByteArray(); } case ModelLoaderRegistryVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(0); - classReader.accept(new TargetClassVisitor(classWriter, ModelLoaderRegistryVisitor.TARGET_METHOD, ModelLoaderRegistryVisitor::new), ClassReader.EXPAND_FRAMES); + classReader.accept(new TargetClassVisitor(classWriter, ModelLoaderRegistryVisitor.TARGET_METHOD, + ModelLoaderRegistryVisitor::new), ClassReader.EXPAND_FRAMES); return classWriter.toByteArray(); } } @@ -179,7 +202,8 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) ObfMapping methodMapping = EnchantmentCanApplyVisitor.CLASS_TO_MAPPING_MAP.get(internalName); ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, methodMapping, mv -> new EnchantmentCanApplyVisitor(mv, methodMapping)), ClassReader.EXPAND_FRAMES); + classReader.accept(new TargetClassVisitor(classWriter, methodMapping, + mv -> new EnchantmentCanApplyVisitor(mv, methodMapping)), ClassReader.EXPAND_FRAMES); return classWriter.toByteArray(); } return basicClass; diff --git a/src/main/java/gregtech/asm/hooks/ArmorHooks.java b/src/main/java/gregtech/asm/hooks/ArmorHooks.java index 9708c4d06b5..5eec5ddeff6 100644 --- a/src/main/java/gregtech/asm/hooks/ArmorHooks.java +++ b/src/main/java/gregtech/asm/hooks/ArmorHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.api.items.armor.IArmorItem; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; @@ -9,7 +10,8 @@ @SuppressWarnings("unused") public class ArmorHooks { - public static void damageArmor(float damage, EntityLivingBase entity, NonNullList inventory, DamageSource damageSource) { + public static void damageArmor(float damage, EntityLivingBase entity, NonNullList inventory, + DamageSource damageSource) { double armorDamage = Math.max(1.0F, damage / 4.0F); for (int i = 0; i < inventory.size(); i++) { ItemStack itemStack = inventory.get(i); diff --git a/src/main/java/gregtech/asm/hooks/ArmorRenderHooks.java b/src/main/java/gregtech/asm/hooks/ArmorRenderHooks.java index 5092339a26f..57b6728fc31 100644 --- a/src/main/java/gregtech/asm/hooks/ArmorRenderHooks.java +++ b/src/main/java/gregtech/asm/hooks/ArmorRenderHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.api.items.armor.IArmorItem; + import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.GlStateManager; @@ -28,7 +29,9 @@ public static boolean isArmorItem(ItemStack itemStack, EntityEquipmentSlot slot) return (itemStack.getItem() instanceof IArmorItem && itemStack.getItem().getEquipmentSlot(itemStack) == slot); } - public static void renderArmorLayer(LayerArmorBase layer, EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale, EntityEquipmentSlot slotIn) { + public static void renderArmorLayer(LayerArmorBase layer, EntityLivingBase entity, float limbSwing, + float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, + float headPitch, float scale, EntityEquipmentSlot slotIn) { ItemStack itemStack = entity.getItemStackFromSlot(slotIn); if (isArmorItem(itemStack, slotIn)) { @@ -56,7 +59,8 @@ public static void renderArmorLayer(LayerArmorBase layer, EntityLivin armorModel.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); } if (itemStack.hasEffect()) { - LayerArmorBase.renderEnchantedGlint(layer.renderer, entity, armorModel, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale); + LayerArmorBase.renderEnchantedGlint(layer.renderer, entity, armorModel, limbSwing, limbSwingAmount, + partialTicks, ageInTicks, netHeadYaw, headPitch, scale); } } } @@ -65,13 +69,16 @@ private static boolean isLegSlot(EntityEquipmentSlot equipmentSlot) { return equipmentSlot == EntityEquipmentSlot.LEGS; } - private static ResourceLocation getArmorTexture(EntityLivingBase entity, ItemStack itemStack, EntityEquipmentSlot slot, String type) { + private static ResourceLocation getArmorTexture(EntityLivingBase entity, ItemStack itemStack, + EntityEquipmentSlot slot, String type) { ResourceLocation registryName = itemStack.getItem().getRegistryName(); if (registryName == null) { - throw new IllegalArgumentException("ItemStack " + itemStack.getTranslationKey() + "has a null registry name"); + throw new IllegalArgumentException( + "ItemStack " + itemStack.getTranslationKey() + "has a null registry name"); } - String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", registryName.getNamespace(), registryName.getPath(), + String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", registryName.getNamespace(), + registryName.getPath(), (isLegSlot(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type)); return new ResourceLocation(ForgeHooksClient.getArmorTexture(entity, itemStack, s1, slot, type)); } diff --git a/src/main/java/gregtech/asm/hooks/BlockHooks.java b/src/main/java/gregtech/asm/hooks/BlockHooks.java index 0614ba81f8a..8297a923613 100644 --- a/src/main/java/gregtech/asm/hooks/BlockHooks.java +++ b/src/main/java/gregtech/asm/hooks/BlockHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.client.model.customtexture.CustomTextureBakedModel; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.IBakedModel; @@ -18,12 +19,12 @@ public static Boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull Bloc if (ENABLE) { IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state); if (model instanceof WeightedBakedModel) { - model = ((WeightedBakedModel)model).baseModel; + model = ((WeightedBakedModel) model).baseModel; } Boolean ret; if (model instanceof CustomTextureBakedModel) { - ret = ((CustomTextureBakedModel)model).getModel().canRenderInLayer(state, layer); + ret = ((CustomTextureBakedModel) model).getModel().canRenderInLayer(state, layer); } else { ret = null; } diff --git a/src/main/java/gregtech/asm/hooks/CTMHooks.java b/src/main/java/gregtech/asm/hooks/CTMHooks.java index 97a29daf6e3..33ddc0d7754 100644 --- a/src/main/java/gregtech/asm/hooks/CTMHooks.java +++ b/src/main/java/gregtech/asm/hooks/CTMHooks.java @@ -2,6 +2,7 @@ import gregtech.client.shader.Shaders; import gregtech.client.utils.BloomEffectUtil; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; @@ -24,13 +25,15 @@ public static boolean checkLayerWithOptiFine(boolean canRenderInLayer, byte laye if (layer == BloomEffectUtil.getBloomLayer()) return false; } else if ((layers >> BloomEffectUtil.getBloomLayer().ordinal() & 1) == 1 && layer == BloomEffectUtil.getEffectiveBloomLayer()) { - return true; - } + return true; + } } return canRenderInLayer; } - public static List getQuadsWithOptiFine(List ret, BlockRenderLayer layer, IBakedModel bakedModel, IBlockState state, EnumFacing side, long rand) { + public static List getQuadsWithOptiFine(List ret, BlockRenderLayer layer, + IBakedModel bakedModel, IBlockState state, EnumFacing side, + long rand) { if (Shaders.isOptiFineShaderPackLoaded() && CTMHooks.ENABLE.get() == null) { if (layer == BloomEffectUtil.getBloomLayer()) { return Collections.emptyList(); diff --git a/src/main/java/gregtech/asm/hooks/CTMModHooks.java b/src/main/java/gregtech/asm/hooks/CTMModHooks.java index 02b37430e95..339a94e1ac3 100644 --- a/src/main/java/gregtech/asm/hooks/CTMModHooks.java +++ b/src/main/java/gregtech/asm/hooks/CTMModHooks.java @@ -1,8 +1,10 @@ package gregtech.asm.hooks; import gregtech.api.util.GTLog; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.BlockRenderLayer; + import team.chisel.ctm.api.model.IModelCTM; import team.chisel.ctm.client.model.ModelCTM; @@ -13,7 +15,7 @@ public class CTMModHooks { private static Field layers; - static{ + static { try { layers = ModelCTM.class.getDeclaredField("layers"); layers.setAccessible(true); diff --git a/src/main/java/gregtech/asm/hooks/EnchantmentHooks.java b/src/main/java/gregtech/asm/hooks/EnchantmentHooks.java index caa541ad649..45a9bd9e92a 100644 --- a/src/main/java/gregtech/asm/hooks/EnchantmentHooks.java +++ b/src/main/java/gregtech/asm/hooks/EnchantmentHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.api.items.toolitem.IGTTool; + import net.minecraft.enchantment.Enchantment; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/asm/hooks/JEIHooks.java b/src/main/java/gregtech/asm/hooks/JEIHooks.java index 04be970ac1c..9fd33875382 100644 --- a/src/main/java/gregtech/asm/hooks/JEIHooks.java +++ b/src/main/java/gregtech/asm/hooks/JEIHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.api.util.FluidTooltipUtil; + import net.minecraftforge.fluids.FluidStack; import java.util.List; diff --git a/src/main/java/gregtech/asm/hooks/LittleTilesHooks.java b/src/main/java/gregtech/asm/hooks/LittleTilesHooks.java index c8186bd733d..489cdb69a37 100644 --- a/src/main/java/gregtech/asm/hooks/LittleTilesHooks.java +++ b/src/main/java/gregtech/asm/hooks/LittleTilesHooks.java @@ -1,10 +1,12 @@ package gregtech.asm.hooks; +import gregtech.client.utils.BloomEffectUtil; + +import net.minecraft.util.BlockRenderLayer; + import com.creativemd.creativecore.client.mods.optifine.OptifineHelper; import com.creativemd.littletiles.client.render.cache.LayeredRenderBoxCache; import com.creativemd.littletiles.client.render.tile.LittleRenderBox; -import gregtech.client.utils.BloomEffectUtil; -import net.minecraft.util.BlockRenderLayer; import java.util.Iterator; import java.util.List; @@ -15,8 +17,8 @@ public static LayeredRenderBoxCache initLayeredRenderBoxCache() { return new BloomLayeredRenderBoxCache(); } - public static class BloomLayeredRenderBoxCache extends LayeredRenderBoxCache { + private List solid = null; private List cutout_mipped = null; private List cutout = null; @@ -76,7 +78,7 @@ public void sort() { if (!OptifineHelper.isActive()) return; - for (Iterator iterator = solid.iterator(); iterator.hasNext(); ) { + for (Iterator iterator = solid.iterator(); iterator.hasNext();) { LittleRenderBox littleRenderingCube = iterator.next(); if (littleRenderingCube.needsResorting) { cutout_mipped.add(littleRenderingCube); diff --git a/src/main/java/gregtech/asm/hooks/MinecraftHooks.java b/src/main/java/gregtech/asm/hooks/MinecraftHooks.java index 82588d7b765..01d0fef77d9 100644 --- a/src/main/java/gregtech/asm/hooks/MinecraftHooks.java +++ b/src/main/java/gregtech/asm/hooks/MinecraftHooks.java @@ -2,6 +2,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.util.text.TextComponentTranslation; + import org.lwjgl.input.Keyboard; @SuppressWarnings("unused") diff --git a/src/main/java/gregtech/asm/hooks/RecipeRepairItemHooks.java b/src/main/java/gregtech/asm/hooks/RecipeRepairItemHooks.java index 68835870cf2..7956c412a68 100644 --- a/src/main/java/gregtech/asm/hooks/RecipeRepairItemHooks.java +++ b/src/main/java/gregtech/asm/hooks/RecipeRepairItemHooks.java @@ -1,8 +1,8 @@ package gregtech.asm.hooks; -import com.google.common.collect.Lists; import gregtech.api.items.toolitem.IGTTool; import gregtech.api.items.toolitem.ToolHelper; + import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -10,6 +10,8 @@ import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.event.ForgeEventFactory; +import com.google.common.collect.Lists; + import java.util.List; @SuppressWarnings("unused") @@ -77,7 +79,8 @@ public static ItemStack getCraftingResult(InventoryCrafting inv) { ItemStack first = list.get(0); ItemStack second = list.get(1); - if (first.getItem() == second.getItem() && first.getCount() == 1 && second.getCount() == 1 && first.getItem().isRepairable()) { + if (first.getItem() == second.getItem() && first.getCount() == 1 && second.getCount() == 1 && + first.getItem().isRepairable()) { int j = first.getMaxDamage() - first.getItemDamage(); int k = first.getMaxDamage() - second.getItemDamage(); int l = j + k + first.getMaxDamage() * 5 / 100; diff --git a/src/main/java/gregtech/asm/hooks/RenderChunkHooks.java b/src/main/java/gregtech/asm/hooks/RenderChunkHooks.java index ab4270efae6..89cadb67e6e 100644 --- a/src/main/java/gregtech/asm/hooks/RenderChunkHooks.java +++ b/src/main/java/gregtech/asm/hooks/RenderChunkHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.api.metatileentity.MetaTileEntityHolder; + import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; @@ -9,7 +10,9 @@ @SuppressWarnings("unused") public class RenderChunkHooks { - public static TileEntitySpecialRenderer getRenderer(TileEntityRendererDispatcher renderer, @Nullable TileEntity tileEntityIn) { + + public static TileEntitySpecialRenderer getRenderer(TileEntityRendererDispatcher renderer, + @Nullable TileEntity tileEntityIn) { // TODO if (tileEntityIn instanceof MetaTileEntityHolder && !((MetaTileEntityHolder) tileEntityIn).hasTESR()) { return null; diff --git a/src/main/java/gregtech/asm/hooks/RenderItemHooks.java b/src/main/java/gregtech/asm/hooks/RenderItemHooks.java index 58c477ff347..fa65ac31edd 100644 --- a/src/main/java/gregtech/asm/hooks/RenderItemHooks.java +++ b/src/main/java/gregtech/asm/hooks/RenderItemHooks.java @@ -4,6 +4,7 @@ import gregtech.api.items.toolitem.IGTTool; import gregtech.client.renderer.handler.LampItemOverlayRenderer; import gregtech.client.utils.ToolChargeBarRenderer; + import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; diff --git a/src/main/java/gregtech/asm/hooks/SoundHooks.java b/src/main/java/gregtech/asm/hooks/SoundHooks.java index ec522817890..31bbc697dbb 100644 --- a/src/main/java/gregtech/asm/hooks/SoundHooks.java +++ b/src/main/java/gregtech/asm/hooks/SoundHooks.java @@ -3,6 +3,7 @@ import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.MusicDiscStats; import gregtech.api.items.metaitem.stats.IItemBehaviour; + import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.entity.player.EntityPlayer; @@ -15,13 +16,15 @@ public class SoundHooks { public static void playRecord(IWorldEventListener listener, EntityPlayer player, int type, BlockPos pos, int data) { - if (type == MusicDiscStats.SOUND_TYPE && FMLCommonHandler.instance().getSide().isClient() && listener instanceof RenderGlobal) { + if (type == MusicDiscStats.SOUND_TYPE && FMLCommonHandler.instance().getSide().isClient() && + listener instanceof RenderGlobal) { for (MetaItem metaItem : MetaItem.getMetaItems()) { MetaItem.MetaValueItem valueItem = metaItem.getItem((short) data); if (valueItem != null) { for (IItemBehaviour behavior : valueItem.getBehaviours()) { if (behavior instanceof MusicDiscStats) { - WorldClient world = ObfuscationReflectionHelper.getPrivateValue(RenderGlobal.class, (RenderGlobal)listener, "field_72769_h"); + WorldClient world = ObfuscationReflectionHelper.getPrivateValue(RenderGlobal.class, + (RenderGlobal) listener, "field_72769_h"); world.playRecord(pos, ((MusicDiscStats) behavior).getSound()); return; } diff --git a/src/main/java/gregtech/asm/hooks/TheOneProbeHooks.java b/src/main/java/gregtech/asm/hooks/TheOneProbeHooks.java index 13ce8fd439e..fd83510be73 100644 --- a/src/main/java/gregtech/asm/hooks/TheOneProbeHooks.java +++ b/src/main/java/gregtech/asm/hooks/TheOneProbeHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.api.block.machines.BlockMachine; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; diff --git a/src/main/java/gregtech/asm/util/ObfMapping.java b/src/main/java/gregtech/asm/util/ObfMapping.java index ba34d31954a..194d379ee3a 100644 --- a/src/main/java/gregtech/asm/util/ObfMapping.java +++ b/src/main/java/gregtech/asm/util/ObfMapping.java @@ -1,12 +1,13 @@ package gregtech.asm.util; +import net.minecraft.launchwrapper.Launch; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; + import com.google.common.base.Charsets; import com.google.common.base.Objects; import com.google.common.io.LineProcessor; import com.google.common.io.Resources; -import net.minecraft.launchwrapper.Launch; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.MethodVisitor; @@ -14,7 +15,6 @@ import org.objectweb.asm.commons.Remapper; import org.objectweb.asm.tree.*; -import javax.annotation.Nonnull; import java.io.File; import java.io.IOException; import java.lang.reflect.Field; @@ -22,10 +22,12 @@ import java.util.Map; import java.util.Map.Entry; +import javax.annotation.Nonnull; + /** * @apiNote codechicken.asm.ObfMapping */ -@SuppressWarnings({"unused", "UnstableApiUsage"}) +@SuppressWarnings({ "unused", "UnstableApiUsage" }) public class ObfMapping extends Remapper { public static final ObfRemapper obfMapper = new ObfRemapper(); @@ -69,14 +71,14 @@ public static ObfMapping fromDesc(String s) { if (lastDot < 0) { return new ObfMapping(s, "", ""); } - int sep = s.indexOf('(');//methods + int sep = s.indexOf('(');// methods int sep_end = sep; if (sep < 0) { - sep = s.indexOf(' ');//some stuffs + sep = s.indexOf(' ');// some stuffs sep_end = sep + 1; } if (sep < 0) { - sep = s.indexOf(':');//fields + sep = s.indexOf(':');// fields sep_end = sep + 1; } if (sep < 0) { @@ -246,11 +248,14 @@ public ObfRemapper() { Field rawMethodMapsField = FMLDeobfuscatingRemapper.class.getDeclaredField("rawMethodMaps"); rawFieldMapsField.setAccessible(true); rawMethodMapsField.setAccessible(true); - Map> rawFieldMaps = (Map>) rawFieldMapsField.get(FMLDeobfuscatingRemapper.INSTANCE); - Map> rawMethodMaps = (Map>) rawMethodMapsField.get(FMLDeobfuscatingRemapper.INSTANCE); + Map> rawFieldMaps = (Map>) rawFieldMapsField + .get(FMLDeobfuscatingRemapper.INSTANCE); + Map> rawMethodMaps = (Map>) rawMethodMapsField + .get(FMLDeobfuscatingRemapper.INSTANCE); if (rawFieldMaps == null) { - throw new IllegalStateException("gregtech.asm.util.ObfMapping loaded too early. Make sure all references are in or after the asm transformer load stage"); + throw new IllegalStateException( + "gregtech.asm.util.ObfMapping loaded too early. Make sure all references are in or after the asm transformer load stage"); } for (Map map : rawFieldMaps.values()) { @@ -325,7 +330,7 @@ public static File[] getConfFiles() { File methodCsv = new File(csvDir, "methods.csv"); if (notchSrg.exists() && fieldCsv.exists() && methodCsv.exists()) { - return new File[]{notchSrg, fieldCsv, methodCsv}; + return new File[] { notchSrg, fieldCsv, methodCsv }; } } @@ -363,19 +368,16 @@ public boolean processLine(@Nonnull String line) { public Void getResult() { return null; } - } static { boolean obf = true; try { obf = Launch.classLoader.getClassBytes("net.minecraft.world.World") == null; - } catch (Exception ignored) { - } + } catch (Exception ignored) {} obfuscated = obf; if (!obf) { loadMCPRemapper(); } } - } diff --git a/src/main/java/gregtech/asm/util/TargetClassVisitor.java b/src/main/java/gregtech/asm/util/TargetClassVisitor.java index e8f5fcbca03..5fcbd9fea68 100644 --- a/src/main/java/gregtech/asm/util/TargetClassVisitor.java +++ b/src/main/java/gregtech/asm/util/TargetClassVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.util; import net.minecraftforge.fml.common.FMLLog; + import org.apache.logging.log4j.Level; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.MethodVisitor; @@ -15,7 +16,8 @@ public class TargetClassVisitor extends ClassVisitor { private final Function visitorCreator; private boolean foundMethod = false; - public TargetClassVisitor(ClassVisitor cv, ObfMapping methodKey, Function visitorCreator) { + public TargetClassVisitor(ClassVisitor cv, ObfMapping methodKey, + Function visitorCreator) { super(Opcodes.ASM5, cv); this.methodKey = methodKey.toRuntime(); this.visitorCreator = visitorCreator; @@ -46,7 +48,8 @@ public void visitEnd() { super.visitEnd(); if (!foundMethod) { FMLLog.log("GregTechTransformer", Level.FATAL, "Failed to find method %s in %s.", methodKey, className); - throw new RuntimeException("Failed to patch method " + methodKey + ", loading cannot continue. Check your environment is correct."); + throw new RuntimeException("Failed to patch method " + methodKey + + ", loading cannot continue. Check your environment is correct."); } } } diff --git a/src/main/java/gregtech/asm/visitors/AbstractCTMBakedModelVisitor.java b/src/main/java/gregtech/asm/visitors/AbstractCTMBakedModelVisitor.java index 8298b85e62e..ebc2f40c274 100644 --- a/src/main/java/gregtech/asm/visitors/AbstractCTMBakedModelVisitor.java +++ b/src/main/java/gregtech/asm/visitors/AbstractCTMBakedModelVisitor.java @@ -1,10 +1,12 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class AbstractCTMBakedModelVisitor extends MethodVisitor implements Opcodes { + public static final String TARGET_CLASS_NAME = "team/chisel/ctm/client/model/AbstractCTMBakedModel"; public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_188616_a", @@ -21,7 +23,6 @@ public class AbstractCTMBakedModelVisitor extends MethodVisitor implements Opcod "J" + ")Ljava/util/List;"); - public AbstractCTMBakedModelVisitor(MethodVisitor mv) { super(ASM5, mv); } diff --git a/src/main/java/gregtech/asm/visitors/BlockVisitor.java b/src/main/java/gregtech/asm/visitors/BlockVisitor.java index 5ababbf16b8..272aa8d3944 100644 --- a/src/main/java/gregtech/asm/visitors/BlockVisitor.java +++ b/src/main/java/gregtech/asm/visitors/BlockVisitor.java @@ -1,13 +1,15 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.*; public class BlockVisitor implements Opcodes { public static final String TARGET_CLASS_NAME = "net/minecraft/block/Block"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "canRenderInLayer", "(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/BlockRenderLayer;)Z"); + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "canRenderInLayer", + "(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/BlockRenderLayer;)Z"); private static final String BLOCK_HOOKS_OWNER = "gregtech/asm/hooks/BlockHooks"; private static final String BLOCK_HOOKS_SIGNATURE = "(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/BlockRenderLayer;)Ljava/lang/Boolean;"; @@ -20,10 +22,16 @@ public static ClassNode handleClassNode(ClassNode classNode) { toAdd.add(new VarInsnNode(ALOAD, 1)); // Load state toAdd.add(new VarInsnNode(ALOAD, 2)); // Load layer // Invoke hook - toAdd.add(new MethodInsnNode(INVOKESTATIC, BLOCK_HOOKS_OWNER, BLOCK_HOOKS_METHOD_NAME, BLOCK_HOOKS_SIGNATURE, false)); + toAdd.add(new MethodInsnNode(INVOKESTATIC, BLOCK_HOOKS_OWNER, BLOCK_HOOKS_METHOD_NAME, + BLOCK_HOOKS_SIGNATURE, false)); toAdd.add(new InsnNode(DUP)); // Copy value on stack, avoids need for local var - toAdd.add(new JumpInsnNode(IFNULL, (LabelNode) m.instructions.getFirst())); // Check if return is null, if it is, jump to vanilla code - toAdd.add(new MethodInsnNode(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false)); // Otherwise evaluate the bool + toAdd.add(new JumpInsnNode(IFNULL, (LabelNode) m.instructions.getFirst())); // Check if return is null, + // if it is, jump to vanilla + // code + toAdd.add(new MethodInsnNode(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false)); // Otherwise + // evaluate + // the + // bool toAdd.add(new InsnNode(IRETURN)); // And return it AbstractInsnNode first = m.instructions.getFirst(); // First vanilla instruction m.instructions.insertBefore(first, toAdd); // Put this before the first instruction (L1 label node) diff --git a/src/main/java/gregtech/asm/visitors/CCLVisitor.java b/src/main/java/gregtech/asm/visitors/CCLVisitor.java index bd92f800329..181a92b796a 100644 --- a/src/main/java/gregtech/asm/visitors/CCLVisitor.java +++ b/src/main/java/gregtech/asm/visitors/CCLVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; diff --git a/src/main/java/gregtech/asm/visitors/ConcretePowderVisitor.java b/src/main/java/gregtech/asm/visitors/ConcretePowderVisitor.java index 8270341820b..6f79f47abda 100644 --- a/src/main/java/gregtech/asm/visitors/ConcretePowderVisitor.java +++ b/src/main/java/gregtech/asm/visitors/ConcretePowderVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; diff --git a/src/main/java/gregtech/asm/visitors/DamageSourceVisitor.java b/src/main/java/gregtech/asm/visitors/DamageSourceVisitor.java index eaf2eb90187..121e459dc8f 100644 --- a/src/main/java/gregtech/asm/visitors/DamageSourceVisitor.java +++ b/src/main/java/gregtech/asm/visitors/DamageSourceVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.*; @@ -28,7 +29,8 @@ public static ClassNode handleClassNode(ClassNode classNode) { if (m.name.equals(TARGET_METHOD_PLAYER.s_name) && m.desc.equals(TARGET_METHOD_PLAYER.s_desc)) { InsnList insns = new InsnList(); insns.add(new VarInsnNode(ALOAD, 0)); - insns.add(new MethodInsnNode(INVOKESTATIC, DAMAGE_SOURCE_OWNER, TARGET_NAME_PLAYER, TARGET_SIGNATURE_PLAYER, false)); + insns.add(new MethodInsnNode(INVOKESTATIC, DAMAGE_SOURCE_OWNER, TARGET_NAME_PLAYER, + TARGET_SIGNATURE_PLAYER, false)); insns.add(new InsnNode(ARETURN)); AbstractInsnNode first = m.instructions.getFirst(); m.instructions.insertBefore(first, insns); @@ -39,7 +41,8 @@ public static ClassNode handleClassNode(ClassNode classNode) { if (m.name.equals(TARGET_METHOD_MOB.s_name) && m.desc.equals(TARGET_METHOD_MOB.s_desc)) { InsnList insns = new InsnList(); insns.add(new VarInsnNode(ALOAD, 0)); - insns.add(new MethodInsnNode(INVOKESTATIC, DAMAGE_SOURCE_OWNER, TARGET_NAME_MOB, TARGET_SIGNATURE_MOB, false)); + insns.add(new MethodInsnNode(INVOKESTATIC, DAMAGE_SOURCE_OWNER, TARGET_NAME_MOB, TARGET_SIGNATURE_MOB, + false)); insns.add(new InsnNode(ARETURN)); AbstractInsnNode first = m.instructions.getFirst(); m.instructions.insertBefore(first, insns); diff --git a/src/main/java/gregtech/asm/visitors/EnchantmentCanApplyVisitor.java b/src/main/java/gregtech/asm/visitors/EnchantmentCanApplyVisitor.java index d49d00c1aea..3b2e69563f9 100644 --- a/src/main/java/gregtech/asm/visitors/EnchantmentCanApplyVisitor.java +++ b/src/main/java/gregtech/asm/visitors/EnchantmentCanApplyVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.commons.AdviceAdapter; @@ -28,7 +29,8 @@ public final class EnchantmentCanApplyVisitor extends AdviceAdapter implements O } private static void createMapping(String className) { - CLASS_TO_MAPPING_MAP.put(className, new ObfMapping(className, "func_92089_a", "(Lnet/minecraft/item/ItemStack;)Z").toRuntime()); + CLASS_TO_MAPPING_MAP.put(className, + new ObfMapping(className, "func_92089_a", "(Lnet/minecraft/item/ItemStack;)Z").toRuntime()); } public EnchantmentCanApplyVisitor(MethodVisitor mv, ObfMapping mapping) { @@ -42,7 +44,9 @@ protected void onMethodExit(int opcode) { visitVarInsn(ALOAD, 1); // load ItemStack visitVarInsn(ALOAD, 0); // load this (Enchantment) visitMethodInsn(INVOKESTATIC, "gregtech/asm/hooks/EnchantmentHooks", "checkTool", - "(ZLnet/minecraft/item/ItemStack;Lnet/minecraft/enchantment/Enchantment;)Z", false); // do GT tool checking logic + "(ZLnet/minecraft/item/ItemStack;Lnet/minecraft/enchantment/Enchantment;)Z", false); // do GT tool + // checking + // logic } } } diff --git a/src/main/java/gregtech/asm/visitors/EntityRendererVisitor.java b/src/main/java/gregtech/asm/visitors/EntityRendererVisitor.java index e54f067c007..a859ff5d4d4 100644 --- a/src/main/java/gregtech/asm/visitors/EntityRendererVisitor.java +++ b/src/main/java/gregtech/asm/visitors/EntityRendererVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -30,7 +31,8 @@ public EntityRendererVisitor(MethodVisitor mv) { @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { - if (opcode == INVOKEVIRTUAL && (METHOD_RENDER_BLOCK_LAYER.matches(name, desc) || METHOD_RENDER_BLOCK_LAYER2.matches(name, desc))) { + if (opcode == INVOKEVIRTUAL && + (METHOD_RENDER_BLOCK_LAYER.matches(name, desc) || METHOD_RENDER_BLOCK_LAYER2.matches(name, desc))) { time++; if (time == 4) { METHOD_BLOOM_HOOKS.visitMethodInsn(this, INVOKESTATIC); @@ -39,5 +41,4 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc, } super.visitMethodInsn(opcode, owner, name, desc, itf); } - } diff --git a/src/main/java/gregtech/asm/visitors/JEIVisitor.java b/src/main/java/gregtech/asm/visitors/JEIVisitor.java index b6a31c0be98..26fc156f89a 100644 --- a/src/main/java/gregtech/asm/visitors/JEIVisitor.java +++ b/src/main/java/gregtech/asm/visitors/JEIVisitor.java @@ -1,13 +1,15 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class JEIVisitor extends MethodVisitor implements Opcodes { public static final String TARGET_CLASS_NAME = "mezz/jei/startup/ForgeModIdHelper"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "addModNameToIngredientTooltip", targetSignature()); + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "addModNameToIngredientTooltip", + targetSignature()); private static final String FLUID_TOOLTIP_OWNER = "gregtech/asm/hooks/JEIHooks"; private static final String FLUID_TOOLTIP_SIGNATURE = tooltipSignature(); @@ -20,19 +22,19 @@ public JEIVisitor(MethodVisitor mv) { // Need to call JEIHooks#addFluidTooltip(List, Object) @Override public void visitCode() { - mv.visitVarInsn(ALOAD, 1); // List tooltip mv.visitVarInsn(ALOAD, 2); // T ingredient // statically call addFluidTooltip(List, Object) - mv.visitMethodInsn(INVOKESTATIC, FLUID_TOOLTIP_OWNER, FLUID_TOOLTIP_METHOD_NAME, FLUID_TOOLTIP_SIGNATURE, false); + mv.visitMethodInsn(INVOKESTATIC, FLUID_TOOLTIP_OWNER, FLUID_TOOLTIP_METHOD_NAME, FLUID_TOOLTIP_SIGNATURE, + false); mv.visitCode(); } - // public List addModNameToIngredientTooltip(List tooltip, E ingredient, IIngredientHelper ingredientHelper) + // public List addModNameToIngredientTooltip(List tooltip, E ingredient, IIngredientHelper + // ingredientHelper) private static String targetSignature() { - return "(" + "Ljava/util/List;" + // List "Ljava/lang/Object;" + // E @@ -42,7 +44,6 @@ private static String targetSignature() { // public void addFluidTooltip(List tooltip, Object ingredient) private static String tooltipSignature() { - return "(" + "Ljava/util/List;" + // List "Ljava/lang/Object;" + // Object diff --git a/src/main/java/gregtech/asm/visitors/LayerArmorBaseVisitor.java b/src/main/java/gregtech/asm/visitors/LayerArmorBaseVisitor.java index 9ab91cb67c5..aef7ff3395e 100644 --- a/src/main/java/gregtech/asm/visitors/LayerArmorBaseVisitor.java +++ b/src/main/java/gregtech/asm/visitors/LayerArmorBaseVisitor.java @@ -1,13 +1,15 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class LayerArmorBaseVisitor extends MethodVisitor implements Opcodes { public static final String TARGET_CLASS_NAME = "net/minecraft/client/renderer/entity/layers/LayerArmorBase"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_188361_a", "(Lnet/minecraft/entity/EntityLivingBase;FFFFFFFLnet/minecraft/inventory/EntityEquipmentSlot;)V"); + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_188361_a", + "(Lnet/minecraft/entity/EntityLivingBase;FFFFFFFLnet/minecraft/inventory/EntityEquipmentSlot;)V"); private static final String ARMOR_HOOKS_OWNER = "gregtech/asm/hooks/ArmorRenderHooks"; private static final String ARMOR_HOOKS_SIGNATURE = "(Lnet/minecraft/client/renderer/entity/layers/LayerArmorBase;Lnet/minecraft/entity/EntityLivingBase;FFFFFFFLnet/minecraft/inventory/EntityEquipmentSlot;)V"; @@ -20,12 +22,14 @@ public LayerArmorBaseVisitor(MethodVisitor mv) { @Override public void visitInsn(int opcode) { if (opcode == Opcodes.RETURN) { - super.visitVarInsn(ALOAD, 0); //this - super.visitVarInsn(ALOAD, 1); //entityLivingBaseIn + super.visitVarInsn(ALOAD, 0); // this + super.visitVarInsn(ALOAD, 1); // entityLivingBaseIn for (int i = 0; i < 7; i++) - super.visitVarInsn(FLOAD, 2 + i); //limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale - super.visitVarInsn(ALOAD, 9); //slotIn - super.visitMethodInsn(INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, ARMOR_HOOKS_SIGNATURE, false); + super.visitVarInsn(FLOAD, 2 + i); // limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, + // headPitch, scale + super.visitVarInsn(ALOAD, 9); // slotIn + super.visitMethodInsn(INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, ARMOR_HOOKS_SIGNATURE, + false); } super.visitInsn(opcode); } diff --git a/src/main/java/gregtech/asm/visitors/LayerCustomHeadVisitor.java b/src/main/java/gregtech/asm/visitors/LayerCustomHeadVisitor.java index 70cea4ee7ba..ce253343216 100644 --- a/src/main/java/gregtech/asm/visitors/LayerCustomHeadVisitor.java +++ b/src/main/java/gregtech/asm/visitors/LayerCustomHeadVisitor.java @@ -2,6 +2,7 @@ import gregtech.asm.util.ObfMapping; import gregtech.asm.util.SafeMethodVisitor; + import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -9,13 +10,14 @@ public class LayerCustomHeadVisitor extends SafeMethodVisitor { public static final String TARGET_CLASS_NAME = "net/minecraft/client/renderer/entity/layers/LayerCustomHead"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_177141_a", "(Lnet/minecraft/entity/EntityLivingBase;FFFFFFF)V"); + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_177141_a", + "(Lnet/minecraft/entity/EntityLivingBase;FFFFFFF)V"); private static final String METHOD_OWNER = "net/minecraft/client/renderer/ItemRenderer"; private static final String METHOD_SIGNATURE = "(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/renderer/block/model/ItemCameraTransforms$TransformType;)V"; private static final String METHOD_NAME = "func_178099_a"; - private static final ObfMapping METHOD_MAPPING = new ObfMapping(METHOD_OWNER, METHOD_NAME, METHOD_SIGNATURE).toRuntime(); - + private static final ObfMapping METHOD_MAPPING = new ObfMapping(METHOD_OWNER, METHOD_NAME, METHOD_SIGNATURE) + .toRuntime(); private static final String ARMOR_HOOKS_OWNER = "gregtech/asm/hooks/ArmorRenderHooks"; private static final String ARMOR_HOOKS_SIGNATURE = "(Lnet/minecraft/entity/EntityLivingBase;)Z"; @@ -26,7 +28,8 @@ public LayerCustomHeadVisitor(MethodVisitor mv) { } private static boolean checkTargetInsn(int opcode, String owner, String name, String desc) { - return opcode == Opcodes.INVOKEVIRTUAL && METHOD_MAPPING.s_owner.equals(owner) && METHOD_MAPPING.matches(name, desc); + return opcode == Opcodes.INVOKEVIRTUAL && METHOD_MAPPING.s_owner.equals(owner) && + METHOD_MAPPING.matches(name, desc); } @Override @@ -35,10 +38,11 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc, markPatchedSuccessfully(); Label endLabel = new Label(); Label skipLabel = new Label(); - super.visitVarInsn(Opcodes.ALOAD, 1); //load entity - super.visitMethodInsn(Opcodes.INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, ARMOR_HOOKS_SIGNATURE, false); + super.visitVarInsn(Opcodes.ALOAD, 1); // load entity + super.visitMethodInsn(Opcodes.INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, + ARMOR_HOOKS_SIGNATURE, false); super.visitJumpInsn(Opcodes.IFEQ, skipLabel); - for (int i = 0; i < 4; i++) super.visitInsn(Opcodes.POP); //pop this, entity, stack, transformType + for (int i = 0; i < 4; i++) super.visitInsn(Opcodes.POP); // pop this, entity, stack, transformType super.visitJumpInsn(Opcodes.GOTO, endLabel); super.visitLabel(skipLabel); super.visitMethodInsn(opcode, owner, name, desc, itf); diff --git a/src/main/java/gregtech/asm/visitors/LittleTilesVisitor.java b/src/main/java/gregtech/asm/visitors/LittleTilesVisitor.java index 7cd27e470f3..a4d09e93ff1 100644 --- a/src/main/java/gregtech/asm/visitors/LittleTilesVisitor.java +++ b/src/main/java/gregtech/asm/visitors/LittleTilesVisitor.java @@ -1,10 +1,12 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class LittleTilesVisitor extends MethodVisitor implements Opcodes { + public static final String TARGET_CLASS_NAME = "com/creativemd/littletiles/client/render/world/TileEntityRenderManager"; public static final ObfMapping TARGET_METHOD = new ObfMapping( TARGET_CLASS_NAME, @@ -26,11 +28,10 @@ public LittleTilesVisitor(MethodVisitor mv) { @Override public void visitInsn(int opcode) { if (opcode == RETURN) { - super.visitVarInsn(ALOAD,0); + super.visitVarInsn(ALOAD, 0); METHOD_LAYER_RENDER_BOX_CACHE_HOOKS.visitMethodInsn(this, INVOKESTATIC); FIELD_LAYER_RENDER_BOX_CACHE.visitFieldInsn(this, PUTFIELD); } super.visitInsn(opcode); } - } diff --git a/src/main/java/gregtech/asm/visitors/MinecraftVisitor.java b/src/main/java/gregtech/asm/visitors/MinecraftVisitor.java index 27f2df3684e..05670191a4a 100644 --- a/src/main/java/gregtech/asm/visitors/MinecraftVisitor.java +++ b/src/main/java/gregtech/asm/visitors/MinecraftVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.commons.AdviceAdapter; diff --git a/src/main/java/gregtech/asm/visitors/ModelCTMVisitor.java b/src/main/java/gregtech/asm/visitors/ModelCTMVisitor.java index e4b3ef7b4ff..06470b38e29 100644 --- a/src/main/java/gregtech/asm/visitors/ModelCTMVisitor.java +++ b/src/main/java/gregtech/asm/visitors/ModelCTMVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -20,7 +21,6 @@ public class ModelCTMVisitor extends MethodVisitor implements Opcodes { "canRenderInLayer", "(Lteam/chisel/ctm/api/model/IModelCTM;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/BlockRenderLayer;)Z"); - public ModelCTMVisitor(MethodVisitor mv) { super(ASM5, mv); } diff --git a/src/main/java/gregtech/asm/visitors/ModelLoaderRegistryVisitor.java b/src/main/java/gregtech/asm/visitors/ModelLoaderRegistryVisitor.java index 29131e8ea5f..7b68ba70bac 100644 --- a/src/main/java/gregtech/asm/visitors/ModelLoaderRegistryVisitor.java +++ b/src/main/java/gregtech/asm/visitors/ModelLoaderRegistryVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import static org.objectweb.asm.Opcodes.*; diff --git a/src/main/java/gregtech/asm/visitors/NuclearCraftRecipeHelperVisitor.java b/src/main/java/gregtech/asm/visitors/NuclearCraftRecipeHelperVisitor.java index 15794c66e56..a70986c67fb 100644 --- a/src/main/java/gregtech/asm/visitors/NuclearCraftRecipeHelperVisitor.java +++ b/src/main/java/gregtech/asm/visitors/NuclearCraftRecipeHelperVisitor.java @@ -1,14 +1,18 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class NuclearCraftRecipeHelperVisitor extends MethodVisitor implements Opcodes { + public static final String TARGET_CLASS_NAME = "nc/integration/gtce/GTCERecipeHelper"; - public static final ObfMapping TARGET_METHOD_NC = new ObfMapping(TARGET_CLASS_NAME, "addGTCERecipe", "(Ljava/lang/String;Lnc/recipe/ProcessorRecipe;)V"); - public static final ObfMapping TARGET_METHOD_NCO = new ObfMapping(TARGET_CLASS_NAME, "addGTCERecipe", "(Ljava/lang/String;Lnc/recipe/BasicRecipe;)V"); + public static final ObfMapping TARGET_METHOD_NC = new ObfMapping(TARGET_CLASS_NAME, "addGTCERecipe", + "(Ljava/lang/String;Lnc/recipe/ProcessorRecipe;)V"); + public static final ObfMapping TARGET_METHOD_NCO = new ObfMapping(TARGET_CLASS_NAME, "addGTCERecipe", + "(Ljava/lang/String;Lnc/recipe/BasicRecipe;)V"); public NuclearCraftRecipeHelperVisitor(MethodVisitor mv) { super(ASM5, mv); @@ -16,7 +20,8 @@ public NuclearCraftRecipeHelperVisitor(MethodVisitor mv) { @Override public void visitFieldInsn(int opcode, String owner, String name, String desc) { - if (opcode == GETSTATIC && name.equals("FLUID_EXTRACTION_RECIPES")) { // FLUID_EXTRACTION_RECIPES -> EXTRACTOR_RECIPES + if (opcode == GETSTATIC && name.equals("FLUID_EXTRACTION_RECIPES")) { // FLUID_EXTRACTION_RECIPES -> + // EXTRACTOR_RECIPES name = "EXTRACTOR_RECIPES"; } super.visitFieldInsn(opcode, owner, name, desc); diff --git a/src/main/java/gregtech/asm/visitors/RecipeRepairItemVisitor.java b/src/main/java/gregtech/asm/visitors/RecipeRepairItemVisitor.java index 88fd9572dc9..94ba37b61c8 100644 --- a/src/main/java/gregtech/asm/visitors/RecipeRepairItemVisitor.java +++ b/src/main/java/gregtech/asm/visitors/RecipeRepairItemVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.*; @@ -33,7 +34,8 @@ public static ClassNode handleClassNode(ClassNode classNode) { if (m.name.equals(MATCHES_METHOD.s_name) && m.desc.equals(MATCHES_METHOD.s_desc)) { InsnList insns = new InsnList(); insns.add(new VarInsnNode(ALOAD, 1)); - insns.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS_NAME, MATCHES_HOOK_METHOD_NAME, MATCHES_HOOK_SIGNATURE, false)); + insns.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS_NAME, MATCHES_HOOK_METHOD_NAME, + MATCHES_HOOK_SIGNATURE, false)); insns.add(new InsnNode(IRETURN)); AbstractInsnNode first = m.instructions.getFirst(); m.instructions.insertBefore(first, insns); @@ -44,7 +46,8 @@ public static ClassNode handleClassNode(ClassNode classNode) { if (m.name.equals(RESULT_METHOD.s_name) && m.desc.equals(RESULT_METHOD.s_desc)) { InsnList insns = new InsnList(); insns.add(new VarInsnNode(ALOAD, 1)); - insns.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS_NAME, RESULT_HOOK_METHOD_NAME, RESULT_HOOK_SIGNATURE, false)); + insns.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS_NAME, RESULT_HOOK_METHOD_NAME, + RESULT_HOOK_SIGNATURE, false)); insns.add(new InsnNode(ARETURN)); AbstractInsnNode first = m.instructions.getFirst(); m.instructions.insertBefore(first, insns); @@ -55,7 +58,8 @@ public static ClassNode handleClassNode(ClassNode classNode) { if (m.name.equals(REMAINING_METHOD.s_name) && m.desc.equals(REMAINING_METHOD.s_desc)) { InsnList insns = new InsnList(); insns.add(new VarInsnNode(ALOAD, 1)); - insns.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS_NAME, REMAINING_HOOK_METHOD_NAME, REMAINING_HOOK_SIGNATURE, false)); + insns.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS_NAME, REMAINING_HOOK_METHOD_NAME, + REMAINING_HOOK_SIGNATURE, false)); insns.add(new InsnNode(ARETURN)); AbstractInsnNode first = m.instructions.getFirst(); m.instructions.insertBefore(first, insns); diff --git a/src/main/java/gregtech/asm/visitors/RegionRenderCacheBuilderVisitor.java b/src/main/java/gregtech/asm/visitors/RegionRenderCacheBuilderVisitor.java index 29d96a60404..27db622cfa3 100644 --- a/src/main/java/gregtech/asm/visitors/RegionRenderCacheBuilderVisitor.java +++ b/src/main/java/gregtech/asm/visitors/RegionRenderCacheBuilderVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -17,16 +18,14 @@ public class RegionRenderCacheBuilderVisitor extends MethodVisitor implements Op "initBloomRenderLayer", "([Lnet/minecraft/client/renderer/BufferBuilder;)V"); - public RegionRenderCacheBuilderVisitor(MethodVisitor mv) { super(ASM5, mv); } - @Override public void visitInsn(int opcode) { if (opcode == RETURN) { - super.visitVarInsn(ALOAD,0); + super.visitVarInsn(ALOAD, 0); FIELD_WORLD_RENDERERS.visitFieldInsn(this, GETFIELD); METHOD_BLOOM_HOOKS.visitMethodInsn(this, INVOKESTATIC); } diff --git a/src/main/java/gregtech/asm/visitors/RenderChunkVisitor.java b/src/main/java/gregtech/asm/visitors/RenderChunkVisitor.java index 0b118a92b22..8f37a9ff9ad 100644 --- a/src/main/java/gregtech/asm/visitors/RenderChunkVisitor.java +++ b/src/main/java/gregtech/asm/visitors/RenderChunkVisitor.java @@ -1,16 +1,20 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class RenderChunkVisitor extends MethodVisitor implements Opcodes { + public static final String TARGET_CLASS_NAME = "net/minecraft/client/renderer/chunk/RenderChunk"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_178581_b", "(FFFLnet/minecraft/client/renderer/chunk/ChunkCompileTaskGenerator;)V"); + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_178581_b", + "(FFFLnet/minecraft/client/renderer/chunk/ChunkCompileTaskGenerator;)V"); private static final ObfMapping METHOD_GET_RENDERER = new ObfMapping( "net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher", "func_147546_a", - "(Lnet/minecraft/tileentity/TileEntity;)Lnet/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer;").toRuntime(); + "(Lnet/minecraft/tileentity/TileEntity;)Lnet/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer;") + .toRuntime(); private static final ObfMapping METHOD_GET_RENDERER_HOOKS = new ObfMapping( "gregtech/asm/hooks/RenderChunkHooks", "getRenderer", @@ -20,7 +24,6 @@ public RenderChunkVisitor(MethodVisitor mv) { super(ASM5, mv); } - @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { if (opcode == INVOKEVIRTUAL && (METHOD_GET_RENDERER.matches(name, desc))) { @@ -29,5 +32,4 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc, } super.visitMethodInsn(opcode, owner, name, desc, itf); } - } diff --git a/src/main/java/gregtech/asm/visitors/RenderItemVisitor.java b/src/main/java/gregtech/asm/visitors/RenderItemVisitor.java index 60c76990991..f1b87a1fc12 100644 --- a/src/main/java/gregtech/asm/visitors/RenderItemVisitor.java +++ b/src/main/java/gregtech/asm/visitors/RenderItemVisitor.java @@ -2,7 +2,9 @@ import gregtech.api.GTValues; import gregtech.asm.util.ObfMapping; + import net.minecraftforge.fml.common.Loader; + import org.objectweb.asm.Label; import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.*; @@ -12,7 +14,8 @@ public class RenderItemVisitor implements Opcodes { public static final String TARGET_CLASS_NAME = "net/minecraft/client/renderer/RenderItem"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_180453_a", "(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V").toRuntime(); // renderItemOverlayIntoGUI + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_180453_a", + "(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V").toRuntime(); // renderItemOverlayIntoGUI public static void transform(Iterator methods) { while (methods.hasNext()) { @@ -22,7 +25,8 @@ public static void transform(Iterator methods) { callRenderLampOverlay.add(new VarInsnNode(ALOAD, 2)); callRenderLampOverlay.add(new VarInsnNode(ILOAD, 3)); callRenderLampOverlay.add(new VarInsnNode(ILOAD, 4)); - callRenderLampOverlay.add(new MethodInsnNode(INVOKESTATIC, "gregtech/asm/hooks/RenderItemHooks", "renderLampOverlay", "(Lnet/minecraft/item/ItemStack;II)V", false)); + callRenderLampOverlay.add(new MethodInsnNode(INVOKESTATIC, "gregtech/asm/hooks/RenderItemHooks", + "renderLampOverlay", "(Lnet/minecraft/item/ItemStack;II)V", false)); boolean enderCoreLoaded = Loader.instance().getIndexedModList().containsKey(GTValues.MODID_ECORE); @@ -33,7 +37,8 @@ public static void transform(Iterator methods) { callRenderElectricBar.add(new VarInsnNode(ALOAD, 2)); callRenderElectricBar.add(new VarInsnNode(ILOAD, 3)); callRenderElectricBar.add(new VarInsnNode(ILOAD, 4)); - callRenderElectricBar.add(new MethodInsnNode(INVOKESTATIC, "gregtech/asm/hooks/RenderItemHooks", "renderElectricBar", "(Lnet/minecraft/item/ItemStack;II)V", false)); + callRenderElectricBar.add(new MethodInsnNode(INVOKESTATIC, "gregtech/asm/hooks/RenderItemHooks", + "renderElectricBar", "(Lnet/minecraft/item/ItemStack;II)V", false)); } else { callRenderElectricBar = null; } diff --git a/src/main/java/gregtech/asm/visitors/SpecialArmorApplyVisitor.java b/src/main/java/gregtech/asm/visitors/SpecialArmorApplyVisitor.java index 6aceeb85ab3..4be3efac79d 100644 --- a/src/main/java/gregtech/asm/visitors/SpecialArmorApplyVisitor.java +++ b/src/main/java/gregtech/asm/visitors/SpecialArmorApplyVisitor.java @@ -2,15 +2,18 @@ import gregtech.asm.util.ObfMapping; import gregtech.asm.util.SafeMethodVisitor; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class SpecialArmorApplyVisitor extends SafeMethodVisitor { public static final String TARGET_CLASS_NAME = "net/minecraftforge/common/ISpecialArmor$ArmorProperties"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "applyArmor", "(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/util/NonNullList;Lnet/minecraft/util/DamageSource;D)F"); + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "applyArmor", + "(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/util/NonNullList;Lnet/minecraft/util/DamageSource;D)F"); - private static final ObfMapping METHOD_MAPPING = new ObfMapping("net/minecraft/util/CombatRules", "func_189427_a", "(FFF)F").toRuntime(); + private static final ObfMapping METHOD_MAPPING = new ObfMapping("net/minecraft/util/CombatRules", "func_189427_a", + "(FFF)F").toRuntime(); private static final String ARMOR_HOOKS_OWNER = "gregtech/asm/hooks/ArmorHooks"; private static final String ARMOR_HOOKS_SIGNATURE = "(FLnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/util/NonNullList;Lnet/minecraft/util/DamageSource;)V"; @@ -21,22 +24,28 @@ public SpecialArmorApplyVisitor(MethodVisitor mv) { } private static boolean checkTargetInsn(int opcode, String owner, String name, String desc) { - return opcode == Opcodes.INVOKESTATIC && METHOD_MAPPING.s_owner.equals(owner) && METHOD_MAPPING.matches(name, desc); + return opcode == Opcodes.INVOKESTATIC && METHOD_MAPPING.s_owner.equals(owner) && + METHOD_MAPPING.matches(name, desc); } @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { if (checkTargetInsn(opcode, owner, name, desc)) { markPatchedSuccessfully(); - super.visitFieldInsn(Opcodes.PUTSTATIC, TARGET_CLASS_NAME, SpecialArmorClassVisitor.CACHED_TOUGHNESS_FIELD_NAME, "F"); //store armorToughness - super.visitFieldInsn(Opcodes.PUTSTATIC, TARGET_CLASS_NAME, SpecialArmorClassVisitor.CACHED_TOTAL_ARMOR_FIELD_NAME, "F"); //store totalArmor - super.visitInsn(Opcodes.DUP); //duplicate damage - super.visitVarInsn(Opcodes.ALOAD, 0); //load entity - super.visitVarInsn(Opcodes.ALOAD, 1); //load inventory - super.visitVarInsn(Opcodes.ALOAD, 2); //load damageSource - super.visitMethodInsn(Opcodes.INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, ARMOR_HOOKS_SIGNATURE, false); //call ArmorHooks - super.visitFieldInsn(Opcodes.GETSTATIC, TARGET_CLASS_NAME, SpecialArmorClassVisitor.CACHED_TOTAL_ARMOR_FIELD_NAME, "F"); //load totalArmor back - super.visitFieldInsn(Opcodes.GETSTATIC, TARGET_CLASS_NAME, SpecialArmorClassVisitor.CACHED_TOUGHNESS_FIELD_NAME, "F"); //load armorToughness back + super.visitFieldInsn(Opcodes.PUTSTATIC, TARGET_CLASS_NAME, + SpecialArmorClassVisitor.CACHED_TOUGHNESS_FIELD_NAME, "F"); // store armorToughness + super.visitFieldInsn(Opcodes.PUTSTATIC, TARGET_CLASS_NAME, + SpecialArmorClassVisitor.CACHED_TOTAL_ARMOR_FIELD_NAME, "F"); // store totalArmor + super.visitInsn(Opcodes.DUP); // duplicate damage + super.visitVarInsn(Opcodes.ALOAD, 0); // load entity + super.visitVarInsn(Opcodes.ALOAD, 1); // load inventory + super.visitVarInsn(Opcodes.ALOAD, 2); // load damageSource + super.visitMethodInsn(Opcodes.INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, + ARMOR_HOOKS_SIGNATURE, false); // call ArmorHooks + super.visitFieldInsn(Opcodes.GETSTATIC, TARGET_CLASS_NAME, + SpecialArmorClassVisitor.CACHED_TOTAL_ARMOR_FIELD_NAME, "F"); // load totalArmor back + super.visitFieldInsn(Opcodes.GETSTATIC, TARGET_CLASS_NAME, + SpecialArmorClassVisitor.CACHED_TOUGHNESS_FIELD_NAME, "F"); // load armorToughness back } super.visitMethodInsn(opcode, owner, name, desc, itf); } diff --git a/src/main/java/gregtech/asm/visitors/SpecialArmorClassVisitor.java b/src/main/java/gregtech/asm/visitors/SpecialArmorClassVisitor.java index c215e166c6c..fbc66c71ab1 100644 --- a/src/main/java/gregtech/asm/visitors/SpecialArmorClassVisitor.java +++ b/src/main/java/gregtech/asm/visitors/SpecialArmorClassVisitor.java @@ -2,6 +2,7 @@ import gregtech.asm.util.ObfMapping; import gregtech.asm.util.TargetClassVisitor; + import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -13,7 +14,8 @@ public class SpecialArmorClassVisitor extends TargetClassVisitor { public static final String CACHED_TOUGHNESS_FIELD_NAME = "gregtech__cachedToughness"; public static final String CACHED_TOTAL_ARMOR_FIELD_NAME = "gregtech__cachedTotalArmor"; - public SpecialArmorClassVisitor(ClassVisitor cv, ObfMapping methodKey, Function visitorCreator) { + public SpecialArmorClassVisitor(ClassVisitor cv, ObfMapping methodKey, + Function visitorCreator) { super(cv, methodKey, visitorCreator); } diff --git a/src/main/java/gregtech/asm/visitors/TheOneProbeVisitor.java b/src/main/java/gregtech/asm/visitors/TheOneProbeVisitor.java index 5ecbce5f5a9..15f7ae71799 100644 --- a/src/main/java/gregtech/asm/visitors/TheOneProbeVisitor.java +++ b/src/main/java/gregtech/asm/visitors/TheOneProbeVisitor.java @@ -1,9 +1,9 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; -import org.objectweb.asm.commons.AdviceAdapter; public class TheOneProbeVisitor extends MethodVisitor implements Opcodes { @@ -19,21 +19,18 @@ public TheOneProbeVisitor(MethodVisitor mv) { @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { - if (opcode == INVOKEVIRTUAL && name.equals(GET_BLOCK_STATE_METHOD.s_name) && desc.equals(GET_BLOCK_STATE_METHOD.s_desc)) { + if (opcode == INVOKEVIRTUAL && name.equals(GET_BLOCK_STATE_METHOD.s_name) && + desc.equals(GET_BLOCK_STATE_METHOD.s_desc)) { visitMethodInsn(INVOKESTATIC, "gregtech/asm/hooks/TheOneProbeHooks", "getActualState", - "(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/state/IBlockState;", false); + "(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/state/IBlockState;", + false); } else super.visitMethodInsn(opcode, owner, name, desc, itf); } private static String getSignature() { - return "(" - + "Lnet/minecraft/entity/player/EntityPlayer;" - + "Lmcjty/theoneprobe/api/ProbeMode;" - + "Lnet/minecraft/world/World;" - + "Lnet/minecraft/util/math/BlockPos;" - + "Lnet/minecraft/util/EnumFacing;" - + "Lnet/minecraft/util/math/Vec3d;" - + "Lnet/minecraft/item/ItemStack;" - + ")Lmcjty/theoneprobe/apiimpl/ProbeInfo;"; + return "(" + "Lnet/minecraft/entity/player/EntityPlayer;" + "Lmcjty/theoneprobe/api/ProbeMode;" + + "Lnet/minecraft/world/World;" + "Lnet/minecraft/util/math/BlockPos;" + + "Lnet/minecraft/util/EnumFacing;" + "Lnet/minecraft/util/math/Vec3d;" + + "Lnet/minecraft/item/ItemStack;" + ")Lmcjty/theoneprobe/apiimpl/ProbeInfo;"; } } diff --git a/src/main/java/gregtech/asm/visitors/WorldVisitor.java b/src/main/java/gregtech/asm/visitors/WorldVisitor.java index 29bf4089c5b..1fc3f5395db 100644 --- a/src/main/java/gregtech/asm/visitors/WorldVisitor.java +++ b/src/main/java/gregtech/asm/visitors/WorldVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -23,7 +24,8 @@ public WorldVisitor(MethodVisitor mv) { @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { - if (opcode == INVOKEINTERFACE && desc.equals("(Lnet/minecraft/entity/player/EntityPlayer;ILnet/minecraft/util/math/BlockPos;I)V")) { + if (opcode == INVOKEINTERFACE && + desc.equals("(Lnet/minecraft/entity/player/EntityPlayer;ILnet/minecraft/util/math/BlockPos;I)V")) { METHOD_PLAY_RECORD_HOOKS.visitMethodInsn(this, INVOKESTATIC); } else { super.visitMethodInsn(opcode, owner, name, desc, itf); diff --git a/src/main/java/gregtech/client/ClientProxy.java b/src/main/java/gregtech/client/ClientProxy.java index ff1404dd5e4..5da0e9f243b 100644 --- a/src/main/java/gregtech/client/ClientProxy.java +++ b/src/main/java/gregtech/client/ClientProxy.java @@ -1,6 +1,5 @@ package gregtech.client; -import codechicken.lib.texture.TextureUtils; import gregtech.api.GTValues; import gregtech.api.fluids.GTFluidRegistration; import gregtech.api.items.metaitem.MetaOreDictItem; @@ -26,6 +25,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; import gregtech.common.items.ToolItems; + import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; @@ -54,13 +54,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.oredict.OreDictionary; + +import codechicken.lib.texture.TextureUtils; import paulscode.sound.SoundSystemConfig; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import java.util.Optional; +import javax.annotation.Nonnull; + @SideOnly(Side.CLIENT) @Mod.EventBusSubscriber(Side.CLIENT) public class ClientProxy extends CommonProxy { @@ -71,9 +74,11 @@ public void onPreLoad() { SoundSystemConfig.setNumberNormalChannels(ConfigHolder.client.maxNumSounds); if (!Loader.isModLoaded(GTValues.MODID_CTM)) { - Minecraft.getMinecraft().metadataSerializer.registerMetadataSectionType(new MetadataSectionCTM.Serializer(), MetadataSectionCTM.class); + Minecraft.getMinecraft().metadataSerializer.registerMetadataSectionType(new MetadataSectionCTM.Serializer(), + MetadataSectionCTM.class); MinecraftForge.EVENT_BUS.register(CustomTextureModelHandler.INSTANCE); - ((SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(CustomTextureModelHandler.INSTANCE); + ((SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()) + .registerReloadListener(CustomTextureModelHandler.INSTANCE); } MetaTileEntityRenderer.preInit(); @@ -120,7 +125,8 @@ public static void addMaterialFormulaHandler(@Nonnull ItemTooltipEvent event) { ItemStack itemStack = event.getItemStack(); if (itemStack.getItem() instanceof ItemBlock) { Block block = ((ItemBlock) itemStack.getItem()).getBlock(); - if (!(block instanceof BlockFrame) && !(block instanceof BlockCompressed) && !(block instanceof IBlockOre) && !(block instanceof IFluidBlock)) { + if (!(block instanceof BlockFrame) && !(block instanceof BlockCompressed) && + !(block instanceof IBlockOre) && !(block instanceof IFluidBlock)) { // Do not apply this tooltip to blocks other than: // - Frames // - Compressed Blocks @@ -139,27 +145,33 @@ public static void addMaterialFormulaHandler(@Nonnull ItemTooltipEvent event) { if (itemStack.getItem() instanceof MetaOreDictItem) { // Test for OreDictItems MetaOreDictItem oreDictItem = (MetaOreDictItem) itemStack.getItem(); Optional oreDictName = OreDictUnifier.getOreDictionaryNames(itemStack).stream().findFirst(); - if (oreDictName.isPresent() && oreDictItem.OREDICT_TO_FORMULA.containsKey(oreDictName.get()) && !oreDictItem.OREDICT_TO_FORMULA.get(oreDictName.get()).isEmpty()) { + if (oreDictName.isPresent() && oreDictItem.OREDICT_TO_FORMULA.containsKey(oreDictName.get()) && + !oreDictItem.OREDICT_TO_FORMULA.get(oreDictName.get()).isEmpty()) { tooltips.add(TextFormatting.YELLOW + oreDictItem.OREDICT_TO_FORMULA.get(oreDictName.get())); } } else if (unificationEntry != null && unificationEntry.material != null) { - if (unificationEntry.material.getChemicalFormula() != null && !unificationEntry.material.getChemicalFormula().isEmpty()) + if (unificationEntry.material.getChemicalFormula() != null && + !unificationEntry.material.getChemicalFormula().isEmpty()) tooltips.add(TextFormatting.YELLOW + unificationEntry.material.getChemicalFormula()); } else if (itemStack.hasTagCompound()) { // Test for Fluids // Vanilla bucket - //noinspection ConstantConditions + // noinspection ConstantConditions tooltips = FluidTooltipUtil.getFluidTooltip(itemStack.getTagCompound().getString("FluidName")); // GTCE Cells, Forestry cans, some other containers if (tooltips == null || tooltips.size() == 0) { - //if (itemStack.getItem() instanceof ItemBlock && ((ItemBlock) itemStack.getItem()).getBlock() == GregTechAPI.MACHINE && itemStack.getItemDamage()) + // if (itemStack.getItem() instanceof ItemBlock && ((ItemBlock) itemStack.getItem()).getBlock() == + // GregTechAPI.MACHINE && itemStack.getItemDamage()) NBTTagCompound compound = itemStack.getTagCompound(); - if (compound != null && compound.hasKey(FluidHandlerItemStack.FLUID_NBT_KEY, Constants.NBT.TAG_COMPOUND)) { - FluidStack fstack = FluidStack.loadFluidStackFromNBT(compound.getCompoundTag(FluidHandlerItemStack.FLUID_NBT_KEY)); + if (compound != null && + compound.hasKey(FluidHandlerItemStack.FLUID_NBT_KEY, Constants.NBT.TAG_COMPOUND)) { + FluidStack fstack = FluidStack + .loadFluidStackFromNBT(compound.getCompoundTag(FluidHandlerItemStack.FLUID_NBT_KEY)); tooltips = FluidTooltipUtil.getFluidTooltip(fstack); } } - } else if (itemStack.getItem().equals(Items.WATER_BUCKET)) { // Water and Lava buckets have a separate registry name from other buckets + } else if (itemStack.getItem().equals(Items.WATER_BUCKET)) { // Water and Lava buckets have a separate registry + // name from other buckets tooltips = FluidTooltipUtil.getFluidTooltip(Materials.Water.getFluid()); } else if (itemStack.getItem().equals(Items.LAVA_BUCKET)) { tooltips = FluidTooltipUtil.getFluidTooltip(Materials.Lava.getFluid()); @@ -173,7 +185,7 @@ public static void addMaterialFormulaHandler(@Nonnull ItemTooltipEvent event) { } } - private static final String[] clearRecipes = new String[]{ + private static final String[] clearRecipes = new String[] { "quantum_tank", "quantum_chest", "super_chest", @@ -205,7 +217,7 @@ public static void addNBTClearingTooltip(ItemTooltipEvent event) { if (stackResult == event.getItemStack()) { if (!stackResult.isEmpty() && ItemStack.areItemsEqual(stackResult, event.getItemStack())) { String unlocalizedName = stackResult.getTranslationKey(); - //noinspection ConstantConditions + // noinspection ConstantConditions String namespace = stackResult.getItem().getRegistryName().getNamespace(); for (String key : clearRecipes) { if (unlocalizedName.contains(key) && namespace.equals(GTValues.MODID)) { @@ -240,15 +252,19 @@ public static void cleanupDebugTooltips(ItemTooltipEvent event) { // Remove durability keys. These can always be removed, as GT puts one of its own in the tooltip already. if (stack.getItem() instanceof IGTTool) { // vanilla durability key - tooltip.remove(I18n.format("item.durability", stack.getMaxDamage() - stack.getItemDamage(), stack.getMaxDamage())); + tooltip.remove(I18n.format("item.durability", stack.getMaxDamage() - stack.getItemDamage(), + stack.getMaxDamage())); // EnderCore durability key - tooltip.remove(net.minecraft.util.text.translation.I18n.translateToLocal("endercore.tooltip.durability") + " " + (stack.getMaxDamage() - stack.getItemDamage()) + "/" + stack.getMaxDamage()); + tooltip.remove( + net.minecraft.util.text.translation.I18n.translateToLocal("endercore.tooltip.durability") + + " " + (stack.getMaxDamage() - stack.getItemDamage()) + "/" + stack.getMaxDamage()); } // MC and EnderCore debug tooltips. Remove these always, as we will format them differently later String nbtTags = null, registryName = null; if (stack.getTagCompound() != null) { - nbtTags = TextFormatting.DARK_GRAY + I18n.format("item.nbt_tags", stack.getTagCompound().getKeySet().size()); + nbtTags = TextFormatting.DARK_GRAY + + I18n.format("item.nbt_tags", stack.getTagCompound().getKeySet().size()); tooltip.remove(nbtTags); } if (stack.getItem().getRegistryName() != null) { @@ -263,7 +279,8 @@ public static void cleanupDebugTooltips(ItemTooltipEvent event) { if (TooltipHelper.isShiftDown()) { int[] oreIds = OreDictionary.getOreIDs(event.getItemStack()); if (oreIds.length > 0) { - tooltip.remove(net.minecraft.util.text.translation.I18n.translateToLocal("endercore.tooltip.oreDictNames")); + tooltip.remove(net.minecraft.util.text.translation.I18n + .translateToLocal("endercore.tooltip.oreDictNames")); for (int i : oreIds) { tooltip.remove(" - " + OreDictionary.getOreName(i)); } @@ -279,9 +296,11 @@ public static void cleanupDebugTooltips(ItemTooltipEvent event) { private static boolean hasActuallyAdvancedInfo(List tooltip) { // Actually Additions Keys - if (tooltip.contains(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + I18n.format("tooltip.actuallyadditions.extraInfo.desc") + ":")) + if (tooltip.contains(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + + I18n.format("tooltip.actuallyadditions.extraInfo.desc") + ":")) return true; - if (tooltip.contains(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + I18n.format("tooltip.actuallyadditions.ctrlForMoreInfo.desc"))) + if (tooltip.contains(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + + I18n.format("tooltip.actuallyadditions.ctrlForMoreInfo.desc"))) return true; // Actually Advanced Info Keys if (tooltip.contains(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + "Advanced Info:")) return true; diff --git a/src/main/java/gregtech/client/event/ClientEventHandler.java b/src/main/java/gregtech/client/event/ClientEventHandler.java index 35f9773cbe3..f8c3b3467ad 100644 --- a/src/main/java/gregtech/client/event/ClientEventHandler.java +++ b/src/main/java/gregtech/client/event/ClientEventHandler.java @@ -1,6 +1,5 @@ package gregtech.client.event; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; import gregtech.api.GTValues; import gregtech.api.items.armor.ArmorMetaItem; import gregtech.api.items.metaitem.MetaItem; @@ -16,7 +15,7 @@ import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.inventory.EntityEquipmentSlot; @@ -33,10 +32,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; import java.util.UUID; +import javax.annotation.Nonnull; + import static gregtech.api.GTValues.CLIENT_TIME; @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/client/event/FluidVisualHandler.java b/src/main/java/gregtech/client/event/FluidVisualHandler.java index 8559f004f6a..01d398c1186 100644 --- a/src/main/java/gregtech/client/event/FluidVisualHandler.java +++ b/src/main/java/gregtech/client/event/FluidVisualHandler.java @@ -3,6 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.fluids.GTFluidBlock; import gregtech.api.util.GTUtility; + import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; @@ -41,7 +42,8 @@ @Mod.EventBusSubscriber(value = Side.CLIENT, modid = GTValues.MODID) public class FluidVisualHandler { - private static final ResourceLocation SUBMERGED_FLUID_OVERLAY = GTUtility.gregtechId("textures/blocks/fluids/submerged_fluid_overlay.png"); + private static final ResourceLocation SUBMERGED_FLUID_OVERLAY = GTUtility + .gregtechId("textures/blocks/fluids/submerged_fluid_overlay.png"); @SubscribeEvent public static void onFOVModifier(@Nonnull EntityViewRenderEvent.FOVModifier event) { @@ -74,7 +76,8 @@ public static void onBlockOverlayRender(@Nonnull RenderBlockOverlayEvent event) final float brightness = player.getBrightness(); GlStateManager.color(brightness * r, brightness * g, brightness * b, 0.5F); GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.pushMatrix(); @@ -129,7 +132,8 @@ public static void onFogColor(@Nonnull EntityViewRenderEvent.FogColors event) { r *= modifier; g *= modifier; b *= modifier; - double modifier2 = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks) * entity.getEntityWorld().provider.getVoidFogYFactor(); + double modifier2 = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks) * + entity.getEntityWorld().provider.getVoidFogYFactor(); if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isPotionActive(MobEffects.BLINDNESS)) { PotionEffect blindness = ((EntityLivingBase) entity).getActivePotionEffect(MobEffects.BLINDNESS); @@ -156,7 +160,8 @@ public static void onFogColor(@Nonnull EntityViewRenderEvent.FogColors event) { } if (renderer.bossColorModifier > 0.0F) { - float bossColor = renderer.bossColorModifierPrev + (renderer.bossColorModifier - renderer.bossColorModifierPrev) * partialTicks; + float bossColor = renderer.bossColorModifierPrev + + (renderer.bossColorModifier - renderer.bossColorModifierPrev) * partialTicks; r = r * (1.0F - bossColor) + r * 0.7F * bossColor; g = g * (1.0F - bossColor) + g * 0.6F * bossColor; b = b * (1.0F - bossColor) + b * 0.6F * bossColor; @@ -201,7 +206,8 @@ public static void onFogDensity(@Nonnull EntityViewRenderEvent.FogDensity event) final Entity entity = event.getEntity(); // again the event is fired at a bad location... - if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isPotionActive(MobEffects.BLINDNESS)) return; + if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isPotionActive(MobEffects.BLINDNESS)) + return; if (renderer.cloudFog) return; GlStateManager.setFog(GlStateManager.FogMode.EXP); diff --git a/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java b/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java index 3bbd8a638b4..99e2a367fde 100644 --- a/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java +++ b/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java @@ -5,7 +5,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.utils.BloomEffectUtil; import gregtech.client.utils.RenderUtil; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -23,19 +23,22 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.function.BooleanSupplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @Mod.EventBusSubscriber(modid = GTValues.MODID, value = Side.CLIENT) public class ActiveVariantBlockBakedModel implements IBakedModel { private static final Map INSTANCES = new Object2ObjectOpenHashMap<>(); - private static final String[] BLOOM_TEXTURE_SUFFIX = {"_bloom", "_emissive", "_bloom_ctm", "_emissive_ctm"}; + private static final String[] BLOOM_TEXTURE_SUFFIX = { "_bloom", "_emissive", "_bloom_ctm", "_emissive_ctm" }; private final ModelResourceLocation inactiveModelLocation; private final ModelResourceLocation activeModelLocation; @@ -44,12 +47,15 @@ public class ActiveVariantBlockBakedModel implements IBakedModel { private final ModelResourceLocation modelLocation; - public ActiveVariantBlockBakedModel(ModelResourceLocation inactiveModelLocation, ModelResourceLocation activeModelLocation, @Nullable BooleanSupplier bloomConfig) { + public ActiveVariantBlockBakedModel(ModelResourceLocation inactiveModelLocation, + ModelResourceLocation activeModelLocation, + @Nullable BooleanSupplier bloomConfig) { this.inactiveModelLocation = inactiveModelLocation; this.activeModelLocation = activeModelLocation; this.bloomConfig = bloomConfig; this.modelLocation = new ModelResourceLocation( - GTUtility.gregtechId("active_variant_block_" + inactiveModelLocation.getNamespace() + "_" + inactiveModelLocation.getPath()), + GTUtility.gregtechId("active_variant_block_" + inactiveModelLocation.getNamespace() + "_" + + inactiveModelLocation.getPath()), inactiveModelLocation.getVariant().replaceAll(",active=(?:true|false)|active=(?:true|false),?", "")); INSTANCES.put(modelLocation, this); } @@ -63,8 +69,8 @@ protected boolean getBloomConfig() { } protected IBakedModel getModel(IBlockState state) { - //Some mods like to call this without getting the extendedBlockState leading to a NPE crash since the - //unlisted ACTIVE property is null. + // Some mods like to call this without getting the extendedBlockState leading to a NPE crash since the + // unlisted ACTIVE property is null. return getModel(Boolean.TRUE.equals(((IExtendedBlockState) state).getValue(VariantActiveBlock.ACTIVE))); } @@ -100,7 +106,8 @@ public List getQuads(@Nullable IBlockState state, @Nullable EnumFacin } } - private static List getBloomQuads(IBakedModel model, @Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + private static List getBloomQuads(IBakedModel model, @Nullable IBlockState state, + @Nullable EnumFacing side, long rand) { List list = new ArrayList<>(); for (BakedQuad q : model.getQuads(state, side, rand)) { for (String bloomTextureSuffix : BLOOM_TEXTURE_SUFFIX) { diff --git a/src/main/java/gregtech/client/model/BorderlessLampBakedModel.java b/src/main/java/gregtech/client/model/BorderlessLampBakedModel.java index 0e04d78d428..d8f61654659 100644 --- a/src/main/java/gregtech/client/model/BorderlessLampBakedModel.java +++ b/src/main/java/gregtech/client/model/BorderlessLampBakedModel.java @@ -2,16 +2,18 @@ import gregtech.client.model.lamp.LampBakedModel; import gregtech.client.utils.RenderUtil; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.EnumFacing; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + public class BorderlessLampBakedModel extends LampBakedModel { // for each 6 side plus "no face" quads diff --git a/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java b/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java index 5362c802ac4..4f00143fdd3 100644 --- a/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java +++ b/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java @@ -4,6 +4,7 @@ import gregtech.client.utils.BloomEffectUtil; import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; @@ -11,11 +12,12 @@ import net.minecraft.util.EnumFacing; import net.minecraftforge.client.MinecraftForgeClient; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.annotation.Nullable; + public class EmissiveOreBakedModel extends OreBakedModel { @SuppressWarnings("unchecked") diff --git a/src/main/java/gregtech/client/model/MaterialStateMapper.java b/src/main/java/gregtech/client/model/MaterialStateMapper.java index 2bfa4271c02..e34034e193d 100644 --- a/src/main/java/gregtech/client/model/MaterialStateMapper.java +++ b/src/main/java/gregtech/client/model/MaterialStateMapper.java @@ -3,6 +3,7 @@ import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.info.MaterialIconType; import gregtech.client.model.modelfactories.MaterialBlockModelLoader; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; diff --git a/src/main/java/gregtech/client/model/ModelFactory.java b/src/main/java/gregtech/client/model/ModelFactory.java index bc8f947d8ef..c865610672d 100644 --- a/src/main/java/gregtech/client/model/ModelFactory.java +++ b/src/main/java/gregtech/client/model/ModelFactory.java @@ -1,8 +1,7 @@ package gregtech.client.model; -import com.google.common.collect.ImmutableMap; import gregtech.api.GTValues; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.client.renderer.block.model.FaceBakery; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; @@ -17,36 +16,50 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.vecmath.Vector3f; +import com.google.common.collect.ImmutableMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.EnumMap; import java.util.Map; import java.util.function.UnaryOperator; +import javax.vecmath.Vector3f; + /** * Revamped from https://github.com/LoliKingdom/Zairyou/blob/main/src/main/java/zone/rong/zairyou/api/client/Bakery.java */ @SideOnly(Side.CLIENT) public class ModelFactory { - private static final Map blockTransformationMap = new EnumMap<>(ItemCameraTransforms.TransformType.class); - private static final Map itemTransformationMap = new EnumMap<>(ItemCameraTransforms.TransformType.class); + private static final Map blockTransformationMap = new EnumMap<>( + ItemCameraTransforms.TransformType.class); + private static final Map itemTransformationMap = new EnumMap<>( + ItemCameraTransforms.TransformType.class); private static FaceBakery INSTANCE; static { blockTransformationMap.put(ItemCameraTransforms.TransformType.GUI, getTransform(0, 0, 0, 30, 225, 0, 0.625f)); blockTransformationMap.put(ItemCameraTransforms.TransformType.GROUND, getTransform(0, 2, 0, 0, 0, 0, 0.25f)); - blockTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, getTransform(0, 0, 0, 0, 45, 0, 0.4f)); - blockTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, getTransform(0, 0, 0, 0, 0, 0, 0.4f)); - blockTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, getTransform(0, 0, 0, 45, 0, 0, 0.4f)); - blockTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, getTransform(0, 0, 0, 45, 0, 0, 0.4f)); + blockTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, + getTransform(0, 0, 0, 0, 45, 0, 0.4f)); + blockTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, + getTransform(0, 0, 0, 0, 0, 0, 0.4f)); + blockTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, + getTransform(0, 0, 0, 45, 0, 0, 0.4f)); + blockTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, + getTransform(0, 0, 0, 45, 0, 0, 0.4f)); itemTransformationMap.put(ItemCameraTransforms.TransformType.GUI, getTransform(0, 0, 0, 0, 0, 0, 1f)); itemTransformationMap.put(ItemCameraTransforms.TransformType.GROUND, getTransform(0, 2, 0, 0, 0, 0, 0.5f)); - itemTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, getTransform(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f)); - itemTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, getTransform(0, 3, 1, 0, 0, 0, 0.55f)); - itemTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, getTransform(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f)); - itemTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, getTransform(0f, 4.0f, 0.5f, 0, 90, -55, 0.85f)); + itemTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, + getTransform(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f)); + itemTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, + getTransform(0, 3, 1, 0, 0, 0, 0.55f)); + itemTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, + getTransform(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f)); + itemTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, + getTransform(0f, 4.0f, 0.5f, 0, 90, -55, 0.85f)); } public static FaceBakery getBakery() { @@ -64,8 +77,10 @@ public static TRSRTransformation getItemTransform(ItemCameraTransforms.Transform return itemTransformationMap.get(transformType); } - private static TRSRTransformation getTransform(float tx, float ty, float tz, float ax, float ay, float az, float s) { - return new TRSRTransformation(new Vector3f(tx / 16, ty / 16, tz / 16), TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)), new Vector3f(s, s, s), null); + private static TRSRTransformation getTransform(float tx, float ty, float tz, float ax, float ay, float az, + float s) { + return new TRSRTransformation(new Vector3f(tx / 16, ty / 16, tz / 16), + TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)), new Vector3f(s, s, s), null); } private final ModelTemplate template; diff --git a/src/main/java/gregtech/client/model/OreBakedModel.java b/src/main/java/gregtech/client/model/OreBakedModel.java index 6300312dd86..20573332ba1 100644 --- a/src/main/java/gregtech/client/model/OreBakedModel.java +++ b/src/main/java/gregtech/client/model/OreBakedModel.java @@ -7,7 +7,7 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.StoneType; import gregtech.api.util.GTUtility; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.*; @@ -20,12 +20,15 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; +import javax.annotation.Nullable; + @Mod.EventBusSubscriber(modid = GTValues.MODID, value = Side.CLIENT) public class OreBakedModel implements IBakedModel { @@ -113,7 +116,8 @@ public static void onModelBake(ModelBakeEvent event) { Map overlayCache = new Object2ObjectOpenHashMap<>(); for (Map.Entry e : ENTRIES.entrySet()) { - IBakedModel overlay = overlayCache.computeIfAbsent(MaterialIconType.ore.getBlockTexturePath(e.getKey().iconSet), + IBakedModel overlay = overlayCache.computeIfAbsent( + MaterialIconType.ore.getBlockTexturePath(e.getKey().iconSet), tex -> new ModelFactory(ModelFactory.ModelTemplate.ORE_OVERLAY) .addSprite("texture", tex) .bake()); diff --git a/src/main/java/gregtech/client/model/SimpleStateMapper.java b/src/main/java/gregtech/client/model/SimpleStateMapper.java index 2be583453b8..c46e8774d4e 100644 --- a/src/main/java/gregtech/client/model/SimpleStateMapper.java +++ b/src/main/java/gregtech/client/model/SimpleStateMapper.java @@ -1,6 +1,5 @@ package gregtech.client.model; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -8,9 +7,12 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; +import javax.annotation.Nonnull; + @SideOnly(Side.CLIENT) public class SimpleStateMapper implements IStateMapper { @@ -23,7 +25,8 @@ public SimpleStateMapper(ModelResourceLocation mrl) { @Override @Nonnull public Map putStateModelLocations(Block block) { - Map map = new Object2ObjectOpenHashMap<>(block.getBlockState().getValidStates().size()); + Map map = new Object2ObjectOpenHashMap<>( + block.getBlockState().getValidStates().size()); for (IBlockState state : block.getBlockState().getValidStates()) { map.put(state, mrl); } diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTexture.java b/src/main/java/gregtech/client/model/customtexture/CustomTexture.java index 4a4a42632da..9221007b552 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTexture.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTexture.java @@ -1,7 +1,5 @@ package gregtech.client.model.customtexture; -import com.google.common.collect.ListMultimap; -import com.google.common.collect.MultimapBuilder; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; @@ -14,21 +12,25 @@ import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.collect.ListMultimap; +import com.google.common.collect.MultimapBuilder; import org.lwjgl.util.vector.Vector; import org.lwjgl.util.vector.Vector2f; import org.lwjgl.util.vector.Vector3f; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; @SideOnly(Side.CLIENT) public class CustomTexture { + private final MetadataSectionCTM meta; public CustomTexture(MetadataSectionCTM meta) { this.meta = meta; - } public BlockRenderLayer getLayer() { @@ -49,9 +51,12 @@ public static BakedQuad rebake(int blockLight, int skyLight, BakedQuad quad) { // Sorry OF users boolean hasLightmap = (blockLight > 0 || skyLight > 0) && !FMLClientHandler.instance().hasOptifine(); if (hasLightmap) { - if (format == DefaultVertexFormats.ITEM) { // ITEM is convertable to BLOCK (replace normal+padding with lmap) + if (format == DefaultVertexFormats.ITEM) { // ITEM is convertable to BLOCK (replace normal+padding with + // lmap) format = DefaultVertexFormats.BLOCK; - } else if (!format.getElements().contains(DefaultVertexFormats.TEX_2S)) { // Otherwise, this format is unknown, add TEX_2S if it does not exist + } else if (!format.getElements().contains(DefaultVertexFormats.TEX_2S)) { // Otherwise, this format is + // unknown, add TEX_2S if it does + // not exist format = new VertexFormat(format).addElement(DefaultVertexFormats.TEX_2S); } } @@ -66,12 +71,13 @@ public static BakedQuad rebake(int blockLight, int skyLight, BakedQuad quad) { for (int v = 0; v < 4; v++) { for (int i = 0; i < format.getElementCount(); i++) { VertexFormatElement ele = format.getElement(i); - //Stuff for Light or UV + // Stuff for Light or UV if (ele.getUsage() == VertexFormatElement.EnumUsage.COLOR) { unpackedBuilder.put(i, 1, 1, 1, 1); } else if (ele.getUsage() == VertexFormatElement.EnumUsage.UV) { if (ele.getIndex() == 1) { - unpackedBuilder.put(i, ((float) blockLight * 0x20) / 0xFFFF, ((float) skyLight * 0x20) / 0xFFFF); + unpackedBuilder.put(i, ((float) blockLight * 0x20) / 0xFFFF, + ((float) skyLight * 0x20) / 0xFFFF); } else if (ele.getIndex() == 0) { Vector2f uv = uvs[v]; unpackedBuilder.put(i, uv.x, uv.y, 0, 1); @@ -92,9 +98,10 @@ public static class Builder implements IVertexConsumer { public int quadTint = -1; public EnumFacing quadOrientation; public boolean applyDiffuseLighting; - public final ListMultimap data = MultimapBuilder.enumKeys(VertexFormatElement.EnumUsage.class).arrayListValues().build(); + public final ListMultimap data = MultimapBuilder + .enumKeys(VertexFormatElement.EnumUsage.class).arrayListValues().build(); - public Builder(VertexFormat vertexFormat, TextureAtlasSprite sprite){ + public Builder(VertexFormat vertexFormat, TextureAtlasSprite sprite) { this.vertexFormat = vertexFormat; this.sprite = sprite; } @@ -120,7 +127,8 @@ public Vector2f[] uvs() { private static T[] fromData(List data, int size) { Vector[] ret = size == 2 ? new Vector2f[data.size()] : new Vector3f[data.size()]; for (int i = 0; i < data.size(); i++) { - ret[i] = size == 2 ? new Vector2f(data.get(i)[0], data.get(i)[1]) : new Vector3f(data.get(i)[0], data.get(i)[1], data.get(i)[2]); + ret[i] = size == 2 ? new Vector2f(data.get(i)[0], data.get(i)[1]) : + new Vector3f(data.get(i)[0], data.get(i)[1], data.get(i)[2]); } return (T[]) ret; } @@ -146,7 +154,7 @@ public void setApplyDiffuseLighting(boolean diffuse) { this.applyDiffuseLighting = diffuse; } - //@Override //soft override, only exists in new forge versions + // @Override //soft override, only exists in new forge versions public void setTexture(@Nullable TextureAtlasSprite texture) {} } } diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTextureBakedModel.java b/src/main/java/gregtech/client/model/customtexture/CustomTextureBakedModel.java index d21ab5f0033..4549eec1590 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTextureBakedModel.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTextureBakedModel.java @@ -1,11 +1,9 @@ package gregtech.client.model.customtexture; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import com.google.common.collect.*; import gregtech.api.util.GTLog; import gregtech.asm.hooks.BlockHooks; import gregtech.asm.hooks.CTMHooks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.*; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -14,38 +12,47 @@ import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import com.google.common.collect.*; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; import java.util.*; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; + @SideOnly(Side.CLIENT) public class CustomTextureBakedModel implements IBakedModel { + private final CustomTextureModel model; private final IBakedModel parent; - public static final Cache MODEL_CACHE = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.MINUTES).maximumSize(5000).build(); + public static final Cache MODEL_CACHE = CacheBuilder + .newBuilder().expireAfterAccess(1, TimeUnit.MINUTES).maximumSize(5000).build(); - protected final ListMultimap genQuads = MultimapBuilder.enumKeys(BlockRenderLayer.class).arrayListValues().build(); - protected final Table> faceQuads = Tables.newCustomTable(Maps.newEnumMap(BlockRenderLayer.class), () -> Maps.newEnumMap(EnumFacing.class)); + protected final ListMultimap genQuads = MultimapBuilder + .enumKeys(BlockRenderLayer.class).arrayListValues().build(); + protected final Table> faceQuads = Tables + .newCustomTable(Maps.newEnumMap(BlockRenderLayer.class), () -> Maps.newEnumMap(EnumFacing.class)); private final EnumMap> noLayerCache = new EnumMap<>(EnumFacing.class); private ImmutableList noSideNoLayerCache; - public CustomTextureBakedModel(CustomTextureModel model, IBakedModel parent){ + public CustomTextureBakedModel(CustomTextureModel model, IBakedModel parent) { this.model = model; this.parent = parent; } public IBakedModel getParent(long rand) { if (parent instanceof WeightedBakedModel) { - return ((WeightedBakedModel)parent).getRandomModel(rand); + return ((WeightedBakedModel) parent).getRandomModel(rand); } return parent; } @@ -77,7 +84,7 @@ private T applyToParent(long rand, Function func protected CustomTextureBakedModel createModel(@Nullable IBlockState state, CustomTextureModel model, long rand) { IBakedModel parent = getParent(rand); while (parent instanceof CustomTextureBakedModel) { - parent = ((CustomTextureBakedModel)parent).getParent(rand); + parent = ((CustomTextureBakedModel) parent).getParent(rand); } CustomTextureBakedModel ret = new CustomTextureBakedModel(model, parent); @@ -108,8 +115,10 @@ protected CustomTextureBakedModel createModel(@Nullable IBlockState state, Custo BlockHooks.ENABLE = false; for (Map.Entry e : textureMap.entrySet()) { - // If the layer is null, this is a wrapped vanilla texture, so passthrough the layer check to the block - if (e.getValue().getLayer() == layer || (e.getValue().getLayer() == null && (state == null || state.getBlock().canRenderInLayer(state, layer)))) { + // If the layer is null, this is a wrapped vanilla texture, so passthrough the layer check to the + // block + if (e.getValue().getLayer() == layer || (e.getValue().getLayer() == null && + (state == null || state.getBlock().canRenderInLayer(state, layer)))) { quads.add(e.getValue().transformQuad(e.getKey())); } } @@ -132,11 +141,12 @@ public List getQuads(@Nullable IBlockState state, @Nullable EnumFacin if (side != null && layer != null) { ret = baked.faceQuads.get(layer, side); } else if (side != null) { - ret = baked.noLayerCache.computeIfAbsent(side, f -> ImmutableList.copyOf(baked.faceQuads.column(f).values() - .stream() - .flatMap(List::stream) - .distinct() - .collect(Collectors.toList()))); + ret = baked.noLayerCache.computeIfAbsent(side, + f -> ImmutableList.copyOf(baked.faceQuads.column(f).values() + .stream() + .flatMap(List::stream) + .distinct() + .collect(Collectors.toList()))); } else if (layer != null) { ret = baked.genQuads.get(layer); } else { @@ -190,12 +200,13 @@ public Pair handlePerspective(@Nonnull ItemCame } private static class State { + private final IBlockState cleanState; private final IBakedModel parent; public State(IBlockState cleanState, IBakedModel parent) { this.cleanState = cleanState; - this. parent = parent; + this.parent = parent; } @Override diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java b/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java index 6b7b4101407..64048153d08 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java @@ -1,10 +1,8 @@ package gregtech.client.model.customtexture; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import gregtech.api.util.GTLog; import gregtech.asm.hooks.CTMHooks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BlockPart; import net.minecraft.client.renderer.block.model.IBakedModel; @@ -20,16 +18,22 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.ParametersAreNonnullByDefault; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + import java.io.IOException; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.util.*; import java.util.function.Function; +import javax.annotation.Nonnull; +import javax.annotation.ParametersAreNonnullByDefault; + @SideOnly(Side.CLIENT) public class CustomTextureModel implements IModel { + private final ModelBlock modelInfo; private final IModel vanillaModel; private Boolean uvLock; @@ -51,14 +55,16 @@ public IModel getVanillaParent() { } public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { - boolean canRenderInLayer = (layers < 0 && state.getBlock().getRenderLayer() == layer) || ((layers >> layer.ordinal()) & 1) == 1; + boolean canRenderInLayer = (layers < 0 && state.getBlock().getRenderLayer() == layer) || + ((layers >> layer.ordinal()) & 1) == 1; return CTMHooks.checkLayerWithOptiFine(canRenderInLayer, layers, layer); } @Override @ParametersAreNonnullByDefault @Nonnull - public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { + public IBakedModel bake(IModelState state, VertexFormat format, + Function bakedTextureGetter) { IBakedModel parent = vanillaModel.bake(state, format, rl -> { TextureAtlasSprite sprite = bakedTextureGetter.apply(rl); MetadataSectionCTM meta = null; @@ -157,7 +163,8 @@ public IModel retexture(@Nonnull ImmutableMap textures) { } } - private static final MethodHandle _asVanillaModel; static { + private static final MethodHandle _asVanillaModel; + static { MethodHandle mh; try { mh = MethodHandles.lookup().unreflect(IModel.class.getMethod("asVanillaModel")); @@ -195,11 +202,13 @@ private CustomTextureModel deepCopy(IModel newParent, Boolean ao, Boolean gui3d) // Deep copy logic taken from ModelLoader$VanillaModelWrapper List parts = new ArrayList<>(); for (BlockPart part : modelInfo.getElements()) { - parts.add(new BlockPart(part.positionFrom, part.positionTo, Maps.newHashMap(part.mapFaces), part.partRotation, part.shade)); + parts.add(new BlockPart(part.positionFrom, part.positionTo, Maps.newHashMap(part.mapFaces), + part.partRotation, part.shade)); } ModelBlock newModel = new ModelBlock(modelInfo.getParentLocation(), parts, - Maps.newHashMap(modelInfo.textures), ao == null ? modelInfo.isAmbientOcclusion() : ao, gui3d == null ? modelInfo.isGui3d() : gui3d, + Maps.newHashMap(modelInfo.textures), ao == null ? modelInfo.isAmbientOcclusion() : ao, + gui3d == null ? modelInfo.isGui3d() : gui3d, modelInfo.getAllTransforms(), Lists.newArrayList(modelInfo.getOverrides())); newModel.name = modelInfo.name; diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTextureModelHandler.java b/src/main/java/gregtech/client/model/customtexture/CustomTextureModelHandler.java index 9bf7286d613..170e8b02802 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTextureModelHandler.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTextureModelHandler.java @@ -1,7 +1,5 @@ package gregtech.client.model.customtexture; -import com.google.common.collect.Sets; -import com.google.gson.JsonParseException; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -21,26 +19,32 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.Sets; +import com.google.gson.JsonParseException; + import java.io.FileNotFoundException; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Copyright CTM. */ @SideOnly(Side.CLIENT) public enum CustomTextureModelHandler implements IResourceManagerReloadListener { + INSTANCE; private final Set wrappedModels = Sets.newHashSet(); @SubscribeEvent(priority = EventPriority.LOWEST) // low priority to capture all event-registered models public void onModelBake(ModelBakeEvent event) { - Map stateModels = ObfuscationReflectionHelper.getPrivateValue(ModelLoader.class, event.getModelLoader(), "stateModels"); + Map stateModels = ObfuscationReflectionHelper.getPrivateValue(ModelLoader.class, + event.getModelLoader(), "stateModels"); for (ModelResourceLocation mrl : event.getModelRegistry().getKeys()) { if (!wrappedModels.contains(mrl)) { IModel rootModel = stateModels.get(mrl); @@ -53,7 +57,8 @@ public void onModelBake(ModelBakeEvent event) { } catch (IOException ignored) {} // Fallthrough if (meta != null) { wrappedModels.add(mrl); - event.getModelRegistry().putObject(mrl, wrap(rootModel, event.getModelRegistry().getObject(mrl))); + event.getModelRegistry().putObject(mrl, + wrap(rootModel, event.getModelRegistry().getObject(mrl))); break; } } @@ -65,7 +70,8 @@ public void onModelBake(ModelBakeEvent event) { @Nonnull private static IBakedModel wrap(IModel model, IBakedModel object) { CustomTextureModel ctm = new CustomTextureModel(null, model); - ctm.bake(TRSRTransformation.identity(), DefaultVertexFormats.ITEM, rl -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(rl.toString())); + ctm.bake(TRSRTransformation.identity(), DefaultVertexFormats.ITEM, + rl -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(rl.toString())); return new CustomTextureBakedModel(ctm, object); } diff --git a/src/main/java/gregtech/client/model/customtexture/MetadataSectionCTM.java b/src/main/java/gregtech/client/model/customtexture/MetadataSectionCTM.java index 6360bf404eb..c903cc12401 100644 --- a/src/main/java/gregtech/client/model/customtexture/MetadataSectionCTM.java +++ b/src/main/java/gregtech/client/model/customtexture/MetadataSectionCTM.java @@ -1,18 +1,21 @@ package gregtech.client.model.customtexture; -import com.google.gson.*; import net.minecraft.client.resources.data.IMetadataSection; import net.minecraft.client.resources.data.IMetadataSectionSerializer; import net.minecraft.util.BlockRenderLayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import com.google.gson.*; + +import java.lang.reflect.Type; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.lang.reflect.Type; @SideOnly(Side.CLIENT) public class MetadataSectionCTM implements IMetadataSection { + public static final String SECTION_NAME = "ctm"; public BlockRenderLayer layer = null; @@ -48,10 +51,12 @@ public static MetadataSectionCTM fromJson(JsonObject obj) throws JsonParseExcept } } else if (extraData.get("light").isJsonObject()) { JsonObject light = extraData.getAsJsonObject("light"); - if (light.has("block") && light.get("block").isJsonPrimitive() && light.getAsJsonPrimitive("block").isNumber()) { + if (light.has("block") && light.get("block").isJsonPrimitive() && + light.getAsJsonPrimitive("block").isNumber()) { ret.blockLight = light.getAsJsonPrimitive("block").getAsInt(); } - if (light.has("sky") && light.get("sky").isJsonPrimitive() && light.getAsJsonPrimitive("sky").isNumber()) { + if (light.has("sky") && light.get("sky").isJsonPrimitive() && + light.getAsJsonPrimitive("sky").isNumber()) { ret.blockLight = light.getAsJsonPrimitive("sky").getAsInt(); } } @@ -64,8 +69,8 @@ public static MetadataSectionCTM fromJson(JsonObject obj) throws JsonParseExcept public static class Serializer implements IMetadataSectionSerializer { @Override - public @Nullable - MetadataSectionCTM deserialize(@Nullable JsonElement json, @Nullable Type typeOfT, @Nullable JsonDeserializationContext context) throws JsonParseException { + public @Nullable MetadataSectionCTM deserialize(@Nullable JsonElement json, @Nullable Type typeOfT, + @Nullable JsonDeserializationContext context) throws JsonParseException { if (json != null && json.isJsonObject()) { JsonObject obj = json.getAsJsonObject(); return MetadataSectionCTM.fromJson(obj); @@ -74,8 +79,7 @@ MetadataSectionCTM deserialize(@Nullable JsonElement json, @Nullable Type typeOf } @Override - public @Nonnull - String getSectionName() { + public @Nonnull String getSectionName() { return SECTION_NAME; } } diff --git a/src/main/java/gregtech/client/model/lamp/LampBakedModel.java b/src/main/java/gregtech/client/model/lamp/LampBakedModel.java index 0a72161fa1a..78d272aae7a 100644 --- a/src/main/java/gregtech/client/model/lamp/LampBakedModel.java +++ b/src/main/java/gregtech/client/model/lamp/LampBakedModel.java @@ -4,7 +4,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.utils.BloomEffectUtil; import gregtech.client.utils.RenderUtil; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.*; @@ -19,14 +19,17 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.*; +import javax.annotation.Nullable; + // TODO could probably be combined with new OreBakedModel or AVBBM @Mod.EventBusSubscriber(modid = GTValues.MODID, value = Side.CLIENT) public class LampBakedModel implements IBakedModel { - private static final String[] BLOOM_TEXTURE_SUFFIX = {"_bloom", "_emissive", "_bloom_ctm", "_emissive_ctm"}; + private static final String[] BLOOM_TEXTURE_SUFFIX = { "_bloom", "_emissive", "_bloom_ctm", "_emissive_ctm" }; private static final Map ENTRIES = new Object2ObjectOpenHashMap<>(); public static Entry register(EnumDyeColor color, LampModelType modelType, boolean bloom, boolean active) { @@ -69,7 +72,8 @@ public List getQuads(@Nullable IBlockState state, @Nullable EnumFacin } } - private List getFilteredQuads(boolean emissive, boolean nonEmissive, @Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + private List getFilteredQuads(boolean emissive, boolean nonEmissive, @Nullable IBlockState state, + @Nullable EnumFacing side, long rand) { if (!emissive && !nonEmissive) return Collections.emptyList(); List quads = new ArrayList<>(); BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer(); diff --git a/src/main/java/gregtech/client/model/lamp/LampModelType.java b/src/main/java/gregtech/client/model/lamp/LampModelType.java index 3e8e6c92ff1..64c91253a0d 100644 --- a/src/main/java/gregtech/client/model/lamp/LampModelType.java +++ b/src/main/java/gregtech/client/model/lamp/LampModelType.java @@ -2,6 +2,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.model.BorderlessLampBakedModel; + import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/gregtech/client/model/modelfactories/BakedModelHandler.java b/src/main/java/gregtech/client/model/modelfactories/BakedModelHandler.java index 3b131ab5bb7..49f9c06a86f 100644 --- a/src/main/java/gregtech/client/model/modelfactories/BakedModelHandler.java +++ b/src/main/java/gregtech/client/model/modelfactories/BakedModelHandler.java @@ -1,8 +1,5 @@ package gregtech.client.model.modelfactories; -import codechicken.lib.render.item.CCRenderItem; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.TransformUtils; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; @@ -28,26 +25,32 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.item.CCRenderItem; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.TransformUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; + @SideOnly(Side.CLIENT) public class BakedModelHandler { private static final StateMapperBase SIMPLE_STATE_MAPPER = new StateMapperBase() { + @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return getSimpleModelLocation(state.getBlock()); } }; - private static final ItemMeshDefinition SIMPLE_MESH_DEFINITION = (stack) -> - getSimpleModelLocation(Block.getBlockFromItem(stack.getItem())); + private static final ItemMeshDefinition SIMPLE_MESH_DEFINITION = (stack) -> getSimpleModelLocation( + Block.getBlockFromItem(stack.getItem())); private static ModelResourceLocation getSimpleModelLocation(Block block) { return new ModelResourceLocation(Block.REGISTRY.getNameForObject(block), ""); @@ -75,7 +78,8 @@ public void onModelsBake(ModelBakeEvent event) { for (BlockFluidBase fluidBlock : fluidBlocks) { Fluid fluid = ObfuscationReflectionHelper.getPrivateValue(BlockFluidBase.class, fluidBlock, "definedFluid"); ModelFluid modelFluid = new ModelFluid(fluid); - IBakedModel bakedModel = modelFluid.bake(modelFluid.getDefaultState(), DefaultVertexFormats.ITEM, TextureUtils::getTexture); + IBakedModel bakedModel = modelFluid.bake(modelFluid.getDefaultState(), DefaultVertexFormats.ITEM, + TextureUtils::getTexture); ModelResourceLocation resourceLocation = getSimpleModelLocation(fluidBlock); event.getModelRegistry().putObject(resourceLocation, bakedModel); } @@ -135,4 +139,3 @@ public Pair handlePerspective(@Nonnull Transfor } } } - diff --git a/src/main/java/gregtech/client/model/modelfactories/MaterialBlockModelLoader.java b/src/main/java/gregtech/client/model/modelfactories/MaterialBlockModelLoader.java index 2b692fec6b4..ddb68081fcc 100644 --- a/src/main/java/gregtech/client/model/modelfactories/MaterialBlockModelLoader.java +++ b/src/main/java/gregtech/client/model/modelfactories/MaterialBlockModelLoader.java @@ -1,13 +1,11 @@ package gregtech.client.model.modelfactories; -import com.google.common.collect.HashBasedTable; -import com.google.common.collect.Table; import gregtech.api.GTValues; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.info.MaterialIconType; import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -21,6 +19,10 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; @Mod.EventBusSubscriber(modid = GTValues.MODID, value = Side.CLIENT) @@ -56,7 +58,8 @@ public static void onTextureStitch(TextureStitchEvent.Pre event) { } } - private static void loadModel(TextureStitchEvent.Pre event, ResourceLocation modelLocation, ModelResourceLocation modelId) { + private static void loadModel(TextureStitchEvent.Pre event, ResourceLocation modelLocation, + ModelResourceLocation modelId) { IModel model; try { model = ModelLoaderRegistry.getModel(modelLocation); @@ -95,8 +98,10 @@ private static final class Entry { this.iconType = iconType; this.iconSet = iconSet; - this.blockModelId = new ModelResourceLocation(GTUtility.gregtechId("material_" + iconType.name + "_" + iconSet.name), "normal"); - this.itemModelId = new ModelResourceLocation(GTUtility.gregtechId("material_" + iconType.name + "_" + iconSet.name), "inventory"); + this.blockModelId = new ModelResourceLocation( + GTUtility.gregtechId("material_" + iconType.name + "_" + iconSet.name), "normal"); + this.itemModelId = new ModelResourceLocation( + GTUtility.gregtechId("material_" + iconType.name + "_" + iconSet.name), "inventory"); } ResourceLocation getBlockModelLocation() { diff --git a/src/main/java/gregtech/client/model/pipeline/VertexLighterFlatSpecial.java b/src/main/java/gregtech/client/model/pipeline/VertexLighterFlatSpecial.java index d896fc3cf7b..75f05440797 100644 --- a/src/main/java/gregtech/client/model/pipeline/VertexLighterFlatSpecial.java +++ b/src/main/java/gregtech/client/model/pipeline/VertexLighterFlatSpecial.java @@ -1,15 +1,17 @@ package gregtech.client.model.pipeline; import gregtech.client.shader.Shaders; + import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraftforge.client.model.pipeline.LightUtil; import net.minecraftforge.client.model.pipeline.VertexLighterFlat; -import javax.vecmath.Vector3f; import java.util.Objects; +import javax.vecmath.Vector3f; + public class VertexLighterFlatSpecial extends VertexLighterFlat { public int tint = -1; @@ -21,7 +23,6 @@ public VertexLighterFlatSpecial(BlockColors colors) { @Override public void setVertexFormat(VertexFormat format) { - if (!Objects.equals(format, baseFormat)) { baseFormat = format; @@ -35,10 +36,10 @@ public void setVertexFormat(VertexFormat format) { updateIndices(); } - } - //This was copied over from VertexLighterFlat because it was private and thus inaccessible from this extended implementation + // This was copied over from VertexLighterFlat because it was private and thus inaccessible from this extended + // implementation private void updateIndices() { for (int i = 0; i < getVertexFormat().getElementCount(); i++) { switch (getVertexFormat().getElement(i).getUsage()) { @@ -70,19 +71,16 @@ private void updateIndices() { } } - //This was copied over from VertexLighterFlat because it needed tweaks to the color handling + // This was copied over from VertexLighterFlat because it needed tweaks to the color handling @Override protected void processQuad() { - float[][] position = quadData[posIndex]; float[][] normal = null; float[][] lightmap = quadData[lightmapIndex]; float[][] color = quadData[colorIndex]; - if (dataLength[normalIndex] >= 3 - && (quadData[normalIndex][0][0] != -1 - || quadData[normalIndex][0][1] != -1 - || quadData[normalIndex][0][2] != -1)) { + if (dataLength[normalIndex] >= 3 && (quadData[normalIndex][0][0] != -1 || quadData[normalIndex][0][1] != -1 || + quadData[normalIndex][0][2] != -1)) { normal = quadData[normalIndex]; } else { // normals must be generated normal = new float[4][4]; @@ -102,7 +100,7 @@ protected void processQuad() { } } - int multiplier = 0xFFFFFFFF;//white + int multiplier = 0xFFFFFFFF;// white if (tint != -1) { multiplier = blockInfo.getColorMultiplier(tint); } @@ -123,7 +121,7 @@ protected void processQuad() { y += normal[v][1] * .5f; z += normal[v][2] * .5f; - color[v][0] = color[v][1] = color[v][2] = color[v][3] = 1.0f;//Default to white + color[v][0] = color[v][1] = color[v][2] = color[v][3] = 1.0f;// Default to white float blockLight = lightmap[v][0]; float skyLight = lightmap[v][1]; @@ -135,7 +133,7 @@ protected void processQuad() { updateColor(normal[v], color[v], x, y, z, tint, multiplier); - //When enabled this causes the rendering to be black with Optifine + // When enabled this causes the rendering to be black with Optifine if (!Shaders.isOptiFineShaderPackLoaded() && diffuse) { float d = LightUtil.diffuseLight(normal[v][0], normal[v][1], normal[v][2]); for (int i = 0; i < 3; i++) { @@ -156,7 +154,7 @@ protected void processQuad() { break; } case COLOR: - //color[v][0] = color[v][1] = color[v][2] = color[v][3] = 1.0f;//Default to white + // color[v][0] = color[v][1] = color[v][2] = color[v][3] = 1.0f;//Default to white parent.put(e, color[v]); break; case UV: @@ -172,8 +170,9 @@ protected void processQuad() { tint = -1; } - //This was copied over from VertexLighterFlat because the tint parameter shouldn't be a float - protected static void updateColor(float[] normal, float[] color, float x, float y, float z, int tint, int multiplier) { + // This was copied over from VertexLighterFlat because the tint parameter shouldn't be a float + protected static void updateColor(float[] normal, float[] color, float x, float y, float z, int tint, + int multiplier) { if (tint != -1) { color[0] *= (float) (multiplier >> 0x10 & 0xFF) / 0xFF; color[1] *= (float) (multiplier >> 0x8 & 0xFF) / 0xFF; @@ -190,5 +189,4 @@ public void setQuadTint(int tint) { public void setApplyDiffuseLighting(boolean diffuse) { this.diffuse = diffuse; } - } diff --git a/src/main/java/gregtech/client/model/pipeline/VertexLighterSmoothAoSpecial.java b/src/main/java/gregtech/client/model/pipeline/VertexLighterSmoothAoSpecial.java index 0c5358688c0..79b83e9998e 100644 --- a/src/main/java/gregtech/client/model/pipeline/VertexLighterSmoothAoSpecial.java +++ b/src/main/java/gregtech/client/model/pipeline/VertexLighterSmoothAoSpecial.java @@ -1,11 +1,12 @@ package gregtech.client.model.pipeline; import gregtech.client.shader.Shaders; + import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.util.math.MathHelper; -//This is a verbatim copy of VertexLighterSmoothAo except with a custom base class. -//Ao Features are disabled when the shader is active. +// This is a verbatim copy of VertexLighterSmoothAo except with a custom base class. +// Ao Features are disabled when the shader is active. public class VertexLighterSmoothAoSpecial extends VertexLighterFlatSpecial { public VertexLighterSmoothAoSpecial(BlockColors colors) { @@ -153,5 +154,4 @@ public void updateBlockInfo() { blockInfo.updateShift(); blockInfo.updateLightMatrix(); } - } diff --git a/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java b/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java index affc28b8c64..a8ef7460fff 100644 --- a/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java +++ b/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java @@ -1,10 +1,10 @@ package gregtech.client.particle; -import codechicken.lib.vec.Vector3; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.client.renderer.IRenderSetup; import gregtech.client.renderer.fx.LaserBeamRenderer; import gregtech.client.utils.EffectRenderContext; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -15,6 +15,8 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; +import codechicken.lib.vec.Vector3; + import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -148,7 +150,7 @@ public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderC ITextureObject bodyTexture = null; if (body != null) { bodyTexture = renderEngine.getTexture(body); - //noinspection ConstantValue + // noinspection ConstantValue if (bodyTexture == null) { bodyTexture = new SimpleTexture(body); renderEngine.loadTexture(body, bodyTexture); @@ -157,7 +159,7 @@ public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderC ITextureObject headTexture = null; if (head != null) { headTexture = renderEngine.getTexture(head); - //noinspection ConstantValue + // noinspection ConstantValue if (headTexture == null) { headTexture = new SimpleTexture(head); renderEngine.loadTexture(head, headTexture); @@ -165,8 +167,10 @@ public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderC } float offset = -emit * (Minecraft.getMinecraft().player.ticksExisted + context.partialTicks()); LaserBeamRenderer.renderRawBeam(bodyTexture == null ? -1 : - bodyTexture.getGlTextureId(), headTexture == null ? -1 : - headTexture.getGlTextureId(), direction, cameraDirection, beamHeight, headWidth, alpha, offset); + bodyTexture.getGlTextureId(), + headTexture == null ? -1 : + headTexture.getGlTextureId(), + direction, cameraDirection, beamHeight, headWidth, alpha, offset); GlStateManager.translate(context.cameraX() - posX, context.cameraY() - posY, context.cameraZ() - posZ); } @@ -214,7 +218,8 @@ public void postDraw(@Nonnull BufferBuilder buffer) { GlStateManager.enableCull(); GlStateManager.disableRescaleNormal(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); - GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); } }; } diff --git a/src/main/java/gregtech/client/particle/GTNameTagParticle.java b/src/main/java/gregtech/client/particle/GTNameTagParticle.java index 6e7dbc03d18..2c4e5251f7c 100644 --- a/src/main/java/gregtech/client/particle/GTNameTagParticle.java +++ b/src/main/java/gregtech/client/particle/GTNameTagParticle.java @@ -2,6 +2,7 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.client.utils.EffectRenderContext; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -9,14 +10,16 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; -import javax.annotation.Nonnull; import java.util.Objects; +import javax.annotation.Nonnull; + public class GTNameTagParticle extends GTParticle { private final MetaTileEntityHolder metaTileEntityHolder; - public GTNameTagParticle(@Nonnull MetaTileEntityHolder metaTileEntityHolder, double posX, double posY, double posZ) { + public GTNameTagParticle(@Nonnull MetaTileEntityHolder metaTileEntityHolder, double posX, double posY, + double posZ) { super(posX, posY, posZ); this.metaTileEntityHolder = Objects.requireNonNull(metaTileEntityHolder); this.setRenderRange(64); @@ -37,8 +40,10 @@ public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderC if (name.isEmpty()) return; Entity renderViewEntity = context.renderViewEntity(); - float rotationYaw = renderViewEntity.prevRotationYaw + (renderViewEntity.rotationYaw - renderViewEntity.prevRotationYaw) * context.partialTicks(); - float rotationPitch = renderViewEntity.prevRotationPitch + (renderViewEntity.rotationPitch - renderViewEntity.prevRotationPitch) * context.partialTicks(); + float rotationYaw = renderViewEntity.prevRotationYaw + + (renderViewEntity.rotationYaw - renderViewEntity.prevRotationYaw) * context.partialTicks(); + float rotationPitch = renderViewEntity.prevRotationPitch + + (renderViewEntity.rotationPitch - renderViewEntity.prevRotationPitch) * context.partialTicks(); GlStateManager.pushMatrix(); GlStateManager.translate(posX - context.cameraX(), posY - context.cameraY(), posZ - context.cameraZ()); @@ -48,7 +53,9 @@ public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderC GlStateManager.scale(-0.025F, -0.025F, 0.025F); GlStateManager.depthMask(false); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); int width = Minecraft.getMinecraft().fontRenderer.getStringWidth(name) / 2; GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); diff --git a/src/main/java/gregtech/client/particle/GTOverheatParticle.java b/src/main/java/gregtech/client/particle/GTOverheatParticle.java index d3e518f5e57..2eb0f55aa9a 100644 --- a/src/main/java/gregtech/client/particle/GTOverheatParticle.java +++ b/src/main/java/gregtech/client/particle/GTOverheatParticle.java @@ -1,6 +1,5 @@ package gregtech.client.particle; -import codechicken.lib.vec.Cuboid6; import gregtech.api.GTValues; import gregtech.client.renderer.IRenderSetup; import gregtech.client.shader.postprocessing.BloomEffect; @@ -10,6 +9,7 @@ import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; import gregtech.common.pipelike.cable.tile.TileEntityCable; + import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -19,11 +19,14 @@ import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.vec.Cuboid6; import org.lwjgl.opengl.GL11; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; /** * @author brachy84 @@ -153,7 +156,8 @@ public static int getBlackBodyColor(int temperature) { protected float alpha = 0; protected int color = blackBodyColors[0]; - public GTOverheatParticle(@Nonnull TileEntityCable tileEntity, int meltTemp, @Nonnull List pipeBoxes, boolean insulated) { + public GTOverheatParticle(@Nonnull TileEntityCable tileEntity, int meltTemp, @Nonnull List pipeBoxes, + boolean insulated) { super(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ()); this.tileEntity = tileEntity; this.meltTemp = meltTemp; diff --git a/src/main/java/gregtech/client/particle/GTParticle.java b/src/main/java/gregtech/client/particle/GTParticle.java index 3a142f040ab..031daaaa7ac 100644 --- a/src/main/java/gregtech/client/particle/GTParticle.java +++ b/src/main/java/gregtech/client/particle/GTParticle.java @@ -2,6 +2,7 @@ import gregtech.client.renderer.IRenderSetup; import gregtech.client.utils.EffectRenderContext; + import net.minecraft.client.renderer.BufferBuilder; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -10,7 +11,8 @@ import javax.annotation.Nullable; /** - * A custom particle implementation with framework for more advanced rendering capabilities.

+ * A custom particle implementation with framework for more advanced rendering capabilities. + *

* GTParticle instances are managed by {@link GTParticleManager}. GTParticle instances with same {@link IRenderSetup}s * will be drawn together as a batch. */ @@ -54,8 +56,9 @@ public final void setExpired() { /** * @return {@code true} to render the particle with - * {@link net.minecraft.client.renderer.GlStateManager#depthMask(boolean) depth mask} feature disabled; in other - * words, render the particle without modifying depth buffer. + * {@link net.minecraft.client.renderer.GlStateManager#depthMask(boolean) depth mask} feature disabled; in + * other + * words, render the particle without modifying depth buffer. */ public boolean shouldDisableDepth() { return false; @@ -63,8 +66,9 @@ public boolean shouldDisableDepth() { /** * @return render range. If the distance between particle and render view entity exceeds this value, the particle - * will not be rendered. If render range is negative value or {@code NaN}, then the check is disabled and the - * particle will be rendered regardless of the distance. + * will not be rendered. If render range is negative value or {@code NaN}, then the check is disabled and + * the + * particle will be rendered regardless of the distance. */ public final double getRenderRange() { return this.renderRange; diff --git a/src/main/java/gregtech/client/particle/GTParticleManager.java b/src/main/java/gregtech/client/particle/GTParticleManager.java index 79a4a7e8b91..cda4ef65828 100644 --- a/src/main/java/gregtech/client/particle/GTParticleManager.java +++ b/src/main/java/gregtech/client/particle/GTParticleManager.java @@ -3,7 +3,7 @@ import gregtech.api.util.GTLog; import gregtech.client.renderer.IRenderSetup; import gregtech.client.utils.EffectRenderContext; -import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.BufferBuilder; @@ -17,12 +17,15 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; -import javax.annotation.Nonnull; import java.util.*; +import javax.annotation.Nonnull; + /** * Singleton class responsible for managing, updating and rendering {@link GTParticle} instances. */ @@ -54,7 +57,8 @@ public void updateEffects() { for (GTParticle particle : newParticleQueue) { var queue = particle.shouldDisableDepth() ? depthDisabledParticles : depthEnabledParticles; - ArrayDeque particles = queue.computeIfAbsent(particle.getRenderSetup(), setup -> new ArrayDeque<>()); + ArrayDeque particles = queue.computeIfAbsent(particle.getRenderSetup(), + setup -> new ArrayDeque<>()); if (particles.size() > 6000) { particles.removeFirst().setExpired(); diff --git a/src/main/java/gregtech/client/renderer/CubeRendererState.java b/src/main/java/gregtech/client/renderer/CubeRendererState.java index 6fd7a465d5b..484046811e9 100644 --- a/src/main/java/gregtech/client/renderer/CubeRendererState.java +++ b/src/main/java/gregtech/client/renderer/CubeRendererState.java @@ -1,16 +1,18 @@ package gregtech.client.renderer; -import codechicken.lib.vec.Cuboid6; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.vec.Cuboid6; + import java.util.Arrays; @SideOnly(Side.CLIENT) public class CubeRendererState { + public final BlockRenderLayer layer; public final boolean[] sideMask; public final IBlockAccess world; diff --git a/src/main/java/gregtech/client/renderer/ICCLBlockRenderer.java b/src/main/java/gregtech/client/renderer/ICCLBlockRenderer.java index 2b079980bd8..f1d70220390 100644 --- a/src/main/java/gregtech/client/renderer/ICCLBlockRenderer.java +++ b/src/main/java/gregtech/client/renderer/ICCLBlockRenderer.java @@ -10,6 +10,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public interface ICCLBlockRenderer { + @SideOnly(Side.CLIENT) void renderItem(ItemStack rawStack, ItemCameraTransforms.TransformType transformType); diff --git a/src/main/java/gregtech/client/renderer/ICubeRenderer.java b/src/main/java/gregtech/client/renderer/ICubeRenderer.java index cb6f3ccb3e3..becc55f7f72 100644 --- a/src/main/java/gregtech/client/renderer/ICubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/ICubeRenderer.java @@ -1,11 +1,7 @@ package gregtech.client.renderer; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.gui.resources.ResourceHelper; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.EnumFacing; @@ -13,6 +9,12 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; + import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -36,30 +38,36 @@ default void render(CCRenderState renderState, Matrix4 translation, IVertexOpera } @SideOnly(Side.CLIENT) - default void renderSided(EnumFacing side, CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { + default void renderSided(EnumFacing side, CCRenderState renderState, Matrix4 translation, + IVertexOperation[] pipeline) { renderSided(side, Cuboid6.full, renderState, pipeline, translation); } @SideOnly(Side.CLIENT) - default void renderSided(EnumFacing side, Cuboid6 bounds, CCRenderState renderState, IVertexOperation[] pipeline, Matrix4 translation) { + default void renderSided(EnumFacing side, Cuboid6 bounds, CCRenderState renderState, IVertexOperation[] pipeline, + Matrix4 translation) { renderOrientedState(renderState, translation, pipeline, bounds, side, false, false); } @SideOnly(Side.CLIENT) - default void renderOriented(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing) { + default void renderOriented(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing) { renderOrientedState(renderState, translation, pipeline, bounds, frontFacing, false, false); } @SideOnly(Side.CLIENT) - default void renderOriented(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing frontFacing) { + default void renderOriented(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + EnumFacing frontFacing) { renderOriented(renderState, translation, pipeline, Cuboid6.full, frontFacing); } @SideOnly(Side.CLIENT) - void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled); + void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled); @SideOnly(Side.CLIENT) - default void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { + default void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { renderOrientedState(renderState, translation, pipeline, Cuboid6.full, frontFacing, isActive, isWorkingEnabled); } diff --git a/src/main/java/gregtech/client/renderer/cclop/ColourOperation.java b/src/main/java/gregtech/client/renderer/cclop/ColourOperation.java index 9f43bfe1565..0018fb0bb1b 100644 --- a/src/main/java/gregtech/client/renderer/cclop/ColourOperation.java +++ b/src/main/java/gregtech/client/renderer/cclop/ColourOperation.java @@ -1,12 +1,14 @@ package gregtech.client.renderer.cclop; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; + @SideOnly(Side.CLIENT) public class ColourOperation implements IVertexOperation { + public static final int operationIndex = CCRenderState.registerOperation(); int colour; diff --git a/src/main/java/gregtech/client/renderer/cclop/LightMapOperation.java b/src/main/java/gregtech/client/renderer/cclop/LightMapOperation.java index 3bb1fb20260..2aa7ce17923 100644 --- a/src/main/java/gregtech/client/renderer/cclop/LightMapOperation.java +++ b/src/main/java/gregtech/client/renderer/cclop/LightMapOperation.java @@ -1,10 +1,11 @@ package gregtech.client.renderer.cclop; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; + /** * Created with IntelliJ IDEA. * @@ -14,6 +15,7 @@ */ @SideOnly(Side.CLIENT) public class LightMapOperation implements IVertexOperation { + public static final int operationIndex = CCRenderState.registerOperation(); int lightmapX; int lightmapY; diff --git a/src/main/java/gregtech/client/renderer/cclop/UVMirror.java b/src/main/java/gregtech/client/renderer/cclop/UVMirror.java index 52c5ba0dd3a..cc1d3a3618f 100644 --- a/src/main/java/gregtech/client/renderer/cclop/UVMirror.java +++ b/src/main/java/gregtech/client/renderer/cclop/UVMirror.java @@ -1,12 +1,14 @@ package gregtech.client.renderer.cclop; -import codechicken.lib.vec.uv.UV; -import codechicken.lib.vec.uv.UVTransformation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.vec.uv.UV; +import codechicken.lib.vec.uv.UVTransformation; + @SideOnly(Side.CLIENT) public class UVMirror extends UVTransformation { + public final double minU; public final double maxU; public final double minV; @@ -37,5 +39,4 @@ public void apply(UV vec) { public UVTransformation inverse() { return null; } - } diff --git a/src/main/java/gregtech/client/renderer/fx/LaserBeamRenderer.java b/src/main/java/gregtech/client/renderer/fx/LaserBeamRenderer.java index 956b9814f0e..32140eedd5d 100644 --- a/src/main/java/gregtech/client/renderer/fx/LaserBeamRenderer.java +++ b/src/main/java/gregtech/client/renderer/fx/LaserBeamRenderer.java @@ -1,6 +1,5 @@ package gregtech.client.renderer.fx; -import codechicken.lib.vec.Vector3; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; @@ -8,14 +7,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.vec.Vector3; + @SideOnly(Side.CLIENT) public class LaserBeamRenderer { /** * Render the Laser Beam. * - * @param texture body texture id. - * @param headTexture head texture id. wont render the head texture if -1. + * @param texture body texture id. + * @param headTexture head texture id. wont render the head texture if -1. * @param direction direction and length vector of laser beam. * @param cameraDirection Vector from the eye to the origin position of the laser. *

@@ -24,12 +25,13 @@ public class LaserBeamRenderer { *

* else render normal vertical quad. *

- * @param beamHeight beam width. - * @param headWidth head width. - * @param alpha alpha. - * @param offset offset of the UV texture. + * @param beamHeight beam width. + * @param headWidth head width. + * @param alpha alpha. + * @param offset offset of the UV texture. */ - public static void renderRawBeam(int texture, int headTexture, Vector3 direction, Vector3 cameraDirection, double beamHeight, double headWidth, float alpha, double offset){ + public static void renderRawBeam(int texture, int headTexture, Vector3 direction, Vector3 cameraDirection, + double beamHeight, double headWidth, float alpha, double offset) { // TODO trick here. should be more strict in the future. if (direction.x == direction.z && direction.x == 0) { direction = direction.copy().add(0.001, 0, 0.001); @@ -42,43 +44,46 @@ public static void renderRawBeam(int texture, int headTexture, Vector3 direction double start = Math.min(headWidth, distance * headWidth); distance -= start; - float degree = (float)Math.toDegrees(new Vector3(direction.x, 0, -direction.z).angle(new Vector3(1,0,0))); + float degree = (float) Math.toDegrees(new Vector3(direction.x, 0, -direction.z).angle(new Vector3(1, 0, 0))); if (direction.z > 0) { degree = -degree; } GlStateManager.pushMatrix(); GlStateManager.rotate(degree, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(90 - (float)Math.toDegrees(direction.copy().angle(new Vector3(0,1,0))), 0, 0, 1); + GlStateManager.rotate(90 - (float) Math.toDegrees(direction.copy().angle(new Vector3(0, 1, 0))), 0, 0, 1); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); if (cameraDirection != null) { // Linear algebra drives me crazy Vector3 v1 = cameraDirection.copy().project(direction).subtract(cameraDirection); - Vector3 v2 = new Vector3(0,1,0).crossProduct(direction); - float rowX = (float)Math.toDegrees(v1.copy().angle(v2)); - if (v1.add(v2).y < 0) rowX = - rowX; + Vector3 v2 = new Vector3(0, 1, 0).crossProduct(direction); + float rowX = (float) Math.toDegrees(v1.copy().angle(v2)); + if (v1.add(v2).y < 0) rowX = -rowX; GlStateManager.rotate(rowX, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 1); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(distance, - beamHeight, 0).tex(offset + distance, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(start, - beamHeight, 0).tex(offset, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance, -beamHeight, 0).tex(offset + distance, 0).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); + bufferbuilder.pos(start, -beamHeight, 0).tex(offset, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(start, beamHeight, 0).tex(offset, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(distance, beamHeight, 0).tex(offset + distance, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance, beamHeight, 0).tex(offset + distance, 1).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); tessellator.draw(); if (headTexture != -1) { // head GlStateManager.bindTexture(headTexture); GlStateManager.glNormal3f(0.0F, 0.0F, 1); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(start, - beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(0, - beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(start, -beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(0, -beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(0, beamHeight, 0).tex(0, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(start, beamHeight, 0).tex(1, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); tessellator.draw(); GlStateManager.glNormal3f(0.0F, 0.0F, 1); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(distance + start, - beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(distance, - beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance + start, -beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); + bufferbuilder.pos(distance, -beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(distance, beamHeight, 0).tex(1, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(distance + start, beamHeight, 0).tex(0, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); tessellator.draw(); @@ -88,10 +93,12 @@ public static void renderRawBeam(int texture, int headTexture, Vector3 direction GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 1); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(distance, - beamHeight, 0).tex(offset + distance, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(start, - beamHeight, 0).tex(offset, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance, -beamHeight, 0).tex(offset + distance, 0).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); + bufferbuilder.pos(start, -beamHeight, 0).tex(offset, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(start, beamHeight, 0).tex(offset, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(distance, beamHeight, 0).tex(offset + distance, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance, beamHeight, 0).tex(offset + distance, 1).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); tessellator.draw(); } @@ -101,8 +108,8 @@ public static void renderRawBeam(int texture, int headTexture, Vector3 direction GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 1); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(start, - beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(0, - beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(start, -beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(0, -beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(0, beamHeight, 0).tex(0, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(start, beamHeight, 0).tex(1, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); tessellator.draw(); @@ -111,10 +118,12 @@ public static void renderRawBeam(int texture, int headTexture, Vector3 direction GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 1); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(distance + start, - beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(distance, - beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance + start, -beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); + bufferbuilder.pos(distance, -beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(distance, beamHeight, 0).tex(1, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(distance + start, beamHeight, 0).tex(0, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance + start, beamHeight, 0).tex(0, 1).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); tessellator.draw(); } } diff --git a/src/main/java/gregtech/client/renderer/handler/BlockPosHighlightRenderer.java b/src/main/java/gregtech/client/renderer/handler/BlockPosHighlightRenderer.java index c7a552ebc41..df5f186744f 100644 --- a/src/main/java/gregtech/client/renderer/handler/BlockPosHighlightRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/BlockPosHighlightRenderer.java @@ -1,6 +1,7 @@ package gregtech.client.renderer.handler; import gregtech.client.utils.RenderBufferHelper; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.renderer.BufferBuilder; @@ -11,6 +12,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) @@ -19,7 +21,6 @@ public class BlockPosHighlightRenderer { private static BlockPos posHighLight; private static long hlEndTime; - public static void renderBlockBoxHighLight(BlockPos blockpos, long durTimeMillis) { posHighLight = blockpos; hlEndTime = System.currentTimeMillis() + durTimeMillis; @@ -55,7 +56,8 @@ public static void renderWorldLastEvent(RenderWorldLastEvent evt) { buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); - RenderBufferHelper.renderCubeFace(buffer, posHighLight.getX(), posHighLight.getY(), posHighLight.getZ(), posHighLight.getX() + 1, posHighLight.getY() + 1, posHighLight.getZ() + 1, 1.0f, 0.0f, 0.0f, 0.8f); + RenderBufferHelper.renderCubeFace(buffer, posHighLight.getX(), posHighLight.getY(), posHighLight.getZ(), + posHighLight.getX() + 1, posHighLight.getY() + 1, posHighLight.getZ() + 1, 1.0f, 0.0f, 0.0f, 0.8f); tessellator.draw(); diff --git a/src/main/java/gregtech/client/renderer/handler/CCLBlockRenderer.java b/src/main/java/gregtech/client/renderer/handler/CCLBlockRenderer.java index c13acb04dd7..5dabff41d6a 100644 --- a/src/main/java/gregtech/client/renderer/handler/CCLBlockRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/CCLBlockRenderer.java @@ -1,19 +1,11 @@ package gregtech.client.renderer.handler; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.block.BlockRenderingRegistry; -import codechicken.lib.render.block.ICCBlockRenderer; -import codechicken.lib.render.item.IItemRenderer; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.TransformUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; import gregtech.api.util.ModCompatibility; import gregtech.client.renderer.ICCLBlockRenderer; import gregtech.client.renderer.texture.Textures; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; @@ -34,9 +26,21 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.block.BlockRenderingRegistry; +import codechicken.lib.render.block.ICCBlockRenderer; +import codechicken.lib.render.item.IItemRenderer; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.TransformUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.uv.IconTransformation; + @SideOnly(Side.CLIENT) public class CCLBlockRenderer implements ICCBlockRenderer, IItemRenderer { - public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation(GTUtility.gregtechId("ccl_block"), "normal"); + + public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation( + GTUtility.gregtechId("ccl_block"), "normal"); public static final CCLBlockRenderer INSTANCE = new CCLBlockRenderer(); public static EnumBlockRenderType BLOCK_RENDER_TYPE; public static Minecraft mc = Minecraft.getMinecraft(); @@ -57,12 +61,12 @@ public void onModelsBake(ModelBakeEvent event) { @Override public void renderItem(ItemStack rawStack, ItemCameraTransforms.TransformType transformType) { ItemStack stack = ModCompatibility.getRealItemStack(rawStack); - if (stack.getItem() instanceof ItemBlock && ((ItemBlock) stack.getItem()).getBlock() instanceof ICCLBlockRenderer) { + if (stack.getItem() instanceof ItemBlock && + ((ItemBlock) stack.getItem()).getBlock() instanceof ICCLBlockRenderer) { ((ICCLBlockRenderer) ((ItemBlock) stack.getItem()).getBlock()).renderItem(stack, transformType); } } - @Override public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) { if (state != null && (state.getBlock() instanceof ICCLBlockRenderer)) { @@ -83,11 +87,11 @@ public boolean isBuiltInRenderer() { } @Override - public void renderBrightness(IBlockState state, float brightness) { - } + public void renderBrightness(IBlockState state, float brightness) {} @Override - public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, BufferBuilder buffer) { + public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, + BufferBuilder buffer) { if (state == null || !(state.getBlock() instanceof ICCLBlockRenderer)) { return; } @@ -96,7 +100,6 @@ public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockStat renderState.bind(buffer); renderState.setPipeline(new Vector3(new Vec3d(pos)).translation(), new IconTransformation(sprite)); codechicken.lib.render.BlockRenderer.renderCuboid(renderState, Cuboid6.full, 0); - } @Override @@ -105,8 +108,7 @@ public TextureAtlasSprite getParticleTexture() { } @Override - public void registerTextures(TextureMap map) { - } + public void registerTextures(TextureMap map) {} @Override public boolean isAmbientOcclusion() { @@ -117,5 +119,4 @@ public boolean isAmbientOcclusion() { public boolean isGui3d() { return true; } - } diff --git a/src/main/java/gregtech/client/renderer/handler/DynamiteRenderer.java b/src/main/java/gregtech/client/renderer/handler/DynamiteRenderer.java index 28a4ce303c2..c6052d576cd 100644 --- a/src/main/java/gregtech/client/renderer/handler/DynamiteRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/DynamiteRenderer.java @@ -2,6 +2,7 @@ import gregtech.common.entities.DynamiteEntity; import gregtech.common.items.MetaItems; + import net.minecraft.client.renderer.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderSnowball; diff --git a/src/main/java/gregtech/client/renderer/handler/FacadeRenderer.java b/src/main/java/gregtech/client/renderer/handler/FacadeRenderer.java index ab760887031..fcd0c3ba523 100644 --- a/src/main/java/gregtech/client/renderer/handler/FacadeRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/FacadeRenderer.java @@ -1,17 +1,5 @@ package gregtech.client.renderer.handler; -import codechicken.lib.colour.Colour; -import codechicken.lib.colour.ColourARGB; -import codechicken.lib.render.CCQuad; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.item.IItemRenderer; -import codechicken.lib.util.TransformUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.uv.UV; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; import gregtech.api.cover.CoverUtil; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.util.ModCompatibility; @@ -21,6 +9,7 @@ import gregtech.client.utils.FacadeBlockAccess; import gregtech.common.covers.facade.FacadeHelper; import gregtech.common.items.behaviors.FacadeItem; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; @@ -45,6 +34,19 @@ import net.minecraftforge.common.model.IModelState; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.colour.Colour; +import codechicken.lib.colour.ColourARGB; +import codechicken.lib.render.CCQuad; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.item.IItemRenderer; +import codechicken.lib.util.TransformUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.uv.UV; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; import org.lwjgl.opengl.GL11; import java.util.ArrayList; @@ -59,19 +61,23 @@ @SideOnly(Side.CLIENT) public class FacadeRenderer implements IItemRenderer { - final static int[] sideOffsets = {1, 1, 2, 2, 0, 0}; - final static float[] sideSoftBounds = {0, 1, 0, 1, 0, 1}; + final static int[] sideOffsets = { 1, 1, 2, 2, 0, 0 }; + final static float[] sideSoftBounds = { 0, 1, 0, 1, 0, 1 }; private final static float FACADE_RENDER_OFFSET = 2.0f / 512.0f; private final static float FACADE_RENDER_OFFSET2 = 1 - FACADE_RENDER_OFFSET; - public static final ThreadLocal lighterFlat = ThreadLocal.withInitial(() -> new VertexLighterFlatSpecial(Minecraft.getMinecraft().getBlockColors())); - public static final ThreadLocal lighterSmooth = ThreadLocal.withInitial(() -> new VertexLighterSmoothAoSpecial(Minecraft.getMinecraft().getBlockColors())); + public static final ThreadLocal lighterFlat = ThreadLocal + .withInitial(() -> new VertexLighterFlatSpecial(Minecraft.getMinecraft().getBlockColors())); + public static final ThreadLocal lighterSmooth = ThreadLocal + .withInitial(() -> new VertexLighterSmoothAoSpecial(Minecraft.getMinecraft().getBlockColors())); - public static final Cache> itemQuadCache = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.HOURS).build(); + public static final Cache> itemQuadCache = CacheBuilder.newBuilder() + .expireAfterAccess(1, TimeUnit.HOURS).build(); public static void init() { - ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(resourceManager -> itemQuadCache.invalidateAll()); + ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()) + .registerReloadListener(resourceManager -> itemQuadCache.invalidateAll()); } @Override @@ -85,9 +91,9 @@ public void renderItem(ItemStack rawStack, ItemCameraTransforms.TransformType tr renderState.reset(); renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM); try { - FacadeRenderer.renderItemCover(renderState, EnumFacing.NORTH.getIndex(), facadeStack, CoverUtil.getCoverPlateBox(EnumFacing.NORTH, 2.0 / 16.0)); - } catch (Throwable ignored) { - } + FacadeRenderer.renderItemCover(renderState, EnumFacing.NORTH.getIndex(), facadeStack, + CoverUtil.getCoverPlateBox(EnumFacing.NORTH, 2.0 / 16.0)); + } catch (Throwable ignored) {} renderState.draw(); } @@ -106,8 +112,8 @@ public boolean isGui3d() { return false; } - public static boolean renderBlockCover(CCRenderState ccrs, Matrix4 translation, IBlockAccess world, BlockPos pos, int side, IBlockState state, Cuboid6 bounds, BlockRenderLayer layer) { - + public static boolean renderBlockCover(CCRenderState ccrs, Matrix4 translation, IBlockAccess world, BlockPos pos, + int side, IBlockState state, Cuboid6 bounds, BlockRenderLayer layer) { EnumFacing face = EnumFacing.VALUES[side]; IBlockAccess coverAccess = new FacadeBlockAccess(world, pos, face, state); if (layer != null && !state.getBlock().canRenderInLayer(state, layer)) { @@ -117,15 +123,13 @@ public static boolean renderBlockCover(CCRenderState ccrs, Matrix4 translation, try { state = state.getActualState(coverAccess, pos); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} IBakedModel model = dispatcher.getModelForState(state); try { state = state.getBlock().getExtendedState(state, coverAccess, pos); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} long posRand = MathHelper.getPositionRandom(pos); List bakedQuads = new ArrayList<>(model.getQuads(state, null, posRand)); @@ -170,7 +174,6 @@ public static void renderItemCover(CCRenderState ccrs, int side, ItemStack rende for (CCQuad quad : renderQuads) { quad.pipe(consumer); } - } public static List applyItemTint(List quads, ItemStack stack) { @@ -198,9 +201,10 @@ public static List applyItemTint(List quads, ItemStack stack) { return retQuads; } - - public static VertexLighterFlat setupLighter(CCRenderState ccrs, Matrix4 translation, IBlockState state, IBlockAccess access, BlockPos pos, IBakedModel model) { - boolean renderAO = Minecraft.isAmbientOcclusionEnabled() && state.getLightValue(access, pos) == 0 && model.isAmbientOcclusion(); + public static VertexLighterFlat setupLighter(CCRenderState ccrs, Matrix4 translation, IBlockState state, + IBlockAccess access, BlockPos pos, IBakedModel model) { + boolean renderAO = Minecraft.isAmbientOcclusionEnabled() && state.getLightValue(access, pos) == 0 && + model.isAmbientOcclusion(); VertexLighterFlat lighter = renderAO ? lighterSmooth.get() : lighterFlat.get(); AdvCCRSConsumer consumer = new AdvCCRSConsumer(ccrs); @@ -209,7 +213,8 @@ public static VertexLighterFlat setupLighter(CCRenderState ccrs, Matrix4 transla return lighter; } - public static boolean renderBlockQuads(VertexLighterFlat lighter, IBlockAccess access, IBlockState state, List quads, BlockPos pos) { + public static boolean renderBlockQuads(VertexLighterFlat lighter, IBlockAccess access, IBlockState state, + List quads, BlockPos pos) { if (!quads.isEmpty()) { lighter.setWorld(access); lighter.setState(state); @@ -275,7 +280,8 @@ public static List sliceQuads(List quads, int side, Cuboid6 boun quadPos[k2][j] = clampF(quadPos[k2][j], bounds, j); } else { if (flag && flag2 && flag3) { - quadPos[k2][j] = MathHelper.clamp(quadPos[k2][j], FACADE_RENDER_OFFSET, FACADE_RENDER_OFFSET2); + quadPos[k2][j] = MathHelper.clamp(quadPos[k2][j], FACADE_RENDER_OFFSET, + FACADE_RENDER_OFFSET2); } } } @@ -312,13 +318,12 @@ public static List sliceQuads(List quads, int side, Cuboid6 boun } private final static EnumFacing[][] sides = { - {EnumFacing.WEST, EnumFacing.EAST}, - {EnumFacing.DOWN, EnumFacing.UP}, - {EnumFacing.NORTH, EnumFacing.SOUTH} + { EnumFacing.WEST, EnumFacing.EAST }, + { EnumFacing.DOWN, EnumFacing.UP }, + { EnumFacing.NORTH, EnumFacing.SOUTH } }; private static double clampF(double x, Cuboid6 b, int j) { - double l = b.getSide(sides[j][0]); double u = b.getSide(sides[j][1]); @@ -370,7 +375,8 @@ public void pipe(IVertexConsumer consumer) { } case COLOR -> { Colour colour = colours[v]; - consumer.put(e, (colour.r & 0xFF) / 255F, (colour.g & 0xFF) / 255F, (colour.b & 0xFF) / 255F, (colour.a & 0xFF) / 255F); + consumer.put(e, (colour.r & 0xFF) / 255F, (colour.g & 0xFF) / 255F, + (colour.b & 0xFF) / 255F, (colour.a & 0xFF) / 255F); } case UV -> { if (element.getIndex() == 0) { @@ -379,7 +385,8 @@ public void pipe(IVertexConsumer consumer) { } else { // fix int brightness = lightMaps[v]; - consumer.put(e, ((float) (brightness & 0xFFFF) / 0xFFFF) * 2, ((float) (brightness >> 16 & 0xFFFF) / 0xFFFF) * 2, 0, 1); + consumer.put(e, ((float) (brightness & 0xFFFF) / 0xFFFF) * 2, + ((float) (brightness >> 16 & 0xFFFF) / 0xFFFF) * 2, 0, 1); } } default -> consumer.put(e); diff --git a/src/main/java/gregtech/client/renderer/handler/GTBoatRenderer.java b/src/main/java/gregtech/client/renderer/handler/GTBoatRenderer.java index d30b9d29925..bb5cb13d9f7 100644 --- a/src/main/java/gregtech/client/renderer/handler/GTBoatRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/GTBoatRenderer.java @@ -2,6 +2,7 @@ import gregtech.api.util.GTUtility; import gregtech.common.entities.GTBoatEntity; + import net.minecraft.client.renderer.entity.RenderBoat; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.item.EntityBoat; @@ -9,8 +10,10 @@ public class GTBoatRenderer extends RenderBoat { - public static final ResourceLocation RUBBER_WOOD_BOAT_TEXTURE = GTUtility.gregtechId("textures/entity/rubber_wood_boat.png"); - public static final ResourceLocation TREATED_WOOD_BOAT_TEXTURE = GTUtility.gregtechId("textures/entity/treated_wood_boat.png"); + public static final ResourceLocation RUBBER_WOOD_BOAT_TEXTURE = GTUtility + .gregtechId("textures/entity/rubber_wood_boat.png"); + public static final ResourceLocation TREATED_WOOD_BOAT_TEXTURE = GTUtility + .gregtechId("textures/entity/treated_wood_boat.png"); public GTBoatRenderer(RenderManager m) { super(m); diff --git a/src/main/java/gregtech/client/renderer/handler/LampItemOverlayRenderer.java b/src/main/java/gregtech/client/renderer/handler/LampItemOverlayRenderer.java index f3f10f3e798..431f5f99d90 100644 --- a/src/main/java/gregtech/client/renderer/handler/LampItemOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/LampItemOverlayRenderer.java @@ -2,6 +2,7 @@ import gregtech.api.gui.GuiTextures; import gregtech.common.blocks.BlockLamp; + import net.minecraft.block.Block; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.Item; @@ -55,6 +56,7 @@ public static void renderOverlay(OverlayType overlayType, int xPosition, int yPo } public enum OverlayType { + NONE, NO_BLOOM, NO_LIGHT, diff --git a/src/main/java/gregtech/client/renderer/handler/MetaTileEntityRenderer.java b/src/main/java/gregtech/client/renderer/handler/MetaTileEntityRenderer.java index ebfbb9d47f8..5aa513fea8c 100644 --- a/src/main/java/gregtech/client/renderer/handler/MetaTileEntityRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/MetaTileEntityRenderer.java @@ -1,18 +1,5 @@ package gregtech.client.renderer.handler; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.render.BlockRenderer; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.block.BlockRenderingRegistry; -import codechicken.lib.render.block.ICCBlockRenderer; -import codechicken.lib.render.item.IItemRenderer; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.TransformUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.metatileentity.IFastRenderMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GTLog; @@ -20,6 +7,7 @@ import gregtech.api.util.ModCompatibility; import gregtech.client.renderer.CubeRendererState; import gregtech.client.renderer.texture.Textures; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -42,6 +30,20 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.render.BlockRenderer; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.block.BlockRenderingRegistry; +import codechicken.lib.render.block.ICCBlockRenderer; +import codechicken.lib.render.item.IItemRenderer; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.TransformUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.uv.IconTransformation; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.opengl.GL11; @@ -50,7 +52,8 @@ @SideOnly(Side.CLIENT) public class MetaTileEntityRenderer implements ICCBlockRenderer, IItemRenderer { - public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation(GTUtility.gregtechId("machine"), "normal"); + public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation( + GTUtility.gregtechId("machine"), "normal"); public static final MetaTileEntityRenderer INSTANCE = new MetaTileEntityRenderer(); public static EnumBlockRenderType BLOCK_RENDER_TYPE; @@ -88,7 +91,6 @@ public void renderItem(ItemStack rawStack, TransformType transformType) { GlStateManager.disableBlend(); } - @Override public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(world, pos); @@ -107,7 +109,7 @@ public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, Textures.RENDER_STATE.set(new CubeRendererState(renderLayer, sideMask, world)); if (metaTileEntity.canRenderInLayer(renderLayer)) { renderState.lightMatrix.locate(world, pos); - IVertexOperation[] pipeline = new IVertexOperation[]{renderState.lightMatrix}; + IVertexOperation[] pipeline = new IVertexOperation[] { renderState.lightMatrix }; metaTileEntity.renderMetaTileEntity(renderState, translation.copy(), pipeline); } @@ -128,11 +130,11 @@ public boolean isBuiltInRenderer() { } @Override - public void renderBrightness(IBlockState state, float brightness) { - } + public void renderBrightness(IBlockState state, float brightness) {} @Override - public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, BufferBuilder buffer) { + public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, + BufferBuilder buffer) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(world, pos); ArrayList boundingBox = new ArrayList<>(); if (metaTileEntity != null) { @@ -163,8 +165,7 @@ public TextureAtlasSprite getParticleTexture() { } @Override - public void registerTextures(TextureMap map) { - } + public void registerTextures(TextureMap map) {} @Override public boolean isAmbientOcclusion() { @@ -175,5 +176,4 @@ public boolean isAmbientOcclusion() { public boolean isGui3d() { return true; } - } diff --git a/src/main/java/gregtech/client/renderer/handler/MetaTileEntityTESR.java b/src/main/java/gregtech/client/renderer/handler/MetaTileEntityTESR.java index cb4ae1cb528..98cf6433124 100644 --- a/src/main/java/gregtech/client/renderer/handler/MetaTileEntityTESR.java +++ b/src/main/java/gregtech/client/renderer/handler/MetaTileEntityTESR.java @@ -1,11 +1,10 @@ package gregtech.client.renderer.handler; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.Cover; import gregtech.api.metatileentity.IFastRenderMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.MetaTileEntityHolder; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -17,6 +16,9 @@ import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.vec.Matrix4; import org.lwjgl.opengl.GL11; import javax.annotation.Nonnull; @@ -25,7 +27,8 @@ public class MetaTileEntityTESR extends TileEntitySpecialRenderer { @Override - public void render(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { + public void render(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage, + float alpha) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); @@ -34,12 +37,9 @@ public void render(MetaTileEntityHolder te, double x, double y, double z, float GlStateManager.enableBlend(); GlStateManager.disableCull(); - if (Minecraft.isAmbientOcclusionEnabled()) - { + if (Minecraft.isAmbientOcclusionEnabled()) { GlStateManager.shadeModel(GL11.GL_SMOOTH); - } - else - { + } else { GlStateManager.shadeModel(GL11.GL_FLAT); } @@ -51,7 +51,8 @@ public void render(MetaTileEntityHolder te, double x, double y, double z, float renderState.reset(); renderState.bind(buffer); renderState.setBrightness(te.getWorld(), te.getPos()); - ((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, new Matrix4().translate(x, y, z), partialTicks); + ((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, + new Matrix4().translate(x, y, z), partialTicks); } if (metaTileEntity != null) { for (EnumFacing side : EnumFacing.VALUES) { @@ -85,14 +86,16 @@ public void render(MetaTileEntityHolder te, double x, double y, double z, float } @Override - public void renderTileEntityFast(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage, float alpha, @Nonnull BufferBuilder buffer) { + public void renderTileEntityFast(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, + int destroyStage, float alpha, @Nonnull BufferBuilder buffer) { MetaTileEntity metaTileEntity = te.getMetaTileEntity(); if (metaTileEntity instanceof IFastRenderMetaTileEntity) { CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); renderState.setBrightness(te.getWorld(), te.getPos()); - ((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, new Matrix4().translate(x, y, z), partialTicks); + ((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, + new Matrix4().translate(x, y, z), partialTicks); ((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntity(x, y, z, partialTicks); } if (metaTileEntity != null) { diff --git a/src/main/java/gregtech/client/renderer/handler/MultiblockPreviewRenderer.java b/src/main/java/gregtech/client/renderer/handler/MultiblockPreviewRenderer.java index 3dee2712914..d3531a43d66 100644 --- a/src/main/java/gregtech/client/renderer/handler/MultiblockPreviewRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/MultiblockPreviewRenderer.java @@ -6,6 +6,7 @@ import gregtech.api.pattern.MultiblockShapeInfo; import gregtech.api.util.BlockInfo; import gregtech.client.utils.TrackedDummyWorld; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.*; @@ -26,6 +27,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; import java.util.HashMap; @@ -71,7 +73,6 @@ public static void renderWorldLastEvent(RenderWorldLastEvent event) { } } - public static void renderMultiBlockPreview(MultiblockControllerBase controller, long durTimeMillis) { if (!controller.getPos().equals(mbpPos)) { layer = 0; @@ -98,7 +99,8 @@ public static void resetMultiblockRender() { } } - public static void renderControllerInList(MultiblockControllerBase controllerBase, MultiblockShapeInfo shapeInfo, int layer) { + public static void renderControllerInList(MultiblockControllerBase controllerBase, MultiblockShapeInfo shapeInfo, + int layer) { BlockPos mbpPos = controllerBase.getPos(); EnumFacing frontFacing, previewFacing; previewFacing = controllerBase.getFrontFacing(); @@ -114,8 +116,10 @@ public static void renderControllerInList(MultiblockControllerBase controllerBas BlockInfo[] column = aisle[y]; for (int z = 0; z < column.length; z++) { blockMap.put(new BlockPos(x, y, z), column[z]); - MetaTileEntity metaTE = column[z].getTileEntity() instanceof IGregTechTileEntity ? ((IGregTechTileEntity) column[z].getTileEntity()).getMetaTileEntity() : null; - if (metaTE instanceof MultiblockControllerBase && metaTE.metaTileEntityId.equals(controllerBase.metaTileEntityId)) { + MetaTileEntity metaTE = column[z].getTileEntity() instanceof IGregTechTileEntity ? + ((IGregTechTileEntity) column[z].getTileEntity()).getMetaTileEntity() : null; + if (metaTE instanceof MultiblockControllerBase && + metaTE.metaTileEntityId.equals(controllerBase.metaTileEntityId)) { controllerPos = new BlockPos(x, y, z); previewFacing = metaTE.getFrontFacing(); mte = (MultiblockControllerBase) metaTE; @@ -132,8 +136,10 @@ public static void renderControllerInList(MultiblockControllerBase controllerBas EnumFacing facing = controllerBase.getFrontFacing(); EnumFacing upwardsFacing = controllerBase.getUpwardsFacing(); - frontFacing = facing.getYOffset() == 0 ? facing : facing.getYOffset() < 0 ? upwardsFacing : upwardsFacing.getOpposite(); - Rotation rotatePreviewBy = Rotation.values()[(4 + frontFacing.getHorizontalIndex() - previewFacing.getHorizontalIndex()) % 4]; + frontFacing = facing.getYOffset() == 0 ? facing : + facing.getYOffset() < 0 ? upwardsFacing : upwardsFacing.getOpposite(); + Rotation rotatePreviewBy = Rotation + .values()[(4 + frontFacing.getHorizontalIndex() - previewFacing.getHorizontalIndex()) % 4]; Minecraft mc = Minecraft.getMinecraft(); BlockRendererDispatcher brd = mc.getBlockRendererDispatcher(); @@ -154,7 +160,8 @@ public static void renderControllerInList(MultiblockControllerBase controllerBas GlStateManager.rotate(90, previewFacing.getZOffset(), 0, -previewFacing.getXOffset()); GlStateManager.translate(-0.5, -0.5, -0.5); } else { - int degree = 90 * (upwardsFacing == EnumFacing.EAST ? -1 : upwardsFacing == EnumFacing.SOUTH ? 2 : upwardsFacing == EnumFacing.WEST ? 1 : 0); + int degree = 90 * (upwardsFacing == EnumFacing.EAST ? -1 : + upwardsFacing == EnumFacing.SOUTH ? 2 : upwardsFacing == EnumFacing.WEST ? 1 : 0); GlStateManager.translate(0.5, 0.5, 0.5); GlStateManager.rotate(degree, previewFacing.getXOffset(), 0, previewFacing.getZOffset()); GlStateManager.translate(-0.5, -0.5, -0.5); @@ -189,7 +196,6 @@ public static void renderControllerInList(MultiblockControllerBase controllerBas ForgeHooksClient.setRenderLayer(oldLayer); GlStateManager.popMatrix(); - } @SideOnly(Side.CLIENT) @@ -246,6 +252,5 @@ public WorldType getWorldType() { public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) { return pos.equals(BlockPos.ORIGIN) && delegate.isSideSolid(targetPos, side, _default); } - } } diff --git a/src/main/java/gregtech/client/renderer/handler/PortalModel.java b/src/main/java/gregtech/client/renderer/handler/PortalModel.java index 8d189685d75..8d002d60fa1 100644 --- a/src/main/java/gregtech/client/renderer/handler/PortalModel.java +++ b/src/main/java/gregtech/client/renderer/handler/PortalModel.java @@ -9,25 +9,27 @@ @SideOnly(Side.CLIENT) public class PortalModel extends ModelBase { - private final ModelRenderer renderer; - public PortalModel() { - textureWidth = 64; - textureHeight = 64; + private final ModelRenderer renderer; - renderer = new ModelRenderer(this); - renderer.setRotationPoint(0.0F, 24.0F, 0.0F); - renderer.cubeList.add(new ModelBox(renderer, 0, 0, -8.0F, -32.0F, -1.0F, 16, 32, 2, 0.0F, false)); - } + public PortalModel() { + textureWidth = 64; + textureHeight = 64; - @Override - public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { - renderer.render(scale); - } + renderer = new ModelRenderer(this); + renderer.setRotationPoint(0.0F, 24.0F, 0.0F); + renderer.cubeList.add(new ModelBox(renderer, 0, 0, -8.0F, -32.0F, -1.0F, 16, 32, 2, 0.0F, false)); + } - public static void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + @Override + public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, + float headPitch, float scale) { + renderer.render(scale); + } + + public static void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/gregtech/client/renderer/handler/PortalRenderer.java b/src/main/java/gregtech/client/renderer/handler/PortalRenderer.java index 35a6742f0a1..aa2ce4c40e2 100644 --- a/src/main/java/gregtech/client/renderer/handler/PortalRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/PortalRenderer.java @@ -2,6 +2,7 @@ import gregtech.api.util.GTUtility; import gregtech.common.entities.PortalEntity; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; @@ -18,7 +19,7 @@ public class PortalRenderer extends Render { private static final ResourceLocation texture = GTUtility.gregtechId("textures/entity/gtportal.png"); protected PortalModel model = new PortalModel(); - public PortalRenderer(RenderManager renderManagerIn){ + public PortalRenderer(RenderManager renderManagerIn) { super(renderManagerIn); } @@ -35,24 +36,26 @@ public void doRender(PortalEntity entity, double x, double y, double z, float en this.bindEntityTexture(entity); float scaleX = 0.0625F, scaleY = 0.0625F, scaleZ = 0.0625F; float translateY = 0.F; - if(entity.isOpening()){ - if(entity.getTimeToDespawn() <= 195) { - scaleY *= MathHelper.clamp((195.F-entity.getTimeToDespawn()+partialTicks)/5.F, 0.05F, 1.F); - translateY = 0.5F*(1.F - MathHelper.clamp((195.F-entity.getTimeToDespawn()+partialTicks)/5.F, 0.F, 1.F)); - }else{ - scaleX *= MathHelper.clamp((200.F-entity.getTimeToDespawn()+partialTicks)/5.F, 0.05F, 1.F); + if (entity.isOpening()) { + if (entity.getTimeToDespawn() <= 195) { + scaleY *= MathHelper.clamp((195.F - entity.getTimeToDespawn() + partialTicks) / 5.F, 0.05F, 1.F); + translateY = 0.5F * + (1.F - MathHelper.clamp((195.F - entity.getTimeToDespawn() + partialTicks) / 5.F, 0.F, 1.F)); + } else { + scaleX *= MathHelper.clamp((200.F - entity.getTimeToDespawn() + partialTicks) / 5.F, 0.05F, 1.F); scaleY *= 0.05F; - scaleZ *= MathHelper.clamp((200.F-entity.getTimeToDespawn()+partialTicks)/5.F, 0.05F, 1.F); + scaleZ *= MathHelper.clamp((200.F - entity.getTimeToDespawn() + partialTicks) / 5.F, 0.05F, 1.F); translateY = 0.5F; } - }else if(entity.isClosing()){ - if(entity.getTimeToDespawn() >= 5) { - scaleY *= MathHelper.clamp((entity.getTimeToDespawn()-partialTicks-5.F)/5.F, 0.05F, 1.F); - translateY = 0.5F*(1.F-MathHelper.clamp((entity.getTimeToDespawn()-partialTicks-5.F)/5.F, 0.F, 1.F)); - }else{ - scaleX *= MathHelper.clamp((entity.getTimeToDespawn()-partialTicks)/5.F, 0.05F, 1.F); + } else if (entity.isClosing()) { + if (entity.getTimeToDespawn() >= 5) { + scaleY *= MathHelper.clamp((entity.getTimeToDespawn() - partialTicks - 5.F) / 5.F, 0.05F, 1.F); + translateY = 0.5F * + (1.F - MathHelper.clamp((entity.getTimeToDespawn() - partialTicks - 5.F) / 5.F, 0.F, 1.F)); + } else { + scaleX *= MathHelper.clamp((entity.getTimeToDespawn() - partialTicks) / 5.F, 0.05F, 1.F); scaleY *= 0.05F; - scaleZ *= MathHelper.clamp((entity.getTimeToDespawn()-partialTicks)/5.F, 0.05F, 1.F); + scaleZ *= MathHelper.clamp((entity.getTimeToDespawn() - partialTicks) / 5.F, 0.05F, 1.F); translateY = 0.5F; } } @@ -60,7 +63,7 @@ public void doRender(PortalEntity entity, double x, double y, double z, float en GlStateManager.scale(scaleX, scaleY, scaleZ); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); - GlStateManager.rotate( -entity.rotationYaw, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-entity.rotationYaw, 0.0F, 1.0F, 0.0F); this.model.render(entity, partialTicks, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); @@ -69,7 +72,6 @@ public void doRender(PortalEntity entity, double x, double y, double z, float en } public static void setupTranslation(double x, double y, double z) { - GlStateManager.translate((float)x, (float)y + 0.5F, (float)z); + GlStateManager.translate((float) x, (float) y + 0.5F, (float) z); } - } diff --git a/src/main/java/gregtech/client/renderer/handler/TerminalARRenderer.java b/src/main/java/gregtech/client/renderer/handler/TerminalARRenderer.java index 4291b84f367..1bc5e61a13e 100644 --- a/src/main/java/gregtech/client/renderer/handler/TerminalARRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/TerminalARRenderer.java @@ -5,6 +5,7 @@ import gregtech.api.terminal.app.AbstractApplication; import gregtech.api.terminal.os.TerminalOSWidget; import gregtech.client.utils.RenderUtil; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; @@ -23,7 +24,7 @@ * @Author: KilaBash * @Date: 2021/09/13 * @Description: Renderer for AR applications. - * Please don't render your stuff here, it's just a handler + * Please don't render your stuff here, it's just a handler */ @SideOnly(Side.CLIENT) public class TerminalARRenderer { @@ -43,7 +44,7 @@ public static void renderGameOverlayEvent(RenderGameOverlayEvent.Pre event) { int sWidth = event.getResolution().getScaledWidth(); int sHeight = event.getResolution().getScaledHeight(); width = (int) (380 * 0.8 * sHeight / 256); - height =(int) (0.8 * sHeight); + height = (int) (0.8 * sHeight); x = (sWidth - width) / 2; y = (sHeight - height) / 2; GlStateManager.enableBlend(); @@ -54,7 +55,7 @@ public static void renderGameOverlayEvent(RenderGameOverlayEvent.Pre event) { public static void renderWorldLastEvent(RenderWorldLastEvent event) { if (APP != null) { - RenderUtil.useScissor(x, y, width, height, ()-> APP.drawARScreen(event)); + RenderUtil.useScissor(x, y, width, height, () -> APP.drawARScreen(event)); } } @@ -70,7 +71,7 @@ public static void onClientTick(TickEvent.ClientTickEvent event) { } HELD_HAND = EnumHand.MAIN_HAND; NBTTagCompound tag = player.getHeldItem(EnumHand.MAIN_HAND).getSubCompound("terminal"); - if (tag == null ) { + if (tag == null) { tag = player.getHeldItem(EnumHand.OFF_HAND).getSubCompound("terminal"); HELD_HAND = EnumHand.OFF_HAND; } @@ -95,5 +96,4 @@ public static void onClientTick(TickEvent.ClientTickEvent event) { } } } - } diff --git a/src/main/java/gregtech/client/renderer/pipe/CableRenderer.java b/src/main/java/gregtech/client/renderer/pipe/CableRenderer.java index 7d928bdb802..1f111d2c0a2 100644 --- a/src/main/java/gregtech/client/renderer/pipe/CableRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/CableRenderer.java @@ -1,9 +1,5 @@ package gregtech.client.renderer.pipe; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.pipenet.block.material.TileEntityMaterialPipeBase; @@ -11,9 +7,15 @@ import gregtech.api.unification.material.Material; import gregtech.api.util.GTUtility; import gregtech.common.pipelike.cable.Insulation; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.ResourceLocation; + +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.vec.uv.IconTransformation; import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nullable; @@ -39,14 +41,16 @@ public void registerIcons(TextureMap map) { } @Override - public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { + public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, IPipeTile pipeTile, + IPipeType pipeType, @Nullable Material material) { if (material == null || !(pipeType instanceof Insulation)) { return; } int insulationLevel = ((Insulation) pipeType).insulationLevel; IVertexOperation wireRender = new IconTransformation(wireTexture); - ColourMultiplier wireColor = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB())); + ColourMultiplier wireColor = new ColourMultiplier( + GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB())); ColourMultiplier insulationColor = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(0x404040)); if (pipeTile != null) { if (pipeTile.getPaintingColor() != pipeTile.getDefaultPaintingColor()) { @@ -64,7 +68,8 @@ public void buildRenderer(PipeRenderContext renderContext, BlockPipe bl } renderContext.addOpenFaceRender(false, wireRender, wireColor) - .addOpenFaceRender(false, new IconTransformation(insulationTextures[insulationLevel]), insulationColor) + .addOpenFaceRender(false, new IconTransformation(insulationTextures[insulationLevel]), + insulationColor) .addSideRender(false, new IconTransformation(insulationTextures[5]), insulationColor); } else { renderContext.addOpenFaceRender(false, wireRender, wireColor) @@ -86,7 +91,8 @@ public Pair getParticleTexture(IPipeTile pipe if (!(pipeType instanceof Insulation)) { return Pair.of(TextureUtils.getMissingSprite(), 0xFFFFFF); } - Material material = pipeTile instanceof TileEntityMaterialPipeBase ? ((TileEntityMaterialPipeBase) pipeTile).getPipeMaterial() : null; + Material material = pipeTile instanceof TileEntityMaterialPipeBase ? + ((TileEntityMaterialPipeBase) pipeTile).getPipeMaterial() : null; TextureAtlasSprite atlasSprite; int particleColor; diff --git a/src/main/java/gregtech/client/renderer/pipe/FluidPipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/FluidPipeRenderer.java index 9eb2f62d59d..b43c6f5755f 100644 --- a/src/main/java/gregtech/client/renderer/pipe/FluidPipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/FluidPipeRenderer.java @@ -1,6 +1,5 @@ package gregtech.client.renderer.pipe; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.pipenet.tile.IPipeTile; @@ -9,12 +8,16 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.pipelike.fluidpipe.FluidPipeType; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; -import javax.annotation.Nullable; +import codechicken.lib.vec.uv.IconTransformation; + import java.util.EnumMap; +import javax.annotation.Nullable; + public class FluidPipeRenderer extends PipeRenderer { public static final FluidPipeRenderer INSTANCE = new FluidPipeRenderer(); @@ -41,13 +44,14 @@ public void registerIcons(TextureMap map) { } @Override - public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { + public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, IPipeTile pipeTile, + IPipeType pipeType, @Nullable Material material) { if (material == null || !(pipeType instanceof FluidPipeType)) { return; } if (ModHandler.isMaterialWood(material)) { TextureAtlasSprite sprite = pipeTexturesWood.get(pipeType); - if(sprite != null) { + if (sprite != null) { renderContext.addOpenFaceRender(new IconTransformation(sprite)); } else { renderContext.addOpenFaceRender(new IconTransformation(pipeTextures.get(pipeType))); diff --git a/src/main/java/gregtech/client/renderer/pipe/ItemPipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/ItemPipeRenderer.java index d6577a0bd99..90961bb1bfe 100644 --- a/src/main/java/gregtech/client/renderer/pipe/ItemPipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/ItemPipeRenderer.java @@ -1,6 +1,5 @@ package gregtech.client.renderer.pipe; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.pipenet.tile.IPipeTile; @@ -8,12 +7,16 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.pipelike.itempipe.ItemPipeType; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; -import javax.annotation.Nullable; +import codechicken.lib.vec.uv.IconTransformation; + import java.util.EnumMap; +import javax.annotation.Nullable; + public class ItemPipeRenderer extends PipeRenderer { public static final ItemPipeRenderer INSTANCE = new ItemPipeRenderer(); @@ -36,7 +39,8 @@ public void registerIcons(TextureMap map) { } @Override - public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { + public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, IPipeTile pipeTile, + IPipeType pipeType, @Nullable Material material) { if (material == null || !(pipeType instanceof ItemPipeType)) { return; } diff --git a/src/main/java/gregtech/client/renderer/pipe/LaserPipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/LaserPipeRenderer.java index 3502a70ae3d..adc2fda4af4 100644 --- a/src/main/java/gregtech/client/renderer/pipe/LaserPipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/LaserPipeRenderer.java @@ -1,9 +1,5 @@ package gregtech.client.renderer.pipe; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.pipenet.tile.IPipeTile; @@ -14,19 +10,27 @@ import gregtech.common.ConfigHolder; import gregtech.common.pipelike.laser.LaserPipeType; import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.uv.IconTransformation; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.Nullable; import java.util.EnumMap; public class LaserPipeRenderer extends PipeRenderer { + public static final LaserPipeRenderer INSTANCE = new LaserPipeRenderer(); private final EnumMap pipeTextures = new EnumMap<>(LaserPipeType.class); private boolean active = false; + public LaserPipeRenderer() { super("gt_laser_pipe", GTUtility.gregtechId("laser_pipe")); } @@ -37,7 +41,8 @@ public void registerIcons(TextureMap map) { } @Override - public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, @Nullable IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { + public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, + @Nullable IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { if (pipeType instanceof LaserPipeType) { renderContext.addOpenFaceRender(new IconTransformation(pipeTextures.get(pipeType))) .addSideRender(false, new IconTransformation(Textures.LASER_PIPE_SIDE)); @@ -45,19 +50,23 @@ public void buildRenderer(PipeRenderContext renderContext, BlockPipe bl renderContext.addSideRender(new IconTransformation(Textures.LASER_PIPE_OVERLAY)); } - active = !ConfigHolder.client.preventAnimatedCables && pipeTile instanceof TileEntityLaserPipe laserPipe && laserPipe.isActive(); + active = !ConfigHolder.client.preventAnimatedCables && pipeTile instanceof TileEntityLaserPipe laserPipe && + laserPipe.isActive(); } } @Override - protected void renderOtherLayers(BlockRenderLayer layer, CCRenderState renderState, PipeRenderContext renderContext) { - if (active && layer == BloomEffectUtil.getEffectiveBloomLayer() && (renderContext.getConnections() & 0b111111) != 0) { + protected void renderOtherLayers(BlockRenderLayer layer, CCRenderState renderState, + PipeRenderContext renderContext) { + if (active && layer == BloomEffectUtil.getEffectiveBloomLayer() && + (renderContext.getConnections() & 0b111111) != 0) { Cuboid6 innerCuboid = BlockPipe.getSideBox(null, renderContext.getPipeThickness()); if ((renderContext.getConnections() & 0b111111) != 0) { for (EnumFacing side : EnumFacing.VALUES) { if ((renderContext.getConnections() & (1 << side.getIndex())) == 0) { int oppositeIndex = side.getOpposite().getIndex(); - if ((renderContext.getConnections() & (1 << oppositeIndex)) <= 0 || (renderContext.getConnections() & 0b111111 & ~(1 << oppositeIndex)) != 0) { + if ((renderContext.getConnections() & (1 << oppositeIndex)) <= 0 || + (renderContext.getConnections() & 0b111111 & ~(1 << oppositeIndex)) != 0) { // render pipe side IVertexOperation[] ops = renderContext.getBaseVertexOperation(); ops = ArrayUtils.addAll(ops, new IconTransformation(Textures.LASER_PIPE_OVERLAY_EMISSIVE)); @@ -70,7 +79,8 @@ protected void renderOtherLayers(BlockRenderLayer layer, CCRenderState renderSta if (connectionSide.getAxis() != side.getAxis()) { // render side textures IVertexOperation[] ops = renderContext.getBaseVertexOperation(); - ops = ArrayUtils.addAll(ops, new IconTransformation(Textures.LASER_PIPE_OVERLAY_EMISSIVE)); + ops = ArrayUtils.addAll(ops, + new IconTransformation(Textures.LASER_PIPE_OVERLAY_EMISSIVE)); renderFace(renderState, ops, connectionSide, sideCuboid); } } diff --git a/src/main/java/gregtech/client/renderer/pipe/OpticalPipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/OpticalPipeRenderer.java index 5dbd92d4fc2..dd4513708cf 100644 --- a/src/main/java/gregtech/client/renderer/pipe/OpticalPipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/OpticalPipeRenderer.java @@ -1,6 +1,5 @@ package gregtech.client.renderer.pipe; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.pipenet.tile.IPipeTile; @@ -10,12 +9,16 @@ import gregtech.common.ConfigHolder; import gregtech.common.pipelike.optical.OpticalPipeType; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; -import javax.annotation.Nullable; +import codechicken.lib.vec.uv.IconTransformation; + import java.util.EnumMap; +import javax.annotation.Nullable; + public final class OpticalPipeRenderer extends PipeRenderer { public static final OpticalPipeRenderer INSTANCE = new OpticalPipeRenderer(); @@ -31,7 +34,8 @@ public void registerIcons(TextureMap map) { } @Override - public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, @Nullable IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { + public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, + @Nullable IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { if (pipeType instanceof OpticalPipeType) { renderContext.addOpenFaceRender(new IconTransformation(pipeTextures.get(pipeType))) .addSideRender(false, new IconTransformation(Textures.OPTICAL_PIPE_SIDE)); diff --git a/src/main/java/gregtech/client/renderer/pipe/PipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/PipeRenderer.java index 4cdeab7d4c6..d7ba5027c3a 100644 --- a/src/main/java/gregtech/client/renderer/pipe/PipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/PipeRenderer.java @@ -1,20 +1,5 @@ package gregtech.client.renderer.pipe; -import codechicken.lib.lighting.LightMatrix; -import codechicken.lib.render.BlockRenderer; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.block.BlockRenderingRegistry; -import codechicken.lib.render.block.ICCBlockRenderer; -import codechicken.lib.render.item.IItemRenderer; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.TransformUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Translation; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.cover.CoverHolder; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; @@ -29,8 +14,7 @@ import gregtech.api.util.ModCompatibility; import gregtech.client.renderer.CubeRendererState; import gregtech.client.renderer.texture.Textures; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; @@ -55,24 +39,45 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.lighting.LightMatrix; +import codechicken.lib.render.BlockRenderer; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.block.BlockRenderingRegistry; +import codechicken.lib.render.block.ICCBlockRenderer; +import codechicken.lib.render.item.IItemRenderer; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.TransformUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Translation; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.uv.IconTransformation; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.opengl.GL11; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; +import javax.annotation.Nullable; + @SideOnly(Side.CLIENT) public abstract class PipeRenderer implements ICCBlockRenderer, IItemRenderer { public final ModelResourceLocation modelLocation; private final String name; private EnumBlockRenderType blockRenderType; - protected static final ThreadLocal blockFaces = ThreadLocal.withInitial(BlockRenderer.BlockFace::new); + protected static final ThreadLocal blockFaces = ThreadLocal + .withInitial(BlockRenderer.BlockFace::new); private static final Cuboid6 FRAME_RENDER_CUBOID = new Cuboid6(0.001, 0.001, 0.001, 0.999, 0.999, 0.999); - private static final EnumMap> FACE_BORDER_MAP = new EnumMap<>(EnumFacing.class); + private static final EnumMap> FACE_BORDER_MAP = new EnumMap<>( + EnumFacing.class); private static final Int2ObjectMap RESTRICTOR_MAP = new Int2ObjectOpenHashMap<>(); @SuppressWarnings("unused") @@ -95,12 +100,18 @@ public static void initializeRestrictor(TextureMap map) { } static { - FACE_BORDER_MAP.put(EnumFacing.DOWN, borderMap(EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST)); - FACE_BORDER_MAP.put(EnumFacing.UP, borderMap(EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.WEST, EnumFacing.EAST)); - FACE_BORDER_MAP.put(EnumFacing.NORTH, borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST)); - FACE_BORDER_MAP.put(EnumFacing.SOUTH, borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.WEST, EnumFacing.EAST)); - FACE_BORDER_MAP.put(EnumFacing.WEST, borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH)); - FACE_BORDER_MAP.put(EnumFacing.EAST, borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.SOUTH, EnumFacing.NORTH)); + FACE_BORDER_MAP.put(EnumFacing.DOWN, + borderMap(EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST)); + FACE_BORDER_MAP.put(EnumFacing.UP, + borderMap(EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.WEST, EnumFacing.EAST)); + FACE_BORDER_MAP.put(EnumFacing.NORTH, + borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST)); + FACE_BORDER_MAP.put(EnumFacing.SOUTH, + borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.WEST, EnumFacing.EAST)); + FACE_BORDER_MAP.put(EnumFacing.WEST, + borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH)); + FACE_BORDER_MAP.put(EnumFacing.EAST, + borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.SOUTH, EnumFacing.NORTH)); } public PipeRenderer(String name, ModelResourceLocation modelLocation) { @@ -134,7 +145,9 @@ public void onModelsBake(ModelBakeEvent event) { event.getModelRegistry().putObject(modelLocation, this); } - public abstract void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, @Nullable IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material); + public abstract void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, + @Nullable IPipeTile pipeTile, IPipeType pipeType, + @Nullable Material material); @Override public void renderItem(ItemStack rawItemStack, TransformType transformType) { @@ -148,7 +161,8 @@ public void renderItem(ItemStack rawItemStack, TransformType transformType) { renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM); BlockPipe blockFluidPipe = (BlockPipe) ((ItemBlockPipe) stack.getItem()).getBlock(); IPipeType pipeType = blockFluidPipe.getItemPipeType(stack); - Material material = blockFluidPipe instanceof BlockMaterialPipe blockMaterialPipe ? blockMaterialPipe.getItemMaterial(stack) : null; + Material material = blockFluidPipe instanceof BlockMaterialPipe blockMaterialPipe ? + blockMaterialPipe.getItemMaterial(stack) : null; if (pipeType != null) { // 12 == 0b1100 is North and South connection (index 2 & 3) PipeRenderContext renderContext = new PipeRenderContext(12, 0, pipeType.getThickness()); @@ -175,7 +189,8 @@ public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, } IPipeType pipeType = pipeTile.getPipeType(); - Material pipeMaterial = pipeTile instanceof TileEntityMaterialPipeBase ? ((TileEntityMaterialPipeBase) pipeTile).getPipeMaterial() : null; + Material pipeMaterial = pipeTile instanceof TileEntityMaterialPipeBase ? + ((TileEntityMaterialPipeBase) pipeTile).getPipeMaterial() : null; int paintingColor = pipeTile.getPaintingColor(); int connectedSidesMap = pipeTile.getVisualConnections(); int blockedConnections = pipeTile.getBlockedConnections(); @@ -189,7 +204,8 @@ public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, Textures.RENDER_STATE.set(new CubeRendererState(renderLayer, sideMask, world)); if (canRenderInLayer(renderLayer)) { renderState.lightMatrix.locate(world, pos); - PipeRenderContext renderContext = new PipeRenderContext(pos, renderState.lightMatrix, connectedSidesMap, blockedConnections, pipeType.getThickness()); + PipeRenderContext renderContext = new PipeRenderContext(pos, renderState.lightMatrix, connectedSidesMap, + blockedConnections, pipeType.getThickness()); renderContext.color = GTUtility.convertRGBtoOpaqueRGBA_CL(getPipeColor(pipeMaterial, paintingColor)); buildRenderer(renderContext, blockPipe, pipeTile, pipeType, pipeMaterial); if (renderLayer == BlockRenderLayer.CUTOUT) { @@ -201,13 +217,15 @@ public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, } CoverHolder coverHolder = pipeTile.getCoverableImplementation(); - coverHolder.renderCovers(renderState, new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ()), renderLayer); + coverHolder.renderCovers(renderState, new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ()), + renderLayer); Textures.RENDER_STATE.set(null); } return true; } - private static void renderFrame(IPipeTile pipeTile, BlockPos pos, CCRenderState renderState, int connections) { + private static void renderFrame(IPipeTile pipeTile, BlockPos pos, CCRenderState renderState, + int connections) { Material frameMaterial = pipeTile.getFrameMaterial(); if (frameMaterial != null) { ResourceLocation rl = MaterialIconType.frameGt.getBlockTexturePath(frameMaterial.getMaterialIconSet()); @@ -250,7 +268,8 @@ public void renderPipeBlock(CCRenderState renderState, PipeRenderContext renderC // if connection is blocked if ((renderContext.connections & 1 << renderedSide.getIndex()) == 0) { int oppositeIndex = renderedSide.getOpposite().getIndex(); - if ((renderContext.connections & 1 << oppositeIndex) > 0 && (renderContext.connections & 63 & ~(1 << oppositeIndex)) == 0) { + if ((renderContext.connections & 1 << oppositeIndex) > 0 && + (renderContext.connections & 63 & ~(1 << oppositeIndex)) == 0) { // render open texture if opposite is open and no other renderOpenFace(renderState, renderContext, renderedSide, cuboid6); } else { @@ -291,13 +310,15 @@ protected void renderPipeCube(CCRenderState renderState, PipeRenderContext rende } } - protected void renderOpenFace(CCRenderState renderState, PipeRenderContext renderContext, EnumFacing side, Cuboid6 cuboid6) { + protected void renderOpenFace(CCRenderState renderState, PipeRenderContext renderContext, EnumFacing side, + Cuboid6 cuboid6) { for (IVertexOperation[] vertexOperations : renderContext.openFaceRenderer) { renderFace(renderState, vertexOperations, side, cuboid6); } } - protected void renderPipeSide(CCRenderState renderState, PipeRenderContext renderContext, EnumFacing side, Cuboid6 cuboid6) { + protected void renderPipeSide(CCRenderState renderState, PipeRenderContext renderContext, EnumFacing side, + Cuboid6 cuboid6) { for (IVertexOperation[] vertexOperations : renderContext.pipeSideRenderer) { renderFace(renderState, vertexOperations, side, cuboid6); } @@ -307,20 +328,22 @@ protected void renderPipeSide(CCRenderState renderState, PipeRenderContext rende int borderMask = 0; for (Border border : Border.VALUES) { EnumFacing borderSide = getSideAtBorder(side, border); - if (TileEntityPipeBase.isFaceBlocked(blockedConnections, borderSide) - && TileEntityPipeBase.isConnected(connections, borderSide)) { + if (TileEntityPipeBase.isFaceBlocked(blockedConnections, borderSide) && + TileEntityPipeBase.isConnected(connections, borderSide)) { // only render when the side is blocked *and* connected borderMask |= border.mask; } } if (borderMask != 0) { - IVertexOperation[] pipeline = ArrayUtils.addAll(renderContext.getBaseVertexOperation(), RESTRICTOR_MAP.get(borderMask)); + IVertexOperation[] pipeline = ArrayUtils.addAll(renderContext.getBaseVertexOperation(), + RESTRICTOR_MAP.get(borderMask)); renderFace(renderState, pipeline, side, cuboid6); } } } - protected void renderFace(CCRenderState renderState, IVertexOperation[] pipeline, EnumFacing side, Cuboid6 cuboid6) { + protected void renderFace(CCRenderState renderState, IVertexOperation[] pipeline, EnumFacing side, + Cuboid6 cuboid6) { BlockRenderer.BlockFace blockFace = blockFaces.get(); blockFace.loadCuboidFace(cuboid6, side.getIndex()); renderState.setPipeline(blockFace, 0, blockFace.verts.length, pipeline); @@ -328,20 +351,19 @@ protected void renderFace(CCRenderState renderState, IVertexOperation[] pipeline } @Override - public void renderBrightness(IBlockState state, float brightness) { - } + public void renderBrightness(IBlockState state, float brightness) {} /** * Override to render in other layers, e.g. emissive stuff * {@link #canRenderInLayer} also need to be overridden */ - protected void renderOtherLayers(BlockRenderLayer layer, CCRenderState renderState, PipeRenderContext renderContext) { - - } + protected void renderOtherLayers(BlockRenderLayer layer, CCRenderState renderState, + PipeRenderContext renderContext) {} /** * What layers can be rendered in. * See also {@link #renderOtherLayers} + * * @param layer the current layer being rendered too * @return true if this should render in {@code layer} */ @@ -350,7 +372,8 @@ protected boolean canRenderInLayer(BlockRenderLayer layer) { } @Override - public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, BufferBuilder buffer) { + public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, + BufferBuilder buffer) { CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); @@ -377,8 +400,7 @@ public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockStat } @Override - public void registerTextures(TextureMap map) { - } + public void registerTextures(TextureMap map) {} @Override public IModelState getTransforms() { @@ -410,7 +432,8 @@ public Pair getParticleTexture(IPipeTile pipe return Pair.of(TextureUtils.getMissingSprite(), 0xFFFFFF); } IPipeType pipeType = pipeTile.getPipeType(); - Material material = pipeTile instanceof TileEntityMaterialPipeBase ? ((TileEntityMaterialPipeBase) pipeTile).getPipeMaterial() : null; + Material material = pipeTile instanceof TileEntityMaterialPipeBase ? + ((TileEntityMaterialPipeBase) pipeTile).getPipeMaterial() : null; if (pipeType == null) { return Pair.of(TextureUtils.getMissingSprite(), 0xFFFFFF); } @@ -434,16 +457,18 @@ public static class PipeRenderContext { private final int connections; private final int blockedConnections; - public PipeRenderContext(BlockPos pos, LightMatrix lightMatrix, int connections, int blockedConnections, float thickness) { + public PipeRenderContext(BlockPos pos, LightMatrix lightMatrix, int connections, int blockedConnections, + float thickness) { this.pos = pos; this.lightMatrix = lightMatrix; this.connections = connections; this.blockedConnections = blockedConnections; this.pipeThickness = thickness; if (pos != null && lightMatrix != null) { - blockedOverlay = new IVertexOperation[]{new Translation(pos), lightMatrix, new IconTransformation(Textures.PIPE_BLOCKED_OVERLAY)}; + blockedOverlay = new IVertexOperation[] { new Translation(pos), lightMatrix, + new IconTransformation(Textures.PIPE_BLOCKED_OVERLAY) }; } else { - blockedOverlay = new IVertexOperation[]{new IconTransformation(Textures.PIPE_BLOCKED_OVERLAY)}; + blockedOverlay = new IVertexOperation[] { new IconTransformation(Textures.PIPE_BLOCKED_OVERLAY) }; } } @@ -485,9 +510,10 @@ public ColourMultiplier getColorOperation() { protected IVertexOperation[] getBaseVertexOperation() { if (pos == null) { - return lightMatrix == null ? new IVertexOperation[0] : new IVertexOperation[]{lightMatrix}; + return lightMatrix == null ? new IVertexOperation[0] : new IVertexOperation[] { lightMatrix }; } - return lightMatrix == null ? new IVertexOperation[]{new Translation(pos)} : new IVertexOperation[]{new Translation(pos), lightMatrix}; + return lightMatrix == null ? new IVertexOperation[] { new Translation(pos) } : + new IVertexOperation[] { new Translation(pos), lightMatrix }; } public int getConnections() { @@ -509,10 +535,10 @@ public List getOpenFaceRenderer() { public float getPipeThickness() { return pipeThickness; } - } - private static EnumMap borderMap(EnumFacing topSide, EnumFacing bottomSide, EnumFacing leftSide, EnumFacing rightSide) { + private static EnumMap borderMap(EnumFacing topSide, EnumFacing bottomSide, EnumFacing leftSide, + EnumFacing rightSide) { EnumMap sideMap = new EnumMap<>(Border.class); sideMap.put(Border.TOP, topSide); sideMap.put(Border.BOTTOM, bottomSide); @@ -526,7 +552,7 @@ private static void addRestrictor(TextureAtlasSprite sprite, Border... borders) for (Border border : borders) { mask |= border.mask; } - RESTRICTOR_MAP.put(mask, new IVertexOperation[]{new IconTransformation(sprite)}); + RESTRICTOR_MAP.put(mask, new IVertexOperation[] { new IconTransformation(sprite) }); } protected static EnumFacing getSideAtBorder(EnumFacing side, Border border) { @@ -534,7 +560,11 @@ protected static EnumFacing getSideAtBorder(EnumFacing side, Border border) { } public enum Border { - TOP, BOTTOM, LEFT, RIGHT; + + TOP, + BOTTOM, + LEFT, + RIGHT; public static final Border[] VALUES = values(); diff --git a/src/main/java/gregtech/client/renderer/scene/FBOWorldSceneRenderer.java b/src/main/java/gregtech/client/renderer/scene/FBOWorldSceneRenderer.java index 3ff6b3b13b4..c7ccac7e16f 100644 --- a/src/main/java/gregtech/client/renderer/scene/FBOWorldSceneRenderer.java +++ b/src/main/java/gregtech/client/renderer/scene/FBOWorldSceneRenderer.java @@ -1,6 +1,7 @@ package gregtech.client.renderer.scene; import gregtech.api.util.GTLog; + import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -12,6 +13,7 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.EXTFramebufferObject; import org.lwjgl.opengl.GL11; @@ -23,13 +25,14 @@ * @Author: KilaBash * @Date: 2021/08/23 * @Description: It looks similar to {@link ImmediateWorldSceneRenderer}, but totally different. - * It uses FBO and is more universality and efficient(X). - * FBO can be rendered anywhere more flexibly, not just in the GUI. - * If you have scene rendering needs, you will love this FBO renderer. - * TODO OP_LIST might be used in the future to further improve performance. + * It uses FBO and is more universality and efficient(X). + * FBO can be rendered anywhere more flexibly, not just in the GUI. + * If you have scene rendering needs, you will love this FBO renderer. + * TODO OP_LIST might be used in the future to further improve performance. */ @SideOnly(Side.CLIENT) public class FBOWorldSceneRenderer extends WorldSceneRenderer { + private int resolutionWidth = 1080; private int resolutionHeight = 1080; private Framebuffer fbo; @@ -68,12 +71,13 @@ public void setFBOSize(int resolutionWidth, int resolutionHeight) { public RayTraceResult screenPos2BlockPosFace(int mouseX, int mouseY) { int lastID = bindFBO(); - RayTraceResult looking = super.screenPos2BlockPosFace(mouseX, mouseY, 0, 0, this.resolutionWidth, this.resolutionHeight); + RayTraceResult looking = super.screenPos2BlockPosFace(mouseX, mouseY, 0, 0, this.resolutionWidth, + this.resolutionHeight); unbindFBO(lastID); return looking; } - public Vector3f blockPos2ScreenPos(BlockPos pos, boolean depth){ + public Vector3f blockPos2ScreenPos(BlockPos pos, boolean depth) { int lastID = bindFBO(); Vector3f winPos = super.blockPos2ScreenPos(pos, depth, 0, 0, this.resolutionWidth, this.resolutionHeight); unbindFBO(lastID); @@ -83,7 +87,8 @@ public Vector3f blockPos2ScreenPos(BlockPos pos, boolean depth){ public void render(float x, float y, float width, float height, float mouseX, float mouseY) { // bind to FBO int lastID = bindFBO(); - super.render(0, 0, this.resolutionWidth, this.resolutionHeight, (int) (this.resolutionWidth * mouseX / width), (int) (this.resolutionHeight * (1 - mouseY / height))); + super.render(0, 0, this.resolutionWidth, this.resolutionHeight, (int) (this.resolutionWidth * mouseX / width), + (int) (this.resolutionHeight * (1 - mouseY / height))); // unbind FBO unbindFBO(lastID); @@ -92,7 +97,7 @@ public void render(float x, float y, float width, float height, float mouseX, fl GlStateManager.disableLighting(); lastID = GL11.glGetInteger(GL11.GL_TEXTURE_2D); GlStateManager.bindTexture(fbo.framebufferTexture); - GlStateManager.color(1,1,1,1); + GlStateManager.color(1, 1, 1, 1); // render rect with FBO texture Tessellator tessellator = Tessellator.getInstance(); @@ -112,7 +117,7 @@ public void render(float x, float y, float width, float height, int mouseX, int render(x, y, width, height, (float) mouseX, (float) mouseY); } - private int bindFBO(){ + private int bindFBO() { int lastID = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT); fbo.setFramebufferColor(0.0F, 0.0F, 0.0F, 0.0F); fbo.framebufferClear(); @@ -121,7 +126,7 @@ private int bindFBO(){ return lastID; } - private void unbindFBO(int lastID){ + private void unbindFBO(int lastID) { GlStateManager.popMatrix(); fbo.unbindFramebufferTexture(); OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, lastID); diff --git a/src/main/java/gregtech/client/renderer/scene/ISceneRenderHook.java b/src/main/java/gregtech/client/renderer/scene/ISceneRenderHook.java index fe4d8acb3aa..e6674c9b4d2 100644 --- a/src/main/java/gregtech/client/renderer/scene/ISceneRenderHook.java +++ b/src/main/java/gregtech/client/renderer/scene/ISceneRenderHook.java @@ -8,8 +8,10 @@ * @Author: KilaBash * @Date: 2021/08/25 * @Description: Scene Render State hooks. - * This is where you decide whether or not this group of pos should be rendered. What other requirements do you have for rendering. + * This is where you decide whether or not this group of pos should be rendered. What other requirements + * do you have for rendering. */ public interface ISceneRenderHook { + void apply(boolean isTESR, int pass, BlockRenderLayer layer); } diff --git a/src/main/java/gregtech/client/renderer/scene/ImmediateWorldSceneRenderer.java b/src/main/java/gregtech/client/renderer/scene/ImmediateWorldSceneRenderer.java index 0b85cc8d79a..2a4972b7f07 100644 --- a/src/main/java/gregtech/client/renderer/scene/ImmediateWorldSceneRenderer.java +++ b/src/main/java/gregtech/client/renderer/scene/ImmediateWorldSceneRenderer.java @@ -1,19 +1,22 @@ package gregtech.client.renderer.scene; import gregtech.api.util.PositionedRect; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; /** * Created with IntelliJ IDEA. + * * @Author: KilaBash * @Date: 2021/8/24 * @Description: Real-time rendering renderer. - * If you need to render scene as a texture, use the FBO {@link FBOWorldSceneRenderer}. + * If you need to render scene as a texture, use the FBO {@link FBOWorldSceneRenderer}. */ @SideOnly(Side.CLIENT) public class ImmediateWorldSceneRenderer extends WorldSceneRenderer { @@ -26,17 +29,17 @@ public ImmediateWorldSceneRenderer(World world) { protected PositionedRect getPositionedRect(int x, int y, int width, int height) { Minecraft mc = Minecraft.getMinecraft(); ScaledResolution resolution = new ScaledResolution(mc); - //compute window size from scaled width & height + // compute window size from scaled width & height int windowWidth = (int) (width / (resolution.getScaledWidth() * 1.0) * mc.displayWidth); int windowHeight = (int) (height / (resolution.getScaledHeight() * 1.0) * mc.displayHeight); - //translate gui coordinates to window's ones (y is inverted) + // translate gui coordinates to window's ones (y is inverted) int windowX = (int) (x / (resolution.getScaledWidth() * 1.0) * mc.displayWidth); - int windowY = mc.displayHeight - (int) (y / (resolution.getScaledHeight() * 1.0) * mc.displayHeight) - windowHeight; + int windowY = mc.displayHeight - (int) (y / (resolution.getScaledHeight() * 1.0) * mc.displayHeight) - + windowHeight; return super.getPositionedRect(windowX, windowY, windowWidth, windowHeight); } - @Override protected void clearView(int x, int y, int width, int height) { GL11.glEnable(GL11.GL_SCISSOR_TEST); diff --git a/src/main/java/gregtech/client/renderer/scene/WorldSceneRenderer.java b/src/main/java/gregtech/client/renderer/scene/WorldSceneRenderer.java index 58be817eb1d..d5947edf46d 100644 --- a/src/main/java/gregtech/client/renderer/scene/WorldSceneRenderer.java +++ b/src/main/java/gregtech/client/renderer/scene/WorldSceneRenderer.java @@ -1,10 +1,10 @@ package gregtech.client.renderer.scene; -import codechicken.lib.vec.Vector3; import gregtech.api.util.Position; import gregtech.api.util.PositionedRect; import gregtech.api.util.Size; import gregtech.client.utils.RenderUtil; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -23,10 +23,11 @@ import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.vec.Vector3; import org.lwjgl.opengl.GL11; import org.lwjgl.util.glu.GLU; -import javax.vecmath.Vector3f; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; @@ -36,6 +37,8 @@ import java.util.Map; import java.util.function.Consumer; +import javax.vecmath.Vector3f; + /** * Created with IntelliJ IDEA. * @@ -45,11 +48,17 @@ */ @SideOnly(Side.CLIENT) public abstract class WorldSceneRenderer { - protected static final FloatBuffer MODELVIEW_MATRIX_BUFFER = ByteBuffer.allocateDirect(16 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); - protected static final FloatBuffer PROJECTION_MATRIX_BUFFER = ByteBuffer.allocateDirect(16 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); - protected static final IntBuffer VIEWPORT_BUFFER = ByteBuffer.allocateDirect(16 * 4).order(ByteOrder.nativeOrder()).asIntBuffer(); - protected static final FloatBuffer PIXEL_DEPTH_BUFFER = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asFloatBuffer(); - protected static final FloatBuffer OBJECT_POS_BUFFER = ByteBuffer.allocateDirect(3 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); + + protected static final FloatBuffer MODELVIEW_MATRIX_BUFFER = ByteBuffer.allocateDirect(16 * 4) + .order(ByteOrder.nativeOrder()).asFloatBuffer(); + protected static final FloatBuffer PROJECTION_MATRIX_BUFFER = ByteBuffer.allocateDirect(16 * 4) + .order(ByteOrder.nativeOrder()).asFloatBuffer(); + protected static final IntBuffer VIEWPORT_BUFFER = ByteBuffer.allocateDirect(16 * 4).order(ByteOrder.nativeOrder()) + .asIntBuffer(); + protected static final FloatBuffer PIXEL_DEPTH_BUFFER = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()) + .asFloatBuffer(); + protected static final FloatBuffer OBJECT_POS_BUFFER = ByteBuffer.allocateDirect(3 * 4) + .order(ByteOrder.nativeOrder()).asFloatBuffer(); public final World world; public final Map, ISceneRenderHook> renderedBlocksMap; @@ -99,7 +108,7 @@ public RayTraceResult getLastTraceResult() { public void render(float x, float y, float width, float height, int mouseX, int mouseY) { // setupCamera - PositionedRect positionedRect = getPositionedRect((int)x, (int)y, (int)width, (int)height); + PositionedRect positionedRect = getPositionedRect((int) x, (int) y, (int) width, (int) height); PositionedRect mouse = getPositionedRect(mouseX, mouseY, 0, 0); mouseX = mouse.position.x; mouseY = mouse.position.y; @@ -108,8 +117,9 @@ public void render(float x, float y, float width, float height, int mouseX, int drawWorld(); // check lookingAt this.lastTraceResult = null; - if (onLookingAt != null && mouseX > positionedRect.position.x && mouseX < positionedRect.position.x + positionedRect.size.width - && mouseY > positionedRect.position.y && mouseY < positionedRect.position.y + positionedRect.size.height) { + if (onLookingAt != null && mouseX > positionedRect.position.x && + mouseX < positionedRect.position.x + positionedRect.size.width && mouseY > positionedRect.position.y && + mouseY < positionedRect.position.y + positionedRect.size.height) { Vector3f hitPos = unProject(mouseX, mouseY); RayTraceResult result = rayTrace(hitPos); if (result != null) { @@ -143,7 +153,7 @@ public void setCameraLookAt(Vector3f eyePos, Vector3f lookAt, Vector3f worldUp) public void setCameraLookAt(Vector3f lookAt, double radius, double rotationPitch, double rotationYaw) { this.lookAt = lookAt; Vector3 vecX = new Vector3(Math.cos(rotationPitch), 0, Math.sin(rotationPitch)); - Vector3 vecY = new Vector3(0, Math.tan(rotationYaw) * vecX.mag(),0); + Vector3 vecY = new Vector3(0, Math.tan(rotationYaw) * vecX.mag(), 0); Vector3 pos = vecX.copy().add(vecY).normalize().multiply(radius); this.eyePos = pos.add(lookAt.x, lookAt.y, lookAt.z).vector3f(); } @@ -165,12 +175,12 @@ protected void setupCamera(PositionedRect positionedRect) { GlStateManager.enableDepth(); GlStateManager.enableBlend(); - //setup viewport and clear GL buffers + // setup viewport and clear GL buffers GlStateManager.viewport(x, y, width, height); clearView(x, y, width, height); - //setup projection matrix to perspective + // setup projection matrix to perspective GlStateManager.matrixMode(GL11.GL_PROJECTION); GlStateManager.pushMatrix(); GlStateManager.loadIdentity(); @@ -178,7 +188,7 @@ protected void setupCamera(PositionedRect positionedRect) { float aspectRatio = width / (height * 1.0f); GLU.gluPerspective(60.0f, aspectRatio, 0.1f, 10000.0f); - //setup modelview matrix + // setup modelview matrix GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.pushMatrix(); GlStateManager.loadIdentity(); @@ -191,22 +201,22 @@ protected void clearView(int x, int y, int width, int height) { } protected static void resetCamera() { - //reset viewport + // reset viewport Minecraft minecraft = Minecraft.getMinecraft(); GlStateManager.viewport(0, 0, minecraft.displayWidth, minecraft.displayHeight); - //reset projection matrix + // reset projection matrix GlStateManager.matrixMode(GL11.GL_PROJECTION); GlStateManager.popMatrix(); - //reset modelview matrix + // reset modelview matrix GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.popMatrix(); GlStateManager.disableBlend(); GlStateManager.disableDepth(); - //reset attributes + // reset attributes GlStateManager.popAttrib(); } @@ -231,7 +241,7 @@ protected void drawWorld() { ForgeHooksClient.setRenderLayer(layer); int pass = layer == BlockRenderLayer.TRANSLUCENT ? 1 : 0; - renderedBlocksMap.forEach((renderedBlocks, hook)->{ + renderedBlocksMap.forEach((renderedBlocks, hook) -> { if (hook != null) { hook.apply(false, pass, layer); } else { @@ -267,7 +277,7 @@ protected void drawWorld() { for (int pass = 0; pass < 2; pass++) { ForgeHooksClient.setRenderPass(pass); int finalPass = pass; - renderedBlocksMap.forEach((renderedBlocks, hook)->{ + renderedBlocksMap.forEach((renderedBlocks, hook) -> { if (hook != null) { hook.apply(true, finalPass, null); } else { @@ -314,85 +324,89 @@ public RayTraceResult rayTrace(Vector3f hitPos) { } public static Vector3f project(BlockPos pos) { - //read current rendering parameters + // read current rendering parameters GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, MODELVIEW_MATRIX_BUFFER); GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, PROJECTION_MATRIX_BUFFER); GL11.glGetInteger(GL11.GL_VIEWPORT, VIEWPORT_BUFFER); - //rewind buffers after write by OpenGL glGet calls + // rewind buffers after write by OpenGL glGet calls MODELVIEW_MATRIX_BUFFER.rewind(); PROJECTION_MATRIX_BUFFER.rewind(); VIEWPORT_BUFFER.rewind(); - //call gluProject with retrieved parameters - GLU.gluProject(pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f, MODELVIEW_MATRIX_BUFFER, PROJECTION_MATRIX_BUFFER, VIEWPORT_BUFFER, OBJECT_POS_BUFFER); + // call gluProject with retrieved parameters + GLU.gluProject(pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f, MODELVIEW_MATRIX_BUFFER, + PROJECTION_MATRIX_BUFFER, VIEWPORT_BUFFER, OBJECT_POS_BUFFER); - //rewind buffers after read by gluProject + // rewind buffers after read by gluProject VIEWPORT_BUFFER.rewind(); PROJECTION_MATRIX_BUFFER.rewind(); MODELVIEW_MATRIX_BUFFER.rewind(); - //rewind buffer after write by gluProject + // rewind buffer after write by gluProject OBJECT_POS_BUFFER.rewind(); - //obtain position in Screen + // obtain position in Screen float winX = OBJECT_POS_BUFFER.get(); float winY = OBJECT_POS_BUFFER.get(); float winZ = OBJECT_POS_BUFFER.get(); - //rewind buffer after read + // rewind buffer after read OBJECT_POS_BUFFER.rewind(); return new Vector3f(winX, winY, winZ); } public static Vector3f unProject(int mouseX, int mouseY) { - //read depth of pixel under mouse + // read depth of pixel under mouse GL11.glReadPixels(mouseX, mouseY, 1, 1, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, PIXEL_DEPTH_BUFFER); - //rewind buffer after write by glReadPixels + // rewind buffer after write by glReadPixels PIXEL_DEPTH_BUFFER.rewind(); - //retrieve depth from buffer (0.0-1.0f) + // retrieve depth from buffer (0.0-1.0f) float pixelDepth = PIXEL_DEPTH_BUFFER.get(); - //rewind buffer after read + // rewind buffer after read PIXEL_DEPTH_BUFFER.rewind(); - //read current rendering parameters + // read current rendering parameters GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, MODELVIEW_MATRIX_BUFFER); GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, PROJECTION_MATRIX_BUFFER); GL11.glGetInteger(GL11.GL_VIEWPORT, VIEWPORT_BUFFER); - //rewind buffers after write by OpenGL glGet calls + // rewind buffers after write by OpenGL glGet calls MODELVIEW_MATRIX_BUFFER.rewind(); PROJECTION_MATRIX_BUFFER.rewind(); VIEWPORT_BUFFER.rewind(); - //call gluUnProject with retrieved parameters - GLU.gluUnProject(mouseX, mouseY, pixelDepth, MODELVIEW_MATRIX_BUFFER, PROJECTION_MATRIX_BUFFER, VIEWPORT_BUFFER, OBJECT_POS_BUFFER); + // call gluUnProject with retrieved parameters + GLU.gluUnProject(mouseX, mouseY, pixelDepth, MODELVIEW_MATRIX_BUFFER, PROJECTION_MATRIX_BUFFER, VIEWPORT_BUFFER, + OBJECT_POS_BUFFER); - //rewind buffers after read by gluUnProject + // rewind buffers after read by gluUnProject VIEWPORT_BUFFER.rewind(); PROJECTION_MATRIX_BUFFER.rewind(); MODELVIEW_MATRIX_BUFFER.rewind(); - //rewind buffer after write by gluUnProject + // rewind buffer after write by gluUnProject OBJECT_POS_BUFFER.rewind(); - //obtain absolute position in world + // obtain absolute position in world float posX = OBJECT_POS_BUFFER.get(); float posY = OBJECT_POS_BUFFER.get(); float posZ = OBJECT_POS_BUFFER.get(); - //rewind buffer after read + // rewind buffer after read OBJECT_POS_BUFFER.rewind(); return new Vector3f(posX, posY, posZ); } /*** - * For better performance, You'd better handle the event {@link #setOnLookingAt(Consumer)} or {@link #getLastTraceResult()} + * For better performance, You'd better handle the event {@link #setOnLookingAt(Consumer)} or + * {@link #getLastTraceResult()} + * * @param mouseX xPos in Texture * @param mouseY yPos in Texture * @return RayTraceResult Hit @@ -414,11 +428,12 @@ protected RayTraceResult screenPos2BlockPosFace(int mouseX, int mouseY, int x, i /*** * For better performance, You'd better do project in {@link #setAfterWorldRender(Consumer)} - * @param pos BlockPos + * + * @param pos BlockPos * @param depth should pass Depth Test * @return x, y, z */ - protected Vector3f blockPos2ScreenPos(BlockPos pos, boolean depth, int x, int y, int width, int height){ + protected Vector3f blockPos2ScreenPos(BlockPos pos, boolean depth, int x, int y, int width, int height) { // render a frame GlStateManager.enableDepth(); setupCamera(getPositionedRect(x, y, width, height)); @@ -430,5 +445,4 @@ protected Vector3f blockPos2ScreenPos(BlockPos pos, boolean depth, int x, int y, return winPos; } - } diff --git a/src/main/java/gregtech/client/renderer/texture/Textures.java b/src/main/java/gregtech/client/renderer/texture/Textures.java index b3a750b10fe..09de1dbb6ef 100644 --- a/src/main/java/gregtech/client/renderer/texture/Textures.java +++ b/src/main/java/gregtech/client/renderer/texture/Textures.java @@ -1,14 +1,5 @@ package gregtech.client.renderer.texture; -import codechicken.lib.render.BlockRenderer.BlockFace; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.TransformationList; -import codechicken.lib.vec.uv.IconTransformation; -import codechicken.lib.vec.uv.UVTransformationList; import gregtech.api.GTValues; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.info.MaterialIconType; @@ -18,6 +9,7 @@ import gregtech.client.renderer.cclop.UVMirror; import gregtech.client.renderer.texture.cube.*; import gregtech.client.renderer.texture.custom.*; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -25,6 +17,16 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.BlockRenderer.BlockFace; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.TransformationList; +import codechicken.lib.vec.uv.IconTransformation; +import codechicken.lib.vec.uv.UVTransformationList; import org.apache.commons.lang3.ArrayUtils; import java.util.ArrayList; @@ -52,259 +54,441 @@ public class Textures { public static final QuantumStorageRenderer QUANTUM_STORAGE_RENDERER = new QuantumStorageRenderer(); // Simple Cube Renderers - public static final SimpleOverlayRenderer BRONZE_PLATED_BRICKS = new SimpleOverlayRenderer("casings/solid/machine_bronze_plated_bricks"); - public static final SimpleOverlayRenderer PRIMITIVE_BRICKS = new SimpleOverlayRenderer("casings/solid/machine_primitive_bricks"); - public static final SimpleOverlayRenderer COKE_BRICKS = new SimpleOverlayRenderer("casings/solid/machine_coke_bricks"); - public static final SimpleOverlayRenderer HEAT_PROOF_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_heatproof"); - public static final SimpleOverlayRenderer FROST_PROOF_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_frost_proof"); - public static final SimpleOverlayRenderer SOLID_STEEL_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_solid_steel"); - public static final SimpleOverlayRenderer CLEAN_STAINLESS_STEEL_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_clean_stainless_steel"); - public static final SimpleOverlayRenderer STABLE_TITANIUM_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_stable_titanium"); - public static final SimpleOverlayRenderer ROBUST_TUNGSTENSTEEL_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_robust_tungstensteel"); - public static final SimpleOverlayRenderer STURDY_HSSE_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_sturdy_hsse"); - public static final SimpleOverlayRenderer PALLADIUM_SUBSTATION_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_palladium_substation"); - public static final SimpleOverlayRenderer INERT_PTFE_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_inert_ptfe"); + public static final SimpleOverlayRenderer BRONZE_PLATED_BRICKS = new SimpleOverlayRenderer( + "casings/solid/machine_bronze_plated_bricks"); + public static final SimpleOverlayRenderer PRIMITIVE_BRICKS = new SimpleOverlayRenderer( + "casings/solid/machine_primitive_bricks"); + public static final SimpleOverlayRenderer COKE_BRICKS = new SimpleOverlayRenderer( + "casings/solid/machine_coke_bricks"); + public static final SimpleOverlayRenderer HEAT_PROOF_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_heatproof"); + public static final SimpleOverlayRenderer FROST_PROOF_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_frost_proof"); + public static final SimpleOverlayRenderer SOLID_STEEL_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_solid_steel"); + public static final SimpleOverlayRenderer CLEAN_STAINLESS_STEEL_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_clean_stainless_steel"); + public static final SimpleOverlayRenderer STABLE_TITANIUM_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_stable_titanium"); + public static final SimpleOverlayRenderer ROBUST_TUNGSTENSTEEL_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_robust_tungstensteel"); + public static final SimpleOverlayRenderer STURDY_HSSE_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_sturdy_hsse"); + public static final SimpleOverlayRenderer PALLADIUM_SUBSTATION_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_palladium_substation"); + public static final SimpleOverlayRenderer INERT_PTFE_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_inert_ptfe"); public static final SimpleOverlayRenderer PLASCRETE = new SimpleOverlayRenderer("casings/cleanroom/plascrete"); - public static final SimpleOverlayRenderer FUSION_TEXTURE = new SimpleOverlayRenderer("casings/fusion/machine_casing_fusion_hatch"); - public static final SimpleOverlayRenderer ACTIVE_FUSION_TEXTURE = new SimpleOverlayRenderer("casings/fusion/machine_casing_fusion_hatch_yellow"); - public static final SimpleOverlayRenderer GRATE_CASING = new SimpleOverlayRenderer("casings/pipe/machine_casing_grate"); - public static final SimpleOverlayRenderer HIGH_POWER_CASING = new SimpleOverlayRenderer("casings/computer/high_power_casing"); + public static final SimpleOverlayRenderer FUSION_TEXTURE = new SimpleOverlayRenderer( + "casings/fusion/machine_casing_fusion_hatch"); + public static final SimpleOverlayRenderer ACTIVE_FUSION_TEXTURE = new SimpleOverlayRenderer( + "casings/fusion/machine_casing_fusion_hatch_yellow"); + public static final SimpleOverlayRenderer GRATE_CASING = new SimpleOverlayRenderer( + "casings/pipe/machine_casing_grate"); + public static final SimpleOverlayRenderer HIGH_POWER_CASING = new SimpleOverlayRenderer( + "casings/computer/high_power_casing"); // Simple Sided Cube Renderers - public static final SimpleSidedCubeRenderer STEAM_CASING_BRONZE = new SimpleSidedCubeRenderer("casings/steam/bronze"); + public static final SimpleSidedCubeRenderer STEAM_CASING_BRONZE = new SimpleSidedCubeRenderer( + "casings/steam/bronze"); public static final SimpleSidedCubeRenderer STEAM_CASING_STEEL = new SimpleSidedCubeRenderer("casings/steam/steel"); - public static final SimpleSidedCubeRenderer STEAM_BRICKED_CASING_BRONZE = new SimpleSidedCubeRenderer("casings/steam/bricked_bronze"); - public static final SimpleSidedCubeRenderer STEAM_BRICKED_CASING_STEEL = new SimpleSidedCubeRenderer("casings/steam/bricked_steel"); + public static final SimpleSidedCubeRenderer STEAM_BRICKED_CASING_BRONZE = new SimpleSidedCubeRenderer( + "casings/steam/bricked_bronze"); + public static final SimpleSidedCubeRenderer STEAM_BRICKED_CASING_STEEL = new SimpleSidedCubeRenderer( + "casings/steam/bricked_steel"); public static final SimpleSidedCubeRenderer[] VOLTAGE_CASINGS = new SimpleSidedCubeRenderer[GTValues.V.length]; public static final SimpleSidedCubeRenderer PRIMITIVE_PUMP = new SimpleSidedCubeRenderer("casings/pump_deck"); public static final SimpleSidedCubeRenderer WOOD_WALL = new SimpleSidedCubeRenderer("casings/wood_wall"); - public static final SimpleSidedCubeRenderer MAGIC_ENERGY_ABSORBER = new SimpleSidedCubeRenderer("casings/magic/absorber/normal"); - public static final SimpleSidedCubeRenderer MAGIC_ENERGY_ABSORBER_ACTIVE = new SimpleSidedCubeRenderer("casings/magic/absorber/active"); + public static final SimpleSidedCubeRenderer MAGIC_ENERGY_ABSORBER = new SimpleSidedCubeRenderer( + "casings/magic/absorber/normal"); + public static final SimpleSidedCubeRenderer MAGIC_ENERGY_ABSORBER_ACTIVE = new SimpleSidedCubeRenderer( + "casings/magic/absorber/active"); public static final SimpleSidedCubeRenderer DRUM_OVERLAY = new SimpleSidedCubeRenderer("storage/drums/drum_top"); // Simple Oriented Cube Renderers - public static final SimpleOrientedCubeRenderer CRAFTING_TABLE = new SimpleOrientedCubeRenderer("casings/crafting_table"); - public static final SimpleOrientedCubeRenderer GRATE_CASING_STEEL_FRONT = new SimpleOrientedCubeRenderer("casings/pipe/grate_steel_front"); + public static final SimpleOrientedCubeRenderer CRAFTING_TABLE = new SimpleOrientedCubeRenderer( + "casings/crafting_table"); + public static final SimpleOrientedCubeRenderer GRATE_CASING_STEEL_FRONT = new SimpleOrientedCubeRenderer( + "casings/pipe/grate_steel_front"); // Oriented Overlay Renderers - public static final OrientedOverlayRenderer COAL_BOILER_OVERLAY = new OrientedOverlayRenderer("generators/boiler/coal"); - public static final OrientedOverlayRenderer LAVA_BOILER_OVERLAY = new OrientedOverlayRenderer("generators/boiler/lava"); - public static final OrientedOverlayRenderer SOLAR_BOILER_OVERLAY = new OrientedOverlayRenderer("generators/boiler/solar"); - public static final OrientedOverlayRenderer PRIMITIVE_PUMP_OVERLAY = new OrientedOverlayRenderer("multiblock/primitive_pump"); - public static final OrientedOverlayRenderer PRIMITIVE_BLAST_FURNACE_OVERLAY = new OrientedOverlayRenderer("multiblock/primitive_blast_furnace"); + public static final OrientedOverlayRenderer COAL_BOILER_OVERLAY = new OrientedOverlayRenderer( + "generators/boiler/coal"); + public static final OrientedOverlayRenderer LAVA_BOILER_OVERLAY = new OrientedOverlayRenderer( + "generators/boiler/lava"); + public static final OrientedOverlayRenderer SOLAR_BOILER_OVERLAY = new OrientedOverlayRenderer( + "generators/boiler/solar"); + public static final OrientedOverlayRenderer PRIMITIVE_PUMP_OVERLAY = new OrientedOverlayRenderer( + "multiblock/primitive_pump"); + public static final OrientedOverlayRenderer PRIMITIVE_BLAST_FURNACE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/primitive_blast_furnace"); public static final OrientedOverlayRenderer COKE_OVEN_OVERLAY = new OrientedOverlayRenderer("multiblock/coke_oven"); - public static final OrientedOverlayRenderer MULTIBLOCK_WORKABLE_OVERLAY = new OrientedOverlayRenderer("multiblock/multiblock_workable"); - public static final OrientedOverlayRenderer BLAST_FURNACE_OVERLAY = new OrientedOverlayRenderer("multiblock/blast_furnace"); - public static final OrientedOverlayRenderer IMPLOSION_COMPRESSOR_OVERLAY = new OrientedOverlayRenderer("multiblock/implosion_compressor"); - public static final OrientedOverlayRenderer MULTI_FURNACE_OVERLAY = new OrientedOverlayRenderer("multiblock/multi_furnace"); - public static final OrientedOverlayRenderer PYROLYSE_OVEN_OVERLAY = new OrientedOverlayRenderer("multiblock/pyrolyse_oven"); - public static final OrientedOverlayRenderer VACUUM_FREEZER_OVERLAY = new OrientedOverlayRenderer("multiblock/vacuum_freezer"); - public static final OrientedOverlayRenderer DISTILLATION_TOWER_OVERLAY = new OrientedOverlayRenderer("multiblock/distillation_tower"); - public static final OrientedOverlayRenderer CRACKING_UNIT_OVERLAY = new OrientedOverlayRenderer("multiblock/cracking_unit"); - public static final OrientedOverlayRenderer LARGE_CHEMICAL_REACTOR_OVERLAY = new OrientedOverlayRenderer("multiblock/large_chemical_reactor"); - public static final OrientedOverlayRenderer LARGE_COMBUSTION_ENGINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/large_combustion_engine"); - public static final OrientedOverlayRenderer EXTREME_COMBUSTION_ENGINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/extreme_combustion_engine"); - public static final OrientedOverlayRenderer FLUID_RIG_OVERLAY = new OrientedOverlayRenderer("multiblock/fluid_drilling_rig"); - public static final OrientedOverlayRenderer LARGE_STEAM_TURBINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/large_steam_turbine"); - public static final OrientedOverlayRenderer LARGE_GAS_TURBINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/large_gas_turbine"); - public static final OrientedOverlayRenderer LARGE_PLASMA_TURBINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/large_plasma_turbine"); - public static final OrientedOverlayRenderer LARGE_BRONZE_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_bronze_boiler"); - public static final OrientedOverlayRenderer LARGE_STEEL_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_steel_boiler"); - public static final OrientedOverlayRenderer LARGE_TITANIUM_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_titanium_boiler"); - public static final OrientedOverlayRenderer LARGE_TUNGSTENSTEEL_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_tungstensteel_boiler"); - public static final OrientedOverlayRenderer FUSION_REACTOR_OVERLAY = new OrientedOverlayRenderer("multiblock/fusion_reactor"); - public static final OrientedOverlayRenderer PROCESSING_ARRAY_OVERLAY = new OrientedOverlayRenderer("multiblock/processing_array"); - public static final OrientedOverlayRenderer ADVANCED_PROCESSING_ARRAY_OVERLAY = new OrientedOverlayRenderer("multiblock/advanced_processing_array"); - public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_BASIC = new OrientedOverlayRenderer("multiblock/large_miner_basic"); - public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_ADVANCED = new OrientedOverlayRenderer("multiblock/large_miner_advanced"); - public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_ADVANCED_2 = new OrientedOverlayRenderer("multiblock/large_miner_advanced_2"); + public static final OrientedOverlayRenderer MULTIBLOCK_WORKABLE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/multiblock_workable"); + public static final OrientedOverlayRenderer BLAST_FURNACE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/blast_furnace"); + public static final OrientedOverlayRenderer IMPLOSION_COMPRESSOR_OVERLAY = new OrientedOverlayRenderer( + "multiblock/implosion_compressor"); + public static final OrientedOverlayRenderer MULTI_FURNACE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/multi_furnace"); + public static final OrientedOverlayRenderer PYROLYSE_OVEN_OVERLAY = new OrientedOverlayRenderer( + "multiblock/pyrolyse_oven"); + public static final OrientedOverlayRenderer VACUUM_FREEZER_OVERLAY = new OrientedOverlayRenderer( + "multiblock/vacuum_freezer"); + public static final OrientedOverlayRenderer DISTILLATION_TOWER_OVERLAY = new OrientedOverlayRenderer( + "multiblock/distillation_tower"); + public static final OrientedOverlayRenderer CRACKING_UNIT_OVERLAY = new OrientedOverlayRenderer( + "multiblock/cracking_unit"); + public static final OrientedOverlayRenderer LARGE_CHEMICAL_REACTOR_OVERLAY = new OrientedOverlayRenderer( + "multiblock/large_chemical_reactor"); + public static final OrientedOverlayRenderer LARGE_COMBUSTION_ENGINE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/generator/large_combustion_engine"); + public static final OrientedOverlayRenderer EXTREME_COMBUSTION_ENGINE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/generator/extreme_combustion_engine"); + public static final OrientedOverlayRenderer FLUID_RIG_OVERLAY = new OrientedOverlayRenderer( + "multiblock/fluid_drilling_rig"); + public static final OrientedOverlayRenderer LARGE_STEAM_TURBINE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/generator/large_steam_turbine"); + public static final OrientedOverlayRenderer LARGE_GAS_TURBINE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/generator/large_gas_turbine"); + public static final OrientedOverlayRenderer LARGE_PLASMA_TURBINE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/generator/large_plasma_turbine"); + public static final OrientedOverlayRenderer LARGE_BRONZE_BOILER = new OrientedOverlayRenderer( + "multiblock/generator/large_bronze_boiler"); + public static final OrientedOverlayRenderer LARGE_STEEL_BOILER = new OrientedOverlayRenderer( + "multiblock/generator/large_steel_boiler"); + public static final OrientedOverlayRenderer LARGE_TITANIUM_BOILER = new OrientedOverlayRenderer( + "multiblock/generator/large_titanium_boiler"); + public static final OrientedOverlayRenderer LARGE_TUNGSTENSTEEL_BOILER = new OrientedOverlayRenderer( + "multiblock/generator/large_tungstensteel_boiler"); + public static final OrientedOverlayRenderer FUSION_REACTOR_OVERLAY = new OrientedOverlayRenderer( + "multiblock/fusion_reactor"); + public static final OrientedOverlayRenderer PROCESSING_ARRAY_OVERLAY = new OrientedOverlayRenderer( + "multiblock/processing_array"); + public static final OrientedOverlayRenderer ADVANCED_PROCESSING_ARRAY_OVERLAY = new OrientedOverlayRenderer( + "multiblock/advanced_processing_array"); + public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_BASIC = new OrientedOverlayRenderer( + "multiblock/large_miner_basic"); + public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_ADVANCED = new OrientedOverlayRenderer( + "multiblock/large_miner_advanced"); + public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_ADVANCED_2 = new OrientedOverlayRenderer( + "multiblock/large_miner_advanced_2"); public static final OrientedOverlayRenderer CLEANROOM_OVERLAY = new OrientedOverlayRenderer("multiblock/cleanroom"); - public static final OrientedOverlayRenderer MULTIBLOCK_TANK_OVERLAY = new OrientedOverlayRenderer("multiblock/multiblock_tank"); - public static final OrientedOverlayRenderer CHARCOAL_PILE_OVERLAY = new OrientedOverlayRenderer("multiblock/charcoal_pile_igniter"); + public static final OrientedOverlayRenderer MULTIBLOCK_TANK_OVERLAY = new OrientedOverlayRenderer( + "multiblock/multiblock_tank"); + public static final OrientedOverlayRenderer CHARCOAL_PILE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/charcoal_pile_igniter"); public static final OrientedOverlayRenderer DATA_BANK_OVERLAY = new OrientedOverlayRenderer("multiblock/data_bank"); - public static final OrientedOverlayRenderer RESEARCH_STATION_OVERLAY = new OrientedOverlayRenderer("multiblock/research_station"); + public static final OrientedOverlayRenderer RESEARCH_STATION_OVERLAY = new OrientedOverlayRenderer( + "multiblock/research_station"); public static final OrientedOverlayRenderer HPCA_OVERLAY = new OrientedOverlayRenderer("multiblock/hpca"); - public static final OrientedOverlayRenderer NETWORK_SWITCH_OVERLAY = new OrientedOverlayRenderer("multiblock/network_switch"); - public static final OrientedOverlayRenderer POWER_SUBSTATION_OVERLAY = new OrientedOverlayRenderer("multiblock/power_substation"); + public static final OrientedOverlayRenderer NETWORK_SWITCH_OVERLAY = new OrientedOverlayRenderer( + "multiblock/network_switch"); + public static final OrientedOverlayRenderer POWER_SUBSTATION_OVERLAY = new OrientedOverlayRenderer( + "multiblock/power_substation"); - public static final OrientedOverlayRenderer ALLOY_SMELTER_OVERLAY = new OrientedOverlayRenderer("machines/alloy_smelter"); + public static final OrientedOverlayRenderer ALLOY_SMELTER_OVERLAY = new OrientedOverlayRenderer( + "machines/alloy_smelter"); public static final OrientedOverlayRenderer FURNACE_OVERLAY = new OrientedOverlayRenderer("machines/furnace"); - public static final OrientedOverlayRenderer ELECTRIC_FURNACE_OVERLAY = new OrientedOverlayRenderer("machines/electric_furnace"); + public static final OrientedOverlayRenderer ELECTRIC_FURNACE_OVERLAY = new OrientedOverlayRenderer( + "machines/electric_furnace"); public static final OrientedOverlayRenderer EXTRACTOR_OVERLAY = new OrientedOverlayRenderer("machines/extractor"); public static final OrientedOverlayRenderer COMPRESSOR_OVERLAY = new OrientedOverlayRenderer("machines/compressor"); public static final OrientedOverlayRenderer MACERATOR_OVERLAY = new OrientedOverlayRenderer("machines/macerator"); public static final OrientedOverlayRenderer PULVERIZER_OVERLAY = new OrientedOverlayRenderer("machines/pulverizer"); - public static final OrientedOverlayRenderer ARC_FURNACE_OVERLAY = new OrientedOverlayRenderer("machines/arc_furnace"); + public static final OrientedOverlayRenderer ARC_FURNACE_OVERLAY = new OrientedOverlayRenderer( + "machines/arc_furnace"); public static final OrientedOverlayRenderer ASSEMBLER_OVERLAY = new OrientedOverlayRenderer("machines/assembler"); public static final OrientedOverlayRenderer AUTOCLAVE_OVERLAY = new OrientedOverlayRenderer("machines/autoclave"); public static final OrientedOverlayRenderer BENDER_OVERLAY = new OrientedOverlayRenderer("machines/bender"); public static final OrientedOverlayRenderer BREWERY_OVERLAY = new OrientedOverlayRenderer("machines/brewery"); public static final OrientedOverlayRenderer CANNER_OVERLAY = new OrientedOverlayRenderer("machines/canner"); public static final OrientedOverlayRenderer CENTRIFUGE_OVERLAY = new OrientedOverlayRenderer("machines/centrifuge"); - public static final OrientedOverlayRenderer CHEMICAL_BATH_OVERLAY = new OrientedOverlayRenderer("machines/chemical_bath"); - public static final OrientedOverlayRenderer CHEMICAL_REACTOR_OVERLAY = new OrientedOverlayRenderer("machines/chemical_reactor"); + public static final OrientedOverlayRenderer CHEMICAL_BATH_OVERLAY = new OrientedOverlayRenderer( + "machines/chemical_bath"); + public static final OrientedOverlayRenderer CHEMICAL_REACTOR_OVERLAY = new OrientedOverlayRenderer( + "machines/chemical_reactor"); public static final OrientedOverlayRenderer CUTTER_OVERLAY = new OrientedOverlayRenderer("machines/cutter"); public static final OrientedOverlayRenderer DISTILLERY_OVERLAY = new OrientedOverlayRenderer("machines/distillery"); - public static final OrientedOverlayRenderer ELECTROLYZER_OVERLAY = new OrientedOverlayRenderer("machines/electrolyzer"); - public static final OrientedOverlayRenderer ELECTROMAGNETIC_SEPARATOR_OVERLAY = new OrientedOverlayRenderer("machines/electromagnetic_separator"); + public static final OrientedOverlayRenderer ELECTROLYZER_OVERLAY = new OrientedOverlayRenderer( + "machines/electrolyzer"); + public static final OrientedOverlayRenderer ELECTROMAGNETIC_SEPARATOR_OVERLAY = new OrientedOverlayRenderer( + "machines/electromagnetic_separator"); public static final OrientedOverlayRenderer EXTRUDER_OVERLAY = new OrientedOverlayRenderer("machines/extruder"); public static final OrientedOverlayRenderer FERMENTER_OVERLAY = new OrientedOverlayRenderer("machines/fermenter"); - public static final OrientedOverlayRenderer FLUID_HEATER_OVERLAY = new OrientedOverlayRenderer("machines/fluid_heater"); - public static final OrientedOverlayRenderer FLUID_SOLIDIFIER_OVERLAY = new OrientedOverlayRenderer("machines/fluid_solidifier"); - public static final OrientedOverlayRenderer FORGE_HAMMER_OVERLAY = new OrientedOverlayRenderer("machines/forge_hammer"); + public static final OrientedOverlayRenderer FLUID_HEATER_OVERLAY = new OrientedOverlayRenderer( + "machines/fluid_heater"); + public static final OrientedOverlayRenderer FLUID_SOLIDIFIER_OVERLAY = new OrientedOverlayRenderer( + "machines/fluid_solidifier"); + public static final OrientedOverlayRenderer FORGE_HAMMER_OVERLAY = new OrientedOverlayRenderer( + "machines/forge_hammer"); public static final OrientedOverlayRenderer FORMING_PRESS_OVERLAY = new OrientedOverlayRenderer("machines/press"); - public static final OrientedOverlayRenderer GAS_COLLECTOR_OVERLAY = new OrientedOverlayRenderer("machines/gas_collector"); + public static final OrientedOverlayRenderer GAS_COLLECTOR_OVERLAY = new OrientedOverlayRenderer( + "machines/gas_collector"); public static final OrientedOverlayRenderer LATHE_OVERLAY = new OrientedOverlayRenderer("machines/lathe"); public static final OrientedOverlayRenderer MIXER_OVERLAY = new OrientedOverlayRenderer("machines/mixer"); public static final OrientedOverlayRenderer ORE_WASHER_OVERLAY = new OrientedOverlayRenderer("machines/ore_washer"); public static final OrientedOverlayRenderer PACKER_OVERLAY = new OrientedOverlayRenderer("machines/packer"); public static final OrientedOverlayRenderer POLARIZER_OVERLAY = new OrientedOverlayRenderer("machines/polarizer"); - public static final OrientedOverlayRenderer LASER_ENGRAVER_OVERLAY = new OrientedOverlayRenderer("machines/laser_engraver"); - public static final OrientedOverlayRenderer ROCK_BREAKER_OVERLAY = new OrientedOverlayRenderer("machines/rock_crusher"); + public static final OrientedOverlayRenderer LASER_ENGRAVER_OVERLAY = new OrientedOverlayRenderer( + "machines/laser_engraver"); + public static final OrientedOverlayRenderer ROCK_BREAKER_OVERLAY = new OrientedOverlayRenderer( + "machines/rock_crusher"); public static final OrientedOverlayRenderer SIFTER_OVERLAY = new OrientedOverlayRenderer("machines/sifter"); - public static final OrientedOverlayRenderer THERMAL_CENTRIFUGE_OVERLAY = new OrientedOverlayRenderer("machines/thermal_centrifuge"); + public static final OrientedOverlayRenderer THERMAL_CENTRIFUGE_OVERLAY = new OrientedOverlayRenderer( + "machines/thermal_centrifuge"); public static final OrientedOverlayRenderer WIREMILL_OVERLAY = new OrientedOverlayRenderer("machines/wiremill"); - public static final OrientedOverlayRenderer MASS_FABRICATOR_OVERLAY = new OrientedOverlayRenderer("machines/mass_fabricator"); + public static final OrientedOverlayRenderer MASS_FABRICATOR_OVERLAY = new OrientedOverlayRenderer( + "machines/mass_fabricator"); public static final OrientedOverlayRenderer REPLICATOR_OVERLAY = new OrientedOverlayRenderer("machines/replicator"); public static final OrientedOverlayRenderer SCANNER_OVERLAY = new OrientedOverlayRenderer("machines/scanner"); - public static final OrientedOverlayRenderer COMBUSTION_GENERATOR_OVERLAY = new OrientedOverlayRenderer("generators/combustion"); - public static final OrientedOverlayRenderer GAS_TURBINE_OVERLAY = new OrientedOverlayRenderer("generators/gas_turbine"); - public static final OrientedOverlayRenderer STEAM_TURBINE_OVERLAY = new OrientedOverlayRenderer("generators/steam_turbine"); - public static final OrientedOverlayRenderer WORLD_ACCELERATOR_OVERLAY = new OrientedOverlayRenderer("machines/world_accelerator"); - public static final OrientedOverlayRenderer WORLD_ACCELERATOR_TE_OVERLAY = new OrientedOverlayRenderer("machines/world_accelerator_te"); - + public static final OrientedOverlayRenderer COMBUSTION_GENERATOR_OVERLAY = new OrientedOverlayRenderer( + "generators/combustion"); + public static final OrientedOverlayRenderer GAS_TURBINE_OVERLAY = new OrientedOverlayRenderer( + "generators/gas_turbine"); + public static final OrientedOverlayRenderer STEAM_TURBINE_OVERLAY = new OrientedOverlayRenderer( + "generators/steam_turbine"); + public static final OrientedOverlayRenderer WORLD_ACCELERATOR_OVERLAY = new OrientedOverlayRenderer( + "machines/world_accelerator"); + public static final OrientedOverlayRenderer WORLD_ACCELERATOR_TE_OVERLAY = new OrientedOverlayRenderer( + "machines/world_accelerator_te"); // Simple Overlay Renderers public static final SimpleOverlayRenderer SCREEN = new SimpleOverlayRenderer("overlay/machine/overlay_screen"); public static final SimpleOverlayRenderer DISPLAY = new SimpleOverlayRenderer("cover/overlay_display"); public static final SimpleOverlayRenderer SHUTTER = new SimpleOverlayRenderer("cover/overlay_shutter"); - public static final SimpleOverlayRenderer DETECTOR_ENERGY = new SimpleOverlayRenderer("cover/overlay_energy_detector"); - public static final SimpleOverlayRenderer DETECTOR_ENERGY_ADVANCED = new SimpleOverlayRenderer("cover/overlay_energy_detector_advanced"); - public static final SimpleOverlayRenderer DETECTOR_FLUID = new SimpleOverlayRenderer("cover/overlay_fluid_detector"); - public static final SimpleOverlayRenderer DETECTOR_FLUID_ADVANCED = new SimpleOverlayRenderer("cover/overlay_fluid_detector_advanced"); + public static final SimpleOverlayRenderer DETECTOR_ENERGY = new SimpleOverlayRenderer( + "cover/overlay_energy_detector"); + public static final SimpleOverlayRenderer DETECTOR_ENERGY_ADVANCED = new SimpleOverlayRenderer( + "cover/overlay_energy_detector_advanced"); + public static final SimpleOverlayRenderer DETECTOR_FLUID = new SimpleOverlayRenderer( + "cover/overlay_fluid_detector"); + public static final SimpleOverlayRenderer DETECTOR_FLUID_ADVANCED = new SimpleOverlayRenderer( + "cover/overlay_fluid_detector_advanced"); public static final SimpleOverlayRenderer DETECTOR_ITEM = new SimpleOverlayRenderer("cover/overlay_item_detector"); - public static final SimpleOverlayRenderer DETECTOR_ITEM_ADVANCED = new SimpleOverlayRenderer("cover/overlay_item_detector_advanced"); - public static final SimpleOverlayRenderer DETECTOR_ACTIVITY = new SimpleOverlayRenderer("cover/overlay_activity_detector"); - public static final SimpleOverlayRenderer DETECTOR_ACTIVITY_ADVANCED = new SimpleOverlayRenderer("cover/overlay_activity_detector_advanced"); - public static final SimpleOverlayRenderer DETECTOR_MAINTENANCE = new SimpleOverlayRenderer("cover/overlay_maintenance_detector"); + public static final SimpleOverlayRenderer DETECTOR_ITEM_ADVANCED = new SimpleOverlayRenderer( + "cover/overlay_item_detector_advanced"); + public static final SimpleOverlayRenderer DETECTOR_ACTIVITY = new SimpleOverlayRenderer( + "cover/overlay_activity_detector"); + public static final SimpleOverlayRenderer DETECTOR_ACTIVITY_ADVANCED = new SimpleOverlayRenderer( + "cover/overlay_activity_detector_advanced"); + public static final SimpleOverlayRenderer DETECTOR_MAINTENANCE = new SimpleOverlayRenderer( + "cover/overlay_maintenance_detector"); public static final SimpleOverlayRenderer SOLAR_PANEL = new SimpleOverlayRenderer("cover/overlay_solar_panel"); - public static final SimpleOverlayRenderer INFINITE_WATER = new SimpleOverlayRenderer("cover/overlay_infinite_water"); + public static final SimpleOverlayRenderer INFINITE_WATER = new SimpleOverlayRenderer( + "cover/overlay_infinite_water"); public static final SimpleOverlayRenderer FLUID_VOIDING = new SimpleOverlayRenderer("cover/overlay_fluid_voiding"); public static final SimpleOverlayRenderer ITEM_VOIDING = new SimpleOverlayRenderer("cover/overlay_item_voiding"); - public static final SimpleOverlayRenderer FLUID_VOIDING_ADVANCED = new SimpleOverlayRenderer("cover/overlay_fluid_voiding_advanced"); - public static final SimpleOverlayRenderer ITEM_VOIDING_ADVANCED = new SimpleOverlayRenderer("cover/overlay_item_voiding_advanced"); - public static final SimpleOverlayRenderer ENDER_FLUID_LINK = new SimpleOverlayRenderer("cover/overlay_ender_fluid_link"); + public static final SimpleOverlayRenderer FLUID_VOIDING_ADVANCED = new SimpleOverlayRenderer( + "cover/overlay_fluid_voiding_advanced"); + public static final SimpleOverlayRenderer ITEM_VOIDING_ADVANCED = new SimpleOverlayRenderer( + "cover/overlay_item_voiding_advanced"); + public static final SimpleOverlayRenderer ENDER_FLUID_LINK = new SimpleOverlayRenderer( + "cover/overlay_ender_fluid_link"); public static final SimpleOverlayRenderer STORAGE = new SimpleOverlayRenderer("cover/overlay_storage"); - public static final SimpleOverlayRenderer PIPE_OUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_pipe_out"); - public static final SimpleOverlayRenderer PIPE_IN_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_pipe_in"); - public static final SimpleOverlayRenderer PIPE_4X_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_pipe_4x"); - public static final SimpleOverlayRenderer PIPE_9X_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_pipe_9x"); - - public static final SimpleOverlayRenderer FLUID_OUTPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_fluid_output"); - public static final SimpleOverlayRenderer ITEM_OUTPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_item_output"); - - public static final SimpleOverlayRenderer FLUID_HATCH_OUTPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_fluid_hatch_output"); - public static final SimpleOverlayRenderer FLUID_HATCH_INPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_fluid_hatch_input"); - public static final SimpleOverlayRenderer ITEM_HATCH_OUTPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_item_hatch_output"); - public static final SimpleOverlayRenderer ITEM_HATCH_INPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_item_hatch_input"); - public static final SimpleOverlayRenderer WATER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_water"); + public static final SimpleOverlayRenderer PIPE_OUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_pipe_out"); + public static final SimpleOverlayRenderer PIPE_IN_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_pipe_in"); + public static final SimpleOverlayRenderer PIPE_4X_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_pipe_4x"); + public static final SimpleOverlayRenderer PIPE_9X_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_pipe_9x"); + + public static final SimpleOverlayRenderer FLUID_OUTPUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_fluid_output"); + public static final SimpleOverlayRenderer ITEM_OUTPUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_item_output"); + + public static final SimpleOverlayRenderer FLUID_HATCH_OUTPUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_fluid_hatch_output"); + public static final SimpleOverlayRenderer FLUID_HATCH_INPUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_fluid_hatch_input"); + public static final SimpleOverlayRenderer ITEM_HATCH_OUTPUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_item_hatch_output"); + public static final SimpleOverlayRenderer ITEM_HATCH_INPUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_item_hatch_input"); + public static final SimpleOverlayRenderer WATER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_water"); public static final ICubeRenderer BRONZE_FIREBOX = new SidedCubeRenderer("casings/firebox/overlay/bronze"); - public static final ICubeRenderer BRONZE_FIREBOX_ACTIVE = new FireboxActiveRenderer("casings/firebox/overlay/bronze/active"); + public static final ICubeRenderer BRONZE_FIREBOX_ACTIVE = new FireboxActiveRenderer( + "casings/firebox/overlay/bronze/active"); public static final ICubeRenderer STEEL_FIREBOX = new SidedCubeRenderer("casings/firebox/overlay/steel"); - public static final ICubeRenderer STEEL_FIREBOX_ACTIVE = new FireboxActiveRenderer("casings/firebox/overlay/steel/active"); + public static final ICubeRenderer STEEL_FIREBOX_ACTIVE = new FireboxActiveRenderer( + "casings/firebox/overlay/steel/active"); public static final ICubeRenderer TITANIUM_FIREBOX = new SidedCubeRenderer("casings/firebox/overlay/titanium"); - public static final ICubeRenderer TITANIUM_FIREBOX_ACTIVE = new FireboxActiveRenderer("casings/firebox/overlay/titanium/active"); - public static final ICubeRenderer TUNGSTENSTEEL_FIREBOX = new SidedCubeRenderer("casings/firebox/overlay/tungstensteel"); - public static final ICubeRenderer TUNGSTENSTEEL_FIREBOX_ACTIVE = new FireboxActiveRenderer("casings/firebox/overlay/tungstensteel/active"); + public static final ICubeRenderer TITANIUM_FIREBOX_ACTIVE = new FireboxActiveRenderer( + "casings/firebox/overlay/titanium/active"); + public static final ICubeRenderer TUNGSTENSTEEL_FIREBOX = new SidedCubeRenderer( + "casings/firebox/overlay/tungstensteel"); + public static final ICubeRenderer TUNGSTENSTEEL_FIREBOX_ACTIVE = new FireboxActiveRenderer( + "casings/firebox/overlay/tungstensteel/active"); public static final ICubeRenderer COMPUTER_CASING = new SidedCubeRenderer("casings/computer/computer_casing"); - public static final ICubeRenderer ADVANCED_COMPUTER_CASING = new SidedCubeRenderer("casings/computer/advanced_computer_casing"); + public static final ICubeRenderer ADVANCED_COMPUTER_CASING = new SidedCubeRenderer( + "casings/computer/advanced_computer_casing"); public static final AlignedOrientedOverlayRenderer LD_ITEM_PIPE = new LDPipeOverlayRenderer("pipe/ld_item_pipe"); public static final AlignedOrientedOverlayRenderer LD_FLUID_PIPE = new LDPipeOverlayRenderer("pipe/ld_fluid_pipe"); - public static final SimpleOverlayRenderer ROTOR_HOLDER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_rotor_holder"); - public static final SimpleOverlayRenderer ADV_PUMP_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_adv_pump"); - public static final SimpleOverlayRenderer FILTER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_filter"); - public static final SimpleOverlayRenderer HATCH_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_hatch"); - public static final SimpleOverlayRenderer FLUID_FILTER_OVERLAY = new SimpleOverlayRenderer("cover/overlay_fluid_filter"); - public static final SimpleOverlayRenderer ITEM_FILTER_FILTER_OVERLAY = new SimpleOverlayRenderer("cover/overlay_item_filter"); - public static final SimpleOverlayRenderer ORE_DICTIONARY_FILTER_OVERLAY = new SimpleOverlayRenderer("cover/overlay_ore_dictionary_filter"); - public static final SimpleOverlayRenderer SMART_FILTER_FILTER_OVERLAY = new SimpleOverlayRenderer("cover/overlay_smart_item_filter"); - public static final SimpleOverlayRenderer MACHINE_CONTROLLER_OVERLAY = new SimpleOverlayRenderer("cover/overlay_controller"); - public static final SimpleOverlayRenderer ENERGY_OUT = new SimpleOverlayRenderer("overlay/machine/overlay_energy_out"); - public static final SimpleOverlayRenderer ENERGY_IN = new SimpleOverlayRenderer("overlay/machine/overlay_energy_in"); - public static final SimpleOverlayRenderer ENERGY_OUT_MULTI = new SimpleOverlayRenderer("overlay/machine/overlay_energy_out_multi"); - public static final SimpleOverlayRenderer ENERGY_IN_MULTI = new SimpleOverlayRenderer("overlay/machine/overlay_energy_in_multi"); - public static final SimpleOverlayRenderer ENERGY_OUT_HI = new SimpleOverlayRenderer("overlay/machine/overlay_energy_out_hi"); - public static final SimpleOverlayRenderer ENERGY_IN_HI = new SimpleOverlayRenderer("overlay/machine/overlay_energy_in_hi"); - public static final SimpleOverlayRenderer ENERGY_OUT_ULTRA = new SimpleOverlayRenderer("overlay/machine/overlay_energy_out_ultra"); - public static final SimpleOverlayRenderer ENERGY_IN_ULTRA = new SimpleOverlayRenderer("overlay/machine/overlay_energy_in_ultra"); - public static final SimpleOverlayRenderer ENERGY_OUT_MAX = new SimpleOverlayRenderer("overlay/machine/overlay_energy_out_max"); - public static final SimpleOverlayRenderer ENERGY_IN_MAX = new SimpleOverlayRenderer("overlay/machine/overlay_energy_in_max"); + public static final SimpleOverlayRenderer ROTOR_HOLDER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_rotor_holder"); + public static final SimpleOverlayRenderer ADV_PUMP_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_adv_pump"); + public static final SimpleOverlayRenderer FILTER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_filter"); + public static final SimpleOverlayRenderer HATCH_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_hatch"); + public static final SimpleOverlayRenderer FLUID_FILTER_OVERLAY = new SimpleOverlayRenderer( + "cover/overlay_fluid_filter"); + public static final SimpleOverlayRenderer ITEM_FILTER_FILTER_OVERLAY = new SimpleOverlayRenderer( + "cover/overlay_item_filter"); + public static final SimpleOverlayRenderer ORE_DICTIONARY_FILTER_OVERLAY = new SimpleOverlayRenderer( + "cover/overlay_ore_dictionary_filter"); + public static final SimpleOverlayRenderer SMART_FILTER_FILTER_OVERLAY = new SimpleOverlayRenderer( + "cover/overlay_smart_item_filter"); + public static final SimpleOverlayRenderer MACHINE_CONTROLLER_OVERLAY = new SimpleOverlayRenderer( + "cover/overlay_controller"); + public static final SimpleOverlayRenderer ENERGY_OUT = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_out"); + public static final SimpleOverlayRenderer ENERGY_IN = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_in"); + public static final SimpleOverlayRenderer ENERGY_OUT_MULTI = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_out_multi"); + public static final SimpleOverlayRenderer ENERGY_IN_MULTI = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_in_multi"); + public static final SimpleOverlayRenderer ENERGY_OUT_HI = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_out_hi"); + public static final SimpleOverlayRenderer ENERGY_IN_HI = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_in_hi"); + public static final SimpleOverlayRenderer ENERGY_OUT_ULTRA = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_out_ultra"); + public static final SimpleOverlayRenderer ENERGY_IN_ULTRA = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_in_ultra"); + public static final SimpleOverlayRenderer ENERGY_OUT_MAX = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_out_max"); + public static final SimpleOverlayRenderer ENERGY_IN_MAX = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_in_max"); public static final SimpleOverlayRenderer CONVEYOR_OVERLAY = new SimpleOverlayRenderer("cover/overlay_conveyor"); - public static final SimpleOverlayRenderer CONVEYOR_OVERLAY_INVERTED = new SimpleOverlayRenderer("cover/overlay_conveyor_inverted"); + public static final SimpleOverlayRenderer CONVEYOR_OVERLAY_INVERTED = new SimpleOverlayRenderer( + "cover/overlay_conveyor_inverted"); public static final SimpleOverlayRenderer ARM_OVERLAY = new SimpleOverlayRenderer("cover/overlay_arm"); - public static final SimpleOverlayRenderer ARM_OVERLAY_INVERTED = new SimpleOverlayRenderer("cover/overlay_arm_inverted"); + public static final SimpleOverlayRenderer ARM_OVERLAY_INVERTED = new SimpleOverlayRenderer( + "cover/overlay_arm_inverted"); public static final SimpleOverlayRenderer PUMP_OVERLAY = new SimpleOverlayRenderer("cover/overlay_pump"); - public static final SimpleOverlayRenderer PUMP_OVERLAY_INVERTED = new SimpleOverlayRenderer("cover/overlay_pump_inverted"); - public static final SimpleOverlayRenderer AIR_VENT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_air_vent"); - public static final SimpleOverlayRenderer BLOWER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_blower"); - public static final SimpleOverlayRenderer BLOWER_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_blower_active"); - public static final SimpleOverlayRenderer INFINITE_EMITTER_FACE = new SimpleOverlayRenderer("overlay/machine/overlay_energy_emitter"); - public static final SimpleOverlayRenderer STEAM_VENT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_steam_vent"); - public static final SimpleOverlayRenderer QUANTUM_TANK_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_qtank"); - public static final SimpleOverlayRenderer QUANTUM_CHEST_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_qchest"); - public static final SimpleOverlayRenderer CREATIVE_CONTAINER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_creativecontainer"); - public static final SimpleOverlayRenderer BUFFER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_buffer"); - public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance"); - public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_TAPED = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance_taped"); - public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_CONFIGURABLE = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance_configurable"); - public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_FULL_AUTO = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance_full_auto"); - public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_CLEANING = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance_cleaning"); - public static final SimpleOverlayRenderer MUFFLER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_muffler"); - public static final SimpleOverlayRenderer STEAM_MINER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_steam_miner"); - public static final SimpleOverlayRenderer CHUNK_MINER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_chunk_miner"); - public static final SimpleOverlayRenderer BLANK_SCREEN = new SimpleOverlayRenderer("overlay/machine/overlay_blank_screen"); - public static final SimpleOverlayRenderer DATA_ACCESS_HATCH = new SimpleOverlayRenderer("overlay/machine/overlay_data_hatch"); - public static final SimpleOverlayRenderer CREATIVE_DATA_ACCESS_HATCH = new SimpleOverlayRenderer("overlay/machine/overlay_data_hatch_creative"); - public static final SimpleOverlayRenderer OPTICAL_DATA_ACCESS_HATCH = new SimpleOverlayRenderer("overlay/machine/overlay_data_hatch_optical"); - public static final SimpleOverlayRenderer LASER_SOURCE = new SimpleOverlayRenderer("overlay/machine/overlay_laser_source"); - public static final SimpleOverlayRenderer LASER_TARGET = new SimpleOverlayRenderer("overlay/machine/overlay_laser_target"); - public static final SimpleOverlayRenderer OBJECT_HOLDER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_object_holder"); - public static final SimpleOverlayRenderer OBJECT_HOLDER_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_object_holder_active"); - public static final SimpleOverlayRenderer HPCA_ACTIVE_COOLER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/active_cooler"); - public static final SimpleOverlayRenderer HPCA_ACTIVE_COOLER_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/active_cooler_active"); - public static final SimpleOverlayRenderer HPCA_BRIDGE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/bridge"); - public static final SimpleOverlayRenderer HPCA_BRIDGE_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/bridge_active"); - public static final SimpleOverlayRenderer HPCA_COMPUTATION_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/computation"); - public static final SimpleOverlayRenderer HPCA_COMPUTATION_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/computation_active"); - public static final SimpleOverlayRenderer HPCA_ADVANCED_COMPUTATION_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/computation_advanced"); - public static final SimpleOverlayRenderer HPCA_ADVANCED_COMPUTATION_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/computation_advanced_active"); - public static final SimpleOverlayRenderer HPCA_DAMAGED_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/damaged"); - public static final SimpleOverlayRenderer HPCA_DAMAGED_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/damaged_active"); - public static final SimpleOverlayRenderer HPCA_ADVANCED_DAMAGED_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/damaged_advanced"); - public static final SimpleOverlayRenderer HPCA_ADVANCED_DAMAGED_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/damaged_advanced_active"); - public static final SimpleOverlayRenderer HPCA_EMPTY_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/empty"); - public static final SimpleOverlayRenderer HPCA_HEAT_SINK_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/heat_sink"); - public static final SimpleOverlayRenderer ALARM_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_alarm"); - public static final SimpleOverlayRenderer ALARM_OVERLAY_ACTIVE = new SimpleOverlayRenderer("overlay/machine/overlay_alarm_active"); - public static final SimpleOverlayRenderer TAPED_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_ducttape"); - - public static final SimpleOverlayRenderer COVER_INTERFACE_FLUID = new SimpleOverlayRenderer("cover/cover_interface_fluid"); - public static final SimpleOverlayRenderer COVER_INTERFACE_FLUID_GLASS = new SimpleOverlayRenderer("cover/cover_interface_fluid_glass"); - public static final SimpleOverlayRenderer COVER_INTERFACE_ITEM = new SimpleOverlayRenderer("cover/cover_interface_item"); - public static final SimpleOverlayRenderer COVER_INTERFACE_ENERGY = new SimpleOverlayRenderer("cover/cover_interface_energy"); - public static final SimpleOverlayRenderer COVER_INTERFACE_MACHINE_ON = new SimpleOverlayRenderer("cover/cover_interface_machine_on"); - public static final SimpleOverlayRenderer COVER_INTERFACE_MACHINE_OFF = new SimpleOverlayRenderer("cover/cover_interface_machine_off"); - public static final SimpleOverlayRenderer COVER_INTERFACE_PROXY = new SimpleOverlayRenderer("cover/cover_interface_proxy"); - public static final SimpleOverlayRenderer COVER_INTERFACE_WIRELESS = new SimpleOverlayRenderer("cover/cover_interface_wireless"); - - public static final SimpleOverlayRenderer CONVERTER_FE_OUT = new SimpleOverlayRenderer("overlay/converter/converter_fe_out"); - public static final SimpleOverlayRenderer CONVERTER_FE_IN = new SimpleOverlayRenderer("overlay/converter/converter_fe_in"); - - public static final SimpleOverlayRenderer ME_OUTPUT_HATCH = new SimpleOverlayRenderer("overlay/appeng/me_output_hatch"); - public static final SimpleOverlayRenderer ME_INPUT_HATCH = new SimpleOverlayRenderer("overlay/appeng/me_input_hatch"); + public static final SimpleOverlayRenderer PUMP_OVERLAY_INVERTED = new SimpleOverlayRenderer( + "cover/overlay_pump_inverted"); + public static final SimpleOverlayRenderer AIR_VENT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_air_vent"); + public static final SimpleOverlayRenderer BLOWER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_blower"); + public static final SimpleOverlayRenderer BLOWER_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_blower_active"); + public static final SimpleOverlayRenderer INFINITE_EMITTER_FACE = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_emitter"); + public static final SimpleOverlayRenderer STEAM_VENT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_steam_vent"); + public static final SimpleOverlayRenderer QUANTUM_TANK_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_qtank"); + public static final SimpleOverlayRenderer QUANTUM_CHEST_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_qchest"); + public static final SimpleOverlayRenderer CREATIVE_CONTAINER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_creativecontainer"); + public static final SimpleOverlayRenderer BUFFER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_buffer"); + public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_maintenance"); + public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_TAPED = new SimpleOverlayRenderer( + "overlay/machine/overlay_maintenance_taped"); + public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_CONFIGURABLE = new SimpleOverlayRenderer( + "overlay/machine/overlay_maintenance_configurable"); + public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_FULL_AUTO = new SimpleOverlayRenderer( + "overlay/machine/overlay_maintenance_full_auto"); + public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_CLEANING = new SimpleOverlayRenderer( + "overlay/machine/overlay_maintenance_cleaning"); + public static final SimpleOverlayRenderer MUFFLER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_muffler"); + public static final SimpleOverlayRenderer STEAM_MINER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_steam_miner"); + public static final SimpleOverlayRenderer CHUNK_MINER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_chunk_miner"); + public static final SimpleOverlayRenderer BLANK_SCREEN = new SimpleOverlayRenderer( + "overlay/machine/overlay_blank_screen"); + public static final SimpleOverlayRenderer DATA_ACCESS_HATCH = new SimpleOverlayRenderer( + "overlay/machine/overlay_data_hatch"); + public static final SimpleOverlayRenderer CREATIVE_DATA_ACCESS_HATCH = new SimpleOverlayRenderer( + "overlay/machine/overlay_data_hatch_creative"); + public static final SimpleOverlayRenderer OPTICAL_DATA_ACCESS_HATCH = new SimpleOverlayRenderer( + "overlay/machine/overlay_data_hatch_optical"); + public static final SimpleOverlayRenderer LASER_SOURCE = new SimpleOverlayRenderer( + "overlay/machine/overlay_laser_source"); + public static final SimpleOverlayRenderer LASER_TARGET = new SimpleOverlayRenderer( + "overlay/machine/overlay_laser_target"); + public static final SimpleOverlayRenderer OBJECT_HOLDER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_object_holder"); + public static final SimpleOverlayRenderer OBJECT_HOLDER_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_object_holder_active"); + public static final SimpleOverlayRenderer HPCA_ACTIVE_COOLER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/active_cooler"); + public static final SimpleOverlayRenderer HPCA_ACTIVE_COOLER_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/active_cooler_active"); + public static final SimpleOverlayRenderer HPCA_BRIDGE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/bridge"); + public static final SimpleOverlayRenderer HPCA_BRIDGE_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/bridge_active"); + public static final SimpleOverlayRenderer HPCA_COMPUTATION_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/computation"); + public static final SimpleOverlayRenderer HPCA_COMPUTATION_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/computation_active"); + public static final SimpleOverlayRenderer HPCA_ADVANCED_COMPUTATION_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/computation_advanced"); + public static final SimpleOverlayRenderer HPCA_ADVANCED_COMPUTATION_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/computation_advanced_active"); + public static final SimpleOverlayRenderer HPCA_DAMAGED_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/damaged"); + public static final SimpleOverlayRenderer HPCA_DAMAGED_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/damaged_active"); + public static final SimpleOverlayRenderer HPCA_ADVANCED_DAMAGED_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/damaged_advanced"); + public static final SimpleOverlayRenderer HPCA_ADVANCED_DAMAGED_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/damaged_advanced_active"); + public static final SimpleOverlayRenderer HPCA_EMPTY_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/empty"); + public static final SimpleOverlayRenderer HPCA_HEAT_SINK_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/heat_sink"); + public static final SimpleOverlayRenderer ALARM_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_alarm"); + public static final SimpleOverlayRenderer ALARM_OVERLAY_ACTIVE = new SimpleOverlayRenderer( + "overlay/machine/overlay_alarm_active"); + public static final SimpleOverlayRenderer TAPED_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_ducttape"); + + public static final SimpleOverlayRenderer COVER_INTERFACE_FLUID = new SimpleOverlayRenderer( + "cover/cover_interface_fluid"); + public static final SimpleOverlayRenderer COVER_INTERFACE_FLUID_GLASS = new SimpleOverlayRenderer( + "cover/cover_interface_fluid_glass"); + public static final SimpleOverlayRenderer COVER_INTERFACE_ITEM = new SimpleOverlayRenderer( + "cover/cover_interface_item"); + public static final SimpleOverlayRenderer COVER_INTERFACE_ENERGY = new SimpleOverlayRenderer( + "cover/cover_interface_energy"); + public static final SimpleOverlayRenderer COVER_INTERFACE_MACHINE_ON = new SimpleOverlayRenderer( + "cover/cover_interface_machine_on"); + public static final SimpleOverlayRenderer COVER_INTERFACE_MACHINE_OFF = new SimpleOverlayRenderer( + "cover/cover_interface_machine_off"); + public static final SimpleOverlayRenderer COVER_INTERFACE_PROXY = new SimpleOverlayRenderer( + "cover/cover_interface_proxy"); + public static final SimpleOverlayRenderer COVER_INTERFACE_WIRELESS = new SimpleOverlayRenderer( + "cover/cover_interface_wireless"); + + public static final SimpleOverlayRenderer CONVERTER_FE_OUT = new SimpleOverlayRenderer( + "overlay/converter/converter_fe_out"); + public static final SimpleOverlayRenderer CONVERTER_FE_IN = new SimpleOverlayRenderer( + "overlay/converter/converter_fe_in"); + + public static final SimpleOverlayRenderer ME_OUTPUT_HATCH = new SimpleOverlayRenderer( + "overlay/appeng/me_output_hatch"); + public static final SimpleOverlayRenderer ME_INPUT_HATCH = new SimpleOverlayRenderer( + "overlay/appeng/me_input_hatch"); public static final SimpleOverlayRenderer ME_OUTPUT_BUS = new SimpleOverlayRenderer("overlay/appeng/me_output_bus"); public static final SimpleOverlayRenderer ME_INPUT_BUS = new SimpleOverlayRenderer("overlay/appeng/me_input_bus"); @@ -453,15 +637,22 @@ public static void register(TextureMap textureMap) { PIPE_BLOCKED_OVERLAY_DR = textureMap.registerSprite(gregtechId("blocks/pipe/blocked/pipe_blocked_dr")); PIPE_BLOCKED_OVERLAY_LR = textureMap.registerSprite(gregtechId("blocks/pipe/blocked/pipe_blocked_lr")); - OPTICAL_PIPE_IN = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_in")); - OPTICAL_PIPE_SIDE = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_side")); - OPTICAL_PIPE_SIDE_OVERLAY = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_side_overlay")); - OPTICAL_PIPE_SIDE_OVERLAY_ACTIVE = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_side_overlay_active")); - - LASER_PIPE_SIDE = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_side")); + OPTICAL_PIPE_IN = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_in")); + OPTICAL_PIPE_SIDE = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_side")); + OPTICAL_PIPE_SIDE_OVERLAY = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_side_overlay")); + OPTICAL_PIPE_SIDE_OVERLAY_ACTIVE = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_side_overlay_active")); + + LASER_PIPE_SIDE = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_side")); LASER_PIPE_IN = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_in")); - LASER_PIPE_OVERLAY = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_side_overlay")); - LASER_PIPE_OVERLAY_EMISSIVE = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_side_overlay_emissive")); + LASER_PIPE_OVERLAY = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_side_overlay")); + LASER_PIPE_OVERLAY_EMISSIVE = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_side_overlay_emissive")); for (MaterialIconSet iconSet : MaterialIconSet.ICON_SETS.values()) { textureMap.registerSprite(MaterialIconType.frameGt.getBlockTexturePath(iconSet)); @@ -477,9 +668,11 @@ private static int mask(EnumFacing... facings) { } @SideOnly(Side.CLIENT) - public static void renderFace(CCRenderState renderState, Matrix4 translation, IVertexOperation[] ops, EnumFacing face, Cuboid6 bounds, TextureAtlasSprite sprite, BlockRenderLayer layer) { + public static void renderFace(CCRenderState renderState, Matrix4 translation, IVertexOperation[] ops, + EnumFacing face, Cuboid6 bounds, TextureAtlasSprite sprite, BlockRenderLayer layer) { CubeRendererState op = RENDER_STATE.get(); - if (layer != null && op != null && op.layer != null && (op.layer != layer || !op.shouldSideBeRendered(face, bounds))) { + if (layer != null && op != null && op.layer != null && + (op.layer != layer || !op.shouldSideBeRendered(face, bounds))) { return; } BlockFace blockFace = blockFaces.get(); diff --git a/src/main/java/gregtech/client/renderer/texture/cube/AlignedOrientedOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/AlignedOrientedOverlayRenderer.java index 804c28ae56d..3c5f4ab4163 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/AlignedOrientedOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/AlignedOrientedOverlayRenderer.java @@ -1,8 +1,9 @@ package gregtech.client.renderer.texture.cube; +import net.minecraft.util.EnumFacing; + import codechicken.lib.vec.Matrix4; import codechicken.lib.vec.Rotation; -import net.minecraft.util.EnumFacing; import javax.annotation.Nonnull; diff --git a/src/main/java/gregtech/client/renderer/texture/cube/LDPipeOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/LDPipeOverlayRenderer.java index 744305c454d..2f205c38264 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/LDPipeOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/LDPipeOverlayRenderer.java @@ -2,12 +2,14 @@ import gregtech.api.GTValues; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -56,14 +58,16 @@ public void registerIcons(TextureMap textureMap) { // emissive - TextureAtlasSprite normalSpriteEmissive = ICubeRenderer.getResource(textureMap, modID, overlayPath + EMISSIVE); + TextureAtlasSprite normalSpriteEmissive = ICubeRenderer.getResource(textureMap, modID, + overlayPath + EMISSIVE); sprites.put(overlayFace, new ActivePredicate(normalSprite, normalSprite, null, normalSpriteEmissive, null, null)); } if (!foundTexture) { - FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/overlay_OVERLAY_FACE")); + FMLClientHandler.instance() + .trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/overlay_OVERLAY_FACE")); } } } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java index e91a25d51e1..86ea1113462 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java @@ -1,10 +1,5 @@ package gregtech.client.renderer.texture.cube; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Rotation; import gregtech.api.GTValues; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.cclop.LightMapOperation; @@ -12,6 +7,7 @@ import gregtech.client.utils.BloomEffectUtil; import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -20,6 +16,12 @@ import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Rotation; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,7 +32,12 @@ public class OrientedOverlayRenderer implements ICubeRenderer { public enum OverlayFace { - FRONT, BACK, TOP, BOTTOM, SIDE; + + FRONT, + BACK, + TOP, + BOTTOM, + SIDE; public static final OverlayFace[] VALUES = values(); @@ -69,7 +76,6 @@ public ActivePredicate(@NotNull TextureAtlasSprite normalSprite, @Nullable TextureAtlasSprite normalSpriteEmissive, @Nullable TextureAtlasSprite activeSpriteEmissive, @Nullable TextureAtlasSprite pausedSpriteEmissive) { - this.normalSprite = normalSprite; this.activeSprite = activeSprite; this.pausedSprite = pausedSprite; @@ -137,7 +143,8 @@ public void registerIcons(TextureMap textureMap) { TextureAtlasSprite activeSprite = ICubeRenderer.getResource(textureMap, modID, active); if (activeSprite == null) { - FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/overlay_" + overlayFace.toString().toLowerCase() + "_active")); + FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, + "blocks/" + basePath + "/overlay_" + overlayFace.toString().toLowerCase() + "_active")); continue; } @@ -146,7 +153,8 @@ public void registerIcons(TextureMap textureMap) { // emissive - TextureAtlasSprite normalSpriteEmissive = ICubeRenderer.getResource(textureMap, modID, overlayPath + EMISSIVE); + TextureAtlasSprite normalSpriteEmissive = ICubeRenderer.getResource(textureMap, modID, + overlayPath + EMISSIVE); TextureAtlasSprite activeSpriteEmissive = ICubeRenderer.getResource(textureMap, modID, active + EMISSIVE); @@ -157,7 +165,8 @@ public void registerIcons(TextureMap textureMap) { } if (!foundTexture) { - FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/overlay_OVERLAY_FACE")); + FMLClientHandler.instance() + .trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/overlay_OVERLAY_FACE")); } } @@ -173,7 +182,9 @@ public TextureAtlasSprite getParticleSprite() { @Override @SideOnly(Side.CLIENT) - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { for (EnumFacing renderSide : EnumFacing.VALUES) { ActivePredicate predicate = sprites.get(OverlayFace.bySide(renderSide, frontFacing)); @@ -188,16 +199,20 @@ public void renderOrientedState(CCRenderState renderState, Matrix4 translation, renderTranslation = RenderUtil.adjustTrans(renderTranslation, renderSide, 1); renderTranslation.apply(rotation); - Textures.renderFace(renderState, renderTranslation, ArrayUtils.addAll(pipeline, rotation), renderSide, bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, renderTranslation, ArrayUtils.addAll(pipeline, rotation), renderSide, + bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED); TextureAtlasSprite emissiveSprite = predicate.getEmissiveSprite(isActive, isWorkingEnabled); if (emissiveSprite != null) { if (ConfigHolder.client.machinesEmissiveTextures) { - IVertexOperation[] lightPipeline = ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), rotation); - Textures.renderFace(renderState, renderTranslation, lightPipeline, renderSide, bounds, emissiveSprite, BloomEffectUtil.getEffectiveBloomLayer()); + IVertexOperation[] lightPipeline = ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), + rotation); + Textures.renderFace(renderState, renderTranslation, lightPipeline, renderSide, bounds, + emissiveSprite, BloomEffectUtil.getEffectiveBloomLayer()); } else { // have to still render both overlays or else textures will be broken - Textures.renderFace(renderState, renderTranslation, ArrayUtils.addAll(pipeline, rotation), renderSide, bounds, emissiveSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, renderTranslation, ArrayUtils.addAll(pipeline, rotation), + renderSide, bounds, emissiveSprite, BlockRenderLayer.CUTOUT_MIPPED); } } } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java index bce57fb7a62..7d95bdb97ef 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java @@ -1,9 +1,5 @@ package gregtech.client.renderer.texture.cube; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.cclop.LightMapOperation; @@ -11,6 +7,7 @@ import gregtech.client.renderer.texture.cube.OrientedOverlayRenderer.OverlayFace; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -19,6 +16,11 @@ import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import java.util.EnumMap; @@ -72,7 +74,8 @@ public void registerIcons(TextureMap textureMap) { } if (!foundTexture) { - FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/OVERLAY_FACE")); + FMLClientHandler.instance() + .trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/OVERLAY_FACE")); } } @@ -84,20 +87,25 @@ public TextureAtlasSprite getParticleSprite() { @Override @SideOnly(Side.CLIENT) - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { for (EnumFacing facing : EnumFacing.VALUES) { OverlayFace overlayFace = OverlayFace.bySide(facing, frontFacing); TextureAtlasSprite renderSprite = sprites.get(overlayFace); if (renderSprite != null) { - Textures.renderFace(renderState, translation, pipeline, facing, bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, facing, bounds, renderSprite, + BlockRenderLayer.CUTOUT_MIPPED); TextureAtlasSprite emissiveSprite = spritesEmissive.get(overlayFace); if (emissiveSprite != null) { if (ConfigHolder.client.machinesEmissiveTextures) { IVertexOperation[] lightPipeline = ArrayUtils.add(pipeline, new LightMapOperation(240, 240)); - Textures.renderFace(renderState, translation, lightPipeline, facing, bounds, emissiveSprite, BloomEffectUtil.getEffectiveBloomLayer()); + Textures.renderFace(renderState, translation, lightPipeline, facing, bounds, emissiveSprite, + BloomEffectUtil.getEffectiveBloomLayer()); } else { - Textures.renderFace(renderState, translation, pipeline, facing, bounds, emissiveSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, facing, bounds, emissiveSprite, + BlockRenderLayer.CUTOUT_MIPPED); } } } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleCubeRenderer.java index 0b64bf6a963..bf5d23c2759 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleCubeRenderer.java @@ -1,18 +1,20 @@ package gregtech.client.renderer.texture.cube; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; + public class SimpleCubeRenderer implements ICubeRenderer { protected final String basePath; @@ -43,8 +45,10 @@ public TextureAtlasSprite getParticleSprite() { } @Override - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { - Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprite, BlockRenderLayer.CUTOUT_MIPPED); + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { + Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprite, + BlockRenderLayer.CUTOUT_MIPPED); } - } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java index 5c4fb6b5d61..fc26dfda3b5 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java @@ -1,9 +1,5 @@ package gregtech.client.renderer.texture.cube; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.resources.ResourceHelper; import gregtech.client.renderer.ICubeRenderer; @@ -11,6 +7,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -18,6 +15,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import java.util.EnumMap; @@ -34,7 +36,13 @@ public class SimpleOrientedCubeRenderer implements ICubeRenderer { private Map spritesEmissive; private enum CubeSide { - FRONT, BACK, RIGHT, LEFT, TOP, BOTTOM; + + FRONT, + BACK, + RIGHT, + LEFT, + TOP, + BOTTOM; public static final CubeSide[] VALUES = values(); } @@ -74,27 +82,42 @@ public TextureAtlasSprite getParticleSprite() { @Override @SideOnly(Side.CLIENT) - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { - Textures.renderFace(renderState, translation, pipeline, EnumFacing.UP, bounds, sprites.get(CubeSide.TOP), BlockRenderLayer.CUTOUT_MIPPED); - Textures.renderFace(renderState, translation, pipeline, EnumFacing.DOWN, bounds, sprites.get(CubeSide.BOTTOM), BlockRenderLayer.CUTOUT_MIPPED); - - Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprites.get(CubeSide.FRONT), BlockRenderLayer.CUTOUT_MIPPED); - Textures.renderFace(renderState, translation, pipeline, frontFacing.getOpposite(), bounds, sprites.get(CubeSide.BACK), BlockRenderLayer.CUTOUT_MIPPED); - - Textures.renderFace(renderState, translation, pipeline, frontFacing.rotateY(), bounds, sprites.get(CubeSide.LEFT), BlockRenderLayer.CUTOUT_MIPPED); - Textures.renderFace(renderState, translation, pipeline, frontFacing.rotateYCCW(), bounds, sprites.get(CubeSide.RIGHT), BlockRenderLayer.CUTOUT_MIPPED); + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { + Textures.renderFace(renderState, translation, pipeline, EnumFacing.UP, bounds, sprites.get(CubeSide.TOP), + BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, EnumFacing.DOWN, bounds, sprites.get(CubeSide.BOTTOM), + BlockRenderLayer.CUTOUT_MIPPED); + + Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprites.get(CubeSide.FRONT), + BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, frontFacing.getOpposite(), bounds, + sprites.get(CubeSide.BACK), BlockRenderLayer.CUTOUT_MIPPED); + + Textures.renderFace(renderState, translation, pipeline, frontFacing.rotateY(), bounds, + sprites.get(CubeSide.LEFT), BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, frontFacing.rotateYCCW(), bounds, + sprites.get(CubeSide.RIGHT), BlockRenderLayer.CUTOUT_MIPPED); IVertexOperation[] lightPipeline = ConfigHolder.client.machinesEmissiveTextures ? ArrayUtils.add(pipeline, new LightMapOperation(240, 240)) : pipeline; - if (spritesEmissive.containsKey(CubeSide.TOP)) Textures.renderFace(renderState, translation, lightPipeline, EnumFacing.UP, bounds, sprites.get(CubeSide.TOP), BloomEffectUtil.getEffectiveBloomLayer()); - if (spritesEmissive.containsKey(CubeSide.BOTTOM)) Textures.renderFace(renderState, translation, lightPipeline, EnumFacing.DOWN, bounds, sprites.get(CubeSide.BOTTOM), BloomEffectUtil.getEffectiveBloomLayer()); - - if (spritesEmissive.containsKey(CubeSide.FRONT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, sprites.get(CubeSide.FRONT), BloomEffectUtil.getEffectiveBloomLayer()); - if (spritesEmissive.containsKey(CubeSide.BACK)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.getOpposite(), bounds, sprites.get(CubeSide.BACK), BloomEffectUtil.getEffectiveBloomLayer()); - - if (spritesEmissive.containsKey(CubeSide.LEFT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.rotateY(), bounds, sprites.get(CubeSide.LEFT), BloomEffectUtil.getEffectiveBloomLayer()); - if (spritesEmissive.containsKey(CubeSide.RIGHT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.rotateYCCW(), bounds, sprites.get(CubeSide.RIGHT), BloomEffectUtil.getEffectiveBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.TOP)) Textures.renderFace(renderState, translation, lightPipeline, + EnumFacing.UP, bounds, sprites.get(CubeSide.TOP), BloomEffectUtil.getEffectiveBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.BOTTOM)) Textures.renderFace(renderState, translation, lightPipeline, + EnumFacing.DOWN, bounds, sprites.get(CubeSide.BOTTOM), BloomEffectUtil.getEffectiveBloomLayer()); + + if (spritesEmissive.containsKey(CubeSide.FRONT)) Textures.renderFace(renderState, translation, lightPipeline, + frontFacing, bounds, sprites.get(CubeSide.FRONT), BloomEffectUtil.getEffectiveBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.BACK)) + Textures.renderFace(renderState, translation, lightPipeline, frontFacing.getOpposite(), bounds, + sprites.get(CubeSide.BACK), BloomEffectUtil.getEffectiveBloomLayer()); + + if (spritesEmissive.containsKey(CubeSide.LEFT)) Textures.renderFace(renderState, translation, lightPipeline, + frontFacing.rotateY(), bounds, sprites.get(CubeSide.LEFT), BloomEffectUtil.getEffectiveBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.RIGHT)) + Textures.renderFace(renderState, translation, lightPipeline, frontFacing.rotateYCCW(), bounds, + sprites.get(CubeSide.RIGHT), BloomEffectUtil.getEffectiveBloomLayer()); } - } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java index 01d92f3b8ab..ab6407baa06 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java @@ -1,9 +1,5 @@ package gregtech.client.renderer.texture.cube; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.resources.ResourceHelper; import gregtech.client.renderer.ICubeRenderer; @@ -11,6 +7,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -18,6 +15,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import javax.annotation.Nullable; @@ -58,13 +60,18 @@ public void registerIcons(TextureMap textureMap) { @Override @SideOnly(Side.CLIENT) - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { - Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprite, BlockRenderLayer.CUTOUT_MIPPED); + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { + Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprite, + BlockRenderLayer.CUTOUT_MIPPED); if (spriteEmissive != null) { if (ConfigHolder.client.machinesEmissiveTextures) { IVertexOperation[] lightPipeline = ArrayUtils.add(pipeline, new LightMapOperation(240, 240)); - Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, BloomEffectUtil.getEffectiveBloomLayer()); - } else Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, spriteEmissive, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, + BloomEffectUtil.getEffectiveBloomLayer()); + } else Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, spriteEmissive, + BlockRenderLayer.CUTOUT_MIPPED); } } @@ -73,5 +80,4 @@ public void renderOrientedState(CCRenderState renderState, Matrix4 translation, public TextureAtlasSprite getParticleSprite() { return sprite; } - } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleSidedCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleSidedCubeRenderer.java index b005e0102a1..6c8b21c07bc 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleSidedCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleSidedCubeRenderer.java @@ -1,9 +1,5 @@ package gregtech.client.renderer.texture.cube; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.resources.ResourceHelper; import gregtech.client.renderer.ICubeRenderer; @@ -11,6 +7,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -18,6 +15,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import java.util.EnumMap; @@ -26,7 +28,10 @@ public class SimpleSidedCubeRenderer implements ICubeRenderer { public enum RenderSide { - TOP, BOTTOM, SIDE; + + TOP, + BOTTOM, + SIDE; public static final RenderSide[] VALUES = values(); @@ -67,7 +72,8 @@ public void registerIcons(TextureMap textureMap) { this.spritesEmissive = new EnumMap<>(RenderSide.class); for (RenderSide overlayFace : RenderSide.VALUES) { String faceName = overlayFace.name().toLowerCase(); - ResourceLocation resourceLocation = new ResourceLocation(modID, String.format("blocks/%s/%s", basePath, faceName)); + ResourceLocation resourceLocation = new ResourceLocation(modID, + String.format("blocks/%s/%s", basePath, faceName)); sprites.put(overlayFace, textureMap.registerSprite(resourceLocation)); String emissive = String.format("blocks/%s/%s_emissive", basePath, faceName); @@ -90,16 +96,21 @@ public TextureAtlasSprite getParticleSprite() { @Override @SideOnly(Side.CLIENT) - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { RenderSide overlayFace = RenderSide.bySide(frontFacing); TextureAtlasSprite renderSprite = sprites.get(overlayFace); - Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, renderSprite, + BlockRenderLayer.CUTOUT_MIPPED); TextureAtlasSprite spriteEmissive = spritesEmissive.get(overlayFace); if (spriteEmissive != null) { if (ConfigHolder.client.machinesEmissiveTextures) { IVertexOperation[] lightPipeline = ArrayUtils.add(pipeline, new LightMapOperation(240, 240)); - Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, BloomEffectUtil.getEffectiveBloomLayer()); - } else Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, spriteEmissive, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, + BloomEffectUtil.getEffectiveBloomLayer()); + } else Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, spriteEmissive, + BlockRenderLayer.CUTOUT_MIPPED); } } } diff --git a/src/main/java/gregtech/client/renderer/texture/custom/ClipboardRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/ClipboardRenderer.java index 3006143030b..107200e2989 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/ClipboardRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/ClipboardRenderer.java @@ -1,13 +1,8 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Rotation; import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.MetaTileEntityClipboard; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -19,6 +14,13 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Rotation; import org.apache.commons.lang3.tuple.Pair; import java.util.Arrays; @@ -27,12 +29,17 @@ public class ClipboardRenderer implements IIconRegister { - private static final Cuboid6 pageBox = new Cuboid6(3 / 16.0, 0.25 / 16.0, 0.25 / 16.0, 13 / 16.0, 14.25 / 16.0, 0.3 / 16.0); - private static final Cuboid6 boardBox = new Cuboid6(2.75 / 16.0, 0 / 16.0, 0 / 16.0, 13.25 / 16.0, 15.25 / 16.0, 0.25 / 16.0); - private static final Cuboid6 clipBox = new Cuboid6(5.75 / 16.0, 14.75 / 16.0, 0.25 / 16.0, 10.25 / 16.0, 15.5 / 16.0, 0.4 / 16.0); - private static final Cuboid6 graspBox = new Cuboid6(7 / 16.0, 15.25 / 16.0, 0.1 / 16.0, 9 / 16.0, 16 / 16.0, 0.35 / 16.0); + private static final Cuboid6 pageBox = new Cuboid6(3 / 16.0, 0.25 / 16.0, 0.25 / 16.0, 13 / 16.0, 14.25 / 16.0, + 0.3 / 16.0); + private static final Cuboid6 boardBox = new Cuboid6(2.75 / 16.0, 0 / 16.0, 0 / 16.0, 13.25 / 16.0, 15.25 / 16.0, + 0.25 / 16.0); + private static final Cuboid6 clipBox = new Cuboid6(5.75 / 16.0, 14.75 / 16.0, 0.25 / 16.0, 10.25 / 16.0, + 15.5 / 16.0, 0.4 / 16.0); + private static final Cuboid6 graspBox = new Cuboid6(7 / 16.0, 15.25 / 16.0, 0.1 / 16.0, 9 / 16.0, 16 / 16.0, + 0.35 / 16.0); - private static final List rotations = Arrays.asList(EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.SOUTH, EnumFacing.EAST); + private static final List rotations = Arrays.asList(EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.SOUTH, + EnumFacing.EAST); @SideOnly(Side.CLIENT) private static HashMap boxTextureMap; @@ -61,19 +68,22 @@ public void registerIcons(TextureMap textureMap) { } @SideOnly(Side.CLIENT) - public static void renderBoard(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing rotation, MetaTileEntityClipboard clipboard, float partialTicks) { + public static void renderBoard(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + EnumFacing rotation, MetaTileEntityClipboard clipboard, float partialTicks) { translation.translate(0.5, 0.5, 0.5); translation.rotate(Math.toRadians(90.0 * rotations.indexOf(rotation)), Rotation.axes[1]); translation.translate(-0.5, -0.5, -0.5); // Render Clipboard for (EnumFacing renderSide : EnumFacing.VALUES) { - boxTextureMap.forEach((box, sprite) -> Textures.renderFace(renderState, translation, pipeline, renderSide, box, sprite, null)); + boxTextureMap.forEach((box, sprite) -> Textures.renderFace(renderState, translation, pipeline, renderSide, + box, sprite, null)); } } @SideOnly(Side.CLIENT) - public static void renderGUI(double x, double y, double z, EnumFacing rotation, MetaTileEntityClipboard clipboard, float partialTicks) { + public static void renderGUI(double x, double y, double z, EnumFacing rotation, MetaTileEntityClipboard clipboard, + float partialTicks) { GlStateManager.color(1, 1, 1, 1); GlStateManager.pushMatrix(); float lastBrightnessX = OpenGlHelper.lastBrightnessX; diff --git a/src/main/java/gregtech/client/renderer/texture/custom/CrateRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/CrateRenderer.java index a823ed2e944..0f999dd687d 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/CrateRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/CrateRenderer.java @@ -1,22 +1,25 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; public class CrateRenderer implements IIconRegister { + private final String basePath; @SideOnly(Side.CLIENT) @@ -34,11 +37,11 @@ public void registerIcons(TextureMap textureMap) { } public void render(CCRenderState renderState, Matrix4 translation, int baseColor, IVertexOperation[] pipeline) { - IVertexOperation[] basePipeline = ArrayUtils.add(pipeline, new ColourMultiplier(baseColor)); for (EnumFacing renderSide : EnumFacing.VALUES) { - Textures.renderFace(renderState, translation, basePipeline, renderSide, Cuboid6.full, sideSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, basePipeline, renderSide, Cuboid6.full, sideSprite, + BlockRenderLayer.CUTOUT_MIPPED); } } diff --git a/src/main/java/gregtech/client/renderer/texture/custom/DrumRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/DrumRenderer.java index 6931a3090e1..d02d824d280 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/DrumRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/DrumRenderer.java @@ -1,12 +1,8 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -15,7 +11,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; + public class DrumRenderer implements IIconRegister { + private final String basePath; @SideOnly(Side.CLIENT) @@ -37,11 +40,13 @@ public void registerIcons(TextureMap textureMap) { } @SideOnly(Side.CLIENT) - public void render(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing rotation) { - + public void render(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + EnumFacing rotation) { for (EnumFacing renderSide : EnumFacing.VALUES) { - TextureAtlasSprite baseSprite = renderSide == EnumFacing.UP ? textures[0] : renderSide == EnumFacing.DOWN ? textures[2] : textures[1]; - Textures.renderFace(renderState, translation, pipeline, renderSide, Cuboid6.full, baseSprite, BlockRenderLayer.CUTOUT_MIPPED); + TextureAtlasSprite baseSprite = renderSide == EnumFacing.UP ? textures[0] : + renderSide == EnumFacing.DOWN ? textures[2] : textures[1]; + Textures.renderFace(renderState, translation, pipeline, renderSide, Cuboid6.full, baseSprite, + BlockRenderLayer.CUTOUT_MIPPED); } } @@ -49,5 +54,4 @@ public void render(CCRenderState renderState, Matrix4 translation, IVertexOperat public TextureAtlasSprite getParticleTexture() { return textures[0]; } - } diff --git a/src/main/java/gregtech/client/renderer/texture/custom/FireboxActiveRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/FireboxActiveRenderer.java index bdbd37ad9a2..6d7b8305d1e 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/FireboxActiveRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/FireboxActiveRenderer.java @@ -1,20 +1,22 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.client.renderer.cclop.LightMapOperation; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.OrientedOverlayRenderer; import gregtech.client.renderer.texture.cube.SidedCubeRenderer; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; public class FireboxActiveRenderer extends SidedCubeRenderer { @@ -25,16 +27,23 @@ public FireboxActiveRenderer(String basePath) { @Override @SideOnly(Side.CLIENT) - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { for (EnumFacing facing : EnumFacing.VALUES) { - OrientedOverlayRenderer.OverlayFace overlayFace = OrientedOverlayRenderer.OverlayFace.bySide(facing, frontFacing); + OrientedOverlayRenderer.OverlayFace overlayFace = OrientedOverlayRenderer.OverlayFace.bySide(facing, + frontFacing); TextureAtlasSprite renderSprite = sprites.get(overlayFace); if (renderSprite != null) { - Textures.renderFace(renderState, translation, pipeline, facing, bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, facing, bounds, renderSprite, + BlockRenderLayer.CUTOUT_MIPPED); TextureAtlasSprite emissiveSprite = spritesEmissive.get(overlayFace); - if (emissiveSprite != null && facing != frontFacing && facing != EnumFacing.UP && facing != EnumFacing.DOWN) { - Textures.renderFace(renderState, translation, ArrayUtils.add(pipeline, new LightMapOperation(240, 240)), facing, bounds, emissiveSprite, - BloomEffectUtil.getEffectiveBloomLayer(ConfigHolder.client.machinesEmissiveTextures, BlockRenderLayer.CUTOUT_MIPPED)); + if (emissiveSprite != null && facing != frontFacing && facing != EnumFacing.UP && + facing != EnumFacing.DOWN) { + Textures.renderFace(renderState, translation, + ArrayUtils.add(pipeline, new LightMapOperation(240, 240)), facing, bounds, emissiveSprite, + BloomEffectUtil.getEffectiveBloomLayer(ConfigHolder.client.machinesEmissiveTextures, + BlockRenderLayer.CUTOUT_MIPPED)); } } } diff --git a/src/main/java/gregtech/client/renderer/texture/custom/LargeTurbineRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/LargeTurbineRenderer.java index 656c84a6000..f2f2e063d82 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/LargeTurbineRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/LargeTurbineRenderer.java @@ -1,21 +1,23 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.util.GTUtility; import gregtech.client.renderer.cclop.ColourOperation; import gregtech.client.renderer.cclop.LightMapOperation; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; public class LargeTurbineRenderer implements IIconRegister { @@ -36,14 +38,19 @@ public LargeTurbineRenderer() { @Override @SideOnly(Side.CLIENT) public void registerIcons(TextureMap textureMap) { - this.baseRingSprite = textureMap.registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/base_ring")); - this.baseBackgroundSprite = textureMap.registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/base_bg")); - this.idleBladeSprite = textureMap.registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/rotor_idle")); - this.activeBladeSprite = textureMap.registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/rotor_spinning")); + this.baseRingSprite = textureMap + .registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/base_ring")); + this.baseBackgroundSprite = textureMap + .registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/base_bg")); + this.idleBladeSprite = textureMap + .registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/rotor_idle")); + this.activeBladeSprite = textureMap + .registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/rotor_spinning")); } @SideOnly(Side.CLIENT) - public void renderSided(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing side, boolean hasBase, boolean hasRotor, boolean isActive, int rotorRGB) { + public void renderSided(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + EnumFacing side, boolean hasBase, boolean hasRotor, boolean isActive, int rotorRGB) { Matrix4 cornerOffset = null; switch (side.getAxis()) { case X: @@ -60,14 +67,18 @@ public void renderSided(CCRenderState renderState, Matrix4 translation, IVertexO break; } if (hasBase) { - Textures.renderFace(renderState, cornerOffset, ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240)), side, Cuboid6.full, baseRingSprite, BlockRenderLayer.CUTOUT_MIPPED); - Textures.renderFace(renderState, cornerOffset, ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), new ColourOperation(0xFFFFFFFF)), side, Cuboid6.full, baseBackgroundSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, cornerOffset, ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240)), + side, Cuboid6.full, baseRingSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, cornerOffset, + ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), new ColourOperation(0xFFFFFFFF)), side, + Cuboid6.full, baseBackgroundSprite, BlockRenderLayer.CUTOUT_MIPPED); } if (hasRotor) { TextureAtlasSprite sprite = isActive ? activeBladeSprite : idleBladeSprite; - IVertexOperation[] color = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(rotorRGB))); - Textures.renderFace(renderState, cornerOffset, color, side, Cuboid6.full, sprite, BlockRenderLayer.CUTOUT_MIPPED); + IVertexOperation[] color = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(rotorRGB))); + Textures.renderFace(renderState, cornerOffset, color, side, Cuboid6.full, sprite, + BlockRenderLayer.CUTOUT_MIPPED); } } - } diff --git a/src/main/java/gregtech/client/renderer/texture/custom/QuantumStorageRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/QuantumStorageRenderer.java index 91fe73f1763..7e6485a155d 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/QuantumStorageRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/QuantumStorageRenderer.java @@ -1,16 +1,12 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.gui.resources.TextTexture; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer.RenderSide; import gregtech.client.utils.RenderUtil; import gregtech.common.metatileentities.storage.MetaTileEntityQuantumChest; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -30,9 +26,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; + import java.util.EnumMap; public class QuantumStorageRenderer implements TextureUtils.IIconRegister { + private static final Cuboid6 glassBox = new Cuboid6(1 / 16.0, 1 / 16.0, 1 / 16.0, 15 / 16.0, 15 / 16.0, 15 / 16.0); private static final EnumMap boxFacingMap = new EnumMap<>(EnumFacing.class); @@ -55,23 +58,33 @@ public QuantumStorageRenderer() { @Override public void registerIcons(TextureMap textureMap) { - this.glassTexture = textureMap.registerSprite(new ResourceLocation("gregtech:blocks/overlay/machine/overlay_screen_glass")); + this.glassTexture = textureMap + .registerSprite(new ResourceLocation("gregtech:blocks/overlay/machine/overlay_screen_glass")); } - public void renderMachine(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing frontFacing, int tier) { - Textures.renderFace(renderState, translation, pipeline, frontFacing, glassBox, glassTexture, BlockRenderLayer.CUTOUT_MIPPED); + public void renderMachine(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + EnumFacing frontFacing, int tier) { + Textures.renderFace(renderState, translation, pipeline, frontFacing, glassBox, glassTexture, + BlockRenderLayer.CUTOUT_MIPPED); - TextureAtlasSprite hullTexture = Textures.VOLTAGE_CASINGS[tier].getSpriteOnSide(RenderSide.bySide(EnumFacing.NORTH)); + TextureAtlasSprite hullTexture = Textures.VOLTAGE_CASINGS[tier] + .getSpriteOnSide(RenderSide.bySide(EnumFacing.NORTH)); boxFacingMap.keySet().forEach(facing -> { for (EnumFacing box : EnumFacing.VALUES) { - if ((facing != frontFacing || box != frontFacing) && (facing != EnumFacing.DOWN || box.getAxis().isVertical())) { // Don't render the front facing box from the front, nor allow Z-fighting to occur on the bottom - Textures.renderFace(renderState, translation, pipeline, facing, boxFacingMap.get(box), hullTexture, BlockRenderLayer.CUTOUT_MIPPED); + if ((facing != frontFacing || box != frontFacing) && + (facing != EnumFacing.DOWN || box.getAxis().isVertical())) { // Don't render the front facing + // box from the front, nor allow + // Z-fighting to occur on the + // bottom + Textures.renderFace(renderState, translation, pipeline, facing, boxFacingMap.get(box), hullTexture, + BlockRenderLayer.CUTOUT_MIPPED); } } }); } - public static void renderChestStack(double x, double y, double z, MetaTileEntityQuantumChest machine, ItemStack stack, long count, float partialTicks) { + public static void renderChestStack(double x, double y, double z, MetaTileEntityQuantumChest machine, + ItemStack stack, long count, float partialTicks) { if (stack.isEmpty() || count == 0) return; @@ -106,7 +119,8 @@ public static void renderTankFluid(CCRenderState renderState, Matrix4 translatio if (stack == null || stack.amount == 0) return; - Cuboid6 partialFluidBox = new Cuboid6(1.0625 / 16.0, 2.0625 / 16.0, 1.0625 / 16.0, 14.9375 / 16.0, 14.9375 / 16.0, 14.9375 / 16.0); + Cuboid6 partialFluidBox = new Cuboid6(1.0625 / 16.0, 2.0625 / 16.0, 1.0625 / 16.0, 14.9375 / 16.0, + 14.9375 / 16.0, 14.9375 / 16.0); double fillFraction = (double) stack.amount / tank.getCapacity(); if (tank.getFluid().getFluid().isGaseous()) { @@ -117,9 +131,11 @@ public static void renderTankFluid(CCRenderState renderState, Matrix4 translatio renderState.setFluidColour(stack); ResourceLocation fluidStill = stack.getFluid().getStill(stack); - TextureAtlasSprite fluidStillSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluidStill.toString()); + TextureAtlasSprite fluidStillSprite = Minecraft.getMinecraft().getTextureMapBlocks() + .getAtlasSprite(fluidStill.toString()); for (EnumFacing facing : EnumFacing.VALUES) { - Textures.renderFace(renderState, translation, pipeline, facing, partialFluidBox, fluidStillSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, facing, partialFluidBox, fluidStillSprite, + BlockRenderLayer.CUTOUT_MIPPED); } GlStateManager.resetColor(); @@ -137,10 +153,10 @@ public static void renderTankAmount(double x, double y, double z, EnumFacing fro } public static void renderAmountText(double x, double y, double z, long amount, EnumFacing frontFacing) { - GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); - GlStateManager.translate(frontFacing.getXOffset() * -1 / 16f, frontFacing.getYOffset() * -1 / 16f, frontFacing.getZOffset() * -1 / 16f); + GlStateManager.translate(frontFacing.getXOffset() * -1 / 16f, frontFacing.getYOffset() * -1 / 16f, + frontFacing.getZOffset() * -1 / 16f); RenderUtil.moveToFace(0, 0, 0, frontFacing); if (frontFacing.getAxis() == EnumFacing.Axis.Y) { RenderUtil.rotateToFace(frontFacing, EnumFacing.SOUTH); diff --git a/src/main/java/gregtech/client/renderer/texture/custom/SafeRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/SafeRenderer.java index 648795e8a60..9e213bfa27d 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/SafeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/SafeRenderer.java @@ -1,13 +1,8 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Rotation; import gregtech.api.GTValues; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -17,15 +12,25 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Rotation; + import java.util.Arrays; import java.util.List; public class SafeRenderer implements IIconRegister { - private static final Cuboid6 mainBoxOuter = new Cuboid6(3 / 16.0, 0 / 16.0, 3 / 16.0, 13 / 16.0, 14 / 16.0, 13 / 16.0); - private static final Cuboid6 mainBoxInner = new Cuboid6(4 / 16.0, 1 / 16.0, 3 / 16.0, 12 / 16.0, 13 / 16.0, 12 / 16.0); + private static final Cuboid6 mainBoxOuter = new Cuboid6(3 / 16.0, 0 / 16.0, 3 / 16.0, 13 / 16.0, 14 / 16.0, + 13 / 16.0); + private static final Cuboid6 mainBoxInner = new Cuboid6(4 / 16.0, 1 / 16.0, 3 / 16.0, 12 / 16.0, 13 / 16.0, + 12 / 16.0); private static final Cuboid6 doorBox = new Cuboid6(4 / 16.0, 1 / 16.0, 3 / 16.0, 12 / 16.0, 13 / 16.0, 4 / 16.0); - private static final List rotations = Arrays.asList(EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.SOUTH, EnumFacing.EAST); + private static final List rotations = Arrays.asList(EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.SOUTH, + EnumFacing.EAST); private final String basePath; @@ -58,7 +63,8 @@ public void registerIcons(TextureMap textureMap) { } @SideOnly(Side.CLIENT) - public void render(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing rotation, float capRotation) { + public void render(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing rotation, + float capRotation) { translation.translate(0.5, 0.5, 0.5); translation.rotate(Math.toRadians(90.0 * rotations.indexOf(rotation)), Rotation.axes[1]); translation.translate(-0.5, -0.5, -0.5); @@ -67,9 +73,11 @@ public void render(CCRenderState renderState, Matrix4 translation, IVertexOperat TextureAtlasSprite baseSprite = renderSide.getAxis() == Axis.Y ? textures[renderSide.getIndex()] : renderSide == EnumFacing.NORTH ? textures[3] : textures[2]; - Textures.renderFace(renderState, translation, pipeline, renderSide, mainBoxOuter, baseSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, renderSide, mainBoxOuter, baseSprite, + BlockRenderLayer.CUTOUT_MIPPED); if (renderSide == EnumFacing.NORTH) continue; - Textures.renderFace(renderState, translation, pipeline, renderSide, mainBoxInner, baseSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, renderSide, mainBoxInner, baseSprite, + BlockRenderLayer.CUTOUT_MIPPED); } translation.translate(4 / 16.0, 7 / 16.0, 3 / 16.0); @@ -77,10 +85,10 @@ public void render(CCRenderState renderState, Matrix4 translation, IVertexOperat translation.translate(-4 / 16.0, -7 / 16.0, -3 / 16.0); for (EnumFacing renderSide : EnumFacing.VALUES) { - TextureAtlasSprite doorSprite = - renderSide == EnumFacing.NORTH ? textures[6] : - renderSide == EnumFacing.SOUTH ? textures[5] : textures[4]; - Textures.renderFace(renderState, translation, pipeline, renderSide, doorBox, doorSprite, BlockRenderLayer.CUTOUT_MIPPED); + TextureAtlasSprite doorSprite = renderSide == EnumFacing.NORTH ? textures[6] : + renderSide == EnumFacing.SOUTH ? textures[5] : textures[4]; + Textures.renderFace(renderState, translation, pipeline, renderSide, doorBox, doorSprite, + BlockRenderLayer.CUTOUT_MIPPED); } } } diff --git a/src/main/java/gregtech/client/shader/PingPongBuffer.java b/src/main/java/gregtech/client/shader/PingPongBuffer.java index 461879a6f5d..a0a87b402fa 100644 --- a/src/main/java/gregtech/client/shader/PingPongBuffer.java +++ b/src/main/java/gregtech/client/shader/PingPongBuffer.java @@ -1,12 +1,14 @@ package gregtech.client.shader; import gregtech.client.utils.RenderUtil; + import net.minecraft.client.shader.Framebuffer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class PingPongBuffer { + private static final Framebuffer BUFFER_A; private static final Framebuffer BUFFER_B; private static boolean flag; diff --git a/src/main/java/gregtech/client/shader/Shaders.java b/src/main/java/gregtech/client/shader/Shaders.java index 8ad7cf30382..e1eb6ef0474 100644 --- a/src/main/java/gregtech/client/shader/Shaders.java +++ b/src/main/java/gregtech/client/shader/Shaders.java @@ -1,10 +1,9 @@ package gregtech.client.shader; -import codechicken.lib.render.shader.ShaderObject; -import codechicken.lib.render.shader.ShaderProgram; import gregtech.api.GTValues; import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.OpenGlHelper; @@ -14,6 +13,9 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.shader.ShaderObject; +import codechicken.lib.render.shader.ShaderProgram; + import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; @@ -34,12 +36,13 @@ */ @SideOnly(Side.CLIENT) public class Shaders { + public static Minecraft mc; private final static Map FULL_IMAGE_PROGRAMS; public static ShaderObject IMAGE_V; public static ShaderObject IMAGE_F; -// public static ShaderObject BLACK_HOLE; + // public static ShaderObject BLACK_HOLE; public static ShaderObject SCANNING; public static ShaderObject BLOOM_COMBINE; @@ -71,7 +74,8 @@ public class Shaders { try { return shaderPackLoaded.getBoolean(null); } catch (final IllegalAccessException e) { - GTLog.logger.warn("Failed reading field indicating whether shaders are enabled. Shader mod integration disabled."); + GTLog.logger.warn( + "Failed reading field indicating whether shaders are enabled. Shader mod integration disabled."); isShaderPackLoaded = null; return false; } @@ -87,7 +91,7 @@ public class Shaders { public static void initShaders() { IMAGE_V = initShader(IMAGE_V, VERTEX, "image.vert"); IMAGE_F = initShader(IMAGE_F, FRAGMENT, "image.frag"); -// BLACK_HOLE = initShader(BLACK_HOLE, FRAGMENT, "blackhole.frag"); + // BLACK_HOLE = initShader(BLACK_HOLE, FRAGMENT, "blackhole.frag"); SCANNING = initShader(SCANNING, FRAGMENT, "scanning.frag"); BLOOM_COMBINE = initShader(BLOOM_COMBINE, FRAGMENT, "bloom_combine.frag"); BLUR = initShader(BLUR, FRAGMENT, "blur.frag"); @@ -105,7 +109,9 @@ private static ShaderObject initShader(ShaderObject object, ShaderObject.ShaderT public static ShaderObject loadShader(ShaderObject.ShaderType shaderType, String location) { try { - return new ShaderObject(shaderType, readShader(getStream(String.format("/assets/%s/shaders/%s", GTValues.MODID, location)))).compileShader(); + return new ShaderObject(shaderType, + readShader(getStream(String.format("/assets/%s/shaders/%s", GTValues.MODID, location)))) + .compileShader(); } catch (Exception exception) { GTLog.logger.error("error while loading shader {}", location, exception); } @@ -126,9 +132,10 @@ public static boolean isOptiFineShaderPackLoaded() { return isShaderPackLoaded != null && isShaderPackLoaded.getAsBoolean(); } - public static Framebuffer renderFullImageInFBO(Framebuffer fbo, ShaderObject frag, Consumer uniformCache) { + public static Framebuffer renderFullImageInFBO(Framebuffer fbo, ShaderObject frag, + Consumer uniformCache) { if (fbo == null || frag == null || !allowedShader()) return fbo; -// int lastID = glGetInteger(GL30.GL_FRAMEBUFFER_BINDING); + // int lastID = glGetInteger(GL30.GL_FRAMEBUFFER_BINDING); fbo.bindFramebuffer(true); @@ -140,7 +147,7 @@ public static Framebuffer renderFullImageInFBO(Framebuffer fbo, ShaderObject fra FULL_IMAGE_PROGRAMS.put(frag, program); } - program.useShader(cache->{ + program.useShader(cache -> { cache.glUniform2F("u_resolution", fbo.framebufferWidth, fbo.framebufferHeight); if (uniformCache != null) { uniformCache.accept(cache); @@ -158,9 +165,9 @@ public static Framebuffer renderFullImageInFBO(Framebuffer fbo, ShaderObject fra tessellator.draw(); program.releaseShader(); -// GlStateManager.viewport(0, 0, mc.displayWidth, mc.displayHeight); + // GlStateManager.viewport(0, 0, mc.displayWidth, mc.displayHeight); -// OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, lastID); + // OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, lastID); return fbo; } } diff --git a/src/main/java/gregtech/client/shader/postprocessing/BloomEffect.java b/src/main/java/gregtech/client/shader/postprocessing/BloomEffect.java index 1b154a7085a..8da7d5b9ffa 100644 --- a/src/main/java/gregtech/client/shader/postprocessing/BloomEffect.java +++ b/src/main/java/gregtech/client/shader/postprocessing/BloomEffect.java @@ -4,10 +4,12 @@ import gregtech.client.shader.Shaders; import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.shader.Framebuffer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL13; @@ -108,7 +110,8 @@ public static void renderUnity(Framebuffer highLightFBO, Framebuffer backgroundF renderDownSampling(downSampleFBO[i], downSampleFBO[i + 1]); } - renderUpSampling(downSampleFBO[downSampleFBO.length - 1], downSampleFBO[downSampleFBO.length - 2], upSampleFBO[downSampleFBO.length - 2]); + renderUpSampling(downSampleFBO[downSampleFBO.length - 1], downSampleFBO[downSampleFBO.length - 2], + upSampleFBO[downSampleFBO.length - 2]); for (int i = upSampleFBO.length - 2; i > 0; i--) { renderUpSampling(upSampleFBO[i], downSampleFBO[i - 1], upSampleFBO[i - 1]); } @@ -125,7 +128,8 @@ public static void renderUnity(Framebuffer highLightFBO, Framebuffer backgroundF private static void renderDownSampling(Framebuffer U, Framebuffer D) { U.bindFramebufferTexture(); - Shaders.renderFullImageInFBO(D, Shaders.DOWN_SAMPLING, uniformCache -> uniformCache.glUniform2F("u_resolution2", U.framebufferWidth, U.framebufferHeight)); + Shaders.renderFullImageInFBO(D, Shaders.DOWN_SAMPLING, + uniformCache -> uniformCache.glUniform2F("u_resolution2", U.framebufferWidth, U.framebufferHeight)); } private static void renderUpSampling(Framebuffer U, Framebuffer D, Framebuffer T) { @@ -148,7 +152,7 @@ public static void renderUnreal(Framebuffer highLightFBO, Framebuffer background cleanUP(backgroundFBO.framebufferWidth, backgroundFBO.framebufferHeight); // blur all mips - int[] kernelSizeArray = new int[]{3, 5, 7, 9, 11}; + int[] kernelSizeArray = new int[] { 3, 5, 7, 9, 11 }; highLightFBO.bindFramebufferTexture(); for (int i = 0; i < downSampleFBO.length; i++) { Framebuffer buffer_h = downSampleFBO[i]; diff --git a/src/main/java/gregtech/client/shader/postprocessing/BloomType.java b/src/main/java/gregtech/client/shader/postprocessing/BloomType.java index 8b65f89503f..2ba0c084fb4 100644 --- a/src/main/java/gregtech/client/shader/postprocessing/BloomType.java +++ b/src/main/java/gregtech/client/shader/postprocessing/BloomType.java @@ -3,6 +3,7 @@ import javax.annotation.Nonnull; public enum BloomType { + /** * Simple Gaussian Blur */ diff --git a/src/main/java/gregtech/client/shader/postprocessing/BlurEffect.java b/src/main/java/gregtech/client/shader/postprocessing/BlurEffect.java index 5ee0fb3b530..07f4109b732 100644 --- a/src/main/java/gregtech/client/shader/postprocessing/BlurEffect.java +++ b/src/main/java/gregtech/client/shader/postprocessing/BlurEffect.java @@ -3,13 +3,16 @@ import gregtech.client.shader.PingPongBuffer; import gregtech.client.shader.Shaders; import gregtech.client.utils.RenderUtil; + import net.minecraft.client.shader.Framebuffer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class BlurEffect { + private static Framebuffer BLUR_H; private static Framebuffer BLUR_W; private static Framebuffer BLUR_H2; @@ -29,7 +32,7 @@ public static void updateSize(int lastWidth, int lastHeight) { BLUR_H2.setFramebufferFilter(GL11.GL_LINEAR); BLUR_W.setFramebufferFilter(GL11.GL_LINEAR); BLUR_W2.setFramebufferFilter(GL11.GL_LINEAR); - } else if (RenderUtil.updateFBOSize(BLUR_H, lastWidth / 8, lastHeight / 8)){ + } else if (RenderUtil.updateFBOSize(BLUR_H, lastWidth / 8, lastHeight / 8)) { RenderUtil.updateFBOSize(BLUR_H2, lastWidth / 4, lastHeight / 4); RenderUtil.updateFBOSize(BLUR_W, lastWidth / 8, lastHeight / 8); RenderUtil.updateFBOSize(BLUR_W2, lastWidth / 4, lastHeight / 4); @@ -42,17 +45,23 @@ public static void updateSize(int lastWidth, int lastHeight) { } public static Framebuffer renderBlur1(float step) { - Shaders.renderFullImageInFBO(BLUR_H2, Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", 0, step)).bindFramebufferTexture(); - Shaders.renderFullImageInFBO(BLUR_W2, Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", step, 0)).bindFramebufferTexture(); - Shaders.renderFullImageInFBO(BLUR_H, Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", 0, step)).bindFramebufferTexture(); - Shaders.renderFullImageInFBO(BLUR_W, Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", step, 0)).bindFramebufferTexture(); + Shaders.renderFullImageInFBO(BLUR_H2, Shaders.BLUR, + uniformCache -> uniformCache.glUniform2F("blurDir", 0, step)).bindFramebufferTexture(); + Shaders.renderFullImageInFBO(BLUR_W2, Shaders.BLUR, + uniformCache -> uniformCache.glUniform2F("blurDir", step, 0)).bindFramebufferTexture(); + Shaders.renderFullImageInFBO(BLUR_H, Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", 0, step)) + .bindFramebufferTexture(); + Shaders.renderFullImageInFBO(BLUR_W, Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", step, 0)) + .bindFramebufferTexture(); return BLUR_W; } public static Framebuffer renderBlur2(int loop, float step) { for (int i = 0; i < loop; i++) { - Shaders.renderFullImageInFBO(PingPongBuffer.swap(true), Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", 0, step)).bindFramebufferTexture(); - Shaders.renderFullImageInFBO(PingPongBuffer.swap(), Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", step, 0)).bindFramebufferTexture(); + Shaders.renderFullImageInFBO(PingPongBuffer.swap(true), Shaders.BLUR, + uniformCache -> uniformCache.glUniform2F("blurDir", 0, step)).bindFramebufferTexture(); + Shaders.renderFullImageInFBO(PingPongBuffer.swap(), Shaders.BLUR, + uniformCache -> uniformCache.glUniform2F("blurDir", step, 0)).bindFramebufferTexture(); } return PingPongBuffer.getCurrentBuffer(false); } diff --git a/src/main/java/gregtech/client/utils/AdvCCRSConsumer.java b/src/main/java/gregtech/client/utils/AdvCCRSConsumer.java index 87dbe090c9e..be6ba9e0ce5 100644 --- a/src/main/java/gregtech/client/utils/AdvCCRSConsumer.java +++ b/src/main/java/gregtech/client/utils/AdvCCRSConsumer.java @@ -1,8 +1,5 @@ package gregtech.client.utils; -import codechicken.lib.colour.Colour; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.vec.Matrix4; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; @@ -11,6 +8,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.colour.Colour; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.vec.Matrix4; + import javax.annotation.Nonnull; @SideOnly(Side.CLIENT) @@ -71,14 +72,11 @@ public void setTranslation(Matrix4 translation) { } @Override - public void setQuadTint(int tint) { - } + public void setQuadTint(int tint) {} @Override - public void setQuadOrientation(@Nonnull EnumFacing orientation) { - } + public void setQuadOrientation(@Nonnull EnumFacing orientation) {} @Override - public void setApplyDiffuseLighting(boolean diffuse) { - } + public void setApplyDiffuseLighting(boolean diffuse) {} } diff --git a/src/main/java/gregtech/client/utils/BloomEffectUtil.java b/src/main/java/gregtech/client/utils/BloomEffectUtil.java index b77529a6b4c..d893799d2c5 100644 --- a/src/main/java/gregtech/client/utils/BloomEffectUtil.java +++ b/src/main/java/gregtech/client/utils/BloomEffectUtil.java @@ -1,12 +1,11 @@ package gregtech.client.utils; -import com.github.bsideup.jabel.Desugar; import gregtech.client.renderer.IRenderSetup; import gregtech.client.shader.Shaders; import gregtech.client.shader.postprocessing.BloomEffect; import gregtech.client.shader.postprocessing.BloomType; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.*; @@ -20,14 +19,14 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.github.bsideup.jabel.Desugar; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.apache.commons.lang3.reflect.FieldUtils; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Contract; import org.lwjgl.opengl.GL11; -import javax.annotation.CheckReturnValue; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; @@ -35,6 +34,10 @@ import java.util.Objects; import java.util.function.Consumer; +import javax.annotation.CheckReturnValue; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @SideOnly(Side.CLIENT) public class BloomEffectUtil { @@ -78,7 +81,7 @@ public static BlockRenderLayer getRealBloomLayer() { * disabled, {@link BlockRenderLayer#CUTOUT} is returned instead. * * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@link BlockRenderLayer#CUTOUT} if - * bloom layer is disabled + * bloom layer is disabled * @see #getEffectiveBloomLayer(BlockRenderLayer) */ @Nonnull @@ -93,7 +96,7 @@ public static BlockRenderLayer getEffectiveBloomLayer() { * * @param fallback Block render layer to be returned when bloom layer is disabled * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@code fallback} if bloom layer is - * disabled + * disabled * @see #getEffectiveBloomLayer(boolean, BlockRenderLayer) */ @Contract("null -> _; !null -> !null") @@ -109,7 +112,7 @@ public static BlockRenderLayer getEffectiveBloomLayer(BlockRenderLayer fallback) * @param isBloomActive Whether bloom layer should be active. If this value is {@code false}, {@code fallback} layer * will be returned. Has no effect if Optifine is present. * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@link BlockRenderLayer#CUTOUT} if - * bloom layer is disabled + * bloom layer is disabled * @see #getEffectiveBloomLayer(boolean, BlockRenderLayer) */ @Nonnull @@ -126,7 +129,7 @@ public static BlockRenderLayer getEffectiveBloomLayer(boolean isBloomActive) { * will be returned. Has no effect if Optifine is present. * @param fallback Block render layer to be returned when bloom layer is disabled * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@code fallback} if bloom layer is - * disabled + * disabled */ @Contract("_, null -> _; _, !null -> !null") public static BlockRenderLayer getEffectiveBloomLayer(boolean isBloomActive, BlockRenderLayer fallback) { @@ -171,7 +174,8 @@ public static BloomRenderTicket registerBloomRender(@Nullable IRenderSetup setup } /** - * @deprecated use ticket-based bloom render hook {@link #registerBloomRender(IRenderSetup, BloomType, IBloomEffect)} + * @deprecated use ticket-based bloom render hook + * {@link #registerBloomRender(IRenderSetup, BloomType, IBloomEffect)} */ @Deprecated @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @@ -180,15 +184,17 @@ public static void requestCustomBloom(IBloomRenderFast handler, Consumer render.accept(b)).legacy = true; } - @SuppressWarnings({"rawtypes", "unchecked"}) + @SuppressWarnings({ "rawtypes", "unchecked" }) public static void init() { - bloom = EnumHelper.addEnum(BlockRenderLayer.class, "BLOOM", new Class[]{String.class}, "Bloom"); + bloom = EnumHelper.addEnum(BlockRenderLayer.class, "BLOOM", new Class[] { String.class }, "Bloom"); BLOOM = bloom; if (Loader.isModLoaded("nothirium")) { try { - //Nothirium hard copies the BlockRenderLayer enum into a ChunkRenderPass enum. Add our BLOOM layer to that too. - Class crp = Class.forName("meldexun.nothirium.api.renderer.chunk.ChunkRenderPass", false, Launch.classLoader); - EnumHelper.addEnum(crp, "BLOOM", new Class[]{}); + // Nothirium hard copies the BlockRenderLayer enum into a ChunkRenderPass enum. Add our BLOOM layer to + // that too. + Class crp = Class.forName("meldexun.nothirium.api.renderer.chunk.ChunkRenderPass", false, + Launch.classLoader); + EnumHelper.addEnum(crp, "BLOOM", new Class[] {}); Field all = FieldUtils.getField(crp, "ALL", false); FieldUtils.removeFinalModifier(all); FieldUtils.writeStaticField(all, crp.getEnumConstants()); @@ -326,7 +332,7 @@ public static int renderBloomBlockLayer(RenderGlobal renderGlobal, GlStateManager.disableBlend(); Shaders.renderFullImageInFBO(fbo, Shaders.IMAGE_F, null); - //********** render custom bloom ************ + // ********** render custom bloom ************ if (!BLOOM_RENDERS.isEmpty()) { BufferBuilder buffer = Tessellator.getInstance().getBuffer(); @@ -419,7 +425,7 @@ private static void preDraw() { } private static void postDraw() { - for (var it = BLOOM_RENDERS.values().iterator(); it.hasNext(); ) { + for (var it = BLOOM_RENDERS.values().iterator(); it.hasNext();) { List list = it.next(); if (!list.isEmpty()) { @@ -447,7 +453,8 @@ public static final class BloomRenderTicket { */ private boolean legacy; - BloomRenderTicket(@Nullable IRenderSetup renderSetup, @Nonnull BloomType bloomType, @Nonnull IBloomEffect render) { + BloomRenderTicket(@Nullable IRenderSetup renderSetup, @Nonnull BloomType bloomType, + @Nonnull IBloomEffect render) { this.renderSetup = renderSetup; this.bloomType = Objects.requireNonNull(bloomType, "bloomType == null"); this.render = Objects.requireNonNull(render, "render == null"); @@ -473,7 +480,8 @@ public void invalidate() { } /** - * @deprecated use ticket-based bloom render hook {@link #registerBloomRender(IRenderSetup, BloomType, IBloomEffect)} + * @deprecated use ticket-based bloom render hook + * {@link #registerBloomRender(IRenderSetup, BloomType, IBloomEffect)} */ @Deprecated @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @@ -483,12 +491,12 @@ public interface IBloomRenderFast extends IRenderSetup { * Custom Bloom Style. * * @return 0 - Simple Gaussian Blur Bloom - *

- * 1 - Unity Bloom - *

- *

- * 2 - Unreal Bloom - *

+ *

+ * 1 - Unity Bloom + *

+ *

+ * 2 - Unreal Bloom + *

*/ int customBloomStyle(); } diff --git a/src/main/java/gregtech/client/utils/DepthTextureUtil.java b/src/main/java/gregtech/client/utils/DepthTextureUtil.java index d8210e6807b..3aa59bf75b4 100644 --- a/src/main/java/gregtech/client/utils/DepthTextureUtil.java +++ b/src/main/java/gregtech/client/utils/DepthTextureUtil.java @@ -2,6 +2,7 @@ import gregtech.client.shader.Shaders; import gregtech.common.ConfigHolder; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -13,6 +14,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; import org.lwjgl.opengl.GL30; @@ -25,10 +27,12 @@ * @Author: KilaBash * @Date: 2021/09/11 * @Description: You'll need it when you need to get deep textures to do more cool things. - * The default FBO is used, unfortunately, sometimes we have to abandon native way to create a new fbo. But generally not. + * The default FBO is used, unfortunately, sometimes we have to abandon native way to create a new fbo. + * But generally not. */ @SideOnly(Side.CLIENT) public class DepthTextureUtil { + public static int framebufferObject; public static int framebufferDepthTexture; private static boolean useDefaultFBO = true; @@ -36,14 +40,16 @@ public class DepthTextureUtil { private static int lastWidth, lastHeight; private static boolean shouldRenderDepthTexture() { - return lastBind && !Shaders.isOptiFineShaderPackLoaded() && ConfigHolder.client.hookDepthTexture && OpenGlHelper.isFramebufferEnabled(); + return lastBind && !Shaders.isOptiFineShaderPackLoaded() && ConfigHolder.client.hookDepthTexture && + OpenGlHelper.isFramebufferEnabled(); } public static void onPreWorldRender(TickEvent.RenderTickEvent event) { Minecraft mc = Minecraft.getMinecraft(); if (event.phase == TickEvent.Phase.START && mc.world != null) { if (shouldRenderDepthTexture()) { - if (useDefaultFBO && GL11.glGetError() != 0) { // if we can't use the vanilla fbo.... okay, why not create our own fbo? + if (useDefaultFBO && GL11.glGetError() != 0) { // if we can't use the vanilla fbo.... okay, why not + // create our own fbo? useDefaultFBO = false; if (framebufferDepthTexture != 0) { disposeDepthTexture(); @@ -52,10 +58,11 @@ public static void onPreWorldRender(TickEvent.RenderTickEvent event) { } if (framebufferDepthTexture == 0) { createDepthTexture(); - } else if (lastWidth != mc.getFramebuffer().framebufferWidth || lastHeight != mc.getFramebuffer().framebufferHeight) { - disposeDepthTexture(); - createDepthTexture(); - } + } else if (lastWidth != mc.getFramebuffer().framebufferWidth || + lastHeight != mc.getFramebuffer().framebufferHeight) { + disposeDepthTexture(); + createDepthTexture(); + } } else { disposeDepthTexture(); } @@ -66,7 +73,8 @@ public static void onPreWorldRender(TickEvent.RenderTickEvent event) { public static void renderWorld(RenderWorldLastEvent event) { // re-render world in our own fbo. Minecraft mc = Minecraft.getMinecraft(); Entity viewer = mc.getRenderViewEntity(); - if (DepthTextureUtil.framebufferDepthTexture != 0 && mc.world != null && viewer != null && !DepthTextureUtil.useDefaultFBO) { + if (DepthTextureUtil.framebufferDepthTexture != 0 && mc.world != null && viewer != null && + !DepthTextureUtil.useDefaultFBO) { int lastFBO = GlStateManager.glGetInteger(GL30.GL_FRAMEBUFFER_BINDING); OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, framebufferObject); GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT); @@ -108,7 +116,8 @@ public static void createDepthTexture() { lastWidth = framebuffer.framebufferTextureWidth; lastHeight = framebuffer.framebufferTextureHeight; - OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, framebufferObject); // bind buffer then bind depth texture + OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, framebufferObject); // bind buffer then bind depth + // texture OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, stencil ? GL30.GL_DEPTH_STENCIL_ATTACHMENT : OpenGlHelper.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D, diff --git a/src/main/java/gregtech/client/utils/EffectRenderContext.java b/src/main/java/gregtech/client/utils/EffectRenderContext.java index 3c296072d36..b1a6793396a 100644 --- a/src/main/java/gregtech/client/utils/EffectRenderContext.java +++ b/src/main/java/gregtech/client/utils/EffectRenderContext.java @@ -4,9 +4,10 @@ import net.minecraft.entity.Entity; import net.minecraft.util.math.Vec3d; +import java.util.Objects; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Objects; /** * Collection of various information for rendering purposes. @@ -38,9 +39,12 @@ public EffectRenderContext update(@Nonnull Entity renderViewEntity, float partia this.renderViewEntity = renderViewEntity; this.partialTicks = partialTicks; - this.cameraX = renderViewEntity.lastTickPosX + (renderViewEntity.posX - renderViewEntity.lastTickPosX) * partialTicks; - this.cameraY = renderViewEntity.lastTickPosY + (renderViewEntity.posY - renderViewEntity.lastTickPosY) * partialTicks; - this.cameraZ = renderViewEntity.lastTickPosZ + (renderViewEntity.posZ - renderViewEntity.lastTickPosZ) * partialTicks; + this.cameraX = renderViewEntity.lastTickPosX + + (renderViewEntity.posX - renderViewEntity.lastTickPosX) * partialTicks; + this.cameraY = renderViewEntity.lastTickPosY + + (renderViewEntity.posY - renderViewEntity.lastTickPosY) * partialTicks; + this.cameraZ = renderViewEntity.lastTickPosZ + + (renderViewEntity.posZ - renderViewEntity.lastTickPosZ) * partialTicks; this.cameraViewDir = renderViewEntity.getLook(partialTicks); this.rotationX = ActiveRenderInfo.getRotationX(); diff --git a/src/main/java/gregtech/client/utils/FacadeBlockAccess.java b/src/main/java/gregtech/client/utils/FacadeBlockAccess.java index 5216c24084d..084e1b46101 100644 --- a/src/main/java/gregtech/client/utils/FacadeBlockAccess.java +++ b/src/main/java/gregtech/client/utils/FacadeBlockAccess.java @@ -1,6 +1,7 @@ package gregtech.client.utils; import gregtech.api.pipenet.IBlockAppearance; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -30,7 +31,6 @@ public class FacadeBlockAccess implements IBlockAccess { public final IBlockState state; public FacadeBlockAccess(IBlockAccess world, BlockPos pos, EnumFacing side, IBlockState state) { - this.world = world; this.pos = pos; this.side = side; @@ -38,7 +38,11 @@ public FacadeBlockAccess(IBlockAccess world, BlockPos pos, EnumFacing side, IBlo } public enum Result { - ORIGINAL, AIR, BASE, BEDROCK, COVER + ORIGINAL, + AIR, + BASE, + BEDROCK, + COVER } public Result getAction(BlockPos pos) { diff --git a/src/main/java/gregtech/client/utils/IBloomEffect.java b/src/main/java/gregtech/client/utils/IBloomEffect.java index 0f755b376bd..984acd91aa8 100644 --- a/src/main/java/gregtech/client/utils/IBloomEffect.java +++ b/src/main/java/gregtech/client/utils/IBloomEffect.java @@ -2,6 +2,7 @@ import gregtech.client.renderer.IRenderSetup; import gregtech.client.shader.postprocessing.BloomType; + import net.minecraft.client.renderer.BufferBuilder; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -26,7 +27,7 @@ public interface IBloomEffect { /** * @param context render context * @return if this effect should be rendered; returning {@code false} skips {@link #renderBloomEffect(BufferBuilder, - * EffectRenderContext)} call. + * EffectRenderContext)} call. */ @SideOnly(Side.CLIENT) default boolean shouldRenderBloomEffect(@Nonnull EffectRenderContext context) { diff --git a/src/main/java/gregtech/client/utils/PipelineUtil.java b/src/main/java/gregtech/client/utils/PipelineUtil.java index 286c0c70737..4bc47855665 100644 --- a/src/main/java/gregtech/client/utils/PipelineUtil.java +++ b/src/main/java/gregtech/client/utils/PipelineUtil.java @@ -1,10 +1,12 @@ package gregtech.client.utils; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; import gregtech.api.util.GTUtility; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; import org.apache.commons.lang3.ArrayUtils; @SideOnly(Side.CLIENT) @@ -13,5 +15,4 @@ public class PipelineUtil { public static IVertexOperation[] color(IVertexOperation[] ops, int rgbColor) { return ArrayUtils.add(ops, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(rgbColor))); } - } diff --git a/src/main/java/gregtech/client/utils/RenderBufferHelper.java b/src/main/java/gregtech/client/utils/RenderBufferHelper.java index 84ede4e950b..b1cffd4c734 100644 --- a/src/main/java/gregtech/client/utils/RenderBufferHelper.java +++ b/src/main/java/gregtech/client/utils/RenderBufferHelper.java @@ -1,16 +1,18 @@ package gregtech.client.utils; -import codechicken.lib.vec.Cuboid6; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.vec.Cuboid6; + @SideOnly(Side.CLIENT) public class RenderBufferHelper { - public static void renderCubeFrame(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float r, float g, float b, float a) { + public static void renderCubeFrame(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, + double maxY, double maxZ, float r, float g, float b, float a) { buffer.pos(minX, minY, minZ).color(r, g, b, a).endVertex(); buffer.pos(maxX, minY, minZ).color(r, g, b, a).endVertex(); @@ -48,15 +50,20 @@ public static void renderCubeFrame(BufferBuilder buffer, double minX, double min buffer.pos(minX, maxY, maxZ).color(r, g, b, a).endVertex(); } - public static void renderCubeFace(BufferBuilder buffer, Cuboid6 cuboid, float r, float g, float b, float a, boolean shade) { - renderCubeFace(buffer, cuboid.min.x, cuboid.min.y, cuboid.min.z, cuboid.max.x, cuboid.max.y, cuboid.max.z, r, g, b, a, shade); + public static void renderCubeFace(BufferBuilder buffer, Cuboid6 cuboid, float r, float g, float b, float a, + boolean shade) { + renderCubeFace(buffer, cuboid.min.x, cuboid.min.y, cuboid.min.z, cuboid.max.x, cuboid.max.y, cuboid.max.z, r, g, + b, a, shade); } - public static void renderCubeFace(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { + public static void renderCubeFace(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, + double maxY, double maxZ, float red, float green, float blue, float alpha) { renderCubeFace(buffer, minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha, false); } - public static void renderCubeFace(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float a, boolean shade) { + public static void renderCubeFace(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, + double maxY, double maxZ, float red, float green, float blue, float a, + boolean shade) { float r = red, g = green, b = blue; if (shade) { @@ -110,7 +117,9 @@ public static void renderCubeFace(BufferBuilder buffer, double minX, double minY buffer.pos(minX, maxY, maxZ).color(r, g, b, a).endVertex(); } - public static void renderRing(BufferBuilder buffer, double x, double y, double z, double r, double tubeRadius, int sides, int segments, float red, float green, float blue, float alpha, EnumFacing.Axis axis) { + public static void renderRing(BufferBuilder buffer, double x, double y, double z, double r, double tubeRadius, + int sides, int segments, float red, float green, float blue, float alpha, + EnumFacing.Axis axis) { double sideDelta = 2.0 * Math.PI / sides; double ringDelta = 2.0 * Math.PI / segments; double theta = 0; @@ -134,16 +143,22 @@ public static void renderRing(BufferBuilder buffer, double x, double y, double z switch (axis) { case Y: - buffer.pos(x + sinTheta * dist, y + tubeRadius * sinPhi, z + cosTheta * dist).color(red, green, blue, alpha).endVertex(); - buffer.pos(x + sinTheta1 * dist, y + tubeRadius * sinPhi, z + cosTheta1 * dist).color(red, green, blue, alpha).endVertex(); + buffer.pos(x + sinTheta * dist, y + tubeRadius * sinPhi, z + cosTheta * dist) + .color(red, green, blue, alpha).endVertex(); + buffer.pos(x + sinTheta1 * dist, y + tubeRadius * sinPhi, z + cosTheta1 * dist) + .color(red, green, blue, alpha).endVertex(); break; case X: - buffer.pos(x + tubeRadius * sinPhi, y + sinTheta * dist, z + cosTheta * dist).color(red, green, blue, alpha).endVertex(); - buffer.pos(x + tubeRadius * sinPhi, y + sinTheta1 * dist, z + cosTheta1 * dist).color(red, green, blue, alpha).endVertex(); + buffer.pos(x + tubeRadius * sinPhi, y + sinTheta * dist, z + cosTheta * dist) + .color(red, green, blue, alpha).endVertex(); + buffer.pos(x + tubeRadius * sinPhi, y + sinTheta1 * dist, z + cosTheta1 * dist) + .color(red, green, blue, alpha).endVertex(); break; case Z: - buffer.pos(x + cosTheta * dist, y + sinTheta * dist, z + tubeRadius * sinPhi).color(red, green, blue, alpha).endVertex(); - buffer.pos(x + cosTheta1 * dist, y + sinTheta1 * dist, z + tubeRadius * sinPhi).color(red, green, blue, alpha).endVertex(); + buffer.pos(x + cosTheta * dist, y + sinTheta * dist, z + tubeRadius * sinPhi) + .color(red, green, blue, alpha).endVertex(); + buffer.pos(x + cosTheta1 * dist, y + sinTheta1 * dist, z + tubeRadius * sinPhi) + .color(red, green, blue, alpha).endVertex(); break; } @@ -154,6 +169,4 @@ public static void renderRing(BufferBuilder buffer, double x, double y, double z } } - - } diff --git a/src/main/java/gregtech/client/utils/RenderUtil.java b/src/main/java/gregtech/client/utils/RenderUtil.java index ff6f613f5c0..20d46b9e509 100644 --- a/src/main/java/gregtech/client/utils/RenderUtil.java +++ b/src/main/java/gregtech/client/utils/RenderUtil.java @@ -1,8 +1,7 @@ package gregtech.client.utils; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.vec.Matrix4; import gregtech.api.gui.resources.TextureArea; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; @@ -25,14 +24,18 @@ import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.vec.Matrix4; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL30; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.awt.image.BufferedImage; import java.util.*; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @SideOnly(Side.CLIENT) public class RenderUtil { @@ -51,7 +54,7 @@ private static int[] peekFirstScissorOrFullScreen() { int[] currentTopFrame = scissorFrameStack.isEmpty() ? null : scissorFrameStack.peek(); if (currentTopFrame == null) { Minecraft minecraft = Minecraft.getMinecraft(); - return new int[]{0, 0, minecraft.displayWidth, minecraft.displayHeight}; + return new int[] { 0, 0, minecraft.displayWidth, minecraft.displayHeight }; } return currentTopFrame; } @@ -75,11 +78,11 @@ public static void pushScissorFrame(int x, int y, int width, int height) { newWidth = Math.min(maxWidth, newWidth); newHeight = Math.min(maxHeight, newHeight); applyScissor(newX, newY, newWidth, newHeight); - //finally, push applied scissor on top of scissor stack + // finally, push applied scissor on top of scissor stack if (scissorFrameStack.isEmpty()) { GL11.glEnable(GL11.GL_SCISSOR_TEST); } - scissorFrameStack.push(new int[]{newX, newY, newWidth, newHeight}); + scissorFrameStack.push(new int[] { newX, newY, newWidth, newHeight }); pushedFrame = true; } } @@ -87,7 +90,7 @@ public static void pushScissorFrame(int x, int y, int width, int height) { if (scissorFrameStack.isEmpty()) { GL11.glEnable(GL11.GL_SCISSOR_TEST); } - scissorFrameStack.push(new int[]{parentX, parentY, parentWidth, parentHeight}); + scissorFrameStack.push(new int[] { parentX, parentY, parentWidth, parentHeight }); } } @@ -104,9 +107,9 @@ public static void popScissorFrame() { } } - //applies scissor with gui-space coordinates and sizes + // applies scissor with gui-space coordinates and sizes private static void applyScissor(int x, int y, int w, int h) { - //translate upper-left to bottom-left + // translate upper-left to bottom-left ScaledResolution r = ((GuiIngameForge) Minecraft.getMinecraft().ingameGUI).getResolution(); int s = r == null ? 1 : r.getScaleFactor(); int translatedY = r == null ? 0 : (r.getScaledHeight() - y - h); @@ -115,10 +118,12 @@ private static void applyScissor(int x, int y, int w, int h) { /*** * used to render pixels in stencil mask. (e.g. Restrict rendering results to be displayed only in Monitor Screens) - * if you want to do the similar things in Gui(2D) not World(3D), plz consider using the {@link #useScissor(int, int, int, int, Runnable)} + * if you want to do the similar things in Gui(2D) not World(3D), plz consider using the + * {@link #useScissor(int, int, int, int, Runnable)} * that you don't need to draw mask to build a rect mask easily. - * @param mask draw mask - * @param renderInMask rendering in the mask + * + * @param mask draw mask + * @param renderInMask rendering in the mask * @param shouldRenderMask should mask be rendered too */ public static void useStencil(Runnable mask, Runnable renderInMask, boolean shouldRenderMask) { @@ -161,14 +166,15 @@ public static void useLightMap(float x, float y, Runnable codeBlock) { if (codeBlock != null) { codeBlock.run(); } - /* restore the lightmap */ + /* restore the lightmap */ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting(); GL11.glPopAttrib(); } public static void moveToFace(double x, double y, double z, EnumFacing face) { - GlStateManager.translate(x + 0.5 + face.getXOffset() * 0.5, y + 0.5 + face.getYOffset() * 0.5, z + 0.5 + face.getZOffset() * 0.5); + GlStateManager.translate(x + 0.5 + face.getXOffset() * 0.5, y + 0.5 + face.getYOffset() * 0.5, + z + 0.5 + face.getZOffset() * 0.5); } public static void rotateToFace(EnumFacing face, @Nullable EnumFacing spin) { @@ -182,7 +188,8 @@ public static void rotateToFace(EnumFacing face, @Nullable EnumFacing spin) { case DOWN: GlStateManager.scale(1.0f, -1.0f, 1.0f); GlStateManager.rotate(-90.0f, 1.0f, 0.0f, 0.0f); - GlStateManager.rotate(spin == EnumFacing.EAST ? 90 : spin == EnumFacing.NORTH ? 180 : spin == EnumFacing.WEST ? -90 : 0, 0, 0, 1); + GlStateManager.rotate(spin == EnumFacing.EAST ? 90 : + spin == EnumFacing.NORTH ? 180 : spin == EnumFacing.WEST ? -90 : 0, 0, 0, 1); break; case EAST: GlStateManager.scale(-1.0f, -1.0f, -1.0f); @@ -226,7 +233,8 @@ public static void bindTextureAtlasSprite(TextureAtlasSprite textureAtlasSprite) return; } - BufferedImage bufferedImage = new BufferedImage(iconWidth, iconHeight * frameCount, BufferedImage.TYPE_4BYTE_ABGR); + BufferedImage bufferedImage = new BufferedImage(iconWidth, iconHeight * frameCount, + BufferedImage.TYPE_4BYTE_ABGR); for (int i = 0; i < frameCount; i++) { int[][] frameTextureData = textureAtlasSprite.getFrameTextureData(i); int[] largestMipMapTextureData = frameTextureData[0]; @@ -243,9 +251,10 @@ public static void bindTextureAtlasSprite(TextureAtlasSprite textureAtlasSprite) /*** * avoid z-fighting. not familiar with the CCL, its a trick. * //TODO could DisableDepthMask in the CCL? + * * @param translation origin - * @param side facing - * @param layer level + * @param side facing + * @param layer level * @return adjust */ public static Matrix4 adjustTrans(Matrix4 translation, EnumFacing side, int layer) { @@ -313,7 +322,8 @@ public static void renderRect(float x, float y, float width, float height, float GlStateManager.color(1, 1, 1, 1); } - public static void renderGradientRect(float x, float y, float width, float height, float z, int startColor, int endColor, boolean horizontal) { + public static void renderGradientRect(float x, float y, float width, float height, float z, int startColor, + int endColor, boolean horizontal) { float startAlpha = (float) (startColor >> 24 & 255) / 255.0F; float startRed = (float) (startColor >> 16 & 255) / 255.0F; float startGreen = (float) (startColor >> 8 & 255) / 255.0F; @@ -325,7 +335,9 @@ public static void renderGradientRect(float x, float y, float width, float heigh GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); @@ -347,7 +359,8 @@ public static void renderGradientRect(float x, float y, float width, float heigh GlStateManager.enableTexture2D(); } - public static void renderText(float x, float y, float z, float scale, int color, final String renderedText, boolean centered) { + public static void renderText(float x, float y, float z, float scale, int color, final String renderedText, + boolean centered) { GlStateManager.pushMatrix(); final FontRenderer fr = Minecraft.getMinecraft().fontRenderer; final int width = fr.getStringWidth(renderedText); @@ -370,7 +383,8 @@ public static void renderItemOverLay(float x, float y, float z, float scale, Ite net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); } - public static void renderFluidOverLay(float x, float y, float width, float height, float z, FluidStack fluidStack, float alpha) { + public static void renderFluidOverLay(float x, float y, float width, float height, float z, FluidStack fluidStack, + float alpha) { if (fluidStack != null) { int color = fluidStack.getFluid().getColor(fluidStack); float r = (color >> 16 & 255) / 255.0f; @@ -378,9 +392,10 @@ public static void renderFluidOverLay(float x, float y, float width, float heigh float b = (color & 255) / 255.0f; TextureAtlasSprite sprite = TextureUtils.getTexture(fluidStack.getFluid().getStill(fluidStack)); GlStateManager.enableBlend(); - GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.disableAlpha(); - //GlStateManager.disableLighting(); + // GlStateManager.disableLighting(); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Tessellator tess = Tessellator.getInstance(); BufferBuilder buf = tess.getBuffer(); @@ -394,14 +409,15 @@ public static void renderFluidOverLay(float x, float y, float width, float heigh buf.pos(x + width, y, z).tex(uMax, vMin).color(r, g, b, alpha).endVertex(); tess.draw(); - //GlStateManager.enableLighting(); + // GlStateManager.enableLighting(); GlStateManager.enableAlpha(); GlStateManager.disableBlend(); GlStateManager.color(1F, 1F, 1F, 1F); } } - public static void renderTextureArea(TextureArea textureArea, float x, float y, float width, float height, float z) { + public static void renderTextureArea(TextureArea textureArea, float x, float y, float width, float height, + float z) { double imageU = textureArea.offsetX; double imageV = textureArea.offsetY; double imageWidth = textureArea.imageWidth; @@ -417,14 +433,16 @@ public static void renderTextureArea(TextureArea textureArea, float x, float y, tessellator.draw(); } - public static void renderLineChart(List data, long max, float x, float y, float width, float height, float lineWidth, int color) { + public static void renderLineChart(List data, long max, float x, float y, float width, float height, + float lineWidth, int color) { float durX = data.size() > 1 ? width / (data.size() - 1) : 0; float hY = max > 0 ? height / max : 0; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_DST_ALPHA); - GlStateManager.color(((color >> 16) & 0xFF) / 255f, ((color >> 8) & 0xFF) / 255f, (color & 0xFF) / 255f, ((color >> 24) & 0xFF) / 255f); + GlStateManager.color(((color >> 16) & 0xFF) / 255f, ((color >> 8) & 0xFF) / 255f, (color & 0xFF) / 255f, + ((color >> 24) & 0xFF) / 255f); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); @@ -462,7 +480,8 @@ public static void renderLine(float x1, float y1, float x2, float y2, float line GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_DST_ALPHA); - GlStateManager.color(((color >> 16) & 0xFF) / 255f, ((color >> 8) & 0xFF) / 255f, (color & 0xFF) / 255f, ((color >> 24) & 0xFF) / 255f); + GlStateManager.color(((color >> 16) & 0xFF) / 255f, ((color >> 8) & 0xFF) / 255f, (color & 0xFF) / 255f, + ((color >> 24) & 0xFF) / 255f); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); @@ -484,7 +503,8 @@ public static void renderLine(float x1, float y1, float x2, float y2, float line GlStateManager.color(1, 1, 1, 1); } - public static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) { + public static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, + int maskRight, double zLevel) { double uMin = textureSprite.getMinU(); double uMax = textureSprite.getMaxU(); double vMin = textureSprite.getMinV(); @@ -502,12 +522,14 @@ public static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSp tessellator.draw(); } - public static void drawFluidForGui(FluidStack contents, int tankCapacity, int startX, int startY, int widthT, int heightT) { + public static void drawFluidForGui(FluidStack contents, int tankCapacity, int startX, int startY, int widthT, + int heightT) { widthT--; heightT--; Fluid fluid = contents.getFluid(); ResourceLocation fluidStill = fluid.getStill(contents); - TextureAtlasSprite fluidStillSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluidStill.toString()); + TextureAtlasSprite fluidStillSprite = Minecraft.getMinecraft().getTextureMapBlocks() + .getAtlasSprite(fluidStill.toString()); int fluidColor = fluid.getColor(contents); int scaledAmount; if (contents.amount == tankCapacity) { @@ -585,23 +607,30 @@ public static boolean updateFBOSize(Framebuffer fbo, int width, int height) { } public static void hookDepthBuffer(Framebuffer fbo, int depthBuffer) { - //Hook DepthBuffer + // Hook DepthBuffer OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, fbo.framebufferObject); if (fbo.isStencilEnabled()) { - OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, depthBuffer); - OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, depthBuffer); + OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, + org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, + depthBuffer); + OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, + org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, + depthBuffer); } else { - OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, depthBuffer); + OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, + OpenGlHelper.GL_RENDERBUFFER, depthBuffer); } } public static void hookDepthTexture(Framebuffer fbo, int depthTexture) { - //Hook DepthTexture + // Hook DepthTexture OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, fbo.framebufferObject); if (fbo.isStencilEnabled()) { - OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, GL30.GL_DEPTH_STENCIL_ATTACHMENT, GL11.GL_TEXTURE_2D, depthTexture, 0); + OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, GL30.GL_DEPTH_STENCIL_ATTACHMENT, + GL11.GL_TEXTURE_2D, depthTexture, 0); } else { - OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D, depthTexture, 0); + OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, + GL11.GL_TEXTURE_2D, depthTexture, 0); } } @@ -609,7 +638,8 @@ public static void hookDepthTexture(Framebuffer fbo, int depthTexture) { * Makes given BakedQuad emissive; specifically, it makes a new UnpackedBakedQuad with * constant lightmap coordination and {@code applyDiffuseLighting} set to {@code false}. * The other properties, such as textures, tint color and other vertex data will be copied from - * the template.

+ * the template. + *

* Note that this method just returns {@code quad} if Optifine is installed. * * @param quad Template BakedQuad. @@ -623,6 +653,7 @@ public static BakedQuad makeEmissive(BakedQuad quad) { format.addElement(DefaultVertexFormats.TEX_2S); } UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format) { + @Override public void put(int element, @Nonnull float... data) { if (this.getVertexFormat().getElement(element) == DefaultVertexFormats.TEX_2S) diff --git a/src/main/java/gregtech/client/utils/ToolChargeBarRenderer.java b/src/main/java/gregtech/client/utils/ToolChargeBarRenderer.java index eb0af0b2d28..de982d07450 100644 --- a/src/main/java/gregtech/client/utils/ToolChargeBarRenderer.java +++ b/src/main/java/gregtech/client/utils/ToolChargeBarRenderer.java @@ -7,6 +7,7 @@ import gregtech.api.items.toolitem.IGTTool; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.util.GTUtility; + import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; @@ -15,6 +16,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.opengl.GL11; @@ -38,7 +40,8 @@ public final class ToolChargeBarRenderer { private static final Color colorBarLeftDepleted = new Color(122, 0, 0, 255); private static final Color colorBarRightDepleted = new Color(255, 27, 27, 255); - public static void render(double level, int xPosition, int yPosition, int offset, boolean shadow, Color left, Color right, boolean doDepletedColor) { + public static void render(double level, int xPosition, int yPosition, int offset, boolean shadow, Color left, + Color right, boolean doDepletedColor) { double width = level * BAR_W; if (doDepletedColor && level <= 0.25) { left = colorBarLeftDepleted; @@ -71,23 +74,38 @@ public static void render(double level, int xPosition, int yPosition, int offset private static void drawGrad(BufferBuilder renderer, int x, int y, double width, Color left, Color right) { renderer.pos(x, y, 0.0D).color(left.getRed(), left.getGreen(), left.getBlue(), left.getAlpha()).endVertex(); - renderer.pos(x, y + (double) 1, 0.0D).color(left.getRed(), left.getGreen(), left.getBlue(), left.getAlpha()).endVertex(); - renderer.pos(x + width, y + (double) 1, 0.0D).color(right.getRed(), right.getGreen(), right.getBlue(), right.getAlpha()).endVertex(); - renderer.pos(x + width, y, 0.0D).color(right.getRed(), right.getGreen(), right.getBlue(), right.getAlpha()).endVertex(); + renderer.pos(x, y + (double) 1, 0.0D).color(left.getRed(), left.getGreen(), left.getBlue(), left.getAlpha()) + .endVertex(); + renderer.pos(x + width, y + (double) 1, 0.0D) + .color(right.getRed(), right.getGreen(), right.getBlue(), right.getAlpha()).endVertex(); + renderer.pos(x + width, y, 0.0D).color(right.getRed(), right.getGreen(), right.getBlue(), right.getAlpha()) + .endVertex(); } private static void drawShadow(BufferBuilder renderer, int x, int y, double width, double height) { - renderer.pos(x, y, 0.0D).color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()).endVertex(); - renderer.pos(x, y + height, 0.0D).color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()).endVertex(); - renderer.pos(x + width, y + height, 0.0D).color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()).endVertex(); - renderer.pos(x + width, y, 0.0D).color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()).endVertex(); + renderer.pos(x, y, 0.0D) + .color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()) + .endVertex(); + renderer.pos(x, y + height, 0.0D) + .color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()) + .endVertex(); + renderer.pos(x + width, y + height, 0.0D) + .color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()) + .endVertex(); + renderer.pos(x + width, y, 0.0D) + .color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()) + .endVertex(); } private static void drawBG(BufferBuilder renderer, int x, int y, double width) { - renderer.pos(x - width, y, 0.0D).color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); - renderer.pos(x - width, y + (double) 1, 0.0D).color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); - renderer.pos(x, y + (double) 1, 0.0D).color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); - renderer.pos(x, y, 0.0D).color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); + renderer.pos(x - width, y, 0.0D) + .color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); + renderer.pos(x - width, y + (double) 1, 0.0D) + .color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); + renderer.pos(x, y + (double) 1, 0.0D) + .color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); + renderer.pos(x, y, 0.0D).color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()) + .endVertex(); } private static void overpaintVanillaRenderBug(BufferBuilder worldrenderer, int xPosition, int yPosition) { @@ -98,10 +116,12 @@ public static void renderBarsTool(IGTTool tool, ItemStack stack, int xPosition, boolean renderedDurability = false; NBTTagCompound tag = GTUtility.getOrCreateNbtCompound(stack); if (!tag.getBoolean(ToolHelper.UNBREAKABLE_KEY)) { - renderedDurability = renderDurabilityBar(stack.getItem().getDurabilityForDisplay(stack), xPosition, yPosition); + renderedDurability = renderDurabilityBar(stack.getItem().getDurabilityForDisplay(stack), xPosition, + yPosition); } if (tool.isElectric()) { - renderElectricBar(tool.getCharge(stack), tool.getMaxCharge(stack), xPosition, yPosition, renderedDurability); + renderElectricBar(tool.getCharge(stack), tool.getMaxCharge(stack), xPosition, yPosition, + renderedDurability); } } @@ -114,18 +134,22 @@ public static void renderBarsItem(MetaItem metaItem, ItemStack stack, int xPo IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (electricItem != null) { - renderElectricBar(electricItem.getCharge(), electricItem.getMaxCharge(), xPosition, yPosition, renderedDurability); + renderElectricBar(electricItem.getCharge(), electricItem.getMaxCharge(), xPosition, yPosition, + renderedDurability); } } - private static void renderElectricBar(long charge, long maxCharge, int xPosition, int yPosition, boolean renderedDurability) { + private static void renderElectricBar(long charge, long maxCharge, int xPosition, int yPosition, + boolean renderedDurability) { if (charge > 0 && maxCharge > 0) { double level = (double) charge / (double) maxCharge; - render(level, xPosition, yPosition, renderedDurability ? 2 : 0, true, colorBarLeftEnergy, colorBarRightEnergy, true); + render(level, xPosition, yPosition, renderedDurability ? 2 : 0, true, colorBarLeftEnergy, + colorBarRightEnergy, true); } } - private static boolean renderDurabilityBar(ItemStack stack, IItemDurabilityManager manager, int xPosition, int yPosition) { + private static boolean renderDurabilityBar(ItemStack stack, IItemDurabilityManager manager, int xPosition, + int yPosition) { double level = manager.getDurabilityForDisplay(stack); if (level == 0.0 && !manager.showEmptyBar(stack)) return false; if (level == 1.0 && !manager.showFullBar(stack)) return false; @@ -142,6 +166,5 @@ private static boolean renderDurabilityBar(double level, int xPosition, int yPos return true; } - private ToolChargeBarRenderer() { - } + private ToolChargeBarRenderer() {} } diff --git a/src/main/java/gregtech/client/utils/TooltipHelper.java b/src/main/java/gregtech/client/utils/TooltipHelper.java index c39b4f111da..b352bb6ca35 100644 --- a/src/main/java/gregtech/client/utils/TooltipHelper.java +++ b/src/main/java/gregtech/client/utils/TooltipHelper.java @@ -2,8 +2,10 @@ import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; + import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.common.gameevent.TickEvent; + import org.lwjgl.input.Keyboard; import java.util.ArrayList; @@ -49,7 +51,8 @@ public static GTFormatCode createNewCode(int rate, TextFormatting... codes) { return null; } if (codes == null || codes.length <= 1) { - GTLog.logger.error("Could not create GT Format Code with codes {}, must have length greater than one!", Arrays.toString(codes)); + GTLog.logger.error("Could not create GT Format Code with codes {}, must have length greater than one!", + Arrays.toString(codes)); return null; } GTFormatCode code = new GTFormatCode(rate, codes); diff --git a/src/main/java/gregtech/client/utils/TrackedDummyWorld.java b/src/main/java/gregtech/client/utils/TrackedDummyWorld.java index 925836aab09..9e1a0c3bfcf 100644 --- a/src/main/java/gregtech/client/utils/TrackedDummyWorld.java +++ b/src/main/java/gregtech/client/utils/TrackedDummyWorld.java @@ -2,6 +2,7 @@ import gregtech.api.util.BlockInfo; import gregtech.api.util.world.DummyWorld; + import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; @@ -10,13 +11,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.vecmath.Vector3f; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.function.Predicate; +import javax.annotation.Nonnull; +import javax.vecmath.Vector3f; + /** * Created with IntelliJ IDEA. * @@ -26,6 +28,7 @@ */ @SideOnly(Side.CLIENT) public class TrackedDummyWorld extends DummyWorld { + public final Set renderedBlocks = new HashSet<>(); private Predicate renderFilter; private final World proxyWorld; @@ -37,11 +40,11 @@ public void setRenderFilter(Predicate renderFilter) { this.renderFilter = renderFilter; } - public TrackedDummyWorld(){ + public TrackedDummyWorld() { proxyWorld = null; } - public TrackedDummyWorld(World world){ + public TrackedDummyWorld(World world) { proxyWorld = world; } @@ -67,7 +70,7 @@ public TileEntity getTileEntity(@Nonnull BlockPos pos) { @Override public IBlockState getBlockState(@Nonnull BlockPos pos) { if (renderFilter != null && !renderFilter.test(pos)) - return Blocks.AIR.getDefaultState(); //return air if not rendering this block + return Blocks.AIR.getDefaultState(); // return air if not rendering this block return proxyWorld != null ? proxyWorld.getBlockState(pos) : super.getBlockState(pos); } diff --git a/src/main/java/gregtech/common/CommonProxy.java b/src/main/java/gregtech/common/CommonProxy.java index 04c05dde5fe..7cac0f93204 100644 --- a/src/main/java/gregtech/common/CommonProxy.java +++ b/src/main/java/gregtech/common/CommonProxy.java @@ -37,6 +37,7 @@ import gregtech.loaders.OreDictionaryLoader; import gregtech.loaders.recipe.CraftingComponent; import gregtech.loaders.recipe.GTRecipeManager; + import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; @@ -56,6 +57,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.registries.IForgeRegistry; + import org.apache.commons.lang3.ArrayUtils; import java.util.Arrays; @@ -84,7 +86,8 @@ public static void registerBlocks(RegistryEvent.Register event) { if (material.hasProperty(PropertyKey.WIRE)) { for (BlockCable cable : CABLES.get(materialRegistry.getModid())) { - if (!cable.getItemPipeType(null).isCable() || !material.getProperty(PropertyKey.WIRE).isSuperconductor()) + if (!cable.getItemPipeType(null).isCable() || + !material.getProperty(PropertyKey.WIRE).isSuperconductor()) cable.addCableMaterial(material, material.getProperty(PropertyKey.WIRE)); } } @@ -194,7 +197,7 @@ private static void createOreBlock(Material material, StoneType[] stoneTypes, in @SubscribeEvent(priority = EventPriority.LOWEST) public static void registerBlocksLast(RegistryEvent.Register event) { - //last chance for mods to register their potion types is here + // last chance for mods to register their potion types is here FLUID_BLOCKS.forEach(event.getRegistry()::register); } @@ -217,9 +220,12 @@ public static void registerItems(RegistryEvent.Register event) { registry.register(createItemBlock(MACHINE, MachineItemBlock::new)); for (MaterialRegistry materialRegistry : GregTechAPI.materialManager.getRegistries()) { - for (BlockCable cable : CABLES.get(materialRegistry.getModid())) registry.register(createItemBlock(cable, ItemBlockCable::new)); - for (BlockFluidPipe pipe : FLUID_PIPES.get(materialRegistry.getModid())) registry.register(createItemBlock(pipe, ItemBlockFluidPipe::new)); - for (BlockItemPipe pipe : ITEM_PIPES.get(materialRegistry.getModid())) registry.register(createItemBlock(pipe, ItemBlockItemPipe::new)); + for (BlockCable cable : CABLES.get(materialRegistry.getModid())) + registry.register(createItemBlock(cable, ItemBlockCable::new)); + for (BlockFluidPipe pipe : FLUID_PIPES.get(materialRegistry.getModid())) + registry.register(createItemBlock(pipe, ItemBlockFluidPipe::new)); + for (BlockItemPipe pipe : ITEM_PIPES.get(materialRegistry.getModid())) + registry.register(createItemBlock(pipe, ItemBlockItemPipe::new)); } for (BlockOpticalPipe pipe : OPTICAL_PIPES) registry.register(createItemBlock(pipe, ItemBlockOpticalPipe::new)); for (BlockLaserPipe pipe : LASER_PIPES) registry.register(createItemBlock(pipe, ItemBlockLaserPipe::new)); @@ -286,11 +292,11 @@ public static void initComponents(RegistryEvent.Register event) { MinecraftForge.EVENT_BUS.post(new GregTechAPI.RegisterEvent<>(null, CraftingComponent.class)); } - //this is called with normal priority, so most mods working with - //ore dictionary and recipes will get recipes accessible in time + // this is called with normal priority, so most mods working with + // ore dictionary and recipes will get recipes accessible in time @SubscribeEvent public static void registerRecipes(RegistryEvent.Register event) { - //Registers Fusion tiers for the FusionEUToStartProperty + // Registers Fusion tiers for the FusionEUToStartProperty FusionEUToStartProperty.registerFusionTier(6, "(MK1)"); FusionEUToStartProperty.registerFusionTier(7, "(MK2)"); FusionEUToStartProperty.registerFusionTier(8, "(MK3)"); @@ -314,17 +320,17 @@ public static void registerRecipes(RegistryEvent.Register event) { GTRecipeManager.load(); } - //this is called almost last, to make sure all mods registered their ore dictionary - //items and blocks for running first phase of material handlers - //it will also clear generated materials + // this is called almost last, to make sure all mods registered their ore dictionary + // items and blocks for running first phase of material handlers + // it will also clear generated materials @SubscribeEvent(priority = EventPriority.LOW) public static void runEarlyMaterialHandlers(RegistryEvent.Register event) { GTLog.logger.info("Running early material handlers..."); OrePrefix.runMaterialHandlers(); } - //this is called last, so all mods finished registering their stuff, as example, CraftTweaker - //if it registered some kind of ore dictionary entry, late processing will hook it and generate recipes + // this is called last, so all mods finished registering their stuff, as example, CraftTweaker + // if it registered some kind of ore dictionary entry, late processing will hook it and generate recipes @SubscribeEvent(priority = EventPriority.LOWEST) public static void registerRecipesLowest(RegistryEvent.Register event) { GTLog.logger.info("Running late material handlers..."); @@ -348,17 +354,17 @@ public static void syncConfigValues(ConfigChangedEvent.OnConfigChangedEvent even public static void modifyFuelBurnTime(FurnaceFuelBurnTimeEvent event) { ItemStack stack = event.getItemStack(); Block block = Block.getBlockFromItem(stack.getItem()); - //handle sapling and log burn rates + // handle sapling and log burn rates if (block == RUBBER_SAPLING) { event.setBurnTime(100); } else if (block == WOOD_SLAB) { event.setBurnTime(150); } else if (block instanceof BlockCompressed) { - //handle material blocks burn value + // handle material blocks burn value Material material = ((BlockCompressed) block).getGtMaterial(stack); DustProperty property = material.getProperty(PropertyKey.DUST); if (property != null && property.getBurnTime() > 0) { - //compute burn value for block prefix, taking amount of material in block into account + // compute burn value for block prefix, taking amount of material in block into account double materialUnitsInBlock = OrePrefix.block.getMaterialAmount(material) / (GTValues.M * 1.0); event.setBurnTime((int) (materialUnitsInBlock * property.getBurnTime())); } @@ -375,11 +381,9 @@ private static ItemBlock createItemBlock(T block, Function 1 EU. 0.5 means 2L Steam -> 1 EU.", "Default: 0.5"}) + @Config.Comment({ "Steam to EU multiplier for Steam Multiblocks.", + "1.0 means 1L Steam -> 1 EU. 0.5 means 2L Steam -> 1 EU.", "Default: 0.5" }) public double multiblockSteamToEU = 0.5; - @Config.Comment({"Whether machines or boilers damage the terrain when they explode.", - "Note machines and boilers always explode when overloaded with power or met with special conditions, regardless of this config.", "Default: true"}) + @Config.Comment({ "Whether machines or boilers damage the terrain when they explode.", + "Note machines and boilers always explode when overloaded with power or met with special conditions, regardless of this config.", + "Default: true" }) public boolean doesExplosionDamagesTerrain = true; - @Config.Comment({"Whether machines explode in rainy weather or when placed next to certain terrain, such as fire or lava", "Default: false"}) + @Config.Comment({ + "Whether machines explode in rainy weather or when placed next to certain terrain, such as fire or lava", + "Default: false" }) public boolean doTerrainExplosion = false; - @Config.Comment({"Energy use multiplier for electric items.", "Default: 100"}) + @Config.Comment({ "Energy use multiplier for electric items.", "Default: 100" }) public int energyUsageMultiplier = 100; - @Config.Comment({"The EU/t drain for each screen of the Central Monitor.", "Default: 8"}) + @Config.Comment({ "The EU/t drain for each screen of the Central Monitor.", "Default: 8" }) @Config.RangeInt(min = 0) public int centralMonitorEuCost = 8; - @Config.Comment({"Whether to play machine sounds while machines are active.", "Default: true"}) + @Config.Comment({ "Whether to play machine sounds while machines are active.", "Default: true" }) public boolean machineSounds = true; - @Config.Comment({"Additional Fluids to allow in GT Boilers in place of Water or Distilled Water.", - "Useful for mods like TerraFirmaCraft with different Fluids for Water", "Default: none"}) + @Config.Comment({ "Additional Fluids to allow in GT Boilers in place of Water or Distilled Water.", + "Useful for mods like TerraFirmaCraft with different Fluids for Water", "Default: none" }) public String[] boilerFluids = new String[0]; - @Config.Comment({"Blacklist of machines for the Processing Array.", + @Config.Comment({ "Blacklist of machines for the Processing Array.", "Add the unlocalized Recipe Map name to blacklist the machine.", - "Default: All machines allowed"}) + "Default: All machines allowed" }) public String[] processingArrayBlacklist = new String[0]; - @Config.Comment({"Whether to enable the cleanroom, required for various recipes.", "Default: true"}) + @Config.Comment({ "Whether to enable the cleanroom, required for various recipes.", "Default: true" }) public boolean enableCleanroom = true; - @Config.Comment({"Whether multiblocks should ignore all cleanroom requirements.", + @Config.Comment({ "Whether multiblocks should ignore all cleanroom requirements.", "This does nothing if B:enableCleanroom is false.", - "Default: false"}) + "Default: false" }) public boolean cleanMultiblocks = false; - @Config.Comment({"Block to replace mined ores with in the miner and multiblock miner.", "Default: minecraft:cobblestone"}) + @Config.Comment({ "Block to replace mined ores with in the miner and multiblock miner.", + "Default: minecraft:cobblestone" }) public String replaceMinedBlocksWith = "minecraft:cobblestone"; - @Config.Comment({"Whether to enable Assembly Line research for recipes.", "Default: true"}) + @Config.Comment({ "Whether to enable Assembly Line research for recipes.", "Default: true" }) @Config.RequiresMcRestart public boolean enableResearch = true; - @Config.Comment({"Whether the Assembly Line should require the item inputs to be in order.", "Default: true"}) + @Config.Comment({ "Whether the Assembly Line should require the item inputs to be in order.", "Default: true" }) @Config.RequiresMcRestart public boolean orderedAssembly = true; - @Config.Comment({"Whether the Assembly Line should require the fluid inputs to be in order.", + @Config.Comment({ "Whether the Assembly Line should require the fluid inputs to be in order.", "This does nothing if B:orderedAssembly is false.", - "Default: false"}) + "Default: false" }) @Config.RequiresMcRestart public boolean orderedFluidAssembly = false; @@ -143,113 +154,130 @@ public static class MachineOptions { * Addons mods should not reference this config directly. * Use {@link GregTechAPI#isHighTier()} instead. */ - @Config.Comment({"If High Tier (>UV-tier) GT content should be registered.", + @Config.Comment({ "If High Tier (>UV-tier) GT content should be registered.", "Items and Machines enabled with this config will have missing recipes by default.", "This is intended for modpack developers only, and is not playable without custom tweaks or addons.", "Other mods can override this to true, regardless of the config file.", - "Default: false"}) + "Default: false" }) @Config.RequiresMcRestart public boolean highTierContent = false; } public static class WorldGenOptions { - @Config.Comment({"Specifies the minimum number of veins in a section.", "Default: 1"}) + @Config.Comment({ "Specifies the minimum number of veins in a section.", "Default: 1" }) public int minVeinsInSection = 1; - @Config.Comment({"Specifies an additional random number of veins in a section.", "Default: 0"}) + @Config.Comment({ "Specifies an additional random number of veins in a section.", "Default: 0" }) public int additionalVeinsInSection = 0; - @Config.Comment({"Whether veins should be generated in the center of chunks.", "Default: true"}) + @Config.Comment({ "Whether veins should be generated in the center of chunks.", "Default: true" }) public boolean generateVeinsInCenterOfChunk = true; - @Config.Comment({"Whether to disable Vanilla ore generation in world.", "Default: true"}) + @Config.Comment({ "Whether to disable Vanilla ore generation in world.", "Default: true" }) public boolean disableVanillaOres = true; - @Config.Comment({"Whether to disable Rubber Tree world generation.", "Default: false"}) + @Config.Comment({ "Whether to disable Rubber Tree world generation.", "Default: false" }) public boolean disableRubberTreeGeneration = false; - @Config.Comment({"Multiplier for the chance to spawn a Rubber Tree on any given roll. Higher values make Rubber Trees more common.", "Default: 1.0"}) + @Config.Comment({ + "Multiplier for the chance to spawn a Rubber Tree on any given roll. Higher values make Rubber Trees more common.", + "Default: 1.0" }) @Config.RangeDouble(min = 0) public double rubberTreeRateIncrease = 1.0; - @Config.Comment({"Whether to increase number of rolls for dungeon chests. Increases dungeon loot drastically.", "Default: true"}) + @Config.Comment({ "Whether to increase number of rolls for dungeon chests. Increases dungeon loot drastically.", + "Default: true" }) public boolean increaseDungeonLoot = true; - @Config.Comment({"Allow GregTech to add additional GregTech Items as loot in various structures.", "Default: true"}) + @Config.Comment({ "Allow GregTech to add additional GregTech Items as loot in various structures.", + "Default: true" }) public boolean addLoot = true; - @Config.Comment({"Should all Stone Types drop unique Ore Item Blocks?", "Default: false (meaning only Stone, Netherrack, and Endstone"}) + @Config.Comment({ "Should all Stone Types drop unique Ore Item Blocks?", + "Default: false (meaning only Stone, Netherrack, and Endstone" }) public boolean allUniqueStoneTypes = false; } public static class RecipeOptions { - @Config.Comment({"Change the recipe of Rods in the Lathe to 1 Rod and 2 Small Piles of Dust, instead of 2 Rods.", "Default: false"}) + @Config.Comment({ + "Change the recipe of Rods in the Lathe to 1 Rod and 2 Small Piles of Dust, instead of 2 Rods.", + "Default: false" }) public boolean harderRods = false; - @Config.Comment({"Whether to make Glass related recipes harder. Default: true"}) + @Config.Comment({ "Whether to make Glass related recipes harder. Default: true" }) public boolean hardGlassRecipes = true; - @Config.Comment({"Whether to nerf Wood crafting to 2 Planks from 1 Log, and 2 Sticks from 2 Planks.", "Default: false"}) + @Config.Comment({ "Whether to nerf Wood crafting to 2 Planks from 1 Log, and 2 Sticks from 2 Planks.", + "Default: false" }) public boolean nerfWoodCrafting = false; - @Config.Comment({"Whether to nerf the Paper crafting recipe.", "Default: true"}) + @Config.Comment({ "Whether to nerf the Paper crafting recipe.", "Default: true" }) public boolean nerfPaperCrafting = true; - @Config.Comment({"Whether to make Wood related recipes harder.", "Excludes sticks and planks.", "Default: false"}) + @Config.Comment({ "Whether to make Wood related recipes harder.", "Excludes sticks and planks.", + "Default: false" }) public boolean hardWoodRecipes = false; - @Config.Comment({"Whether to make Redstone related recipes harder.", "Default: false"}) + @Config.Comment({ "Whether to make Redstone related recipes harder.", "Default: false" }) public boolean hardRedstoneRecipes = false; - @Config.Comment({"Recipes for Buckets, Cauldrons, Hoppers, and Iron Bars" + - " require Iron Plates, Rods, and more.", "Default: true"}) + @Config.Comment({ "Recipes for Buckets, Cauldrons, Hoppers, and Iron Bars" + + " require Iron Plates, Rods, and more.", "Default: true" }) public boolean hardIronRecipes = true; - @Config.Comment({"Recipes for items like Iron Doors, Trapdoors, Anvil" + - " require Iron Plates, Rods, and more.", "Default: false"}) + @Config.Comment({ "Recipes for items like Iron Doors, Trapdoors, Anvil" + + " require Iron Plates, Rods, and more.", "Default: false" }) public boolean hardAdvancedIronRecipes = false; - @Config.Comment({"Whether to make miscellaneous recipes harder.", "Default: false"}) + @Config.Comment({ "Whether to make miscellaneous recipes harder.", "Default: false" }) public boolean hardMiscRecipes = false; - @Config.Comment({"Whether to make coloring blocks like Concrete or Glass harder.", "Default: false"}) + @Config.Comment({ "Whether to make coloring blocks like Concrete or Glass harder.", "Default: false" }) public boolean hardDyeRecipes = false; - @Config.Comment({"Whether to remove charcoal smelting recipes from the vanilla furnace.", "Default: true"}) + @Config.Comment({ "Whether to remove charcoal smelting recipes from the vanilla furnace.", "Default: true" }) public boolean harderCharcoalRecipe = true; - @Config.Comment({"Whether to make the Flint and Steel recipe require steel parts.", "Default: true."}) + @Config.Comment({ "Whether to make the Flint and Steel recipe require steel parts.", "Default: true." }) public boolean flintAndSteelRequireSteel = true; - @Config.Comment({"Whether to make Vanilla Tools and Armor recipes harder.", "Excludes Flint and Steel, and Buckets.", "Default: false"}) + @Config.Comment({ "Whether to make Vanilla Tools and Armor recipes harder.", + "Excludes Flint and Steel, and Buckets.", "Default: false" }) public boolean hardToolArmorRecipes = false; - @Config.Comment({"Whether to disable the Vanilla Concrete from Powder with Water behavior, forcing the GT recipe.", "Default: false"}) + @Config.Comment({ + "Whether to disable the Vanilla Concrete from Powder with Water behavior, forcing the GT recipe.", + "Default: false" }) public boolean disableConcreteInWorld = false; - @Config.Comment({"Whether to generate Flawed and Chipped Gems for materials and recipes involving them.", - "Useful for mods like TerraFirmaCraft.", "Default: false"}) + @Config.Comment({ "Whether to generate Flawed and Chipped Gems for materials and recipes involving them.", + "Useful for mods like TerraFirmaCraft.", "Default: false" }) public boolean generateLowQualityGems = false; - @Config.Comment({"Whether to remove Block/Ingot compression and decompression in the Crafting Table.", "Default: false"}) + @Config.Comment({ "Whether to remove Block/Ingot compression and decompression in the Crafting Table.", + "Default: false" }) public boolean disableManualCompression = false; - @Config.Comment({"Whether to remove Vanilla Block Recipes from the Crafting Table.", "Default: false"}) + @Config.Comment({ "Whether to remove Vanilla Block Recipes from the Crafting Table.", "Default: false" }) public boolean removeVanillaBlockRecipes = false; - @Config.Comment({"Whether to make crafting recipes for Bricks, Nether Bricks, Firebricks, and Coke Bricks harder.", "Default: false"}) + @Config.Comment({ + "Whether to make crafting recipes for Bricks, Nether Bricks, Firebricks, and Coke Bricks harder.", + "Default: false" }) public boolean harderBrickRecipes = false; - @Config.Comment({"Whether to make the recipe for the EBF Controller harder.", "Default: false"}) + @Config.Comment({ "Whether to make the recipe for the EBF Controller harder.", "Default: false" }) public boolean harderEBFControllerRecipe = false; - @Config.Comment({"How many Multiblock Casings to make per craft. Either 1, 2, or 3.", "Default: 2"}) + @Config.Comment({ "How many Multiblock Casings to make per craft. Either 1, 2, or 3.", "Default: 2" }) @Config.RangeInt(min = 1, max = 3) public int casingsPerCraft = 2; - @Config.Comment({"Whether to nerf the output amounts of the first circuit in a set to 1 (from 2) and SoC to 2 (from 4).", "Default: false"}) + @Config.Comment({ + "Whether to nerf the output amounts of the first circuit in a set to 1 (from 2) and SoC to 2 (from 4).", + "Default: false" }) public boolean harderCircuitRecipes = false; } @@ -263,45 +291,54 @@ public static class CompatibilityOptions { @Config.Name("Energy Compat Options") public AE2CompatOptions ae2 = new AE2CompatOptions(); - @Config.Comment({"Whether to hide facades of all blocks in JEI and creative search menu.", "Default: true"}) + @Config.Comment({ "Whether to hide facades of all blocks in JEI and creative search menu.", "Default: true" }) public boolean hideFacadesInJEI = true; - @Config.Comment({"Whether to hide filled cells in JEI and creative search menu.", "Default: true"}) + @Config.Comment({ "Whether to hide filled cells in JEI and creative search menu.", "Default: true" }) public boolean hideFilledCellsInJEI = true; - @Config.Comment({"Specifies priorities of mods in Ore Dictionary item registration.", "First ModID has highest priority, last has lowest. " + - "Unspecified ModIDs follow standard sorting, but always have lower priority than the last specified ModID.", "Default: [\"minecraft\", \"gregtech\"]"}) + @Config.Comment({ "Specifies priorities of mods in Ore Dictionary item registration.", + "First ModID has highest priority, last has lowest. " + + "Unspecified ModIDs follow standard sorting, but always have lower priority than the last specified ModID.", + "Default: [\"minecraft\", \"gregtech\"]" }) public String[] modPriorities = { "minecraft", "gregtech" }; - @Config.Comment({"Whether Gregtech should remove smelting recipes from the vanilla furnace for ingots requiring the Electric Blast Furnace.", "Default: true"}) + @Config.Comment({ + "Whether Gregtech should remove smelting recipes from the vanilla furnace for ingots requiring the Electric Blast Furnace.", + "Default: true" }) public boolean removeSmeltingForEBFMetals = true; public static class EnergyCompatOptions { - @Config.Comment({"Enable Native GTEU to Forge Energy (RF and alike) on GT Cables and Wires.", "This does not enable nor disable Converters.", "Default: true"}) + @Config.Comment({ "Enable Native GTEU to Forge Energy (RF and alike) on GT Cables and Wires.", + "This does not enable nor disable Converters.", "Default: true" }) public boolean nativeEUToFE = true; - @Config.Comment({"Enable GTEU to FE (and vice versa) Converters.", "Default: false"}) + @Config.Comment({ "Enable GTEU to FE (and vice versa) Converters.", "Default: false" }) public boolean enableFEConverters = false; - @Config.Comment({"Forge Energy to GTEU ratio for converting FE to EU.", "Only affects converters.", "Default: 4 FE == 1 EU"}) + @Config.Comment({ "Forge Energy to GTEU ratio for converting FE to EU.", "Only affects converters.", + "Default: 4 FE == 1 EU" }) @Config.RangeInt(min = 1, max = 16) public int feToEuRatio = 4; - @Config.Comment({"GTEU to Forge Energy ratio for converting EU to FE.", "Affects native conversion and Converters.", "Default: 4 FE == 1 EU"}) + @Config.Comment({ "GTEU to Forge Energy ratio for converting EU to FE.", + "Affects native conversion and Converters.", "Default: 4 FE == 1 EU" }) @Config.RangeInt(min = 1, max = 16) public int euToFeRatio = 4; } public static class AE2CompatOptions { - @Config.Comment({"The interval between ME Hatch/Bus interact ME network.", "It may cause lag if the interval is too small.", "Default: 2 sec"}) + + @Config.Comment({ "The interval between ME Hatch/Bus interact ME network.", + "It may cause lag if the interval is too small.", "Default: 2 sec" }) @Config.RangeInt(min = 1, max = 80) public int updateIntervals = 40; - @Config.Comment({"The energy consumption of ME Hatch/Bus.", "Default: 1.0AE/t"}) + @Config.Comment({ "The energy consumption of ME Hatch/Bus.", "Default: 1.0AE/t" }) @Config.RangeDouble(min = 0.0, max = 10.0) public double meHatchEnergyUsage = 1.0; } @@ -309,26 +346,27 @@ public static class AE2CompatOptions { public static class MiscOptions { - @Config.Comment({"Whether to enable more verbose logging.", "Default: false"}) + @Config.Comment({ "Whether to enable more verbose logging.", "Default: false" }) public boolean debug = false; - @Config.Comment({"Whether to enable Special Event features (e.g. Christmas, etc).", "Default: true"}) + @Config.Comment({ "Whether to enable Special Event features (e.g. Christmas, etc).", "Default: true" }) public boolean specialEvents = true; - @Config.Comment({"Setting this to true makes GTCEu ignore error and invalid recipes that would otherwise cause crash.", "Default: true"}) + @Config.Comment({ + "Setting this to true makes GTCEu ignore error and invalid recipes that would otherwise cause crash.", + "Default: true" }) public boolean ignoreErrorOrInvalidRecipes = true; - @Config.Comment({"Whether to enable a login message to players when they join the world.", "Default: true"}) + @Config.Comment({ "Whether to enable a login message to players when they join the world.", "Default: true" }) public boolean loginMessage = true; @Config.RangeInt(min = 0, max = 100) - @Config.Comment({"Chance with which flint and steel will create fire.", "Default: 50"}) + @Config.Comment({ "Chance with which flint and steel will create fire.", "Default: 50" }) @Config.SlidingOption public int flintChanceToCreateFire = 50; - @Config.Comment({"Whether to give the terminal to new players on login", "Default: true"}) + @Config.Comment({ "Whether to give the terminal to new players on login", "Default: true" }) public boolean spawnTerminal = true; - } public static class ClientOptions { @@ -344,94 +382,106 @@ public static class ClientOptions { @Config.Name("Shader Options") public ShaderOptions shader = new ShaderOptions(); - @Config.Comment({"Terminal root path.", "Default: {.../config}/gregtech/terminal"}) + @Config.Comment({ "Terminal root path.", "Default: {.../config}/gregtech/terminal" }) @Config.RequiresMcRestart public String terminalRootPath = "gregtech/terminal"; - @Config.Comment({"Whether to hook depth texture. Has no effect on performance, but if there is a problem with rendering, try disabling it.", "Default: true"}) + @Config.Comment({ + "Whether to hook depth texture. Has no effect on performance, but if there is a problem with rendering, try disabling it.", + "Default: true" }) public boolean hookDepthTexture = true; - @Config.Comment({"Resolution level for fragment shaders.", - "Higher values increase quality (limited by the resolution of your screen) but are more GPU intensive.", "Default: 2"}) + @Config.Comment({ "Resolution level for fragment shaders.", + "Higher values increase quality (limited by the resolution of your screen) but are more GPU intensive.", + "Default: 2" }) @Config.RangeDouble(min = 0, max = 5) @Config.SlidingOption public double resolution = 2; - @Config.Comment({"Whether or not to enable Emissive Textures for GregTech Machines and multiblock parts.", "Default: true"}) + @Config.Comment({ "Whether or not to enable Emissive Textures for GregTech Machines and multiblock parts.", + "Default: true" }) public boolean machinesEmissiveTextures = true; - @Config.Comment({"Whether or not to enable Emissive Textures for Electric Blast Furnace Coils when the multiblock is working.", "Default: false"}) + @Config.Comment({ + "Whether or not to enable Emissive Textures for Electric Blast Furnace Coils when the multiblock is working.", + "Default: false" }) public boolean coilsActiveEmissiveTextures = true; - @Config.Comment({"Whether or not sounds should be played when using tools outside of crafting.", "Default: true"}) + @Config.Comment({ "Whether or not sounds should be played when using tools outside of crafting.", + "Default: true" }) public boolean toolUseSounds = true; - @Config.Comment({"Whether or not sounds should be played when crafting with tools.", "Default: true"}) + @Config.Comment({ "Whether or not sounds should be played when crafting with tools.", "Default: true" }) public boolean toolCraftingSounds = true; - @Config.Comment({"Overrides the MC total playable sounds limit. MC's default is 28, which causes problems with many machine sounds at once", + @Config.Comment({ + "Overrides the MC total playable sounds limit. MC's default is 28, which causes problems with many machine sounds at once", "If sounds are causing large amounts of lag, try lowering this.", - "If sounds are not working at all, try setting this to the lowest value (28).", "Default: 512"}) + "If sounds are not working at all, try setting this to the lowest value (28).", "Default: 512" }) @Config.RangeInt(min = 28, max = 2048) @Config.RequiresMcRestart public int maxNumSounds = 512; - @Config.Comment({"The default color to overlay onto machines.", "16777215 (0xFFFFFF in decimal) is no coloring (like GTCE).", - "13819135 (0xD2DCFF in decimal) is the classic blue from GT5 (default)."}) + @Config.Comment({ "The default color to overlay onto machines.", + "16777215 (0xFFFFFF in decimal) is no coloring (like GTCE).", + "13819135 (0xD2DCFF in decimal) is the classic blue from GT5 (default)." }) @Config.RangeInt(min = 0, max = 0xFFFFFF) public int defaultPaintingColor = 0xD2DCFF; - @Config.Comment({"The default color to overlay onto Machine (and other) UIs.", "16777215 (0xFFFFFF) is no coloring (like GTCE).", - "13819135 (0xD2DCFF in decimal) is the classic blue from GT5 (default)."}) + @Config.Comment({ "The default color to overlay onto Machine (and other) UIs.", + "16777215 (0xFFFFFF) is no coloring (like GTCE).", + "13819135 (0xD2DCFF in decimal) is the classic blue from GT5 (default)." }) @Config.RangeInt(min = 0, max = 0xFFFFFF) public int defaultUIColor = 0xD2DCFF; // requires mc restart, color is set upon jei plugin registration - @Config.Comment({"The color to use as a background for the Multiblock Preview JEI Page.", - "Default: 13027014 (0xC6C6C6), which is JEI's background color."}) + @Config.Comment({ "The color to use as a background for the Multiblock Preview JEI Page.", + "Default: 13027014 (0xC6C6C6), which is JEI's background color." }) @Config.RangeInt(min = 0, max = 0xFFFFFF) @Config.RequiresMcRestart public int multiblockPreviewColor = 0xC6C6C6; - @Config.Comment({"Whether to use the Spray Can color in UIs when a machine is painted.", "Default: true"}) + @Config.Comment({ "Whether to use the Spray Can color in UIs when a machine is painted.", "Default: true" }) public boolean useSprayCanColorInUI = true; // does not require mc restart, drawn dynamically - @Config.Comment({"The color to use for the text in the Multiblock Preview JEI Page.", - "Default: 3355443 (0x333333), which is minecraft's dark gray color."}) + @Config.Comment({ "The color to use for the text in the Multiblock Preview JEI Page.", + "Default: 3355443 (0x333333), which is minecraft's dark gray color." }) @Config.RangeInt(min = 0, max = 0xFFFFFF) public int multiblockPreviewFontColor = 0x333333; @Config.Comment("Prevent tooltips from blinking for better visibility") public boolean preventBlinkingTooltips = false; - @Config.Comment({"Prevent optical and laser cables from animating when active.", "Default: false"}) + @Config.Comment({ "Prevent optical and laser cables from animating when active.", "Default: false" }) public boolean preventAnimatedCables = false; public static class GuiConfig { - @Config.Comment({"The scrolling speed of widgets", "Default: 13"}) + + @Config.Comment({ "The scrolling speed of widgets", "Default: 13" }) @Config.RangeInt(min = 1) public int scrollSpeed = 13; - @Config.Comment({"If progress bars should move smoothly.", + @Config.Comment({ "If progress bars should move smoothly.", "False is incremental like the Minecraft furnace.", - "Default: true"}) + "Default: true" }) public boolean smoothProgressBars = true; } public static class ArmorHud { - @Config.Comment({"Sets HUD location", "1 - left-upper corner", "2 - right-upper corner", "3 - left-bottom corner", "4 - right-bottom corner", "Default: 1"}) + @Config.Comment({ "Sets HUD location", "1 - left-upper corner", "2 - right-upper corner", + "3 - left-bottom corner", "4 - right-bottom corner", "Default: 1" }) @Config.RangeInt(min = 1, max = 4) @Config.SlidingOption public int hudLocation = 1; - @Config.Comment({"Horizontal offset of HUD.", "Default: 0"}) + @Config.Comment({ "Horizontal offset of HUD.", "Default: 0" }) @Config.RangeInt(min = 0, max = 100) @Config.SlidingOption public int hudOffsetX = 0; - @Config.Comment({"Vertical offset of HUD.", "Default: 0"}) + @Config.Comment({ "Vertical offset of HUD.", "Default: 0" }) @Config.RangeInt(min = 0, max = 100) @Config.SlidingOption public int hudOffsetY = 0; @@ -450,98 +500,137 @@ public static class ShaderOptions { @Config.Name("Heat Effect") public HeatEffectBloom heatEffectBloom = new HeatEffectBloom(); - @Config.Comment({"Whether to use shader programs.", "Default: true"}) + @Config.Comment({ "Whether to use shader programs.", "Default: true" }) public boolean useShader = true; - @Config.Comment({"Whether or not to enable Emissive Textures with bloom effect.", "Default: true"}) + @Config.Comment({ "Whether or not to enable Emissive Textures with bloom effect.", "Default: true" }) public boolean emissiveTexturesBloom = true; - @Config.Comment({"Bloom Algorithm", "0 - Simple Gaussian Blur Bloom (Fast)", "1 - Unity Bloom", "2 - Unreal Bloom", "Default: 2"}) + @Config.Comment({ "Bloom Algorithm", "0 - Simple Gaussian Blur Bloom (Fast)", "1 - Unity Bloom", + "2 - Unreal Bloom", "Default: 2" }) @Config.RangeInt(min = 0, max = 2) @Config.SlidingOption public int bloomStyle = 2; - @Config.Comment({"The brightness after bloom should not exceed this value. It can be used to limit the brightness of highlights " + - "(e.g., daytime).", "OUTPUT = BACKGROUND + BLOOM * strength * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*({HT}-LT)))", "This value should be greater than lowBrightnessThreshold.", "Default: 0.5"}) + @Config.Comment({ + "The brightness after bloom should not exceed this value. It can be used to limit the brightness of highlights " + + "(e.g., daytime).", + "OUTPUT = BACKGROUND + BLOOM * strength * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*({HT}-LT)))", + "This value should be greater than lowBrightnessThreshold.", "Default: 0.5" }) @Config.RangeDouble(min = 0) public double highBrightnessThreshold = 0.5; - @Config.Comment({"The brightness after bloom should not smaller than this value. It can be used to limit the brightness of dusky parts " + - "(e.g., night/caves).", "OUTPUT = BACKGROUND + BLOOM * strength * (base + {LT} + (1 - BACKGROUND_BRIGHTNESS)*(HT-{LT})))", "This value should be smaller than highBrightnessThreshold.", "Default: 0.2"}) + @Config.Comment({ + "The brightness after bloom should not smaller than this value. It can be used to limit the brightness of dusky parts " + + "(e.g., night/caves).", + "OUTPUT = BACKGROUND + BLOOM * strength * (base + {LT} + (1 - BACKGROUND_BRIGHTNESS)*(HT-{LT})))", + "This value should be smaller than highBrightnessThreshold.", "Default: 0.2" }) @Config.RangeDouble(min = 0) public double lowBrightnessThreshold = 0.2; - @Config.Comment({"The base brightness of the bloom.", "It is similar to strength", "This value should be smaller than highBrightnessThreshold.", "OUTPUT = BACKGROUND + BLOOM * strength * ({base} + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", "Default: 0.1"}) + @Config.Comment({ "The base brightness of the bloom.", "It is similar to strength", + "This value should be smaller than highBrightnessThreshold.", + "OUTPUT = BACKGROUND + BLOOM * strength * ({base} + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", + "Default: 0.1" }) @Config.RangeDouble(min = 0) public double baseBrightness = 0.1; - @Config.Comment({"Mipmap Size.", "Higher values increase quality, but are slower to render.", "Default: 5"}) + @Config.Comment({ "Mipmap Size.", "Higher values increase quality, but are slower to render.", + "Default: 5" }) @Config.RangeInt(min = 2, max = 5) @Config.SlidingOption public int nMips = 5; - @Config.Comment({"Bloom Strength", "OUTPUT = BACKGROUND + BLOOM * {strength} * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", "Default: 2"}) + @Config.Comment({ "Bloom Strength", + "OUTPUT = BACKGROUND + BLOOM * {strength} * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", + "Default: 2" }) @Config.RangeDouble(min = 0) public double strength = 1.5; - @Config.Comment({"Blur Step (bloom range)", "Default: 1"}) + @Config.Comment({ "Blur Step (bloom range)", "Default: 1" }) @Config.RangeDouble(min = 0) public double step = 1; } } public static class FusionBloom { - @Config.Comment({"Whether to use shader programs.", "Default: true"}) + + @Config.Comment({ "Whether to use shader programs.", "Default: true" }) public boolean useShader = true; - @Config.Comment({"Bloom Strength", "OUTPUT = BACKGROUND + BLOOM * {strength} * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", "Default: 2"}) + @Config.Comment({ "Bloom Strength", + "OUTPUT = BACKGROUND + BLOOM * {strength} * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", + "Default: 2" }) @Config.RangeDouble(min = 0) public double strength = 1.5; - @Config.Comment({"Bloom Algorithm", "0 - Simple Gaussian Blur Bloom (Fast)", "1 - Unity Bloom", "2 - Unreal Bloom", "Default: 2"}) + @Config.Comment({ "Bloom Algorithm", "0 - Simple Gaussian Blur Bloom (Fast)", "1 - Unity Bloom", + "2 - Unreal Bloom", "Default: 2" }) @Config.RangeInt(min = 0, max = 2) @Config.SlidingOption public int bloomStyle = 1; - @Config.Comment({"The brightness after bloom should not exceed this value. It can be used to limit the brightness of highlights " + - "(e.g., daytime).", "OUTPUT = BACKGROUND + BLOOM * strength * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*({HT}-LT)))", "This value should be greater than lowBrightnessThreshold.", "Default: 0.5"}) + @Config.Comment({ + "The brightness after bloom should not exceed this value. It can be used to limit the brightness of highlights " + + "(e.g., daytime).", + "OUTPUT = BACKGROUND + BLOOM * strength * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*({HT}-LT)))", + "This value should be greater than lowBrightnessThreshold.", "Default: 0.5" }) @Config.RangeDouble(min = 0) public double highBrightnessThreshold = 1.3; - @Config.Comment({"The brightness after bloom should not smaller than this value. It can be used to limit the brightness of dusky parts " + - "(e.g., night/caves).", "OUTPUT = BACKGROUND + BLOOM * strength * (base + {LT} + (1 - BACKGROUND_BRIGHTNESS)*(HT-{LT})))", "This value should be smaller than highBrightnessThreshold.", "Default: 0.2"}) + @Config.Comment({ + "The brightness after bloom should not smaller than this value. It can be used to limit the brightness of dusky parts " + + "(e.g., night/caves).", + "OUTPUT = BACKGROUND + BLOOM * strength * (base + {LT} + (1 - BACKGROUND_BRIGHTNESS)*(HT-{LT})))", + "This value should be smaller than highBrightnessThreshold.", "Default: 0.2" }) @Config.RangeDouble(min = 0) public double lowBrightnessThreshold = 0.3; - @Config.Comment({"The base brightness of the bloom.", "It is similar to strength", "This value should be smaller than highBrightnessThreshold.", "OUTPUT = BACKGROUND + BLOOM * strength * ({base} + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", "Default: 0.1"}) + @Config.Comment({ "The base brightness of the bloom.", "It is similar to strength", + "This value should be smaller than highBrightnessThreshold.", + "OUTPUT = BACKGROUND + BLOOM * strength * ({base} + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", + "Default: 0.1" }) @Config.RangeDouble(min = 0) public double baseBrightness = 0; } public static class HeatEffectBloom { - @Config.Comment({"Whether to use shader programs.", "Default: true"}) + + @Config.Comment({ "Whether to use shader programs.", "Default: true" }) public boolean useShader = true; - @Config.Comment({"Bloom Strength", "OUTPUT = BACKGROUND + BLOOM * {strength} * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", "Default: 2"}) + @Config.Comment({ "Bloom Strength", + "OUTPUT = BACKGROUND + BLOOM * {strength} * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", + "Default: 2" }) @Config.RangeDouble(min = 0) public double strength = 1.1; - @Config.Comment({"Bloom Algorithm", "0 - Simple Gaussian Blur Bloom (Fast)", "1 - Unity Bloom", "2 - Unreal Bloom", "Default: 2"}) + @Config.Comment({ "Bloom Algorithm", "0 - Simple Gaussian Blur Bloom (Fast)", "1 - Unity Bloom", + "2 - Unreal Bloom", "Default: 2" }) @Config.RangeInt(min = 0, max = 2) @Config.SlidingOption public int bloomStyle = 2; - @Config.Comment({"The brightness after bloom should not exceed this value. It can be used to limit the brightness of highlights " + - "(e.g., daytime).", "OUTPUT = BACKGROUND + BLOOM * strength * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*({HT}-LT)))", "This value should be greater than lowBrightnessThreshold.", "Default: 0.5"}) + @Config.Comment({ + "The brightness after bloom should not exceed this value. It can be used to limit the brightness of highlights " + + "(e.g., daytime).", + "OUTPUT = BACKGROUND + BLOOM * strength * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*({HT}-LT)))", + "This value should be greater than lowBrightnessThreshold.", "Default: 0.5" }) @Config.RangeDouble(min = 0) public double highBrightnessThreshold = 1.4; - @Config.Comment({"The brightness after bloom should not smaller than this value. It can be used to limit the brightness of dusky parts " + - "(e.g., night/caves).", "OUTPUT = BACKGROUND + BLOOM * strength * (base + {LT} + (1 - BACKGROUND_BRIGHTNESS)*(HT-{LT})))", "This value should be smaller than highBrightnessThreshold.", "Default: 0.2"}) + @Config.Comment({ + "The brightness after bloom should not smaller than this value. It can be used to limit the brightness of dusky parts " + + "(e.g., night/caves).", + "OUTPUT = BACKGROUND + BLOOM * strength * (base + {LT} + (1 - BACKGROUND_BRIGHTNESS)*(HT-{LT})))", + "This value should be smaller than highBrightnessThreshold.", "Default: 0.2" }) @Config.RangeDouble(min = 0) public double lowBrightnessThreshold = 0.6; - @Config.Comment({"The base brightness of the bloom.", "It is similar to strength", "This value should be smaller than highBrightnessThreshold.", "OUTPUT = BACKGROUND + BLOOM * strength * ({base} + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", "Default: 0.1"}) + @Config.Comment({ "The base brightness of the bloom.", "It is similar to strength", + "This value should be smaller than highBrightnessThreshold.", + "OUTPUT = BACKGROUND + BLOOM * strength * ({base} + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", + "Default: 0.1" }) @Config.RangeDouble(min = 0) public double baseBrightness = 0; } @@ -559,28 +648,28 @@ public static class ToolOptions { @Config.RangeInt(min = 0, max = 14) public int voltageTierNanoSuit = 3; - @Config.Comment({"Advanced NanoSuit Chestplate Voltage Tier.", "Default: 3 (HV)"}) + @Config.Comment({ "Advanced NanoSuit Chestplate Voltage Tier.", "Default: 3 (HV)" }) @Config.RangeInt(min = 0, max = 14) public int voltageTierAdvNanoSuit = 3; - @Config.Comment({"QuarkTech Suit Voltage Tier.", "Default: 5 (IV)"}) + @Config.Comment({ "QuarkTech Suit Voltage Tier.", "Default: 5 (IV)" }) @Config.RangeInt(min = 0, max = 14) @Config.SlidingOption public int voltageTierQuarkTech = 5; - @Config.Comment({"Advanced QuarkTech Suit Chestplate Voltage Tier.", "Default: 5 (LuV)"}) + @Config.Comment({ "Advanced QuarkTech Suit Chestplate Voltage Tier.", "Default: 5 (LuV)" }) @Config.RangeInt(min = 0, max = 14) public int voltageTierAdvQuarkTech = 6; - @Config.Comment({"Electric Impeller Jetpack Voltage Tier.", "Default: 2 (MV)"}) + @Config.Comment({ "Electric Impeller Jetpack Voltage Tier.", "Default: 2 (MV)" }) @Config.RangeInt(min = 0, max = 14) public int voltageTierImpeller = 2; - @Config.Comment({"Advanced Electric Jetpack Voltage Tier.", "Default: 3 (HV)"}) + @Config.Comment({ "Advanced Electric Jetpack Voltage Tier.", "Default: 3 (HV)" }) @Config.RangeInt(min = 0, max = 14) public int voltageTierAdvImpeller = 3; - @Config.Comment({"Random chance for electric tools to take actual damage", "Default: 10%"}) + @Config.Comment({ "Random chance for electric tools to take actual damage", "Default: 10%" }) @Config.RangeInt(min = 0, max = 100) @Config.SlidingOption public int rngDamageElectricTools = 10; @@ -590,7 +679,9 @@ public static class ToolOptions { } public static class ArmorHud { - @Config.Comment({"Sets HUD location", "1 - left-upper corner", "2 - right-upper corner", "3 - left-bottom corner", "4 - right-bottom corner"}) + + @Config.Comment({ "Sets HUD location", "1 - left-upper corner", "2 - right-upper corner", + "3 - left-bottom corner", "4 - right-bottom corner" }) public byte hudLocation = 1; @Config.Comment("Horizontal offset of HUD [0 ~ 100)") public byte hudOffsetX = 0; @@ -601,18 +692,18 @@ public static class ArmorHud { public static class NanoSaber { @Config.RangeDouble(min = 0, max = 100) - @Config.Comment({"The additional damage added when the NanoSaber is powered.", "Default: 20.0"}) + @Config.Comment({ "The additional damage added when the NanoSaber is powered.", "Default: 20.0" }) public double nanoSaberDamageBoost = 20; @Config.RangeDouble(min = 0, max = 100) - @Config.Comment({"The base damage of the NanoSaber.", "Default: 5.0"}) + @Config.Comment({ "The base damage of the NanoSaber.", "Default: 5.0" }) public double nanoSaberBaseDamage = 5; - @Config.Comment({"Should Zombies spawn with charged, active NanoSabers on hard difficulty?", "Default: true"}) + @Config.Comment({ "Should Zombies spawn with charged, active NanoSabers on hard difficulty?", "Default: true" }) public boolean zombieSpawnWithSabers = true; @Config.RangeInt(min = 1, max = 512) - @Config.Comment({"The EU/t consumption of the NanoSaber.", "Default: 64"}) + @Config.Comment({ "The EU/t consumption of the NanoSaber.", "Default: 64" }) public int energyConsumption = 64; } } diff --git a/src/main/java/gregtech/common/EventHandlers.java b/src/main/java/gregtech/common/EventHandlers.java index dbe8d76fd7d..a25b6b99716 100644 --- a/src/main/java/gregtech/common/EventHandlers.java +++ b/src/main/java/gregtech/common/EventHandlers.java @@ -17,6 +17,7 @@ import gregtech.common.items.armor.PowerlessJetpack; import gregtech.common.items.behaviors.ToggleEnergyConsumerBehavior; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor; + import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityEnderman; @@ -85,15 +86,14 @@ public static void onPlayerInteractionRightClickBlock(PlayerInteractEvent.RightC TileEntity tileEntity = event.getWorld().getTileEntity(event.getPos()); if (tileEntity instanceof IGregTechTileEntity) { event.setUseBlock(Event.Result.ALLOW); - } else if (tileEntity instanceof IPipeTile) { + } else if (tileEntity instanceof IPipeTile) { event.setUseBlock(Event.Result.ALLOW); } ItemStack stack = event.getItemStack(); if (!stack.isEmpty() && stack.getItem() == Items.FLINT_AND_STEEL) { - if (!event.getWorld().isRemote - && !event.getEntityPlayer().capabilities.isCreativeMode - && GTValues.RNG.nextInt(100) >= ConfigHolder.misc.flintChanceToCreateFire) { + if (!event.getWorld().isRemote && !event.getEntityPlayer().capabilities.isCreativeMode && + GTValues.RNG.nextInt(100) >= ConfigHolder.misc.flintChanceToCreateFire) { stack.damageItem(1, event.getEntityPlayer()); if (stack.getItemDamage() >= stack.getMaxDamage()) { stack.shrink(1); @@ -107,8 +107,10 @@ public static void onPlayerInteractionRightClickBlock(PlayerInteractEvent.RightC public static void onPlayerInteractionLeftClickBlock(PlayerInteractEvent.LeftClickBlock event) { if (event.getEntityPlayer().isCreative()) { TileEntity holder = event.getWorld().getTileEntity(event.getPos()); - if (holder instanceof IGregTechTileEntity && ((IGregTechTileEntity) holder).getMetaTileEntity() instanceof MetaTileEntityCentralMonitor) { - ((MetaTileEntityCentralMonitor) ((IGregTechTileEntity) holder).getMetaTileEntity()).invalidateStructure(); + if (holder instanceof IGregTechTileEntity && + ((IGregTechTileEntity) holder).getMetaTileEntity() instanceof MetaTileEntityCentralMonitor) { + ((MetaTileEntityCentralMonitor) ((IGregTechTileEntity) holder).getMetaTileEntity()) + .invalidateStructure(); } } } @@ -127,7 +129,8 @@ public static void onHarvestCheck(net.minecraftforge.event.entity.player.PlayerE } tool = ToolClasses.PICKAXE; int harvestLevel = event.getTargetBlock().getBlock().getHarvestLevel(event.getTargetBlock()); - if (!item.isEmpty() && harvestLevel > item.getItem().getHarvestLevel(item, tool, event.getEntityPlayer(), event.getTargetBlock())) { + if (!item.isEmpty() && harvestLevel > + item.getItem().getHarvestLevel(item, tool, event.getEntityPlayer(), event.getTargetBlock())) { event.setCanHarvest(false); } } @@ -137,13 +140,12 @@ public static void onHarvestCheck(net.minecraftforge.event.entity.player.PlayerE public static void onDestroySpeed(net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed event) { ItemStack item = event.getEntityPlayer().getHeldItemMainhand(); String tool = event.getState().getBlock().getHarvestTool(event.getState()); - if (tool != null && !item.isEmpty() && ToolHelper.canMineWithPick(tool) && item.getItem().getToolClasses(item).contains(ToolClasses.PICKAXE)) { + if (tool != null && !item.isEmpty() && ToolHelper.canMineWithPick(tool) && + item.getItem().getToolClasses(item).contains(ToolClasses.PICKAXE)) { event.setNewSpeed(event.getNewSpeed() * 0.75f); } } - - @SubscribeEvent(priority = EventPriority.LOW) public static void onEntityLivingFallEvent(LivingFallEvent event) { if (event.getEntity() instanceof EntityPlayerMP) { @@ -157,18 +159,21 @@ public static void onEntityLivingFallEvent(LivingFallEvent event) { if (!armor.isEmpty() && armor.getItem() instanceof ArmorMetaItem) { ArmorMetaItem.ArmorMetaValueItem valueItem = ((ArmorMetaItem) armor.getItem()).getItem(armor); if (valueItem != null) { - valueItem.getArmorLogic().damageArmor(player, armor, DamageSource.FALL, (int) (player.fallDistance - 1.2f), EntityEquipmentSlot.FEET); + valueItem.getArmorLogic().damageArmor(player, armor, DamageSource.FALL, + (int) (player.fallDistance - 1.2f), EntityEquipmentSlot.FEET); player.fallDistance = 0; event.setCanceled(true); } - } else if (!jet.isEmpty() && jet.getItem() instanceof ArmorMetaItem && GTUtility.getOrCreateNbtCompound(jet).hasKey("flyMode")) { - ArmorMetaItem.ArmorMetaValueItem valueItem = ((ArmorMetaItem) jet.getItem()).getItem(jet); - if (valueItem != null) { - valueItem.getArmorLogic().damageArmor(player, jet, DamageSource.FALL, (int) (player.fallDistance - 1.2f), EntityEquipmentSlot.FEET); - player.fallDistance = 0; - event.setCanceled(true); - } - } + } else if (!jet.isEmpty() && jet.getItem() instanceof ArmorMetaItem && + GTUtility.getOrCreateNbtCompound(jet).hasKey("flyMode")) { + ArmorMetaItem.ArmorMetaValueItem valueItem = ((ArmorMetaItem) jet.getItem()).getItem(jet); + if (valueItem != null) { + valueItem.getArmorLogic().damageArmor(player, jet, DamageSource.FALL, + (int) (player.fallDistance - 1.2f), EntityEquipmentSlot.FEET); + player.fallDistance = 0; + event.setCanceled(true); + } + } } } @@ -204,11 +209,13 @@ public static void onLivingEquipmentChangeEvent(LivingEquipmentChangeEvent event @SubscribeEvent @SideOnly(Side.CLIENT) public static void onPlayerTick(TickEvent.PlayerTickEvent event) { - if (event.phase == TickEvent.Phase.START && !event.player.isSpectator() && !(event.player instanceof EntityOtherPlayerMP) && !(event.player instanceof FakePlayer)) { + if (event.phase == TickEvent.Phase.START && !event.player.isSpectator() && + !(event.player instanceof EntityOtherPlayerMP) && !(event.player instanceof FakePlayer)) { ItemStack feetEquip = event.player.getItemStackFromSlot(EntityEquipmentSlot.FEET); if (!lastFeetEquip.getItem().equals(feetEquip.getItem())) { if (lastFeetEquip.getItem() instanceof ArmorMetaItem) { - ArmorMetaItem.ArmorMetaValueItem valueItem = ((ArmorMetaItem) lastFeetEquip.getItem()).getItem(lastFeetEquip); + ArmorMetaItem.ArmorMetaValueItem valueItem = ((ArmorMetaItem) lastFeetEquip.getItem()) + .getItem(lastFeetEquip); if (valueItem != null && valueItem.getArmorLogic() instanceof IStepAssist) { event.player.stepHeight = 0.6f; } @@ -250,7 +257,8 @@ public static void onWorldSaveEvent(WorldEvent.Save event) { public static void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) { if (ConfigHolder.misc.spawnTerminal) { NBTTagCompound playerData = event.player.getEntityData(); - NBTTagCompound data = playerData.hasKey(EntityPlayer.PERSISTED_NBT_TAG) ? playerData.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG) : new NBTTagCompound(); + NBTTagCompound data = playerData.hasKey(EntityPlayer.PERSISTED_NBT_TAG) ? + playerData.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG) : new NBTTagCompound(); if (!data.getBoolean(HAS_TERMINAL)) { ItemStack terminal = MetaItems.TERMINAL.getStackForm(); @@ -268,7 +276,8 @@ public static void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) { @SubscribeEvent public static void onFurnaceFuelBurnTime(FurnaceFuelBurnTimeEvent event) { - if (ItemStack.areItemStacksEqual(event.getItemStack(), FluidUtil.getFilledBucket(Materials.Creosote.getFluid(1000)))) { + if (ItemStack.areItemStacksEqual(event.getItemStack(), + FluidUtil.getFilledBucket(Materials.Creosote.getFluid(1000)))) { event.setBurnTime(6400); } } diff --git a/src/main/java/gregtech/common/MetaEntities.java b/src/main/java/gregtech/common/MetaEntities.java index 7e09df91d5b..00efb35f87d 100644 --- a/src/main/java/gregtech/common/MetaEntities.java +++ b/src/main/java/gregtech/common/MetaEntities.java @@ -8,6 +8,7 @@ import gregtech.common.entities.DynamiteEntity; import gregtech.common.entities.GTBoatEntity; import gregtech.common.entities.PortalEntity; + import net.minecraft.client.Minecraft; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; @@ -17,14 +18,18 @@ public class MetaEntities { public static void init() { - EntityRegistry.registerModEntity(GTUtility.gregtechId("dynamite"), DynamiteEntity.class, "Dynamite", 1, GregTechAPI.instance, 64, 3, true); - EntityRegistry.registerModEntity(GTUtility.gregtechId("gtportal"), PortalEntity.class, "GTPortal", 2, GregTechAPI.instance, 64, 5, true); - EntityRegistry.registerModEntity(GTUtility.gregtechId("gtboat"), GTBoatEntity.class, "GTBoat", 3, GregTechAPI.instance, 64, 2, true); + EntityRegistry.registerModEntity(GTUtility.gregtechId("dynamite"), DynamiteEntity.class, "Dynamite", 1, + GregTechAPI.instance, 64, 3, true); + EntityRegistry.registerModEntity(GTUtility.gregtechId("gtportal"), PortalEntity.class, "GTPortal", 2, + GregTechAPI.instance, 64, 5, true); + EntityRegistry.registerModEntity(GTUtility.gregtechId("gtboat"), GTBoatEntity.class, "GTBoat", 3, + GregTechAPI.instance, 64, 2, true); } @SideOnly(Side.CLIENT) public static void initRenderers() { - RenderingRegistry.registerEntityRenderingHandler(DynamiteEntity.class, manager -> new DynamiteRenderer(manager, Minecraft.getMinecraft().getRenderItem())); + RenderingRegistry.registerEntityRenderingHandler(DynamiteEntity.class, + manager -> new DynamiteRenderer(manager, Minecraft.getMinecraft().getRenderItem())); RenderingRegistry.registerEntityRenderingHandler(PortalEntity.class, PortalRenderer::new); RenderingRegistry.registerEntityRenderingHandler(GTBoatEntity.class, GTBoatRenderer::new); } diff --git a/src/main/java/gregtech/common/ToolEventHandlers.java b/src/main/java/gregtech/common/ToolEventHandlers.java index 77ba6c49b70..95731245465 100644 --- a/src/main/java/gregtech/common/ToolEventHandlers.java +++ b/src/main/java/gregtech/common/ToolEventHandlers.java @@ -1,6 +1,5 @@ package gregtech.common; -import codechicken.lib.vec.*; import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.GregtechTileCapabilities; @@ -22,6 +21,7 @@ import gregtech.api.util.TaskScheduler; import gregtech.common.items.tool.rotation.CustomBlockRotations; import gregtech.common.items.tool.rotation.ICustomRotationBehavior; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -55,15 +55,18 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.vec.*; import org.lwjgl.opengl.GL11; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Iterator; import java.util.Set; import java.util.function.BooleanSupplier; import java.util.function.Predicate; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @Mod.EventBusSubscriber(modid = GTValues.MODID) public class ToolEventHandlers { @@ -80,7 +83,8 @@ public static void onPlayerDestroyItem(@Nonnull PlayerDestroyItemEvent event) { // Transfer over remaining charge to power units if (brokenStack.hasCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null) && def.isElectric()) { long remainingCharge = def.getCharge(event.getOriginal()); - IElectricItem electricStack = brokenStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem electricStack = brokenStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (electricStack != null) { // update the max charge of the item, if possible // applies to items like power units, which can have different max charges depending on their recipe @@ -104,14 +108,13 @@ public static void onPlayerDestroyItem(@Nonnull PlayerDestroyItemEvent event) { } } - @SubscribeEvent public static void onPlayerEntityInteract(@Nonnull PlayerInteractEvent.EntityInteract event) { ItemStack itemStack = event.getItemStack(); Item item = itemStack.getItem(); /* - Handle item frame power unit duping + * Handle item frame power unit duping */ if (item instanceof IGTTool) { Entity entity = event.getTarget(); @@ -143,11 +146,13 @@ public static void onHarvestDrops(@Nonnull BlockEvent.HarvestDropsEvent event) { return; } if (!event.isSilkTouching()) { - ToolHelper.applyHammerDropConversion(stack, event.getState(), event.getDrops(), event.getFortuneLevel(), event.getDropChance(), player.getRNG()); + ToolHelper.applyHammerDropConversion(stack, event.getState(), event.getDrops(), event.getFortuneLevel(), + event.getDropChance(), player.getRNG()); } NBTTagCompound behaviorTag = ToolHelper.getBehaviorsTag(stack); Block block = event.getState().getBlock(); - if (!event.isSilkTouching() && (block == Blocks.ICE || block == Blocks.PACKED_ICE) && behaviorTag.getBoolean(ToolHelper.HARVEST_ICE_KEY)) { + if (!event.isSilkTouching() && (block == Blocks.ICE || block == Blocks.PACKED_ICE) && + behaviorTag.getBoolean(ToolHelper.HARVEST_ICE_KEY)) { Item iceBlock = Item.getItemFromBlock(block); if (event.getDrops().stream().noneMatch(drop -> drop.getItem() == iceBlock)) { event.getDrops().add(new ItemStack(iceBlock)); @@ -172,7 +177,8 @@ public static void onHarvestDrops(@Nonnull BlockEvent.HarvestDropsEvent event) { EntityItem drop = new EntityItem(event.getWorld()); drop.setItem(dropStack); - if (ForgeEventFactory.onItemPickup(drop, player) == -1 || player.addItemStackToInventory(dropStack)) { + if (ForgeEventFactory.onItemPickup(drop, player) == -1 || + player.addItemStackToInventory(dropStack)) { dropItr.remove(); } } @@ -205,7 +211,7 @@ public static void onAnvilUpdateEvent(AnvilUpdateEvent event) { @SubscribeEvent @SideOnly(Side.CLIENT) public static void onDrawHighlightEvent(@Nonnull DrawBlockHighlightEvent event) { - //noinspection ConstantConditions + // noinspection ConstantConditions if (event.getTarget().getBlockPos() == null) return; EntityPlayer player = event.getPlayer(); @@ -225,13 +231,16 @@ public static void onDrawHighlightEvent(@Nonnull DrawBlockHighlightEvent event) // AoE selection box and block damage overlay if (!sneaking && stack.getItem() instanceof IGTTool tool) { state = state.getActualState(player.world, pos); - if (!ToolHelper.isToolEffective(state, tool.getToolClasses(stack), tool.getTotalHarvestLevel(stack))) return; - Set validPositions = ToolHelper.getHarvestableBlocks(stack, player.world, player, event.getTarget()); + if (!ToolHelper.isToolEffective(state, tool.getToolClasses(stack), tool.getTotalHarvestLevel(stack))) + return; + Set validPositions = ToolHelper.getHarvestableBlocks(stack, player.world, player, + event.getTarget()); if (validPositions.isEmpty()) return; float partialTicks = event.getPartialTicks(); for (BlockPos validPosition : validPositions) { - event.getContext().drawSelectionBox(player, new RayTraceResult(Vec3d.ZERO, player.getHorizontalFacing(), validPosition), 0, partialTicks); + event.getContext().drawSelectionBox(player, + new RayTraceResult(Vec3d.ZERO, player.getHorizontalFacing(), validPosition), 0, partialTicks); } DestroyBlockProgress progress = event.getContext().damagedBlocks.get(player.getEntityId()); @@ -252,7 +261,8 @@ public static void onDrawHighlightEvent(@Nonnull DrawBlockHighlightEvent event) TileEntity tileEntity = mc.world.getTileEntity(validPosition); if (tileEntity == null || tileEntity.canRenderBreaking()) { TextureAtlasSprite sprite = event.getContext().destroyBlockIcons[damage]; - rendererDispatcher.renderBlockDamage(mc.world.getBlockState(validPosition), validPosition, sprite, mc.world); + rendererDispatcher.renderBlockDamage(mc.world.getBlockState(validPosition), validPosition, + sprite, mc.world); } } Tessellator.getInstance().draw(); @@ -267,7 +277,8 @@ public static void onDrawHighlightEvent(@Nonnull DrawBlockHighlightEvent event) * Sets up for rendering blocks with break progress */ private static void preRenderDamagedBlocks() { - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.DST_COLOR, GlStateManager.DestFactor.SRC_COLOR, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.DST_COLOR, GlStateManager.DestFactor.SRC_COLOR, + GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.enableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F); GlStateManager.doPolygonOffset(-3.0F, -3.0F); @@ -291,19 +302,22 @@ private static void postRenderDamagedBlocks() { } @SideOnly(Side.CLIENT) - private static boolean shouldRenderGridOverlays(@Nonnull IBlockState state, @Nullable TileEntity tile, ItemStack mainHand, ItemStack offHand, boolean isSneaking) { - if (state.getBlock() instanceof BlockPipe pipe) { - if (isSneaking && (mainHand.isEmpty() || mainHand.getItem().getClass() == Item.getItemFromBlock(pipe).getClass())) { + private static boolean shouldRenderGridOverlays(@Nonnull IBlockState state, @Nullable TileEntity tile, + ItemStack mainHand, ItemStack offHand, boolean isSneaking) { + if (state.getBlock() instanceof BlockPipepipe) { + if (isSneaking && + (mainHand.isEmpty() || mainHand.getItem().getClass() == Item.getItemFromBlock(pipe).getClass())) { return true; } else { Set mainToolClasses = mainHand.getItem().getToolClasses(mainHand); Set offToolClasses = offHand.getItem().getToolClasses(offHand); if (mainToolClasses.stream().anyMatch(s -> pipe.isToolEffective(s, state)) || - offToolClasses.stream().anyMatch(s -> pipe.isToolEffective(s, state))) return true; + offToolClasses.stream().anyMatch(s -> pipe.isToolEffective(s, state))) + return true; BooleanSupplier hasCover; Predicate canCover; - if (tile instanceof IPipeTile pipeTile) { + if (tile instanceof IPipeTilepipeTile) { final boolean hasAnyCover = pipeTile.getCoverableImplementation().hasAnyCover(); if (hasAnyCover) { if (mainToolClasses.contains(ToolClasses.SCREWDRIVER)) return true; @@ -352,10 +366,13 @@ private static boolean shouldRenderGridOverlays(@Nonnull IBlockState state, @Nul private static float bColour; @SideOnly(Side.CLIENT) - private static boolean renderGridOverlays(@Nonnull EntityPlayer player, BlockPos pos, IBlockState state, EnumFacing facing, TileEntity tile, float partialTicks) { + private static boolean renderGridOverlays(@Nonnull EntityPlayer player, BlockPos pos, IBlockState state, + EnumFacing facing, TileEntity tile, float partialTicks) { if (player.world.getWorldBorder().contains(pos)) { GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); GlStateManager.glLineWidth(2.0F); GlStateManager.disableTexture2D(); GlStateManager.depthMask(false); @@ -365,15 +382,18 @@ private static boolean renderGridOverlays(@Nonnull EntityPlayer player, BlockPos AxisAlignedBB box = state.getSelectedBoundingBox(player.world, pos).grow(0.002D).offset(-d3, -d4, -d5); RenderGlobal.drawSelectionBoundingBox(box, 1, 1, 1, 0.4F); - rColour = gColour = bColour = 0.2F + (float) Math.sin((float) (System.currentTimeMillis() % (Math.PI * 800)) / 800) / 2; + rColour = gColour = bColour = 0.2F + + (float) Math.sin((float) (System.currentTimeMillis() % (Math.PI * 800)) / 800) / 2; if (tile instanceof TileEntityPipeBase) { TileEntityPipeBase tepb = (TileEntityPipeBase) tile; - drawGridOverlays(facing, box, face -> tepb.isConnected(face) || tepb.getCoverableImplementation().getCoverAtSide(face) != null); + drawGridOverlays(facing, box, face -> tepb.isConnected(face) || + tepb.getCoverableImplementation().getCoverAtSide(face) != null); } else if (tile instanceof MetaTileEntityHolder) { MetaTileEntity mte = ((MetaTileEntityHolder) tile).getMetaTileEntity(); drawGridOverlays(facing, box, mte::isSideUsed); - if (mte instanceof MultiblockControllerBase multi && multi.allowsExtendedFacing() && ToolHelper.isTool(player.getHeldItemMainhand(), ToolClasses.WRENCH)) { + if (mte instanceof MultiblockControllerBase multi && multi.allowsExtendedFacing() && + ToolHelper.isTool(player.getHeldItemMainhand(), ToolClasses.WRENCH)) { // set up some render state first GL11.glPushMatrix(); GL11.glTranslated(pos.getX() - (int) d3, pos.getY() - (int) d4, pos.getZ() - (int) d5); @@ -391,8 +411,10 @@ private static boolean renderGridOverlays(@Nonnull EntityPlayer player, BlockPos } } else { // render on the side of the grid - drawRotationMarker(ROTATION_MARKER_TRANSFORMS_SIDES_TRANSFORMS[ - ROTATION_MARKER_TRANSFORMS_SIDES[facing.getIndex() * 6 + multi.getFrontFacing().getIndex()]], player.isSneaking()); + drawRotationMarker( + ROTATION_MARKER_TRANSFORMS_SIDES_TRANSFORMS[ROTATION_MARKER_TRANSFORMS_SIDES[facing + .getIndex() * 6 + multi.getFrontFacing().getIndex()]], + player.isSneaking()); } GL11.glPopMatrix(); } @@ -622,14 +644,20 @@ private static void drawGridOverlays(EnumFacing facing, AxisAlignedBB box, Predi Vector3 localXShiftVert = new Vector3(0, 0, 0); for (int j = 0; j < 2; j++) { startLine(buffer, topLeft.copy().add(localXShift).add(localXShiftVert)); - endLine(buffer, topLeft.copy().add(localXShift).add(localXShiftVert).add(shift).subtract(shiftVert)); + endLine(buffer, + topLeft.copy().add(localXShift).add(localXShiftVert).add(shift).subtract(shiftVert)); startLine(buffer, topLeft.copy().add(localXShift).add(localXShiftVert).add(shift)); endLine(buffer, topLeft.copy().add(localXShift).add(localXShiftVert).subtract(shiftVert)); - localXShiftVert.add(bottomLeft.copy().subtract(topLeft).add(shiftVert)); // Move by the vector from the top to the bottom, minus the shift from the edge. + localXShiftVert.add(bottomLeft.copy().subtract(topLeft).add(shiftVert)); // Move by the vector from + // the top to the bottom, + // minus the shift from the + // edge. } - localXShift.add(topRight.copy().subtract(topLeft).subtract(shift)); // Move by the vector from the left to the right, minus the shift from the edge. + localXShift.add(topRight.copy().subtract(topLeft).subtract(shift)); // Move by the vector from the left + // to the right, minus the shift + // from the edge. } } @@ -653,14 +681,14 @@ private static void endLine(BufferBuilder buffer, Vector3 vec) { new Scale(0.25).with(new Translation(0, 0, 0.375)).compile(), new Scale(0.25).with(new Translation(0.375, 0, 0)).compile(), new Scale(0.25).with(new Translation(0, 0, -0.375)).compile(), - new Scale(0.25).with(new Translation(-0.375, 0, 0)).compile()}; + new Scale(0.25).with(new Translation(-0.375, 0, 0)).compile() }; private static final int[] ROTATION_MARKER_TRANSFORMS_SIDES = { -1, -1, 2, 0, 3, 1, -1, -1, 0, 2, 3, 1, 0, 2, -1, -1, 3, 1, 2, 0, -1, -1, 3, 1, 1, 3, 2, 0, -1, -1, 3, 1, 2, 0, -1, -1 }; private static final Transformation[] ROTATION_MARKER_TRANSFORMS_CORNER = { new Scale(0.25).with(new Translation(0.375, 0, 0.375)).compile(), new Scale(0.25).with(new Translation(-0.375, 0, 0.375)).compile(), new Scale(0.25).with(new Translation(0.375, 0, -0.375)).compile(), - new Scale(0.25).with(new Translation(-0.375, 0, -0.375)).compile()}; + new Scale(0.25).with(new Translation(-0.375, 0, -0.375)).compile() }; private static int rotationMarkerDisplayList; private static boolean rotationMarkerDisplayListCompiled = false; diff --git a/src/main/java/gregtech/common/blocks/BlockAsphalt.java b/src/main/java/gregtech/common/blocks/BlockAsphalt.java index aec0ea5bec5..c5c9b5b28ac 100644 --- a/src/main/java/gregtech/common/blocks/BlockAsphalt.java +++ b/src/main/java/gregtech/common/blocks/BlockAsphalt.java @@ -3,6 +3,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantBlock; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -26,7 +27,8 @@ public BlockAsphalt() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityLiving.SpawnPlacementType type) { return false; } diff --git a/src/main/java/gregtech/common/blocks/BlockBatteryPart.java b/src/main/java/gregtech/common/blocks/BlockBatteryPart.java index 86d2589f7ad..e89734051b1 100644 --- a/src/main/java/gregtech/common/blocks/BlockBatteryPart.java +++ b/src/main/java/gregtech/common/blocks/BlockBatteryPart.java @@ -4,6 +4,7 @@ import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.metatileentity.multiblock.IBatteryData; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -15,6 +16,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -33,12 +35,14 @@ public BlockBatteryPart() { } @Override - public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, @NotNull EntityLiving.SpawnPlacementType placementType) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType placementType) { return false; } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World world, List tooltip, @NotNull ITooltipFlag advanced) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, List tooltip, + @NotNull ITooltipFlag advanced) { super.addInformation(stack, world, tooltip, advanced); BatteryPartType batteryType = getState(stack); @@ -50,6 +54,7 @@ public void addInformation(@NotNull ItemStack stack, @Nullable World world, List } public enum BatteryPartType implements IStringSerializable, IBatteryData { + EMPTY_TIER_I, LAPOTRONIC_EV(GTValues.EV, 25_000_000L * 6), // Lapotron Crystal * 6 LAPOTRONIC_IV(GTValues.IV, 250_000_000L * 6), // Lapotronic Orb * 6 diff --git a/src/main/java/gregtech/common/blocks/BlockBoilerCasing.java b/src/main/java/gregtech/common/blocks/BlockBoilerCasing.java index f8585341695..5ba9ef69c02 100644 --- a/src/main/java/gregtech/common/blocks/BlockBoilerCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockBoilerCasing.java @@ -3,6 +3,7 @@ import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -25,7 +26,8 @@ public BlockBoilerCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } @@ -61,5 +63,4 @@ public String getHarvestTool(IBlockState state) { return ToolClasses.WRENCH; } } - } diff --git a/src/main/java/gregtech/common/blocks/BlockBrittleCharcoal.java b/src/main/java/gregtech/common/blocks/BlockBrittleCharcoal.java index 75fe5f1deb5..f8e5d91cc33 100644 --- a/src/main/java/gregtech/common/blocks/BlockBrittleCharcoal.java +++ b/src/main/java/gregtech/common/blocks/BlockBrittleCharcoal.java @@ -1,6 +1,7 @@ package gregtech.common.blocks; import gregtech.api.GTValues; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.MapColor; @@ -15,9 +16,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class BlockBrittleCharcoal extends Block { @@ -31,12 +33,14 @@ public BlockBrittleCharcoal() { } @Override - public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state, int fortune) { + public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull IBlockState state, int fortune) { drops.add(new ItemStack(Items.COAL, 1 + GTValues.RNG.nextInt(2), 1)); } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, @Nonnull ITooltipFlag flagIn) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, + @Nonnull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); tooltip.add(I18n.format("tile.brittle_charcoal.tooltip.1")); tooltip.add(I18n.format("tile.brittle_charcoal.tooltip.2")); diff --git a/src/main/java/gregtech/common/blocks/BlockCleanroomCasing.java b/src/main/java/gregtech/common/blocks/BlockCleanroomCasing.java index 7a790f2c897..59828acd886 100644 --- a/src/main/java/gregtech/common/blocks/BlockCleanroomCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockCleanroomCasing.java @@ -3,6 +3,7 @@ import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -15,10 +16,11 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; -import java.util.List; @ParametersAreNonnullByDefault public class BlockCleanroomCasing extends VariantBlock implements IStateHarvestLevel { @@ -33,7 +35,8 @@ public BlockCleanroomCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, + EntityLiving.SpawnPlacementType type) { return false; } @@ -74,9 +77,12 @@ public String getHarvestTool(IBlockState state) { } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World player, @Nonnull List tooltip, @Nonnull ITooltipFlag advanced) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World player, @Nonnull List tooltip, + @Nonnull ITooltipFlag advanced) { super.addInformation(stack, player, tooltip, advanced); - if (stack.isItemEqual(getItemVariant(CasingType.FILTER_CASING))) tooltip.add(I18n.format("tile.cleanroom_casing.filter.tooltip")); - if (stack.isItemEqual(getItemVariant(CasingType.FILTER_CASING_STERILE))) tooltip.add(I18n.format("tile.cleanroom_casing.filter_sterile.tooltip")); + if (stack.isItemEqual(getItemVariant(CasingType.FILTER_CASING))) + tooltip.add(I18n.format("tile.cleanroom_casing.filter.tooltip")); + if (stack.isItemEqual(getItemVariant(CasingType.FILTER_CASING_STERILE))) + tooltip.add(I18n.format("tile.cleanroom_casing.filter_sterile.tooltip")); } } diff --git a/src/main/java/gregtech/common/blocks/BlockColored.java b/src/main/java/gregtech/common/blocks/BlockColored.java index 8b6d8b1d773..9f84069c345 100644 --- a/src/main/java/gregtech/common/blocks/BlockColored.java +++ b/src/main/java/gregtech/common/blocks/BlockColored.java @@ -1,6 +1,7 @@ package gregtech.common.blocks; import gregtech.api.block.VariantBlock; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -14,10 +15,12 @@ public class BlockColored extends VariantBlock { public BlockColored() { - this(net.minecraft.block.material.Material.IRON, "block_colored", 2.0f, 5.0f, SoundType.METAL, EnumDyeColor.WHITE); + this(net.minecraft.block.material.Material.IRON, "block_colored", 2.0f, 5.0f, SoundType.METAL, + EnumDyeColor.WHITE); } - public BlockColored(Material material, String translationKey, float hardness, float resistance, SoundType soundType, EnumDyeColor defaultColor) { + public BlockColored(Material material, String translationKey, float hardness, float resistance, SoundType soundType, + EnumDyeColor defaultColor) { super(material); setTranslationKey(translationKey); setHardness(hardness); @@ -27,7 +30,8 @@ public BlockColored(Material material, String translationKey, float hardness, fl } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, + EntityLiving.SpawnPlacementType type) { return false; } @@ -43,7 +47,6 @@ public boolean checkApplicableBlocks(IBlockState state) { @Override public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, EnumDyeColor color) { - if (world.getBlockState(pos) != getState(color)) { world.setBlockState(pos, getState(color)); return true; @@ -51,5 +54,4 @@ public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, EnumDyeC return false; } - } diff --git a/src/main/java/gregtech/common/blocks/BlockCompressed.java b/src/main/java/gregtech/common/blocks/BlockCompressed.java index d4cbf7e1866..5ebc94cfda2 100644 --- a/src/main/java/gregtech/common/blocks/BlockCompressed.java +++ b/src/main/java/gregtech/common/blocks/BlockCompressed.java @@ -9,6 +9,7 @@ import gregtech.client.model.modelfactories.MaterialBlockModelLoader; import gregtech.common.ConfigHolder; import gregtech.common.blocks.properties.PropertyMaterial; + import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; @@ -21,15 +22,17 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public abstract class BlockCompressed extends BlockMaterialBase { public static BlockCompressed create(Material[] materials) { PropertyMaterial property = PropertyMaterial.create("variant", materials); return new BlockCompressed() { + @Nonnull @Override public PropertyMaterial getVariantProperty() { @@ -63,7 +66,8 @@ public net.minecraft.block.material.Material getMaterial(IBlockState state) { @Nonnull @Override - public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { + public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, + @Nullable Entity entity) { Material material = getGtMaterial(state); if (material.hasProperty(PropertyKey.GEM)) { return SoundType.STONE; diff --git a/src/main/java/gregtech/common/blocks/BlockComputerCasing.java b/src/main/java/gregtech/common/blocks/BlockComputerCasing.java index 2ad69cbf422..95ee6542223 100644 --- a/src/main/java/gregtech/common/blocks/BlockComputerCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockComputerCasing.java @@ -2,9 +2,11 @@ import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; + import org.jetbrains.annotations.NotNull; public class BlockComputerCasing extends VariantBlock { diff --git a/src/main/java/gregtech/common/blocks/BlockFireboxCasing.java b/src/main/java/gregtech/common/blocks/BlockFireboxCasing.java index c025c16f891..250ca9dda00 100644 --- a/src/main/java/gregtech/common/blocks/BlockFireboxCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockFireboxCasing.java @@ -4,6 +4,7 @@ import gregtech.api.block.VariantActiveBlock; import gregtech.api.items.toolitem.ToolClasses; import gregtech.common.blocks.BlockFireboxCasing.FireboxCasingType; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -26,7 +27,8 @@ public BlockFireboxCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } @@ -61,5 +63,4 @@ public String getHarvestTool(IBlockState state) { return ToolClasses.WRENCH; } } - } diff --git a/src/main/java/gregtech/common/blocks/BlockFrame.java b/src/main/java/gregtech/common/blocks/BlockFrame.java index f948a502214..170c123a7e3 100644 --- a/src/main/java/gregtech/common/blocks/BlockFrame.java +++ b/src/main/java/gregtech/common/blocks/BlockFrame.java @@ -15,6 +15,7 @@ import gregtech.client.model.modelfactories.MaterialBlockModelLoader; import gregtech.common.ConfigHolder; import gregtech.common.blocks.properties.PropertyMaterial; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.EnumPushReaction; @@ -41,9 +42,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public abstract class BlockFrame extends BlockMaterialBase { @@ -52,6 +54,7 @@ public abstract class BlockFrame extends BlockMaterialBase { public static BlockFrame create(Material[] materials) { PropertyMaterial property = PropertyMaterial.create("variant", materials); return new BlockFrame() { + @Nonnull @Override public PropertyMaterial getVariantProperty() { @@ -79,7 +82,8 @@ public String getHarvestTool(IBlockState state) { @Nonnull @Override - public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { + public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, + @Nullable Entity entity) { Material material = getGtMaterial(state); if (ModHandler.isMaterialWood(material)) { return SoundType.WOOD; @@ -112,11 +116,13 @@ public net.minecraft.block.material.Material getMaterial(IBlockState state) { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } - public boolean replaceWithFramedPipe(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, ItemStack stackInHand, EnumFacing facing) { + public boolean replaceWithFramedPipe(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, + ItemStack stackInHand, EnumFacing facing) { BlockPipe blockPipe = (BlockPipe) ((ItemBlockPipe) stackInHand.getItem()).getBlock(); if (blockPipe.getItemPipeType(stackInHand).getThickness() < 1) { ItemBlock itemBlock = (ItemBlock) stackInHand.getItem(); @@ -131,7 +137,8 @@ public boolean replaceWithFramedPipe(World worldIn, BlockPos pos, IBlockState st return false; } SoundType type = blockPipe.getSoundType(state, worldIn, pos, playerIn); - worldIn.playSound(playerIn, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); + worldIn.playSound(playerIn, pos, type.getPlaceSound(), SoundCategory.BLOCKS, + (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); if (!playerIn.capabilities.isCreativeMode) { stackInHand.shrink(1); } @@ -189,9 +196,11 @@ public boolean onBlockActivated(@Nonnull World world, @Nonnull BlockPos pos, @No continue; } if (canPlaceBlockAt(world, blockPos)) { - world.setBlockState(blockPos, frameBlock.getStateFromMeta(stack.getItem().getMetadata(stack.getItemDamage()))); + world.setBlockState(blockPos, + frameBlock.getStateFromMeta(stack.getItem().getMetadata(stack.getItemDamage()))); SoundType type = getSoundType(stack); - world.playSound(null, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); + world.playSound(null, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, + type.getPitch() * 0.8F); if (!player.capabilities.isCreativeMode) { stack.shrink(1); } @@ -200,7 +209,8 @@ public boolean onBlockActivated(@Nonnull World world, @Nonnull BlockPos pos, @No } else if (te instanceof TileEntityPipeBase && ((TileEntityPipeBase) te).getFrameMaterial() == null) { ((TileEntityPipeBase) te).setFrameMaterial(frameBlock.getGtMaterial(stack)); SoundType type = getSoundType(stack); - world.playSound(null, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); + world.playSound(null, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, + type.getPitch() * 0.8F); if (!player.capabilities.isCreativeMode) { stack.shrink(1); } @@ -216,7 +226,8 @@ public boolean onBlockActivated(@Nonnull World world, @Nonnull BlockPos pos, @No } @Override - public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, Entity entityIn) { + public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + Entity entityIn) { entityIn.motionX = MathHelper.clamp(entityIn.motionX, -0.15, 0.15); entityIn.motionZ = MathHelper.clamp(entityIn.motionZ, -0.15, 0.15); entityIn.fallDistance = 0.0F; @@ -240,7 +251,8 @@ public EnumPushReaction getPushReaction(@Nonnull IBlockState state) { @Override @SuppressWarnings("deprecation") - public AxisAlignedBB getCollisionBoundingBox(@Nonnull IBlockState blockState, @Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { + public AxisAlignedBB getCollisionBoundingBox(@Nonnull IBlockState blockState, @Nonnull IBlockAccess worldIn, + @Nonnull BlockPos pos) { return COLLISION_BOX; } @@ -259,7 +271,8 @@ public boolean isOpaqueCube(@Nonnull IBlockState state) { @Nonnull @Override @SuppressWarnings("deprecation") - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EnumFacing face) { return BlockFaceShape.UNDEFINED; } diff --git a/src/main/java/gregtech/common/blocks/BlockFusionCasing.java b/src/main/java/gregtech/common/blocks/BlockFusionCasing.java index 65aaa08806c..06ab2ece46b 100644 --- a/src/main/java/gregtech/common/blocks/BlockFusionCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockFusionCasing.java @@ -3,6 +3,7 @@ import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantActiveBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLiving; @@ -24,7 +25,8 @@ public BlockFusionCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityLiving.SpawnPlacementType type) { return false; } diff --git a/src/main/java/gregtech/common/blocks/BlockGlassCasing.java b/src/main/java/gregtech/common/blocks/BlockGlassCasing.java index 6ff2f9a5223..a5812dd9348 100644 --- a/src/main/java/gregtech/common/blocks/BlockGlassCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockGlassCasing.java @@ -2,6 +2,7 @@ import gregtech.api.block.VariantActiveBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -32,7 +33,8 @@ public BlockGlassCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, + EntityLiving.SpawnPlacementType type) { return false; } @@ -44,7 +46,8 @@ public BlockRenderLayer getRenderLayer() { @Override public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { - return getState(state) == CasingType.TEMPERED_GLASS ? layer == BlockRenderLayer.TRANSLUCENT : super.canRenderInLayer(state, layer); + return getState(state) == CasingType.TEMPERED_GLASS ? layer == BlockRenderLayer.TRANSLUCENT : + super.canRenderInLayer(state, layer); } @Override @@ -88,6 +91,5 @@ public enum CasingType implements IStringSerializable { public String getName() { return this.name; } - } } diff --git a/src/main/java/gregtech/common/blocks/BlockGregStairs.java b/src/main/java/gregtech/common/blocks/BlockGregStairs.java index beb20fd6805..88bc3490190 100644 --- a/src/main/java/gregtech/common/blocks/BlockGregStairs.java +++ b/src/main/java/gregtech/common/blocks/BlockGregStairs.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.BlockStairs; import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; @@ -20,7 +21,8 @@ public BlockGregStairs(IBlockState state) { } @Override - public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, + @Nonnull BlockPos pos, @Nonnull EnumFacing side) { return false; } } diff --git a/src/main/java/gregtech/common/blocks/BlockHermeticCasing.java b/src/main/java/gregtech/common/blocks/BlockHermeticCasing.java index e6928599e96..a94715647bd 100644 --- a/src/main/java/gregtech/common/blocks/BlockHermeticCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockHermeticCasing.java @@ -2,6 +2,7 @@ import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -28,7 +29,8 @@ public BlockHermeticCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, + EntityLiving.SpawnPlacementType type) { return false; } diff --git a/src/main/java/gregtech/common/blocks/BlockLamp.java b/src/main/java/gregtech/common/blocks/BlockLamp.java index 76d0260f932..bb37e097a7d 100644 --- a/src/main/java/gregtech/common/blocks/BlockLamp.java +++ b/src/main/java/gregtech/common/blocks/BlockLamp.java @@ -8,6 +8,7 @@ import gregtech.client.model.lamp.LampBakedModel; import gregtech.client.model.lamp.LampModelType; import gregtech.client.utils.BloomEffectUtil; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.MapColor; @@ -30,14 +31,15 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault public class BlockLamp extends Block { @@ -187,7 +189,8 @@ public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { public void onModelRegister() { Map models = new HashMap<>(); for (IBlockState state : getBlockState().getValidStates()) { - LampBakedModel.Entry entry = LampBakedModel.register(color, getModelType(), state.getValue(BLOOM), isLightActive(state)); + LampBakedModel.Entry entry = LampBakedModel.register(color, getModelType(), state.getValue(BLOOM), + isLightActive(state)); models.put(state, entry.getBlockModelId()); if (state.getValue(POWERED)) continue; Item item = Item.getItemFromBlock(this); @@ -204,7 +207,8 @@ protected LampModelType getModelType() { } public void registerOreDict() { - OreDictUnifier.registerOre(new ItemStack(this, 1, GTValues.W), OrePrefix.lampGt, MarkerMaterials.Color.COLORS.get(color)); + OreDictUnifier.registerOre(new ItemStack(this, 1, GTValues.W), OrePrefix.lampGt, + MarkerMaterials.Color.COLORS.get(color)); } public static boolean isLightActive(IBlockState state) { diff --git a/src/main/java/gregtech/common/blocks/BlockLampBorderless.java b/src/main/java/gregtech/common/blocks/BlockLampBorderless.java index 26467f777b4..3f54c3c426e 100644 --- a/src/main/java/gregtech/common/blocks/BlockLampBorderless.java +++ b/src/main/java/gregtech/common/blocks/BlockLampBorderless.java @@ -2,6 +2,7 @@ import gregtech.client.model.lamp.LampModelType; import gregtech.client.utils.BloomEffectUtil; + import net.minecraft.block.state.IBlockState; import net.minecraft.item.EnumDyeColor; import net.minecraft.util.BlockRenderLayer; @@ -16,7 +17,8 @@ public BlockLampBorderless(EnumDyeColor color) { @Override public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRenderLayer layer) { - return layer == BloomEffectUtil.getEffectiveBloomLayer(isLightActive(state) && state.getValue(BLOOM), BlockRenderLayer.SOLID); + return layer == BloomEffectUtil.getEffectiveBloomLayer(isLightActive(state) && state.getValue(BLOOM), + BlockRenderLayer.SOLID); } @Nonnull diff --git a/src/main/java/gregtech/common/blocks/BlockMachineCasing.java b/src/main/java/gregtech/common/blocks/BlockMachineCasing.java index 98fea579f7c..46f313e64a9 100644 --- a/src/main/java/gregtech/common/blocks/BlockMachineCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockMachineCasing.java @@ -4,6 +4,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -15,9 +16,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import java.util.Locale; + import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; -import java.util.Locale; import static gregtech.api.GTValues.VOLTAGE_NAMES; @@ -50,7 +52,7 @@ public void getSubBlocks(CreativeTabs tab, NonNullList list) { public enum MachineCasingType implements IStringSerializable { - //Voltage-tiered casings + // Voltage-tiered casings ULV(makeName(VOLTAGE_NAMES[GTValues.ULV])), LV(makeName(VOLTAGE_NAMES[GTValues.LV])), MV(makeName(VOLTAGE_NAMES[GTValues.MV])), diff --git a/src/main/java/gregtech/common/blocks/BlockMaterialBase.java b/src/main/java/gregtech/common/blocks/BlockMaterialBase.java index 2498cc72cca..ff551e6bd6a 100644 --- a/src/main/java/gregtech/common/blocks/BlockMaterialBase.java +++ b/src/main/java/gregtech/common/blocks/BlockMaterialBase.java @@ -5,6 +5,7 @@ import gregtech.api.unification.material.info.MaterialFlags; import gregtech.api.util.GTUtility; import gregtech.common.blocks.properties.PropertyMaterial; + import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.state.BlockStateContainer; diff --git a/src/main/java/gregtech/common/blocks/BlockMetalCasing.java b/src/main/java/gregtech/common/blocks/BlockMetalCasing.java index 56fad410076..9386de8dba8 100644 --- a/src/main/java/gregtech/common/blocks/BlockMetalCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockMetalCasing.java @@ -3,6 +3,7 @@ import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -25,7 +26,8 @@ public BlockMetalCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } @@ -42,8 +44,7 @@ public enum MetalCasingType implements IStringSerializable, IStateHarvestLevel { COKE_BRICKS("coke_bricks", 1), PTFE_INERT_CASING("ptfe_inert", 0), HSSE_STURDY("hsse_sturdy", 3), - PALLADIUM_SUBSTATION("palladium_substation", 3) - ; + PALLADIUM_SUBSTATION("palladium_substation", 3); private final String name; private final int harvestLevel; @@ -69,5 +70,4 @@ public String getHarvestTool(IBlockState state) { return ToolClasses.WRENCH; } } - } diff --git a/src/main/java/gregtech/common/blocks/BlockMultiblockCasing.java b/src/main/java/gregtech/common/blocks/BlockMultiblockCasing.java index 30e7995c7b2..92848f68cf0 100644 --- a/src/main/java/gregtech/common/blocks/BlockMultiblockCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockMultiblockCasing.java @@ -2,6 +2,7 @@ import gregtech.api.block.VariantActiveBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -25,7 +26,8 @@ public BlockMultiblockCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } @@ -48,7 +50,5 @@ public enum MultiblockCasingType implements IStringSerializable { public String getName() { return this.name; } - } - } diff --git a/src/main/java/gregtech/common/blocks/BlockOre.java b/src/main/java/gregtech/common/blocks/BlockOre.java index 13499872741..b91135bc0d1 100644 --- a/src/main/java/gregtech/common/blocks/BlockOre.java +++ b/src/main/java/gregtech/common/blocks/BlockOre.java @@ -13,6 +13,7 @@ import gregtech.client.model.OreBakedModel; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.blocks.properties.PropertyStoneType; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.state.BlockStateContainer; @@ -32,12 +33,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Objects; import java.util.Random; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class BlockOre extends Block implements IBlockOre { public final PropertyStoneType STONE_TYPE; @@ -107,7 +109,8 @@ public int damageDropped(@Nonnull IBlockState state) { @Nonnull @Override - public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { + public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, + @Nullable Entity entity) { StoneType stoneType = state.getValue(STONE_TYPE); return stoneType.soundType; } @@ -122,7 +125,8 @@ public String getHarvestTool(IBlockState state) { @Override public int getHarvestLevel(IBlockState state) { // this is save because ore blocks and stone types only generate for materials with dust property - return Math.max(state.getValue(STONE_TYPE).stoneMaterial.getBlockHarvestLevel(), material.getBlockHarvestLevel()); + return Math.max(state.getValue(STONE_TYPE).stoneMaterial.getBlockHarvestLevel(), + material.getBlockHarvestLevel()); } @Nonnull @@ -152,7 +156,8 @@ public int getMetaFromState(IBlockState state) { @Nonnull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { // Still get correct block even if shouldBeDroppedAsItem is false return GTUtility.toItem(state); } @@ -195,8 +200,7 @@ public void onModelRegister() { ModelLoader.setCustomStateMapper(this, b -> b.getBlockState().getValidStates().stream() .collect(Collectors.toMap( s -> s, - s -> OreBakedModel.registerOreEntry(s.getValue(STONE_TYPE), this.material) - ))); + s -> OreBakedModel.registerOreEntry(s.getValue(STONE_TYPE), this.material)))); for (IBlockState state : this.getBlockState().getValidStates()) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), this.getMetaFromState(state), OreBakedModel.registerOreEntry(state.getValue(STONE_TYPE), this.material)); diff --git a/src/main/java/gregtech/common/blocks/BlockSteamCasing.java b/src/main/java/gregtech/common/blocks/BlockSteamCasing.java index 72d4f0ef864..01c0b5d393e 100644 --- a/src/main/java/gregtech/common/blocks/BlockSteamCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockSteamCasing.java @@ -3,6 +3,7 @@ import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -15,10 +16,11 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; -import java.util.List; @ParametersAreNonnullByDefault public class BlockSteamCasing extends VariantBlock { @@ -33,7 +35,8 @@ public BlockSteamCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, + EntityLiving.SpawnPlacementType type) { return false; } diff --git a/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java b/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java index dc44d26821a..dc06466524e 100755 --- a/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java +++ b/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java @@ -7,6 +7,7 @@ import gregtech.api.unification.ore.OrePrefix; import gregtech.api.util.GTUtility; import gregtech.common.blocks.properties.PropertyMaterial; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.state.BlockFaceShape; @@ -30,12 +31,15 @@ @SuppressWarnings("deprecation") public abstract class BlockSurfaceRock extends BlockMaterialBase { - private static final AxisAlignedBB STONE_AABB = new AxisAlignedBB(2.0 / 16.0, 0.0 / 16.0, 2.0 / 16.0, 14.0 / 16.0, 2.0 / 16.0, 14.0 / 16.0); - public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation(GTUtility.gregtechId("surface_rock"), "normal"); + private static final AxisAlignedBB STONE_AABB = new AxisAlignedBB(2.0 / 16.0, 0.0 / 16.0, 2.0 / 16.0, 14.0 / 16.0, + 2.0 / 16.0, 14.0 / 16.0); + public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation( + GTUtility.gregtechId("surface_rock"), "normal"); public static BlockSurfaceRock create(Material[] materials) { PropertyMaterial property = PropertyMaterial.create("variant", materials); return new BlockSurfaceRock() { + @Nonnull @Override public PropertyMaterial getVariantProperty() { @@ -57,7 +61,9 @@ public String getHarvestTool(@Nonnull IBlockState state) { } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + float hitX, float hitY, float hitZ) { dropBlockAsItem(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); playerIn.swingArm(hand); @@ -66,13 +72,15 @@ public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @ @Nonnull @Override - public SoundType getSoundType(@Nonnull IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { + public SoundType getSoundType(@Nonnull IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, + @Nullable Entity entity) { return SoundType.GROUND; } @Override @Nonnull - public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, @Nonnull IBlockAccess source, @Nonnull BlockPos pos) { + public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, @Nonnull IBlockAccess source, + @Nonnull BlockPos pos) { return STONE_AABB; } @@ -82,12 +90,14 @@ private ItemStack getDropStack(IBlockState state, int amount) { @Override @Nonnull - public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { return getDropStack(state, 1); } @Override - public void getDrops(NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state, int fortune) { + public void getDrops(NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull IBlockState state, int fortune) { int amount = 3 + GTValues.RNG.nextInt((int) (2 + fortune * 1.5)); drops.add(getDropStack(state, amount)); } @@ -103,9 +113,11 @@ public boolean isOpaqueCube(@Nonnull IBlockState state) { } @Override - public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Block blockIn, BlockPos fromPos) { + public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull Block blockIn, BlockPos fromPos) { if (fromPos.up().equals(pos)) { - if (worldIn.getBlockState(fromPos).getBlockFaceShape(worldIn, fromPos, EnumFacing.UP) != BlockFaceShape.SOLID) { + if (worldIn.getBlockState(fromPos).getBlockFaceShape(worldIn, fromPos, EnumFacing.UP) != + BlockFaceShape.SOLID) { worldIn.destroyBlock(pos, true); } } @@ -113,7 +125,8 @@ public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Override @Nonnull - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EnumFacing face) { return BlockFaceShape.UNDEFINED; } } diff --git a/src/main/java/gregtech/common/blocks/BlockTurbineCasing.java b/src/main/java/gregtech/common/blocks/BlockTurbineCasing.java index c3173ed2129..984b4869533 100644 --- a/src/main/java/gregtech/common/blocks/BlockTurbineCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockTurbineCasing.java @@ -3,6 +3,7 @@ import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -68,5 +69,4 @@ public String getHarvestTool(IBlockState state) { return ToolClasses.WRENCH; } } - } diff --git a/src/main/java/gregtech/common/blocks/BlockWarningSign.java b/src/main/java/gregtech/common/blocks/BlockWarningSign.java index fd060b459aa..d35241a8699 100644 --- a/src/main/java/gregtech/common/blocks/BlockWarningSign.java +++ b/src/main/java/gregtech/common/blocks/BlockWarningSign.java @@ -3,6 +3,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; @@ -52,7 +53,5 @@ public enum SignType implements IStringSerializable { public String getName() { return this.name; } - } - } diff --git a/src/main/java/gregtech/common/blocks/BlockWarningSign1.java b/src/main/java/gregtech/common/blocks/BlockWarningSign1.java index 05ad51ae3a5..bb03ca19a3a 100644 --- a/src/main/java/gregtech/common/blocks/BlockWarningSign1.java +++ b/src/main/java/gregtech/common/blocks/BlockWarningSign1.java @@ -3,6 +3,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; diff --git a/src/main/java/gregtech/common/blocks/BlockWireCoil.java b/src/main/java/gregtech/common/blocks/BlockWireCoil.java index 9fff79fde24..8587e149364 100644 --- a/src/main/java/gregtech/common/blocks/BlockWireCoil.java +++ b/src/main/java/gregtech/common/blocks/BlockWireCoil.java @@ -9,6 +9,7 @@ import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.electric.MetaTileEntityMultiSmelter; + import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; @@ -23,9 +24,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class BlockWireCoil extends VariantActiveBlock { @@ -46,7 +48,8 @@ public BlockRenderLayer getRenderLayer() { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, List lines, @Nonnull ITooltipFlag tooltipFlag) { + public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, List lines, + @Nonnull ITooltipFlag tooltipFlag) { super.addInformation(itemStack, worldIn, lines, tooltipFlag); // noinspection rawtypes, unchecked @@ -60,7 +63,8 @@ public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn int coilTier = coilType.ordinal(); lines.add(I18n.format("tile.wire_coil.tooltip_smelter")); lines.add(I18n.format("tile.wire_coil.tooltip_parallel_smelter", coilType.level * 32)); - int EUt = MetaTileEntityMultiSmelter.getEUtForParallel(MetaTileEntityMultiSmelter.getMaxParallel(coilType.getLevel()), coilType.getEnergyDiscount()); + int EUt = MetaTileEntityMultiSmelter.getEUtForParallel( + MetaTileEntityMultiSmelter.getMaxParallel(coilType.getLevel()), coilType.getEnergyDiscount()); lines.add(I18n.format("tile.wire_coil.tooltip_energy_smelter", EUt)); lines.add(I18n.format("tile.wire_coil.tooltip_pyro")); lines.add(I18n.format("tile.wire_coil.tooltip_speed_pyro", coilTier == 0 ? 75 : 50 * (coilTier + 1))); @@ -72,7 +76,8 @@ public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } @@ -93,9 +98,9 @@ public enum CoilType implements IStringSerializable, IHeatingCoilBlockStats { TRITANIUM("tritanium", 10800, 16, 8, Materials.Tritanium); private final String name; - //electric blast furnace properties + // electric blast furnace properties private final int coilTemperature; - //multi smelter properties + // multi smelter properties private final int level; private final int energyDiscount; private final Material material; diff --git a/src/main/java/gregtech/common/blocks/MaterialItemBlock.java b/src/main/java/gregtech/common/blocks/MaterialItemBlock.java index 75564c3ad53..b8ac343fe6d 100644 --- a/src/main/java/gregtech/common/blocks/MaterialItemBlock.java +++ b/src/main/java/gregtech/common/blocks/MaterialItemBlock.java @@ -1,6 +1,7 @@ package gregtech.common.blocks; import gregtech.api.unification.ore.OrePrefix; + import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/common/blocks/MetaBlocks.java b/src/main/java/gregtech/common/blocks/MetaBlocks.java index 385b2365566..64e5fd1abf4 100644 --- a/src/main/java/gregtech/common/blocks/MetaBlocks.java +++ b/src/main/java/gregtech/common/blocks/MetaBlocks.java @@ -1,12 +1,9 @@ package gregtech.common.blocks; -import com.google.common.collect.ImmutableMap; import gregtech.api.GregTechAPI; import gregtech.api.block.machines.BlockMachine; import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.pipenet.longdist.BlockLongDistancePipe; -import gregtech.common.pipelike.fluidpipe.longdistance.LDFluidPipeType; -import gregtech.common.pipelike.itempipe.longdistance.LDItemPipeType; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; @@ -32,10 +29,12 @@ import gregtech.common.pipelike.cable.tile.TileEntityCableTickable; import gregtech.common.pipelike.fluidpipe.BlockFluidPipe; import gregtech.common.pipelike.fluidpipe.FluidPipeType; +import gregtech.common.pipelike.fluidpipe.longdistance.LDFluidPipeType; import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipe; import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipeTickable; import gregtech.common.pipelike.itempipe.BlockItemPipe; import gregtech.common.pipelike.itempipe.ItemPipeType; +import gregtech.common.pipelike.itempipe.longdistance.LDItemPipeType; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipeTickable; import gregtech.common.pipelike.laser.BlockLaserPipe; @@ -44,9 +43,7 @@ import gregtech.common.pipelike.optical.BlockOpticalPipe; import gregtech.common.pipelike.optical.OpticalPipeType; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; -import it.unimi.dsi.fastutil.ints.Int2ObjectAVLTreeMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.*; import net.minecraft.block.BlockLog.EnumAxis; import net.minecraft.block.BlockSlab.EnumBlockHalf; @@ -70,12 +67,18 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import com.google.common.collect.ImmutableMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectAVLTreeMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.*; import java.util.Map.Entry; import java.util.function.Predicate; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + import static gregtech.api.unification.material.info.MaterialFlags.FORCE_GENERATE_BLOCK; import static gregtech.api.unification.material.info.MaterialFlags.GENERATE_FRAME; import static gregtech.api.util.GTUtility.gregtechId; @@ -115,7 +118,8 @@ private MetaBlocks() {} public static BlockAsphalt ASPHALT; - public static final EnumMap STONE_BLOCKS = new EnumMap<>(StoneVariantBlock.StoneVariant.class); + public static final EnumMap STONE_BLOCKS = new EnumMap<>( + StoneVariantBlock.StoneVariant.class); public static BlockFoam FOAM; public static BlockFoam REINFORCED_FOAM; @@ -288,26 +292,31 @@ public static void init() { BRITTLE_CHARCOAL = new BlockBrittleCharcoal(); BRITTLE_CHARCOAL.setRegistryName("brittle_charcoal"); - METAL_SHEET = new BlockColored(net.minecraft.block.material.Material.IRON, "metal_sheet", 2.0f, 5.0f, SoundType.METAL, EnumDyeColor.WHITE); + METAL_SHEET = new BlockColored(net.minecraft.block.material.Material.IRON, "metal_sheet", 2.0f, 5.0f, + SoundType.METAL, EnumDyeColor.WHITE); METAL_SHEET.setRegistryName("metal_sheet"); - LARGE_METAL_SHEET = new BlockColored(net.minecraft.block.material.Material.IRON, "large_metal_sheet", 2.0f, 5.0f, SoundType.METAL, EnumDyeColor.WHITE); + LARGE_METAL_SHEET = new BlockColored(net.minecraft.block.material.Material.IRON, "large_metal_sheet", 2.0f, + 5.0f, SoundType.METAL, EnumDyeColor.WHITE); LARGE_METAL_SHEET.setRegistryName("large_metal_sheet"); - STUDS = new BlockColored(net.minecraft.block.material.Material.CARPET, "studs", 1.5f, 2.5f, SoundType.CLOTH, EnumDyeColor.BLACK); + STUDS = new BlockColored(net.minecraft.block.material.Material.CARPET, "studs", 1.5f, 2.5f, SoundType.CLOTH, + EnumDyeColor.BLACK); STUDS.setRegistryName("studs"); - createGeneratedBlock(m -> m.hasProperty(PropertyKey.DUST) && m.hasFlag(GENERATE_FRAME), MetaBlocks::createFrameBlock); - createGeneratedBlock(m -> m.hasProperty(PropertyKey.ORE) && m.hasProperty(PropertyKey.DUST), MetaBlocks::createSurfaceRockBlock); + createGeneratedBlock(m -> m.hasProperty(PropertyKey.DUST) && m.hasFlag(GENERATE_FRAME), + MetaBlocks::createFrameBlock); + createGeneratedBlock(m -> m.hasProperty(PropertyKey.ORE) && m.hasProperty(PropertyKey.DUST), + MetaBlocks::createSurfaceRockBlock); createGeneratedBlock( - material -> (material.hasProperty(PropertyKey.INGOT) || material.hasProperty(PropertyKey.GEM) || material.hasFlag(FORCE_GENERATE_BLOCK)) - && !OrePrefix.block.isIgnored(material), + material -> (material.hasProperty(PropertyKey.INGOT) || material.hasProperty(PropertyKey.GEM) || + material.hasFlag(FORCE_GENERATE_BLOCK)) && !OrePrefix.block.isIgnored(material), MetaBlocks::createCompressedBlock); - registerTileEntity(); - //not sure if that's a good place for that, but i don't want to make a dedicated method for that - //could possibly override block methods, but since these props don't depend on state why not just use nice and simple vanilla method + // not sure if that's a good place for that, but i don't want to make a dedicated method for that + // could possibly override block methods, but since these props don't depend on state why not just use nice and + // simple vanilla method Blocks.FIRE.setFireInfo(RUBBER_LOG, 5, 5); Blocks.FIRE.setFireInfo(RUBBER_LEAVES, 30, 60); Blocks.FIRE.setFireInfo(PLANKS, 5, 20); @@ -395,16 +404,19 @@ public static void registerTileEntity() { @SideOnly(Side.CLIENT) public static void registerItemModels() { - ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MACHINE), stack -> MetaTileEntityRenderer.MODEL_LOCATION); + ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MACHINE), + stack -> MetaTileEntityRenderer.MODEL_LOCATION); for (MaterialRegistry registry : GregTechAPI.materialManager.getRegistries()) { for (BlockCable cable : CABLES.get(registry.getModid())) cable.onModelRegister(); for (BlockFluidPipe pipe : FLUID_PIPES.get(registry.getModid())) pipe.onModelRegister(); for (BlockItemPipe pipe : ITEM_PIPES.get(registry.getModid())) pipe.onModelRegister(); } for (BlockOpticalPipe pipe : OPTICAL_PIPES) - ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(pipe), stack -> OpticalPipeRenderer.INSTANCE.getModelLocation()); + ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(pipe), + stack -> OpticalPipeRenderer.INSTANCE.getModelLocation()); for (BlockLaserPipe pipe : LASER_PIPES) - ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(pipe), stack -> LaserPipeRenderer.INSTANCE.getModelLocation()); + ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(pipe), + stack -> LaserPipeRenderer.INSTANCE.getModelLocation()); registerItemModel(BOILER_CASING); registerItemModel(METAL_CASING); @@ -438,9 +450,11 @@ public static void registerItemModels() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(TREATED_WOOD_FENCE), 0, new ModelResourceLocation(Objects.requireNonNull(TREATED_WOOD_FENCE.getRegistryName()), "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RUBBER_WOOD_FENCE_GATE), 0, - new ModelResourceLocation(Objects.requireNonNull(RUBBER_WOOD_FENCE_GATE.getRegistryName()), "inventory")); + new ModelResourceLocation(Objects.requireNonNull(RUBBER_WOOD_FENCE_GATE.getRegistryName()), + "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(TREATED_WOOD_FENCE_GATE), 0, - new ModelResourceLocation(Objects.requireNonNull(TREATED_WOOD_FENCE_GATE.getRegistryName()), "inventory")); + new ModelResourceLocation(Objects.requireNonNull(TREATED_WOOD_FENCE_GATE.getRegistryName()), + "inventory")); registerItemModel(BRITTLE_CHARCOAL); registerItemModel(METAL_SHEET); @@ -464,7 +478,7 @@ public static void registerItemModels() { @SideOnly(Side.CLIENT) private static void registerItemModel(Block block) { for (IBlockState state : block.getBlockState().getValidStates()) { - //noinspection ConstantConditions + // noinspection ConstantConditions ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), block.getMetaFromState(state), new ModelResourceLocation(block.getRegistryName(), @@ -477,7 +491,7 @@ private static void registerItemModelWithOverride(Block block, Map, for (IBlockState state : block.getBlockState().getValidStates()) { Map, Comparable> stringProperties = new Object2ObjectOpenHashMap<>(state.getProperties()); stringProperties.putAll(stateOverrides); - //noinspection ConstantConditions + // noinspection ConstantConditions ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), block.getMetaFromState(state), new ModelResourceLocation(block.getRegistryName(), @@ -519,6 +533,7 @@ public static void registerStateMappers() { } normalStateMapper = new StateMapperBase() { + @Nonnull @Override protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) { @@ -543,54 +558,48 @@ public static void registerColors() { BlockColors blockColors = Minecraft.getMinecraft().getBlockColors(); ItemColors itemColors = Minecraft.getMinecraft().getItemColors(); - blockColors.registerBlockColorHandler((s, w, p, i) -> - s.getValue(net.minecraft.block.BlockColored.COLOR).colorValue, + blockColors.registerBlockColorHandler( + (s, w, p, i) -> s.getValue(net.minecraft.block.BlockColored.COLOR).colorValue, FOAM, REINFORCED_FOAM, PETRIFIED_FOAM, REINFORCED_PETRIFIED_FOAM); final int rubberLeavesColor = 0x98de4b; - blockColors.registerBlockColorHandler((s, w, p, i) -> - rubberLeavesColor, RUBBER_LEAVES); - itemColors.registerItemColorHandler((s, i) -> - rubberLeavesColor, RUBBER_LEAVES); + blockColors.registerBlockColorHandler((s, w, p, i) -> rubberLeavesColor, RUBBER_LEAVES); + itemColors.registerItemColorHandler((s, i) -> rubberLeavesColor, RUBBER_LEAVES); for (BlockCompressed block : COMPRESSED_BLOCKS) { - blockColors.registerBlockColorHandler((s, w, p, i) -> - block.getGtMaterial(s).getMaterialRGB(), block); - itemColors.registerItemColorHandler((s, i) -> - block.getGtMaterial(s).getMaterialRGB(), block); + blockColors.registerBlockColorHandler((s, w, p, i) -> block.getGtMaterial(s).getMaterialRGB(), block); + itemColors.registerItemColorHandler((s, i) -> block.getGtMaterial(s).getMaterialRGB(), block); } for (BlockFrame block : FRAME_BLOCKS) { - blockColors.registerBlockColorHandler((s, w, p, i) -> - block.getGtMaterial(s).getMaterialRGB(), block); - itemColors.registerItemColorHandler((s, i) -> - block.getGtMaterial(s).getMaterialRGB(), block); + blockColors.registerBlockColorHandler((s, w, p, i) -> block.getGtMaterial(s).getMaterialRGB(), block); + itemColors.registerItemColorHandler((s, i) -> block.getGtMaterial(s).getMaterialRGB(), block); } for (BlockSurfaceRock block : SURFACE_ROCK_BLOCKS) { - blockColors.registerBlockColorHandler((s, w, p, i) -> - i == 1 ? block.getGtMaterial(s).getMaterialRGB() : -1, block); + blockColors.registerBlockColorHandler((s, w, p, i) -> i == 1 ? block.getGtMaterial(s).getMaterialRGB() : -1, + block); } for (BlockOre block : ORES) { - blockColors.registerBlockColorHandler((s, w, p, i) -> - i == 1 ? block.material.getMaterialRGB() : 0xFFFFFF, block); - itemColors.registerItemColorHandler((s, i) -> - i == 1 ? block.material.getMaterialRGB() : 0xFFFFFF, block); + blockColors.registerBlockColorHandler((s, w, p, i) -> i == 1 ? block.material.getMaterialRGB() : 0xFFFFFF, + block); + itemColors.registerItemColorHandler((s, i) -> i == 1 ? block.material.getMaterialRGB() : 0xFFFFFF, block); } - blockColors.registerBlockColorHandler((s, w, p, i) -> - MACHINE_CASING.getState(s) == BlockMachineCasing.MachineCasingType.ULV ? - 0xFFFFFF : ConfigHolder.client.defaultPaintingColor, MACHINE_CASING); - itemColors.registerItemColorHandler((s, i) -> - MACHINE_CASING.getState(s) == BlockMachineCasing.MachineCasingType.ULV ? - 0xFFFFFF : ConfigHolder.client.defaultPaintingColor, MACHINE_CASING); - - blockColors.registerBlockColorHandler((s, w, p, i) -> - ConfigHolder.client.defaultPaintingColor, HERMETIC_CASING); - itemColors.registerItemColorHandler((s, i) -> - ConfigHolder.client.defaultPaintingColor, HERMETIC_CASING); + blockColors.registerBlockColorHandler( + (s, w, p, i) -> MACHINE_CASING.getState(s) == BlockMachineCasing.MachineCasingType.ULV ? + 0xFFFFFF : ConfigHolder.client.defaultPaintingColor, + MACHINE_CASING); + itemColors.registerItemColorHandler( + (s, i) -> MACHINE_CASING.getState(s) == BlockMachineCasing.MachineCasingType.ULV ? + 0xFFFFFF : ConfigHolder.client.defaultPaintingColor, + MACHINE_CASING); + + blockColors.registerBlockColorHandler((s, w, p, i) -> ConfigHolder.client.defaultPaintingColor, + HERMETIC_CASING); + itemColors.registerItemColorHandler((s, i) -> ConfigHolder.client.defaultPaintingColor, HERMETIC_CASING); } public static void registerOreDict() { diff --git a/src/main/java/gregtech/common/blocks/OreItemBlock.java b/src/main/java/gregtech/common/blocks/OreItemBlock.java index 8108d1f1df5..1e2b569c801 100644 --- a/src/main/java/gregtech/common/blocks/OreItemBlock.java +++ b/src/main/java/gregtech/common/blocks/OreItemBlock.java @@ -1,6 +1,7 @@ package gregtech.common.blocks; import gregtech.api.unification.ore.StoneType; + import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/common/blocks/StoneVariantBlock.java b/src/main/java/gregtech/common/blocks/StoneVariantBlock.java index 0098a77fecf..c532c1700dc 100644 --- a/src/main/java/gregtech/common/blocks/StoneVariantBlock.java +++ b/src/main/java/gregtech/common/blocks/StoneVariantBlock.java @@ -6,6 +6,7 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; + import net.minecraft.block.SoundType; import net.minecraft.block.material.MapColor; import net.minecraft.block.properties.PropertyEnum; @@ -17,9 +18,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; import java.util.Random; +import javax.annotation.Nonnull; + @SuppressWarnings("deprecation") public class StoneVariantBlock extends VariantBlock { @@ -50,7 +52,8 @@ protected BlockStateContainer createBlockState() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityLiving.SpawnPlacementType type) { return false; } @@ -100,22 +103,34 @@ public String getName() { public OrePrefix getOrePrefix() { switch (this) { - case BLACK_GRANITE: case RED_GRANITE: case MARBLE: case BASALT: + case BLACK_GRANITE: + case RED_GRANITE: + case MARBLE: + case BASALT: return OrePrefix.stone; - case CONCRETE_LIGHT: case CONCRETE_DARK: + case CONCRETE_LIGHT: + case CONCRETE_DARK: return OrePrefix.block; - default: throw new IllegalStateException("Unreachable"); + default: + throw new IllegalStateException("Unreachable"); } } public Material getMaterial() { switch (this) { - case BLACK_GRANITE: return Materials.GraniteBlack; - case RED_GRANITE: return Materials.GraniteRed; - case MARBLE: return Materials.Marble; - case BASALT: return Materials.Basalt; - case CONCRETE_LIGHT: case CONCRETE_DARK: return Materials.Concrete; - default: throw new IllegalStateException("Unreachable"); + case BLACK_GRANITE: + return Materials.GraniteBlack; + case RED_GRANITE: + return Materials.GraniteRed; + case MARBLE: + return Materials.Marble; + case BASALT: + return Materials.Basalt; + case CONCRETE_LIGHT: + case CONCRETE_DARK: + return Materials.Concrete; + default: + throw new IllegalStateException("Unreachable"); } } } diff --git a/src/main/java/gregtech/common/blocks/foam/BlockFoam.java b/src/main/java/gregtech/common/blocks/foam/BlockFoam.java index 6a7d8c7f312..426701f2682 100644 --- a/src/main/java/gregtech/common/blocks/foam/BlockFoam.java +++ b/src/main/java/gregtech/common/blocks/foam/BlockFoam.java @@ -2,6 +2,7 @@ import gregtech.api.unification.OreDictUnifier; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.Block; import net.minecraft.block.BlockColored; import net.minecraft.block.SoundType; @@ -23,9 +24,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import java.util.Random; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Random; public class BlockFoam extends BlockColored { @@ -43,7 +45,9 @@ public BlockFoam(boolean isReinforced) { } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + float hitX, float hitY, float hitZ) { ItemStack stackInHand = playerIn.getHeldItem(hand); if (!stackInHand.isEmpty() && OreDictUnifier.hasOreDictionary(stackInHand, "sand")) { worldIn.setBlockState(pos, getPetrifiedBlock(state)); @@ -78,7 +82,8 @@ public EnumPushReaction getPushReaction(@Nonnull IBlockState state) { @Nullable @Override @SuppressWarnings("deprecation") - public AxisAlignedBB getCollisionBoundingBox(@Nonnull IBlockState blockState, @Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { + public AxisAlignedBB getCollisionBoundingBox(@Nonnull IBlockState blockState, @Nonnull IBlockAccess worldIn, + @Nonnull BlockPos pos) { return null; } @@ -100,7 +105,6 @@ public boolean isOpaqueCube(@Nonnull IBlockState state) { return false; } - @Override @SuppressWarnings("deprecation") public boolean isFullCube(@Nonnull IBlockState state) { @@ -110,7 +114,8 @@ public boolean isFullCube(@Nonnull IBlockState state) { @Nonnull @Override @SuppressWarnings("deprecation") - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EnumFacing face) { return BlockFaceShape.UNDEFINED; } } diff --git a/src/main/java/gregtech/common/blocks/foam/BlockPetrifiedFoam.java b/src/main/java/gregtech/common/blocks/foam/BlockPetrifiedFoam.java index 08a34fdacbc..769eaef2194 100644 --- a/src/main/java/gregtech/common/blocks/foam/BlockPetrifiedFoam.java +++ b/src/main/java/gregtech/common/blocks/foam/BlockPetrifiedFoam.java @@ -1,6 +1,7 @@ package gregtech.common.blocks.foam; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.BlockColored; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; @@ -23,7 +24,8 @@ public BlockPetrifiedFoam(boolean isReinforced) { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } } diff --git a/src/main/java/gregtech/common/blocks/properties/PropertyMaterial.java b/src/main/java/gregtech/common/blocks/properties/PropertyMaterial.java index e5b6fa2ff01..64c176b21b8 100644 --- a/src/main/java/gregtech/common/blocks/properties/PropertyMaterial.java +++ b/src/main/java/gregtech/common/blocks/properties/PropertyMaterial.java @@ -1,16 +1,19 @@ package gregtech.common.blocks.properties; -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableList; import gregtech.api.GregTechAPI; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; + import net.minecraft.block.properties.PropertyHelper; -import javax.annotation.Nonnull; +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableList; + import java.util.Arrays; import java.util.Collection; +import javax.annotation.Nonnull; + public class PropertyMaterial extends PropertyHelper { private final ImmutableList allowedValues; diff --git a/src/main/java/gregtech/common/blocks/properties/PropertyStoneType.java b/src/main/java/gregtech/common/blocks/properties/PropertyStoneType.java index ca9c10db241..771c045b3da 100644 --- a/src/main/java/gregtech/common/blocks/properties/PropertyStoneType.java +++ b/src/main/java/gregtech/common/blocks/properties/PropertyStoneType.java @@ -1,14 +1,17 @@ package gregtech.common.blocks.properties; -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableList; import gregtech.api.unification.ore.StoneType; + import net.minecraft.block.properties.PropertyHelper; -import javax.annotation.Nonnull; +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableList; + import java.util.Arrays; import java.util.Collection; +import javax.annotation.Nonnull; + public class PropertyStoneType extends PropertyHelper { private final ImmutableList allowedValues; @@ -66,5 +69,4 @@ public int hashCode() { i = 31 * i + this.allowedValues.hashCode(); return i; } - } diff --git a/src/main/java/gregtech/common/blocks/wood/BlockGregFence.java b/src/main/java/gregtech/common/blocks/wood/BlockGregFence.java index 91dd4a7c10f..975c0708a22 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockGregFence.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockGregFence.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.BlockFence; import net.minecraft.block.SoundType; import net.minecraft.block.material.MapColor; diff --git a/src/main/java/gregtech/common/blocks/wood/BlockGregFenceGate.java b/src/main/java/gregtech/common/blocks/wood/BlockGregFenceGate.java index 0e25e0e47d7..29c539eca35 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockGregFenceGate.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockGregFenceGate.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.BlockFenceGate; import net.minecraft.block.BlockPlanks; import net.minecraft.block.SoundType; diff --git a/src/main/java/gregtech/common/blocks/wood/BlockGregPlanks.java b/src/main/java/gregtech/common/blocks/wood/BlockGregPlanks.java index 297e77ea51d..9333e23a8bc 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockGregPlanks.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockGregPlanks.java @@ -2,6 +2,7 @@ import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; diff --git a/src/main/java/gregtech/common/blocks/wood/BlockGregWoodSlab.java b/src/main/java/gregtech/common/blocks/wood/BlockGregWoodSlab.java index 4f4d3df4f5c..6fd4f614b81 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockGregWoodSlab.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockGregWoodSlab.java @@ -3,6 +3,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.BlockSlab; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; @@ -18,12 +19,14 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; import java.util.Random; +import javax.annotation.Nonnull; + public abstract class BlockGregWoodSlab extends BlockSlab { - private static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockGregPlanks.BlockType.class); + private static final PropertyEnum VARIANT = PropertyEnum.create("variant", + BlockGregPlanks.BlockType.class); public BlockGregWoodSlab() { super(Material.WOOD); @@ -114,7 +117,8 @@ protected BlockStateContainer createBlockState() { } @Override - public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, + @Nonnull BlockPos pos, @Nonnull EnumFacing side) { return false; } } diff --git a/src/main/java/gregtech/common/blocks/wood/BlockRubberDoor.java b/src/main/java/gregtech/common/blocks/wood/BlockRubberDoor.java index 13bbbe46c25..751ea10fa13 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockRubberDoor.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockRubberDoor.java @@ -1,6 +1,7 @@ package gregtech.common.blocks.wood; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.BlockDoor; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/common/blocks/wood/BlockRubberLeaves.java b/src/main/java/gregtech/common/blocks/wood/BlockRubberLeaves.java index 0b884519ef4..7c351a19ee5 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockRubberLeaves.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockRubberLeaves.java @@ -1,9 +1,9 @@ package gregtech.common.blocks.wood; -import com.google.common.collect.Lists; import gregtech.api.GregTechAPI; import gregtech.common.blocks.MetaBlocks; import gregtech.core.CoreModule; + import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockPlanks.EnumType; import net.minecraft.block.state.BlockStateContainer; @@ -18,10 +18,13 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import javax.annotation.Nonnull; +import com.google.common.collect.Lists; + import java.util.List; import java.util.Random; +import javax.annotation.Nonnull; + public class BlockRubberLeaves extends BlockLeaves { public BlockRubberLeaves() { @@ -46,7 +49,8 @@ protected BlockStateContainer createBlockState() { @SuppressWarnings("deprecation") @Override - public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { + public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, + float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(DECAYABLE, false).withProperty(CHECK_DECAY, false); } @@ -101,7 +105,8 @@ public boolean isOpaqueCube(@Nonnull IBlockState state) { } @Override - public boolean shouldSideBeRendered(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean shouldSideBeRendered(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, + @Nonnull BlockPos pos, @Nonnull EnumFacing side) { if (!fancyLeaves()) { return super.shouldSideBeRendered(blockState, blockAccess, pos, side); } diff --git a/src/main/java/gregtech/common/blocks/wood/BlockRubberLog.java b/src/main/java/gregtech/common/blocks/wood/BlockRubberLog.java index f676aa6b579..60a17930696 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockRubberLog.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockRubberLog.java @@ -3,6 +3,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; import gregtech.common.items.MetaItems; + import net.minecraft.block.BlockLog; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.BlockStateContainer; @@ -13,9 +14,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import javax.annotation.Nonnull; import java.util.Random; +import javax.annotation.Nonnull; + public class BlockRubberLog extends BlockLog { public static final PropertyBool NATURAL = PropertyBool.create("natural"); @@ -49,7 +51,8 @@ public int getMetaFromState(IBlockState state) { } @Override - public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, IBlockState state, int fortune) { + public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + IBlockState state, int fortune) { Random rand = world instanceof World ? ((World) world).rand : RANDOM; if (state.getValue(NATURAL)) { if (rand.nextDouble() <= .85D) { diff --git a/src/main/java/gregtech/common/blocks/wood/BlockRubberSapling.java b/src/main/java/gregtech/common/blocks/wood/BlockRubberSapling.java index 51e22dd36fa..2c17b442f62 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockRubberSapling.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockRubberSapling.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.common.worldgen.WorldGenRubberTree; + import net.minecraft.block.BlockBush; import net.minecraft.block.IGrowable; import net.minecraft.block.SoundType; @@ -13,9 +14,10 @@ import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; -import javax.annotation.Nonnull; import java.util.Random; +import javax.annotation.Nonnull; + import static net.minecraft.block.BlockSapling.STAGE; public class BlockRubberSapling extends BlockBush implements IGrowable { @@ -66,22 +68,26 @@ public int getMetaFromState(IBlockState state) { @Nonnull @Override @SuppressWarnings("deprecation") - public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, @Nonnull IBlockAccess source, @Nonnull BlockPos pos) { + public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, @Nonnull IBlockAccess source, + @Nonnull BlockPos pos) { return SAPLING_AABB; } @Override - public boolean canGrow(@Nonnull World world, @Nonnull BlockPos blockPos, @Nonnull IBlockState iBlockState, boolean b) { + public boolean canGrow(@Nonnull World world, @Nonnull BlockPos blockPos, @Nonnull IBlockState iBlockState, + boolean b) { return true; } @Override - public boolean canUseBonemeal(@Nonnull World world, @Nonnull Random random, @Nonnull BlockPos blockPos, @Nonnull IBlockState iBlockState) { + public boolean canUseBonemeal(@Nonnull World world, @Nonnull Random random, @Nonnull BlockPos blockPos, + @Nonnull IBlockState iBlockState) { return true; } @Override - public boolean canBeReplacedByLeaves(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) { + public boolean canBeReplacedByLeaves(@Nonnull IBlockState state, @Nonnull IBlockAccess world, + @Nonnull BlockPos pos) { return true; } diff --git a/src/main/java/gregtech/common/blocks/wood/BlockWoodenDoor.java b/src/main/java/gregtech/common/blocks/wood/BlockWoodenDoor.java index 9411ee11177..c24e92abfc0 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockWoodenDoor.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockWoodenDoor.java @@ -1,6 +1,7 @@ package gregtech.common.blocks.wood; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.BlockDoor; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; @@ -32,7 +33,8 @@ public ItemStack getItem(World world, BlockPos pos, IBlockState state) { } @Override - public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { + public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, + int fortune) { if (state.getValue(HALF) == EnumDoorHalf.LOWER) { drops.add(itemSupplier.get()); } diff --git a/src/main/java/gregtech/common/command/CommandHand.java b/src/main/java/gregtech/common/command/CommandHand.java index e14a848e847..8a847ef8be2 100644 --- a/src/main/java/gregtech/common/command/CommandHand.java +++ b/src/main/java/gregtech/common/command/CommandHand.java @@ -11,6 +11,7 @@ import gregtech.api.util.GTLog; import gregtech.integration.RecipeCompatUtil; import gregtech.modules.GregTechModules; + import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -27,9 +28,10 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; import java.util.Set; +import javax.annotation.Nonnull; + public class CommandHand extends CommandBase { @Nonnull @@ -45,7 +47,8 @@ public String getUsage(@Nonnull ICommandSender sender) { } @Override - public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args) throws CommandException { + public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, + @Nonnull String[] args) throws CommandException { if (sender instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP) sender; ItemStack stackInHand = player.getHeldItemMainhand(); @@ -56,19 +59,21 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen } } String registryName; - ResourceLocation registryLocation = stackInHand.getItem().getRegistryName(); - if (registryLocation != null) { + ResourceLocation registryLocation = stackInHand.getItem().getRegistryName(); + if (registryLocation != null) { registryName = registryLocation.toString(); } else { registryName = "ERROR"; GTLog.logger.warn("ItemStack {} has a null registry name", stackInHand.getTranslationKey()); } ClickEvent itemNameEvent = new ClickEvent(Action.OPEN_URL, registryName); - player.sendMessage(new TextComponentTranslation("gregtech.command.hand.item_id", registryName, stackInHand.getItemDamage()) - .setStyle(new Style().setClickEvent(itemNameEvent))); + player.sendMessage(new TextComponentTranslation("gregtech.command.hand.item_id", registryName, + stackInHand.getItemDamage()) + .setStyle(new Style().setClickEvent(itemNameEvent))); IElectricItem electricItem = stackInHand.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); - IFluidHandlerItem fluidHandlerItem = stackInHand.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = stackInHand + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (electricItem != null) { player.sendMessage(new TextComponentTranslation("gregtech.command.hand.electric", electricItem.getCharge(), @@ -86,7 +91,9 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen properties.getCapacity(), Boolean.toString(properties.canFill()), Boolean.toString(properties.canDrain()))); if (contents != null) { - player.sendMessage(new TextComponentTranslation("gregtech.command.hand.fluid2", fluidName).appendSibling(new TextComponentString(" " + fluidName).setStyle(new Style().setColor(TextFormatting.GREEN))) + player.sendMessage(new TextComponentTranslation("gregtech.command.hand.fluid2", fluidName) + .appendSibling(new TextComponentString(" " + fluidName) + .setStyle(new Style().setColor(TextFormatting.GREEN))) .setStyle(getCopyStyle("", false))); } } @@ -96,26 +103,33 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen if (id != null) { String ctId = ""; ClipboardUtil.copyToClipboard(player, ctId); - player.sendMessage(new TextComponentTranslation("gregtech.command.hand.meta_item", id).appendSibling(new TextComponentString(" " + id).setStyle(new Style().setColor(TextFormatting.GREEN))) + player.sendMessage(new TextComponentTranslation("gregtech.command.hand.meta_item", id) + .appendSibling( + new TextComponentString(" " + id).setStyle(new Style().setColor(TextFormatting.GREEN))) .setStyle(getCopyStyle(ctId, true))); } // tool info if (stackInHand.getItem() instanceof IGTTool) { IGTTool tool = (IGTTool) stackInHand.getItem(); - player.sendMessage(new TextComponentTranslation("gregtech.command.hand.tool_stats", tool.getToolClasses(stackInHand))); + player.sendMessage(new TextComponentTranslation("gregtech.command.hand.tool_stats", + tool.getToolClasses(stackInHand))); } // material info MaterialStack material = OreDictUnifier.getMaterial(stackInHand); if (material != null) { - player.sendMessage(new TextComponentTranslation("gregtech.command.hand.material").appendSibling(new TextComponentString(" " + material.material).setStyle(new Style().setColor(TextFormatting.GREEN))) + player.sendMessage(new TextComponentTranslation("gregtech.command.hand.material") + .appendSibling(new TextComponentString(" " + material.material) + .setStyle(new Style().setColor(TextFormatting.GREEN))) .setStyle(getCopyStyle("", false))); } // ore prefix info OrePrefix orePrefix = OreDictUnifier.getPrefix(stackInHand); if (orePrefix != null) { - player.sendMessage(new TextComponentTranslation("gregtech.command.hand.ore_prefix").appendSibling(new TextComponentString(" " + orePrefix.name).setStyle(new Style().setColor(TextFormatting.GREEN))) + player.sendMessage(new TextComponentTranslation("gregtech.command.hand.ore_prefix") + .appendSibling(new TextComponentString(" " + orePrefix.name) + .setStyle(new Style().setColor(TextFormatting.GREEN))) .setStyle(getCopyStyle(orePrefix.name, false))); } @@ -142,10 +156,13 @@ public static Style getCopyStyle(String copyMessage, boolean alreadyCopied) { style.setClickEvent(click); ITextComponent text = alreadyCopied ? - new TextComponentString("").appendSibling(new TextComponentString(copyMessage + " ").setStyle(new Style().setColor(TextFormatting.GOLD))) + new TextComponentString("") + .appendSibling(new TextComponentString(copyMessage + " ") + .setStyle(new Style().setColor(TextFormatting.GOLD))) .appendSibling(new TextComponentTranslation("gregtech.command.copy.copied_and_click")) : new TextComponentTranslation("gregtech.command.copy.click_to_copy") - .appendSibling(new TextComponentString(" " + copyMessage).setStyle(new Style().setColor(TextFormatting.GOLD))); + .appendSibling(new TextComponentString(" " + copyMessage) + .setStyle(new Style().setColor(TextFormatting.GOLD))); style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, text)); return style; diff --git a/src/main/java/gregtech/common/command/CommandRecipeCheck.java b/src/main/java/gregtech/common/command/CommandRecipeCheck.java index b2bc3d0c2a9..68f6d17f513 100644 --- a/src/main/java/gregtech/common/command/CommandRecipeCheck.java +++ b/src/main/java/gregtech/common/command/CommandRecipeCheck.java @@ -19,10 +19,7 @@ import gregtech.common.blocks.BlockCompressed; import gregtech.common.blocks.BlockFrame; import gregtech.common.items.MetaItems; -import it.unimi.dsi.fastutil.ints.IntOpenHashSet; -import it.unimi.dsi.fastutil.ints.IntSet; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.block.Block; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; @@ -34,13 +31,19 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.ints.IntOpenHashSet; +import it.unimi.dsi.fastutil.ints.IntSet; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class CommandRecipeCheck extends CommandBase { @Nonnull @@ -79,7 +82,8 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen } } - // set amount of itemstacks to Integer.MAX_VALUE to detect conflicts only occurring if batching the recipe + // set amount of itemstacks to Integer.MAX_VALUE to detect conflicts only occurring if batching the + // recipe List inputs = new ArrayList<>(); for (GTRecipeInput input : currentRecipe.getInputs()) { for (ItemStack stack : input.getInputStacks()) { @@ -90,7 +94,8 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen } List fluidInputs = currentRecipe.getFluidInputs() - // set volume of fluids to Integer.MAX_VALUE to detect conflicts only occurring if batching the recipe + // set volume of fluids to Integer.MAX_VALUE to detect conflicts only occurring if batching the + // recipe .stream().map(stack -> new FluidStack(stack.getInputFluidStack(), Integer.MAX_VALUE)) .collect(Collectors.toList()); @@ -98,15 +103,19 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen inputs, fluidInputs); if (collidingRecipeSet == null) { - GTLog.logger.error("This recipe returned null for findRecipeCollisions: {}", prettyPrintRecipe(currentRecipe)); + GTLog.logger.error("This recipe returned null for findRecipeCollisions: {}", + prettyPrintRecipe(currentRecipe)); continue; } if (collidingRecipeSet.size() > 1) { // remove the current recipe from the list of recipes, as it's not a conflict collidingRecipeSet.remove(currentRecipe); - Object2ObjectOpenHashMap> conflictingRecipeMap = mismatchedRecipes.get(recipeMap); - // if the conflicting recipe was iterated over before, and the current recipe is in the list, remove it - collidingRecipeSet.removeIf(cf -> conflictingRecipeMap.get(cf) != null && conflictingRecipeMap.get(cf).contains(currentRecipe)); + Object2ObjectOpenHashMap> conflictingRecipeMap = mismatchedRecipes + .get(recipeMap); + // if the conflicting recipe was iterated over before, and the current recipe is in the list, remove + // it + collidingRecipeSet.removeIf(cf -> conflictingRecipeMap.get(cf) != null && + conflictingRecipeMap.get(cf).contains(currentRecipe)); if (collidingRecipeSet.size() > 0) { mismatchedRecipes.get(recipeMap).put(currentRecipe, collidingRecipeSet); } @@ -130,9 +139,11 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen if (mismatchedRecipes.size() == 0) { GTLog.logger.info("No recipe conflicts found in all recipe maps!"); } else { - count = (int) mismatchedRecipes.values().stream().mapToLong(s -> s.values().stream().mapToLong(Set::size).sum()).sum(); + count = (int) mismatchedRecipes.values().stream() + .mapToLong(s -> s.values().stream().mapToLong(Set::size).sum()).sum(); GTLog.logger.info("[Recipe Checker] Found {} potential conflicts", count); - for (Map.Entry, Object2ObjectOpenHashMap>> recipeMap : mismatchedRecipes.entrySet()) { + for (Map.Entry, Object2ObjectOpenHashMap>> recipeMap : mismatchedRecipes + .entrySet()) { GTLog.logger.error( "\n[In Recipe map] : \"{}\"", recipeMap.getKey().unlocalizedName); for (Map.Entry> reciper : mismatchedRecipes.get(recipeMap.getKey()).entrySet()) { @@ -174,7 +185,8 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen sender.sendMessage(new TextComponentTranslation("gregtech.command.recipecheck.end", count)); } if (emptyInputRecipes.size() != 0) { - sender.sendMessage(new TextComponentTranslation("gregtech.command.recipecheck.end_empty_inputs", emptyCount, emptyOreDicts.size())); + sender.sendMessage(new TextComponentTranslation("gregtech.command.recipecheck.end_empty_inputs", emptyCount, + emptyOreDicts.size())); } } @@ -287,13 +299,14 @@ public static String prettyPrintRecipeInput(GTRecipeInput recipeInput) { } public static String prettyPrintItemStack(ItemStack stack) { - if (stack.getItem() instanceof MetaItem metaItem) { + if (stack.getItem() instanceof MetaItemmetaItem) { MetaValueItem metaValueItem = metaItem.getItem(stack); if (metaValueItem == null) { if (metaItem instanceof MetaPrefixItem metaPrefixItem) { Material material = metaPrefixItem.getMaterial(stack); OrePrefix orePrefix = metaPrefixItem.getOrePrefix(); - return "(MetaItem) OrePrefix: " + orePrefix.name + ", Material: " + material + " * " + stack.getCount(); + return "(MetaItem) OrePrefix: " + orePrefix.name + ", Material: " + material + " * " + + stack.getCount(); } } else { if (MetaItems.INTEGRATED_CIRCUIT.isItemEqual(stack)) { @@ -316,7 +329,7 @@ public static String prettyPrintItemStack(ItemStack stack) { id = "block" + ((BlockCompressed) block).getGtMaterial(stack).toCamelCaseString(); } else if (block instanceof BlockFrame) { id = "frame" + ((BlockFrame) block).getGtMaterial(stack).toCamelCaseString(); - } else if (block instanceof BlockMaterialPipe blockMaterialPipe) { + } else if (block instanceof BlockMaterialPipeblockMaterialPipe) { id = blockMaterialPipe.getPrefix().name + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString(); } @@ -324,7 +337,8 @@ public static String prettyPrintItemStack(ItemStack stack) { return "(MetaBlock) " + id + " * " + stack.getCount(); } } - //noinspection ConstantConditions - return stack.getItem().getRegistryName().toString() + " * " + stack.getCount() + " (Meta " + stack.getItemDamage() + ")"; + // noinspection ConstantConditions + return stack.getItem().getRegistryName().toString() + " * " + stack.getCount() + " (Meta " + + stack.getItemDamage() + ")"; } } diff --git a/src/main/java/gregtech/common/command/CommandShaders.java b/src/main/java/gregtech/common/command/CommandShaders.java index 4cb2a3101f6..ced67002537 100644 --- a/src/main/java/gregtech/common/command/CommandShaders.java +++ b/src/main/java/gregtech/common/command/CommandShaders.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.core.network.packets.PacketReloadShaders; + import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; @@ -25,7 +26,8 @@ public String getUsage(@Nonnull ICommandSender iCommandSender) { } @Override - public void execute(@Nonnull MinecraftServer minecraftServer, @Nonnull ICommandSender iCommandSender, @Nonnull String[] strings) { + public void execute(@Nonnull MinecraftServer minecraftServer, @Nonnull ICommandSender iCommandSender, + @Nonnull String[] strings) { if (iCommandSender instanceof EntityPlayerMP) { GregTechAPI.networkHandler.sendTo(new PacketReloadShaders(), (EntityPlayerMP) iCommandSender); iCommandSender.sendMessage(new TextComponentString("Reloaded Shaders")); diff --git a/src/main/java/gregtech/common/command/worldgen/CommandWorldgenReload.java b/src/main/java/gregtech/common/command/worldgen/CommandWorldgenReload.java index ae3b37983cb..db35254e038 100644 --- a/src/main/java/gregtech/common/command/worldgen/CommandWorldgenReload.java +++ b/src/main/java/gregtech/common/command/worldgen/CommandWorldgenReload.java @@ -2,6 +2,7 @@ import gregtech.api.util.GTLog; import gregtech.api.worldgen.config.WorldGenRegistry; + import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.server.MinecraftServer; @@ -9,9 +10,10 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; -import javax.annotation.Nonnull; import java.io.IOException; +import javax.annotation.Nonnull; + public class CommandWorldgenReload extends CommandBase { @Nonnull diff --git a/src/main/java/gregtech/common/covers/CoverBehaviors.java b/src/main/java/gregtech/common/covers/CoverBehaviors.java index 72002cc4617..3e5779fb3bf 100644 --- a/src/main/java/gregtech/common/covers/CoverBehaviors.java +++ b/src/main/java/gregtech/common/covers/CoverBehaviors.java @@ -14,8 +14,10 @@ import gregtech.common.covers.filter.SmartItemFilter; import gregtech.common.items.MetaItems; import gregtech.common.items.behaviors.CoverDigitalInterfaceWirelessPlaceBehaviour; + import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; + import org.jetbrains.annotations.NotNull; import static gregtech.api.GTValues.*; @@ -29,103 +31,179 @@ private CoverBehaviors() {} public static void init() { GTLog.logger.info("Registering cover behaviors..."); - registerBehavior(gregtechId("conveyor.lv"), MetaItems.CONVEYOR_MODULE_LV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.LV, 8)); - registerBehavior(gregtechId("conveyor.mv"), MetaItems.CONVEYOR_MODULE_MV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.MV, 32)); - registerBehavior(gregtechId("conveyor.hv"), MetaItems.CONVEYOR_MODULE_HV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.HV, 64)); - registerBehavior(gregtechId("conveyor.ev"), MetaItems.CONVEYOR_MODULE_EV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.EV, 3 * 64)); - registerBehavior(gregtechId("conveyor.iv"), MetaItems.CONVEYOR_MODULE_IV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.IV, 8 * 64)); - registerBehavior(gregtechId("conveyor.luv"), MetaItems.CONVEYOR_MODULE_LuV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.LuV, 16 * 64)); - registerBehavior(gregtechId("conveyor.zpm"), MetaItems.CONVEYOR_MODULE_ZPM, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.ZPM, 16 * 64)); - registerBehavior(gregtechId("conveyor.uv"), MetaItems.CONVEYOR_MODULE_UV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UV, 16 * 64)); - - registerBehavior(gregtechId("robotic_arm.lv"), MetaItems.ROBOT_ARM_LV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.LV, 8)); - registerBehavior(gregtechId("robotic_arm.mv"), MetaItems.ROBOT_ARM_MV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.MV, 32)); - registerBehavior(gregtechId("robotic_arm.hv"), MetaItems.ROBOT_ARM_HV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.HV, 64)); - registerBehavior(gregtechId("robotic_arm.ev"), MetaItems.ROBOT_ARM_EV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.EV, 3 * 64)); - registerBehavior(gregtechId("robotic_arm.iv"), MetaItems.ROBOT_ARM_IV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.IV, 8 * 64)); - registerBehavior(gregtechId("robotic_arm.luv"), MetaItems.ROBOT_ARM_LuV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.LuV, 16 * 64)); - registerBehavior(gregtechId("robotic_arm.zpm"), MetaItems.ROBOT_ARM_ZPM, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.ZPM, 16 * 64)); - registerBehavior(gregtechId("robotic_arm.uv"), MetaItems.ROBOT_ARM_UV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UV, 16 * 64)); - - registerBehavior(gregtechId("ore_dictionary_filter"), MetaItems.ORE_DICTIONARY_FILTER, (def, tile, side) -> new CoverItemFilter(def, tile, side, "cover.ore_dictionary_filter.title", Textures.ORE_DICTIONARY_FILTER_OVERLAY, new OreDictionaryItemFilter())); - registerBehavior(gregtechId("item_filter"), MetaItems.ITEM_FILTER, (def, tile, side) -> new CoverItemFilter(def, tile, side, "cover.item_filter.title", Textures.ITEM_FILTER_FILTER_OVERLAY, new SimpleItemFilter())); - registerBehavior(gregtechId("fluid_filter"), MetaItems.FLUID_FILTER, (def, tile, side) -> new CoverFluidFilter(def, tile, side, "cover.fluid_filter.title", Textures.FLUID_FILTER_OVERLAY, new SimpleFluidFilter())); + registerBehavior(gregtechId("conveyor.lv"), MetaItems.CONVEYOR_MODULE_LV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.LV, 8)); + registerBehavior(gregtechId("conveyor.mv"), MetaItems.CONVEYOR_MODULE_MV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.MV, 32)); + registerBehavior(gregtechId("conveyor.hv"), MetaItems.CONVEYOR_MODULE_HV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.HV, 64)); + registerBehavior(gregtechId("conveyor.ev"), MetaItems.CONVEYOR_MODULE_EV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.EV, 3 * 64)); + registerBehavior(gregtechId("conveyor.iv"), MetaItems.CONVEYOR_MODULE_IV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.IV, 8 * 64)); + registerBehavior(gregtechId("conveyor.luv"), MetaItems.CONVEYOR_MODULE_LuV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.LuV, 16 * 64)); + registerBehavior(gregtechId("conveyor.zpm"), MetaItems.CONVEYOR_MODULE_ZPM, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.ZPM, 16 * 64)); + registerBehavior(gregtechId("conveyor.uv"), MetaItems.CONVEYOR_MODULE_UV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UV, 16 * 64)); + + registerBehavior(gregtechId("robotic_arm.lv"), MetaItems.ROBOT_ARM_LV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.LV, 8)); + registerBehavior(gregtechId("robotic_arm.mv"), MetaItems.ROBOT_ARM_MV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.MV, 32)); + registerBehavior(gregtechId("robotic_arm.hv"), MetaItems.ROBOT_ARM_HV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.HV, 64)); + registerBehavior(gregtechId("robotic_arm.ev"), MetaItems.ROBOT_ARM_EV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.EV, 3 * 64)); + registerBehavior(gregtechId("robotic_arm.iv"), MetaItems.ROBOT_ARM_IV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.IV, 8 * 64)); + registerBehavior(gregtechId("robotic_arm.luv"), MetaItems.ROBOT_ARM_LuV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.LuV, 16 * 64)); + registerBehavior(gregtechId("robotic_arm.zpm"), MetaItems.ROBOT_ARM_ZPM, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.ZPM, 16 * 64)); + registerBehavior(gregtechId("robotic_arm.uv"), MetaItems.ROBOT_ARM_UV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UV, 16 * 64)); + + registerBehavior(gregtechId("ore_dictionary_filter"), MetaItems.ORE_DICTIONARY_FILTER, + (def, tile, side) -> new CoverItemFilter(def, tile, side, "cover.ore_dictionary_filter.title", + Textures.ORE_DICTIONARY_FILTER_OVERLAY, new OreDictionaryItemFilter())); + registerBehavior(gregtechId("item_filter"), MetaItems.ITEM_FILTER, (def, tile, side) -> new CoverItemFilter(def, + tile, side, "cover.item_filter.title", Textures.ITEM_FILTER_FILTER_OVERLAY, new SimpleItemFilter())); + registerBehavior(gregtechId("fluid_filter"), MetaItems.FLUID_FILTER, + (def, tile, side) -> new CoverFluidFilter(def, tile, side, "cover.fluid_filter.title", + Textures.FLUID_FILTER_OVERLAY, new SimpleFluidFilter())); registerBehavior(gregtechId("shutter"), MetaItems.COVER_SHUTTER, CoverShutter::new); - registerBehavior(gregtechId("solar_panel.basic"), MetaItems.COVER_SOLAR_PANEL, (def, tile, side) -> new CoverSolarPanel(def, tile, side, 1)); - registerBehavior(gregtechId("solar_panel.ulv"), MetaItems.COVER_SOLAR_PANEL_ULV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[ULV])); - registerBehavior(gregtechId("solar_panel.lv"), MetaItems.COVER_SOLAR_PANEL_LV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[LV])); - registerBehavior(gregtechId("solar_panel.mv"), MetaItems.COVER_SOLAR_PANEL_MV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[MV])); - registerBehavior(gregtechId("solar_panel.hv"), MetaItems.COVER_SOLAR_PANEL_HV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[HV])); - registerBehavior(gregtechId("solar_panel.ev"), MetaItems.COVER_SOLAR_PANEL_EV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[EV])); - registerBehavior(gregtechId("solar_panel.iv"), MetaItems.COVER_SOLAR_PANEL_IV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[IV])); - registerBehavior(gregtechId("solar_panel.luv"), MetaItems.COVER_SOLAR_PANEL_LUV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[LuV])); - registerBehavior(gregtechId("solar_panel.zpm"), MetaItems.COVER_SOLAR_PANEL_ZPM, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[ZPM])); - registerBehavior(gregtechId("solar_panel.uv"), MetaItems.COVER_SOLAR_PANEL_UV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[UV])); - - registerBehavior(gregtechId("machine_controller"), MetaItems.COVER_MACHINE_CONTROLLER, CoverMachineController::new); - registerBehavior(gregtechId("smart_filter"), MetaItems.SMART_FILTER, (def, tile, side) -> new CoverItemFilter(def, tile, side, "cover.smart_item_filter.title", Textures.SMART_FILTER_FILTER_OVERLAY, new SmartItemFilter())); + registerBehavior(gregtechId("solar_panel.basic"), MetaItems.COVER_SOLAR_PANEL, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, 1)); + registerBehavior(gregtechId("solar_panel.ulv"), MetaItems.COVER_SOLAR_PANEL_ULV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[ULV])); + registerBehavior(gregtechId("solar_panel.lv"), MetaItems.COVER_SOLAR_PANEL_LV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[LV])); + registerBehavior(gregtechId("solar_panel.mv"), MetaItems.COVER_SOLAR_PANEL_MV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[MV])); + registerBehavior(gregtechId("solar_panel.hv"), MetaItems.COVER_SOLAR_PANEL_HV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[HV])); + registerBehavior(gregtechId("solar_panel.ev"), MetaItems.COVER_SOLAR_PANEL_EV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[EV])); + registerBehavior(gregtechId("solar_panel.iv"), MetaItems.COVER_SOLAR_PANEL_IV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[IV])); + registerBehavior(gregtechId("solar_panel.luv"), MetaItems.COVER_SOLAR_PANEL_LUV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[LuV])); + registerBehavior(gregtechId("solar_panel.zpm"), MetaItems.COVER_SOLAR_PANEL_ZPM, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[ZPM])); + registerBehavior(gregtechId("solar_panel.uv"), MetaItems.COVER_SOLAR_PANEL_UV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[UV])); + + registerBehavior(gregtechId("machine_controller"), MetaItems.COVER_MACHINE_CONTROLLER, + CoverMachineController::new); + registerBehavior(gregtechId("smart_filter"), MetaItems.SMART_FILTER, + (def, tile, side) -> new CoverItemFilter(def, tile, side, "cover.smart_item_filter.title", + Textures.SMART_FILTER_FILTER_OVERLAY, new SmartItemFilter())); registerBehavior(gregtechId("facade"), MetaItems.COVER_FACADE, CoverFacade::new); registerBehavior(gregtechId("screen"), MetaItems.COVER_SCREEN, CoverScreen::new); registerBehavior(gregtechId("energy_detector"), MetaItems.COVER_ENERGY_DETECTOR, CoverDetectorEnergy::new); - registerBehavior(gregtechId("energy_detector_advanced"), MetaItems.COVER_ENERGY_DETECTOR_ADVANCED, CoverDetectorEnergyAdvanced::new); + registerBehavior(gregtechId("energy_detector_advanced"), MetaItems.COVER_ENERGY_DETECTOR_ADVANCED, + CoverDetectorEnergyAdvanced::new); registerBehavior(gregtechId("fluid_detector"), MetaItems.COVER_FLUID_DETECTOR, CoverDetectorFluid::new); - registerBehavior(gregtechId("fluid_detector_advanced"), MetaItems.COVER_FLUID_DETECTOR_ADVANCED, CoverDetectorFluidAdvanced::new); + registerBehavior(gregtechId("fluid_detector_advanced"), MetaItems.COVER_FLUID_DETECTOR_ADVANCED, + CoverDetectorFluidAdvanced::new); registerBehavior(gregtechId("item_detector"), MetaItems.COVER_ITEM_DETECTOR, CoverDetectorItem::new); - registerBehavior(gregtechId("item_detector_advanced"), MetaItems.COVER_ITEM_DETECTOR_ADVANCED, CoverDetectorItemAdvanced::new); - registerBehavior(gregtechId("activity_detector"), MetaItems.COVER_ACTIVITY_DETECTOR, CoverDetectorActivity::new); - registerBehavior(gregtechId("activity_detector_advanced"), MetaItems.COVER_ACTIVITY_DETECTOR_ADVANCED, CoverDetectorActivityAdvanced::new); - registerBehavior(gregtechId("maintenance_detector"), MetaItems.COVER_MAINTENANCE_DETECTOR, CoverDetectorMaintenance::new); + registerBehavior(gregtechId("item_detector_advanced"), MetaItems.COVER_ITEM_DETECTOR_ADVANCED, + CoverDetectorItemAdvanced::new); + registerBehavior(gregtechId("activity_detector"), MetaItems.COVER_ACTIVITY_DETECTOR, + CoverDetectorActivity::new); + registerBehavior(gregtechId("activity_detector_advanced"), MetaItems.COVER_ACTIVITY_DETECTOR_ADVANCED, + CoverDetectorActivityAdvanced::new); + registerBehavior(gregtechId("maintenance_detector"), MetaItems.COVER_MAINTENANCE_DETECTOR, + CoverDetectorMaintenance::new); registerCover(gregtechId("crafting_table"), ItemStack.EMPTY, CoverCraftingTable::new); registerBehavior(gregtechId("infinite_water"), MetaItems.COVER_INFINITE_WATER, CoverInfiniteWater::new); registerBehavior(gregtechId("ender_fluid_link"), MetaItems.COVER_ENDER_FLUID_LINK, CoverEnderFluidLink::new); registerBehavior(gregtechId("cover.digital"), MetaItems.COVER_DIGITAL_INTERFACE, CoverDigitalInterface::new); // Custom cover behaviour - MetaItems.COVER_DIGITAL_INTERFACE_WIRELESS.addComponents(new CoverDigitalInterfaceWirelessPlaceBehaviour(registerCover(gregtechId("cover.digital.wireless"), MetaItems.COVER_DIGITAL_INTERFACE_WIRELESS.getStackForm(), CoverDigitalInterfaceWireless::new))); - - registerBehavior(gregtechId("pump.lv"), MetaItems.ELECTRIC_PUMP_LV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.LV, 1280)); - registerBehavior(gregtechId("pump.mv"), MetaItems.ELECTRIC_PUMP_MV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.MV, 1280 * 4)); - registerBehavior(gregtechId("pump.hv"), MetaItems.ELECTRIC_PUMP_HV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.HV, 1280 * 16)); - registerBehavior(gregtechId("pump.ev"), MetaItems.ELECTRIC_PUMP_EV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.EV, 1280 * 64)); - registerBehavior(gregtechId("pump.iv"), MetaItems.ELECTRIC_PUMP_IV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.IV, 1280 * 64 * 4)); - registerBehavior(gregtechId("pump.luv"), MetaItems.ELECTRIC_PUMP_LuV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.LuV, 1280 * 64 * 16)); - registerBehavior(gregtechId("pump.zpm"), MetaItems.ELECTRIC_PUMP_ZPM, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.ZPM, 1280 * 64 * 64)); - registerBehavior(gregtechId("pump.uv"), MetaItems.ELECTRIC_PUMP_UV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UV, 1280 * 64 * 64 * 4)); - - registerBehavior(gregtechId("fluid.regulator.lv"), MetaItems.FLUID_REGULATOR_LV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.LV, 1280)); - registerBehavior(gregtechId("fluid.regulator.mv"), MetaItems.FLUID_REGULATOR_MV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.MV, 1280 * 4)); - registerBehavior(gregtechId("fluid.regulator.hv"), MetaItems.FLUID_REGULATOR_HV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.HV, 1280 * 16)); - registerBehavior(gregtechId("fluid.regulator.ev"), MetaItems.FLUID_REGULATOR_EV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.EV, 1280 * 64)); - registerBehavior(gregtechId("fluid.regulator.iv"), MetaItems.FLUID_REGULATOR_IV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.IV, 1280 * 64 * 4)); - registerBehavior(gregtechId("fluid.regulator.luv"), MetaItems.FLUID_REGULATOR_LUV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.LuV, 1280 * 64 * 16)); - registerBehavior(gregtechId("fluid.regulator.zpm"), MetaItems.FLUID_REGULATOR_ZPM, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.ZPM, 1280 * 64 * 64)); - registerBehavior(gregtechId("fluid.regulator.uv"), MetaItems.FLUID_REGULATOR_UV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.UV, 1280 * 64 * 64 * 4)); + MetaItems.COVER_DIGITAL_INTERFACE_WIRELESS.addComponents( + new CoverDigitalInterfaceWirelessPlaceBehaviour(registerCover(gregtechId("cover.digital.wireless"), + MetaItems.COVER_DIGITAL_INTERFACE_WIRELESS.getStackForm(), + CoverDigitalInterfaceWireless::new))); + + registerBehavior(gregtechId("pump.lv"), MetaItems.ELECTRIC_PUMP_LV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.LV, 1280)); + registerBehavior(gregtechId("pump.mv"), MetaItems.ELECTRIC_PUMP_MV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.MV, 1280 * 4)); + registerBehavior(gregtechId("pump.hv"), MetaItems.ELECTRIC_PUMP_HV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.HV, 1280 * 16)); + registerBehavior(gregtechId("pump.ev"), MetaItems.ELECTRIC_PUMP_EV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.EV, 1280 * 64)); + registerBehavior(gregtechId("pump.iv"), MetaItems.ELECTRIC_PUMP_IV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.IV, 1280 * 64 * 4)); + registerBehavior(gregtechId("pump.luv"), MetaItems.ELECTRIC_PUMP_LuV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.LuV, 1280 * 64 * 16)); + registerBehavior(gregtechId("pump.zpm"), MetaItems.ELECTRIC_PUMP_ZPM, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.ZPM, 1280 * 64 * 64)); + registerBehavior(gregtechId("pump.uv"), MetaItems.ELECTRIC_PUMP_UV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UV, 1280 * 64 * 64 * 4)); + + registerBehavior(gregtechId("fluid.regulator.lv"), MetaItems.FLUID_REGULATOR_LV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.LV, 1280)); + registerBehavior(gregtechId("fluid.regulator.mv"), MetaItems.FLUID_REGULATOR_MV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.MV, 1280 * 4)); + registerBehavior(gregtechId("fluid.regulator.hv"), MetaItems.FLUID_REGULATOR_HV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.HV, 1280 * 16)); + registerBehavior(gregtechId("fluid.regulator.ev"), MetaItems.FLUID_REGULATOR_EV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.EV, 1280 * 64)); + registerBehavior(gregtechId("fluid.regulator.iv"), MetaItems.FLUID_REGULATOR_IV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.IV, 1280 * 64 * 4)); + registerBehavior(gregtechId("fluid.regulator.luv"), MetaItems.FLUID_REGULATOR_LUV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.LuV, 1280 * 64 * 16)); + registerBehavior(gregtechId("fluid.regulator.zpm"), MetaItems.FLUID_REGULATOR_ZPM, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.ZPM, 1280 * 64 * 64)); + registerBehavior(gregtechId("fluid.regulator.uv"), MetaItems.FLUID_REGULATOR_UV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.UV, 1280 * 64 * 64 * 4)); // UHV+ - registerBehavior(gregtechId("conveyor.uhv"), MetaItems.CONVEYOR_MODULE_UHV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UHV, 16 * 64)); - registerBehavior(gregtechId("conveyor.uev"), MetaItems.CONVEYOR_MODULE_UEV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UEV, 16 * 64)); - registerBehavior(gregtechId("conveyor.uiv"), MetaItems.CONVEYOR_MODULE_UIV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UIV, 16 * 64)); - registerBehavior(gregtechId("conveyor.uxv"), MetaItems.CONVEYOR_MODULE_UXV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UXV, 16 * 64)); - registerBehavior(gregtechId("conveyor.opv"), MetaItems.CONVEYOR_MODULE_OpV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.OpV, 16 * 64)); - - registerBehavior(gregtechId("robotic_arm.uhv"), MetaItems.ROBOT_ARM_UHV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UHV, 16 * 64)); - registerBehavior(gregtechId("robotic_arm.uev"), MetaItems.ROBOT_ARM_UEV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UEV, 16 * 64)); - registerBehavior(gregtechId("robotic_arm.uiv"), MetaItems.ROBOT_ARM_UIV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UIV, 16 * 64)); - registerBehavior(gregtechId("robotic_arm.uxv"), MetaItems.ROBOT_ARM_UXV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UXV, 16 * 64)); - registerBehavior(gregtechId("robotic_arm.opv"), MetaItems.ROBOT_ARM_OpV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.OpV, 16 * 64)); - - registerBehavior(gregtechId("pump.uhv"), MetaItems.ELECTRIC_PUMP_UHV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UHV, 1280 * 64 * 64 * 4)); - registerBehavior(gregtechId("pump.uev"), MetaItems.ELECTRIC_PUMP_UEV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UEV, 1280 * 64 * 64 * 4)); - registerBehavior(gregtechId("pump.uiv"), MetaItems.ELECTRIC_PUMP_UIV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UIV, 1280 * 64 * 64 * 4)); - registerBehavior(gregtechId("pump.uxv"), MetaItems.ELECTRIC_PUMP_UXV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UXV, 1280 * 64 * 64 * 4)); - registerBehavior(gregtechId("pump.opv"), MetaItems.ELECTRIC_PUMP_OpV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.OpV, 1280 * 64 * 64 * 4)); + registerBehavior(gregtechId("conveyor.uhv"), MetaItems.CONVEYOR_MODULE_UHV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UHV, 16 * 64)); + registerBehavior(gregtechId("conveyor.uev"), MetaItems.CONVEYOR_MODULE_UEV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UEV, 16 * 64)); + registerBehavior(gregtechId("conveyor.uiv"), MetaItems.CONVEYOR_MODULE_UIV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UIV, 16 * 64)); + registerBehavior(gregtechId("conveyor.uxv"), MetaItems.CONVEYOR_MODULE_UXV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UXV, 16 * 64)); + registerBehavior(gregtechId("conveyor.opv"), MetaItems.CONVEYOR_MODULE_OpV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.OpV, 16 * 64)); + + registerBehavior(gregtechId("robotic_arm.uhv"), MetaItems.ROBOT_ARM_UHV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UHV, 16 * 64)); + registerBehavior(gregtechId("robotic_arm.uev"), MetaItems.ROBOT_ARM_UEV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UEV, 16 * 64)); + registerBehavior(gregtechId("robotic_arm.uiv"), MetaItems.ROBOT_ARM_UIV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UIV, 16 * 64)); + registerBehavior(gregtechId("robotic_arm.uxv"), MetaItems.ROBOT_ARM_UXV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UXV, 16 * 64)); + registerBehavior(gregtechId("robotic_arm.opv"), MetaItems.ROBOT_ARM_OpV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.OpV, 16 * 64)); + + registerBehavior(gregtechId("pump.uhv"), MetaItems.ELECTRIC_PUMP_UHV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UHV, 1280 * 64 * 64 * 4)); + registerBehavior(gregtechId("pump.uev"), MetaItems.ELECTRIC_PUMP_UEV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UEV, 1280 * 64 * 64 * 4)); + registerBehavior(gregtechId("pump.uiv"), MetaItems.ELECTRIC_PUMP_UIV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UIV, 1280 * 64 * 64 * 4)); + registerBehavior(gregtechId("pump.uxv"), MetaItems.ELECTRIC_PUMP_UXV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UXV, 1280 * 64 * 64 * 4)); + registerBehavior(gregtechId("pump.opv"), MetaItems.ELECTRIC_PUMP_OpV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.OpV, 1280 * 64 * 64 * 4)); registerBehavior(gregtechId("fluid_voiding"), MetaItems.COVER_FLUID_VOIDING, CoverFluidVoiding::new); - registerBehavior(gregtechId("fluid_voiding.advanced"), MetaItems.COVER_FLUID_VOIDING_ADVANCED, CoverFluidVoidingAdvanced::new); + registerBehavior(gregtechId("fluid_voiding.advanced"), MetaItems.COVER_FLUID_VOIDING_ADVANCED, + CoverFluidVoidingAdvanced::new); registerBehavior(gregtechId("item_voiding"), MetaItems.COVER_ITEM_VOIDING, CoverItemVoiding::new); - registerBehavior(gregtechId("item_voiding.advanced"), MetaItems.COVER_ITEM_VOIDING_ADVANCED, CoverItemVoidingAdvanced::new); + registerBehavior(gregtechId("item_voiding.advanced"), MetaItems.COVER_ITEM_VOIDING_ADVANCED, + CoverItemVoidingAdvanced::new); registerBehavior(gregtechId("storage"), MetaItems.COVER_STORAGE, CoverStorage::new); } @@ -138,7 +216,8 @@ public static void init() { */ public static void registerBehavior(@NotNull ResourceLocation coverId, @NotNull MetaValueItem placerItem, @NotNull CoverDefinition.CoverCreator behaviorCreator) { - placerItem.addComponents(new CoverItemBehavior(registerCover(coverId, placerItem.getStackForm(), behaviorCreator))); + placerItem.addComponents( + new CoverItemBehavior(registerCover(coverId, placerItem.getStackForm(), behaviorCreator))); } /** @@ -149,7 +228,8 @@ public static void registerBehavior(@NotNull ResourceLocation coverId, @NotNull * @param behaviorCreator a function creating the cover behavior * @return the registered cover definition */ - public static @NotNull CoverDefinition registerCover(@NotNull ResourceLocation coverId, @NotNull ItemStack itemStack, + public static @NotNull CoverDefinition registerCover(@NotNull ResourceLocation coverId, + @NotNull ItemStack itemStack, @NotNull CoverDefinition.CoverCreator behaviorCreator) { CoverDefinition coverDefinition = new CoverDefinition(coverId, behaviorCreator, itemStack); GregTechAPI.COVER_REGISTRY.register(rollingId++, coverId, coverDefinition); diff --git a/src/main/java/gregtech/common/covers/CoverConveyor.java b/src/main/java/gregtech/common/covers/CoverConveyor.java index e666591730b..c92346bafcc 100644 --- a/src/main/java/gregtech/common/covers/CoverConveyor.java +++ b/src/main/java/gregtech/common/covers/CoverConveyor.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -23,11 +18,7 @@ import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.covers.filter.ItemFilterContainer; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -42,13 +33,25 @@ import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.Map; import java.util.Set; +import javax.annotation.Nonnull; + public class CoverConveyor extends CoverBase implements CoverWithUI, ITickable, IControllable { public final int tier; @@ -140,7 +143,8 @@ public void update() { if (timer % 5 == 0 && isWorkingAllowed && itemsLeftToTransferLastSecond > 0) { EnumFacing side = getAttachedSide(); TileEntity tileEntity = coverable.getNeighbor(side); - IItemHandler itemHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()); + IItemHandler itemHandler = tileEntity == null ? null : + tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()); IItemHandler myItemHandler = coverable.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side); if (itemHandler != null && myItemHandler != null) { int totalTransferred = doTransferItems(itemHandler, myItemHandler, itemsLeftToTransferLastSecond); @@ -165,7 +169,8 @@ protected int doTransferItemsAny(IItemHandler itemHandler, IItemHandler myItemHa return 0; } - protected int doTransferItemsByGroup(IItemHandler itemHandler, IItemHandler myItemHandler, Map itemInfos, int maxTransferAmount) { + protected int doTransferItemsByGroup(IItemHandler itemHandler, IItemHandler myItemHandler, + Map itemInfos, int maxTransferAmount) { if (conveyorMode == ConveyorMode.IMPORT) { return moveInventoryItems(itemHandler, myItemHandler, itemInfos, maxTransferAmount); } else if (conveyorMode == ConveyorMode.EXPORT) { @@ -174,7 +179,8 @@ protected int doTransferItemsByGroup(IItemHandler itemHandler, IItemHandler myIt return 0; } - protected Map doCountDestinationInventoryItemsByMatchIndex(IItemHandler itemHandler, IItemHandler myItemHandler) { + protected Map doCountDestinationInventoryItemsByMatchIndex(IItemHandler itemHandler, + IItemHandler myItemHandler) { if (conveyorMode == ConveyorMode.IMPORT) { return countInventoryItemsByMatchSlot(myItemHandler); } else if (conveyorMode == ConveyorMode.EXPORT) { @@ -183,7 +189,8 @@ protected Map doCountDestinationInventoryItemsByMatchInde return Collections.emptyMap(); } - protected Map doCountSourceInventoryItemsByType(IItemHandler itemHandler, IItemHandler myItemHandler) { + protected Map doCountSourceInventoryItemsByType(IItemHandler itemHandler, + IItemHandler myItemHandler) { if (conveyorMode == ConveyorMode.IMPORT) { return countInventoryItemsByType(itemHandler); } else if (conveyorMode == ConveyorMode.EXPORT) { @@ -192,7 +199,8 @@ protected Map doCountSourceInventoryItemsByType(IItemHa return Collections.emptyMap(); } - protected boolean doTransferItemsExact(IItemHandler itemHandler, IItemHandler myItemHandler, TypeItemInfo itemInfo) { + protected boolean doTransferItemsExact(IItemHandler itemHandler, IItemHandler myItemHandler, + TypeItemInfo itemInfo) { if (conveyorMode == ConveyorMode.IMPORT) { return moveInventoryItemsExact(itemHandler, myItemHandler, itemInfo); } else if (conveyorMode == ConveyorMode.EXPORT) { @@ -201,10 +209,11 @@ protected boolean doTransferItemsExact(IItemHandler itemHandler, IItemHandler my return false; } - protected static boolean moveInventoryItemsExact(IItemHandler sourceInventory, IItemHandler targetInventory, TypeItemInfo itemInfo) { - //first, compute how much can we extract in reality from the machine, - //because totalCount is based on what getStackInSlot returns, which may differ from what - //extractItem() will return + protected static boolean moveInventoryItemsExact(IItemHandler sourceInventory, IItemHandler targetInventory, + TypeItemInfo itemInfo) { + // first, compute how much can we extract in reality from the machine, + // because totalCount is based on what getStackInSlot returns, which may differ from what + // extractItem() will return ItemStack resultStack = itemInfo.itemStack.copy(); int totalExtractedCount = 0; int itemsLeftToExtract = itemInfo.totalCount; @@ -222,25 +231,25 @@ protected static boolean moveInventoryItemsExact(IItemHandler sourceInventory, I break; } } - //if amount of items extracted is not equal to the amount of items we - //wanted to extract, abort item extraction + // if amount of items extracted is not equal to the amount of items we + // wanted to extract, abort item extraction if (totalExtractedCount != itemInfo.totalCount) { return false; } - //adjust size of the result stack accordingly + // adjust size of the result stack accordingly resultStack.setCount(totalExtractedCount); - //now, see how much we can insert into destination inventory - //if we can't insert as much as itemInfo requires, and remainder is empty, abort, abort + // now, see how much we can insert into destination inventory + // if we can't insert as much as itemInfo requires, and remainder is empty, abort, abort ItemStack remainder = GTTransferUtils.insertItem(targetInventory, resultStack, true); if (!remainder.isEmpty()) { return false; } - //otherwise, perform real insertion and then remove items from the source inventory + // otherwise, perform real insertion and then remove items from the source inventory GTTransferUtils.insertItem(targetInventory, resultStack, false); - //perform real extraction of the items from the source inventory now + // perform real extraction of the items from the source inventory now itemsLeftToExtract = itemInfo.totalCount; for (int i = 0; i < itemInfo.slots.size(); i++) { int slotIndex = itemInfo.slots.get(i); @@ -257,7 +266,8 @@ protected static boolean moveInventoryItemsExact(IItemHandler sourceInventory, I return true; } - protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targetInventory, Map itemInfos, int maxTransferAmount) { + protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targetInventory, + Map itemInfos, int maxTransferAmount) { int itemsLeftToTransfer = maxTransferAmount; for (int i = 0; i < sourceInventory.getSlots(); i++) { ItemStack itemStack = sourceInventory.getStackInSlot(i); @@ -271,7 +281,8 @@ protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targ GroupItemInfo itemInfo = itemInfos.get(matchSlotIndex); - ItemStack extractedStack = sourceInventory.extractItem(i, Math.min(itemInfo.totalCount, itemsLeftToTransfer), true); + ItemStack extractedStack = sourceInventory.extractItem(i, + Math.min(itemInfo.totalCount, itemsLeftToTransfer), true); ItemStack remainderStack = GTTransferUtils.insertItem(targetInventory, extractedStack, true); int amountToInsert = extractedStack.getCount() - remainderStack.getCount(); @@ -300,7 +311,8 @@ protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targ return maxTransferAmount - itemsLeftToTransfer; } - protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targetInventory, int maxTransferAmount) { + protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targetInventory, + int maxTransferAmount) { int itemsLeftToTransfer = maxTransferAmount; for (int srcIndex = 0; srcIndex < sourceInventory.getSlots(); srcIndex++) { ItemStack sourceStack = sourceInventory.extractItem(srcIndex, itemsLeftToTransfer, true); @@ -329,6 +341,7 @@ protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targ } protected static class TypeItemInfo { + public final ItemStack itemStack; public final Object filterSlot; public final IntList slots; @@ -343,6 +356,7 @@ public TypeItemInfo(ItemStack itemStack, Object filterSlot, IntList slots, int t } protected static class GroupItemInfo { + public final Object filterSlot; public final Set itemStackTypes; public int totalCount; @@ -356,7 +370,8 @@ public GroupItemInfo(Object filterSlot, Set itemStackTypes, int total @Nonnull protected Map countInventoryItemsByType(@Nonnull IItemHandler inventory) { - Map result = new Object2ObjectOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + Map result = new Object2ObjectOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); for (int srcIndex = 0; srcIndex < inventory.getSlots(); srcIndex++) { ItemStack itemStack = inventory.getStackInSlot(srcIndex); if (itemStack.isEmpty()) { @@ -393,7 +408,8 @@ protected Map countInventoryItemsByMatchSlot(@Nonnull IIt continue; } if (!result.containsKey(transferSlotIndex)) { - GroupItemInfo itemInfo = new GroupItemInfo(transferSlotIndex, new ObjectOpenCustomHashSet<>(ItemStackHashStrategy.comparingAllButCount()), 0); + GroupItemInfo itemInfo = new GroupItemInfo(transferSlotIndex, + new ObjectOpenCustomHashSet<>(ItemStackHashStrategy.comparingAllButCount()), 0); itemInfo.itemStackTypes.add(itemStack.copy()); itemInfo.totalCount += itemStack.getCount(); result.put(transferSlotIndex, itemInfo); @@ -422,16 +438,19 @@ public void onRemoval() { } @Override - public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) { + public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 plateBox, BlockRenderLayer layer) { if (conveyorMode == ConveyorMode.EXPORT) { Textures.CONVEYOR_OVERLAY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } else { - Textures.CONVEYOR_OVERLAY_INVERTED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); + Textures.CONVEYOR_OVERLAY_INVERTED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, + translation); } } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getCoverableView().getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -478,26 +497,26 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(new ImageWidget(40, 20, 96, 20, GuiTextures.DISPLAY)); primaryGroup.addWidget(new TextFieldWidget2(42, 26, 92, 20, () -> String.valueOf(transferRate), val -> { - if (val != null && !val.isEmpty()) - setTransferRate(MathHelper.clamp(Integer.parseInt(val), 1, maxItemTransferRate)); - }) - .setNumbersOnly(1, maxItemTransferRate) - .setMaxLength(4) - .setPostFix("cover.conveyor.transfer_rate") - ); + if (val != null && !val.isEmpty()) + setTransferRate(MathHelper.clamp(Integer.parseInt(val), 1, maxItemTransferRate)); + }) + .setNumbersOnly(1, maxItemTransferRate) + .setMaxLength(4) + .setPostFix("cover.conveyor.transfer_rate")); primaryGroup.addWidget(new CycleButtonWidget(10, 45, 75, 20, ConveyorMode.class, this::getConveyorMode, this::setConveyorMode)); primaryGroup.addWidget(new CycleButtonWidget(7, 166, 116, 20, ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) - .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); + .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); if (getTileEntityHere() instanceof TileEntityItemPipe || getNeighbor(getAttachedSide()) instanceof TileEntityItemPipe) { - final ImageCycleButtonWidget distributionModeButton = new ImageCycleButtonWidget(149, 166, 20, 20, GuiTextures.DISTRIBUTION_MODE, 3, + final ImageCycleButtonWidget distributionModeButton = new ImageCycleButtonWidget(149, 166, 20, 20, + GuiTextures.DISTRIBUTION_MODE, 3, () -> distributionMode.ordinal(), val -> setDistributionMode(DistributionMode.values()[val])) - .setTooltipHoverString(val -> DistributionMode.values()[val].getName()); + .setTooltipHoverString(val -> DistributionMode.values()[val].getName()); primaryGroup.addWidget(distributionModeButton); } @@ -571,6 +590,7 @@ public void readFromNBT(@NotNull NBTTagCompound tagCompound) { } public enum ConveyorMode implements IStringSerializable, IIOMode { + IMPORT("cover.conveyor.mode.import"), EXPORT("cover.conveyor.mode.export"); @@ -604,7 +624,8 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate if (conveyorMode == ConveyorMode.EXPORT && manualImportExportMode == ManualImportExportMode.DISABLED) { return stack; } - if (manualImportExportMode == ManualImportExportMode.FILTERED && !itemFilterContainer.testItemStack(stack)) { + if (manualImportExportMode == ManualImportExportMode.FILTERED && + !itemFilterContainer.testItemStack(stack)) { return stack; } return super.insertItem(slot, stack, simulate); diff --git a/src/main/java/gregtech/common/covers/CoverCraftingTable.java b/src/main/java/gregtech/common/covers/CoverCraftingTable.java index 8f73b5185ed..902873c7ffa 100644 --- a/src/main/java/gregtech/common/covers/CoverCraftingTable.java +++ b/src/main/java/gregtech/common/covers/CoverCraftingTable.java @@ -1,14 +1,11 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GregTechAPI; import gregtech.api.cover.*; import gregtech.api.util.GTTransferUtils; import gregtech.api.util.GTUtility; import gregtech.common.inventory.handlers.ToolItemStackHandler; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockRenderLayer; @@ -17,6 +14,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -38,7 +40,8 @@ public class CoverCraftingTable extends CoverBase implements ITickable { private final ItemStackHandler internalInventory = new ItemStackHandler(18); private final ItemStackHandler toolInventory = new ToolItemStackHandler(9); - public CoverCraftingTable(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverCraftingTable(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -53,7 +56,8 @@ public boolean shouldAutoConnectToPipes() { } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) {} + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) {} @Override public void update() { diff --git a/src/main/java/gregtech/common/covers/CoverDigitalInterface.java b/src/main/java/gregtech/common/covers/CoverDigitalInterface.java index 8ea20311664..0a04343acde 100644 --- a/src/main/java/gregtech/common/covers/CoverDigitalInterface.java +++ b/src/main/java/gregtech/common/covers/CoverDigitalInterface.java @@ -1,11 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Rotation; import gregtech.api.capability.*; import gregtech.api.capability.impl.*; import gregtech.api.cover.CoverBase; @@ -25,6 +19,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.RenderUtil; import gregtech.common.terminal.app.prospector.widget.WidgetOreList; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -56,6 +51,13 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Rotation; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -69,16 +71,19 @@ public class CoverDigitalInterface extends CoverBase implements IFastRenderMetaTileEntity, ITickable, CoverWithUI { - public CoverDigitalInterface(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDigitalInterface(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } public enum MODE { + FLUID, ITEM, ENERGY, MACHINE, PROXY; + public static MODE[] VALUES; static { @@ -106,7 +111,7 @@ public enum MODE { protected int slot = 0; protected MODE mode = MODE.PROXY; protected EnumFacing spin = EnumFacing.NORTH; - protected final int[] proxyMode = new int[]{0, 0, 0, 0}; // server-only + protected final int[] proxyMode = new int[] { 0, 0, 0, 0 }; // server-only public MODE getMode() { return mode; @@ -204,7 +209,8 @@ public void writeToNBT(NBTTagCompound tagCompound) { public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); this.mode = tagCompound.hasKey("cdiMode") ? MODE.VALUES[tagCompound.getByte("cdiMode")] : MODE.PROXY; - this.spin = tagCompound.hasKey("cdiSpin") ? EnumFacing.byIndex(tagCompound.getByte("cdiSpin")) : EnumFacing.NORTH; + this.spin = tagCompound.hasKey("cdiSpin") ? EnumFacing.byIndex(tagCompound.getByte("cdiSpin")) : + EnumFacing.NORTH; this.slot = tagCompound.hasKey("cdiSlot") ? tagCompound.getInteger("cdiSlot") : 0; this.proxyMode[0] = tagCompound.hasKey("cdi0") ? tagCompound.getInteger("cdi0") : 0; this.proxyMode[1] = tagCompound.hasKey("cdi1") ? tagCompound.getInteger("cdi1") : 0; @@ -213,7 +219,8 @@ public void readFromNBT(NBTTagCompound tagCompound) { } @Override - public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { + public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, + @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { if (getFluidCapability() != null) { fluids = new FluidTankProperties[getFluidCapability().getTankProperties().length]; this.mode = MODE.FLUID; @@ -283,13 +290,14 @@ public void readInitialSyncData(@NotNull PacketBuffer packetBuffer) { @Override public void update() { - if (!isRemote() && getOffsetTimer() % 2 ==0) { + if (!isRemote() && getOffsetTimer() % 2 == 0) { syncAllInfo(); } } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!this.getWorld().isRemote) { this.openUI((EntityPlayerMP) playerIn); } @@ -297,9 +305,11 @@ public void update() { } @Override - public @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult rayTraceResult) { + public @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult rayTraceResult) { if (!isRemote()) { - if (this.getWorld().getTotalWorldTime() - lastClickTime < 2 && playerIn.getPersistentID().equals(lastClickUUID)) { + if (this.getWorld().getTotalWorldTime() - lastClickTime < 2 && + playerIn.getPersistentID().equals(lastClickUUID)) { return EnumActionResult.SUCCESS; } lastClickTime = this.getWorld().getTotalWorldTime(); @@ -307,7 +317,7 @@ public void update() { if (playerIn.isSneaking() && playerIn.getHeldItemMainhand().isEmpty()) { if (rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK) { int maxSlotLimit = Integer.MAX_VALUE; - if(this.getCoverableView() instanceof MetaTileEntity metaTileEntity) { + if (this.getCoverableView() instanceof MetaTileEntity metaTileEntity) { maxSlotLimit = this.mode == MODE.ITEM ? metaTileEntity.getImportItems().getSlots() : metaTileEntity.getImportFluids().getTanks(); } @@ -339,7 +349,8 @@ public void update() { @Override public boolean onLeftClick(@NotNull EntityPlayer entityPlayer, @NotNull CuboidRayTraceResult hitResult) { if (!isRemote()) { - if (this.getWorld().getTotalWorldTime() - lastClickTime < 2 && entityPlayer.getPersistentID().equals(lastClickUUID)) { + if (this.getWorld().getTotalWorldTime() - lastClickTime < 2 && + entityPlayer.getPersistentID().equals(lastClickUUID)) { return true; } lastClickTime = this.getWorld().getTotalWorldTime(); @@ -353,7 +364,8 @@ public EnumActionResult modeRightClick(EntityPlayer playerIn, EnumHand hand, MOD IFluidHandler fluidHandler = this.getFluidCapability(); if (mode == MODE.FLUID && fluidHandler != null) { if (!FluidUtil.interactWithFluidHandler(playerIn, hand, fluidHandler)) { - if (fluidHandler instanceof FluidHandlerProxy && FluidUtil.interactWithFluidHandler(playerIn, hand, ((FluidHandlerProxy) fluidHandler).input)) { + if (fluidHandler instanceof FluidHandlerProxy && + FluidUtil.interactWithFluidHandler(playerIn, hand, ((FluidHandlerProxy) fluidHandler).input)) { return EnumActionResult.SUCCESS; } return EnumActionResult.PASS; @@ -414,7 +426,8 @@ public boolean modeLeftClick(EntityPlayer entityPlayer, MODE mode, int slot) { itemStack = itemHandler.extractItem(slot, 1, false); } if (itemStack.isEmpty() && itemHandler instanceof ItemHandlerProxy) { - IItemHandler insertHandler = ObfuscationReflectionHelper.getPrivateValue(ItemHandlerProxy.class, (ItemHandlerProxy) itemHandler, "insertHandler"); + IItemHandler insertHandler = ObfuscationReflectionHelper.getPrivateValue(ItemHandlerProxy.class, + (ItemHandlerProxy) itemHandler, "insertHandler"); if (slot < insertHandler.getSlots()) { if (entityPlayer.isSneaking()) { itemStack = insertHandler.extractItem(slot, 64, false); @@ -424,7 +437,8 @@ public boolean modeLeftClick(EntityPlayer entityPlayer, MODE mode, int slot) { } } if (!itemStack.isEmpty()) { - EntityItem entity = new EntityItem(entityPlayer.world, entityPlayer.posX + .5f, entityPlayer.posY + .3f, entityPlayer.posZ + .5f, itemStack); + EntityItem entity = new EntityItem(entityPlayer.world, entityPlayer.posX + .5f, + entityPlayer.posY + .3f, entityPlayer.posZ + .5f, itemStack); entity.addVelocity(-entity.motionX, -entity.motionY, -entity.motionZ); entityPlayer.world.spawnEntity(entity); } @@ -439,21 +453,26 @@ public ModularUI createUI(EntityPlayer player) { WidgetGroup primaryGroup = new WidgetGroup(new Position(0, 10)); primaryGroup.addWidget(new LabelWidget(10, 5, "metaitem.cover.digital.name", 0)); ToggleButtonWidget[] buttons = new ToggleButtonWidget[5]; - buttons[0] = new ToggleButtonWidget(40, 20, 20, 20, GuiTextures.BUTTON_FLUID, () -> this.mode == MODE.FLUID, (pressed) -> { - if (pressed) setMode(MODE.FLUID); - }).setTooltipText("metaitem.cover.digital.mode.fluid"); - buttons[1] = new ToggleButtonWidget(60, 20, 20, 20, GuiTextures.BUTTON_ITEM, () -> this.mode == MODE.ITEM, (pressed) -> { - if (pressed) setMode(MODE.ITEM); - }).setTooltipText("metaitem.cover.digital.mode.item"); - buttons[2] = new ToggleButtonWidget(80, 20, 20, 20, GuiTextures.BUTTON_ENERGY, () -> this.mode == MODE.ENERGY, (pressed) -> { - if (pressed) setMode(MODE.ENERGY); - }).setTooltipText("metaitem.cover.digital.mode.energy"); - buttons[3] = new ToggleButtonWidget(100, 20, 20, 20, GuiTextures.BUTTON_MACHINE, () -> this.mode == MODE.MACHINE, (pressed) -> { - if (pressed) setMode(MODE.MACHINE); - }).setTooltipText("metaitem.cover.digital.mode.machine"); - buttons[4] = new ToggleButtonWidget(140, 20, 20, 20, GuiTextures.BUTTON_INTERFACE, () -> this.mode == MODE.PROXY, (pressed) -> { - if (pressed) setMode(MODE.PROXY); - }).setTooltipText("metaitem.cover.digital.mode.proxy"); + buttons[0] = new ToggleButtonWidget(40, 20, 20, 20, GuiTextures.BUTTON_FLUID, () -> this.mode == MODE.FLUID, + (pressed) -> { + if (pressed) setMode(MODE.FLUID); + }).setTooltipText("metaitem.cover.digital.mode.fluid"); + buttons[1] = new ToggleButtonWidget(60, 20, 20, 20, GuiTextures.BUTTON_ITEM, () -> this.mode == MODE.ITEM, + (pressed) -> { + if (pressed) setMode(MODE.ITEM); + }).setTooltipText("metaitem.cover.digital.mode.item"); + buttons[2] = new ToggleButtonWidget(80, 20, 20, 20, GuiTextures.BUTTON_ENERGY, () -> this.mode == MODE.ENERGY, + (pressed) -> { + if (pressed) setMode(MODE.ENERGY); + }).setTooltipText("metaitem.cover.digital.mode.energy"); + buttons[3] = new ToggleButtonWidget(100, 20, 20, 20, GuiTextures.BUTTON_MACHINE, + () -> this.mode == MODE.MACHINE, (pressed) -> { + if (pressed) setMode(MODE.MACHINE); + }).setTooltipText("metaitem.cover.digital.mode.machine"); + buttons[4] = new ToggleButtonWidget(140, 20, 20, 20, GuiTextures.BUTTON_INTERFACE, + () -> this.mode == MODE.PROXY, (pressed) -> { + if (pressed) setMode(MODE.PROXY); + }).setTooltipText("metaitem.cover.digital.mode.proxy"); primaryGroup.addWidget(new LabelWidget(10, 25, "metaitem.cover.digital.title.mode", 0)); primaryGroup.addWidget(buttons[0]); primaryGroup.addWidget(buttons[1]); @@ -462,8 +481,10 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(buttons[4]); primaryGroup.addWidget(new LabelWidget(10, 50, "monitor.gui.title.slot", 0)); - primaryGroup.addWidget(new ClickButtonWidget(40, 45, 20, 20, "-1", (data) -> setMode(slot - (data.isShiftClick ? 10 : 1)))); - primaryGroup.addWidget(new ClickButtonWidget(140, 45, 20, 20, "+1", (data) -> setMode(slot + (data.isShiftClick ? 10 : 1)))); + primaryGroup.addWidget( + new ClickButtonWidget(40, 45, 20, 20, "-1", (data) -> setMode(slot - (data.isShiftClick ? 10 : 1)))); + primaryGroup.addWidget( + new ClickButtonWidget(140, 45, 20, 20, "+1", (data) -> setMode(slot + (data.isShiftClick ? 10 : 1)))); primaryGroup.addWidget(new ImageWidget(60, 45, 80, 20, GuiTextures.DISPLAY)); primaryGroup.addWidget(new SimpleTextWidget(100, 55, "", 16777215, () -> Integer.toString(this.slot))); @@ -471,7 +492,8 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(new ClickButtonWidget(40, 70, 20, 20, "R", (data) -> setMode(this.spin.rotateY()))); primaryGroup.addWidget(new ImageWidget(60, 70, 80, 20, GuiTextures.DISPLAY)); primaryGroup.addWidget(new SimpleTextWidget(100, 80, "", 16777215, () -> this.spin.toString())); - ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 202).widget(primaryGroup).bindPlayerInventory(player.inventory, GuiTextures.SLOT, 8, 120); + ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 202).widget(primaryGroup) + .bindPlayerInventory(player.inventory, GuiTextures.SLOT, 8, 120); return builder.build(this, player); } @@ -488,20 +510,26 @@ private void syncAllInfo() { List toUpdate = new ArrayList<>(); for (int i = 0; i < fluidTankProperties.length; i++) { FluidStack content = fluidTankProperties[i].getContents(); - if (fluids[i] == null || (content == null && fluids[i].getContents() != null) || (content != null && fluids[i].getContents() == null) || + if (fluids[i] == null || (content == null && fluids[i].getContents() != null) || + (content != null && fluids[i].getContents() == null) || fluidTankProperties[i].getCapacity() != fluids[i].getCapacity() || fluidTankProperties[i].canDrain() != fluids[i].canDrain() || fluidTankProperties[i].canFill() != fluids[i].canFill()) { syncFlag = true; - fluids[i] = new FluidTankProperties(content, fluidTankProperties[i].getCapacity(), fluidTankProperties[i].canFill(), fluidTankProperties[i].canDrain()); - toUpdate.add(i); - } else if (content != null && (fluids[i] != null && fluids[i].getContents() != null && (content.amount != fluids[i].getContents().amount || !content.isFluidEqual(fluids[i].getContents())))) { - syncFlag = true; - fluids[i] = new FluidTankProperties(content, fluidTankProperties[i].getCapacity(), fluidTankProperties[i].canFill(), fluidTankProperties[i].canDrain()); + fluids[i] = new FluidTankProperties(content, fluidTankProperties[i].getCapacity(), + fluidTankProperties[i].canFill(), fluidTankProperties[i].canDrain()); toUpdate.add(i); - } + } else if (content != null && (fluids[i] != null && fluids[i].getContents() != null && + (content.amount != fluids[i].getContents().amount || + !content.isFluidEqual(fluids[i].getContents())))) { + syncFlag = true; + fluids[i] = new FluidTankProperties(content, + fluidTankProperties[i].getCapacity(), fluidTankProperties[i].canFill(), + fluidTankProperties[i].canDrain()); + toUpdate.add(i); + } } - if (syncFlag) writeCustomData(GregtechDataCodes.UPDATE_FLUID, packetBuffer->{ + if (syncFlag) writeCustomData(GregtechDataCodes.UPDATE_FLUID, packetBuffer -> { packetBuffer.writeVarInt(fluids.length); packetBuffer.writeVarInt(toUpdate.size()); for (Integer index : toUpdate) { @@ -513,7 +541,7 @@ private void syncAllInfo() { if (mode == MODE.ITEM || (mode == MODE.PROXY && proxyMode[1] > 0)) { boolean syncFlag = false; IItemHandler itemHandler = this.getItemCapability(); - if(itemHandler != null) { + if (itemHandler != null) { int size = itemHandler.getSlots(); if (this.slot < size) { int maxStoredItems = itemHandler.getSlotLimit(this.slot); @@ -553,7 +581,8 @@ private void syncAllInfo() { IEnergyContainer energyContainer = this.getEnergyCapability(); if (energyContainer != null) { // TODO, figure out what to do when values exceed Long.MAX_VALUE, ie with multiple Ultimate batteries - if (energyStored != energyContainer.getEnergyStored() || energyCapability != energyContainer.getEnergyCapacity()) { + if (energyStored != energyContainer.getEnergyStored() || + energyCapability != energyContainer.getEnergyCapacity()) { energyStored = energyContainer.getEnergyStored(); energyCapability = energyContainer.getEnergyCapacity(); writeCustomData(GregtechDataCodes.UPDATE_ENERGY, packetBuffer -> { @@ -561,7 +590,7 @@ private void syncAllInfo() { packetBuffer.writeLong(energyCapability); }); } - if (this.getOffsetTimer() % 20 == 0) { //per second + if (this.getOffsetTimer() % 20 == 0) { // per second writeCustomData(GregtechDataCodes.UPDATE_ENERGY_PER, packetBuffer -> { packetBuffer.writeLong(energyContainer.getInputPerSec()); packetBuffer.writeLong(energyContainer.getOutputPerSec()); @@ -582,7 +611,8 @@ private void syncAllInfo() { int maxProgress = workable.getMaxProgress(); boolean isActive = workable.isActive(); boolean isWorkingEnable = workable.isWorkingEnabled(); - if (isActive != this.isActive || isWorkingEnable != this.isWorkingEnabled || this.progress != progress || this.maxProgress != maxProgress) { + if (isActive != this.isActive || isWorkingEnable != this.isWorkingEnabled || + this.progress != progress || this.maxProgress != maxProgress) { this.progress = progress; this.maxProgress = maxProgress; this.isWorkingEnabled = isWorkingEnable; @@ -597,7 +627,8 @@ private void syncAllInfo() { if (this.getOffsetTimer() % 20 == 0) { IEnergyContainer energyContainer = this.getEnergyCapability(); if (energyContainer != null) { - if (energyStored != energyContainer.getEnergyStored() || energyCapability != energyContainer.getEnergyCapacity()) { + if (energyStored != energyContainer.getEnergyStored() || + energyCapability != energyContainer.getEnergyCapacity()) { energyStored = energyContainer.getEnergyStored(); energyCapability = energyContainer.getEnergyCapacity(); writeCustomData(GregtechDataCodes.UPDATE_ENERGY, packetBuffer -> { @@ -641,7 +672,8 @@ private void readFluids(PacketBuffer packetBuffer) { int index = packetBuffer.readVarInt(); NBTTagCompound nbt = packetBuffer.readCompoundTag(); if (nbt != null) { - fluids[index] = new FluidTankProperties(FluidStack.loadFluidStackFromNBT(nbt), nbt.getInteger("Capacity")); + fluids[index] = new FluidTankProperties(FluidStack.loadFluidStackFromNBT(nbt), + nbt.getInteger("Capacity")); } } } catch (IOException e) { @@ -662,7 +694,7 @@ private void writeAllItems(PacketBuffer packetBuffer) { private void readItems(PacketBuffer packetBuffer) { maxItemCapability = packetBuffer.readVarInt(); int size = packetBuffer.readVarInt(); - if(items == null || items.length != size) { + if (items == null || items.length != size) { items = new ItemStack[size]; } size = packetBuffer.readVarInt(); @@ -674,7 +706,7 @@ private void readItems(PacketBuffer packetBuffer) { items[index] = new ItemStack(nbt); items[index].setCount(nbt.getInteger("count")); } else { - items [index] = ItemStack.EMPTY; + items[index] = ItemStack.EMPTY; } } } catch (IOException e) { @@ -690,7 +722,8 @@ public static NBTTagCompound fixItemStackSer(ItemStack itemStack) { public IFluidHandler getFluidCapability() { TileEntity te = getCoveredTE(); - IFluidHandler capability = te == null ? null : te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getCoveredFacing()); + IFluidHandler capability = te == null ? null : + te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getCoveredFacing()); if (capability == null && this.getCoverableView() instanceof MultiblockControllerBase controllerBase) { List input = controllerBase.getAbilities(MultiblockAbility.IMPORT_FLUIDS); List output = controllerBase.getAbilities(MultiblockAbility.EXPORT_FLUIDS); @@ -708,7 +741,8 @@ public IFluidHandler getFluidCapability() { public IItemHandler getItemCapability() { TileEntity te = getCoveredTE(); - IItemHandler capability = te == null ? null : te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getCoveredFacing()); + IItemHandler capability = te == null ? null : + te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getCoveredFacing()); if (capability == null && this.getCoverableView() instanceof MultiblockControllerBase controllerBase) { List input = controllerBase.getAbilities(MultiblockAbility.IMPORT_ITEMS); List output = controllerBase.getAbilities(MultiblockAbility.EXPORT_ITEMS); @@ -726,7 +760,8 @@ public IItemHandler getItemCapability() { public IEnergyContainer getEnergyCapability() { TileEntity te = getCoveredTE(); - IEnergyContainer capability = te == null ? null : te.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, getCoveredFacing()); + IEnergyContainer capability = te == null ? null : + te.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, getCoveredFacing()); if (capability == null && this.getCoverableView() instanceof MultiblockControllerBase controllerBase) { List input = controllerBase.getAbilities(MultiblockAbility.INPUT_ENERGY); List output = controllerBase.getAbilities(MultiblockAbility.OUTPUT_ENERGY); @@ -740,26 +775,33 @@ public IEnergyContainer getEnergyCapability() { capability = new EnergyContainerList(list); } else if (capability == null && te != null) { IEnergyStorage fe = te.getCapability(CapabilityEnergy.ENERGY, getCoveredFacing()); - if(fe != null) { + if (fe != null) { return new IEnergyContainer() { + public long acceptEnergyFromNetwork(EnumFacing enumFacing, long l, long l1) { return 0; } + public boolean inputsEnergy(EnumFacing enumFacing) { return false; } + public long changeEnergy(long l) { return 0; } + public long getEnergyStored() { return FeCompat.toEu(fe.getEnergyStored(), FeCompat.ratio(false)); } + public long getEnergyCapacity() { return FeCompat.toEu(fe.getMaxEnergyStored(), FeCompat.ratio(false)); } + public long getInputAmperage() { return 0; } + public long getInputVoltage() { return 0; } @@ -778,7 +820,8 @@ public IWorkable getMachineCapability() { public void readCustomData(int id, @NotNull PacketBuffer packetBuffer) { super.readCustomData(id, packetBuffer); if (id == GregtechDataCodes.UPDATE_COVER_MODE) { // set mode - setMode(MODE.VALUES[packetBuffer.readByte()], packetBuffer.readInt(), EnumFacing.byIndex(packetBuffer.readByte())); + setMode(MODE.VALUES[packetBuffer.readByte()], packetBuffer.readInt(), + EnumFacing.byIndex(packetBuffer.readByte())); } else if (id == GregtechDataCodes.UPDATE_FLUID) { // sync fluids readFluids(packetBuffer); } else if (id == GregtechDataCodes.UPDATE_ITEM) { @@ -814,7 +857,7 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } public boolean canCapabilityAttach() { - return getFluidCapability() != null || + return getFluidCapability() != null || getItemCapability() != null || getEnergyCapability() != null || getMachineCapability() != null; @@ -831,7 +874,8 @@ public T getCapability(@NotNull Capability capability, T defaultValue) { } @Override - public void renderCover(CCRenderState ccRenderState, Matrix4 translation, IVertexOperation[] ops, Cuboid6 cuboid6, BlockRenderLayer blockRenderLayer) { + public void renderCover(CCRenderState ccRenderState, Matrix4 translation, IVertexOperation[] ops, Cuboid6 cuboid6, + BlockRenderLayer blockRenderLayer) { codechicken.lib.vec.Rotation rotation = new codechicken.lib.vec.Rotation(0, 0, 1, 0); if (this.getAttachedSide().getAxis().isVertical()) { if (this.spin == EnumFacing.WEST) { @@ -849,26 +893,30 @@ public void renderCover(CCRenderState ccRenderState, Matrix4 translation, IVerte if (mode == MODE.PROXY) { Textures.COVER_INTERFACE_PROXY.renderSided(getAttachedSide(), cuboid6, ccRenderState, ops, translation); } else if (mode == MODE.FLUID) { - Textures.COVER_INTERFACE_FLUID.renderSided(getAttachedSide(), cuboid6, ccRenderState, ArrayUtils.addAll(ops, rotation), translation); - Textures.COVER_INTERFACE_FLUID_GLASS.renderSided(getAttachedSide(), cuboid6, ccRenderState, ArrayUtils.addAll(ops, rotation), RenderUtil.adjustTrans(translation, getAttachedSide(), 3)); + Textures.COVER_INTERFACE_FLUID.renderSided(getAttachedSide(), cuboid6, ccRenderState, + ArrayUtils.addAll(ops, rotation), translation); + Textures.COVER_INTERFACE_FLUID_GLASS.renderSided(getAttachedSide(), cuboid6, ccRenderState, + ArrayUtils.addAll(ops, rotation), RenderUtil.adjustTrans(translation, getAttachedSide(), 3)); } else if (mode == MODE.ITEM) { - Textures.COVER_INTERFACE_ITEM.renderSided(getAttachedSide(), cuboid6, ccRenderState, ArrayUtils.addAll(ops, rotation), translation); + Textures.COVER_INTERFACE_ITEM.renderSided(getAttachedSide(), cuboid6, ccRenderState, + ArrayUtils.addAll(ops, rotation), translation); } else if (mode == MODE.ENERGY) { - Textures.COVER_INTERFACE_ENERGY.renderSided(getAttachedSide(), cuboid6, ccRenderState, ArrayUtils.addAll(ops, rotation), translation); + Textures.COVER_INTERFACE_ENERGY.renderSided(getAttachedSide(), cuboid6, ccRenderState, + ArrayUtils.addAll(ops, rotation), translation); } else if (mode == MODE.MACHINE) { if (isWorkingEnabled) { - Textures.COVER_INTERFACE_MACHINE_ON.renderSided(getAttachedSide(), cuboid6, ccRenderState, ArrayUtils.addAll(ops, rotation), translation); + Textures.COVER_INTERFACE_MACHINE_ON.renderSided(getAttachedSide(), cuboid6, ccRenderState, + ArrayUtils.addAll(ops, rotation), translation); } else { - Textures.COVER_INTERFACE_MACHINE_OFF.renderSided(getAttachedSide(), cuboid6, ccRenderState, ArrayUtils.addAll(ops, rotation), translation); + Textures.COVER_INTERFACE_MACHINE_OFF.renderSided(getAttachedSide(), cuboid6, ccRenderState, + ArrayUtils.addAll(ops, rotation), translation); } } } @SideOnly(Side.CLIENT) @Override - public void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) { - - } + public void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) {} @SideOnly(Side.CLIENT) @Override @@ -881,13 +929,14 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); RenderUtil.moveToFace(x, y, z, getAttachedSide()); - RenderUtil.rotateToFace(getAttachedSide(), getAttachedSide().getAxis() == EnumFacing.Axis.Y ? this.spin : EnumFacing.NORTH); + RenderUtil.rotateToFace(getAttachedSide(), + getAttachedSide().getAxis() == EnumFacing.Axis.Y ? this.spin : EnumFacing.NORTH); if (!renderSneakingLookAt(this.getPos(), getAttachedSide(), this.slot, partialTicks)) { renderMode(this.mode, this.slot, partialTicks); } - /* restore the lightmap */ + /* restore the lightmap */ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); @@ -907,8 +956,10 @@ public AxisAlignedBB getRenderBoundingBox() { public boolean renderSneakingLookAt(BlockPos blockPos, EnumFacing side, int slot, float partialTicks) { EntityPlayer player = Minecraft.getMinecraft().player; if (player != null && player.isSneaking() && player.getHeldItemMainhand().isEmpty()) { - RayTraceResult rayTraceResult = player.rayTrace(Minecraft.getMinecraft().playerController.getBlockReachDistance(), partialTicks); - if (rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && rayTraceResult.sideHit == side && rayTraceResult.getBlockPos().equals(blockPos)) { + RayTraceResult rayTraceResult = player + .rayTrace(Minecraft.getMinecraft().playerController.getBlockReachDistance(), partialTicks); + if (rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && + rayTraceResult.sideHit == side && rayTraceResult.getBlockPos().equals(blockPos)) { RenderUtil.renderRect(-7f / 16, -7f / 16, 3f / 16, 3f / 16, 0.002f, 0XFF838583); RenderUtil.renderRect(4f / 16, -7f / 16, 3f / 16, 3f / 16, 0.002f, 0XFF838583); RenderUtil.renderText(-5.5f / 16, -5.5F / 16, 0, 1.0f / 70, 0XFFFFFFFF, "<", true); @@ -921,7 +972,9 @@ public boolean renderSneakingLookAt(BlockPos blockPos, EnumFacing side, int slot itemStack = ((IGregTechTileEntity) te).getMetaTileEntity().getStackForm(); } else { BlockPos pos = te.getPos(); - itemStack = te.getBlockType().getPickBlock(te.getWorld().getBlockState(pos), new RayTraceResult(new Vec3d(0.5, 0.5, 0.5), getCoveredFacing(), pos), te.getWorld(), pos, Minecraft.getMinecraft().player); + itemStack = te.getBlockType().getPickBlock(te.getWorld().getBlockState(pos), + new RayTraceResult(new Vec3d(0.5, 0.5, 0.5), getCoveredFacing(), pos), te.getWorld(), + pos, Minecraft.getMinecraft().player); } String name = itemStack.getDisplayName(); RenderUtil.renderRect(-7f / 16, -4f / 16, 14f / 16, 1f / 16, 0.002f, 0XFF000000); @@ -936,7 +989,8 @@ public boolean renderSneakingLookAt(BlockPos blockPos, EnumFacing side, int slot @SideOnly(Side.CLIENT) public void renderMode(MODE mode, int slot, float partialTicks) { - if (mode == MODE.FLUID && fluids.length > slot && slot >= 0 && fluids[slot] != null && fluids[slot].getContents() != null) { + if (mode == MODE.FLUID && fluids.length > slot && slot >= 0 && fluids[slot] != null && + fluids[slot].getContents() != null) { renderFluidMode(slot); } else if (mode == MODE.ITEM && items.length > slot && slot >= 0 && items[slot] != null) { renderItemMode(slot); @@ -962,16 +1016,20 @@ private void renderMachineMode(float partialTicks) { endAlpha = (int) (510 - 255 / 0.4375 * offset); } RenderUtil.renderRect(-7f / 16, -7f / 16, progress * 14f / (maxProgress * 16), 3f / 16, 0.002f, 0XFFFF5F44); - RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), 0XFFFFFFFF, readAmountOrCountOrEnergy(progress * 100L / maxProgress, MODE.MACHINE), true); - RenderUtil.renderGradientRect(start, -4f / 16, width, 1f / 16, 0.002f, (color & 0X00FFFFFF) | (startAlpha << 24), (color & 0X00FFFFFF) | (endAlpha << 24), true); + RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), 0XFFFFFFFF, + readAmountOrCountOrEnergy(progress * 100L / maxProgress, MODE.MACHINE), true); + RenderUtil.renderGradientRect(start, -4f / 16, width, 1f / 16, 0.002f, + (color & 0X00FFFFFF) | (startAlpha << 24), (color & 0X00FFFFFF) | (endAlpha << 24), true); } else { RenderUtil.renderRect(-7f / 16, -4f / 16, 14f / 16, 1f / 16, 0.002f, color); } if (this.isProxy()) { if (isWorkingEnabled) { - RenderUtil.renderTextureArea(GuiTextures.COVER_INTERFACE_MACHINE_ON_PROXY, -7f / 16, 1f / 16, 14f / 16, 3f / 16, 0.002f); + RenderUtil.renderTextureArea(GuiTextures.COVER_INTERFACE_MACHINE_ON_PROXY, -7f / 16, 1f / 16, 14f / 16, + 3f / 16, 0.002f); } else { - RenderUtil.renderTextureArea(GuiTextures.COVER_INTERFACE_MACHINE_OFF_PROXY, -7f / 16, -1f / 16, 14f / 16, 5f / 16, 0.002f); + RenderUtil.renderTextureArea(GuiTextures.COVER_INTERFACE_MACHINE_OFF_PROXY, -7f / 16, -1f / 16, + 14f / 16, 5f / 16, 0.002f); } } } @@ -988,11 +1046,16 @@ private void renderEnergyMode() { } RenderUtil.renderLineChart(inputEnergyList, max, -5.5f / 16, 5.5f / 16, 12f / 16, 6f / 16, 0.005f, 0XFF03FF00); RenderUtil.renderLineChart(outputEnergyList, max, -5.5f / 16, 5.5f / 16, 12f / 16, 6f / 16, 0.005f, 0XFFFF2F39); - RenderUtil.renderText(-5.7f / 16, -2.3f / 16, 0, 1.0f / 270, 0XFF03FF00, "EU I: " + energyInputPerDur + "EU/s", false); - RenderUtil.renderText(-5.7f / 16, -1.6f / 16, 0, 1.0f / 270, 0XFFFF0000, "EU O: " + energyOutputPerDur + "EU/s", false); - // Bandaid fix to prevent overflowing renders when dealing with items that cause long overflow, ie Ultimate Battery - RenderUtil.renderRect(-7f / 16, -7f / 16, Math.max(0, energyStored * 14f / (energyCapability * 16)), 3f / 16, 0.002f, 0XFFFFD817); - RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), 0XFFFFFFFF, readAmountOrCountOrEnergy(energyStored, MODE.ENERGY), true); + RenderUtil.renderText(-5.7f / 16, -2.3f / 16, 0, 1.0f / 270, 0XFF03FF00, "EU I: " + energyInputPerDur + "EU/s", + false); + RenderUtil.renderText(-5.7f / 16, -1.6f / 16, 0, 1.0f / 270, 0XFFFF0000, "EU O: " + energyOutputPerDur + "EU/s", + false); + // Bandaid fix to prevent overflowing renders when dealing with items that cause long overflow, ie Ultimate + // Battery + RenderUtil.renderRect(-7f / 16, -7f / 16, Math.max(0, energyStored * 14f / (energyCapability * 16)), 3f / 16, + 0.002f, 0XFFFFD817); + RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), 0XFFFFFFFF, + readAmountOrCountOrEnergy(energyStored, MODE.ENERGY), true); } @SideOnly(Side.CLIENT) @@ -1001,11 +1064,16 @@ private void renderItemMode(int slot) { if (!itemStack.isEmpty()) { RenderUtil.renderItemOverLay(-8f / 16, -5f / 16, 0, 1f / 32, itemStack); if (maxItemCapability != 0) { - RenderUtil.renderRect(-7f / 16, -7f / 16, Math.max(itemStack.getCount() * 14f / (maxItemCapability * 16), 0.001f), 3f / 16, 0.002f, 0XFF25B9FF); + RenderUtil.renderRect(-7f / 16, -7f / 16, + Math.max(itemStack.getCount() * 14f / (maxItemCapability * 16), 0.001f), 3f / 16, 0.002f, + 0XFF25B9FF); } else { - RenderUtil.renderRect(-7f / 16, -7f / 16, Math.max(itemStack.getCount() * 14f / (itemStack.getMaxStackSize() * 16), 0.001f), 3f / 16, 0.002f, 0XFF25B9FF); + RenderUtil.renderRect(-7f / 16, -7f / 16, + Math.max(itemStack.getCount() * 14f / (itemStack.getMaxStackSize() * 16), 0.001f), 3f / 16, + 0.002f, 0XFF25B9FF); } - RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), 0XFFFFFFFF, readAmountOrCountOrEnergy(itemStack.getCount(), MODE.ITEM), true); + RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), 0XFFFFFFFF, + readAmountOrCountOrEnergy(itemStack.getCount(), MODE.ITEM), true); } } @@ -1017,18 +1085,20 @@ private void renderFluidMode(int slot) { float height = 10f / 16 * Math.max(fluidStack.amount * 1.0f / fluids[slot].getCapacity(), 0.001f); RenderUtil.renderFluidOverLay(-7f / 16, 0.4375f - height, 14f / 16, height, 0.002f, fluidStack, 0.8f); int fluidColor = WidgetOreList.getFluidColor(fluidStack.getFluid()); - int textColor = ((fluidColor & 0xff) + ((fluidColor >> 8) & 0xff) + ((fluidColor >> 16) & 0xff)) / 3 > (255 / 2) ? 0X0 : 0XFFFFFFFF; + int textColor = ((fluidColor & 0xff) + ((fluidColor >> 8) & 0xff) + ((fluidColor >> 16) & 0xff)) / 3 > + (255 / 2) ? 0X0 : 0XFFFFFFFF; RenderUtil.renderRect(-7f / 16, -7f / 16, 14f / 16, 3f / 16, 0.002f, fluidColor | (255 << 24)); - RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), textColor, readAmountOrCountOrEnergy(fluidStack.amount, MODE.FLUID), true); + RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), textColor, + readAmountOrCountOrEnergy(fluidStack.amount, MODE.FLUID), true); } static String[][] units = { - {"", "mB", "", "EU"}, - {"", "B", "K", "KEU"}, - {"", "KB", "M", "MEU"}, - {"", "MB", "G", "GEU"}, - {"", "GB", "T", "TEU"}, - {"", "TB", "P", "PEU"}, + { "", "mB", "", "EU" }, + { "", "B", "K", "KEU" }, + { "", "KB", "M", "MEU" }, + { "", "MB", "G", "GEU" }, + { "", "GB", "T", "TEU" }, + { "", "TB", "P", "PEU" }, }; @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/common/covers/CoverDigitalInterfaceWireless.java b/src/main/java/gregtech/common/covers/CoverDigitalInterfaceWireless.java index 1d7efdb7ee9..329085dc55c 100644 --- a/src/main/java/gregtech/common/covers/CoverDigitalInterfaceWireless.java +++ b/src/main/java/gregtech/common/covers/CoverDigitalInterfaceWireless.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; @@ -12,6 +7,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.items.behaviors.CoverDigitalInterfaceWirelessPlaceBehaviour; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -23,6 +19,12 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,13 +32,13 @@ public class CoverDigitalInterfaceWireless extends CoverDigitalInterface { private BlockPos remote; - public CoverDigitalInterfaceWireless(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDigitalInterfaceWireless(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @Override - public void setMode(MODE mode, int slot, EnumFacing spin) { - } + public void setMode(MODE mode, int slot, EnumFacing spin) {} @Override public void writeToNBT(NBTTagCompound tagCompound) { @@ -49,7 +51,8 @@ public void writeToNBT(NBTTagCompound tagCompound) { @Override public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); - this.remote = tagCompound.hasKey("cdiRemote") ? NBTUtil.getPosFromTag(tagCompound.getCompoundTag("cdiRemote")) : null; + this.remote = tagCompound.hasKey("cdiRemote") ? NBTUtil.getPosFromTag(tagCompound.getCompoundTag("cdiRemote")) : + null; } @Override @@ -70,7 +73,8 @@ public void readInitialSyncData(PacketBuffer packetBuffer) { } @Override - public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { + public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, + @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { remote = CoverDigitalInterfaceWirelessPlaceBehaviour.getRemotePos(itemStack); } @@ -79,14 +83,16 @@ public void update() { super.update(); if (remote != null && !isRemote() && getOffsetTimer() % 20 == 0) { TileEntity te = getWorld().getTileEntity(remote); - if (te instanceof IGregTechTileEntity igtte && igtte.getMetaTileEntity() instanceof MetaTileEntityCentralMonitor monitor) { + if (te instanceof IGregTechTileEntity igtte && + igtte.getMetaTileEntity() instanceof MetaTileEntityCentralMonitor monitor) { monitor.addRemoteCover(new FacingPos(getPos(), getAttachedSide())); } } } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { return EnumActionResult.SUCCESS; } @@ -100,7 +106,8 @@ public void update() { } @Override - public void renderCover(CCRenderState ccRenderState, Matrix4 translation, IVertexOperation[] ops, Cuboid6 cuboid6, BlockRenderLayer blockRenderLayer) { + public void renderCover(CCRenderState ccRenderState, Matrix4 translation, IVertexOperation[] ops, Cuboid6 cuboid6, + BlockRenderLayer blockRenderLayer) { Textures.COVER_INTERFACE_WIRELESS.renderSided(getAttachedSide(), cuboid6, ccRenderState, ops, translation); } } diff --git a/src/main/java/gregtech/common/covers/CoverEnderFluidLink.java b/src/main/java/gregtech/common/covers/CoverEnderFluidLink.java index b79abfcef6d..b34348c69bb 100644 --- a/src/main/java/gregtech/common/covers/CoverEnderFluidLink.java +++ b/src/main/java/gregtech/common/covers/CoverEnderFluidLink.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; import gregtech.api.cover.CoverBase; @@ -19,6 +14,7 @@ import gregtech.api.util.VirtualTankRegistry; import gregtech.client.renderer.texture.Textures; import gregtech.common.covers.filter.FluidFilterContainer; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -28,6 +24,12 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -50,7 +52,8 @@ public class CoverEnderFluidLink extends CoverBase implements CoverWithUI, ITick private final FluidTankSwitchShim linkedTank; protected final FluidFilterContainer fluidFilter; - protected CoverEnderFluidLink(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + protected CoverEnderFluidLink(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); this.linkedTank = new FluidTankSwitchShim(VirtualTankRegistry.getTankCreate(makeTankName(), null)); this.fluidFilter = new FluidFilterContainer(this); @@ -78,12 +81,14 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.ENDER_FLUID_LINK.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -91,7 +96,8 @@ public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 tra } @Override - public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { + public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, + @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { super.onAttachment(coverableView, side, player, itemStack); if (player != null) { this.playerUUID = player.getUniqueID(); @@ -111,7 +117,8 @@ public void update() { } protected void transferFluids() { - IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); + IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + getAttachedSide()); if (fluidHandler == null) return; if (pumpMode == CoverPump.PumpMode.IMPORT) { GTTransferUtils.transferFluids(fluidHandler, linkedTank, TRANSFER_RATE, fluidFilter::testFluidStack); @@ -141,13 +148,13 @@ public ModularUI createUI(EntityPlayer player) { widgetGroup.addWidget(new LabelWidget(10, 5, "cover.ender_fluid_link.title")); widgetGroup.addWidget(new ToggleButtonWidget(12, 18, 18, 18, GuiTextures.BUTTON_PUBLIC_PRIVATE, this::isPrivate, this::setPrivate) - .setTooltipText("cover.ender_fluid_link.private.tooltip")); + .setTooltipText("cover.ender_fluid_link.private.tooltip")); widgetGroup.addWidget(new SyncableColorRectWidget(35, 18, 18, 18, () -> color) .setBorderWidth(1) .drawCheckerboard(4, 4)); widgetGroup.addWidget(new TextFieldWidget(58, 13, 58, 18, true, this::getColorStr, this::updateColor, 8) - .setValidator(str -> COLOR_INPUT_PATTERN.matcher(str).matches())); + .setValidator(str -> COLOR_INPUT_PATTERN.matcher(str).matches())); widgetGroup.addWidget(new TankWidget(this.linkedTank, 123, 18, 18, 18) .setContainerClicking(true, true) .setBackgroundTexture(GuiTextures.FLUID_SLOT).setAlwaysShowFull(true)); @@ -159,7 +166,8 @@ public ModularUI createUI(EntityPlayer player) { widgetGroup.addWidget(new CycleButtonWidget(10, 42, 75, 18, CoverPump.PumpMode.class, this::getPumpMode, this::setPumpMode)); widgetGroup.addWidget(new CycleButtonWidget(92, 42, 75, 18, - this::isIoEnabled, this::setIoEnabled, "cover.ender_fluid_link.iomode.disabled", "cover.ender_fluid_link.iomode.enabled")); + this::isIoEnabled, this::setIoEnabled, "cover.ender_fluid_link.iomode.disabled", + "cover.ender_fluid_link.iomode.enabled")); this.fluidFilter.initUI(65, widgetGroup::addWidget); return ModularUI.builder(GuiTextures.BACKGROUND, 176, 221) .widget(widgetGroup) @@ -226,10 +234,10 @@ public void writeInitialSyncData(PacketBuffer packetBuffer) { @Override public void readInitialSyncData(PacketBuffer packetBuffer) { this.color = packetBuffer.readInt(); - //does client even need uuid info? just in case + // does client even need uuid info? just in case String uuidStr = packetBuffer.readString(36); this.playerUUID = uuidStr.equals("null") ? null : UUID.fromString(uuidStr); - //client does not need the actual tank reference, the default one will do just fine + // client does not need the actual tank reference, the default one will do just fine } @Override diff --git a/src/main/java/gregtech/common/covers/CoverFacade.java b/src/main/java/gregtech/common/covers/CoverFacade.java index 7b03c3d9a0b..9f458f8cec2 100644 --- a/src/main/java/gregtech/common/covers/CoverFacade.java +++ b/src/main/java/gregtech/common/covers/CoverFacade.java @@ -1,9 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; @@ -13,6 +9,7 @@ import gregtech.client.renderer.handler.FacadeRenderer; import gregtech.common.covers.facade.FacadeHelper; import gregtech.common.items.behaviors.FacadeItem; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -25,6 +22,11 @@ import net.minecraft.util.EnumFacing; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.MinecraftForgeClient; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -53,17 +55,20 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { + public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, + @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { super.onAttachment(coverableView, side, player, itemStack); setFacadeStack(FacadeItem.getFacadeStack(itemStack)); } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { BlockRenderLayer oldLayer = MinecraftForgeClient.getRenderLayer(); ForgeHooksClient.setRenderLayer(layer); - FacadeRenderer.renderBlockCover(renderState, translation, getCoverableView().getWorld(), getCoverableView().getPos(), getAttachedSide().getIndex(), facadeState, plateBox, layer); + FacadeRenderer.renderBlockCover(renderState, translation, getCoverableView().getWorld(), + getCoverableView().getPos(), getAttachedSide().getIndex(), facadeState, plateBox, layer); ForgeHooksClient.setRenderLayer(oldLayer); } @@ -152,5 +157,7 @@ public boolean canRenderBackside() { } @Override - public void renderCoverPlate(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) {} + public void renderCoverPlate(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, + @NotNull BlockRenderLayer layer) {} } diff --git a/src/main/java/gregtech/common/covers/CoverFluidFilter.java b/src/main/java/gregtech/common/covers/CoverFluidFilter.java index 5e1ac806d5d..0e8fa374c0a 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidFilter.java +++ b/src/main/java/gregtech/common/covers/CoverFluidFilter.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FluidHandlerDelegate; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; @@ -19,6 +14,7 @@ import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; import gregtech.common.covers.filter.FluidFilter; import gregtech.common.covers.filter.FluidFilterWrapper; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; @@ -30,6 +26,12 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; @@ -43,7 +45,8 @@ public class CoverFluidFilter extends CoverBase implements CoverWithUI { protected FluidHandlerFiltered fluidHandler; public CoverFluidFilter(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, - @NotNull EnumFacing attachedSide, String titleLocale, SimpleOverlayRenderer texture, FluidFilter fluidFilter) { + @NotNull EnumFacing attachedSide, String titleLocale, SimpleOverlayRenderer texture, + FluidFilter fluidFilter) { super(definition, coverableView, attachedSide); this.filterMode = FluidFilterMode.FILTER_FILL; this.titleLocale = titleLocale; @@ -79,7 +82,8 @@ public boolean canPipePassThrough() { return true; } - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!playerIn.world.isRemote) { this.openUI((EntityPlayerMP) playerIn); } @@ -101,7 +105,8 @@ public ModularUI createUI(EntityPlayer player) { } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { this.texture.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/CoverFluidRegulator.java b/src/main/java/gregtech/common/covers/CoverFluidRegulator.java index e6d70dfc2a4..553f2734b46 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidRegulator.java +++ b/src/main/java/gregtech/common/covers/CoverFluidRegulator.java @@ -1,6 +1,5 @@ package gregtech.common.covers; -import com.google.common.math.IntMath; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.gui.GuiTextures; @@ -12,7 +11,7 @@ import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.covers.filter.FluidFilter; import gregtech.common.covers.filter.FluidFilterContainer; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; @@ -27,6 +26,9 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.math.IntMath; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.apache.logging.log4j.message.FormattedMessage; import org.jetbrains.annotations.NotNull; @@ -36,13 +38,13 @@ import java.util.Objects; import java.util.function.Predicate; - public class CoverFluidRegulator extends CoverPump { protected TransferMode transferMode = TransferMode.TRANSFER_ANY; protected int transferAmount = 0; - public CoverFluidRegulator(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide, int tier, int mbPerTick) { + public CoverFluidRegulator(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide, int tier, int mbPerTick) { super(definition, coverableView, attachedSide, tier, mbPerTick); this.fluidFilter = new FluidFilterContainer(this, this::shouldShowTip, maxFluidTransferRate * 100); } @@ -57,7 +59,8 @@ public int getTransferAmount() { } @Override - protected int doTransferFluidsInternal(IFluidHandler myFluidHandler, IFluidHandler fluidHandler, int transferLimit) { + protected int doTransferFluidsInternal(IFluidHandler myFluidHandler, IFluidHandler fluidHandler, + int transferLimit) { IFluidHandler sourceHandler; IFluidHandler destHandler; @@ -71,20 +74,22 @@ protected int doTransferFluidsInternal(IFluidHandler myFluidHandler, IFluidHandl return 0; } return switch (transferMode) { - case TRANSFER_ANY -> - GTTransferUtils.transferFluids(sourceHandler, destHandler, transferLimit, fluidFilter::testFluidStack); - case KEEP_EXACT -> - doKeepExact(transferLimit, sourceHandler, destHandler, fluidFilter::testFluidStack, this.transferAmount); - case TRANSFER_EXACT -> - doTransferExact(transferLimit, sourceHandler, destHandler, fluidFilter::testFluidStack, this.transferAmount); + case TRANSFER_ANY -> GTTransferUtils.transferFluids(sourceHandler, destHandler, transferLimit, + fluidFilter::testFluidStack); + case KEEP_EXACT -> doKeepExact(transferLimit, sourceHandler, destHandler, fluidFilter::testFluidStack, + this.transferAmount); + case TRANSFER_EXACT -> doTransferExact(transferLimit, sourceHandler, destHandler, + fluidFilter::testFluidStack, this.transferAmount); }; } - protected int doTransferExact(int transferLimit, IFluidHandler sourceHandler, IFluidHandler destHandler, Predicate fluidFilter, int supplyAmount) { + protected int doTransferExact(int transferLimit, IFluidHandler sourceHandler, IFluidHandler destHandler, + Predicate fluidFilter, int supplyAmount) { int fluidLeftToTransfer = transferLimit; for (IFluidTankProperties tankProperties : sourceHandler.getTankProperties()) { FluidStack sourceFluid = tankProperties.getContents(); - if (this.fluidFilter.getFilterWrapper().getFluidFilter() != null && transferMode != TransferMode.TRANSFER_ANY) { + if (this.fluidFilter.getFilterWrapper().getFluidFilter() != null && + transferMode != TransferMode.TRANSFER_ANY) { supplyAmount = this.fluidFilter.getFilterWrapper().getFluidFilter().getFluidTransferLimit(sourceFluid); } if (fluidLeftToTransfer < supplyAmount) @@ -114,21 +119,21 @@ protected int doKeepExact(final int transferLimit, final IFluidHandler destHandler, final Predicate fluidFilter, int keepAmount) { - if (sourceHandler == null || destHandler == null || fluidFilter == null) return 0; - final Map sourceFluids = - collectDistinctFluids(sourceHandler, IFluidTankProperties::canDrain, fluidFilter); - final Map destFluids = - collectDistinctFluids(destHandler, IFluidTankProperties::canFill, fluidFilter); + final Map sourceFluids = collectDistinctFluids(sourceHandler, + IFluidTankProperties::canDrain, fluidFilter); + final Map destFluids = collectDistinctFluids(destHandler, IFluidTankProperties::canFill, + fluidFilter); int transferred = 0; for (FluidStack fluidStack : sourceFluids.keySet()) { if (transferred >= transferLimit) break; - if (this.fluidFilter.getFilterWrapper().getFluidFilter() != null && transferMode != TransferMode.TRANSFER_ANY) { + if (this.fluidFilter.getFilterWrapper().getFluidFilter() != null && + transferMode != TransferMode.TRANSFER_ANY) { keepAmount = this.fluidFilter.getFilterWrapper().getFluidFilter().getFluidTransferLimit(fluidStack); } @@ -145,7 +150,8 @@ protected int doKeepExact(final int transferLimit, continue; // Simulate a drain of this fluid from the source tanks - FluidStack drainedResult = sourceHandler.drain(copyFluidStackWithAmount(fluidStack, amountToMove), false); + FluidStack drainedResult = sourceHandler.drain(copyFluidStackWithAmount(fluidStack, amountToMove), + false); // Can't drain this fluid. Try the next one. if (drainedResult == null || drainedResult.amount <= 0 || !fluidStack.equals(drainedResult)) @@ -167,10 +173,12 @@ protected int doKeepExact(final int transferLimit, // Account for potential error states from the drain if (drainedActual == null) - throw new RuntimeException("Misbehaving fluid container: drain produced null after simulation succeeded"); + throw new RuntimeException( + "Misbehaving fluid container: drain produced null after simulation succeeded"); if (!fluidStack.equals(drainedActual)) - throw new RuntimeException("Misbehaving fluid container: drain produced a different fluid than the simulation"); + throw new RuntimeException( + "Misbehaving fluid container: drain produced a different fluid than the simulation"); if (drainedActual.amount != fluidToMove) throw new RuntimeException(new FormattedMessage( @@ -178,7 +186,6 @@ protected int doKeepExact(final int transferLimit, fluidToMove, drainedActual.amount).getFormattedMessage()); - // Perform Fill int filledActual = destHandler.fill(copyFluidStackWithAmount(fluidStack, fluidToMove), true); @@ -213,7 +220,6 @@ private static FluidStack copyFluidStackWithAmount(FluidStack fs, int amount) { private static Map collectDistinctFluids(IFluidHandler handler, Predicate tankTypeFilter, Predicate fluidTypeFilter) { - final Map summedFluids = new Object2IntOpenHashMap<>(); Arrays.stream(handler.getTankProperties()) .filter(tankTypeFilter) @@ -258,7 +264,8 @@ private String getTransferSizeString() { protected void getHoverString(List textList) { ITextComponent keepComponent = new TextComponentString(getTransferSizeString()); - TextComponentTranslation hoverKeep = new TextComponentTranslation("cover.fluid_regulator." + transferMode.name().toLowerCase(), this.transferAmount); + TextComponentTranslation hoverKeep = new TextComponentTranslation( + "cover.fluid_regulator." + transferMode.name().toLowerCase(), this.transferAmount); keepComponent.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverKeep)); textList.add(keepComponent); } @@ -275,8 +282,8 @@ private void adjustTransferSize(int amount) { if (bucketMode == BucketMode.BUCKET) amount *= 1000; switch (this.transferMode) { - case TRANSFER_EXACT -> - setTransferAmount(MathHelper.clamp(this.transferAmount + amount, 0, this.maxFluidTransferRate)); + case TRANSFER_EXACT -> setTransferAmount( + MathHelper.clamp(this.transferAmount + amount, 0, this.maxFluidTransferRate)); case KEEP_EXACT -> setTransferAmount(MathHelper.clamp(this.transferAmount + amount, 0, Integer.MAX_VALUE)); } } @@ -297,7 +304,7 @@ protected ModularUI buildUI(ModularUI.Builder builder, EntityPlayer player) { WidgetGroup filterGroup = new WidgetGroup(); filterGroup.addWidget(new CycleButtonWidget(92, 43, 75, 18, TransferMode.class, this::getTransferMode, this::setTransferMode) - .setTooltipHoverString("cover.fluid_regulator.transfer_mode.description")); + .setTooltipHoverString("cover.fluid_regulator.transfer_mode.description")); ServerWidgetGroup stackSizeGroup = new ServerWidgetGroup(this::shouldDisplayAmountSlider); stackSizeGroup.addWidget(new ImageWidget(110, 64, 38, 18, GuiTextures.DISPLAY)); @@ -306,10 +313,11 @@ protected ModularUI buildUI(ModularUI.Builder builder, EntityPlayer player) { .setDefaultTooltip() .setTextScale(0.7f) .setShouldClientCallback(false)); - stackSizeGroup.addWidget(new IncrementButtonWidget(92, 64, 18, 18, -1, -10, -100, -1000, this::adjustTransferSize) - .setDefaultTooltip() - .setTextScale(0.7f) - .setShouldClientCallback(false)); + stackSizeGroup + .addWidget(new IncrementButtonWidget(92, 64, 18, 18, -1, -10, -100, -1000, this::adjustTransferSize) + .setDefaultTooltip() + .setTextScale(0.7f) + .setShouldClientCallback(false)); stackSizeGroup.addWidget(new TextFieldWidget2(111, 70, 36, 11, this::getTransferAmountString, val -> { if (val != null && !val.isEmpty()) { @@ -321,16 +329,17 @@ protected ModularUI buildUI(ModularUI.Builder builder, EntityPlayer player) { } }) .setCentered(true) - .setNumbersOnly(1, transferMode == TransferMode.TRANSFER_EXACT ? maxFluidTransferRate : Integer.MAX_VALUE) + .setNumbersOnly(1, + transferMode == TransferMode.TRANSFER_EXACT ? maxFluidTransferRate : Integer.MAX_VALUE) .setMaxLength(10) .setScale(0.6f)); - stackSizeGroup.addWidget(new SimpleTextWidget(129, 78, "", 0xFFFFFF, () -> bucketMode.localeName).setScale(0.6f)); + stackSizeGroup + .addWidget(new SimpleTextWidget(129, 78, "", 0xFFFFFF, () -> bucketMode.localeName).setScale(0.6f)); return super.buildUI(builder.widget(filterGroup).widget(stackSizeGroup), player); } - @Override public void writeToNBT(@NotNull NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); @@ -343,7 +352,7 @@ public void writeToNBT(@NotNull NBTTagCompound tagCompound) { public void readFromNBT(@NotNull NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); this.transferMode = TransferMode.values()[tagCompound.getInteger("TransferMode")]; - //legacy NBT tag + // legacy NBT tag if (!tagCompound.hasKey("filterv2") && tagCompound.hasKey("TransferAmount")) { FluidFilter filter = getFluidFilterContainer().getFilterWrapper().getFluidFilter(); if (filter != null) { diff --git a/src/main/java/gregtech/common/covers/CoverFluidVoiding.java b/src/main/java/gregtech/common/covers/CoverFluidVoiding.java index af25c07ea1b..4c1f097ccee 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidVoiding.java +++ b/src/main/java/gregtech/common/covers/CoverFluidVoiding.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; @@ -16,6 +11,7 @@ import gregtech.api.util.GTTransferUtils; import gregtech.client.renderer.texture.Textures; import gregtech.common.covers.filter.FluidFilterContainer; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumActionResult; @@ -27,13 +23,20 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverFluidVoiding extends CoverPump { protected final NullFluidTank nullFluidTank = new NullFluidTank(); - public CoverFluidVoiding(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverFluidVoiding(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide, 0, Integer.MAX_VALUE); this.isWorkingAllowed = false; this.fluidFilter = new FluidFilterContainer(this, this::shouldShowTip, Integer.MAX_VALUE); @@ -47,7 +50,8 @@ public void update() { } protected void doTransferFluids() { - IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); + IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + getAttachedSide()); if (myFluidHandler == null) { return; } @@ -68,11 +72,11 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(new CycleButtonWidget(10, 92, 80, 18, this::isWorkingEnabled, this::setWorkingEnabled, "cover.voiding.label.disabled", "cover.voiding.label.enabled") - .setTooltipHoverString("cover.voiding.tooltip")); + .setTooltipHoverString("cover.voiding.tooltip")); primaryGroup.addWidget(new CycleButtonWidget(10, 112, 116, 18, ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) - .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); + .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 100 + 82 + 16 + 24) .widget(primaryGroup) @@ -81,12 +85,14 @@ public ModularUI createUI(EntityPlayer player) { } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.FLUID_VOIDING.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @Override - public @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { this.isWorkingAllowed = !this.isWorkingAllowed; if (!playerIn.world.isRemote) { playerIn.sendStatusMessage(new TextComponentTranslation(isWorkingEnabled() ? diff --git a/src/main/java/gregtech/common/covers/CoverFluidVoidingAdvanced.java b/src/main/java/gregtech/common/covers/CoverFluidVoidingAdvanced.java index c76ede3ad5d..4d2290aa13b 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidVoidingAdvanced.java +++ b/src/main/java/gregtech/common/covers/CoverFluidVoidingAdvanced.java @@ -1,9 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.gui.GuiTextures; @@ -12,6 +8,7 @@ import gregtech.api.gui.widgets.*; import gregtech.api.util.GTTransferUtils; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockRenderLayer; @@ -21,6 +18,11 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import java.util.function.Consumer; @@ -31,7 +33,8 @@ public class CoverFluidVoidingAdvanced extends CoverFluidVoiding { protected VoidingMode voidingMode = VoidingMode.VOID_ANY; protected int transferAmount = 0; - public CoverFluidVoidingAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverFluidVoidingAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -42,13 +45,14 @@ protected boolean shouldShowTip() { @Override protected void doTransferFluids() { - IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); + IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + getAttachedSide()); if (myFluidHandler == null) { return; } switch (voidingMode) { - case VOID_ANY -> - GTTransferUtils.transferFluids(myFluidHandler, nullFluidTank, Integer.MAX_VALUE, fluidFilter::testFluidStack); + case VOID_ANY -> GTTransferUtils.transferFluids(myFluidHandler, nullFluidTank, Integer.MAX_VALUE, + fluidFilter::testFluidStack); case VOID_OVERFLOW -> voidOverflow(myFluidHandler, fluidFilter::testFluidStack, this.transferAmount); } } @@ -68,10 +72,13 @@ protected void voidOverflow(final IFluidHandler sourceHandler, for (IFluidTankProperties tankProperties : sourceHandler.getTankProperties()) { FluidStack sourceFluid = tankProperties.getContents(); - if (this.fluidFilter.getFilterWrapper().getFluidFilter() != null && voidingMode == VoidingMode.VOID_OVERFLOW) { + if (this.fluidFilter.getFilterWrapper().getFluidFilter() != null && + voidingMode == VoidingMode.VOID_OVERFLOW) { keepAmount = this.fluidFilter.getFilterWrapper().getFluidFilter().getFluidTransferLimit(sourceFluid); } - if (sourceFluid == null || sourceFluid.amount == 0 || !getFluidFilterContainer().testFluidStack(sourceFluid, true)) continue; + if (sourceFluid == null || sourceFluid.amount == 0 || + !getFluidFilterContainer().testFluidStack(sourceFluid, true)) + continue; sourceFluid.amount = sourceFluid.amount - keepAmount; sourceHandler.drain(sourceFluid, true); } @@ -135,17 +142,17 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(new CycleButtonWidget(92, 15, 75, 18, VoidingMode.class, this::getVoidingMode, this::setVoidingMode) - .setTooltipHoverString("cover.voiding.voiding_mode.description")); + .setTooltipHoverString("cover.voiding.voiding_mode.description")); this.initFilterUI(20, primaryGroup::addWidget); primaryGroup.addWidget(new CycleButtonWidget(10, 92, 80, 18, this::isWorkingEnabled, this::setWorkingEnabled, "cover.voiding.label.disabled", "cover.voiding.label.enabled") - .setTooltipHoverString("cover.voiding.tooltip")); + .setTooltipHoverString("cover.voiding.tooltip")); primaryGroup.addWidget(new CycleButtonWidget(10, 112, 116, 18, ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) - .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); + .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 100 + 82 + 16 + 24) .widget(primaryGroup) @@ -153,7 +160,7 @@ public ModularUI createUI(EntityPlayer player) { return buildUI(builder, player); } - public void initFilterUI(int y, Consumer widgetGroup){ + public void initFilterUI(int y, Consumer widgetGroup) { widgetGroup.accept(new LabelWidget(10, y, "cover.pump.fluid_filter.title")); widgetGroup.accept(new SlotWidget(fluidFilter.getFilterInventory(), 0, 10, y + 15) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.FILTER_SLOT_OVERLAY)); @@ -165,10 +172,11 @@ public void initFilterUI(int y, Consumer widgetGroup){ .setDefaultTooltip() .setTextScale(0.7f) .setShouldClientCallback(false)); - stackSizeGroup.addWidget(new IncrementButtonWidget(92, 34, 18, 18, -1, -10, -100, -1000, this::adjustTransferSize) - .setDefaultTooltip() - .setTextScale(0.7f) - .setShouldClientCallback(false)); + stackSizeGroup + .addWidget(new IncrementButtonWidget(92, 34, 18, 18, -1, -10, -100, -1000, this::adjustTransferSize) + .setDefaultTooltip() + .setTextScale(0.7f) + .setShouldClientCallback(false)); stackSizeGroup.addWidget(new TextFieldWidget2(111, 39, 37, 11, this::getTransferAmountString, val -> { if (val != null && !val.isEmpty()) { @@ -184,23 +192,26 @@ public void initFilterUI(int y, Consumer widgetGroup){ .setMaxLength(10) .setScale(0.6f)); - stackSizeGroup.addWidget(new SimpleTextWidget(129, 47, "", 0xFFFFFF, () -> bucketMode.localeName).setScale(0.6f)); + stackSizeGroup + .addWidget(new SimpleTextWidget(129, 47, "", 0xFFFFFF, () -> bucketMode.localeName).setScale(0.6f)); stackSizeGroup.addWidget(new CycleButtonWidget(114, 53, 30, 20, BucketMode.class, this::getBucketMode, mode -> { - if (mode != bucketMode) { - setBucketMode(mode); - } - })); + if (mode != bucketMode) { + setBucketMode(mode); + } + })); widgetGroup.accept(stackSizeGroup); this.fluidFilter.getFilterWrapper().initUI(y + 15, widgetGroup); - this.fluidFilter.getFilterWrapper().blacklistUI(y + 15, widgetGroup, () -> voidingMode != VoidingMode.VOID_OVERFLOW); + this.fluidFilter.getFilterWrapper().blacklistUI(y + 15, widgetGroup, + () -> voidingMode != VoidingMode.VOID_OVERFLOW); } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.FLUID_VOIDING_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -217,5 +228,4 @@ public void readFromNBT(@NotNull NBTTagCompound tagCompound) { this.voidingMode = VoidingMode.values()[tagCompound.getInteger("VoidingMode")]; this.transferAmount = tagCompound.getInteger("TransferAmount"); } - } diff --git a/src/main/java/gregtech/common/covers/CoverInfiniteWater.java b/src/main/java/gregtech/common/covers/CoverInfiniteWater.java index fd6e6afcfa0..808308ecabb 100644 --- a/src/main/java/gregtech/common/covers/CoverInfiniteWater.java +++ b/src/main/java/gregtech/common/covers/CoverInfiniteWater.java @@ -1,13 +1,10 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.client.renderer.texture.Textures; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; @@ -15,11 +12,17 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverInfiniteWater extends CoverBase implements ITickable { - public CoverInfiniteWater(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverInfiniteWater(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -29,14 +32,17 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState ccRenderState, @NotNull Matrix4 matrix4, IVertexOperation[] iVertexOperations, @NotNull Cuboid6 cuboid6, @NotNull BlockRenderLayer blockRenderLayer) { + public void renderCover(@NotNull CCRenderState ccRenderState, @NotNull Matrix4 matrix4, + IVertexOperation[] iVertexOperations, @NotNull Cuboid6 cuboid6, + @NotNull BlockRenderLayer blockRenderLayer) { Textures.INFINITE_WATER.renderSided(getAttachedSide(), cuboid6, ccRenderState, iVertexOperations, matrix4); } @Override public void update() { if (!getWorld().isRemote && getOffsetTimer() % 20 == 0) { - IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); + IFluidHandler fluidHandler = getCoverableView() + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); if (fluidHandler != null) { fluidHandler.fill(new FluidStack(FluidRegistry.WATER, 16000), true); } diff --git a/src/main/java/gregtech/common/covers/CoverItemFilter.java b/src/main/java/gregtech/common/covers/CoverItemFilter.java index 29e435e3a59..b427397432f 100644 --- a/src/main/java/gregtech/common/covers/CoverItemFilter.java +++ b/src/main/java/gregtech/common/covers/CoverItemFilter.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.ItemHandlerDelegate; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; @@ -19,6 +14,7 @@ import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; import gregtech.common.covers.filter.ItemFilter; import gregtech.common.covers.filter.ItemFilterWrapper; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -30,6 +26,12 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; @@ -77,7 +79,8 @@ public boolean canPipePassThrough() { } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!playerIn.world.isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -104,7 +107,8 @@ public ModularUI createUI(EntityPlayer player) { } @Override - public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) { + public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 plateBox, BlockRenderLayer layer) { this.texture.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/CoverItemVoiding.java b/src/main/java/gregtech/common/covers/CoverItemVoiding.java index d845d30b987..d0119f6939f 100644 --- a/src/main/java/gregtech/common/covers/CoverItemVoiding.java +++ b/src/main/java/gregtech/common/covers/CoverItemVoiding.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; @@ -14,6 +9,7 @@ import gregtech.api.gui.widgets.LabelWidget; import gregtech.api.gui.widgets.WidgetGroup; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; @@ -24,6 +20,12 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; @@ -46,7 +48,8 @@ public void update() { } protected void doTransferItems() { - IItemHandler myItemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getAttachedSide()); + IItemHandler myItemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + getAttachedSide()); if (myItemHandler == null) { return; } @@ -77,13 +80,14 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(new LabelWidget(10, 5, getUITitle())); this.itemFilterContainer.initUI(20, primaryGroup::addWidget); - primaryGroup.addWidget(new CycleButtonWidget(10, 92 + 23, 80, 18, this::isWorkingEnabled, this::setWorkingEnabled, - "cover.voiding.label.disabled", "cover.voiding.label.enabled") - .setTooltipHoverString("cover.voiding.tooltip")); + primaryGroup + .addWidget(new CycleButtonWidget(10, 92 + 23, 80, 18, this::isWorkingEnabled, this::setWorkingEnabled, + "cover.voiding.label.disabled", "cover.voiding.label.enabled") + .setTooltipHoverString("cover.voiding.tooltip")); primaryGroup.addWidget(new CycleButtonWidget(10, 112 + 23, 116, 18, ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) - .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); + .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 125 + 82 + 16 + 24) .widget(primaryGroup) @@ -92,12 +96,14 @@ public ModularUI createUI(EntityPlayer player) { } @Override - public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) { + public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 plateBox, BlockRenderLayer layer) { Textures.ITEM_VOIDING.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @Override - public @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { this.isWorkingAllowed = !this.isWorkingAllowed; if (!playerIn.world.isRemote) { playerIn.sendStatusMessage(new TextComponentTranslation(isWorkingEnabled() ? @@ -118,6 +124,7 @@ public T getCapability(Capability capability, T defaultValue) { } class NullItemHandler implements IItemHandler { + @Override public int getSlots() { return 9; diff --git a/src/main/java/gregtech/common/covers/CoverItemVoidingAdvanced.java b/src/main/java/gregtech/common/covers/CoverItemVoidingAdvanced.java index bcb294839b5..62d2844aaa3 100644 --- a/src/main/java/gregtech/common/covers/CoverItemVoidingAdvanced.java +++ b/src/main/java/gregtech/common/covers/CoverItemVoidingAdvanced.java @@ -1,9 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.gui.GuiTextures; @@ -11,6 +7,7 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.*; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -19,6 +16,11 @@ import net.minecraft.util.math.MathHelper; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import java.util.Map; @@ -37,7 +39,8 @@ public CoverItemVoidingAdvanced(@NotNull CoverDefinition definition, @NotNull Co @Override protected void doTransferItems() { - IItemHandler myItemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getAttachedSide()); + IItemHandler myItemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + getAttachedSide()); if (myItemHandler == null) { return; } @@ -68,7 +71,8 @@ protected void voidOverflow(IItemHandler myItemHandler) { for (int srcIndex = 0; srcIndex < myItemHandler.getSlots(); srcIndex++) { ItemStack is = myItemHandler.getStackInSlot(srcIndex); - if (!is.isEmpty() && ItemStack.areItemsEqual(is, typeItemInfo.itemStack) && ItemStack.areItemStackTagsEqual(is, typeItemInfo.itemStack)) { + if (!is.isEmpty() && ItemStack.areItemsEqual(is, typeItemInfo.itemStack) && + ItemStack.areItemStackTagsEqual(is, typeItemInfo.itemStack)) { ItemStack extracted = myItemHandler.extractItem(srcIndex, itemToVoidAmount, false); if (!extracted.isEmpty()) { itemToVoidAmount -= extracted.getCount(); @@ -93,17 +97,18 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(new CycleButtonWidget(91, 14, 75, 20, VoidingMode.class, this::getVoidingMode, this::setVoidingMode) - .setTooltipHoverString("cover.voiding.voiding_mode.description")); + .setTooltipHoverString("cover.voiding.voiding_mode.description")); this.initFilterUI(20, primaryGroup::addWidget); - primaryGroup.addWidget(new CycleButtonWidget(10, 92 + 23, 80, 18, this::isWorkingEnabled, this::setWorkingEnabled, - "cover.voiding.label.disabled", "cover.voiding.label.enabled") - .setTooltipHoverString("cover.voiding.tooltip")); + primaryGroup + .addWidget(new CycleButtonWidget(10, 92 + 23, 80, 18, this::isWorkingEnabled, this::setWorkingEnabled, + "cover.voiding.label.disabled", "cover.voiding.label.enabled") + .setTooltipHoverString("cover.voiding.tooltip")); primaryGroup.addWidget(new CycleButtonWidget(10, 112 + 23, 116, 18, ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) - .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); + .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 125 + 82 + 16 + 24) .widget(primaryGroup) @@ -111,43 +116,50 @@ public ModularUI createUI(EntityPlayer player) { return buildUI(builder, player); } - //Basically the item filter container GUI code, with different Y widget positioning + // Basically the item filter container GUI code, with different Y widget positioning public void initFilterUI(int y, Consumer widgetGroup) { widgetGroup.accept(new LabelWidget(10, y, "cover.conveyor.item_filter.title")); widgetGroup.accept(new SlotWidget(itemFilterContainer.getFilterInventory(), 0, 10, y + 15) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.FILTER_SLOT_OVERLAY)); - ServerWidgetGroup stackSizeGroup = new ServerWidgetGroup(() -> itemFilterContainer.getFilterWrapper().getItemFilter() == null && voidingMode == VoidingMode.VOID_OVERFLOW); + ServerWidgetGroup stackSizeGroup = new ServerWidgetGroup( + () -> itemFilterContainer.getFilterWrapper().getItemFilter() == null && + voidingMode == VoidingMode.VOID_OVERFLOW); stackSizeGroup.addWidget(new ImageWidget(111, 34, 35, 20, GuiTextures.DISPLAY)); - stackSizeGroup.addWidget(new IncrementButtonWidget(146, 34, 20, 20, 1, 8, 64, 512, itemFilterContainer::adjustTransferStackSize) - .setDefaultTooltip() - .setTextScale(0.7f) - .setShouldClientCallback(false)); - stackSizeGroup.addWidget(new IncrementButtonWidget(91, 34, 20, 20, -1, -8, -64, -512, itemFilterContainer::adjustTransferStackSize) - .setDefaultTooltip() - .setTextScale(0.7f) - .setShouldClientCallback(false)); - - stackSizeGroup.addWidget(new TextFieldWidget2(113, 41, 31, 20, () -> String.valueOf(itemFilterContainer.getTransferStackSize()), val -> { + stackSizeGroup.addWidget( + new IncrementButtonWidget(146, 34, 20, 20, 1, 8, 64, 512, itemFilterContainer::adjustTransferStackSize) + .setDefaultTooltip() + .setTextScale(0.7f) + .setShouldClientCallback(false)); + stackSizeGroup.addWidget(new IncrementButtonWidget(91, 34, 20, 20, -1, -8, -64, -512, + itemFilterContainer::adjustTransferStackSize) + .setDefaultTooltip() + .setTextScale(0.7f) + .setShouldClientCallback(false)); + + stackSizeGroup.addWidget(new TextFieldWidget2(113, 41, 31, 20, + () -> String.valueOf(itemFilterContainer.getTransferStackSize()), val -> { if (val != null && !val.isEmpty()) - itemFilterContainer.setTransferStackSize(MathHelper.clamp(Integer.parseInt(val), 1, voidingMode.maxStackSize)); + itemFilterContainer.setTransferStackSize( + MathHelper.clamp(Integer.parseInt(val), 1, voidingMode.maxStackSize)); }) .setCentered(true) .setNumbersOnly(1, Integer.MAX_VALUE) .setMaxLength(10) - .setScale(0.9f) - ); + .setScale(0.9f)); widgetGroup.accept(stackSizeGroup); this.itemFilterContainer.getFilterWrapper().initUI(y + 38, widgetGroup); - this.itemFilterContainer.getFilterWrapper().blacklistUI(y + 38, widgetGroup, () -> voidingMode != VoidingMode.VOID_OVERFLOW); + this.itemFilterContainer.getFilterWrapper().blacklistUI(y + 38, widgetGroup, + () -> voidingMode != VoidingMode.VOID_OVERFLOW); } @Override - public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) { + public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 plateBox, BlockRenderLayer layer) { Textures.ITEM_VOIDING_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/CoverMachineController.java b/src/main/java/gregtech/common/covers/CoverMachineController.java index 873a7f1abf9..58532319279 100644 --- a/src/main/java/gregtech/common/covers/CoverMachineController.java +++ b/src/main/java/gregtech/common/covers/CoverMachineController.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; import gregtech.api.cover.*; @@ -12,19 +7,27 @@ import gregtech.api.gui.ModularUI; import gregtech.api.gui.widgets.*; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + public class CoverMachineController extends CoverBase implements CoverWithUI { private int minRedstoneStrength; @@ -105,7 +108,8 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getCoverableView().getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -126,12 +130,13 @@ public ModularUI createUI(EntityPlayer player) { .setBackgroundTexture(GuiTextures.SLOT)) .widget(new CycleButtonWidget(48, 70, 80, 18, this::isInverted, this::setInverted, "cover.machine_controller.normal", "cover.machine_controller.inverted") - .setTooltipHoverString("cover.machine_controller.inverted.description")) + .setTooltipHoverString("cover.machine_controller.inverted.description")) .build(this, player); } @Override - public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { + public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, + @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { super.onAttachment(coverableView, side, player, itemStack); this.controllerMode = getAllowedModes(getCoverableView(), getAttachedSide()).iterator().next(); updateRedstoneStatus(); @@ -144,8 +149,10 @@ public void onRemoval() { } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { - Textures.MACHINE_CONTROLLER_OVERLAY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + Textures.MACHINE_CONTROLLER_OVERLAY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, + translation); } @Override @@ -173,7 +180,8 @@ private void updateDisplayInventory() { private @Nullable IControllable getControllable() { EnumFacing side = controllerMode.side; if (side == null) { - return getCoverableView().getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, getAttachedSide()); + return getCoverableView().getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, + getAttachedSide()); } else { Cover cover = getCoverableView().getCoverAtSide(side); if (cover == null) { @@ -198,8 +206,9 @@ private void updateRedstoneStatus() { } private boolean shouldAllowWorking() { - boolean shouldAllowWorking = getCoverableView().getInputRedstoneSignal(getAttachedSide(), true) < minRedstoneStrength; - //noinspection SimplifiableConditionalExpression + boolean shouldAllowWorking = getCoverableView().getInputRedstoneSignal(getAttachedSide(), true) < + minRedstoneStrength; + // noinspection SimplifiableConditionalExpression return isInverted ? !shouldAllowWorking : shouldAllowWorking; } @@ -209,7 +218,8 @@ private boolean doesOtherAllowingWork() { EnumFacing attachedSide = getAttachedSide(); CoverableView coverable = getCoverableView(); for (EnumFacing side : EnumFacing.values()) { - if (side != attachedSide && coverable.getCoverAtSide(side) instanceof CoverMachineController machineController) { + if (side != attachedSide && + coverable.getCoverAtSide(side) instanceof CoverMachineController machineController) { cover = machineController; otherAllow = otherAllow && cover.controllerMode == controllerMode && cover.shouldAllowWorking(); } @@ -234,6 +244,7 @@ public void readFromNBT(@NotNull NBTTagCompound tagCompound) { } public enum ControllerMode implements IStringSerializable { + MACHINE("cover.machine_controller.mode.machine", null), COVER_UP("cover.machine_controller.mode.cover_up", EnumFacing.UP), COVER_DOWN("cover.machine_controller.mode.cover_down", EnumFacing.DOWN), @@ -250,7 +261,6 @@ public enum ControllerMode implements IStringSerializable { this.side = side; } - @Nonnull @Override public String getName() { diff --git a/src/main/java/gregtech/common/covers/CoverPump.java b/src/main/java/gregtech/common/covers/CoverPump.java index bbf9b29f772..b0e9018f396 100644 --- a/src/main/java/gregtech/common/covers/CoverPump.java +++ b/src/main/java/gregtech/common/covers/CoverPump.java @@ -1,11 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import com.google.common.math.IntMath; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -22,6 +16,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.covers.filter.FluidFilterContainer; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -36,13 +31,21 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import com.google.common.math.IntMath; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.function.Function; import java.util.function.IntSupplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class CoverPump extends CoverBase implements CoverWithUI, ITickable, IControllable { public final int tier; @@ -132,19 +135,24 @@ public void update() { protected int doTransferFluids(int transferLimit) { TileEntity tileEntity = getNeighbor(getAttachedSide()); - IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide().getOpposite()); - IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); + IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide().getOpposite()); + IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + getAttachedSide()); if (fluidHandler == null || myFluidHandler == null) { return 0; } return doTransferFluidsInternal(myFluidHandler, fluidHandler, transferLimit); } - protected int doTransferFluidsInternal(IFluidHandler myFluidHandler, IFluidHandler fluidHandler, int transferLimit) { + protected int doTransferFluidsInternal(IFluidHandler myFluidHandler, IFluidHandler fluidHandler, + int transferLimit) { if (pumpMode == PumpMode.IMPORT) { - return GTTransferUtils.transferFluids(fluidHandler, myFluidHandler, transferLimit, fluidFilter::testFluidStack); + return GTTransferUtils.transferFluids(fluidHandler, myFluidHandler, transferLimit, + fluidFilter::testFluidStack); } else if (pumpMode == PumpMode.EXPORT) { - return GTTransferUtils.transferFluids(myFluidHandler, fluidHandler, transferLimit, fluidFilter::testFluidStack); + return GTTransferUtils.transferFluids(myFluidHandler, fluidHandler, transferLimit, + fluidFilter::testFluidStack); } return 0; } @@ -176,33 +184,35 @@ public ModularUI createUI(EntityPlayer player) { .setDefaultTooltip() .setShouldClientCallback(false)); - TextFieldWidget2 textField = new TextFieldWidget2(45, 26, 60, 20, () -> bucketMode == BucketMode.BUCKET ? Integer.toString(transferRate / 1000) : Integer.toString(transferRate), val -> { - if (val != null && !val.isEmpty()) { - int amount = Integer.parseInt(val); - if (this.bucketMode == BucketMode.BUCKET) { - amount = IntMath.saturatedMultiply(amount, 1000); - } - setTransferRate(amount); - } - }) - .setCentered(true) - .setNumbersOnly(1, bucketMode == BucketMode.BUCKET ? maxFluidTransferRate / 1000 : maxFluidTransferRate) - .setMaxLength(8); + TextFieldWidget2 textField = new TextFieldWidget2(45, 26, 60, 20, () -> bucketMode == BucketMode.BUCKET ? + Integer.toString(transferRate / 1000) : Integer.toString(transferRate), val -> { + if (val != null && !val.isEmpty()) { + int amount = Integer.parseInt(val); + if (this.bucketMode == BucketMode.BUCKET) { + amount = IntMath.saturatedMultiply(amount, 1000); + } + setTransferRate(amount); + } + }) + .setCentered(true) + .setNumbersOnly(1, + bucketMode == BucketMode.BUCKET ? maxFluidTransferRate / 1000 : maxFluidTransferRate) + .setMaxLength(8); primaryGroup.addWidget(textField); primaryGroup.addWidget(new CycleButtonWidget(106, 20, 30, 20, BucketMode.class, this::getBucketMode, mode -> { - if (mode != bucketMode) { - setBucketMode(mode); - } - })); + if (mode != bucketMode) { + setBucketMode(mode); + } + })); primaryGroup.addWidget(new CycleButtonWidget(10, 43, 75, 18, PumpMode.class, this::getPumpMode, this::setPumpMode)); primaryGroup.addWidget(new CycleButtonWidget(7, 160, 116, 20, ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) - .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); + .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); this.fluidFilter.initUI(88, primaryGroup::addWidget); @@ -236,7 +246,8 @@ public static Function getTextFieldValidator(IntSupplier maxSupp } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -280,7 +291,8 @@ public void onRemoval() { } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { if (pumpMode == PumpMode.EXPORT) { Textures.PUMP_OVERLAY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } else { @@ -345,6 +357,7 @@ public void readFromNBT(@NotNull NBTTagCompound tagCompound) { } public enum PumpMode implements IStringSerializable, IIOMode { + IMPORT("cover.pump.mode.import"), EXPORT("cover.pump.mode.export"); @@ -367,6 +380,7 @@ public boolean isImport() { } public enum BucketMode implements IStringSerializable { + BUCKET("cover.bucket.mode.bucket"), MILLI_BUCKET("cover.bucket.mode.milli_bucket"); diff --git a/src/main/java/gregtech/common/covers/CoverRoboticArm.java b/src/main/java/gregtech/common/covers/CoverRoboticArm.java index e75441bc27a..902ffcd62f4 100644 --- a/src/main/java/gregtech/common/covers/CoverRoboticArm.java +++ b/src/main/java/gregtech/common/covers/CoverRoboticArm.java @@ -1,9 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.gui.GuiTextures; @@ -13,6 +9,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.covers.filter.SmartItemFilter; import gregtech.common.pipelike.itempipe.net.ItemNetHandler; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -20,6 +17,11 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.MathHelper; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import java.util.Iterator; @@ -38,7 +40,8 @@ public CoverRoboticArm(@NotNull CoverDefinition definition, @NotNull CoverableVi } @Override - public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) { + public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 plateBox, BlockRenderLayer layer) { if (conveyorMode == ConveyorMode.EXPORT) { Textures.ARM_OVERLAY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } else { @@ -48,10 +51,12 @@ public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexO @Override protected int doTransferItems(IItemHandler itemHandler, IItemHandler myItemHandler, int maxTransferAmount) { - if (conveyorMode == ConveyorMode.EXPORT && itemHandler instanceof ItemNetHandler && transferMode == TransferMode.KEEP_EXACT) { + if (conveyorMode == ConveyorMode.EXPORT && itemHandler instanceof ItemNetHandler && + transferMode == TransferMode.KEEP_EXACT) { return 0; } - if (conveyorMode == ConveyorMode.IMPORT && myItemHandler instanceof ItemNetHandler && transferMode == TransferMode.KEEP_EXACT) { + if (conveyorMode == ConveyorMode.IMPORT && myItemHandler instanceof ItemNetHandler && + transferMode == TransferMode.KEEP_EXACT) { return 0; } return switch (transferMode) { @@ -99,19 +104,21 @@ protected int doTransferExact(IItemHandler itemHandler, IItemHandler myItemHandl notEnoughTransferRate = true; } } - //if we didn't transfer anything because of too small transfer rate, buffer it + // if we didn't transfer anything because of too small transfer rate, buffer it if (itemsTransferred == 0 && notEnoughTransferRate) { itemsTransferBuffered += maxTransferAmount; } else { - //otherwise, if transfer succeed, empty transfer buffer value + // otherwise, if transfer succeed, empty transfer buffer value itemsTransferBuffered = 0; } return Math.min(itemsTransferred, maxTransferAmount); } protected int doKeepExact(IItemHandler itemHandler, IItemHandler myItemHandler, int maxTransferAmount) { - Map currentItemAmount = doCountDestinationInventoryItemsByMatchIndex(itemHandler, myItemHandler); - Map sourceItemAmounts = doCountDestinationInventoryItemsByMatchIndex(myItemHandler, itemHandler); + Map currentItemAmount = doCountDestinationInventoryItemsByMatchIndex(itemHandler, + myItemHandler); + Map sourceItemAmounts = doCountDestinationInventoryItemsByMatchIndex(myItemHandler, + itemHandler); Iterator iterator = sourceItemAmounts.keySet().iterator(); while (iterator.hasNext()) { Object filterSlotIndex = iterator.next(); @@ -182,28 +189,31 @@ protected ModularUI buildUI(Builder builder, EntityPlayer player) { WidgetGroup primaryGroup = new WidgetGroup(); primaryGroup.addWidget(new CycleButtonWidget(91, 45, 75, 20, TransferMode.class, this::getTransferMode, this::setTransferMode) - .setTooltipHoverString("cover.robotic_arm.transfer_mode.description")); + .setTooltipHoverString("cover.robotic_arm.transfer_mode.description")); ServerWidgetGroup stackSizeGroup = new ServerWidgetGroup(this::shouldDisplayAmountSlider); stackSizeGroup.addWidget(new ImageWidget(111, 70, 35, 20, GuiTextures.DISPLAY)); - stackSizeGroup.addWidget(new IncrementButtonWidget(146, 70, 20, 20, 1, 8, 64, 512, itemFilterContainer::adjustTransferStackSize) - .setDefaultTooltip() - .setTextScale(0.7f) - .setShouldClientCallback(false)); - stackSizeGroup.addWidget(new IncrementButtonWidget(91, 70, 20, 20, -1, -8, -64, -512, itemFilterContainer::adjustTransferStackSize) - .setDefaultTooltip() - .setTextScale(0.7f) - .setShouldClientCallback(false)); - - stackSizeGroup.addWidget(new TextFieldWidget2(113, 77, 31, 20, () -> String.valueOf(itemFilterContainer.getTransferStackSize()), val -> { + stackSizeGroup.addWidget( + new IncrementButtonWidget(146, 70, 20, 20, 1, 8, 64, 512, itemFilterContainer::adjustTransferStackSize) + .setDefaultTooltip() + .setTextScale(0.7f) + .setShouldClientCallback(false)); + stackSizeGroup.addWidget(new IncrementButtonWidget(91, 70, 20, 20, -1, -8, -64, -512, + itemFilterContainer::adjustTransferStackSize) + .setDefaultTooltip() + .setTextScale(0.7f) + .setShouldClientCallback(false)); + + stackSizeGroup.addWidget(new TextFieldWidget2(113, 77, 31, 20, + () -> String.valueOf(itemFilterContainer.getTransferStackSize()), val -> { if (val != null && !val.isEmpty()) - itemFilterContainer.setTransferStackSize(MathHelper.clamp(Integer.parseInt(val), 1, transferMode.maxStackSize)); + itemFilterContainer.setTransferStackSize( + MathHelper.clamp(Integer.parseInt(val), 1, transferMode.maxStackSize)); }) .setNumbersOnly(1, transferMode.maxStackSize) .setMaxLength(4) - .setScale(0.9f) - ); + .setScale(0.9f)); primaryGroup.addWidget(stackSizeGroup); @@ -221,5 +231,4 @@ public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); this.transferMode = TransferMode.values()[tagCompound.getInteger("TransferMode")]; } - } diff --git a/src/main/java/gregtech/common/covers/CoverScreen.java b/src/main/java/gregtech/common/covers/CoverScreen.java index 2d70d9d4d48..723741b006f 100644 --- a/src/main/java/gregtech/common/covers/CoverScreen.java +++ b/src/main/java/gregtech/common/covers/CoverScreen.java @@ -1,20 +1,23 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.client.renderer.texture.Textures; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverScreen extends CoverBase { - public CoverScreen(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverScreen(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -24,7 +27,8 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DISPLAY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/CoverShutter.java b/src/main/java/gregtech/common/covers/CoverShutter.java index 28a2c676928..2a279b65cff 100644 --- a/src/main/java/gregtech/common/covers/CoverShutter.java +++ b/src/main/java/gregtech/common/covers/CoverShutter.java @@ -1,16 +1,12 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockRenderLayer; @@ -19,6 +15,12 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.common.capabilities.Capability; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverShutter extends CoverBase implements IControllable { @@ -31,7 +33,8 @@ public CoverShutter(@NotNull CoverDefinition definition, @NotNull CoverableView } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.SHUTTER.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -41,12 +44,14 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { return EnumActionResult.FAIL; } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { return EnumActionResult.FAIL; } @@ -69,7 +74,8 @@ public boolean canPipePassThrough() { } @Override - public @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { this.isWorkingAllowed = !this.isWorkingAllowed; if (!playerIn.world.isRemote) { playerIn.sendMessage(new TextComponentTranslation(isWorkingEnabled() ? diff --git a/src/main/java/gregtech/common/covers/CoverSolarPanel.java b/src/main/java/gregtech/common/covers/CoverSolarPanel.java index ee6de34871d..7e2e750439a 100644 --- a/src/main/java/gregtech/common/covers/CoverSolarPanel.java +++ b/src/main/java/gregtech/common/covers/CoverSolarPanel.java @@ -1,9 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IEnergyContainer; import gregtech.api.cover.CoverBase; @@ -12,6 +8,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; @@ -20,6 +17,11 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverSolarPanel extends CoverBase implements ITickable { @@ -34,11 +36,13 @@ public CoverSolarPanel(@NotNull CoverDefinition definition, @NotNull CoverableVi @Override public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing side) { - return getAttachedSide() == EnumFacing.UP && coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null) != null; + return getAttachedSide() == EnumFacing.UP && + coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null) != null; } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.SOLAR_PANEL.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -48,7 +52,8 @@ public void update() { World world = coverable.getWorld(); BlockPos blockPos = coverable.getPos(); if (GTUtility.canSeeSunClearly(world, blockPos)) { - IEnergyContainer energyContainer = coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); + IEnergyContainer energyContainer = coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + null); if (energyContainer != null) { energyContainer.acceptEnergyFromNetwork(null, EUt, 1); } @@ -58,6 +63,7 @@ public void update() { @Override @SideOnly(Side.CLIENT) protected @NotNull TextureAtlasSprite getPlateSprite() { - return Textures.VOLTAGE_CASINGS[GTUtility.getTierByVoltage(this.EUt)].getSpriteOnSide(SimpleSidedCubeRenderer.RenderSide.SIDE); + return Textures.VOLTAGE_CASINGS[GTUtility.getTierByVoltage(this.EUt)] + .getSpriteOnSide(SimpleSidedCubeRenderer.RenderSide.SIDE); } } diff --git a/src/main/java/gregtech/common/covers/CoverStorage.java b/src/main/java/gregtech/common/covers/CoverStorage.java index cccec691fa1..5d34cb33b17 100644 --- a/src/main/java/gregtech/common/covers/CoverStorage.java +++ b/src/main/java/gregtech/common/covers/CoverStorage.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverWithUI; @@ -12,6 +7,7 @@ import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; @@ -21,6 +17,12 @@ import net.minecraft.util.EnumHand; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -31,7 +33,8 @@ public class CoverStorage extends CoverBase implements CoverWithUI { private static final int MAX_HEIGHT = 126; private static final int SLOT_SIZE = 18; - public CoverStorage(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverStorage(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -41,7 +44,8 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.STORAGE.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -51,7 +55,8 @@ public void onRemoval() { } @Override - public @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getCoverableView().getWorld().isRemote) { openUI((EntityPlayerMP) player); } @@ -59,7 +64,8 @@ public void onRemoval() { } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { openUI((EntityPlayerMP) player); } @@ -71,7 +77,8 @@ public ModularUI createUI(EntityPlayer player) { ModularUI.Builder builder = new ModularUI.Builder(GuiTextures.BACKGROUND, MAX_WIDTH, MAX_HEIGHT); builder.label(5, 5, "cover.storage.title"); for (int index = 0; index < storageHandler.getSlots(); index++) { - builder.slot(storageHandler, index, (index * SLOT_SIZE) + 7, (MAX_HEIGHT - SLOT_SIZE * 5) / 2, true, true, GuiTextures.SLOT); + builder.slot(storageHandler, index, (index * SLOT_SIZE) + 7, (MAX_HEIGHT - SLOT_SIZE * 5) / 2, true, true, + GuiTextures.SLOT); } builder.bindPlayerInventory(player.inventory, (MAX_HEIGHT - SLOT_SIZE * 2) / 2 - 1); @@ -81,7 +88,7 @@ public ModularUI createUI(EntityPlayer player) { /** * @deprecated Only exists for compatibility with the crafting table cover and will be removed in the future. - * Do not depend on this method. + * Do not depend on this method. */ @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @ApiStatus.Internal diff --git a/src/main/java/gregtech/common/covers/DistributionMode.java b/src/main/java/gregtech/common/covers/DistributionMode.java index 63efe6d6051..0372f3c1540 100644 --- a/src/main/java/gregtech/common/covers/DistributionMode.java +++ b/src/main/java/gregtech/common/covers/DistributionMode.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; public enum DistributionMode implements IStringSerializable { + ROUND_ROBIN_GLOBAL("cover.conveyor.distribution.round_robin_enhanced"), ROUND_ROBIN_PRIO("cover.conveyor.distribution.round_robin"), INSERT_FIRST("cover.conveyor.distribution.first_insert"); diff --git a/src/main/java/gregtech/common/covers/TransferMode.java b/src/main/java/gregtech/common/covers/TransferMode.java index 87f6243973a..69e47b0e2cc 100644 --- a/src/main/java/gregtech/common/covers/TransferMode.java +++ b/src/main/java/gregtech/common/covers/TransferMode.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; public enum TransferMode implements IStringSerializable { + TRANSFER_ANY("cover.robotic_arm.transfer_mode.transfer_any", 1), TRANSFER_EXACT("cover.robotic_arm.transfer_mode.transfer_exact", 1024), KEEP_EXACT("cover.robotic_arm.transfer_mode.keep_exact", 1024); @@ -17,11 +18,9 @@ public enum TransferMode implements IStringSerializable { this.maxStackSize = maxStackSize; } - @Nonnull @Override public String getName() { return localeName; } } - diff --git a/src/main/java/gregtech/common/covers/VoidingMode.java b/src/main/java/gregtech/common/covers/VoidingMode.java index c73ad7ea42c..7049f0031c6 100644 --- a/src/main/java/gregtech/common/covers/VoidingMode.java +++ b/src/main/java/gregtech/common/covers/VoidingMode.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; public enum VoidingMode implements IStringSerializable { + VOID_ANY("cover.voiding.voiding_mode.void_any", 1), VOID_OVERFLOW("cover.voiding.voiding_mode.void_overflow", 1024); @@ -16,7 +17,6 @@ public enum VoidingMode implements IStringSerializable { this.maxStackSize = maxStackSize; } - @Nonnull @Override public String getName() { diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorActivity.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorActivity.java index 311ce74746e..f4f6eb25a7b 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorActivity.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorActivity.java @@ -1,22 +1,25 @@ package gregtech.common.covers.detector; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IWorkable; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.client.renderer.texture.Textures; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorActivity extends CoverDetectorBase implements ITickable { - public CoverDetectorActivity(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorActivity(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -26,7 +29,8 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_ACTIVITY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorActivityAdvanced.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorActivityAdvanced.java index 8d58a624793..cd13c60c0c6 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorActivityAdvanced.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorActivityAdvanced.java @@ -1,28 +1,33 @@ package gregtech.common.covers.detector; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IWorkable; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorActivityAdvanced extends CoverDetectorActivity { - public CoverDetectorActivityAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorActivityAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { - Textures.DETECTOR_ACTIVITY_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + Textures.DETECTOR_ACTIVITY_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, + translation); } @Override @@ -34,9 +39,10 @@ public void update() { if (workable.getMaxProgress() == 0) return; - int outputAmount = RedstoneUtil.computeRedstoneValue(workable.getProgress(), workable.getMaxProgress(), isInverted()); + int outputAmount = RedstoneUtil.computeRedstoneValue(workable.getProgress(), workable.getMaxProgress(), + isInverted()); - //nonstandard logic for handling off state + // nonstandard logic for handling off state if (!workable.isWorkingEnabled()) { outputAmount = 0; } diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorBase.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorBase.java index bc58a2f3f5c..b4df7c1822a 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorBase.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorBase.java @@ -1,9 +1,9 @@ package gregtech.common.covers.detector; -import codechicken.lib.raytracer.CuboidRayTraceResult; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -11,11 +11,14 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.text.TextComponentTranslation; + +import codechicken.lib.raytracer.CuboidRayTraceResult; import org.jetbrains.annotations.NotNull; import static gregtech.api.capability.GregtechDataCodes.UPDATE_INVERTED; public abstract class CoverDetectorBase extends CoverBase { + protected static final String NBT_KEY_IS_INVERTED = "isInverted"; private boolean isInverted = false; @@ -68,7 +71,7 @@ public void writeToNBT(@NotNull NBTTagCompound tagCompound) { @Override public void readFromNBT(@NotNull NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); - if (tagCompound.hasKey(NBT_KEY_IS_INVERTED)) { //compatibility check + if (tagCompound.hasKey(NBT_KEY_IS_INVERTED)) { // compatibility check setInverted(tagCompound.getBoolean(NBT_KEY_IS_INVERTED)); } this.redstoneSignalOutput = tagCompound.getInteger("RedstoneSignal"); @@ -92,14 +95,14 @@ public boolean canConnectRedstone() { } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (getWorld().isRemote) { return EnumActionResult.SUCCESS; } - String translationKey = isInverted() - ? "gregtech.cover.detector_base.message_inverted_state" - : "gregtech.cover.detector_base.message_normal_state"; + String translationKey = isInverted() ? "gregtech.cover.detector_base.message_inverted_state" : + "gregtech.cover.detector_base.message_normal_state"; playerIn.sendStatusMessage(new TextComponentTranslation(translationKey), true); toggleInvertedWithNotification(); diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergy.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergy.java index f3c3db26f48..5363b7a48ca 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergy.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergy.java @@ -1,9 +1,5 @@ package gregtech.common.covers.detector; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IEnergyContainer; import gregtech.api.cover.CoverDefinition; @@ -11,9 +7,15 @@ import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.multi.electric.MetaTileEntityPowerSubstation; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorEnergy extends CoverDetectorBase implements ITickable { @@ -25,15 +27,16 @@ public CoverDetectorEnergy(@NotNull CoverDefinition definition, @NotNull Coverab @Override public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing side) { - return coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null) != null - || coverable instanceof MetaTileEntityPowerSubstation; // todo check this + return coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null) != null || + coverable instanceof MetaTileEntityPowerSubstation; // todo check this } public long getCoverHolderCapacity() { if (getCoverableView() instanceof MetaTileEntityPowerSubstation pss) { return pss.getCapacityLong(); } else { - IEnergyContainer energyContainer = getCoverableView().getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); + IEnergyContainer energyContainer = getCoverableView() + .getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); if (energyContainer != null) return energyContainer.getEnergyCapacity(); } return 0; @@ -43,14 +46,16 @@ public long getCoverHolderStored() { if (getCoverableView() instanceof MetaTileEntityPowerSubstation pss) { return pss.getStoredLong(); } else { - IEnergyContainer energyContainer = getCoverableView().getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); + IEnergyContainer energyContainer = getCoverableView() + .getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); if (energyContainer != null) return energyContainer.getEnergyStored(); } return 0; } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_ENERGY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java index 1eed566063e..bae050fd172 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java @@ -1,12 +1,5 @@ package gregtech.common.covers.detector; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import gregtech.api.capability.GregtechCapabilities; -import gregtech.api.capability.IEnergyContainer; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverWithUI; import gregtech.api.cover.CoverableView; @@ -16,6 +9,7 @@ import gregtech.api.gui.widgets.*; import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; @@ -24,6 +18,12 @@ import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; @@ -41,17 +41,20 @@ public class CoverDetectorEnergyAdvanced extends CoverDetectorEnergy implements private boolean usePercent = false; private WidgetGroup widgetsToUpdate; - public CoverDetectorEnergyAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorEnergyAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_ENERGY_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -68,7 +71,8 @@ public void update() { if (usePercent) { if (energyCapacity > 0) { float ratio = (float) storedEnergy / energyCapacity; - this.outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(ratio * 100, this.maxValue, this.minValue, isInverted(), this.outputAmount); + this.outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(ratio * 100, this.maxValue, + this.minValue, isInverted(), this.outputAmount); } else { this.outputAmount = isInverted() ? 0 : 15; } @@ -98,17 +102,17 @@ public ModularUI createUI(EntityPlayer player) { // change modes between percent and discrete EU group.addWidget(new LabelWidget(10, 5 + 3 * (SIZE + PADDING), "cover.advanced_energy_detector.modes_label")); - group.addWidget(new CycleButtonWidget(72, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isUsePercent, this::setUsePercent, - "cover.advanced_energy_detector.mode_eu", "cover.advanced_energy_detector.mode_percent") - .setTooltipHoverString("cover.advanced_energy_detector.modes_tooltip") - ); + group.addWidget( + new CycleButtonWidget(72, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isUsePercent, this::setUsePercent, + "cover.advanced_energy_detector.mode_eu", "cover.advanced_energy_detector.mode_percent") + .setTooltipHoverString("cover.advanced_energy_detector.modes_tooltip")); // invert logic button group.addWidget(new LabelWidget(10, 5 + 4 * (SIZE + PADDING), "cover.generic.advanced_detector.invert_label")); - group.addWidget(new CycleButtonWidget(72, 4 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isInverted, this::setInverted, - "cover.machine_controller.normal", "cover.machine_controller.inverted") - .setTooltipHoverString("cover.advanced_energy_detector.invert_tooltip") - ); + group.addWidget( + new CycleButtonWidget(72, 4 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isInverted, this::setInverted, + "cover.machine_controller.normal", "cover.machine_controller.inverted") + .setTooltipHoverString("cover.advanced_energy_detector.invert_tooltip")); return ModularUI.builder(GuiTextures.BACKGROUND, 176 + (3 * SIZE), 108 + (SIZE)) .widget(group) @@ -119,14 +123,16 @@ public ModularUI createUI(EntityPlayer player) { private WidgetGroup constructWidgetsToUpdate() { WidgetGroup sync = new WidgetGroup(); - sync.addWidget(new TextFieldWidget2(76, 5 + (SIZE + PADDING), 8 * SIZE, SIZE, this::getMinValue, this::setMinValue) - .setAllowedChars(TextFieldWidget2.NATURAL_NUMS) - .setMaxLength(this.getLength()) - .setPostFix(this.getPostFix())); - sync.addWidget(new TextFieldWidget2(76, 5 + 2 * (SIZE + PADDING), 8 * SIZE, SIZE, this::getMaxValue, this::setMaxValue) - .setAllowedChars(TextFieldWidget2.NATURAL_NUMS) - .setMaxLength(this.getLength()) - .setPostFix(this.getPostFix())); + sync.addWidget( + new TextFieldWidget2(76, 5 + (SIZE + PADDING), 8 * SIZE, SIZE, this::getMinValue, this::setMinValue) + .setAllowedChars(TextFieldWidget2.NATURAL_NUMS) + .setMaxLength(this.getLength()) + .setPostFix(this.getPostFix())); + sync.addWidget( + new TextFieldWidget2(76, 5 + 2 * (SIZE + PADDING), 8 * SIZE, SIZE, this::getMaxValue, this::setMaxValue) + .setAllowedChars(TextFieldWidget2.NATURAL_NUMS) + .setMaxLength(this.getLength()) + .setPostFix(this.getPostFix())); return sync; } @@ -206,7 +212,7 @@ public void readFromNBT(@Nonnull NBTTagCompound tagCompound) { readDeprecatedInvertedKeyFromNBT(tagCompound); } - //inverted here was saved using different key, now it is normalized but construction is for compatibility + // inverted here was saved using different key, now it is normalized but construction is for compatibility private void readDeprecatedInvertedKeyFromNBT(@Nonnull NBTTagCompound tagCompound) { String oldInvertedKey = "inverted"; if (!tagCompound.hasKey(NBT_KEY_IS_INVERTED) && tagCompound.hasKey(oldInvertedKey)) { diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorFluid.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorFluid.java index f18db72ee42..e3b0a26db68 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorFluid.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorFluid.java @@ -1,13 +1,10 @@ package gregtech.common.covers.detector; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; @@ -15,11 +12,17 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorFluid extends CoverDetectorBase implements ITickable { - public CoverDetectorFluid(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorFluid(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -29,7 +32,8 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_FLUID.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -37,7 +41,8 @@ public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 tra public void update() { if (getOffsetTimer() % 20 != 0) return; - IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null); + IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + null); if (fluidHandler == null) return; IFluidTankProperties[] tankProperties = fluidHandler.getTankProperties(); diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java index 9b42f2b94f4..32239be9036 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java @@ -1,10 +1,5 @@ package gregtech.common.covers.detector; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverWithUI; import gregtech.api.cover.CoverableView; @@ -14,6 +9,7 @@ import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; import gregtech.common.covers.filter.FluidFilterContainer; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; @@ -26,6 +22,12 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorFluidAdvanced extends CoverDetectorFluid implements CoverWithUI { @@ -41,13 +43,15 @@ public class CoverDetectorFluidAdvanced extends CoverDetectorFluid implements Co protected FluidFilterContainer fluidFilter; - public CoverDetectorFluidAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorFluidAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); this.fluidFilter = new FluidFilterContainer(this); } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -55,7 +59,8 @@ public CoverDetectorFluidAdvanced(@NotNull CoverDefinition definition, @NotNull } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_FLUID_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -69,31 +74,30 @@ public ModularUI createUI(EntityPlayer player) { group.addWidget(new ImageWidget(98 - 4, (SIZE + PADDING), 4 * SIZE, SIZE, GuiTextures.DISPLAY)); group.addWidget(new TextFieldWidget2(98, 5 + (SIZE + PADDING), 4 * SIZE, SIZE, this::getMinValue, this::setMinValue) - .setMaxLength(10) - .setAllowedChars(TextFieldWidget2.WHOLE_NUMS) - .setPostFix("L") - ); + .setMaxLength(10) + .setAllowedChars(TextFieldWidget2.WHOLE_NUMS) + .setPostFix("L")); // set max fluid amount group.addWidget(new LabelWidget(10, 5 + 2 * (SIZE + PADDING), "cover.advanced_fluid_detector.max")); group.addWidget(new ImageWidget(98 - 4, 2 * (SIZE + PADDING), 4 * SIZE, SIZE, GuiTextures.DISPLAY)); group.addWidget(new TextFieldWidget2(98, 5 + 2 * (SIZE + PADDING), 4 * SIZE, SIZE, this::getMaxValue, this::setMaxValue) - .setMaxLength(10) - .setAllowedChars(TextFieldWidget2.WHOLE_NUMS) - .setPostFix("L") - ); + .setMaxLength(10) + .setAllowedChars(TextFieldWidget2.WHOLE_NUMS) + .setPostFix("L")); // invert logic button -// group.addWidget(new LabelWidget(10, 5 + 3 * (SIZE + PADDING), "cover.generic.advanced_detector.invert_label")); - group.addWidget(new CycleButtonWidget(10, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isInverted, this::setInverted, - "cover.machine_controller.normal", "cover.machine_controller.inverted") - .setTooltipHoverString("cover.generic.advanced_detector.invert_tooltip") - ); - group.addWidget(new CycleButtonWidget(94, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isLatched, this::setLatched, - "cover.generic.advanced_detector.continuous", "cover.generic.advanced_detector.latched") - .setTooltipHoverString("cover.generic.advanced_detector.latch_tooltip") - ); + // group.addWidget(new LabelWidget(10, 5 + 3 * (SIZE + PADDING), + // "cover.generic.advanced_detector.invert_label")); + group.addWidget( + new CycleButtonWidget(10, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isInverted, this::setInverted, + "cover.machine_controller.normal", "cover.machine_controller.inverted") + .setTooltipHoverString("cover.generic.advanced_detector.invert_tooltip")); + group.addWidget( + new CycleButtonWidget(94, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isLatched, this::setLatched, + "cover.generic.advanced_detector.continuous", "cover.generic.advanced_detector.latched") + .setTooltipHoverString("cover.generic.advanced_detector.latch_tooltip")); this.fluidFilter.initUI(5 + 4 * (SIZE + PADDING), group::addWidget); @@ -131,7 +135,8 @@ public boolean isLatched() { public void update() { if (getOffsetTimer() % 20 != 0) return; - IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null); + IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + null); if (fluidHandler == null) return; IFluidTankProperties[] tankProperties = fluidHandler.getTankProperties(); @@ -145,7 +150,8 @@ public void update() { } if (isLatched) { - outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(storedFluid, max, min, isInverted(), outputAmount); + outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(storedFluid, max, min, isInverted(), + outputAmount); } else { outputAmount = RedstoneUtil.computeRedstoneBetweenValues(storedFluid, max, min, isInverted()); } diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorItem.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorItem.java index eca5ce69970..00df1e03792 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorItem.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorItem.java @@ -1,23 +1,26 @@ package gregtech.common.covers.detector; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorItem extends CoverDetectorBase implements ITickable { - public CoverDetectorItem(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorItem(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -27,7 +30,8 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_ITEM.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -35,7 +39,8 @@ public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 tra public void update() { if (getOffsetTimer() % 20 != 0) return; - IItemHandler itemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); + IItemHandler itemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + null); if (itemHandler == null) return; int storedItems = 0; diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorItemAdvanced.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorItemAdvanced.java index 5d21c484b1c..7d992674a93 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorItemAdvanced.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorItemAdvanced.java @@ -1,10 +1,5 @@ package gregtech.common.covers.detector; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverWithUI; import gregtech.api.cover.CoverableView; @@ -14,6 +9,7 @@ import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; import gregtech.common.covers.filter.ItemFilterContainer; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; @@ -24,6 +20,12 @@ import net.minecraft.util.EnumHand; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorItemAdvanced extends CoverDetectorItem implements CoverWithUI { @@ -38,13 +40,15 @@ public class CoverDetectorItemAdvanced extends CoverDetectorItem implements Cove private boolean isLatched = false; protected ItemFilterContainer itemFilter; - public CoverDetectorItemAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorItemAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); this.itemFilter = new ItemFilterContainer(this); } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_ITEM_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -58,30 +62,30 @@ public ModularUI createUI(EntityPlayer player) { group.addWidget(new ImageWidget(98 - 4, (SIZE + PADDING), 4 * SIZE, SIZE, GuiTextures.DISPLAY)); group.addWidget(new TextFieldWidget2(98, 5 + (SIZE + PADDING), 4 * SIZE, SIZE, this::getMinValue, this::setMinValue) - .setMaxLength(10) - .setAllowedChars(TextFieldWidget2.WHOLE_NUMS) - ); + .setMaxLength(10) + .setAllowedChars(TextFieldWidget2.WHOLE_NUMS)); // set max fluid amount group.addWidget(new LabelWidget(10, 5 + 2 * (SIZE + PADDING), "cover.advanced_item_detector.max")); group.addWidget(new ImageWidget(98 - 4, 2 * (SIZE + PADDING), 4 * SIZE, SIZE, GuiTextures.DISPLAY)); group.addWidget(new TextFieldWidget2(98, 5 + 2 * (SIZE + PADDING), 4 * SIZE, SIZE, this::getMaxValue, this::setMaxValue) - .setMaxLength(10) - .setAllowedChars(TextFieldWidget2.WHOLE_NUMS) - ); + .setMaxLength(10) + .setAllowedChars(TextFieldWidget2.WHOLE_NUMS)); // invert logic button - // group.addWidget(new LabelWidget(10, 5 + 3 * (SIZE + PADDING), "cover.generic.advanced_detector.invert_label")); - group.addWidget(new CycleButtonWidget(10, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isInverted, this::setInverted, - "cover.machine_controller.normal", "cover.machine_controller.inverted") - .setTooltipHoverString("cover.generic.advanced_detector.invert_tooltip") - ); - // group.addWidget(new LabelWidget(10, 5 + 4 * (SIZE + PADDING), "cover.generic.advanced_detector.latch_label")); - group.addWidget(new CycleButtonWidget(94, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isLatched, this::setLatched, - "cover.generic.advanced_detector.continuous", "cover.generic.advanced_detector.latched") - .setTooltipHoverString("cover.generic.advanced_detector.latch_tooltip") - ); + // group.addWidget(new LabelWidget(10, 5 + 3 * (SIZE + PADDING), + // "cover.generic.advanced_detector.invert_label")); + group.addWidget( + new CycleButtonWidget(10, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isInverted, this::setInverted, + "cover.machine_controller.normal", "cover.machine_controller.inverted") + .setTooltipHoverString("cover.generic.advanced_detector.invert_tooltip")); + // group.addWidget(new LabelWidget(10, 5 + 4 * (SIZE + PADDING), + // "cover.generic.advanced_detector.latch_label")); + group.addWidget( + new CycleButtonWidget(94, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isLatched, this::setLatched, + "cover.generic.advanced_detector.continuous", "cover.generic.advanced_detector.latched") + .setTooltipHoverString("cover.generic.advanced_detector.latch_tooltip")); this.itemFilter.initUI(5 + 4 * (SIZE + PADDING), group::addWidget); @@ -128,7 +132,8 @@ public boolean isLatched() { } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -139,7 +144,8 @@ public boolean isLatched() { public void update() { if (getOffsetTimer() % 20 != 0) return; - IItemHandler itemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); + IItemHandler itemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + null); if (itemHandler == null) return; int storedItems = 0; @@ -150,7 +156,8 @@ public void update() { } if (isLatched) { - outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(storedItems, max, min, isInverted(), outputAmount); + outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(storedItems, max, min, isInverted(), + outputAmount); } else { outputAmount = RedstoneUtil.computeRedstoneBetweenValues(storedItems, max, min, isInverted()); } diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorMaintenance.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorMaintenance.java index db3705f5272..85bb2b17dce 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorMaintenance.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorMaintenance.java @@ -1,34 +1,37 @@ package gregtech.common.covers.detector; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.metatileentity.multiblock.IMaintenance; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorMaintenance extends CoverDetectorBase implements ITickable { - public CoverDetectorMaintenance(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorMaintenance(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @Override public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing side) { - return ConfigHolder.machines.enableMaintenance - && coverable instanceof IMaintenance maintenance - && maintenance.hasMaintenanceMechanics(); + return ConfigHolder.machines.enableMaintenance && coverable instanceof IMaintenance maintenance && + maintenance.hasMaintenanceMechanics(); } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_MAINTENANCE.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/facade/FacadeHelper.java b/src/main/java/gregtech/common/covers/facade/FacadeHelper.java index 53a8d712d1c..890f1a22afe 100644 --- a/src/main/java/gregtech/common/covers/facade/FacadeHelper.java +++ b/src/main/java/gregtech/common/covers/facade/FacadeHelper.java @@ -1,16 +1,16 @@ package gregtech.common.covers.facade; -import com.google.common.collect.ImmutableList; import gregtech.api.util.GTUtility; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.util.NonNullList; + +import com.google.common.collect.ImmutableList; public class FacadeHelper { @@ -35,7 +35,7 @@ public static ImmutableList getValidFacadeItems() { public static boolean isValidFacade(ItemStack itemStack) { IBlockState rawBlockState = lookupBlockForItemUnsafe(itemStack); - //noinspection deprecation + // noinspection deprecation return rawBlockState != null && !rawBlockState.getBlock().hasTileEntity(rawBlockState) && !rawBlockState.getBlock().hasTileEntity() && @@ -58,7 +58,7 @@ private static IBlockState lookupBlockForItemUnsafe(ItemStack itemStack) { Block block = ((ItemBlock) itemStack.getItem()).getBlock(); int blockMetadata = itemStack.getItem().getMetadata(itemStack); try { - //noinspection deprecation + // noinspection deprecation return block.getStateFromMeta(blockMetadata); } catch (Throwable e) { return null; diff --git a/src/main/java/gregtech/common/covers/filter/FilterTypeRegistry.java b/src/main/java/gregtech/common/covers/filter/FilterTypeRegistry.java index e0d75d70c86..633242b05d2 100644 --- a/src/main/java/gregtech/common/covers/filter/FilterTypeRegistry.java +++ b/src/main/java/gregtech/common/covers/filter/FilterTypeRegistry.java @@ -1,13 +1,15 @@ package gregtech.common.covers.filter; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; import gregtech.api.unification.stack.ItemAndMetadata; import gregtech.api.util.GTLog; import gregtech.common.items.MetaItems; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.item.ItemStack; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.Map; public class FilterTypeRegistry { diff --git a/src/main/java/gregtech/common/covers/filter/FluidFilter.java b/src/main/java/gregtech/common/covers/filter/FluidFilter.java index 89ba98a55f1..6d6dc23254b 100644 --- a/src/main/java/gregtech/common/covers/filter/FluidFilter.java +++ b/src/main/java/gregtech/common/covers/filter/FluidFilter.java @@ -2,6 +2,7 @@ import gregtech.api.gui.Widget; import gregtech.api.util.IDirtyNotifiable; + import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/gregtech/common/covers/filter/FluidFilterContainer.java b/src/main/java/gregtech/common/covers/filter/FluidFilterContainer.java index 6f9d61952e7..85f663561a6 100644 --- a/src/main/java/gregtech/common/covers/filter/FluidFilterContainer.java +++ b/src/main/java/gregtech/common/covers/filter/FluidFilterContainer.java @@ -5,16 +5,18 @@ import gregtech.api.gui.widgets.LabelWidget; import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.util.IDirtyNotifiable; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; import java.util.function.Consumer; import java.util.function.Supplier; +import javax.annotation.Nonnull; + public class FluidFilterContainer implements INBTSerializable { private final ItemStackHandler filterInventory; @@ -23,6 +25,7 @@ public class FluidFilterContainer implements INBTSerializable { public FluidFilterContainer(IDirtyNotifiable dirtyNotifiable, int capacity) { this.filterWrapper = new FluidFilterWrapper(dirtyNotifiable, capacity); this.filterInventory = new ItemStackHandler(1) { + @Override public boolean isItemValid(int slot, @Nonnull ItemStack stack) { return FilterTypeRegistry.getFluidFilterForStack(stack) != null; @@ -74,7 +77,7 @@ public void initUI(int y, Consumer widgetGroup) { .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.FILTER_SLOT_OVERLAY)); this.filterWrapper.initUI(y + 15, widgetGroup); - this.filterWrapper.blacklistUI(y + 15, widgetGroup, ()-> true); + this.filterWrapper.blacklistUI(y + 15, widgetGroup, () -> true); } protected void onFilterSlotChange(boolean notify) { @@ -88,9 +91,9 @@ protected void onFilterSlotChange(boolean notify) { } } else if (currentFluidFilter == null || newFluidFilter.getClass() != currentFluidFilter.getClass()) { - filterWrapper.setFluidFilter(newFluidFilter); - if (notify) filterWrapper.onFilterInstanceChange(); - } + filterWrapper.setFluidFilter(newFluidFilter); + if (notify) filterWrapper.onFilterInstanceChange(); + } } public boolean testFluidStack(FluidStack fluidStack) { diff --git a/src/main/java/gregtech/common/covers/filter/FluidFilterWrapper.java b/src/main/java/gregtech/common/covers/filter/FluidFilterWrapper.java index 4bf7485ab6f..2ef1f76a32e 100644 --- a/src/main/java/gregtech/common/covers/filter/FluidFilterWrapper.java +++ b/src/main/java/gregtech/common/covers/filter/FluidFilterWrapper.java @@ -5,6 +5,7 @@ import gregtech.api.gui.widgets.ServerWidgetGroup; import gregtech.api.gui.widgets.ToggleButtonWidget; import gregtech.api.util.IDirtyNotifiable; + import net.minecraftforge.fluids.FluidStack; import java.util.function.BooleanSupplier; @@ -35,7 +36,8 @@ public void initUI(int y, Consumer widgetGroup) { public void blacklistUI(int y, Consumer widgetGroup, BooleanSupplier showBlacklistButton) { ServerWidgetGroup blacklistButton = new ServerWidgetGroup(() -> getFluidFilter() != null); blacklistButton.addWidget(new ToggleButtonWidget(144, y, 18, 18, GuiTextures.BUTTON_BLACKLIST, - this::isBlacklistFilter, this::setBlacklistFilter).setPredicate(showBlacklistButton).setTooltipText("cover.filter.blacklist")); + this::isBlacklistFilter, this::setBlacklistFilter).setPredicate(showBlacklistButton) + .setTooltipText("cover.filter.blacklist")); widgetGroup.accept(blacklistButton); } diff --git a/src/main/java/gregtech/common/covers/filter/ItemFilter.java b/src/main/java/gregtech/common/covers/filter/ItemFilter.java index f947283ee14..a5b350da33d 100644 --- a/src/main/java/gregtech/common/covers/filter/ItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/ItemFilter.java @@ -2,6 +2,7 @@ import gregtech.api.gui.Widget; import gregtech.api.util.IDirtyNotifiable; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -21,8 +22,7 @@ public final void setMaxStackSize(int maxStackSize) { onMaxStackSizeChange(); } - protected void onMaxStackSizeChange() { - } + protected void onMaxStackSizeChange() {} public abstract boolean showGlobalTransferLimitSlider(); diff --git a/src/main/java/gregtech/common/covers/filter/ItemFilterContainer.java b/src/main/java/gregtech/common/covers/filter/ItemFilterContainer.java index 2cccb67d255..21aaaa56b01 100644 --- a/src/main/java/gregtech/common/covers/filter/ItemFilterContainer.java +++ b/src/main/java/gregtech/common/covers/filter/ItemFilterContainer.java @@ -5,15 +5,17 @@ import gregtech.api.gui.widgets.LabelWidget; import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.util.IDirtyNotifiable; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; import java.util.function.Consumer; +import javax.annotation.Nonnull; + public class ItemFilterContainer implements INBTSerializable { private final ItemStackHandler filterInventory; @@ -25,6 +27,7 @@ public ItemFilterContainer(IDirtyNotifiable dirtyNotifiable) { this.filterWrapper = new ItemFilterWrapper(dirtyNotifiable); this.filterWrapper.setOnFilterInstanceChange(this::onFilterInstanceChange); this.filterInventory = new ItemStackHandler(1) { + @Override public boolean isItemValid(int slot, @Nonnull ItemStack stack) { return FilterTypeRegistry.getItemFilterForStack(stack) != null; @@ -100,9 +103,9 @@ protected void onFilterSlotChange(boolean notify) { } } else if (currentItemFilter == null || newItemFilter.getClass() != currentItemFilter.getClass()) { - filterWrapper.setItemFilter(newItemFilter); - if (notify) filterWrapper.onFilterInstanceChange(); - } + filterWrapper.setItemFilter(newItemFilter); + if (notify) filterWrapper.onFilterInstanceChange(); + } } public void setMaxStackSize(int maxStackSizeLimit) { @@ -159,5 +162,4 @@ public void deserializeNBT(NBTTagCompound tagCompound) { this.filterWrapper.getItemFilter().readFromNBT(tagCompound.getCompoundTag("Filter")); } } - } diff --git a/src/main/java/gregtech/common/covers/filter/ItemFilterWrapper.java b/src/main/java/gregtech/common/covers/filter/ItemFilterWrapper.java index c0f7b99bbeb..d11905e00b5 100644 --- a/src/main/java/gregtech/common/covers/filter/ItemFilterWrapper.java +++ b/src/main/java/gregtech/common/covers/filter/ItemFilterWrapper.java @@ -5,6 +5,7 @@ import gregtech.api.gui.widgets.ServerWidgetGroup; import gregtech.api.gui.widgets.ToggleButtonWidget; import gregtech.api.util.IDirtyNotifiable; + import net.minecraft.item.ItemStack; import java.util.function.BooleanSupplier; @@ -30,7 +31,8 @@ public void initUI(int y, Consumer widgetGroup) { public void blacklistUI(int y, Consumer widgetGroup, BooleanSupplier showBlacklistButton) { ServerWidgetGroup blacklistButton = new ServerWidgetGroup(() -> getItemFilter() != null); blacklistButton.addWidget(new ToggleButtonWidget(144, y, 20, 20, GuiTextures.BUTTON_BLACKLIST, - this::isBlacklistFilter, this::setBlacklistFilter).setPredicate(showBlacklistButton).setTooltipText("cover.filter.blacklist")); + this::isBlacklistFilter, this::setBlacklistFilter).setPredicate(showBlacklistButton) + .setTooltipText("cover.filter.blacklist")); widgetGroup.accept(blacklistButton); } diff --git a/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java b/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java index 095e27ce06d..95cc2f172e0 100644 --- a/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java @@ -14,12 +14,14 @@ import gregtech.common.gui.widget.HighlightedTextField; import gregtech.common.gui.widget.orefilter.ItemOreFilterTestSlot; import gregtech.common.gui.widget.orefilter.OreGlobCompileStatusWidget; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.text.TextFormatting; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; import java.util.Set; import java.util.function.Consumer; @@ -116,7 +118,8 @@ public void initUI(Consumer widgetGroup) { @Override public Object matchItemStack(ItemStack itemStack) { - return matchesItemStack(itemStack) ? "wtf is this system?? i can put any non null object here and it i will work??? $arch" : null; + return matchesItemStack(itemStack) ? + "wtf is this system?? i can put any non null object here and it i will work??? $arch" : null; } public boolean matchesItemStack(ItemStack itemStack) { diff --git a/src/main/java/gregtech/common/covers/filter/SimpleFluidFilter.java b/src/main/java/gregtech/common/covers/filter/SimpleFluidFilter.java index b6998378659..16a62e6821e 100644 --- a/src/main/java/gregtech/common/covers/filter/SimpleFluidFilter.java +++ b/src/main/java/gregtech/common/covers/filter/SimpleFluidFilter.java @@ -3,15 +3,17 @@ import gregtech.api.gui.GuiTextures; import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.PhantomFluidWidget; + import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; -import javax.annotation.Nullable; import java.util.function.Consumer; +import javax.annotation.Nullable; + public class SimpleFluidFilter extends FluidFilter { private static final int MAX_FLUID_SLOTS = 9; @@ -21,6 +23,7 @@ public class SimpleFluidFilter extends FluidFilter { public SimpleFluidFilter() { for (int i = 0; i < MAX_FLUID_SLOTS; ++i) { fluidFilterTanks[i] = new FluidTank(1000) { + @Override public void setFluid(@Nullable FluidStack fluid) { super.setFluid(fluid); @@ -61,7 +64,7 @@ public void initUI(Consumer widgetGroup) { for (int i = 0; i < 9; ++i) { widgetGroup.accept((new PhantomFluidWidget(10 + 18 * (i % 3), 18 * (i / 3), 18, 18, this.fluidFilterTanks[i])) - .setBackgroundTexture(GuiTextures.SLOT).showTipSupplier(this::shouldShowTip)); + .setBackgroundTexture(GuiTextures.SLOT).showTipSupplier(this::shouldShowTip)); } } @@ -112,5 +115,4 @@ public int getFluidTransferLimit(FluidStack fluidStack) { } return limit; } - } diff --git a/src/main/java/gregtech/common/covers/filter/SimpleItemFilter.java b/src/main/java/gregtech/common/covers/filter/SimpleItemFilter.java index f539b4a3e1e..864986ca805 100644 --- a/src/main/java/gregtech/common/covers/filter/SimpleItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/SimpleItemFilter.java @@ -5,6 +5,7 @@ import gregtech.api.gui.widgets.PhantomSlotWidget; import gregtech.api.gui.widgets.ToggleButtonWidget; import gregtech.api.util.LargeStackSizeItemStackHandler; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.items.IItemHandler; @@ -22,6 +23,7 @@ public class SimpleItemFilter extends ItemFilter { public SimpleItemFilter() { this.itemFilterSlots = new LargeStackSizeItemStackHandler(MAX_MATCH_SLOTS) { + @Override public int getSlotLimit(int slot) { return getMaxStackSize(); @@ -87,13 +89,13 @@ public int getTotalOccupiedHeight() { @Override public void initUI(Consumer widgetGroup) { for (int i = 0; i < 9; i++) { - widgetGroup.accept(new PhantomSlotWidget(itemFilterSlots, i, 10 + 18 * (i % 3), 18 * (i / 3)).setBackgroundTexture(GuiTextures.SLOT)); + widgetGroup.accept(new PhantomSlotWidget(itemFilterSlots, i, 10 + 18 * (i % 3), 18 * (i / 3)) + .setBackgroundTexture(GuiTextures.SLOT)); } widgetGroup.accept(new ToggleButtonWidget(74, 0, 20, 20, GuiTextures.BUTTON_FILTER_DAMAGE, () -> ignoreDamage, this::setIgnoreDamage).setTooltipText("cover.item_filter.ignore_damage")); widgetGroup.accept(new ToggleButtonWidget(99, 0, 20, 20, GuiTextures.BUTTON_FILTER_NBT, () -> ignoreNBT, this::setIgnoreNBT).setTooltipText("cover.item_filter.ignore_nbt")); - } @Override @@ -110,7 +112,8 @@ public void readFromNBT(NBTTagCompound tagCompound) { this.ignoreNBT = tagCompound.getBoolean("IgnoreNBT"); } - public static int itemFilterMatch(IItemHandler filterSlots, boolean ignoreDamage, boolean ignoreNBTData, ItemStack itemStack) { + public static int itemFilterMatch(IItemHandler filterSlots, boolean ignoreDamage, boolean ignoreNBTData, + ItemStack itemStack) { for (int i = 0; i < filterSlots.getSlots(); i++) { ItemStack filterStack = filterSlots.getStackInSlot(i); if (!filterStack.isEmpty() && areItemsEqual(ignoreDamage, ignoreNBTData, filterStack, itemStack)) { @@ -120,7 +123,8 @@ public static int itemFilterMatch(IItemHandler filterSlots, boolean ignoreDamage return -1; } - private static boolean areItemsEqual(boolean ignoreDamage, boolean ignoreNBTData, ItemStack filterStack, ItemStack itemStack) { + private static boolean areItemsEqual(boolean ignoreDamage, boolean ignoreNBTData, ItemStack filterStack, + ItemStack itemStack) { if (ignoreDamage) { if (!filterStack.isItemEqualIgnoreDurability(itemStack)) { return false; diff --git a/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java b/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java index cb816baa899..df44ad98b78 100644 --- a/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java @@ -7,16 +7,19 @@ import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.ingredients.GTRecipeInput; import gregtech.api.unification.stack.ItemAndMetadata; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IStringSerializable; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.Collections; import java.util.Map; import java.util.function.Consumer; +import javax.annotation.Nonnull; + public class SmartItemFilter extends ItemFilter { private SmartFilteringMode filteringMode = SmartFilteringMode.ELECTROLYZER; @@ -45,7 +48,8 @@ public Object matchItemStack(ItemStack itemStack) { ItemStack infinitelyBigStack = itemStack.copy(); infinitelyBigStack.setCount(Integer.MAX_VALUE); - Recipe recipe = filteringMode.recipeMap.findRecipe(Long.MAX_VALUE, Collections.singletonList(infinitelyBigStack), Collections.emptyList()); + Recipe recipe = filteringMode.recipeMap.findRecipe(Long.MAX_VALUE, + Collections.singletonList(infinitelyBigStack), Collections.emptyList()); if (recipe == null) { filteringMode.transferStackSizesCache.put(itemAndMetadata, 0); cachedTransferRateValue = 0; @@ -66,7 +70,7 @@ public Object matchItemStack(ItemStack itemStack) { public void initUI(Consumer widgetGroup) { widgetGroup.accept(new CycleButtonWidget(10, 0, 75, 20, SmartFilteringMode.class, this::getFilteringMode, this::setFilteringMode) - .setTooltipHoverString("cover.smart_item_filter.filtering_mode.description")); + .setTooltipHoverString("cover.smart_item_filter.filtering_mode.description")); } @Override @@ -90,6 +94,7 @@ public void readFromNBT(NBTTagCompound tagCompound) { } private static class ItemAndMetadataAndStackSize { + public final ItemAndMetadata itemAndMetadata; public final int transferStackSize; @@ -113,6 +118,7 @@ public int hashCode() { } public enum SmartFilteringMode implements IStringSerializable { + ELECTROLYZER("cover.smart_item_filter.filtering_mode.electrolyzer", RecipeMaps.ELECTROLYZER_RECIPES), CENTRIFUGE("cover.smart_item_filter.filtering_mode.centrifuge", RecipeMaps.CENTRIFUGE_RECIPES), SIFTER("cover.smart_item_filter.filtering_mode.sifter", RecipeMaps.SIFTER_RECIPES); @@ -132,6 +138,4 @@ public String getName() { return localeName; } } - - } diff --git a/src/main/java/gregtech/common/covers/filter/WidgetGroupFluidFilter.java b/src/main/java/gregtech/common/covers/filter/WidgetGroupFluidFilter.java index 85c79ef13fa..f2c08f856b3 100644 --- a/src/main/java/gregtech/common/covers/filter/WidgetGroupFluidFilter.java +++ b/src/main/java/gregtech/common/covers/filter/WidgetGroupFluidFilter.java @@ -2,6 +2,7 @@ import gregtech.api.gui.widgets.AbstractWidgetGroup; import gregtech.api.util.Position; + import net.minecraft.network.PacketBuffer; import java.util.function.Supplier; @@ -12,7 +13,8 @@ public class WidgetGroupFluidFilter extends AbstractWidgetGroup { private final Supplier showTipSupplier; private FluidFilter fluidFilter; - public WidgetGroupFluidFilter(int yPosition, Supplier fluidFilterSupplier, Supplier showTipSupplier) { + public WidgetGroupFluidFilter(int yPosition, Supplier fluidFilterSupplier, + Supplier showTipSupplier) { super(new Position(18 + 5, yPosition)); this.fluidFilterSupplier = fluidFilterSupplier; this.showTipSupplier = showTipSupplier; diff --git a/src/main/java/gregtech/common/covers/filter/WidgetGroupItemFilter.java b/src/main/java/gregtech/common/covers/filter/WidgetGroupItemFilter.java index 5ad2a3dede3..d5601f2b2ab 100644 --- a/src/main/java/gregtech/common/covers/filter/WidgetGroupItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/WidgetGroupItemFilter.java @@ -2,6 +2,7 @@ import gregtech.api.gui.widgets.AbstractWidgetGroup; import gregtech.api.util.Position; + import net.minecraft.network.PacketBuffer; import java.util.function.Supplier; diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeInterpreter.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeInterpreter.java index c2ddfd701d4..35ef46bd4aa 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeInterpreter.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeInterpreter.java @@ -3,6 +3,7 @@ import gregtech.common.covers.filter.oreglob.node.BranchType; import gregtech.common.covers.filter.oreglob.node.NodeVisitor; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; + import it.unimi.dsi.fastutil.ints.*; import java.util.List; @@ -18,6 +19,7 @@ *

* For example, matching the input {@code "ingotIron"} with string {@code "i"} and * input state of {@code [ 0, 1, 2, 3, 4, 5 ]} would each produce these output states. + * *

  *     0  =>  [ 1 ]  (the first "i" matches the string match node "i")
  *     1  =>  [ ]    (no match; "n" does not match the string match node "i")
@@ -26,6 +28,7 @@
  *     4  =>  [ ]    (no match; "t" does not match the string match node "i")
  *     5  =>  [ 6 ]  (the "I" matches the string match node "i"; oreglob is by default case insensitive.)
  * 
+ * * When the next node gets evaluated, the input state will be the last evaluation result * from the last node; in the example above, input state for the node after {@code "i"} * will be {@code [ 1, 6 ]}. @@ -35,6 +38,7 @@ * without using surrogate pairs. */ class NodeInterpreter implements NodeVisitor { + private final String input; private IntSet inputStates; private IntSet outputStates = new IntLinkedOpenHashSet(); @@ -171,7 +175,8 @@ public void branch(BranchType type, List nodes, boolean not) { IntSet out2 = new IntOpenHashSet(branchState.outputStates); out2.removeAll(this.outputStates); // out2 = { x in out2 AND x !in out } this.outputStates.removeAll(branchState.outputStates); // out = { x in out AND x !in out2 } - this.outputStates.addAll(out2); // out = { ( x in out AND x !in out2 ) OR ( x in out2 AND x !in out ) } + this.outputStates.addAll(out2); // out = { ( x in out AND x !in out2 ) OR ( x in out2 AND x !in out + // ) } } } default -> throw new IllegalStateException("Unknown BranchType '" + type + "'"); diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java index 8af400e4b7b..4d6fe44298d 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java @@ -1,10 +1,11 @@ package gregtech.common.covers.filter.oreglob.impl; -import com.google.common.annotations.VisibleForTesting; import gregtech.api.util.oreglob.OreGlob; import gregtech.api.util.oreglob.OreGlobTextBuilder; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; +import com.google.common.annotations.VisibleForTesting; + import javax.annotation.Nonnull; /** diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java index 8475fe47572..f779cc94429 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java @@ -2,15 +2,18 @@ import gregtech.api.util.oreglob.OreGlobTextBuilder; import gregtech.api.util.oreglob.VisualizationHint; + import net.minecraft.util.text.TextFormatting; + import org.xml.sax.Attributes; import org.xml.sax.helpers.DefaultHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + final class NodeVisualXMLHandler extends DefaultHandler { private final OreGlobTextBuilder builder; diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java index 24365e243aa..448ebc176ff 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java @@ -6,17 +6,19 @@ import gregtech.common.covers.filter.oreglob.node.BranchType; import gregtech.common.covers.filter.oreglob.node.NodeVisitor; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; + import org.xml.sax.SAXException; -import javax.annotation.Nullable; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.List; +import javax.annotation.Nullable; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + class NodeVisualizer implements NodeVisitor { private static boolean xmlParserErrorReported; @@ -62,7 +64,8 @@ public void chars(int amount, boolean not) { @Override public void charsOrMore(int amount, boolean not) { - appendNodeXML(visualizer, not ? OreGlobMessages.PREVIEW_CHARS_OR_MORE_NOT : OreGlobMessages.PREVIEW_CHARS_OR_MORE, amount); + appendNodeXML(visualizer, + not ? OreGlobMessages.PREVIEW_CHARS_OR_MORE_NOT : OreGlobMessages.PREVIEW_CHARS_OR_MORE, amount); } @Override @@ -84,7 +87,8 @@ public void branch(BranchType type, List nodes, boolean not) { for (int i = 0; i < nodes.size(); i++) { OreGlobNode node = nodes.get(i); visualizer.newLine(indents); - appendNodeXML(visualizer, i == 0 ? OreGlobMessages.PREVIEW_OR_ENTRY_START : OreGlobMessages.PREVIEW_OR_ENTRY); + appendNodeXML(visualizer, + i == 0 ? OreGlobMessages.PREVIEW_OR_ENTRY_START : OreGlobMessages.PREVIEW_OR_ENTRY); new NodeVisualizer(visualizer, indents + 1).visit(node); } } @@ -93,7 +97,8 @@ public void branch(BranchType type, List nodes, boolean not) { for (int i = 0; i < nodes.size(); i++) { OreGlobNode node = nodes.get(i); visualizer.newLine(indents); - appendNodeXML(visualizer, i == 0 ? OreGlobMessages.PREVIEW_AND_ENTRY_START : OreGlobMessages.PREVIEW_AND_ENTRY); + appendNodeXML(visualizer, + i == 0 ? OreGlobMessages.PREVIEW_AND_ENTRY_START : OreGlobMessages.PREVIEW_AND_ENTRY); new NodeVisualizer(visualizer, indents + 1).visit(node); } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java index 48bb123464b..602cde45011 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java @@ -5,14 +5,16 @@ import gregtech.common.covers.filter.oreglob.node.OreGlobNode; import gregtech.common.covers.filter.oreglob.node.OreGlobNodes; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.common.covers.filter.oreglob.impl.OreGlobParser.TokenType.*; /** * Top-down parser for oreGlob expression. + * *
  * oreGlob = [ FLAG ], [ or ], EOF
  *
@@ -185,8 +187,7 @@ private void addFlag(int flag, int index) {
                 }
             }
             default -> warn(OreGlobMessages.compileErrorUnknownCompilationFlag(
-                    new StringBuilder().appendCodePoint(flag).toString()
-            ), index, 1);
+                    new StringBuilder().appendCodePoint(flag).toString()), index, 1);
         }
     }
 
@@ -219,7 +220,7 @@ private OreGlobNode or() {
             // Eat through OR tokens as much as we can, to prevent scenario where
             // a disgusting C like lang users type || and complain their filter is broken
             // noinspection StatementWithEmptyBody
-            while (advanceIf(OR)) ;
+            while (advanceIf(OR));
             nodes.add(and());
         } while (advanceIf(OR));
         return OreGlobNodes.or(nodes);
@@ -234,7 +235,7 @@ private OreGlobNode and() {
             // Eat through AND tokens as much as we can, to prevent scenario where
             // a disgusting C like lang users type && and complain their filter is broken
             // noinspection StatementWithEmptyBody
-            while (advanceIf(AND)) ;
+            while (advanceIf(AND));
             nodes.add(xor());
         } while (advanceIf(AND));
         return OreGlobNodes.and(nodes);
@@ -282,7 +283,8 @@ private OreGlobNode not(boolean nested) {
                 int tokenStart = this.tokenStart;
                 OreGlobNode node = not(nested || not);
                 if (OreGlobNodes.isNegatedMatch(root) && OreGlobNodes.isNegatedMatch(node)) {
-                    warn(OreGlobMessages.compileWarnConsecutiveNegation(), tokenStart, tokenStart + tokenLength - tokenStart);
+                    warn(OreGlobMessages.compileWarnConsecutiveNegation(), tokenStart,
+                            tokenStart + tokenLength - tokenStart);
                 }
                 root = OreGlobNodes.append(root, node);
             }
@@ -311,11 +313,12 @@ yield switch (tokenType) {
                         advance();
                         yield OreGlobNodes.empty();
                     }
-                    // To preserve consistency between grouped expression below, enclosing parenthesis of nothing match is also optional
+                    // To preserve consistency between grouped expression below, enclosing parenthesis of nothing match
+                    // is also optional
                     // For example, this is totally valid ore expression
-                    //    (
+                    // (
                     // ...in the same logic the ore expression below is valid
-                    //    ( ore* | ingot*
+                    // ( ore* | ingot*
                     case EOF -> OreGlobNodes.empty();
                     default -> {
                         OreGlobNode result = or();
diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java
index 7eddaeafd5f..b7b856756f2 100644
--- a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java
+++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java
@@ -1,8 +1,9 @@
 package gregtech.common.covers.filter.oreglob.node;
 
-import javax.annotation.Nonnull;
 import java.util.List;
 
+import javax.annotation.Nonnull;
+
 class BranchNode extends OreGlobNode {
 
     final BranchType type;
@@ -28,28 +29,28 @@ protected MatchDescription getIndividualNodeMatchDescription() {
             case 0 -> this.type == BranchType.AND ? MatchDescription.EVERYTHING : MatchDescription.NOTHING;
             case 1 -> this.expressions.get(0).getMatchDescription();
             default -> switch (this.type) {
-                case OR -> {
-                    MatchDescription union = MatchDescription.NOTHING;
-                    for (OreGlobNode node : this.expressions) {
-                        union = union.or(node.getMatchDescription());
+                    case OR -> {
+                        MatchDescription union = MatchDescription.NOTHING;
+                        for (OreGlobNode node : this.expressions) {
+                            union = union.or(node.getMatchDescription());
+                        }
+                        yield union;
                     }
-                    yield union;
-                }
-                case AND -> {
-                    MatchDescription intersection = MatchDescription.EVERYTHING;
-                    for (OreGlobNode node : this.expressions) {
-                        intersection = intersection.and(node.getMatchDescription());
+                    case AND -> {
+                        MatchDescription intersection = MatchDescription.EVERYTHING;
+                        for (OreGlobNode node : this.expressions) {
+                            intersection = intersection.and(node.getMatchDescription());
+                        }
+                        yield intersection;
                     }
-                    yield intersection;
-                }
-                case XOR -> {
-                    MatchDescription disjunction = MatchDescription.NOTHING;
-                    for (OreGlobNode node : this.expressions) {
-                        disjunction = disjunction.xor(node.getMatchDescription());
+                    case XOR -> {
+                        MatchDescription disjunction = MatchDescription.NOTHING;
+                        for (OreGlobNode node : this.expressions) {
+                            disjunction = disjunction.xor(node.getMatchDescription());
+                        }
+                        yield disjunction;
                     }
-                    yield disjunction;
-                }
-            };
+                };
         };
         return isNegated() ? description.complement() : description;
     }
diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchType.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchType.java
index d75481e7934..4ee7e1a6da9 100644
--- a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchType.java
+++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchType.java
@@ -1,5 +1,7 @@
 package gregtech.common.covers.filter.oreglob.node;
 
 public enum BranchType {
-    OR, AND, XOR
+    OR,
+    AND,
+    XOR
 }
diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchDescription.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchDescription.java
index 93b8fc3d225..0a655cb5b17 100644
--- a/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchDescription.java
+++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchDescription.java
@@ -1,6 +1,7 @@
 package gregtech.common.covers.filter.oreglob.node;
 
 public enum MatchDescription {
+
     /**
      * Matches all possible inputs.
      */
@@ -43,7 +44,7 @@ public boolean isComplete() {
 
     /**
      * @return If this description is incomplete; {@code OTHER_EXCLUDING_NOTHING} and
-     * {@code OTHER_INCLUDING_NOTHING} does not fully describe the match result.
+     *         {@code OTHER_INCLUDING_NOTHING} does not fully describe the match result.
      */
     public boolean isIncomplete() {
         return this == OTHER_EXCLUDING_EMPTY || this == OTHER_INCLUDING_EMPTY;
@@ -62,16 +63,16 @@ public MatchDescription append(MatchDescription another) {
         if (another == NOTHING) return NOTHING;
         return switch (this) {
             case EVERYTHING -> switch (another) {
-                case NONEMPTY -> NONEMPTY;
-                case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
-                case OTHER_INCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY;
-                default -> EVERYTHING;
-            };
+                    case NONEMPTY -> NONEMPTY;
+                    case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
+                    case OTHER_INCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY;
+                    default -> EVERYTHING;
+                };
             case NOTHING -> NOTHING;
             case NONEMPTY -> switch (another) { // 2 or more
-                case NONEMPTY, OTHER_EXCLUDING_EMPTY, OTHER_INCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
-                default -> NONEMPTY;
-            };
+                    case NONEMPTY, OTHER_EXCLUDING_EMPTY, OTHER_INCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
+                    default -> NONEMPTY;
+                };
             case EMPTY -> another;
             case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
             case OTHER_INCLUDING_EMPTY -> another.canMatchNothing() ? OTHER_INCLUDING_EMPTY : OTHER_EXCLUDING_EMPTY;
@@ -86,15 +87,15 @@ public MatchDescription or(MatchDescription desc) {
             case NOTHING -> desc;
             case NONEMPTY -> desc.canMatchNothing() ? EVERYTHING : NONEMPTY;
             case EMPTY -> switch (desc) {
-                case NONEMPTY -> EVERYTHING;
-                case OTHER_EXCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY;
-                default -> desc;
-            };
+                    case NONEMPTY -> EVERYTHING;
+                    case OTHER_EXCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY;
+                    default -> desc;
+                };
             case OTHER_EXCLUDING_EMPTY -> switch (desc) {
-                case NONEMPTY -> NONEMPTY;
-                case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
-                default -> OTHER_INCLUDING_EMPTY;
-            };
+                    case NONEMPTY -> NONEMPTY;
+                    case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
+                    default -> OTHER_INCLUDING_EMPTY;
+                };
             case OTHER_INCLUDING_EMPTY -> desc == MatchDescription.NONEMPTY ? EVERYTHING : OTHER_INCLUDING_EMPTY;
         };
     }
@@ -121,15 +122,17 @@ public MatchDescription xor(MatchDescription desc) {
         return switch (this) {
             case NONEMPTY -> desc == MatchDescription.EMPTY ? EVERYTHING : desc;
             case EMPTY -> switch (desc) {
-                case NONEMPTY -> EVERYTHING;
-                case OTHER_EXCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY;
-                case OTHER_INCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
-                default -> throw new IllegalStateException("Unreachable");
-            };
+                    case NONEMPTY -> EVERYTHING;
+                    case OTHER_EXCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY;
+                    case OTHER_INCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
+                    default -> throw new IllegalStateException("Unreachable");
+                };
             // technically an incomplete descriptions can produce other results
             // but we can't factor them in currently
-            case OTHER_EXCLUDING_EMPTY -> desc == MatchDescription.NONEMPTY ? OTHER_EXCLUDING_EMPTY : OTHER_INCLUDING_EMPTY;
-            case OTHER_INCLUDING_EMPTY -> desc == MatchDescription.EMPTY ? OTHER_EXCLUDING_EMPTY : OTHER_INCLUDING_EMPTY;
+            case OTHER_EXCLUDING_EMPTY -> desc == MatchDescription.NONEMPTY ? OTHER_EXCLUDING_EMPTY :
+                    OTHER_INCLUDING_EMPTY;
+            case OTHER_INCLUDING_EMPTY -> desc == MatchDescription.EMPTY ? OTHER_EXCLUDING_EMPTY :
+                    OTHER_INCLUDING_EMPTY;
             default -> throw new IllegalStateException("Unreachable");
         };
     }
diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java
index 429eb1599d5..886fef9a830 100644
--- a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java
+++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java
@@ -55,7 +55,8 @@ final void setNegated(boolean negated) {
     /**
      * Whether this node shares same structure and content with given node.
      * The check includes types, type specific states, negation flag and
-     * the next node's structural equality.

+ * the next node's structural equality. + *

* Note that this check does not account for logical equivalency outside * structural equality. * @@ -107,4 +108,3 @@ public static boolean isStructurallyEqualTo(@Nullable OreGlobNode node1, @Nullab return node1.isStructurallyEqualTo(node2); } } - diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNodes.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNodes.java index 1b34da20afc..a87aeb61a96 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNodes.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNodes.java @@ -5,7 +5,8 @@ import java.util.List; /** - * Entry point for accessing all oreGlobNode instances outside package. Thanks to Java for the superior visibility system. + * Entry point for accessing all oreGlobNode instances outside package. Thanks to Java for the superior visibility + * system. */ public class OreGlobNodes { diff --git a/src/main/java/gregtech/common/crafting/FacadeRecipe.java b/src/main/java/gregtech/common/crafting/FacadeRecipe.java index af2dabce700..ec4d0ca26d9 100644 --- a/src/main/java/gregtech/common/crafting/FacadeRecipe.java +++ b/src/main/java/gregtech/common/crafting/FacadeRecipe.java @@ -3,6 +3,7 @@ import gregtech.common.covers.facade.FacadeHelper; import gregtech.common.items.MetaItems; import gregtech.common.items.behaviors.FacadeItem; + import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; @@ -36,11 +37,11 @@ public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) { if (itemStack.isEmpty()) continue; for (int j = 0; j < matched.length; j++) { if (!ingredients.get(j).apply(itemStack)) continue; - if (matched[j]) return false; //already matched + if (matched[j]) return false; // already matched matched[j] = true; continue mainLoop; } - //reached there, no match + // reached there, no match return false; } for (boolean b : matched) { @@ -95,6 +96,7 @@ public String getGroup() { } private static class FacadeIngredient extends Ingredient { + public static final FacadeIngredient INSTANCE = new FacadeIngredient(); private FacadeIngredient() { diff --git a/src/main/java/gregtech/common/crafting/FluidReplaceRecipe.java b/src/main/java/gregtech/common/crafting/FluidReplaceRecipe.java index a83db538527..4a25c6e238d 100644 --- a/src/main/java/gregtech/common/crafting/FluidReplaceRecipe.java +++ b/src/main/java/gregtech/common/crafting/FluidReplaceRecipe.java @@ -48,15 +48,18 @@ public NonNullList getRemainingItems(@Nonnull InventoryCrafting inv) @Override public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { IFluidHandlerItem recipeCap = output.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); - if (recipeCap == null) throw new IllegalStateException("FluidReplaceRecipe output did not have an IFluidHandlerItem capability"); + if (recipeCap == null) + throw new IllegalStateException("FluidReplaceRecipe output did not have an IFluidHandlerItem capability"); FluidStack outputFluid = recipeCap.drain(Integer.MAX_VALUE, false); if (outputFluid == null) throw new IllegalStateException("FluidReplaceRecipe output did not have a fluid"); - if (outputFluid.amount != 1000) throw new IllegalStateException("FluidReplaceRecipe output must have exactly 1000mB of fluid"); + if (outputFluid.amount != 1000) + throw new IllegalStateException("FluidReplaceRecipe output must have exactly 1000mB of fluid"); for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack input = inv.getStackInSlot(i); - IFluidHandlerItem inputCap = input.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem inputCap = input.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (inputCap == null) continue; // if the input has a fluid, it must only hold 1000mB @@ -73,7 +76,8 @@ public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { isBucket = false; } - IFluidHandlerItem outputCap = output.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem outputCap = output.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (outputCap == null) return ItemStack.EMPTY; outputCap.drain(Integer.MAX_VALUE, true); // ensure the output is empty @@ -98,6 +102,7 @@ public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { } private static boolean isBucket(@Nonnull Item item) { - return item == Items.WATER_BUCKET || item == Items.LAVA_BUCKET || item == Items.MILK_BUCKET || item == ForgeModContainer.getInstance().universalBucket; + return item == Items.WATER_BUCKET || item == Items.LAVA_BUCKET || item == Items.MILK_BUCKET || + item == ForgeModContainer.getInstance().universalBucket; } } diff --git a/src/main/java/gregtech/common/crafting/GTFluidCraftingIngredient.java b/src/main/java/gregtech/common/crafting/GTFluidCraftingIngredient.java index 48fc05d0d6f..dcfdd434abf 100644 --- a/src/main/java/gregtech/common/crafting/GTFluidCraftingIngredient.java +++ b/src/main/java/gregtech/common/crafting/GTFluidCraftingIngredient.java @@ -9,6 +9,7 @@ import javax.annotation.Nullable; public class GTFluidCraftingIngredient extends Ingredient { + private final FluidStack fluidStack; GTFluidCraftingIngredient(ItemStack... stacks) { diff --git a/src/main/java/gregtech/common/crafting/GTShapedOreRecipe.java b/src/main/java/gregtech/common/crafting/GTShapedOreRecipe.java index 04c5948fd8b..c69e7c66b2b 100644 --- a/src/main/java/gregtech/common/crafting/GTShapedOreRecipe.java +++ b/src/main/java/gregtech/common/crafting/GTShapedOreRecipe.java @@ -1,11 +1,8 @@ package gregtech.common.crafting; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.google.gson.JsonElement; -import com.google.gson.JsonSyntaxException; import gregtech.api.util.GTLog; import gregtech.api.util.GTStringUtils; + import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; @@ -23,23 +20,31 @@ import net.minecraftforge.oredict.OreIngredient; import net.minecraftforge.oredict.ShapedOreRecipe; -import javax.annotation.Nonnull; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.google.gson.JsonElement; +import com.google.gson.JsonSyntaxException; + import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Set; +import javax.annotation.Nonnull; + public class GTShapedOreRecipe extends ShapedOreRecipe { + boolean isClearing; - public static Constructor ingredientNBT = ReflectionHelper.findConstructor(IngredientNBT.class, ItemStack.class); + public static Constructor ingredientNBT = ReflectionHelper.findConstructor(IngredientNBT.class, + ItemStack.class); public GTShapedOreRecipe(boolean isClearing, ResourceLocation group, @Nonnull ItemStack result, Object... recipe) { super(group, result, parseShaped(isClearing, recipe)); this.isClearing = isClearing; } - //a copy of the CraftingHelper.ShapedPrimer.parseShaped method. - //the on difference is calling getIngredient of this class. + // a copy of the CraftingHelper.ShapedPrimer.parseShaped method. + // the on difference is calling getIngredient of this class. public static CraftingHelper.ShapedPrimer parseShaped(boolean isClearing, Object... recipe) { CraftingHelper.ShapedPrimer ret = new CraftingHelper.ShapedPrimer(); @@ -108,7 +113,8 @@ public static CraftingHelper.ShapedPrimer parseShaped(boolean isClearing, Object for (char chr : shape.toString().toCharArray()) { Ingredient ing = itemMap.get(chr); if (ing == null) { - throw new IllegalArgumentException("Pattern references symbol '" + chr + "' but it's not defined in the key"); + throw new IllegalArgumentException( + "Pattern references symbol '" + chr + "' but it's not defined in the key"); } ret.input.set(x++, ing); keys.remove(chr); @@ -121,15 +127,16 @@ public static CraftingHelper.ShapedPrimer parseShaped(boolean isClearing, Object return ret; } - //a copy of the CraftingHelper getIngredient method. - //the only difference is checking for a filled bucket and making - //it an GTFluidCraftingIngredient + // a copy of the CraftingHelper getIngredient method. + // the only difference is checking for a filled bucket and making + // it an GTFluidCraftingIngredient protected static Ingredient getIngredient(boolean isClearing, Object obj) { if (obj instanceof Ingredient) return (Ingredient) obj; else if (obj instanceof ItemStack) { ItemStack ing = (ItemStack) obj; if (ing.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { - IFluidHandlerItem handler = ing.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem handler = ing.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (handler != null) { FluidStack drained = handler.drain(Integer.MAX_VALUE, false); if (drained != null && drained.amount > 0) { diff --git a/src/main/java/gregtech/common/crafting/GTShapelessOreRecipe.java b/src/main/java/gregtech/common/crafting/GTShapelessOreRecipe.java index e18e5735eae..758976fd20d 100644 --- a/src/main/java/gregtech/common/crafting/GTShapelessOreRecipe.java +++ b/src/main/java/gregtech/common/crafting/GTShapelessOreRecipe.java @@ -1,8 +1,8 @@ package gregtech.common.crafting; -import com.google.gson.JsonElement; import gregtech.api.util.GTLog; import gregtech.api.util.GTStringUtils; + import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; @@ -19,16 +19,21 @@ import net.minecraftforge.oredict.OreIngredient; import net.minecraftforge.oredict.ShapelessOreRecipe; -import javax.annotation.Nonnull; +import com.google.gson.JsonElement; + import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import javax.annotation.Nonnull; + public class GTShapelessOreRecipe extends ShapelessOreRecipe { boolean isClearing; - public static Constructor ingredientNBT = ReflectionHelper.findConstructor(IngredientNBT.class, ItemStack.class); + public static Constructor ingredientNBT = ReflectionHelper.findConstructor(IngredientNBT.class, + ItemStack.class); - public GTShapelessOreRecipe(boolean isClearing, ResourceLocation group, @Nonnull ItemStack result, Object... recipe) { + public GTShapelessOreRecipe(boolean isClearing, ResourceLocation group, @Nonnull ItemStack result, + Object... recipe) { super(group, result); this.isClearing = isClearing; for (Object in : recipe) { @@ -47,15 +52,16 @@ public GTShapelessOreRecipe(boolean isClearing, ResourceLocation group, @Nonnull } } - //a copy of the CraftingHelper getIngredient method. - //the only difference is checking for a filled bucket and making - //it an GTFluidCraftingIngredient + // a copy of the CraftingHelper getIngredient method. + // the only difference is checking for a filled bucket and making + // it an GTFluidCraftingIngredient private static Ingredient getIngredient(boolean isClearing, Object obj) { if (obj instanceof Ingredient) return (Ingredient) obj; else if (obj instanceof ItemStack) { ItemStack ing = (ItemStack) obj; if (ing.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { - IFluidHandlerItem handler = ing.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem handler = ing.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (handler != null) { FluidStack drained = handler.drain(Integer.MAX_VALUE, false); if (drained != null && drained.amount > 0) { @@ -87,8 +93,7 @@ else if (obj instanceof JsonElement) public @Nonnull NonNullList getRemainingItems(@Nonnull InventoryCrafting inv) { if (isClearing) { return NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); - } - else { + } else { return super.getRemainingItems(inv); } } diff --git a/src/main/java/gregtech/common/crafting/ShapedOreEnergyTransferRecipe.java b/src/main/java/gregtech/common/crafting/ShapedOreEnergyTransferRecipe.java index a97c300e0ab..535da4bc35d 100644 --- a/src/main/java/gregtech/common/crafting/ShapedOreEnergyTransferRecipe.java +++ b/src/main/java/gregtech/common/crafting/ShapedOreEnergyTransferRecipe.java @@ -4,6 +4,7 @@ import gregtech.api.capability.IElectricItem; import gregtech.api.capability.impl.ElectricItem; import gregtech.api.items.toolitem.IGTTool; + import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; @@ -11,17 +12,20 @@ import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.oredict.ShapedOreRecipe; -import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Objects; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class ShapedOreEnergyTransferRecipe extends ShapedOreRecipe { private final Predicate chargePredicate; private final boolean transferMaxCharge; - public ShapedOreEnergyTransferRecipe(ResourceLocation group, @Nonnull ItemStack result, Predicate chargePredicate, boolean overrideCharge, boolean transferMaxCharge, Object... recipe) { + public ShapedOreEnergyTransferRecipe(ResourceLocation group, @Nonnull ItemStack result, + Predicate chargePredicate, boolean overrideCharge, + boolean transferMaxCharge, Object... recipe) { super(group, result, CraftingHelper.parseShaped(recipe)); this.chargePredicate = chargePredicate; this.transferMaxCharge = transferMaxCharge; @@ -30,7 +34,7 @@ public ShapedOreEnergyTransferRecipe(ResourceLocation group, @Nonnull ItemStack } } - //transfer initial max charge for correct display in JEI + // transfer initial max charge for correct display in JEI private void fixOutputItemMaxCharge() { long totalMaxCharge = getIngredients().stream() .mapToLong(it -> Arrays.stream(it.getMatchingStacks()) @@ -38,7 +42,8 @@ private void fixOutputItemMaxCharge() { .map(stack -> stack.copy().getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null)) .filter(Objects::nonNull) .mapToLong(IElectricItem::getMaxCharge) - .max().orElse(0L)).sum(); + .max().orElse(0L)) + .sum(); IElectricItem electricItem = output.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (totalMaxCharge > 0L && electricItem instanceof ElectricItem) { ((ElectricItem) electricItem).setMaxChargeOverride(totalMaxCharge); @@ -53,7 +58,8 @@ public ItemStack getCraftingResult(@Nonnull InventoryCrafting inventoryCrafting) return resultStack; } - public static void chargeStackFromComponents(ItemStack toolStack, IInventory ingredients, Predicate chargePredicate, boolean transferMaxCharge) { + public static void chargeStackFromComponents(ItemStack toolStack, IInventory ingredients, + Predicate chargePredicate, boolean transferMaxCharge) { IElectricItem electricItem = toolStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); long totalMaxCharge = 0L; long toCharge = 0L; @@ -63,7 +69,8 @@ public static void chargeStackFromComponents(ItemStack toolStack, IInventory ing if (!chargePredicate.test(stackInSlot)) { continue; } - IElectricItem batteryItem = stackInSlot.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem batteryItem = stackInSlot.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (batteryItem == null) { continue; } @@ -74,7 +81,7 @@ public static void chargeStackFromComponents(ItemStack toolStack, IInventory ing if (electricItem instanceof ElectricItem && transferMaxCharge) { ((ElectricItem) electricItem).setMaxChargeOverride(totalMaxCharge); } - //noinspection DataFlowIssue + // noinspection DataFlowIssue electricItem.charge(toCharge, Integer.MAX_VALUE, true, false); } } diff --git a/src/main/java/gregtech/common/crafting/ToolHeadReplaceRecipe.java b/src/main/java/gregtech/common/crafting/ToolHeadReplaceRecipe.java index cc9e5d14ea3..2bc3a7c9b86 100644 --- a/src/main/java/gregtech/common/crafting/ToolHeadReplaceRecipe.java +++ b/src/main/java/gregtech/common/crafting/ToolHeadReplaceRecipe.java @@ -5,6 +5,7 @@ import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.UnificationEntry; + import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; @@ -12,12 +13,13 @@ import net.minecraft.world.World; import net.minecraftforge.registries.IForgeRegistryEntry; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; + // basically a modified RecipeRepairItem public class ToolHeadReplaceRecipe extends IForgeRegistryEntry.Impl implements IRecipe { diff --git a/src/main/java/gregtech/common/entities/DynamiteEntity.java b/src/main/java/gregtech/common/entities/DynamiteEntity.java index 17a8afac750..dfbefa11e25 100644 --- a/src/main/java/gregtech/common/entities/DynamiteEntity.java +++ b/src/main/java/gregtech/common/entities/DynamiteEntity.java @@ -59,7 +59,8 @@ public void onUpdate() { ticksUntilExplosion--; if (world.rand.nextInt(3) == 2) { - world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, -this.motionX * 0.05f, this.inGround ? 0.05f : -this.motionY * 0.05f, -this.motionZ * 0.05f); + world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, -this.motionX * 0.05f, + this.inGround ? 0.05f : -this.motionY * 0.05f, -this.motionZ * 0.05f); } if (ticksUntilExplosion < 0 && !world.isRemote) { @@ -81,11 +82,14 @@ public void onUpdate() { } Vec3d vec3d = new Vec3d(this.posX, this.posY, this.posZ); - Vec3d vec3d1 = new Vec3d(this.posX + this.motionX + (this.motionX > 0 ? 0.5f : -0.5f), this.posY + this.motionY + (this.motionY > 0 ? 0.2f : -0.2f), this.posZ + this.motionZ + (this.motionZ > 0 ? 0.2f : -0.2f)); + Vec3d vec3d1 = new Vec3d(this.posX + this.motionX + (this.motionX > 0 ? 0.5f : -0.5f), + this.posY + this.motionY + (this.motionY > 0 ? 0.2f : -0.2f), + this.posZ + this.motionZ + (this.motionZ > 0 ? 0.2f : -0.2f)); RayTraceResult raytraceresult = this.world.rayTraceBlocks(vec3d, vec3d1); if (raytraceresult != null) { - if (raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK && this.world.getBlockState(raytraceresult.getBlockPos()).getBlock() == Blocks.PORTAL) { + if (raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK && + this.world.getBlockState(raytraceresult.getBlockPos()).getBlock() == Blocks.PORTAL) { this.setPortal(raytraceresult.getBlockPos()); } else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { this.onImpact(raytraceresult); @@ -122,7 +126,9 @@ public void onUpdate() { if (this.isInWater()) { for (int j = 0; j < 4; ++j) { - this.world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * 0.25D, this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D, this.motionX, this.motionY, this.motionZ); + this.world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * 0.25D, + this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D, this.motionX, this.motionY, + this.motionZ); } f1 = 0.8F; diff --git a/src/main/java/gregtech/common/entities/GTBoatEntity.java b/src/main/java/gregtech/common/entities/GTBoatEntity.java index 6bfda9b743f..00168af694b 100644 --- a/src/main/java/gregtech/common/entities/GTBoatEntity.java +++ b/src/main/java/gregtech/common/entities/GTBoatEntity.java @@ -3,6 +3,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.blocks.wood.BlockGregPlanks; import gregtech.common.items.MetaItems; + import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityBoat; @@ -21,7 +22,8 @@ public class GTBoatEntity extends EntityBoat { - private static final DataParameter GT_BOAT_TYPE = EntityDataManager.createKey(GTBoatEntity.class, DataSerializers.VARINT); + private static final DataParameter GT_BOAT_TYPE = EntityDataManager.createKey(GTBoatEntity.class, + DataSerializers.VARINT); public GTBoatEntity(World world) { super(world); @@ -60,14 +62,16 @@ public boolean attackEntityFrom(DamageSource source, float amount) { return false; } if (!this.world.isRemote && !this.isDead) { - if (source instanceof EntityDamageSourceIndirect && source.getTrueSource() != null && this.isPassenger(source.getTrueSource())) { + if (source instanceof EntityDamageSourceIndirect && source.getTrueSource() != null && + this.isPassenger(source.getTrueSource())) { return false; } this.setForwardDirection(-this.getForwardDirection()); this.setTimeSinceHit(10); this.setDamageTaken(this.getDamageTaken() + amount * 10); this.markVelocityChanged(); - boolean flag = source.getTrueSource() instanceof EntityPlayer && ((EntityPlayer) source.getTrueSource()).capabilities.isCreativeMode; + boolean flag = source.getTrueSource() instanceof EntityPlayer && + ((EntityPlayer) source.getTrueSource()).capabilities.isCreativeMode; if (flag || this.getDamageTaken() > 40) { if (!flag && this.world.getGameRules().getBoolean("doEntityDrops")) { @@ -124,7 +128,8 @@ public ItemStack getPickedResult(RayTraceResult ray) { } /** - * @deprecated Vanilla boat types do not affect GTBoat instances; use {@link GTBoatEntity#setGTBoatType(GTBoatType)}. + * @deprecated Vanilla boat types do not affect GTBoat instances; use + * {@link GTBoatEntity#setGTBoatType(GTBoatType)}. */ @Deprecated @Override diff --git a/src/main/java/gregtech/common/entities/PortalEntity.java b/src/main/java/gregtech/common/entities/PortalEntity.java index 559445a41aa..6186bdc80b3 100644 --- a/src/main/java/gregtech/common/entities/PortalEntity.java +++ b/src/main/java/gregtech/common/entities/PortalEntity.java @@ -3,6 +3,7 @@ import gregtech.api.util.GTTeleporter; import gregtech.api.util.TeleportHandler; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -23,22 +24,22 @@ public class PortalEntity extends Entity { private int timeToDespawn = 200; - public PortalEntity(World worldIn){ + public PortalEntity(World worldIn) { super(worldIn); rideCooldown = -1; } - public PortalEntity(World worldIn, double x, double y, double z){ + public PortalEntity(World worldIn, double x, double y, double z) { super(worldIn); this.setPosition(x, y, z); rideCooldown = -1; } @Override - protected void entityInit(){} + protected void entityInit() {} @Override - public void readEntityFromNBT(NBTTagCompound nbtTagCompound){ + public void readEntityFromNBT(NBTTagCompound nbtTagCompound) { this.targetX = nbtTagCompound.getDouble("targetX"); this.targetY = nbtTagCompound.getDouble("targetY"); this.targetZ = nbtTagCompound.getDouble("targetZ"); @@ -46,7 +47,7 @@ public void readEntityFromNBT(NBTTagCompound nbtTagCompound){ } @Override - public void writeEntityToNBT(NBTTagCompound nbtTagCompound){ + public void writeEntityToNBT(NBTTagCompound nbtTagCompound) { nbtTagCompound.setDouble("targetX", this.targetX); nbtTagCompound.setDouble("targetY", this.targetY); nbtTagCompound.setDouble("targetZ", this.targetZ); @@ -55,27 +56,29 @@ public void writeEntityToNBT(NBTTagCompound nbtTagCompound){ @Override public void onUpdate() { - if(timeToDespawn <= 0){ + if (timeToDespawn <= 0) { this.setDead(); } if (!this.world.isRemote) { this.setFlag(6, this.isGlowing()); } - if(timeToDespawn == 200){ + if (timeToDespawn == 200) { this.playSound(GTSoundEvents.PORTAL_OPENING, 0.7F, 1.F); - }else if(timeToDespawn == 10){ + } else if (timeToDespawn == 10) { this.playSound(GTSoundEvents.PORTAL_CLOSING, 0.7F, 1.F); } this.onEntityUpdate(); - if(!this.world.isRemote) { + if (!this.world.isRemote) { List list = this.world.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox(), null); for (Entity entity : list) { if (!(entity instanceof PortalEntity)) { - GTTeleporter teleporter = new GTTeleporter(TeleportHandler.getWorldByDimensionID(targetDim), targetX, targetY, targetZ); - TeleportHandler.teleport(entity, targetDim, teleporter, targetX + entity.getLookVec().x, targetY, targetZ + entity.getLookVec().z); + GTTeleporter teleporter = new GTTeleporter(TeleportHandler.getWorldByDimensionID(targetDim), + targetX, targetY, targetZ); + TeleportHandler.teleport(entity, targetDim, teleporter, targetX + entity.getLookVec().x, targetY, + targetZ + entity.getLookVec().z); } } } @@ -83,7 +86,7 @@ public void onUpdate() { } @Override - public void setRotation(float yaw, float pitch){ + public void setRotation(float yaw, float pitch) { super.setRotation(yaw, pitch); } @@ -99,11 +102,11 @@ public boolean shouldRenderInPass(int pass) { return pass == RENDER_PASS_TRANSLUCENT; } - public boolean isOpening(){ + public boolean isOpening() { return timeToDespawn >= 190; } - public boolean isClosing(){ + public boolean isClosing() { return timeToDespawn <= 10; } @@ -113,7 +116,7 @@ public int getTimeToDespawn() { @SideOnly(Side.CLIENT) @Override - public int getBrightnessForRender(){ + public int getBrightnessForRender() { return 15728880; } } diff --git a/src/main/java/gregtech/common/gui/impl/FakeModularUIContainerClipboard.java b/src/main/java/gregtech/common/gui/impl/FakeModularUIContainerClipboard.java index e24444eb407..af569788b80 100644 --- a/src/main/java/gregtech/common/gui/impl/FakeModularUIContainerClipboard.java +++ b/src/main/java/gregtech/common/gui/impl/FakeModularUIContainerClipboard.java @@ -1,19 +1,21 @@ package gregtech.common.gui.impl; -import com.google.common.collect.Lists; import gregtech.api.GregTechAPI; import gregtech.api.gui.ModularUI; import gregtech.api.gui.Widget; import gregtech.api.gui.impl.FakeModularGuiContainer; -import gregtech.core.network.packets.PacketClipboardUIWidgetUpdate; import gregtech.common.metatileentities.MetaTileEntityClipboard; -import io.netty.buffer.Unpooled; +import gregtech.core.network.packets.PacketClipboardUIWidgetUpdate; + import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.util.NonNullList; import net.minecraft.util.Tuple; +import com.google.common.collect.Lists; +import io.netty.buffer.Unpooled; + import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; @@ -21,6 +23,7 @@ import static gregtech.api.capability.GregtechDataCodes.UPDATE_UI; public class FakeModularUIContainerClipboard extends FakeModularGuiContainer { + private final NonNullList inventoryItemStacks = NonNullList.create(); public final List inventorySlots = Lists.newArrayList(); public int windowId; diff --git a/src/main/java/gregtech/common/gui/impl/FakeModularUIPluginContainer.java b/src/main/java/gregtech/common/gui/impl/FakeModularUIPluginContainer.java index 8e57edfd8b7..6d3bcd7ebef 100644 --- a/src/main/java/gregtech/common/gui/impl/FakeModularUIPluginContainer.java +++ b/src/main/java/gregtech/common/gui/impl/FakeModularUIPluginContainer.java @@ -5,6 +5,7 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.impl.FakeModularGuiContainer; import gregtech.common.items.behaviors.monitorplugin.FakeGuiPluginBehavior; + import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.util.Tuple; @@ -14,6 +15,7 @@ import java.util.function.Consumer; public class FakeModularUIPluginContainer extends FakeModularGuiContainer { + protected int windowId; private final FakeGuiPluginBehavior behavior; public int syncId; @@ -73,7 +75,7 @@ public void writeClientAction(Widget widget, int updateId, Consumer payloadWriter) { - if(behavior != null) { + if (behavior != null) { behavior.writePluginData(GregtechDataCodes.UPDATE_FAKE_GUI, buf -> { buf.writeVarInt(windowId); buf.writeVarInt(modularUI.guiWidgets.inverse().get(widget)); diff --git a/src/main/java/gregtech/common/gui/widget/HighlightedTextField.java b/src/main/java/gregtech/common/gui/widget/HighlightedTextField.java index 07c36082299..cb34ca111e2 100644 --- a/src/main/java/gregtech/common/gui/widget/HighlightedTextField.java +++ b/src/main/java/gregtech/common/gui/widget/HighlightedTextField.java @@ -1,14 +1,17 @@ package gregtech.common.gui.widget; import gregtech.api.gui.widgets.TextFieldWidget2; + +import net.minecraft.util.text.TextFormatting; + import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; -import net.minecraft.util.text.TextFormatting; -import javax.annotation.Nullable; import java.util.function.Consumer; import java.util.function.Supplier; +import javax.annotation.Nullable; + public class HighlightedTextField extends TextFieldWidget2 { @Nullable @@ -16,7 +19,8 @@ public class HighlightedTextField extends TextFieldWidget2 { @Nullable private TextHighlighter formatResult; - public HighlightedTextField(int x, int y, int width, int height, Supplier supplier, Consumer setter) { + public HighlightedTextField(int x, int y, int width, int height, Supplier supplier, + Consumer setter) { super(x, y, width, height, supplier, setter); } diff --git a/src/main/java/gregtech/common/gui/widget/WidgetARGB.java b/src/main/java/gregtech/common/gui/widget/WidgetARGB.java index 161443ddfbc..2e5f2c72e27 100644 --- a/src/main/java/gregtech/common/gui/widget/WidgetARGB.java +++ b/src/main/java/gregtech/common/gui/widget/WidgetARGB.java @@ -4,6 +4,7 @@ import gregtech.api.gui.widgets.TextFieldWidget; import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.util.Position; + import net.minecraft.client.gui.Gui; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.relauncher.Side; @@ -13,6 +14,7 @@ import java.util.function.Predicate; public class WidgetARGB extends WidgetGroup { + public int color; private final int height; @@ -20,34 +22,44 @@ public WidgetARGB(int x, int y, int height, int initColor, Consumer onC super(new Position(x, y)); this.color = initColor; this.height = height; - Predicate validator = (data)->{ + Predicate validator = (data) -> { if (data.isEmpty()) return true; - try { int num = Integer.parseInt(data, 16); if (num > 255 || num < 0) return false; } catch (Exception e) { return false; } return true; + try { + int num = Integer.parseInt(data, 16); + if (num > 255 || num < 0) return false; + } catch (Exception e) { + return false; + } + return true; }; - Consumer update = (buf)->{ + Consumer update = (buf) -> { buf.writeInt(color); }; TextFieldWidget[] ARGB = new TextFieldWidget[4]; - ARGB[0] = new TextFieldWidget(0, 0, 20, height, true, ()->Integer.toHexString(color >> 24 & 0XFF).toUpperCase(), (data)->{ - this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) << 24 | (color & 0X00FFFFFF); - onColorChanged.accept(color); - writeUpdateInfo(2, update); - }).setValidator(validator); - ARGB[1] = new TextFieldWidget(22, 0, 20, height, true, ()->Integer.toHexString(color >> 16 & 0XFF).toUpperCase(), (data)->{ - this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) << 16 | (color & 0XFF00FFFF); - onColorChanged.accept(color); - writeUpdateInfo(2, update); - }).setValidator(validator); - ARGB[2] = new TextFieldWidget(44, 0, 20, height, true, ()->Integer.toHexString(color >> 8 & 0XFF).toUpperCase(), (data)->{ - this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) << 8 | (color & 0X00FF00FF); - onColorChanged.accept(color); - writeUpdateInfo(2, update); - }).setValidator(validator); - ARGB[3] = new TextFieldWidget(66, 0, 20, height, true, ()->Integer.toHexString(color & 0XFF).toUpperCase(), (data)->{ - this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) | (color & 0XFFFFFF00); - onColorChanged.accept(color); - writeUpdateInfo(2, update); - }).setValidator(validator); + ARGB[0] = new TextFieldWidget(0, 0, 20, height, true, + () -> Integer.toHexString(color >> 24 & 0XFF).toUpperCase(), (data) -> { + this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) << 24 | (color & 0X00FFFFFF); + onColorChanged.accept(color); + writeUpdateInfo(2, update); + }).setValidator(validator); + ARGB[1] = new TextFieldWidget(22, 0, 20, height, true, + () -> Integer.toHexString(color >> 16 & 0XFF).toUpperCase(), (data) -> { + this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) << 16 | (color & 0XFF00FFFF); + onColorChanged.accept(color); + writeUpdateInfo(2, update); + }).setValidator(validator); + ARGB[2] = new TextFieldWidget(44, 0, 20, height, true, + () -> Integer.toHexString(color >> 8 & 0XFF).toUpperCase(), (data) -> { + this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) << 8 | (color & 0X00FF00FF); + onColorChanged.accept(color); + writeUpdateInfo(2, update); + }).setValidator(validator); + ARGB[3] = new TextFieldWidget(66, 0, 20, height, true, () -> Integer.toHexString(color & 0XFF).toUpperCase(), + (data) -> { + this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) | (color & 0XFFFFFF00); + onColorChanged.accept(color); + writeUpdateInfo(2, update); + }).setValidator(validator); this.addWidget(ARGB[0]); this.addWidget(ARGB[1]); this.addWidget(ARGB[2]); @@ -67,6 +79,7 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { super.drawInBackground(mouseX, mouseY, partialTicks, context); - Gui.drawRect(this.getPosition().x + 88, this.getPosition().y, this.getPosition().x + 100, this.getPosition().y + height, color); + Gui.drawRect(this.getPosition().x + 88, this.getPosition().y, this.getPosition().x + 100, + this.getPosition().y + height, color); } } diff --git a/src/main/java/gregtech/common/gui/widget/WidgetScrollBar.java b/src/main/java/gregtech/common/gui/widget/WidgetScrollBar.java index 4b5986916ca..76dcf8a3cee 100644 --- a/src/main/java/gregtech/common/gui/widget/WidgetScrollBar.java +++ b/src/main/java/gregtech/common/gui/widget/WidgetScrollBar.java @@ -6,8 +6,9 @@ import gregtech.api.gui.resources.SizedTextureArea; import gregtech.api.gui.resources.TextureArea; import gregtech.api.util.Position; -import gregtech.client.utils.RenderUtil; import gregtech.api.util.Size; +import gregtech.client.utils.RenderUtil; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.resources.I18n; @@ -17,6 +18,7 @@ import java.util.function.Consumer; public class WidgetScrollBar extends Widget { + protected final float min; protected final float max; protected final float dur; @@ -30,7 +32,6 @@ public class WidgetScrollBar extends Widget { protected int titleColor; protected Consumer onChanged; - public WidgetScrollBar(int x, int y, int width, float min, float max, float dur, Consumer onChanged) { super(new Position(x, y), new Size(width, 20)); this.max = max; @@ -78,25 +79,29 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender Size size = this.getSize(); RenderUtil.renderRect(position.x, position.y + 15 - 0.5f, size.width, 1, 0, lineColor); if (this.buttonTexture instanceof SizedTextureArea) { - ((SizedTextureArea)this.buttonTexture).drawHorizontalCutSubArea(position.x + xOffset - buttonWidth / 2, position.y + 15 - buttonHeight / 2, buttonWidth, buttonHeight, 0.0D, 1.0D); + ((SizedTextureArea) this.buttonTexture).drawHorizontalCutSubArea(position.x + xOffset - buttonWidth / 2, + position.y + 15 - buttonHeight / 2, buttonWidth, buttonHeight, 0.0D, 1.0D); } else { - this.buttonTexture.drawSubArea(position.x + xOffset - buttonWidth * 0.5f, position.y + 15 - buttonHeight * 0.5f, buttonWidth, buttonHeight, 0.0D, 0.0D, 1.0D, 1.0D); + this.buttonTexture.drawSubArea(position.x + xOffset - buttonWidth * 0.5f, + position.y + 15 - buttonHeight * 0.5f, buttonWidth, buttonHeight, 0.0D, 0.0D, 1.0D, 1.0D); } FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; String text = I18n.format(this.title); text += ": " + new DecimalFormat("#.00").format(getValue()); - fontRenderer.drawString(text, position.x + size.width / 2 - fontRenderer.getStringWidth(text) / 2, position.y - 3 + size.height / 2 - fontRenderer.FONT_HEIGHT / 2, this.titleColor); + fontRenderer.drawString(text, position.x + size.width / 2 - fontRenderer.getStringWidth(text) / 2, + position.y - 3 + size.height / 2 - fontRenderer.FONT_HEIGHT / 2, this.titleColor); } private boolean isOnScrollPane(int mouseX, int mouseY) { Position position = this.getPosition(); Size size = this.getSize(); - return isMouseOver(position.x - buttonWidth / 2, position.y + 15 - buttonHeight / 2, size.width + buttonWidth / 2, buttonHeight, mouseX, mouseY); + return isMouseOver(position.x - buttonWidth / 2, position.y + 15 - buttonHeight / 2, + size.width + buttonWidth / 2, buttonHeight, mouseX, mouseY); } private float getValue() { - return (float) (min + Math.floor((max - min) * xOffset * 1.0f / this.getSize().width / dur) * dur) ; + return (float) (min + Math.floor((max - min) * xOffset * 1.0f / this.getSize().width / dur) * dur); } @Override @@ -115,7 +120,7 @@ public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged Size size = this.getSize(); if (mouseX > position.x + size.width) { this.xOffset = size.width; - } else if(mouseX < position.x) { + } else if (mouseX < position.x) { this.xOffset = 0; } else { this.xOffset = mouseX - this.getPosition().x; @@ -130,7 +135,7 @@ public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged @Override public boolean mouseReleased(int mouseX, int mouseY, int button) { - if(this.draggedOnScrollBar) { + if (this.draggedOnScrollBar) { this.writeClientAction(2, packetBuffer -> packetBuffer.writeFloat(getValue())); } this.draggedOnScrollBar = false; @@ -142,7 +147,7 @@ public void handleClientAction(int id, PacketBuffer buffer) { super.handleClientAction(id, buffer); if (id == 2) { float value = buffer.readFloat(); - if(this.onChanged != null) { + if (this.onChanged != null) { onChanged.accept(value); } } diff --git a/src/main/java/gregtech/common/gui/widget/among_us/FixWiringTaskWidget.java b/src/main/java/gregtech/common/gui/widget/among_us/FixWiringTaskWidget.java index 37b64663acf..bd946b1e39d 100644 --- a/src/main/java/gregtech/common/gui/widget/among_us/FixWiringTaskWidget.java +++ b/src/main/java/gregtech/common/gui/widget/among_us/FixWiringTaskWidget.java @@ -4,6 +4,7 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.gui.resources.TextureArea; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; @@ -16,9 +17,11 @@ public class FixWiringTaskWidget extends Widget { - private final static TextureArea background = TextureArea.fullImage("textures/gui/widget/electricity_wires_baseback.png"); + private final static TextureArea background = TextureArea + .fullImage("textures/gui/widget/electricity_wires_baseback.png"); private final static TextureArea wire = TextureArea.fullImage("textures/gui/widget/electricity_wires.png"); - private final static TextureArea wire_base = TextureArea.fullImage("textures/gui/widget/electricity_wires_base.png"); + private final static TextureArea wire_base = TextureArea + .fullImage("textures/gui/widget/electricity_wires_base.png"); private final int[] colors = new int[4]; private final boolean[] connect = new boolean[4]; private final int[] init = new int[4]; @@ -79,11 +82,13 @@ public int isMouseOverWire(int mouseX, int mouseY, boolean isLeft) { for (int i = 0; i < 4; i++) { double y1 = y + yScale * ((i + 1) * 104 - 10); if (isLeft) { - if (isMouseOver(x, (int)(y1 - yScale * 16), (int)(xScale * 38 * 1.5), (int)(yScale * 64), mouseX, mouseY)) { + if (isMouseOver(x, (int) (y1 - yScale * 16), (int) (xScale * 38 * 1.5), (int) (yScale * 64), mouseX, + mouseY)) { return i; } } else { - if (isMouseOver(x + width - (int)(xScale * 38 * 1.5), (int)(y1 - yScale * 16), (int)(xScale * 38 * 1.5), (int)(yScale * 64), mouseX, mouseY)) { + if (isMouseOver(x + width - (int) (xScale * 38 * 1.5), (int) (y1 - yScale * 16), + (int) (xScale * 38 * 1.5), (int) (yScale * 64), mouseX, mouseY)) { return i; } } @@ -91,8 +96,6 @@ public int isMouseOverWire(int mouseX, int mouseY, boolean isLeft) { return -1; } - - @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { int x = getPosition().x; @@ -109,9 +112,9 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender if (connect[i]) { for (int j = 0; j < init.length; j++) { if (init[j] == i) { - double y2 = y + yScale * ((j + 1) * 104 - 10); + double y2 = y + yScale * ((j + 1) * 104 - 10); drawLines(Arrays.asList(new Vec2f(x + xScale * 25, (float) y1 + yScale * 12), - new Vec2f(x+ width - (int)(xScale * 25), (float) y2 + yScale * 12)), color, color, 5); + new Vec2f(x + width - (int) (xScale * 25), (float) y2 + yScale * 12)), color, color, 5); break; } } @@ -122,20 +125,25 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender int color = colors[i]; if (dragged == i) { - drawLines(Arrays.asList(new Vec2f(x + xScale * 25, (float) y1 + yScale * 12), new Vec2f(mouseX, mouseY)), color, color, 5); + drawLines( + Arrays.asList(new Vec2f(x + xScale * 25, (float) y1 + yScale * 12), new Vec2f(mouseX, mouseY)), + color, color, 5); } // left - wire.drawSubArea(x + (int)(xScale * 25), y1 - yScale * 5, (int)(xScale * 38), (int)(yScale * 32), 0, 0, 0.5,1); + wire.drawSubArea(x + (int) (xScale * 25), y1 - yScale * 5, (int) (xScale * 38), (int) (yScale * 32), 0, 0, + 0.5, 1); setColor(color); - wire_base.drawSubArea(x, (int)y1, (int)(xScale * 50), (int)(yScale * 32), 0, 0, 0.5, 1); - GlStateManager.color(1,1,1,1); + wire_base.drawSubArea(x, (int) y1, (int) (xScale * 50), (int) (yScale * 32), 0, 0, 0.5, 1); + GlStateManager.color(1, 1, 1, 1); - //right - wire.drawSubArea(x + width - (int)(xScale * (25 + 38)), y1 - yScale * 5, (int)(xScale * 38), (int)(yScale * 32), 0.5, 0, 0.5, 1); + // right + wire.drawSubArea(x + width - (int) (xScale * (25 + 38)), y1 - yScale * 5, (int) (xScale * 38), + (int) (yScale * 32), 0.5, 0, 0.5, 1); setColor(colors[init[i]]); - wire_base.drawSubArea(x + width - (int)(xScale * 50), (int)y1, (int)(xScale * 50), (int)(yScale * 32), 0.5, 0, 0.5, 1); - GlStateManager.color(1,1,1,1); + wire_base.drawSubArea(x + width - (int) (xScale * 50), (int) y1, (int) (xScale * 50), (int) (yScale * 32), + 0.5, 0, 0.5, 1); + GlStateManager.color(1, 1, 1, 1); } } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/AEConfigWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/AEConfigWidget.java index 49da74133d6..59005459893 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/AEConfigWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/AEConfigWidget.java @@ -1,6 +1,5 @@ package gregtech.common.gui.widget.appeng; -import appeng.api.storage.data.IAEStack; import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.AbstractWidgetGroup; import gregtech.api.util.Position; @@ -8,6 +7,8 @@ import gregtech.common.gui.widget.appeng.slot.AEConfigSlot; import gregtech.common.gui.widget.appeng.slot.AmountSetSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; + +import appeng.api.storage.data.IAEStack; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; @@ -72,7 +73,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { public void detectAndSendChanges() { super.detectAndSendChanges(); this.changeMap.clear(); - for (int index = 0; index < this.config.length; index ++) { + for (int index = 0; index < this.config.length; index++) { IConfigurableSlot newSlot = this.config[index]; IConfigurableSlot oldSlot = this.cached[index]; T nConfig = newSlot.getConfig(); @@ -106,8 +107,7 @@ public void detectAndSendChanges() { buf.writeBoolean(false); } } - } catch (IOException ignored) { - } + } catch (IOException ignored) {} }); } } @@ -129,5 +129,4 @@ protected final boolean areAEStackCountEquals(T s1, T s2) { } return false; } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/AEFluidConfigWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/AEFluidConfigWidget.java index f55b0e24d58..1599217290c 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/AEFluidConfigWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/AEFluidConfigWidget.java @@ -1,12 +1,14 @@ package gregtech.common.gui.widget.appeng; -import appeng.api.storage.data.IAEFluidStack; import gregtech.common.gui.widget.appeng.slot.AEFluidConfigSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.MetaTileEntityMEInputHatch; import gregtech.common.metatileentities.multi.multiblockpart.appeng.stack.WrappedFluidStack; + import net.minecraft.network.PacketBuffer; +import appeng.api.storage.data.IAEFluidStack; + /** * @Author GlodBlock * @Description Display {@link IAEFluidStack} config @@ -24,7 +26,7 @@ void init() { int line; this.displayList = new IConfigurableSlot[this.config.length]; this.cached = new IConfigurableSlot[this.config.length]; - for (int index = 0; index < this.config.length; index ++) { + for (int index = 0; index < this.config.length; index++) { this.displayList[index] = new MetaTileEntityMEInputHatch.ExportOnlyAEFluid(); this.cached[index] = new MetaTileEntityMEInputHatch.ExportOnlyAEFluid(); line = index / 8; @@ -37,7 +39,7 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { super.readUpdateInfo(id, buffer); if (id == UPDATE_ID) { int size = buffer.readVarInt(); - for (int i = 0; i < size; i ++) { + for (int i = 0; i < size; i++) { int index = buffer.readVarInt(); IConfigurableSlot slot = this.displayList[index]; if (buffer.readBoolean()) { diff --git a/src/main/java/gregtech/common/gui/widget/appeng/AEFluidGridWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/AEFluidGridWidget.java index 33a125d07b4..3f7d1358e99 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/AEFluidGridWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/AEFluidGridWidget.java @@ -1,16 +1,18 @@ package gregtech.common.gui.widget.appeng; +import gregtech.api.gui.Widget; +import gregtech.common.gui.widget.appeng.slot.AEFluidDisplayWidget; + +import net.minecraft.network.PacketBuffer; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IItemList; import appeng.fluids.util.AEFluidStack; import appeng.fluids.util.FluidList; -import gregtech.api.gui.Widget; -import gregtech.common.gui.widget.appeng.slot.AEFluidDisplayWidget; import it.unimi.dsi.fastutil.objects.Object2LongMap; import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; -import net.minecraft.network.PacketBuffer; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; /** * @Author GlodBlock @@ -34,7 +36,7 @@ public IAEFluidStack getAt(int index) { if (cnt == index) { return fluid; } - cnt ++; + cnt++; } return null; } @@ -83,7 +85,7 @@ protected void writeListChange() { @Override protected void readListChange(PacketBuffer buffer) { int size = buffer.readVarInt(); - for (int i = 0; i < size ; i ++) { + for (int i = 0; i < size; i++) { FluidStack fluid = FluidRegistry.getFluidStack(buffer.readString(Integer.MAX_VALUE / 16), 1); long delta = buffer.readVarLong(); if (fluid != null) { diff --git a/src/main/java/gregtech/common/gui/widget/appeng/AEItemConfigWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/AEItemConfigWidget.java index 8861e87e030..c3707d4afaf 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/AEItemConfigWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/AEItemConfigWidget.java @@ -1,12 +1,14 @@ package gregtech.common.gui.widget.appeng; -import appeng.api.storage.data.IAEItemStack; import gregtech.common.gui.widget.appeng.slot.AEItemConfigSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.MetaTileEntityMEInputBus; import gregtech.common.metatileentities.multi.multiblockpart.appeng.stack.WrappedItemStack; + import net.minecraft.network.PacketBuffer; +import appeng.api.storage.data.IAEItemStack; + /** * @Author GlodBlock * @Description Display {@link IAEItemStack} config @@ -24,7 +26,7 @@ void init() { int line; this.displayList = new IConfigurableSlot[this.config.length]; this.cached = new IConfigurableSlot[this.config.length]; - for (int index = 0; index < this.config.length; index ++) { + for (int index = 0; index < this.config.length; index++) { this.displayList[index] = new MetaTileEntityMEInputBus.ExportOnlyAEItem(); this.cached[index] = new MetaTileEntityMEInputBus.ExportOnlyAEItem(); line = index / 8; @@ -37,7 +39,7 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { super.readUpdateInfo(id, buffer); if (id == UPDATE_ID) { int size = buffer.readVarInt(); - for (int i = 0; i < size; i ++) { + for (int i = 0; i < size; i++) { int index = buffer.readVarInt(); IConfigurableSlot slot = this.displayList[index]; if (buffer.readBoolean()) { @@ -53,5 +55,4 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { } } } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/AEItemGridWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/AEItemGridWidget.java index c158d8df148..7b036eee6af 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/AEItemGridWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/AEItemGridWidget.java @@ -1,15 +1,17 @@ package gregtech.common.gui.widget.appeng; +import gregtech.api.gui.Widget; +import gregtech.common.gui.widget.appeng.slot.AEItemDisplayWidget; + +import net.minecraft.item.ItemStack; +import net.minecraft.network.PacketBuffer; + import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IItemList; import appeng.util.item.AEItemStack; import appeng.util.item.ItemList; -import gregtech.api.gui.Widget; -import gregtech.common.gui.widget.appeng.slot.AEItemDisplayWidget; import it.unimi.dsi.fastutil.objects.Object2LongMap; import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; import java.io.IOException; @@ -35,7 +37,7 @@ public IAEItemStack getAt(int index) { if (cnt == index) { return item; } - cnt ++; + cnt++; } return null; } @@ -85,7 +87,7 @@ protected void writeListChange() { protected void readListChange(PacketBuffer buffer) { int size = buffer.readVarInt(); try { - for (int i = 0; i < size ; i ++) { + for (int i = 0; i < size; i++) { ItemStack item = buffer.readItemStack(); item.setCount(1); long delta = buffer.readVarLong(); @@ -93,8 +95,6 @@ protected void readListChange(PacketBuffer buffer) { this.displayList.add(AEItemStack.fromItemStack(item).setStackSize(delta)); } } - } catch (IOException ignore) { - } + } catch (IOException ignore) {} } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/AEListGridWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/AEListGridWidget.java index 4a89ec21b44..1cdcdf4804b 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/AEListGridWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/AEListGridWidget.java @@ -1,11 +1,13 @@ package gregtech.common.gui.widget.appeng; -import appeng.api.storage.data.IAEStack; -import appeng.api.storage.data.IItemList; import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.ScrollableListWidget; + import net.minecraft.network.PacketBuffer; +import appeng.api.storage.data.IAEStack; +import appeng.api.storage.data.IItemList; + /** * @Author GlodBlock * @Description A display only widget for {@link IItemList} @@ -74,5 +76,4 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { } protected abstract void readListChange(PacketBuffer buffer); - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEConfigSlot.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEConfigSlot.java index 6bc3e52afd0..ed1b9145bd7 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEConfigSlot.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEConfigSlot.java @@ -1,16 +1,18 @@ package gregtech.common.gui.widget.appeng.slot; -import appeng.api.storage.data.IAEStack; import gregtech.api.gui.Widget; import gregtech.api.gui.ingredient.IGhostIngredientTarget; import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.common.gui.widget.appeng.AEConfigWidget; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; -import mezz.jei.api.gui.IGhostIngredientHandler; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import appeng.api.storage.data.IAEStack; +import mezz.jei.api.gui.IGhostIngredientHandler; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -67,5 +69,4 @@ protected boolean mouseOverStock(int mouseX, int mouseY) { public List> getPhantomTargets(Object ingredient) { return Collections.emptyList(); } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidConfigSlot.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidConfigSlot.java index fb26dfb1408..d21bc00b38f 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidConfigSlot.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidConfigSlot.java @@ -1,7 +1,5 @@ package gregtech.common.gui.widget.appeng.slot; -import appeng.api.storage.data.IAEFluidStack; -import com.google.common.collect.Lists; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.util.FluidTooltipUtil; @@ -12,7 +10,7 @@ import gregtech.common.gui.widget.appeng.AEConfigWidget; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.stack.WrappedFluidStack; -import mezz.jei.api.gui.IGhostIngredientHandler; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -22,13 +20,18 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import appeng.api.storage.data.IAEFluidStack; +import com.google.common.collect.Lists; +import mezz.jei.api.gui.IGhostIngredientHandler; + import java.awt.*; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + import static gregtech.api.capability.GregtechDataCodes.LOAD_PHANTOM_FLUID_STACK_FROM_NBT; import static gregtech.api.util.GTUtility.getFluidFromContainer; @@ -64,7 +67,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender drawStringFixedCorner(amountStr, stackX + 17, stackY + 17, 16777215, true, 0.5f); } if (stock != null) { - RenderUtil.drawFluidForGui(stock.getFluidStack(), stock.getFluidStack().amount, stackX, stackY + 18, 17, 17); + RenderUtil.drawFluidForGui(stock.getFluidStack(), stock.getFluidStack().amount, stackX, stackY + 18, 17, + 17); String amountStr = TextFormattingUtil.formatLongToCompactString(stock.getStackSize(), 4) + "L"; drawStringFixedCorner(amountStr, stackX + 17, stackY + 18 + 17, 16777215, true, 0.5f); } @@ -140,7 +144,8 @@ public void handleClientAction(int id, PacketBuffer buffer) { writeUpdateInfo(REMOVE_ID, buf -> {}); } if (id == UPDATE_ID) { - FluidStack fluid = FluidRegistry.getFluidStack(buffer.readString(Integer.MAX_VALUE / 16), buffer.readVarInt()); + FluidStack fluid = FluidRegistry.getFluidStack(buffer.readString(Integer.MAX_VALUE / 16), + buffer.readVarInt()); slot.setConfig(WrappedFluidStack.fromFluidStack(fluid)); this.parentWidget.enableAmount(this.index); if (fluid != null) { @@ -182,7 +187,8 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { slot.setConfig(null); } if (id == UPDATE_ID) { - FluidStack fluid = FluidRegistry.getFluidStack(buffer.readString(Integer.MAX_VALUE / 16), buffer.readVarInt()); + FluidStack fluid = FluidRegistry.getFluidStack(buffer.readString(Integer.MAX_VALUE / 16), + buffer.readVarInt()); slot.setConfig(WrappedFluidStack.fromFluidStack(fluid)); } if (id == AMOUNT_CHANGE_ID) { @@ -243,5 +249,4 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { } return false; } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidDisplayWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidDisplayWidget.java index bf387d8e350..6aa47927c36 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidDisplayWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidDisplayWidget.java @@ -1,6 +1,5 @@ package gregtech.common.gui.widget.appeng.slot; -import appeng.api.storage.data.IAEFluidStack; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; @@ -9,8 +8,11 @@ import gregtech.api.util.Size; import gregtech.client.utils.RenderUtil; import gregtech.common.gui.widget.appeng.AEListGridWidget; + import net.minecraft.item.ItemStack; +import appeng.api.storage.data.IAEFluidStack; + import java.util.ArrayList; import java.util.List; @@ -68,5 +70,4 @@ public void drawInForeground(int mouseX, int mouseY) { } } } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemConfigSlot.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemConfigSlot.java index 18e90d4702b..7fba8bf1eae 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemConfigSlot.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemConfigSlot.java @@ -1,7 +1,5 @@ package gregtech.common.gui.widget.appeng.slot; -import appeng.api.storage.data.IAEItemStack; -import com.google.common.collect.Lists; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.util.Position; @@ -10,18 +8,23 @@ import gregtech.common.gui.widget.appeng.AEConfigWidget; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.stack.WrappedItemStack; -import mezz.jei.api.gui.IGhostIngredientHandler; + import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import appeng.api.storage.data.IAEItemStack; +import com.google.common.collect.Lists; +import mezz.jei.api.gui.IGhostIngredientHandler; + import java.awt.*; import java.io.IOException; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + /** * @Author GlodBlock * @Description A configurable slot for {@link IAEItemStack} @@ -123,8 +126,7 @@ public void handleClientAction(int id, PacketBuffer buffer) { if (!item.isEmpty()) { writeUpdateInfo(UPDATE_ID, buf -> buf.writeItemStack(item)); } - } catch (IOException ignored) { - } + } catch (IOException ignored) {} } if (id == AMOUNT_CHANGE_ID) { if (slot.getConfig() != null) { @@ -146,8 +148,7 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { try { ItemStack item = buffer.readItemStack(); slot.setConfig(WrappedItemStack.fromItemStack(item)); - } catch (IOException ignored) { - } + } catch (IOException ignored) {} } if (id == AMOUNT_CHANGE_ID) { if (slot.getConfig() != null) { @@ -203,5 +204,4 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { } return false; } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemDisplayWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemDisplayWidget.java index d4bc53161c6..62ffe78c113 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemDisplayWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemDisplayWidget.java @@ -1,14 +1,16 @@ package gregtech.common.gui.widget.appeng.slot; -import appeng.api.storage.data.IAEItemStack; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.common.gui.widget.appeng.AEListGridWidget; + import net.minecraft.item.ItemStack; +import appeng.api.storage.data.IAEItemStack; + /** * @Author GlodBlock * @Description Display a certain {@link IAEItemStack} element. @@ -55,5 +57,4 @@ public void drawInForeground(int mouseX, int mouseY) { } } } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AmountSetSlot.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AmountSetSlot.java index 80cbd724dab..ccec8521dd7 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AmountSetSlot.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AmountSetSlot.java @@ -1,6 +1,5 @@ package gregtech.common.gui.widget.appeng.slot; -import appeng.api.storage.data.IAEStack; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; @@ -8,8 +7,11 @@ import gregtech.api.util.Position; import gregtech.common.gui.widget.appeng.AEConfigWidget; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; + import net.minecraft.network.PacketBuffer; +import appeng.api.storage.data.IAEStack; + /** * @Author GlodBlock * @Description The amount set widget for config slot @@ -53,8 +55,7 @@ public void setNewAmount(String amount) { try { long newAmount = Long.parseLong(amount); writeClientAction(1, buf -> buf.writeVarLong(newAmount)); - } catch (NumberFormatException ignore) { - } + } catch (NumberFormatException ignore) {} } @Override @@ -82,5 +83,4 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender drawStringSized("Amount", position.x + 3, position.y + 3, 0x404040, false, 1f, false); GuiTextures.DISPLAY.draw(position.x + 3, position.y + 11, 65, 14); } - } diff --git a/src/main/java/gregtech/common/gui/widget/craftingstation/CraftingSlotWidget.java b/src/main/java/gregtech/common/gui/widget/craftingstation/CraftingSlotWidget.java index 27babb582c3..973ef3c478b 100644 --- a/src/main/java/gregtech/common/gui/widget/craftingstation/CraftingSlotWidget.java +++ b/src/main/java/gregtech/common/gui/widget/craftingstation/CraftingSlotWidget.java @@ -1,19 +1,21 @@ package gregtech.common.gui.widget.craftingstation; -import com.google.common.base.Preconditions; import gregtech.api.gui.impl.ModularUIContainer; import gregtech.api.gui.ingredient.IRecipeTransferHandlerWidget; import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.util.OverlayedItemHandler; import gregtech.common.metatileentities.storage.CraftingRecipeLogic; -import mezz.jei.api.gui.IGuiIngredient; -import mezz.jei.api.gui.IRecipeLayout; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraftforge.items.wrapper.PlayerMainInvWrapper; + +import com.google.common.base.Preconditions; +import mezz.jei.api.gui.IGuiIngredient; +import mezz.jei.api.gui.IRecipeLayout; import org.lwjgl.input.Mouse; import java.io.IOException; @@ -58,16 +60,18 @@ public void handleClientAction(int id, PacketBuffer buffer) { boolean isRightClick = clickData.button == 1; EntityPlayer player = gui.entityPlayer; if (isShiftDown) { - OverlayedItemHandler playerInventory = new OverlayedItemHandler(new PlayerMainInvWrapper(gui.entityPlayer.inventory)); + OverlayedItemHandler playerInventory = new OverlayedItemHandler( + new PlayerMainInvWrapper(gui.entityPlayer.inventory)); ItemStack toMerge = slotReference.getStack(); int crafts = this.slotReference.getStack().getCount(); if (isLeftClick) { if (crafts != 0) { - //limit shift click to one stack at a time + // limit shift click to one stack at a time int totalCrafts = 0; int maxCrafts = toMerge.getMaxStackSize() / crafts; for (int i = 0; i < maxCrafts; i++) { - if (canMergeToInv(playerInventory, toMerge, crafts) && recipeResolver.performRecipe(gui.entityPlayer)) { + if (canMergeToInv(playerInventory, toMerge, crafts) && + recipeResolver.performRecipe(gui.entityPlayer)) { this.recipeResolver.refreshOutputSlot(); recipeResolver.handleItemCraft(this.slotReference.getStack(), gui.entityPlayer); totalCrafts += crafts; @@ -79,7 +83,8 @@ public void handleClientAction(int id, PacketBuffer buffer) { } } else if (isRightClick) { int totalCrafts = 0; - while (canMergeToInv(playerInventory, toMerge, crafts) && recipeResolver.performRecipe(gui.entityPlayer)) { + while (canMergeToInv(playerInventory, toMerge, crafts) && + recipeResolver.performRecipe(gui.entityPlayer)) { this.recipeResolver.refreshOutputSlot(); recipeResolver.handleItemCraft(this.slotReference.getStack(), gui.entityPlayer); totalCrafts += crafts; @@ -90,15 +95,17 @@ public void handleClientAction(int id, PacketBuffer buffer) { } } else { if (isLeftClick) { - if (canMerge(player.inventory.getItemStack(), this.slotReference.getStack()) && recipeResolver.performRecipe(gui.entityPlayer)) { + if (canMerge(player.inventory.getItemStack(), this.slotReference.getStack()) && + recipeResolver.performRecipe(gui.entityPlayer)) { this.recipeResolver.refreshOutputSlot(); recipeResolver.handleItemCraft(this.slotReference.getStack(), gui.entityPlayer); - //send slot changes now, both of consumed items in inventory and result slot + // send slot changes now, both of consumed items in inventory and result slot ItemStack result = this.slotReference.getStack(); mergeToHand(result); } } else if (isRightClick) { - while (canMerge(player.inventory.getItemStack(), this.slotReference.getStack()) && recipeResolver.performRecipe(gui.entityPlayer)) { + while (canMerge(player.inventory.getItemStack(), this.slotReference.getStack()) && + recipeResolver.performRecipe(gui.entityPlayer)) { this.recipeResolver.refreshOutputSlot(); recipeResolver.handleItemCraft(this.slotReference.getStack(), gui.entityPlayer); ItemStack result = this.slotReference.getStack(); @@ -107,7 +114,7 @@ public void handleClientAction(int id, PacketBuffer buffer) { } } uiAccess.sendHeldItemUpdate(); - //send slot changes now, both of consumed items in inventory and result slot + // send slot changes now, both of consumed items in inventory and result slot gui.entityPlayer.openContainer.detectAndSendChanges(); uiAccess.sendSlotUpdate(this); } @@ -132,14 +139,15 @@ private void mergeToHand(ItemStack toMerge) { if (itemInHand.isEmpty()) { itemInHand = toMerge; player.inventory.setItemStack(itemInHand); - } else if (ItemStack.areItemsEqual(itemInHand, toMerge) && ItemStack.areItemStackTagsEqual(itemInHand, toMerge)) { - //if the hand is not empty, try to merge the result with the hand - if (itemInHand.getCount() + toMerge.getCount() <= itemInHand.getMaxStackSize()) { - //if the result of the merge is smaller than the max stack size, merge - itemInHand.grow(toMerge.getCount()); - player.inventory.setItemStack(itemInHand); + } else + if (ItemStack.areItemsEqual(itemInHand, toMerge) && ItemStack.areItemStackTagsEqual(itemInHand, toMerge)) { + // if the hand is not empty, try to merge the result with the hand + if (itemInHand.getCount() + toMerge.getCount() <= itemInHand.getMaxStackSize()) { + // if the result of the merge is smaller than the max stack size, merge + itemInHand.grow(toMerge.getCount()); + player.inventory.setItemStack(itemInHand); + } } - } } @Override @@ -178,11 +186,13 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { } @Override - public String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { + public String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, + boolean maxTransfer, boolean doTransfer) { if (!doTransfer) { return null; } - Map> ingredients = new HashMap<>(recipeLayout.getItemStacks().getGuiIngredients()); + Map> ingredients = new HashMap<>( + recipeLayout.getItemStacks().getGuiIngredients()); ingredients.values().removeIf(it -> it.getAllIngredients().isEmpty() || !it.isInput()); writeClientAction(1, buf -> { buf.writeVarInt(ingredients.size()); diff --git a/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListGridWidget.java b/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListGridWidget.java index 16af45ff053..ed75af27bd4 100644 --- a/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListGridWidget.java +++ b/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListGridWidget.java @@ -9,15 +9,18 @@ import gregtech.common.inventory.IItemList; import gregtech.common.inventory.IItemList.InsertMode; import gregtech.common.inventory.SimpleItemInfo; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; + import java.io.IOException; import java.util.*; +import javax.annotation.Nullable; + public class ItemListGridWidget extends ScrollableListWidget { private static final Comparator COMPARATOR = Comparator.comparing( @@ -33,7 +36,8 @@ public class ItemListGridWidget extends ScrollableListWidget { private final int slotAmountX; private final int slotAmountY; private int slotRowsAmount = 0; - private final Map cachedItemList = new Object2ObjectOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + private final Map cachedItemList = new Object2ObjectOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); private final List itemsChanged = new ArrayList<>(); private final List itemsRemoved = new ArrayList<>(); @@ -80,7 +84,8 @@ private void handleSlotShiftClick(INativeWidget clickedSlot) { ItemStack itemStack = clickedSlot.getHandle().getStack(); if (clickedSlot.getHandle().canTakeStack(gui.entityPlayer) && !itemStack.isEmpty()) { itemStack = clickedSlot.onItemTake(gui.entityPlayer, itemStack, true); - int amountInserted = getItemList().insertItem(itemStack, itemStack.getCount(), false, InsertMode.LOWEST_PRIORITY); + int amountInserted = getItemList().insertItem(itemStack, itemStack.getCount(), false, + InsertMode.LOWEST_PRIORITY); if (amountInserted > 0) { clickedSlot.onItemTake(gui.entityPlayer, itemStack, false); itemStack.shrink(amountInserted); @@ -200,14 +205,16 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { int itemsRemoved = buffer.readVarInt(); for (int i = 0; i < itemsRemoved; i++) { ItemStack itemStack = buffer.readItemStack(); - this.displayItemList.removeIf(it -> ItemStackHashStrategy.comparingAllButCount().equals(it.getItemStack(), itemStack)); + this.displayItemList.removeIf( + it -> ItemStackHashStrategy.comparingAllButCount().equals(it.getItemStack(), itemStack)); } int itemsChanged = buffer.readVarInt(); for (int i = 0; i < itemsChanged; i++) { ItemStack itemStack = buffer.readItemStack(); int newTotalAmount = buffer.readVarInt(); SimpleItemInfo itemInfo = displayItemList.stream() - .filter(it -> ItemStackHashStrategy.comparingAllButCount().equals(it.getItemStack(), itemStack)) + .filter(it -> ItemStackHashStrategy.comparingAllButCount().equals(it.getItemStack(), + itemStack)) .findAny() .orElse(null); if (itemInfo == null) { diff --git a/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListSlotWidget.java b/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListSlotWidget.java index 291fe76f7c6..aeb7cb80ba7 100644 --- a/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListSlotWidget.java +++ b/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListSlotWidget.java @@ -9,17 +9,19 @@ import gregtech.common.inventory.IItemInfo; import gregtech.common.inventory.IItemList; import gregtech.common.inventory.IItemList.InsertMode; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.util.text.TextFormatting; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.IOException; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class ItemListSlotWidget extends Widget { private final ItemListGridWidget gridWidget; @@ -86,22 +88,23 @@ private static int getAmountToTake(@Nonnull ItemStack itemStack, int maxAmount, return button == 0 ? maxStackSize : (maxStackSize >= 2 ? maxStackSize / 2 : 1); } - //returns true if something actually happened + // returns true if something actually happened private boolean insertHeldItemStack(int button, boolean isClient) { InventoryPlayer inventory = gui.entityPlayer.inventory; int amountToInsert = button == 1 ? 1 : Integer.MAX_VALUE; if (!inventory.getItemStack().isEmpty()) { if (!isClient) { - //on server, we lookup item list to see how much we can actually insert + // on server, we lookup item list to see how much we can actually insert ItemStack heldItemStack = inventory.getItemStack(); IItemList itemList = gridWidget.getItemList(); - int amountInserted = itemList.insertItem(heldItemStack, Math.min(heldItemStack.getCount(), amountToInsert), false, InsertMode.LOWEST_PRIORITY); + int amountInserted = itemList.insertItem(heldItemStack, + Math.min(heldItemStack.getCount(), amountToInsert), false, InsertMode.LOWEST_PRIORITY); heldItemStack.shrink(amountInserted); uiAccess.sendHeldItemUpdate(); gui.entityPlayer.openContainer.detectAndSendChanges(); return amountInserted > 0; } else { - //on client we assume we can insert full stack into the network + // on client we assume we can insert full stack into the network inventory.getItemStack().shrink(amountToInsert); return true; } @@ -113,7 +116,7 @@ private void extractItemStack(ItemStack itemStack, int amount, boolean isClient) InventoryPlayer inventory = gui.entityPlayer.inventory; if (inventory.getItemStack().isEmpty()) { if (!isClient) { - //on server, we try to extract from the network + // on server, we try to extract from the network IItemList itemList = gridWidget.getItemList(); int amountExtracted = itemList.extractItem(itemStack, amount, false); if (amountExtracted > 0) { @@ -123,7 +126,7 @@ private void extractItemStack(ItemStack itemStack, int amount, boolean isClient) } uiAccess.sendHeldItemUpdate(); } else { - //on client we assume we can extract as much items as user wishes + // on client we assume we can extract as much items as user wishes ItemStack resultStack = itemStack.copy(); resultStack.setCount(amount); inventory.setItemStack(resultStack); diff --git a/src/main/java/gregtech/common/gui/widget/craftingstation/MemorizedRecipeWidget.java b/src/main/java/gregtech/common/gui/widget/craftingstation/MemorizedRecipeWidget.java index b7e01694808..4bbf93311b8 100644 --- a/src/main/java/gregtech/common/gui/widget/craftingstation/MemorizedRecipeWidget.java +++ b/src/main/java/gregtech/common/gui/widget/craftingstation/MemorizedRecipeWidget.java @@ -6,6 +6,7 @@ import gregtech.api.util.Position; import gregtech.common.metatileentities.storage.CraftingRecipeMemory; import gregtech.common.metatileentities.storage.CraftingRecipeMemory.MemorizedRecipe; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -24,7 +25,8 @@ public class MemorizedRecipeWidget extends SlotWidget { private boolean recipeLocked = false; private final IItemHandlerModifiable craftingGrid; - public MemorizedRecipeWidget(CraftingRecipeMemory recipeMemory, int index, IItemHandlerModifiable craftingGrid, int xPosition, int yPosition) { + public MemorizedRecipeWidget(CraftingRecipeMemory recipeMemory, int index, IItemHandlerModifiable craftingGrid, + int xPosition, int yPosition) { super(new ItemStackHandler(1), 0, xPosition, yPosition, false, false); this.recipeMemory = recipeMemory; this.recipeIndex = index; @@ -95,5 +97,4 @@ public ItemStack slotClick(int dragType, ClickType clickTypeIn, EntityPlayer pla } return ItemStack.EMPTY; } - } diff --git a/src/main/java/gregtech/common/gui/widget/monitor/WidgetCoverList.java b/src/main/java/gregtech/common/gui/widget/monitor/WidgetCoverList.java index 8921eb5c239..5706c8a6787 100644 --- a/src/main/java/gregtech/common/gui/widget/monitor/WidgetCoverList.java +++ b/src/main/java/gregtech/common/gui/widget/monitor/WidgetCoverList.java @@ -13,6 +13,7 @@ import gregtech.client.renderer.handler.BlockPosHighlightRenderer; import gregtech.client.utils.RenderUtil; import gregtech.common.covers.CoverDigitalInterface; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; @@ -39,7 +40,8 @@ public class WidgetCoverList extends ScrollableListWidget { private final Map widgetMap; public Consumer onSelected; - public WidgetCoverList(int xPosition, int yPosition, int width, int slotSize, List covers, CoverDigitalInterface bindCover, Consumer onSelected) { + public WidgetCoverList(int xPosition, int yPosition, int width, int slotSize, List covers, + CoverDigitalInterface bindCover, Consumer onSelected) { super(xPosition, yPosition, width, slotSize * 18); widgetMap = new HashMap<>(); this.onSelected = onSelected; @@ -60,7 +62,8 @@ public WidgetCoverList(int xPosition, int yPosition, int width, int slotSize, Li itemStackHandler.insertItem(0, itemStack, false); WidgetGroup widgetGroup = new WidgetGroup(); widgetGroup.addWidget(new SlotWidget(itemStackHandler, 0, 0, 0, false, false)); - widgetGroup.addWidget(new LabelWidget(20, 5, String.format("(%d, %d, %d)", pos.getX(), pos.getY(), pos.getZ()), 0XFFFFFFFF)); + widgetGroup.addWidget(new LabelWidget(20, 5, + String.format("(%d, %d, %d)", pos.getX(), pos.getY(), pos.getZ()), 0XFFFFFFFF)); widgetMap.put(widgetGroup, cover); if (widgetGroup.getSize().width + scrollPaneWidth > this.getSize().width) this.setSize(new Size(widgetGroup.getSize().width + scrollPaneWidth, this.getSize().height)); @@ -87,22 +90,23 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { public boolean mouseClicked(int mouseX, int mouseY, int button) { boolean result = super.mouseClicked(mouseX, mouseY, button); if (!result && mouseY >= this.getPosition().y && mouseY <= this.getPosition().y + this.getSize().height) { - Widget widget = this.widgets.stream().filter(it -> it.isMouseOverElement(mouseX, mouseY)).findFirst().orElse(null); + Widget widget = this.widgets.stream().filter(it -> it.isMouseOverElement(mouseX, mouseY)).findFirst() + .orElse(null); if (widget instanceof WidgetGroup) { List children = ((WidgetGroup) widget).getContainedWidgets(true); if (children.get(0).isMouseOverElement(mouseX, mouseY)) { try { - String posString = ObfuscationReflectionHelper.getPrivateValue(LabelWidget.class, (LabelWidget) children.get(1), "text"); + String posString = ObfuscationReflectionHelper.getPrivateValue(LabelWidget.class, + (LabelWidget) children.get(1), "text"); String[] posSplit = PARENTHESIS_PATTERN.split(posString); BlockPosHighlightRenderer.renderBlockBoxHighLight( - new BlockPos(Integer.parseInt(posSplit[1]), Integer.parseInt(posSplit[3]) - , Integer.parseInt(posSplit[5])), 5000); + new BlockPos(Integer.parseInt(posSplit[1]), Integer.parseInt(posSplit[3]), + Integer.parseInt(posSplit[5])), + 5000); Minecraft.getMinecraft().player.closeScreen(); Minecraft.getMinecraft().player.sendMessage(new TextComponentString( ((SlotWidget) children.get(0)).getHandle().getStack().getDisplayName() + - ": " - + posString - )); + ": " + posString)); return false; } catch (Throwable e) { GTLog.logger.error("Could not reflect GregTech WidgetLabel text", e); @@ -173,19 +177,22 @@ private boolean isOnScrollPane(int mouseX, int mouseY) { @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { - RenderUtil.useScissor(this.getPosition().x, this.getPosition().y, this.getSize().width, this.getSize().height, () -> { - widgets.forEach(widget -> { - if (widget instanceof WidgetGroup) { - Widget widget1 = ((WidgetGroup) widget).getContainedWidgets(true).get(0); - SlotWidget slotWidget = (SlotWidget) widget1; - slotWidget.setActive(widget.getPosition().y >= this.getPosition().y - 9 && widget.getPosition().y <= this.getPosition().y + this.getSize().height - 9); - } - }); - if (selected != null) { - Gui.drawRect(selected.getPosition().x, selected.getPosition().y, selected.getPosition().x + this.getSize().width - this.scrollPaneWidth, selected.getPosition().y + selected.getSize().height, 0x4BFFFFFF); - } - super.drawInBackground(mouseX, mouseY, partialTicks, context); - }); + RenderUtil.useScissor(this.getPosition().x, this.getPosition().y, this.getSize().width, this.getSize().height, + () -> { + widgets.forEach(widget -> { + if (widget instanceof WidgetGroup) { + Widget widget1 = ((WidgetGroup) widget).getContainedWidgets(true).get(0); + SlotWidget slotWidget = (SlotWidget) widget1; + slotWidget.setActive(widget.getPosition().y >= this.getPosition().y - 9 && + widget.getPosition().y <= this.getPosition().y + this.getSize().height - 9); + } + }); + if (selected != null) { + Gui.drawRect(selected.getPosition().x, selected.getPosition().y, + selected.getPosition().x + this.getSize().width - this.scrollPaneWidth, + selected.getPosition().y + selected.getSize().height, 0x4BFFFFFF); + } + super.drawInBackground(mouseX, mouseY, partialTicks, context); + }); } - } diff --git a/src/main/java/gregtech/common/gui/widget/monitor/WidgetMonitorScreen.java b/src/main/java/gregtech/common/gui/widget/monitor/WidgetMonitorScreen.java index 5fe2b017915..f3d0bc7cf02 100644 --- a/src/main/java/gregtech/common/gui/widget/monitor/WidgetMonitorScreen.java +++ b/src/main/java/gregtech/common/gui/widget/monitor/WidgetMonitorScreen.java @@ -3,12 +3,14 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.util.Position; -import gregtech.client.utils.RenderUtil; import gregtech.api.util.Size; +import gregtech.client.utils.RenderUtil; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen; + import net.minecraft.client.renderer.GlStateManager; public class WidgetMonitorScreen extends Widget { + private final MetaTileEntityMonitorScreen screen; public WidgetMonitorScreen(int x, int y, int w, MetaTileEntityMonitorScreen screen) { @@ -25,14 +27,14 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender if (screen != null && screen.isActive()) { GlStateManager.pushMatrix(); - GlStateManager.translate(position.x + 2 + 0.5 * (size.width - 4), position.y + 2 + 0.5 * (size.height - 4),0); + GlStateManager.translate(position.x + 2 + 0.5 * (size.width - 4), position.y + 2 + 0.5 * (size.height - 4), + 0); GlStateManager.scale(size.getWidth(), size.getWidth(), 1.0f / size.getWidth()); - GlStateManager.scale(1 / screen.scale,1 / screen.scale,1 / screen.scale); + GlStateManager.scale(1 / screen.scale, 1 / screen.scale, 1 / screen.scale); GlStateManager.translate(-(screen.scale - 1) * 0.5, -(screen.scale - 1) * 0.5, 0); - screen.renderScreen(0,null); + screen.renderScreen(0, null); GlStateManager.popMatrix(); } - } } diff --git a/src/main/java/gregtech/common/gui/widget/monitor/WidgetPluginConfig.java b/src/main/java/gregtech/common/gui/widget/monitor/WidgetPluginConfig.java index 01c656a7c17..1fa2cee2bb9 100644 --- a/src/main/java/gregtech/common/gui/widget/monitor/WidgetPluginConfig.java +++ b/src/main/java/gregtech/common/gui/widget/monitor/WidgetPluginConfig.java @@ -8,11 +8,13 @@ import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.entity.player.InventoryPlayer; public class WidgetPluginConfig extends WidgetGroup { + protected TextureArea textureArea; - int width,height; + int width, height; public WidgetPluginConfig setSize(int width, int height) { setSize(new Size(width, height)); @@ -33,12 +35,12 @@ public void setGui(ModularUI gui) { onPositionUpdate(); } - public WidgetPluginConfig setBackGround(TextureArea textureArea){ + public WidgetPluginConfig setBackGround(TextureArea textureArea) { this.textureArea = textureArea; return this; } - public WidgetPluginConfig widget(Widget widget){ + public WidgetPluginConfig widget(Widget widget) { addWidget(widget); return this; } @@ -47,19 +49,23 @@ public void removePluginWidget() { clearAllWidgets(); } - public WidgetPluginConfig bindPlayerInventory(InventoryPlayer inventoryPlayer, TextureArea imageLocation, int x, int y) { - for(int row = 0; row < 3; ++row) { - for(int col = 0; col < 9; ++col) { - this.widget((new SlotWidget(inventoryPlayer, col + (row + 1) * 9, x + col * 18, y + row * 18)).setBackgroundTexture(new TextureArea[]{imageLocation}).setLocationInfo(true, false)); + public WidgetPluginConfig bindPlayerInventory(InventoryPlayer inventoryPlayer, TextureArea imageLocation, int x, + int y) { + for (int row = 0; row < 3; ++row) { + for (int col = 0; col < 9; ++col) { + this.widget((new SlotWidget(inventoryPlayer, col + (row + 1) * 9, x + col * 18, y + row * 18)) + .setBackgroundTexture(new TextureArea[] { imageLocation }).setLocationInfo(true, false)); } } return this.bindPlayerHotbar(inventoryPlayer, imageLocation, x, y + 58); } - public WidgetPluginConfig bindPlayerHotbar(InventoryPlayer inventoryPlayer, TextureArea imageLocation, int x, int y) { - for(int slot = 0; slot < 9; ++slot) { - this.widget((new SlotWidget(inventoryPlayer, slot, x + slot * 18, y)).setBackgroundTexture(new TextureArea[]{imageLocation}).setLocationInfo(true, true)); + public WidgetPluginConfig bindPlayerHotbar(InventoryPlayer inventoryPlayer, TextureArea imageLocation, int x, + int y) { + for (int slot = 0; slot < 9; ++slot) { + this.widget((new SlotWidget(inventoryPlayer, slot, x + slot * 18, y)) + .setBackgroundTexture(new TextureArea[] { imageLocation }).setLocationInfo(true, true)); } return this; @@ -74,5 +80,4 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender } super.drawInBackground(mouseX, mouseY, partialTicks, context); } - } diff --git a/src/main/java/gregtech/common/gui/widget/monitor/WidgetScreenGrid.java b/src/main/java/gregtech/common/gui/widget/monitor/WidgetScreenGrid.java index 67a635d0577..45a7904362f 100644 --- a/src/main/java/gregtech/common/gui/widget/monitor/WidgetScreenGrid.java +++ b/src/main/java/gregtech/common/gui/widget/monitor/WidgetScreenGrid.java @@ -7,16 +7,19 @@ import gregtech.api.util.Size; import gregtech.client.utils.RenderUtil; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen; + import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.input.Mouse; public class WidgetScreenGrid extends Widget { - public int x,y; + + public int x, y; public static final int width = 20; public static final int height = 20; MetaTileEntityMonitorScreen monitorScreen; @@ -24,12 +27,13 @@ public class WidgetScreenGrid extends Widget { public WidgetScreenGrid(int xPosition, int yPosition, int x, int y) { super(new Position(xPosition + x * width, yPosition + y * height), new Size(width, height)); - this.x = x; this.y = y; + this.x = x; + this.y = y; } public void setScreen(MetaTileEntityMonitorScreen monitorScreen) { this.monitorScreen = monitorScreen; - color = (monitorScreen != null && monitorScreen.isActive())? 0XFF4F66FF : 0XFF000000; + color = (monitorScreen != null && monitorScreen.isActive()) ? 0XFF4F66FF : 0XFF000000; } @SideOnly(Side.CLIENT) @@ -39,19 +43,19 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender int y = this.getPosition().y; int width = this.getSize().width; int height = this.getSize().height; - int color = (monitorScreen != null && monitorScreen.isActive())? monitorScreen.frameColor:this.color; + int color = (monitorScreen != null && monitorScreen.isActive()) ? monitorScreen.frameColor : this.color; Gui.drawRect(x + 1, y + 1, x + width - 2, y + height - 2, color); -// if (monitorScreen.scale > 1) { -// width = (int) (monitorScreen.scale * width); -// height = (int) (monitorScreen.scale * height); -// Gui.drawRect(x, y, x + width - 1, y + 1, color); -// Gui.drawRect(x, y + height - 1, x + width - 1, y + height, color); -// Gui.drawRect(x, y, x + 1, y + height, color); -// Gui.drawRect(x + width - 1, y, x + width, y + height, color); -// } -// if (this.isMouseOverElement(mouseX, mouseY)) { -// Gui.drawRect(x, y, x + width, y + height, 0x4B6C6C6C); -// } + // if (monitorScreen.scale > 1) { + // width = (int) (monitorScreen.scale * width); + // height = (int) (monitorScreen.scale * height); + // Gui.drawRect(x, y, x + width - 1, y + 1, color); + // Gui.drawRect(x, y + height - 1, x + width - 1, y + height, color); + // Gui.drawRect(x, y, x + 1, y + height, color); + // Gui.drawRect(x + width - 1, y, x + width, y + height, color); + // } + // if (this.isMouseOverElement(mouseX, mouseY)) { + // Gui.drawRect(x, y, x + width, y + height, 0x4B6C6C6C); + // } } @SideOnly(Side.CLIENT) @@ -91,7 +95,8 @@ public void handleClientAction(int id, PacketBuffer buffer) { super.handleClientAction(id, buffer); if (id == 1) { if (monitorScreen != null) { - MetaTileEntityUIFactory.INSTANCE.openUI(monitorScreen.getHolder(), (EntityPlayerMP) this.gui.entityPlayer); + MetaTileEntityUIFactory.INSTANCE.openUI(monitorScreen.getHolder(), + (EntityPlayerMP) this.gui.entityPlayer); } } } diff --git a/src/main/java/gregtech/common/gui/widget/orefilter/ItemOreFilterTestSlot.java b/src/main/java/gregtech/common/gui/widget/orefilter/ItemOreFilterTestSlot.java index 0b4a850400a..ff2481feb9b 100644 --- a/src/main/java/gregtech/common/gui/widget/orefilter/ItemOreFilterTestSlot.java +++ b/src/main/java/gregtech/common/gui/widget/orefilter/ItemOreFilterTestSlot.java @@ -1,11 +1,10 @@ package gregtech.common.gui.widget.orefilter; -import com.google.common.collect.Lists; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.ingredient.IGhostIngredientTarget; import gregtech.api.unification.OreDictUnifier; import gregtech.api.util.Position; -import mezz.jei.api.gui.IGhostIngredientHandler; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; @@ -15,13 +14,17 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.Lists; +import mezz.jei.api.gui.IGhostIngredientHandler; + import java.awt.*; import java.util.Collections; import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class ItemOreFilterTestSlot extends OreFilterTestSlot implements IGhostIngredientTarget { @Nonnull @@ -56,7 +59,8 @@ protected void renderSlotContents(float partialTicks, IRenderContext context) { GlStateManager.pushMatrix(); RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); itemRender.renderItemAndEffectIntoGUI(testStack, pos.x + 1, pos.y + 1); - itemRender.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, testStack, pos.x + 1, pos.y + 1, null); + itemRender.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, testStack, pos.x + 1, pos.y + 1, + null); GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); } @@ -75,7 +79,8 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { private void putItem(ItemStack stack) { ItemStack testStack = getTestStack(); - if ((stack.isEmpty() ^ testStack.isEmpty()) || !testStack.isItemEqual(stack) || !ItemStack.areItemStackTagsEqual(testStack, stack)) { + if ((stack.isEmpty() ^ testStack.isEmpty()) || !testStack.isItemEqual(stack) || + !ItemStack.areItemStackTagsEqual(testStack, stack)) { ItemStack copy = stack.copy(); copy.setCount(1); setTestStack(copy); @@ -89,6 +94,7 @@ public List> getPhantomTargets(Object ingredie } Rectangle rectangle = toRectangleBox(); return Lists.newArrayList(new IGhostIngredientHandler.Target() { + @Nonnull @Override public Rectangle getArea() { diff --git a/src/main/java/gregtech/common/gui/widget/orefilter/OreFilterTestSlot.java b/src/main/java/gregtech/common/gui/widget/orefilter/OreFilterTestSlot.java index b1d939ac8a8..b8a276ed17d 100644 --- a/src/main/java/gregtech/common/gui/widget/orefilter/OreFilterTestSlot.java +++ b/src/main/java/gregtech/common/gui/widget/orefilter/OreFilterTestSlot.java @@ -9,22 +9,25 @@ import gregtech.api.util.Position; import gregtech.api.util.function.BooleanConsumer; import gregtech.api.util.oreglob.OreGlob; -import it.unimi.dsi.fastutil.objects.Object2BooleanAVLTreeMap; -import it.unimi.dsi.fastutil.objects.Object2BooleanMap; -import it.unimi.dsi.fastutil.objects.Object2BooleanMaps; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2BooleanAVLTreeMap; +import it.unimi.dsi.fastutil.objects.Object2BooleanMap; +import it.unimi.dsi.fastutil.objects.Object2BooleanMaps; + import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.stream.Collectors; +import javax.annotation.Nullable; + /** * @author brachy84 */ @@ -177,8 +180,8 @@ public void drawInForeground(int mouseX, int mouseY) { list = this.testResult.object2BooleanEntrySet().stream().map( e -> I18n.format(e.getBooleanValue() ? "cover.ore_dictionary_filter.test_slot.matches" : - "cover.ore_dictionary_filter.test_slot.matches_not", e.getKey()) - ).collect(Collectors.toList()); + "cover.ore_dictionary_filter.test_slot.matches_not", e.getKey())) + .collect(Collectors.toList()); break; case INVALID: default: diff --git a/src/main/java/gregtech/common/gui/widget/orefilter/OreGlobCompileStatusWidget.java b/src/main/java/gregtech/common/gui/widget/orefilter/OreGlobCompileStatusWidget.java index 39a4c756410..730ef11b13f 100644 --- a/src/main/java/gregtech/common/gui/widget/orefilter/OreGlobCompileStatusWidget.java +++ b/src/main/java/gregtech/common/gui/widget/orefilter/OreGlobCompileStatusWidget.java @@ -6,14 +6,16 @@ import gregtech.api.gui.resources.TextureArea; import gregtech.api.gui.widgets.TextFieldWidget2; import gregtech.api.util.oreglob.OreGlobCompileResult; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + public class OreGlobCompileStatusWidget extends Widget { @Nullable diff --git a/src/main/java/gregtech/common/inventory/IItemList.java b/src/main/java/gregtech/common/inventory/IItemList.java index ebcc961df73..037db382c43 100644 --- a/src/main/java/gregtech/common/inventory/IItemList.java +++ b/src/main/java/gregtech/common/inventory/IItemList.java @@ -2,9 +2,10 @@ import net.minecraft.item.ItemStack; -import javax.annotation.Nullable; import java.util.Set; +import javax.annotation.Nullable; + public interface IItemList { Set getStoredItems(); diff --git a/src/main/java/gregtech/common/inventory/SimpleItemInfo.java b/src/main/java/gregtech/common/inventory/SimpleItemInfo.java index f413c6da66e..56775d0beee 100644 --- a/src/main/java/gregtech/common/inventory/SimpleItemInfo.java +++ b/src/main/java/gregtech/common/inventory/SimpleItemInfo.java @@ -1,6 +1,7 @@ package gregtech.common.inventory; import gregtech.api.util.ItemStackHashStrategy; + import net.minecraft.item.ItemStack; public class SimpleItemInfo implements IItemInfo { diff --git a/src/main/java/gregtech/common/inventory/appeng/SerializableFluidList.java b/src/main/java/gregtech/common/inventory/appeng/SerializableFluidList.java index 5a7fd6f54c0..e47157302c0 100644 --- a/src/main/java/gregtech/common/inventory/appeng/SerializableFluidList.java +++ b/src/main/java/gregtech/common/inventory/appeng/SerializableFluidList.java @@ -1,5 +1,12 @@ package gregtech.common.inventory.appeng; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraftforge.common.util.INBTSerializable; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + import appeng.api.config.FuzzyMode; import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IItemList; @@ -7,18 +14,13 @@ import appeng.fluids.util.MeaningfulFluidIterator; import it.unimi.dsi.fastutil.objects.Reference2ObjectMap; import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; import java.util.Iterator; +import javax.annotation.Nonnull; + /** * @Author GlodBlock * @Description A serializable {@link IItemList} from AE2, specially improved for fluid. @@ -28,8 +30,7 @@ public class SerializableFluidList implements IItemList, INBTSeri private final Reference2ObjectMap records = new Reference2ObjectOpenHashMap<>(); - public SerializableFluidList() { - } + public SerializableFluidList() {} @Override public void add(IAEFluidStack fluid) { @@ -59,7 +60,8 @@ public boolean isEmpty() { } private IAEFluidStack getOrCreateRecord(@Nonnull IAEFluidStack fluid) { - return this.records.computeIfAbsent(fluid.getFluid(), key -> AEFluidStack.fromFluidStack(new FluidStack(key, 0))); + return this.records.computeIfAbsent(fluid.getFluid(), + key -> AEFluidStack.fromFluidStack(new FluidStack(key, 0))); } private IAEFluidStack getRecord(@Nonnull IAEFluidStack fluid) { diff --git a/src/main/java/gregtech/common/inventory/appeng/SerializableItemList.java b/src/main/java/gregtech/common/inventory/appeng/SerializableItemList.java index 2b1b879f265..ad09fa2e5b6 100644 --- a/src/main/java/gregtech/common/inventory/appeng/SerializableItemList.java +++ b/src/main/java/gregtech/common/inventory/appeng/SerializableItemList.java @@ -1,14 +1,15 @@ package gregtech.common.inventory.appeng; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraftforge.common.util.INBTSerializable; + import appeng.api.config.FuzzyMode; import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IItemList; import appeng.util.item.AEItemStack; import appeng.util.item.ItemList; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.common.util.INBTSerializable; import java.util.Collection; import java.util.Iterator; @@ -22,8 +23,7 @@ public class SerializableItemList implements IItemList, INBTSerial private final ItemList parent = new ItemList(); - public SerializableItemList() { - } + public SerializableItemList() {} @Override public void addStorage(IAEItemStack stack) { @@ -104,5 +104,4 @@ public void deserializeNBT(NBTTagList list) { } } } - } diff --git a/src/main/java/gregtech/common/inventory/handlers/CycleItemStackHandler.java b/src/main/java/gregtech/common/inventory/handlers/CycleItemStackHandler.java index 0f6000d33f5..e8eb21d9e3f 100644 --- a/src/main/java/gregtech/common/inventory/handlers/CycleItemStackHandler.java +++ b/src/main/java/gregtech/common/inventory/handlers/CycleItemStackHandler.java @@ -1,6 +1,5 @@ package gregtech.common.inventory.handlers; - import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.items.ItemStackHandler; @@ -16,6 +15,7 @@ public CycleItemStackHandler(NonNullList stacks) { @Nonnull @Override public ItemStack getStackInSlot(int slot) { - return stacks.isEmpty() ? ItemStack.EMPTY : super.getStackInSlot(Math.abs((int)(System.currentTimeMillis() / 1000) % stacks.size())); + return stacks.isEmpty() ? ItemStack.EMPTY : + super.getStackInSlot(Math.abs((int) (System.currentTimeMillis() / 1000) % stacks.size())); } } diff --git a/src/main/java/gregtech/common/inventory/handlers/TapeItemStackHandler.java b/src/main/java/gregtech/common/inventory/handlers/TapeItemStackHandler.java index f0e61c9f01a..22a0569b87a 100644 --- a/src/main/java/gregtech/common/inventory/handlers/TapeItemStackHandler.java +++ b/src/main/java/gregtech/common/inventory/handlers/TapeItemStackHandler.java @@ -3,6 +3,7 @@ import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; diff --git a/src/main/java/gregtech/common/inventory/handlers/ToolItemStackHandler.java b/src/main/java/gregtech/common/inventory/handlers/ToolItemStackHandler.java index 8c327117af2..ab9191f8bfc 100644 --- a/src/main/java/gregtech/common/inventory/handlers/ToolItemStackHandler.java +++ b/src/main/java/gregtech/common/inventory/handlers/ToolItemStackHandler.java @@ -2,6 +2,7 @@ import gregtech.api.items.toolitem.IGTTool; import gregtech.api.unification.OreDictUnifier; + import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; @@ -16,7 +17,8 @@ public ToolItemStackHandler(int size) { @Nonnull public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { if (stack.getItem().getToolClasses(stack).isEmpty()) return stack; - if (stack.getItem() instanceof IGTTool && ((IGTTool) stack.getItem()).getToolStats().isSuitableForCrafting(stack)) { + if (stack.getItem() instanceof IGTTool && + ((IGTTool) stack.getItem()).getToolStats().isSuitableForCrafting(stack)) { return super.insertItem(slot, stack, simulate); } diff --git a/src/main/java/gregtech/common/inventory/itemsource/ItemSource.java b/src/main/java/gregtech/common/inventory/itemsource/ItemSource.java index facc0242cde..a45329c604c 100644 --- a/src/main/java/gregtech/common/inventory/itemsource/ItemSource.java +++ b/src/main/java/gregtech/common/inventory/itemsource/ItemSource.java @@ -1,8 +1,9 @@ package gregtech.common.inventory.itemsource; -import it.unimi.dsi.fastutil.objects.Object2IntMap; import net.minecraft.item.ItemStack; +import it.unimi.dsi.fastutil.objects.Object2IntMap; + public abstract class ItemSource { public abstract int getPriority(); diff --git a/src/main/java/gregtech/common/inventory/itemsource/ItemSources.java b/src/main/java/gregtech/common/inventory/itemsource/ItemSources.java index ff41f26a2f5..5c9d512059d 100644 --- a/src/main/java/gregtech/common/inventory/itemsource/ItemSources.java +++ b/src/main/java/gregtech/common/inventory/itemsource/ItemSources.java @@ -3,20 +3,24 @@ import gregtech.api.util.ItemStackHashStrategy; import gregtech.common.inventory.IItemInfo; import gregtech.common.inventory.IItemList; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenCustomHashMap; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import javax.annotation.Nullable; import java.util.*; +import javax.annotation.Nullable; + public class ItemSources implements IItemList { protected final World world; protected final List handlerInfoList = new ArrayList<>(); - protected final Map itemInfoMap = new Object2ObjectLinkedOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + protected final Map itemInfoMap = new Object2ObjectLinkedOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); private final Comparator comparator = Comparator.comparing(ItemSource::getPriority); private final Set storedItemsView = Collections.unmodifiableSet(itemInfoMap.keySet()); diff --git a/src/main/java/gregtech/common/inventory/itemsource/NetworkItemInfo.java b/src/main/java/gregtech/common/inventory/itemsource/NetworkItemInfo.java index f9f6323de83..ad60895347b 100644 --- a/src/main/java/gregtech/common/inventory/itemsource/NetworkItemInfo.java +++ b/src/main/java/gregtech/common/inventory/itemsource/NetworkItemInfo.java @@ -1,16 +1,20 @@ package gregtech.common.inventory.itemsource; import gregtech.common.inventory.IItemInfo; + +import net.minecraft.item.ItemStack; + import it.unimi.dsi.fastutil.objects.Object2IntAVLTreeMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; -import net.minecraft.item.ItemStack; import java.util.Comparator; + public class NetworkItemInfo implements IItemInfo { private final ItemStack itemStack; private int totalItemAmount = 0; - private final Object2IntMap inventories = new Object2IntAVLTreeMap<>(Comparator.comparingInt(ItemSource::getPriority)); + private final Object2IntMap inventories = new Object2IntAVLTreeMap<>( + Comparator.comparingInt(ItemSource::getPriority)); public NetworkItemInfo(ItemStack itemStack) { this.itemStack = itemStack; diff --git a/src/main/java/gregtech/common/inventory/itemsource/sources/InventoryItemSource.java b/src/main/java/gregtech/common/inventory/itemsource/sources/InventoryItemSource.java index 49639ed3535..fae123f74a6 100644 --- a/src/main/java/gregtech/common/inventory/itemsource/sources/InventoryItemSource.java +++ b/src/main/java/gregtech/common/inventory/itemsource/sources/InventoryItemSource.java @@ -2,20 +2,23 @@ import gregtech.api.util.ItemStackHashStrategy; import gregtech.common.inventory.itemsource.ItemSource; -import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntMaps; + import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.wrapper.EmptyHandler; +import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntMaps; + public class InventoryItemSource extends ItemSource { protected final World world; protected final int priority; protected IItemHandler itemHandler = EmptyHandler.INSTANCE; - private Object2IntMap itemStackByAmountMap = new Object2IntLinkedOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + private Object2IntMap itemStackByAmountMap = new Object2IntLinkedOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); public InventoryItemSource(World world, int priority) { this.world = world; @@ -27,8 +30,7 @@ public InventoryItemSource(World world, IItemHandler itemHandler1, int priority) this.itemHandler = itemHandler1; } - public void computeItemHandler() { - } + public void computeItemHandler() {} @Override public int getPriority() { @@ -91,7 +93,8 @@ public Object2IntMap getStoredItems() { } private void recomputeItemStackCount() { - Object2IntMap amountMap = new Object2IntLinkedOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + Object2IntMap amountMap = new Object2IntLinkedOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); if (itemHandler == null) { this.itemStackByAmountMap = amountMap; return; @@ -104,4 +107,3 @@ private void recomputeItemStackCount() { this.itemStackByAmountMap = amountMap; } } - diff --git a/src/main/java/gregtech/common/inventory/itemsource/sources/TileItemSource.java b/src/main/java/gregtech/common/inventory/itemsource/sources/TileItemSource.java index 01ba9db290b..987b815a5df 100644 --- a/src/main/java/gregtech/common/inventory/itemsource/sources/TileItemSource.java +++ b/src/main/java/gregtech/common/inventory/itemsource/sources/TileItemSource.java @@ -39,28 +39,28 @@ public BlockPos getAccessedBlockPos() { @Override public void computeItemHandler() { if (!world.isBlockLoaded(accessedBlockPos)) { - //we handle unloaded blocks as empty item handlers - //so when they are loaded, they are refreshed and handled correctly + // we handle unloaded blocks as empty item handlers + // so when they are loaded, they are refreshed and handled correctly itemHandler = EmptyHandler.INSTANCE; return; } - //use cached tile entity as long as it's valid and has same position (just in case of frames etc) + // use cached tile entity as long as it's valid and has same position (just in case of frames etc) TileEntity tileEntity = cachedTileEntity.get(); if (tileEntity == null || tileEntity.isInvalid() || !tileEntity.getPos().equals(accessedBlockPos)) { tileEntity = world.getTileEntity(accessedBlockPos); if (tileEntity == null) { - //if tile entity doesn't exist anymore, we are invalid now - //return null which will be handled as INVALID + // if tile entity doesn't exist anymore, we are invalid now + // return null which will be handled as INVALID itemHandler = null; return; } - //update cached tile entity + // update cached tile entity this.cachedTileEntity = new WeakReference<>(tileEntity); } - //fetch capability from tile entity - //if it returns null, item handler info will be removed - //block should emit block update once it obtains capability again, - //so handler info will be recreated accordingly + // fetch capability from tile entity + // if it returns null, item handler info will be removed + // block should emit block update once it obtains capability again, + // so handler info will be recreated accordingly itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, accessSide.getOpposite()); } diff --git a/src/main/java/gregtech/common/items/EnchantmentTableTweaks.java b/src/main/java/gregtech/common/items/EnchantmentTableTweaks.java index 134663f7cf4..e2c8cadd6b5 100644 --- a/src/main/java/gregtech/common/items/EnchantmentTableTweaks.java +++ b/src/main/java/gregtech/common/items/EnchantmentTableTweaks.java @@ -8,6 +8,7 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTLog; import gregtech.api.util.SlotDelegate; + import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerEnchantment; @@ -42,8 +43,8 @@ public static void onGuiOpen(GuiOpenEvent event) { private static void onContainerOpen(Container container) { if (container instanceof ContainerEnchantment) { - //wrap in try-catch because such kind of tweaks is subject to breaking - //don't let it crash game if some mod borked it + // wrap in try-catch because such kind of tweaks is subject to breaking + // don't let it crash game if some mod borked it try { int index = getEnchantmentSlotIndex((ContainerEnchantment) container); if (index != -1) { @@ -91,5 +92,4 @@ public boolean isItemValid(@Nonnull ItemStack stack) { return super.isItemValid(stack) || isValidForEnchantment(stack); } } - } diff --git a/src/main/java/gregtech/common/items/MetaItem1.java b/src/main/java/gregtech/common/items/MetaItem1.java index 7259f715d46..78650965336 100644 --- a/src/main/java/gregtech/common/items/MetaItem1.java +++ b/src/main/java/gregtech/common/items/MetaItem1.java @@ -29,6 +29,7 @@ import gregtech.common.items.behaviors.monitorplugin.OnlinePicPluginBehavior; import gregtech.common.items.behaviors.monitorplugin.TextPluginBehavior; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.client.resources.I18n; import net.minecraft.init.Items; import net.minecraft.init.MobEffects; @@ -60,51 +61,87 @@ public void registerSubItems() { CREDIT_NEUTRONIUM = addItem(7, "credit.neutronium").setRarity(EnumRarity.EPIC); COIN_GOLD_ANCIENT = addItem(8, "coin.gold.ancient") - .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Gold, M / 4))).setRarity(EnumRarity.RARE); + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Gold, M / 4))) + .setRarity(EnumRarity.RARE); COIN_DOGE = addItem(9, "coin.doge") - .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Brass, M / 4))).setRarity(EnumRarity.EPIC); + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Brass, M / 4))) + .setRarity(EnumRarity.EPIC); COIN_CHOCOLATE = addItem(10, "coin.chocolate") .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Gold, M / 4))) - .addComponents(new FoodStats(1, 0.1F, false, true, OreDictUnifier.get(OrePrefix.foil, Materials.Gold), new RandomPotionEffect(MobEffects.SPEED, 200, 1, 10))); + .addComponents(new FoodStats(1, 0.1F, false, true, OreDictUnifier.get(OrePrefix.foil, Materials.Gold), + new RandomPotionEffect(MobEffects.SPEED, 200, 1, 10))); // Solidifier Shapes: ID 11-30 - SHAPE_EMPTY = addItem(11, "shape.empty").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - - SHAPE_MOLDS[0] = SHAPE_MOLD_PLATE = addItem(12, "shape.mold.plate").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[1] = SHAPE_MOLD_GEAR = addItem(13, "shape.mold.gear").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[2] = SHAPE_MOLD_CREDIT = addItem(14, "shape.mold.credit").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[3] = SHAPE_MOLD_BOTTLE = addItem(15, "shape.mold.bottle").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[4] = SHAPE_MOLD_INGOT = addItem(16, "shape.mold.ingot").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[5] = SHAPE_MOLD_BALL = addItem(17, "shape.mold.ball").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[6] = SHAPE_MOLD_BLOCK = addItem(18, "shape.mold.block").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[7] = SHAPE_MOLD_NUGGET = addItem(19, "shape.mold.nugget").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[8] = SHAPE_MOLD_CYLINDER = addItem(20, "shape.mold.cylinder").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[9] = SHAPE_MOLD_ANVIL = addItem(21, "shape.mold.anvil").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[10] = SHAPE_MOLD_NAME = addItem(22, "shape.mold.name").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[11] = SHAPE_MOLD_GEAR_SMALL = addItem(23, "shape.mold.gear.small").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[12] = SHAPE_MOLD_ROTOR = addItem(24, "shape.mold.rotor").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EMPTY = addItem(11, "shape.empty") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + + SHAPE_MOLDS[0] = SHAPE_MOLD_PLATE = addItem(12, "shape.mold.plate") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[1] = SHAPE_MOLD_GEAR = addItem(13, "shape.mold.gear") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[2] = SHAPE_MOLD_CREDIT = addItem(14, "shape.mold.credit") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[3] = SHAPE_MOLD_BOTTLE = addItem(15, "shape.mold.bottle") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[4] = SHAPE_MOLD_INGOT = addItem(16, "shape.mold.ingot") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[5] = SHAPE_MOLD_BALL = addItem(17, "shape.mold.ball") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[6] = SHAPE_MOLD_BLOCK = addItem(18, "shape.mold.block") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[7] = SHAPE_MOLD_NUGGET = addItem(19, "shape.mold.nugget") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[8] = SHAPE_MOLD_CYLINDER = addItem(20, "shape.mold.cylinder") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[9] = SHAPE_MOLD_ANVIL = addItem(21, "shape.mold.anvil") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[10] = SHAPE_MOLD_NAME = addItem(22, "shape.mold.name") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[11] = SHAPE_MOLD_GEAR_SMALL = addItem(23, "shape.mold.gear.small") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[12] = SHAPE_MOLD_ROTOR = addItem(24, "shape.mold.rotor") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); // Extruder Shapes: ID 31-59 - SHAPE_EXTRUDERS[0] = SHAPE_EXTRUDER_PLATE = addItem(31, "shape.extruder.plate").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[1] = SHAPE_EXTRUDER_ROD = addItem(32, "shape.extruder.rod").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[2] = SHAPE_EXTRUDER_BOLT = addItem(33, "shape.extruder.bolt").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[3] = SHAPE_EXTRUDER_RING = addItem(34, "shape.extruder.ring").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[4] = SHAPE_EXTRUDER_CELL = addItem(35, "shape.extruder.cell").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[5] = SHAPE_EXTRUDER_INGOT = addItem(36, "shape.extruder.ingot").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[6] = SHAPE_EXTRUDER_WIRE = addItem(37, "shape.extruder.wire").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[7] = SHAPE_EXTRUDER_PIPE_TINY = addItem(38, "shape.extruder.pipe.tiny").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[8] = SHAPE_EXTRUDER_PIPE_SMALL = addItem(39, "shape.extruder.pipe.small").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[9] = SHAPE_EXTRUDER_PIPE_NORMAL = addItem(40, "shape.extruder.pipe.normal").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[10] = SHAPE_EXTRUDER_PIPE_LARGE = addItem(41, "shape.extruder.pipe.large").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[11] = SHAPE_EXTRUDER_PIPE_HUGE = addItem(42, "shape.extruder.pipe.huge").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[12] = SHAPE_EXTRUDER_BLOCK = addItem(43, "shape.extruder.block").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[0] = SHAPE_EXTRUDER_PLATE = addItem(31, "shape.extruder.plate") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[1] = SHAPE_EXTRUDER_ROD = addItem(32, "shape.extruder.rod") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[2] = SHAPE_EXTRUDER_BOLT = addItem(33, "shape.extruder.bolt") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[3] = SHAPE_EXTRUDER_RING = addItem(34, "shape.extruder.ring") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[4] = SHAPE_EXTRUDER_CELL = addItem(35, "shape.extruder.cell") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[5] = SHAPE_EXTRUDER_INGOT = addItem(36, "shape.extruder.ingot") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[6] = SHAPE_EXTRUDER_WIRE = addItem(37, "shape.extruder.wire") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[7] = SHAPE_EXTRUDER_PIPE_TINY = addItem(38, "shape.extruder.pipe.tiny") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[8] = SHAPE_EXTRUDER_PIPE_SMALL = addItem(39, "shape.extruder.pipe.small") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[9] = SHAPE_EXTRUDER_PIPE_NORMAL = addItem(40, "shape.extruder.pipe.normal") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[10] = SHAPE_EXTRUDER_PIPE_LARGE = addItem(41, "shape.extruder.pipe.large") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[11] = SHAPE_EXTRUDER_PIPE_HUGE = addItem(42, "shape.extruder.pipe.huge") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[12] = SHAPE_EXTRUDER_BLOCK = addItem(43, "shape.extruder.block") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); // Extruder Shapes index 13-20 (inclusive), id 44-51 (inclusive) are unused - SHAPE_EXTRUDERS[21] = SHAPE_EXTRUDER_GEAR = addItem(52, "shape.extruder.gear").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[22] = SHAPE_EXTRUDER_BOTTLE = addItem(53, "shape.extruder.bottle").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[23] = SHAPE_EXTRUDER_FOIL = addItem(54, "shape.extruder.foil").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[24] = SHAPE_EXTRUDER_GEAR_SMALL = addItem(55, "shape.extruder.gear_small").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[25] = SHAPE_EXTRUDER_ROD_LONG = addItem(56, "shape.extruder.rod_long").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[26] = SHAPE_EXTRUDER_ROTOR = addItem(57, "shape.extruder.rotor").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[21] = SHAPE_EXTRUDER_GEAR = addItem(52, "shape.extruder.gear") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[22] = SHAPE_EXTRUDER_BOTTLE = addItem(53, "shape.extruder.bottle") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[23] = SHAPE_EXTRUDER_FOIL = addItem(54, "shape.extruder.foil") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[24] = SHAPE_EXTRUDER_GEAR_SMALL = addItem(55, "shape.extruder.gear_small") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[25] = SHAPE_EXTRUDER_ROD_LONG = addItem(56, "shape.extruder.rod_long") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[26] = SHAPE_EXTRUDER_ROTOR = addItem(57, "shape.extruder.rotor") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); // Spray Cans: ID 60-77 SPRAY_EMPTY = addItem(61, "spray.empty"); @@ -123,41 +160,54 @@ public void registerSubItems() { // Fluid Cells: ID 78-88 FLUID_CELL = addItem(78, "fluid_cell") - .addComponents(new FilteredFluidStats(1000, 1800, true, false, false, false, false), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(1000, 1800, true, false, false, false, false), + new ItemFluidContainer()) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_UNIVERSAL = addItem(79, "fluid_cell.universal") - .addComponents(new FilteredFluidStats(1000, 1800, true, false, false, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(1000, 1800, true, false, false, false, true), + new ItemFluidContainer()) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_LARGE_STEEL = addItem(80, "large_fluid_cell.steel") - .addComponents(new FilteredFluidStats(8000, Materials.Steel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(8000, + Materials.Steel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, + false, false, true), new ItemFluidContainer()) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))) // ingot * 4 .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_LARGE_ALUMINIUM = addItem(81, "large_fluid_cell.aluminium") - .addComponents(new FilteredFluidStats(32000, Materials.Aluminium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(32000, + Materials.Aluminium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, + false, false, true), new ItemFluidContainer()) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Aluminium, M * 4))) // ingot * 4 .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_LARGE_STAINLESS_STEEL = addItem(82, "large_fluid_cell.stainless_steel") - .addComponents(new FilteredFluidStats(64000, Materials.StainlessSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, true, true, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(64000, + Materials.StainlessSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, + true, true, false, true), new ItemFluidContainer()) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.StainlessSteel, M * 6))) // ingot * 6 .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_LARGE_TITANIUM = addItem(83, "large_fluid_cell.titanium") - .addComponents(new FilteredFluidStats(128000, Materials.Titanium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(128000, + Materials.Titanium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, + false, false, true), new ItemFluidContainer()) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Titanium, M * 6))) // ingot * 6 .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_LARGE_TUNGSTEN_STEEL = addItem(84, "large_fluid_cell.tungstensteel") - .addComponents(new FilteredFluidStats(512000, Materials.TungstenSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(512000, + Materials.TungstenSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, + false, false, false, true), new ItemFluidContainer()) .setMaxStackSize(32) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.TungstenSteel, M * 8))) // ingot * 8 .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_GLASS_VIAL = addItem(85, "fluid_cell.glass_vial") - .addComponents(new FilteredFluidStats(1000, 1200, false, true, false, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(1000, 1200, false, true, false, false, true), + new ItemFluidContainer()) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Glass, M / 4))) // small dust .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); @@ -184,18 +234,29 @@ public void registerSubItems() { .setRarity(EnumRarity.UNCOMMON) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BOTTLE_PURPLE_DRINK = addItem(93, "bottle.purple.drink").addComponents(new FoodStats(8, 0.2F, true, true, new ItemStack(Items.GLASS_BOTTLE), new RandomPotionEffect(MobEffects.HASTE, 800, 1, 90))); + BOTTLE_PURPLE_DRINK = addItem(93, "bottle.purple.drink").addComponents(new FoodStats(8, 0.2F, true, true, + new ItemStack(Items.GLASS_BOTTLE), new RandomPotionEffect(MobEffects.HASTE, 800, 1, 90))); // Voltage Coils: ID 96-110 - VOLTAGE_COIL_ULV = addItem(96, "voltage_coil.ulv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Lead, M * 2), new MaterialStack(Materials.IronMagnetic, M / 2))); - VOLTAGE_COIL_LV = addItem(97, "voltage_coil.lv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 2), new MaterialStack(Materials.IronMagnetic, M / 2))); - VOLTAGE_COIL_MV = addItem(98, "voltage_coil.mv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Aluminium, M * 2), new MaterialStack(Materials.SteelMagnetic, M / 2))); - VOLTAGE_COIL_HV = addItem(99, "voltage_coil.hv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BlackSteel, M * 2), new MaterialStack(Materials.SteelMagnetic, M / 2))); - VOLTAGE_COIL_EV = addItem(100, "voltage_coil.ev").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.TungstenSteel, M * 2), new MaterialStack(Materials.NeodymiumMagnetic, M / 2))); - VOLTAGE_COIL_IV = addItem(101, "voltage_coil.iv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Iridium, M * 2), new MaterialStack(Materials.NeodymiumMagnetic, M / 2))); - VOLTAGE_COIL_LuV = addItem(102, "voltage_coil.luv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Osmiridium, M * 2), new MaterialStack(Materials.SamariumMagnetic, M / 2))); - VOLTAGE_COIL_ZPM = addItem(103, "voltage_coil.zpm").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Europium, M * 2), new MaterialStack(Materials.SamariumMagnetic, M / 2))); - VOLTAGE_COIL_UV = addItem(104, "voltage_coil.uv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Tritanium, M * 2), new MaterialStack(Materials.SamariumMagnetic, M / 2))); + VOLTAGE_COIL_ULV = addItem(96, "voltage_coil.ulv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Lead, M * 2), new MaterialStack(Materials.IronMagnetic, M / 2))); + VOLTAGE_COIL_LV = addItem(97, "voltage_coil.lv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Steel, M * 2), new MaterialStack(Materials.IronMagnetic, M / 2))); + VOLTAGE_COIL_MV = addItem(98, "voltage_coil.mv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Aluminium, M * 2), new MaterialStack(Materials.SteelMagnetic, M / 2))); + VOLTAGE_COIL_HV = addItem(99, "voltage_coil.hv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.BlackSteel, M * 2), new MaterialStack(Materials.SteelMagnetic, M / 2))); + VOLTAGE_COIL_EV = addItem(100, "voltage_coil.ev") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.TungstenSteel, M * 2), + new MaterialStack(Materials.NeodymiumMagnetic, M / 2))); + VOLTAGE_COIL_IV = addItem(101, "voltage_coil.iv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Iridium, M * 2), new MaterialStack(Materials.NeodymiumMagnetic, M / 2))); + VOLTAGE_COIL_LuV = addItem(102, "voltage_coil.luv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Osmiridium, M * 2), new MaterialStack(Materials.SamariumMagnetic, M / 2))); + VOLTAGE_COIL_ZPM = addItem(103, "voltage_coil.zpm").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Europium, M * 2), new MaterialStack(Materials.SamariumMagnetic, M / 2))); + VOLTAGE_COIL_UV = addItem(104, "voltage_coil.uv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Tritanium, M * 2), new MaterialStack(Materials.SamariumMagnetic, M / 2))); // ???: ID 111-125 @@ -477,12 +538,16 @@ public void registerSubItems() { // Special Machine Components: ID 266-280 COMPONENT_GRINDER_DIAMOND = addItem(266, "component.grinder.diamond") - .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 8), new MaterialStack(Materials.Diamond, M * 5))); + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 8), + new MaterialStack(Materials.Diamond, M * 5))); COMPONENT_GRINDER_TUNGSTEN = addItem(267, "component.grinder.tungsten") - .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Tungsten, M * 4), new MaterialStack(Materials.VanadiumSteel, M * 8), new MaterialStack(Materials.Diamond, M))); + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Tungsten, M * 4), + new MaterialStack(Materials.VanadiumSteel, M * 8), new MaterialStack(Materials.Diamond, M))); - IRON_MINECART_WHEELS = addItem(268, "minecart_wheels.iron").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Iron, M))); - STEEL_MINECART_WHEELS = addItem(269, "minecart_wheels.steel").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M))); + IRON_MINECART_WHEELS = addItem(268, "minecart_wheels.iron") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Iron, M))); + STEEL_MINECART_WHEELS = addItem(269, "minecart_wheels.steel") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M))); // Special Eyes/Stars: ID 281-289 QUANTUM_EYE = addItem(281, "quantumeye"); @@ -493,7 +558,8 @@ public void registerSubItems() { FLUID_FILTER = addItem(290, "fluid_filter") .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Zinc, M * 2))); ITEM_FILTER = addItem(291, "item_filter") - .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Zinc, M * 2), new MaterialStack(Materials.Steel, M))); + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Zinc, M * 2), + new MaterialStack(Materials.Steel, M))); ORE_DICTIONARY_FILTER = addItem(292, "ore_dictionary_filter") .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Zinc, M * 2))); SMART_FILTER = addItem(293, "smart_item_filter") @@ -537,47 +603,56 @@ public void registerSubItems() { COVER_SOLAR_PANEL_ULV = addItem(332, "cover.solar.panel.ulv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.ULV], GTValues.VNF[GTValues.ULV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.ULV], + GTValues.VNF[GTValues.ULV])); })); COVER_SOLAR_PANEL_LV = addItem(333, "cover.solar.panel.lv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.LV], GTValues.VNF[GTValues.LV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.LV], + GTValues.VNF[GTValues.LV])); })); COVER_SOLAR_PANEL_MV = addItem(334, "cover.solar.panel.mv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.MV], GTValues.VNF[GTValues.MV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.MV], + GTValues.VNF[GTValues.MV])); })); COVER_SOLAR_PANEL_HV = addItem(335, "cover.solar.panel.hv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.HV], GTValues.VNF[GTValues.HV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.HV], + GTValues.VNF[GTValues.HV])); })); COVER_SOLAR_PANEL_EV = addItem(336, "cover.solar.panel.ev").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.EV], GTValues.VNF[GTValues.EV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.EV], + GTValues.VNF[GTValues.EV])); })); COVER_SOLAR_PANEL_IV = addItem(337, "cover.solar.panel.iv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.IV], GTValues.VNF[GTValues.IV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.IV], + GTValues.VNF[GTValues.IV])); })); COVER_SOLAR_PANEL_LUV = addItem(338, "cover.solar.panel.luv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.LuV], GTValues.VNF[GTValues.LuV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.LuV], + GTValues.VNF[GTValues.LuV])); })); COVER_SOLAR_PANEL_ZPM = addItem(339, "cover.solar.panel.zpm").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.ZPM], GTValues.VNF[GTValues.ZPM])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.ZPM], + GTValues.VNF[GTValues.ZPM])); })); COVER_SOLAR_PANEL_UV = addItem(340, "cover.solar.panel.uv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.UV], GTValues.VNF[GTValues.UV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.UV], + GTValues.VNF[GTValues.UV])); })); // MAX-tier solar panel? @@ -592,11 +667,16 @@ public void registerSubItems() { IItemContainerItemProvider selfContainerItemProvider = itemStack -> itemStack; WOODEN_FORM_EMPTY = addItem(347, "wooden_form.empty"); WOODEN_FORM_BRICK = addItem(348, "wooden_form.brick").addComponents(selfContainerItemProvider); - COMPRESSED_CLAY = addItem(349, "compressed.clay").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Clay, M))); - COMPRESSED_COKE_CLAY = addItem(350, "compressed.coke_clay").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Clay, M))); - COMPRESSED_FIRECLAY = addItem(351, "compressed.fireclay").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M))); - FIRECLAY_BRICK = addItem(352, "brick.fireclay").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M))); - COKE_OVEN_BRICK = addItem(353, "brick.coke").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Clay, M))); + COMPRESSED_CLAY = addItem(349, "compressed.clay") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Clay, M))); + COMPRESSED_COKE_CLAY = addItem(350, "compressed.coke_clay") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Clay, M))); + COMPRESSED_FIRECLAY = addItem(351, "compressed.fireclay") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M))); + FIRECLAY_BRICK = addItem(352, "brick.fireclay") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M))); + COKE_OVEN_BRICK = addItem(353, "brick.coke") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Clay, M))); if (!ConfigHolder.recipes.harderBrickRecipes) COMPRESSED_CLAY.setInvisible(); @@ -643,17 +723,23 @@ public void registerSubItems() { BIO_CHAFF = addItem(440, "bio_chaff").setBurnValue(200); // Power Units: ID 446-459 - POWER_UNIT_LV = addItem(446, "power_unit.lv").addComponents(ElectricStats.createElectricItem(100000L, GTValues.LV)).setMaxStackSize(8); - POWER_UNIT_MV = addItem(447, "power_unit.mv").addComponents(ElectricStats.createElectricItem(400000L, GTValues.MV)).setMaxStackSize(8); - POWER_UNIT_HV = addItem(448, "power_unit.hv").addComponents(ElectricStats.createElectricItem(1600000L, GTValues.HV)).setMaxStackSize(8); - POWER_UNIT_EV = addItem(449, "power_unit.ev").addComponents(ElectricStats.createElectricItem(6400000L, GTValues.EV)).setMaxStackSize(8); - POWER_UNIT_IV = addItem(450, "power_unit.iv").addComponents(ElectricStats.createElectricItem(25600000L, GTValues.IV)).setMaxStackSize(8); + POWER_UNIT_LV = addItem(446, "power_unit.lv") + .addComponents(ElectricStats.createElectricItem(100000L, GTValues.LV)).setMaxStackSize(8); + POWER_UNIT_MV = addItem(447, "power_unit.mv") + .addComponents(ElectricStats.createElectricItem(400000L, GTValues.MV)).setMaxStackSize(8); + POWER_UNIT_HV = addItem(448, "power_unit.hv") + .addComponents(ElectricStats.createElectricItem(1600000L, GTValues.HV)).setMaxStackSize(8); + POWER_UNIT_EV = addItem(449, "power_unit.ev") + .addComponents(ElectricStats.createElectricItem(6400000L, GTValues.EV)).setMaxStackSize(8); + POWER_UNIT_IV = addItem(450, "power_unit.iv") + .addComponents(ElectricStats.createElectricItem(25600000L, GTValues.IV)).setMaxStackSize(8); // Usable Items: ID 460-490 DYNAMITE = addItem(460, "dynamite") .addComponents(new DynamiteBehaviour()) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - INTEGRATED_CIRCUIT = addItem(461, "circuit.integrated").addComponents(new IntCircuitBehaviour()).setModelAmount(33); + INTEGRATED_CIRCUIT = addItem(461, "circuit.integrated").addComponents(new IntCircuitBehaviour()) + .setModelAmount(33); FOAM_SPRAYER = addItem(462, "foam_sprayer").addComponents(new FoamSprayerBehavior()) .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); @@ -662,7 +748,8 @@ public void registerSubItems() { .addComponents(new NanoSaberBehavior()) .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - NANO_SABER.getMetaItem().addPropertyOverride(NanoSaberBehavior.OVERRIDE_KEY_LOCATION, (stack, worldIn, entityIn) -> NanoSaberBehavior.isItemActive(stack) ? 1.0f : 0.0f); + NANO_SABER.getMetaItem().addPropertyOverride(NanoSaberBehavior.OVERRIDE_KEY_LOCATION, + (stack, worldIn, entityIn) -> NanoSaberBehavior.isItemActive(stack) ? 1.0f : 0.0f); CLIPBOARD = addItem(464, "clipboard") .addComponents(new ClipboardBehavior()) @@ -673,15 +760,18 @@ public void registerSubItems() { .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); PROSPECTOR_LV = addItem(466, "prospector.lv") - .addComponents(ElectricStats.createElectricItem(100_000L, GTValues.LV), new ProspectorScannerBehavior(2, GTValues.LV)) + .addComponents(ElectricStats.createElectricItem(100_000L, GTValues.LV), + new ProspectorScannerBehavior(2, GTValues.LV)) .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); PROSPECTOR_HV = addItem(467, "prospector.hv") - .addComponents(ElectricStats.createElectricItem(1_600_000L, GTValues.HV), new ProspectorScannerBehavior(3, GTValues.HV)) + .addComponents(ElectricStats.createElectricItem(1_600_000L, GTValues.HV), + new ProspectorScannerBehavior(3, GTValues.HV)) .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); PROSPECTOR_LUV = addItem(468, "prospector.luv") - .addComponents(ElectricStats.createElectricItem(1_000_000_000L, GTValues.LuV), new ProspectorScannerBehavior(5, GTValues.LuV)) + .addComponents(ElectricStats.createElectricItem(1_000_000_000L, GTValues.LuV), + new ProspectorScannerBehavior(5, GTValues.LuV)) .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); TRICORDER_SCANNER = addItem(469, "tricorder_scanner") @@ -701,15 +791,20 @@ public void registerSubItems() { .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - RUBBER_WOOD_BOAT = addItem(473, "rubber_wood_boat").addComponents(new GTBoatBehavior(GTBoatType.RUBBER_WOOD_BOAT)).setMaxStackSize(1).setBurnValue(400); - TREATED_WOOD_BOAT = addItem(474, "treated_wood_boat").addComponents(new GTBoatBehavior(GTBoatType.TREATED_WOOD_BOAT)).setMaxStackSize(1).setBurnValue(400); - RUBBER_WOOD_DOOR = addItem(475, "rubber_wood_door").addComponents(new DoorBehavior(MetaBlocks.RUBBER_WOOD_DOOR)).setBurnValue(200).setCreativeTabs(GregTechAPI.TAB_GREGTECH_DECORATIONS); - TREATED_WOOD_DOOR = addItem(476, "treated_wood_door").addComponents(new DoorBehavior(MetaBlocks.TREATED_WOOD_DOOR)).setBurnValue(200).setCreativeTabs(GregTechAPI.TAB_GREGTECH_DECORATIONS); + RUBBER_WOOD_BOAT = addItem(473, "rubber_wood_boat") + .addComponents(new GTBoatBehavior(GTBoatType.RUBBER_WOOD_BOAT)).setMaxStackSize(1).setBurnValue(400); + TREATED_WOOD_BOAT = addItem(474, "treated_wood_boat") + .addComponents(new GTBoatBehavior(GTBoatType.TREATED_WOOD_BOAT)).setMaxStackSize(1).setBurnValue(400); + RUBBER_WOOD_DOOR = addItem(475, "rubber_wood_door").addComponents(new DoorBehavior(MetaBlocks.RUBBER_WOOD_DOOR)) + .setBurnValue(200).setCreativeTabs(GregTechAPI.TAB_GREGTECH_DECORATIONS); + TREATED_WOOD_DOOR = addItem(476, "treated_wood_door") + .addComponents(new DoorBehavior(MetaBlocks.TREATED_WOOD_DOOR)).setBurnValue(200) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_DECORATIONS); // Misc Crafting Items: ID 491-515 ENERGIUM_DUST = addItem(491, "energium_dust"); ENGRAVED_LAPOTRON_CHIP = addItem(492, "engraved.lapotron_chip"); - //Free ID: 493, 494, 495, 496 + // Free ID: 493, 494, 495, 496 NEUTRON_REFLECTOR = addItem(497, "neutron_reflector"); GELLED_TOLUENE = addItem(498, "gelled_toluene"); CARBON_FIBERS = addItem(499, "carbon.fibers"); @@ -728,11 +823,15 @@ public void registerSubItems() { CAPACITOR = addItem(520, "component.capacitor").setUnificationData(OrePrefix.component, Component.Capacitor); DIODE = addItem(521, "component.diode").setUnificationData(OrePrefix.component, Component.Diode); INDUCTOR = addItem(522, "component.inductor").setUnificationData(OrePrefix.component, Component.Inductor); - SMD_TRANSISTOR = addItem(523, "component.smd.transistor").setUnificationData(OrePrefix.component, Component.Transistor); - SMD_RESISTOR = addItem(524, "component.smd.resistor").setUnificationData(OrePrefix.component, Component.Resistor); - SMD_CAPACITOR = addItem(525, "component.smd.capacitor").setUnificationData(OrePrefix.component, Component.Capacitor); + SMD_TRANSISTOR = addItem(523, "component.smd.transistor").setUnificationData(OrePrefix.component, + Component.Transistor); + SMD_RESISTOR = addItem(524, "component.smd.resistor").setUnificationData(OrePrefix.component, + Component.Resistor); + SMD_CAPACITOR = addItem(525, "component.smd.capacitor").setUnificationData(OrePrefix.component, + Component.Capacitor); SMD_DIODE = addItem(526, "component.smd.diode").setUnificationData(OrePrefix.component, Component.Diode); - SMD_INDUCTOR = addItem(527, "component.smd.inductor").setUnificationData(OrePrefix.component, Component.Inductor); + SMD_INDUCTOR = addItem(527, "component.smd.inductor").setUnificationData(OrePrefix.component, + Component.Inductor); ADVANCED_SMD_TRANSISTOR = addItem(528, "component.advanced_smd.transistor"); ADVANCED_SMD_RESISTOR = addItem(529, "component.advanced_smd.resistor"); ADVANCED_SMD_CAPACITOR = addItem(530, "component.advanced_smd.capacitor"); @@ -786,7 +885,8 @@ public void registerSubItems() { // T2: Integrated INTEGRATED_CIRCUIT_LV = addItem(623, "circuit.basic_integrated").setUnificationData(OrePrefix.circuit, Tier.LV); INTEGRATED_CIRCUIT_MV = addItem(624, "circuit.good_integrated").setUnificationData(OrePrefix.circuit, Tier.MV); - INTEGRATED_CIRCUIT_HV = addItem(625, "circuit.advanced_integrated").setUnificationData(OrePrefix.circuit, Tier.HV); + INTEGRATED_CIRCUIT_HV = addItem(625, "circuit.advanced_integrated").setUnificationData(OrePrefix.circuit, + Tier.HV); // Misc Unlocks NAND_CHIP_ULV = addItem(626, "circuit.nand_chip").setUnificationData(OrePrefix.circuit, Tier.ULV); @@ -800,7 +900,8 @@ public void registerSubItems() { // T4: Nano NANO_PROCESSOR_HV = addItem(632, "circuit.nano_processor").setUnificationData(OrePrefix.circuit, Tier.HV); - NANO_PROCESSOR_ASSEMBLY_EV = addItem(633, "circuit.nano_assembly").setUnificationData(OrePrefix.circuit, Tier.EV); + NANO_PROCESSOR_ASSEMBLY_EV = addItem(633, "circuit.nano_assembly").setUnificationData(OrePrefix.circuit, + Tier.EV); NANO_COMPUTER_IV = addItem(634, "circuit.nano_computer").setUnificationData(OrePrefix.circuit, Tier.IV); NANO_MAINFRAME_LUV = addItem(635, "circuit.nano_mainframe").setUnificationData(OrePrefix.circuit, Tier.LuV); @@ -808,7 +909,8 @@ public void registerSubItems() { QUANTUM_PROCESSOR_EV = addItem(636, "circuit.quantum_processor").setUnificationData(OrePrefix.circuit, Tier.EV); QUANTUM_ASSEMBLY_IV = addItem(637, "circuit.quantum_assembly").setUnificationData(OrePrefix.circuit, Tier.IV); QUANTUM_COMPUTER_LUV = addItem(638, "circuit.quantum_computer").setUnificationData(OrePrefix.circuit, Tier.LuV); - QUANTUM_MAINFRAME_ZPM = addItem(639, "circuit.quantum_mainframe").setUnificationData(OrePrefix.circuit, Tier.ZPM); + QUANTUM_MAINFRAME_ZPM = addItem(639, "circuit.quantum_mainframe").setUnificationData(OrePrefix.circuit, + Tier.ZPM); // T6: Crystal CRYSTAL_PROCESSOR_IV = addItem(640, "circuit.crystal_processor").setUnificationData(OrePrefix.circuit, Tier.IV); @@ -817,10 +919,14 @@ public void registerSubItems() { CRYSTAL_MAINFRAME_UV = addItem(643, "circuit.crystal_mainframe").setUnificationData(OrePrefix.circuit, Tier.UV); // T7: Wetware - WETWARE_PROCESSOR_LUV = addItem(644, "circuit.wetware_processor").setUnificationData(OrePrefix.circuit, Tier.LuV); - WETWARE_PROCESSOR_ASSEMBLY_ZPM = addItem(645, "circuit.wetware_assembly").setUnificationData(OrePrefix.circuit, Tier.ZPM); - WETWARE_SUPER_COMPUTER_UV = addItem(646, "circuit.wetware_computer").setUnificationData(OrePrefix.circuit, Tier.UV); - WETWARE_MAINFRAME_UHV = addItem(647, "circuit.wetware_mainframe").setUnificationData(OrePrefix.circuit, Tier.UHV); + WETWARE_PROCESSOR_LUV = addItem(644, "circuit.wetware_processor").setUnificationData(OrePrefix.circuit, + Tier.LuV); + WETWARE_PROCESSOR_ASSEMBLY_ZPM = addItem(645, "circuit.wetware_assembly").setUnificationData(OrePrefix.circuit, + Tier.ZPM); + WETWARE_SUPER_COMPUTER_UV = addItem(646, "circuit.wetware_computer").setUnificationData(OrePrefix.circuit, + Tier.UV); + WETWARE_MAINFRAME_UHV = addItem(647, "circuit.wetware_mainframe").setUnificationData(OrePrefix.circuit, + Tier.UHV); // T8: Bioware @@ -850,61 +956,140 @@ public void registerSubItems() { TURBINE_ROTOR = addItem(711, "turbine_rotor").addComponents(new TurbineRotorBehavior()); // Battery Hulls: ID 716-730 - BATTERY_HULL_LV = addItem(717, "battery.hull.lv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BatteryAlloy, M))); // plate - BATTERY_HULL_MV = addItem(718, "battery.hull.mv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BatteryAlloy, M * 3))); // plate * 3 - BATTERY_HULL_HV = addItem(719, "battery.hull.hv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BatteryAlloy, M * 9))); // plate * 9 - BATTERY_HULL_SMALL_VANADIUM = addItem(720, "battery.hull.ev").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BlueSteel, M * 2))); - BATTERY_HULL_MEDIUM_VANADIUM = addItem(721, "battery.hull.iv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.RoseGold, M * 6))); - BATTERY_HULL_LARGE_VANADIUM = addItem(722, "battery.hull.luv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.RedSteel, M * 18))); - BATTERY_HULL_MEDIUM_NAQUADRIA = addItem(723, "battery.hull.zpm").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Europium, M * 6))); - BATTERY_HULL_LARGE_NAQUADRIA = addItem(724, "battery.hull.uv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Americium, M * 18))); + BATTERY_HULL_LV = addItem(717, "battery.hull.lv") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BatteryAlloy, M))); // plate + BATTERY_HULL_MV = addItem(718, "battery.hull.mv") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BatteryAlloy, M * 3))); // plate * 3 + BATTERY_HULL_HV = addItem(719, "battery.hull.hv") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BatteryAlloy, M * 9))); // plate * 9 + BATTERY_HULL_SMALL_VANADIUM = addItem(720, "battery.hull.ev") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BlueSteel, M * 2))); + BATTERY_HULL_MEDIUM_VANADIUM = addItem(721, "battery.hull.iv") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.RoseGold, M * 6))); + BATTERY_HULL_LARGE_VANADIUM = addItem(722, "battery.hull.luv") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.RedSteel, M * 18))); + BATTERY_HULL_MEDIUM_NAQUADRIA = addItem(723, "battery.hull.zpm") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Europium, M * 6))); + BATTERY_HULL_LARGE_NAQUADRIA = addItem(724, "battery.hull.uv") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Americium, M * 18))); // Batteries: 731-775 - BATTERY_ULV_TANTALUM = addItem(731, "battery.re.ulv.tantalum").addComponents(ElectricStats.createRechargeableBattery(1000, GTValues.ULV)).setUnificationData(OrePrefix.battery, Tier.ULV).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_ULV_TANTALUM = addItem(731, "battery.re.ulv.tantalum") + .addComponents(ElectricStats.createRechargeableBattery(1000, GTValues.ULV)) + .setUnificationData(OrePrefix.battery, Tier.ULV).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_LV_SODIUM = addItem(732, "battery.re.lv.sodium").addComponents(ElectricStats.createRechargeableBattery(80000, GTValues.LV)).setUnificationData(OrePrefix.battery, Tier.LV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_MV_SODIUM = addItem(733, "battery.re.mv.sodium").addComponents(ElectricStats.createRechargeableBattery(360000, GTValues.MV)).setUnificationData(OrePrefix.battery, Tier.MV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_HV_SODIUM = addItem(734, "battery.re.hv.sodium").addComponents(ElectricStats.createRechargeableBattery(1200000, GTValues.HV)).setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_LV_SODIUM = addItem(732, "battery.re.lv.sodium") + .addComponents(ElectricStats.createRechargeableBattery(80000, GTValues.LV)) + .setUnificationData(OrePrefix.battery, Tier.LV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_MV_SODIUM = addItem(733, "battery.re.mv.sodium") + .addComponents(ElectricStats.createRechargeableBattery(360000, GTValues.MV)) + .setUnificationData(OrePrefix.battery, Tier.MV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_HV_SODIUM = addItem(734, "battery.re.hv.sodium") + .addComponents(ElectricStats.createRechargeableBattery(1200000, GTValues.HV)) + .setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_LV_LITHIUM = addItem(735, "battery.re.lv.lithium").addComponents(ElectricStats.createRechargeableBattery(120000, GTValues.LV)).setUnificationData(OrePrefix.battery, Tier.LV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_MV_LITHIUM = addItem(736, "battery.re.mv.lithium").addComponents(ElectricStats.createRechargeableBattery(420000, GTValues.MV)).setUnificationData(OrePrefix.battery, Tier.MV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_HV_LITHIUM = addItem(737, "battery.re.hv.lithium").addComponents(ElectricStats.createRechargeableBattery(1800000, GTValues.HV)).setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_LV_LITHIUM = addItem(735, "battery.re.lv.lithium") + .addComponents(ElectricStats.createRechargeableBattery(120000, GTValues.LV)) + .setUnificationData(OrePrefix.battery, Tier.LV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_MV_LITHIUM = addItem(736, "battery.re.mv.lithium") + .addComponents(ElectricStats.createRechargeableBattery(420000, GTValues.MV)) + .setUnificationData(OrePrefix.battery, Tier.MV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_HV_LITHIUM = addItem(737, "battery.re.hv.lithium") + .addComponents(ElectricStats.createRechargeableBattery(1800000, GTValues.HV)) + .setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_LV_CADMIUM = addItem(738, "battery.re.lv.cadmium").addComponents(ElectricStats.createRechargeableBattery(100000, GTValues.LV)).setUnificationData(OrePrefix.battery, Tier.LV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_MV_CADMIUM = addItem(739, "battery.re.mv.cadmium").addComponents(ElectricStats.createRechargeableBattery(400000, GTValues.MV)).setUnificationData(OrePrefix.battery, Tier.MV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_HV_CADMIUM = addItem(740, "battery.re.hv.cadmium").addComponents(ElectricStats.createRechargeableBattery(1600000, GTValues.HV)).setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_LV_CADMIUM = addItem(738, "battery.re.lv.cadmium") + .addComponents(ElectricStats.createRechargeableBattery(100000, GTValues.LV)) + .setUnificationData(OrePrefix.battery, Tier.LV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_MV_CADMIUM = addItem(739, "battery.re.mv.cadmium") + .addComponents(ElectricStats.createRechargeableBattery(400000, GTValues.MV)) + .setUnificationData(OrePrefix.battery, Tier.MV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_HV_CADMIUM = addItem(740, "battery.re.hv.cadmium") + .addComponents(ElectricStats.createRechargeableBattery(1600000, GTValues.HV)) + .setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ENERGIUM_CRYSTAL = addItem(741, "energy_crystal").addComponents(ElectricStats.createRechargeableBattery(6_400_000L, GTValues.HV)).setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - LAPOTRON_CRYSTAL = addItem(742, "lapotron_crystal").addComponents(ElectricStats.createRechargeableBattery(25_000_000L, GTValues.EV)).setUnificationData(OrePrefix.battery, Tier.EV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ENERGIUM_CRYSTAL = addItem(741, "energy_crystal") + .addComponents(ElectricStats.createRechargeableBattery(6_400_000L, GTValues.HV)) + .setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + LAPOTRON_CRYSTAL = addItem(742, "lapotron_crystal") + .addComponents(ElectricStats.createRechargeableBattery(25_000_000L, GTValues.EV)) + .setUnificationData(OrePrefix.battery, Tier.EV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_EV_VANADIUM = addItem(743, "battery.ev.vanadium").addComponents(ElectricStats.createRechargeableBattery(10_240_000L, GTValues.EV)).setUnificationData(OrePrefix.battery, Tier.EV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_IV_VANADIUM = addItem(744, "battery.iv.vanadium").addComponents(ElectricStats.createRechargeableBattery(40_960_000L, GTValues.IV)).setUnificationData(OrePrefix.battery, Tier.IV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_LUV_VANADIUM = addItem(745, "battery.luv.vanadium").addComponents(ElectricStats.createRechargeableBattery(163_840_000L, GTValues.LuV)).setUnificationData(OrePrefix.battery, Tier.LuV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_EV_VANADIUM = addItem(743, "battery.ev.vanadium") + .addComponents(ElectricStats.createRechargeableBattery(10_240_000L, GTValues.EV)) + .setUnificationData(OrePrefix.battery, Tier.EV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_IV_VANADIUM = addItem(744, "battery.iv.vanadium") + .addComponents(ElectricStats.createRechargeableBattery(40_960_000L, GTValues.IV)) + .setUnificationData(OrePrefix.battery, Tier.IV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_LUV_VANADIUM = addItem(745, "battery.luv.vanadium") + .addComponents(ElectricStats.createRechargeableBattery(163_840_000L, GTValues.LuV)) + .setUnificationData(OrePrefix.battery, Tier.LuV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_ZPM_NAQUADRIA = addItem(746, "battery.zpm.naquadria").addComponents(ElectricStats.createRechargeableBattery(655_360_000L, GTValues.ZPM)).setUnificationData(OrePrefix.battery, Tier.ZPM).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_UV_NAQUADRIA = addItem(747, "battery.uv.naquadria").addComponents(ElectricStats.createRechargeableBattery(2_621_440_000L, GTValues.UV)).setUnificationData(OrePrefix.battery, Tier.UV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_ZPM_NAQUADRIA = addItem(746, "battery.zpm.naquadria") + .addComponents(ElectricStats.createRechargeableBattery(655_360_000L, GTValues.ZPM)) + .setUnificationData(OrePrefix.battery, Tier.ZPM).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_UV_NAQUADRIA = addItem(747, "battery.uv.naquadria") + .addComponents(ElectricStats.createRechargeableBattery(2_621_440_000L, GTValues.UV)) + .setUnificationData(OrePrefix.battery, Tier.UV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ENERGY_LAPOTRONIC_ORB = addItem(748, "energy.lapotronic_orb").addComponents(ElectricStats.createRechargeableBattery(250_000_000L, GTValues.IV)).setUnificationData(OrePrefix.battery, Tier.IV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ENERGY_LAPOTRONIC_ORB_CLUSTER = addItem(749, "energy.lapotronic_orb_cluster").addComponents(ElectricStats.createRechargeableBattery(1_000_000_000L, GTValues.LuV)).setUnificationData(OrePrefix.battery, Tier.LuV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ENERGY_LAPOTRONIC_ORB = addItem(748, "energy.lapotronic_orb") + .addComponents(ElectricStats.createRechargeableBattery(250_000_000L, GTValues.IV)) + .setUnificationData(OrePrefix.battery, Tier.IV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ENERGY_LAPOTRONIC_ORB_CLUSTER = addItem(749, "energy.lapotronic_orb_cluster") + .addComponents(ElectricStats.createRechargeableBattery(1_000_000_000L, GTValues.LuV)) + .setUnificationData(OrePrefix.battery, Tier.LuV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ENERGY_MODULE = addItem(750, "energy.module").addComponents(new IItemComponent[]{ElectricStats.createRechargeableBattery(4_000_000_000L, GTValues.ZPM)}).setUnificationData(OrePrefix.battery, Tier.ZPM).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ENERGY_CLUSTER = addItem(751, "energy.cluster").addComponents(new IItemComponent[]{ElectricStats.createRechargeableBattery(20_000_000_000L, GTValues.UV)}).setUnificationData(OrePrefix.battery, Tier.UV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ENERGY_MODULE = addItem(750, "energy.module") + .addComponents( + new IItemComponent[] { ElectricStats.createRechargeableBattery(4_000_000_000L, GTValues.ZPM) }) + .setUnificationData(OrePrefix.battery, Tier.ZPM).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ENERGY_CLUSTER = addItem(751, "energy.cluster") + .addComponents( + new IItemComponent[] { ElectricStats.createRechargeableBattery(20_000_000_000L, GTValues.UV) }) + .setUnificationData(OrePrefix.battery, Tier.UV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ZERO_POINT_MODULE = addItem(752, "zpm").addComponents(ElectricStats.createBattery(2000000000000L, GTValues.ZPM, true)).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ULTIMATE_BATTERY = addItem(753, "max.battery").addComponents(ElectricStats.createRechargeableBattery(Long.MAX_VALUE, GTValues.UHV)).setUnificationData(OrePrefix.battery, Tier.UHV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ZERO_POINT_MODULE = addItem(752, "zpm") + .addComponents(ElectricStats.createBattery(2000000000000L, GTValues.ZPM, true)).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ULTIMATE_BATTERY = addItem(753, "max.battery") + .addComponents(ElectricStats.createRechargeableBattery(Long.MAX_VALUE, GTValues.UHV)) + .setUnificationData(OrePrefix.battery, Tier.UHV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); POWER_THRUSTER = addItem(776, "power_thruster").setRarity(EnumRarity.UNCOMMON); POWER_THRUSTER_ADVANCED = addItem(777, "power_thruster_advanced").setRarity(EnumRarity.RARE); GRAVITATION_ENGINE = addItem(778, "gravitation_engine").setRarity(EnumRarity.EPIC); // Plugins: 780-799 - PLUGIN_ADVANCED_MONITOR = addItem(780, "plugin.advanced_monitor").addComponents(new AdvancedMonitorPluginBehavior()); + PLUGIN_ADVANCED_MONITOR = addItem(780, "plugin.advanced_monitor") + .addComponents(new AdvancedMonitorPluginBehavior()); PLUGIN_FAKE_GUI = addItem(781, "plugin.fake_gui").addComponents(new FakeGuiPluginBehavior()); PLUGIN_ONLINE_PIC = addItem(782, "plugin.online_pic").addComponents(new OnlinePicPluginBehavior()); PLUGIN_TEXT = addItem(783, "plugin.text").addComponents(new TextPluginBehavior()); // Records: 800-819 - SUS_RECORD = addItem(800, "record.sus").addComponents(new MusicDiscStats(GTSoundEvents.SUS_RECORD)).setRarity(EnumRarity.RARE).setMaxStackSize(1).setInvisible(); + SUS_RECORD = addItem(800, "record.sus").addComponents(new MusicDiscStats(GTSoundEvents.SUS_RECORD)) + .setRarity(EnumRarity.RARE).setMaxStackSize(1).setInvisible(); // Dyed Glass Lenses: 820-840 for (int i = 0; i < MarkerMaterials.Color.VALUES.length; i++) { @@ -922,6 +1107,7 @@ public void registerSubItems() { LOGO = addItem(1003, "logo").setInvisible(); LOGO.getMetaItem().addPropertyOverride(new ResourceLocation("xmas"), (s, w, e) -> GTValues.XMAS.get() ? 1 : 0); - MULTIBLOCK_BUILDER = addItem(1004, "tool.multiblock_builder").addComponents(new MultiblockBuilderBehavior()).setMaxStackSize(1); + MULTIBLOCK_BUILDER = addItem(1004, "tool.multiblock_builder").addComponents(new MultiblockBuilderBehavior()) + .setMaxStackSize(1); } } diff --git a/src/main/java/gregtech/common/items/MetaItems.java b/src/main/java/gregtech/common/items/MetaItems.java index f8a1f518a90..303588e6dc8 100644 --- a/src/main/java/gregtech/common/items/MetaItems.java +++ b/src/main/java/gregtech/common/items/MetaItems.java @@ -1,6 +1,5 @@ package gregtech.common.items; -import com.google.common.base.CaseFormat; import gregtech.api.GregTechAPI; import gregtech.api.items.armor.ArmorMetaItem; import gregtech.api.items.materialitem.MetaPrefixItem; @@ -13,6 +12,7 @@ import gregtech.api.util.GTLog; import gregtech.client.renderer.handler.FacadeRenderer; import gregtech.common.items.armor.MetaArmor; + import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.EnumDyeColor; @@ -23,12 +23,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import com.google.common.base.CaseFormat; + import java.util.*; public final class MetaItems { - private MetaItems() { - } + private MetaItems() {} public static final List> ITEMS = MetaItem.getMetaItems(); @@ -459,7 +460,6 @@ private MetaItems() { public static MetaItem.MetaValueItem COVER_SOLAR_PANEL_ZPM; public static MetaItem.MetaValueItem COVER_SOLAR_PANEL_UV; - public static MetaItem.MetaValueItem PLUGIN_TEXT; public static MetaItem.MetaValueItem PLUGIN_ONLINE_PIC; public static MetaItem.MetaValueItem PLUGIN_FAKE_GUI; @@ -504,8 +504,10 @@ private MetaItems() { public static MetaItem.MetaValueItem CAMERA; public static MetaItem.MetaValueItem TERMINAL; - public static final MetaItem.MetaValueItem[] DYE_ONLY_ITEMS = new MetaItem.MetaValueItem[EnumDyeColor.values().length]; - public static final MetaItem.MetaValueItem[] SPRAY_CAN_DYES = new MetaItem.MetaValueItem[EnumDyeColor.values().length]; + public static final MetaItem.MetaValueItem[] DYE_ONLY_ITEMS = new MetaItem.MetaValueItem[EnumDyeColor + .values().length]; + public static final MetaItem.MetaValueItem[] SPRAY_CAN_DYES = new MetaItem.MetaValueItem[EnumDyeColor + .values().length]; public static MetaItem.MetaValueItem TURBINE_ROTOR; @@ -630,7 +632,8 @@ public static void registerOreDict() { // Register "craftingLensWhite" for example OreDictUnifier.registerOre(entry.getValue().getStackForm(), OrePrefix.craftingLens, entry.getKey()); // Register "craftingLensGlass", intended only for recipes to dye lenses and not in the Engraver - OreDictUnifier.registerOre(entry.getValue().getStackForm(), String.format("%s%s", OrePrefix.craftingLens.name(), "Glass")); + OreDictUnifier.registerOre(entry.getValue().getStackForm(), + String.format("%s%s", OrePrefix.craftingLens.name(), "Glass")); } } @@ -658,9 +661,10 @@ public static void registerBakedModels(ModelBakeEvent event) { } @SideOnly(Side.CLIENT) - @SuppressWarnings({"unchecked", "rawtypes"}) - private static void registerSpecialItemModel(ModelBakeEvent event, MetaValueItem metaValueItem, IBakedModel bakedModel) { - //noinspection RedundantCast + @SuppressWarnings({ "unchecked", "rawtypes" }) + private static void registerSpecialItemModel(ModelBakeEvent event, MetaValueItem metaValueItem, + IBakedModel bakedModel) { + // noinspection RedundantCast ResourceLocation modelPath = ((MetaItem) metaValueItem.getMetaItem()).createItemModelPath(metaValueItem, ""); ModelResourceLocation modelResourceLocation = new ModelResourceLocation(modelPath, "inventory"); event.getModelRegistry().putObject(modelResourceLocation, bakedModel); diff --git a/src/main/java/gregtech/common/items/ToolItems.java b/src/main/java/gregtech/common/items/ToolItems.java index f70516fd7ac..f967aefd6e4 100644 --- a/src/main/java/gregtech/common/items/ToolItems.java +++ b/src/main/java/gregtech/common/items/ToolItems.java @@ -6,6 +6,7 @@ import gregtech.api.unification.material.Materials; import gregtech.common.items.tool.*; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.client.Minecraft; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.entity.monster.EntityGolem; @@ -15,10 +16,11 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.client.model.ModelLoader; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + public final class ToolItems { private static final List TOOLS = new ArrayList<>(); @@ -180,7 +182,8 @@ public static void init() { .toolStats(b -> b.blockBreaking().attacking() .attackDamage(5.0F).attackSpeed(-3.0F).durabilityMultiplier(3.0F) .aoe(2, 2, 2) - .behaviors(HoeGroundBehavior.INSTANCE, HarvestCropsBehavior.INSTANCE).canApplyEnchantment(EnumEnchantmentType.DIGGER)) + .behaviors(HoeGroundBehavior.INSTANCE, HarvestCropsBehavior.INSTANCE) + .canApplyEnchantment(EnumEnchantmentType.DIGGER)) .oreDict(ToolOreDict.toolScythe) .toolClasses(ToolClasses.SCYTHE, ToolClasses.HOE)); KNIFE = register(ItemGTSword.Builder.of(GTValues.MODID, "knife") @@ -250,7 +253,8 @@ public static void init() { .efficiencyMultiplier(2.0F) .attackDamage(5.0F).attackSpeed(-3.2F) .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV) - .behaviors(HarvestIceBehavior.INSTANCE, DisableShieldBehavior.INSTANCE, TreeFellingBehavior.INSTANCE)) + .behaviors(HarvestIceBehavior.INSTANCE, DisableShieldBehavior.INSTANCE, + TreeFellingBehavior.INSTANCE)) .oreDict(ToolOreDict.toolAxe) .secondaryOreDicts(ToolOreDict.toolChainsaw) .sound(GTSoundEvents.CHAINSAW_TOOL, true) @@ -333,7 +337,8 @@ public static void registerModels() { } public static void registerColors() { - TOOLS.forEach(tool -> Minecraft.getMinecraft().getItemColors().registerItemColorHandler(tool::getColor, tool.get())); + TOOLS.forEach( + tool -> Minecraft.getMinecraft().getItemColors().registerItemColorHandler(tool::getColor, tool.get())); } public static void registerOreDict() { diff --git a/src/main/java/gregtech/common/items/armor/AdvancedJetpack.java b/src/main/java/gregtech/common/items/armor/AdvancedJetpack.java index 4e8ad7a490f..ff3634b2110 100644 --- a/src/main/java/gregtech/common/items/armor/AdvancedJetpack.java +++ b/src/main/java/gregtech/common/items/armor/AdvancedJetpack.java @@ -1,10 +1,10 @@ package gregtech.common.items.armor; - import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IElectricItem; import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; + import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; @@ -25,7 +25,7 @@ public AdvancedJetpack(int energyPerUse, long capacity, int tier) { @Override public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack item) { IElectricItem cont = item.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); - if(cont == null) { + if (cont == null) { return; } NBTTagCompound data = GTUtility.getOrCreateNbtCompound(item); @@ -103,4 +103,3 @@ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlo return "gregtech:textures/armor/advanced_jetpack.png"; } } - diff --git a/src/main/java/gregtech/common/items/armor/AdvancedNanoMuscleSuite.java b/src/main/java/gregtech/common/items/armor/AdvancedNanoMuscleSuite.java index 56d82e6a674..fae06b7281f 100644 --- a/src/main/java/gregtech/common/items/armor/AdvancedNanoMuscleSuite.java +++ b/src/main/java/gregtech/common/items/armor/AdvancedNanoMuscleSuite.java @@ -6,6 +6,7 @@ import gregtech.api.items.armor.ArmorUtils; import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -17,14 +18,17 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; import java.util.Iterator; import java.util.List; +import javax.annotation.Nonnull; + public class AdvancedNanoMuscleSuite extends NanoMuscleSuite implements IJetpack { - //A replacement for checking the current world time, to get around the gamerule that stops it + + // A replacement for checking the current world time, to get around the gamerule that stops it private long timer = 0L; private List, List>> inventoryIndexMap; @@ -88,7 +92,8 @@ else if (canShare) Iterator inventoryIterator = inventoryMap.getValue().iterator(); while (inventoryIterator.hasNext()) { int slot = inventoryIterator.next(); - IElectricItem chargable = inventoryMap.getKey().get(slot).getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem chargable = inventoryMap.getKey().get(slot) + .getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); // Safety check the null, it should not actually happen. Also don't try and charge itself if (chargable == null || chargable == cont) { @@ -99,7 +104,8 @@ else if (canShare) long attemptedChargeAmount = chargable.getTransferLimit() * 10; // Accounts for tick differences when charging items - if (chargable.getCharge() < chargable.getMaxCharge() && cont.canUse(attemptedChargeAmount) && timer % 10 == 0) { + if (chargable.getCharge() < chargable.getMaxCharge() && cont.canUse(attemptedChargeAmount) && + timer % 10 == 0) { long delta = chargable.charge(attemptedChargeAmount, cont.getTier(), true, false); if (delta > 0) { cont.discharge(delta, cont.getTier(), true, false, false); @@ -134,7 +140,8 @@ public void addInfo(ItemStack itemStack, List lines) { NBTTagCompound data = GTUtility.getOrCreateNbtCompound(itemStack); String state; if (data.hasKey("canShare")) { - state = data.getBoolean("canShare") ? I18n.format("metaarmor.hud.status.enabled") : I18n.format("metaarmor.hud.status.disabled"); + state = data.getBoolean("canShare") ? I18n.format("metaarmor.hud.status.enabled") : + I18n.format("metaarmor.hud.status.disabled"); } else { state = I18n.format("metaarmor.hud.status.disabled"); } @@ -157,7 +164,8 @@ public ActionResult onRightClick(World world, @Nonnull EntityPlayer p if (armor.getItem() instanceof ArmorMetaItem && player.isSneaking()) { NBTTagCompound data = GTUtility.getOrCreateNbtCompound(player.getHeldItem(hand)); boolean canShare = data.hasKey("canShare") && data.getBoolean("canShare"); - IElectricItem cont = player.getHeldItem(hand).getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem cont = player.getHeldItem(hand).getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (cont == null) { return ActionResult.newResult(EnumActionResult.FAIL, player.getHeldItem(hand)); } @@ -191,12 +199,14 @@ public void drawHUD(ItemStack item) { NBTTagCompound data = item.getTagCompound(); if (data != null) { if (data.hasKey("canShare")) { - String status = data.getBoolean("canShare") ? "metaarmor.hud.status.enabled" : "metaarmor.hud.status.disabled"; + String status = data.getBoolean("canShare") ? "metaarmor.hud.status.enabled" : + "metaarmor.hud.status.disabled"; this.HUD.newString(I18n.format("mataarmor.hud.supply_mode", I18n.format(status))); } if (data.hasKey("hover")) { - String status = data.getBoolean("hover") ? "metaarmor.hud.status.enabled" : "metaarmor.hud.status.disabled"; + String status = data.getBoolean("hover") ? "metaarmor.hud.status.enabled" : + "metaarmor.hud.status.disabled"; this.HUD.newString(I18n.format("metaarmor.hud.hover_mode", I18n.format(status))); } } diff --git a/src/main/java/gregtech/common/items/armor/AdvancedQuarkTechSuite.java b/src/main/java/gregtech/common/items/armor/AdvancedQuarkTechSuite.java index aa144febe60..755a1802b59 100644 --- a/src/main/java/gregtech/common/items/armor/AdvancedQuarkTechSuite.java +++ b/src/main/java/gregtech/common/items/armor/AdvancedQuarkTechSuite.java @@ -6,6 +6,7 @@ import gregtech.api.items.armor.ArmorUtils; import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -19,14 +20,17 @@ import net.minecraftforge.common.ISpecialArmor.ArmorProperties; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; import java.util.Iterator; import java.util.List; +import javax.annotation.Nonnull; + public class AdvancedQuarkTechSuite extends QuarkTechSuite implements IJetpack { - //A replacement for checking the current world time, to get around the gamerule that stops it + + // A replacement for checking the current world time, to get around the gamerule that stops it private long timer = 0L; private List, List>> inventoryIndexMap; @@ -93,7 +97,8 @@ else if (canShare) Iterator inventoryIterator = inventoryMap.getValue().iterator(); while (inventoryIterator.hasNext()) { int slot = inventoryIterator.next(); - IElectricItem chargable = inventoryMap.getKey().get(slot).getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem chargable = inventoryMap.getKey().get(slot) + .getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); // Safety check the null, it should not actually happen. Also don't try and charge itself if (chargable == null || chargable == cont) { @@ -104,7 +109,8 @@ else if (canShare) long attemptedChargeAmount = chargable.getTransferLimit() * 10; // Accounts for tick differences when charging items - if (chargable.getCharge() < chargable.getMaxCharge() && cont.canUse(attemptedChargeAmount) && timer % 10 == 0) { + if (chargable.getCharge() < chargable.getMaxCharge() && cont.canUse(attemptedChargeAmount) && + timer % 10 == 0) { long delta = chargable.charge(attemptedChargeAmount, cont.getTier(), true, false); if (delta > 0) { cont.discharge(delta, cont.getTier(), true, false, false); @@ -139,7 +145,8 @@ public void addInfo(ItemStack itemStack, List lines) { NBTTagCompound data = GTUtility.getOrCreateNbtCompound(itemStack); String state; if (data.hasKey("canShare")) { - state = data.getBoolean("canShare") ? I18n.format("metaarmor.hud.status.enabled") : I18n.format("metaarmor.hud.status.disabled"); + state = data.getBoolean("canShare") ? I18n.format("metaarmor.hud.status.enabled") : + I18n.format("metaarmor.hud.status.disabled"); } else { state = I18n.format("metaarmor.hud.status.disabled"); } @@ -159,7 +166,8 @@ public ActionResult onRightClick(World world, EntityPlayer player, En if (player.getHeldItem(hand).getItem() instanceof ArmorMetaItem && player.isSneaking()) { NBTTagCompound data = GTUtility.getOrCreateNbtCompound(player.getHeldItem(hand)); boolean canShare = data.hasKey("canShare") && data.getBoolean("canShare"); - IElectricItem cont = player.getHeldItem(hand).getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem cont = player.getHeldItem(hand).getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (cont == null) { return ActionResult.newResult(EnumActionResult.FAIL, player.getHeldItem(hand)); } @@ -193,12 +201,14 @@ public void drawHUD(ItemStack item) { NBTTagCompound data = item.getTagCompound(); if (data != null) { if (data.hasKey("canShare")) { - String status = data.getBoolean("canShare") ? "metaarmor.hud.status.enabled" : "metaarmor.hud.status.disabled"; + String status = data.getBoolean("canShare") ? "metaarmor.hud.status.enabled" : + "metaarmor.hud.status.disabled"; this.HUD.newString(I18n.format("mataarmor.hud.supply_mode", I18n.format(status))); } if (data.hasKey("hover")) { - String status = data.getBoolean("hover") ? "metaarmor.hud.status.enabled" : "metaarmor.hud.status.disabled"; + String status = data.getBoolean("hover") ? "metaarmor.hud.status.enabled" : + "metaarmor.hud.status.disabled"; this.HUD.newString(I18n.format("metaarmor.hud.hover_mode", I18n.format(status))); } } @@ -207,7 +217,8 @@ public void drawHUD(ItemStack item) { } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { int damageLimit = Integer.MAX_VALUE; IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (item == null) { @@ -220,7 +231,8 @@ public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack } @Override - public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { return source != DamageSource.FALL && source != DamageSource.DROWN && source != DamageSource.STARVE; } diff --git a/src/main/java/gregtech/common/items/armor/IJetpack.java b/src/main/java/gregtech/common/items/armor/IJetpack.java index 43bc6c58c96..eeb33f98260 100644 --- a/src/main/java/gregtech/common/items/armor/IJetpack.java +++ b/src/main/java/gregtech/common/items/armor/IJetpack.java @@ -2,15 +2,16 @@ import gregtech.api.items.armor.ArmorUtils; import gregtech.api.util.input.KeyBind; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; import javax.annotation.Nonnull; - /** - * Logic from SimplyJetpacks2: https://github.com/Tomson124/SimplyJetpacks2/blob/1.12/src/main/java/tonius/simplyjetpacks/item/ItemJetpack.java + * Logic from SimplyJetpacks2: + * https://github.com/Tomson124/SimplyJetpacks2/blob/1.12/src/main/java/tonius/simplyjetpacks/item/ItemJetpack.java */ public interface IJetpack { @@ -66,14 +67,16 @@ default void performFlying(@Nonnull EntityPlayer player, boolean hover, ItemStac if (!player.isInWater() && !player.isInLava() && canUseEnergy(stack, getEnergyPerUse())) { if (flyKeyDown || hover && !player.onGround) { - drainEnergy(stack, (int) (player.isSprinting() ? Math.round(getEnergyPerUse() * getSprintEnergyModifier()) : getEnergyPerUse())); + drainEnergy(stack, (int) (player.isSprinting() ? + Math.round(getEnergyPerUse() * getSprintEnergyModifier()) : getEnergyPerUse())); if (hasEnergy(stack)) { if (flyKeyDown) { if (!hover) { player.motionY = Math.min(player.motionY + currentAccel, currentSpeedVertical); } else { - if (descendKeyDown) player.motionY = Math.min(player.motionY + currentAccel, getVerticalHoverSlowSpeed()); + if (descendKeyDown) + player.motionY = Math.min(player.motionY + currentAccel, getVerticalHoverSlowSpeed()); else player.motionY = Math.min(player.motionY + currentAccel, getVerticalHoverSpeed()); } } else if (descendKeyDown) { @@ -81,8 +84,10 @@ default void performFlying(@Nonnull EntityPlayer player, boolean hover, ItemStac } else { player.motionY = Math.min(player.motionY + currentAccel, -getVerticalHoverSlowSpeed()); } - float speedSideways = (float) (player.isSneaking() ? getSidewaysSpeed() * 0.5f : getSidewaysSpeed()); - float speedForward = (float) (player.isSprinting() ? speedSideways * getSprintSpeedModifier() : speedSideways); + float speedSideways = (float) (player.isSneaking() ? getSidewaysSpeed() * 0.5f : + getSidewaysSpeed()); + float speedForward = (float) (player.isSprinting() ? speedSideways * getSprintSpeedModifier() : + speedSideways); if (KeyBind.VANILLA_FORWARD.isKeyDown(player)) player.moveRelative(0, 0, speedForward, speedForward); diff --git a/src/main/java/gregtech/common/items/armor/IStepAssist.java b/src/main/java/gregtech/common/items/armor/IStepAssist.java index e59b2ceb5f3..9b4f57f9604 100644 --- a/src/main/java/gregtech/common/items/armor/IStepAssist.java +++ b/src/main/java/gregtech/common/items/armor/IStepAssist.java @@ -5,7 +5,8 @@ import javax.annotation.Nonnull; /** - * Logic from EnderIO: https://github.com/SleepyTrousers/EnderIO/blob/d6dfb9d3964946ceb9fd72a66a3cff197a51a1fe/enderio-base/src/main/java/crazypants/enderio/base/handler/darksteel/DarkSteelController.java + * Logic from EnderIO: + * https://github.com/SleepyTrousers/EnderIO/blob/d6dfb9d3964946ceb9fd72a66a3cff197a51a1fe/enderio-base/src/main/java/crazypants/enderio/base/handler/darksteel/DarkSteelController.java */ public interface IStepAssist { diff --git a/src/main/java/gregtech/common/items/armor/Jetpack.java b/src/main/java/gregtech/common/items/armor/Jetpack.java index 7d9a6eb90d5..de30fdda203 100644 --- a/src/main/java/gregtech/common/items/armor/Jetpack.java +++ b/src/main/java/gregtech/common/items/armor/Jetpack.java @@ -6,6 +6,7 @@ import gregtech.api.items.armor.ArmorUtils; import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -21,9 +22,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class Jetpack extends ArmorLogicSuite implements IJetpack { @SideOnly(Side.CLIENT) @@ -32,7 +34,7 @@ public class Jetpack extends ArmorLogicSuite implements IJetpack { public Jetpack(int energyPerUse, long capacity, int tier) { super(energyPerUse, capacity, tier, EntityEquipmentSlot.CHEST); if (ArmorUtils.SIDE.isClient() && this.shouldDrawHUD()) { - //noinspection NewExpressionSideOnly + // noinspection NewExpressionSideOnly HUD = new ArmorUtils.ModularHUD(); } } @@ -100,7 +102,8 @@ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlo } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { return new ArmorProperties(0, 0, 0); } @@ -111,7 +114,8 @@ public void drawHUD(ItemStack item) { NBTTagCompound data = item.getTagCompound(); if (data != null) { if (data.hasKey("hover")) { - String status = (data.getBoolean("hover") ? I18n.format("metaarmor.hud.status.enabled") : I18n.format("metaarmor.hud.status.disabled")); + String status = (data.getBoolean("hover") ? I18n.format("metaarmor.hud.status.enabled") : + I18n.format("metaarmor.hud.status.disabled")); String result = I18n.format("metaarmor.hud.hover_mode", status); this.HUD.newString(result); } diff --git a/src/main/java/gregtech/common/items/armor/MetaArmor.java b/src/main/java/gregtech/common/items/armor/MetaArmor.java index e3bf768a73f..1d53bbca1c9 100644 --- a/src/main/java/gregtech/common/items/armor/MetaArmor.java +++ b/src/main/java/gregtech/common/items/armor/MetaArmor.java @@ -3,6 +3,7 @@ import gregtech.api.items.armor.ArmorMetaItem; import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; + import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; @@ -10,28 +11,61 @@ public class MetaArmor extends ArmorMetaItem.ArmorMetaValueItem @Override public void registerSubItems() { - MetaItems.NIGHTVISION_GOGGLES = addItem(1, "nightvision_goggles").setArmorLogic(new NightvisionGoggles(2, 80_000L * (long) Math.max(1, Math.pow(1, ConfigHolder.tools.voltageTierNightVision - 1)), ConfigHolder.tools.voltageTierNightVision, EntityEquipmentSlot.HEAD)); + MetaItems.NIGHTVISION_GOGGLES = addItem(1, "nightvision_goggles").setArmorLogic(new NightvisionGoggles(2, + 80_000L * (long) Math.max(1, Math.pow(1, ConfigHolder.tools.voltageTierNightVision - 1)), + ConfigHolder.tools.voltageTierNightVision, EntityEquipmentSlot.HEAD)); MetaItems.SEMIFLUID_JETPACK = addItem(2, "liquid_fuel_jetpack").setArmorLogic(new PowerlessJetpack()); - MetaItems.ELECTRIC_JETPACK = addItem(3, "electric_jetpack").setArmorLogic(new Jetpack(30, 1_000_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierImpeller - 2)), ConfigHolder.tools.voltageTierImpeller)).setModelAmount(8).setRarity(EnumRarity.UNCOMMON); - MetaItems.ELECTRIC_JETPACK_ADVANCED = addItem(4, "advanced_electric_jetpack").setArmorLogic(new AdvancedJetpack(512, 6_400_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierAdvImpeller - 4)), ConfigHolder.tools.voltageTierAdvImpeller)).setRarity(EnumRarity.RARE); + MetaItems.ELECTRIC_JETPACK = addItem(3, "electric_jetpack").setArmorLogic(new Jetpack(30, + 1_000_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierImpeller - 2)), + ConfigHolder.tools.voltageTierImpeller)).setModelAmount(8).setRarity(EnumRarity.UNCOMMON); + MetaItems.ELECTRIC_JETPACK_ADVANCED = addItem(4, "advanced_electric_jetpack") + .setArmorLogic(new AdvancedJetpack(512, + 6_400_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierAdvImpeller - 4)), + ConfigHolder.tools.voltageTierAdvImpeller)) + .setRarity(EnumRarity.RARE); int energyPerUse = 512; int tier = ConfigHolder.tools.voltageTierNanoSuit; long maxCapacity = 6_400_000L * (long) Math.max(1, Math.pow(4, tier - 3)); - MetaItems.NANO_HELMET = addItem(20, "nms.helmet").setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.HEAD, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.UNCOMMON); - MetaItems.NANO_CHESTPLATE = addItem(21, "nms.chestplate").setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.CHEST, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.UNCOMMON); - MetaItems.NANO_LEGGINGS = addItem(22, "nms.leggings").setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.LEGS, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.UNCOMMON); - MetaItems.NANO_BOOTS = addItem(23, "nms.boots").setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.FEET, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.UNCOMMON); - MetaItems.NANO_CHESTPLATE_ADVANCED = addItem(30, "nms.advanced_chestplate").setArmorLogic(new AdvancedNanoMuscleSuite(energyPerUse, 12_800_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierAdvNanoSuit - 3)), ConfigHolder.tools.voltageTierAdvNanoSuit)).setRarity(EnumRarity.RARE); + MetaItems.NANO_HELMET = addItem(20, "nms.helmet") + .setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.HEAD, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.UNCOMMON); + MetaItems.NANO_CHESTPLATE = addItem(21, "nms.chestplate") + .setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.CHEST, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.UNCOMMON); + MetaItems.NANO_LEGGINGS = addItem(22, "nms.leggings") + .setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.LEGS, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.UNCOMMON); + MetaItems.NANO_BOOTS = addItem(23, "nms.boots") + .setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.FEET, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.UNCOMMON); + MetaItems.NANO_CHESTPLATE_ADVANCED = addItem(30, "nms.advanced_chestplate") + .setArmorLogic(new AdvancedNanoMuscleSuite(energyPerUse, + 12_800_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierAdvNanoSuit - 3)), + ConfigHolder.tools.voltageTierAdvNanoSuit)) + .setRarity(EnumRarity.RARE); energyPerUse = 8192; tier = ConfigHolder.tools.voltageTierQuarkTech; maxCapacity = 100_000_000L * (long) Math.max(1, Math.pow(4, tier - 5)); - MetaItems.QUANTUM_HELMET = addItem(40, "qts.helmet").setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.HEAD, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.RARE); - MetaItems.QUANTUM_CHESTPLATE = addItem(41, "qts.chestplate").setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.CHEST, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.RARE); - MetaItems.QUANTUM_LEGGINGS = addItem(42, "qts.leggings").setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.LEGS, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.RARE); - MetaItems.QUANTUM_BOOTS = addItem(43, "qts.boots").setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.FEET, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.RARE); - MetaItems.QUANTUM_CHESTPLATE_ADVANCED = addItem(50, "qts.advanced_chestplate").setArmorLogic(new AdvancedQuarkTechSuite(energyPerUse, 1_000_000_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierAdvQuarkTech - 6)), ConfigHolder.tools.voltageTierAdvQuarkTech)).setRarity(EnumRarity.EPIC); + MetaItems.QUANTUM_HELMET = addItem(40, "qts.helmet") + .setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.HEAD, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.RARE); + MetaItems.QUANTUM_CHESTPLATE = addItem(41, "qts.chestplate") + .setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.CHEST, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.RARE); + MetaItems.QUANTUM_LEGGINGS = addItem(42, "qts.leggings") + .setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.LEGS, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.RARE); + MetaItems.QUANTUM_BOOTS = addItem(43, "qts.boots") + .setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.FEET, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.RARE); + MetaItems.QUANTUM_CHESTPLATE_ADVANCED = addItem(50, "qts.advanced_chestplate") + .setArmorLogic(new AdvancedQuarkTechSuite(energyPerUse, + 1_000_000_000L * + (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierAdvQuarkTech - 6)), + ConfigHolder.tools.voltageTierAdvQuarkTech)) + .setRarity(EnumRarity.EPIC); } } diff --git a/src/main/java/gregtech/common/items/armor/NanoMuscleSuite.java b/src/main/java/gregtech/common/items/armor/NanoMuscleSuite.java index f077020f26d..a0c0f48d769 100644 --- a/src/main/java/gregtech/common/items/armor/NanoMuscleSuite.java +++ b/src/main/java/gregtech/common/items/armor/NanoMuscleSuite.java @@ -7,6 +7,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; import gregtech.common.items.MetaItems; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; @@ -24,9 +25,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class NanoMuscleSuite extends ArmorLogicSuite implements IStepAssist { @SideOnly(Side.CLIENT) @@ -35,7 +37,7 @@ public class NanoMuscleSuite extends ArmorLogicSuite implements IStepAssist { public NanoMuscleSuite(EntityEquipmentSlot slot, int energyPerUse, long maxCapacity, int tier) { super(energyPerUse, maxCapacity, tier, slot); if (ArmorUtils.SIDE.isClient() && this.shouldDrawHUD()) { - //noinspection NewExpressionSideOnly + // noinspection NewExpressionSideOnly HUD = new ArmorUtils.ModularHUD(); } } @@ -55,7 +57,8 @@ public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack ite if (!nightvision && item.getCharge() >= 4) { nightvision = true; if (!world.isRemote) - player.sendStatusMessage(new TextComponentTranslation("metaarmor.nms.nightvision.enabled"), true); + player.sendStatusMessage(new TextComponentTranslation("metaarmor.nms.nightvision.enabled"), + true); } else if (nightvision) { nightvision = false; disableNightVision(world, player, true); @@ -89,16 +92,19 @@ public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack ite public static void disableNightVision(@Nonnull World world, EntityPlayer player, boolean sendMsg) { if (!world.isRemote) { player.removePotionEffect(MobEffects.NIGHT_VISION); - if (sendMsg) player.sendStatusMessage(new TextComponentTranslation("metaarmor.nms.nightvision.disabled"), true); + if (sendMsg) + player.sendStatusMessage(new TextComponentTranslation("metaarmor.nms.nightvision.disabled"), true); } } - public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { return source == DamageSource.FALL; } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { IElectricItem container = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); int damageLimit = Integer.MAX_VALUE; if (source == DamageSource.FALL && this.getEquipmentSlot(armor) == EntityEquipmentSlot.FEET) { @@ -116,7 +122,8 @@ public EntityEquipmentSlot getEquipmentSlot(ItemStack itemStack) { } @Override - public void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage, EntityEquipmentSlot equipmentSlot) { + public void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage, + EntityEquipmentSlot equipmentSlot) { IElectricItem item = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (item != null) { item.discharge((long) energyPerUse / 10 * damage, item.getTier(), true, false, false); @@ -125,7 +132,8 @@ public void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSour @Override public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { - ItemStack currentChest = Minecraft.getMinecraft().player.inventory.armorItemInSlot(EntityEquipmentSlot.CHEST.getIndex()); + ItemStack currentChest = Minecraft.getMinecraft().player.inventory + .armorItemInSlot(EntityEquipmentSlot.CHEST.getIndex()); ItemStack advancedChest = MetaItems.NANO_CHESTPLATE_ADVANCED.getStackForm(); String armorTexture = "nano_muscule_suite"; if (advancedChest.isItemEqual(currentChest)) armorTexture = "advanced_nano_muscle_suite"; diff --git a/src/main/java/gregtech/common/items/armor/NightvisionGoggles.java b/src/main/java/gregtech/common/items/armor/NightvisionGoggles.java index f0619660f70..73597d10a39 100644 --- a/src/main/java/gregtech/common/items/armor/NightvisionGoggles.java +++ b/src/main/java/gregtech/common/items/armor/NightvisionGoggles.java @@ -5,6 +5,7 @@ import gregtech.api.items.armor.ArmorLogicSuite; import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -16,9 +17,10 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class NightvisionGoggles extends ArmorLogicSuite { public NightvisionGoggles(int energyPerUse, long capacity, int voltageTier, EntityEquipmentSlot slot) { @@ -43,13 +45,15 @@ public void onArmorTick(World world, @Nonnull EntityPlayer player, @Nonnull Item if (!nightvision && item.getCharge() >= energyPerUse) { nightvision = true; if (!world.isRemote) - player.sendStatusMessage(new TextComponentTranslation("metaarmor.message.nightvision.enabled"), true); + player.sendStatusMessage(new TextComponentTranslation("metaarmor.message.nightvision.enabled"), + true); } else if (nightvision) { nightvision = false; disableNightVision(world, player, true); } else { if (!world.isRemote) { - player.sendStatusMessage(new TextComponentTranslation("metaarmor.message.nightvision.error"), true); + player.sendStatusMessage(new TextComponentTranslation("metaarmor.message.nightvision.error"), + true); } } @@ -74,7 +78,8 @@ public void onArmorTick(World world, @Nonnull EntityPlayer player, @Nonnull Item public static void disableNightVision(@Nonnull World world, EntityPlayer player, boolean sendMsg) { if (!world.isRemote) { player.removePotionEffect(MobEffects.NIGHT_VISION); - if (sendMsg) player.sendStatusMessage(new TextComponentTranslation("metaarmor.message.nightvision.disabled"), true); + if (sendMsg) + player.sendStatusMessage(new TextComponentTranslation("metaarmor.message.nightvision.disabled"), true); } } diff --git a/src/main/java/gregtech/common/items/armor/PowerlessJetpack.java b/src/main/java/gregtech/common/items/armor/PowerlessJetpack.java index 3ef025028f2..51c089dece1 100644 --- a/src/main/java/gregtech/common/items/armor/PowerlessJetpack.java +++ b/src/main/java/gregtech/common/items/armor/PowerlessJetpack.java @@ -13,6 +13,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.GradientUtil; import gregtech.api.util.input.KeyBind; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -32,15 +33,17 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.awt.*; import java.util.Collections; import java.util.List; import java.util.Objects; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class PowerlessJetpack implements ISpecialArmorLogic, IJetpack, IItemHUDProvider { public static final int tankCapacity = 16000; @@ -54,13 +57,14 @@ public class PowerlessJetpack implements ISpecialArmorLogic, IJetpack, IItemHUDP public PowerlessJetpack() { if (ArmorUtils.SIDE.isClient()) - //noinspection NewExpressionSideOnly + // noinspection NewExpressionSideOnly HUD = new ArmorUtils.ModularHUD(); } @Override public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack stack) { - IFluidHandlerItem internalTank = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem internalTank = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (internalTank == null) return; @@ -98,7 +102,6 @@ public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack sta data.setShort("burnTimer", (short) burnTimer); data.setByte("toggleTimer", toggleTimer); player.inventoryContainer.detectAndSendChanges(); - } @Override @@ -125,13 +128,15 @@ public void drawHUD(@Nonnull ItemStack item) { if (prop[0] != null) { if (prop[0].getContents() != null) { if (prop[0].getContents().amount == 0) return; - String formated = String.format("%.1f", (prop[0].getContents().amount * 100.0F / prop[0].getCapacity())); + String formated = String.format("%.1f", + (prop[0].getContents().amount * 100.0F / prop[0].getCapacity())); this.HUD.newString(I18n.format("metaarmor.hud.fuel_lvl", formated + "%")); NBTTagCompound data = item.getTagCompound(); if (data != null) { if (data.hasKey("hover")) { - String status = (data.getBoolean("hover") ? I18n.format("metaarmor.hud.status.enabled") : I18n.format("metaarmor.hud.status.disabled")); + String status = (data.getBoolean("hover") ? I18n.format("metaarmor.hud.status.enabled") : + I18n.format("metaarmor.hud.status.disabled")); String result = I18n.format("metaarmor.hud.hover_mode", status); this.HUD.newString(result); } @@ -190,11 +195,14 @@ public void findNewRecipe(@Nonnull ItemStack stack) { IFluidHandlerItem internalTank = getIFluidHandlerItem(stack); if (internalTank != null) { FluidStack fluidStack = internalTank.drain(1, false); - if (previousRecipe != null && fluidStack != null && fluidStack.isFluidEqual(previousRecipe.getFluidInputs().get(0).getInputFluidStack()) && fluidStack.amount > 0) { + if (previousRecipe != null && fluidStack != null && + fluidStack.isFluidEqual(previousRecipe.getFluidInputs().get(0).getInputFluidStack()) && + fluidStack.amount > 0) { currentRecipe = previousRecipe; return; } else if (fluidStack != null) { - Recipe recipe = RecipeMaps.COMBUSTION_GENERATOR_FUELS.find(Collections.emptyList(), Collections.singletonList(fluidStack), (Objects::nonNull)); + Recipe recipe = RecipeMaps.COMBUSTION_GENERATOR_FUELS.find(Collections.emptyList(), + Collections.singletonList(fluidStack), (Objects::nonNull)); if (recipe != null) { previousRecipe = recipe; currentRecipe = previousRecipe; @@ -221,8 +229,10 @@ public FluidStack getFuel() { public ActionResult onRightClick(World world, EntityPlayer player, EnumHand hand) { if (player.getHeldItem(hand).getItem() instanceof ArmorMetaItem) { ItemStack armor = player.getHeldItem(hand); - if (armor.getItem() instanceof ArmorMetaItem && player.inventory.armorInventory.get(getEquipmentSlot(player.getHeldItem(hand)).getIndex()).isEmpty() && !player.isSneaking()) { - player.inventory.armorInventory.set(getEquipmentSlot(player.getHeldItem(hand)).getIndex(), armor.copy()); + if (armor.getItem() instanceof ArmorMetaItem && player.inventory.armorInventory + .get(getEquipmentSlot(player.getHeldItem(hand)).getIndex()).isEmpty() && !player.isSneaking()) { + player.inventory.armorInventory.set(getEquipmentSlot(player.getHeldItem(hand)).getIndex(), + armor.copy()); player.setHeldItem(hand, ItemStack.EMPTY); player.playSound(new SoundEvent(new ResourceLocation("item.armor.equip_generic")), 1.0F, 1.0F); return ActionResult.newResult(EnumActionResult.SUCCESS, armor); @@ -233,7 +243,9 @@ public ActionResult onRightClick(World world, EntityPlayer player, En } @Override - public ISpecialArmor.ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, @Nonnull DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public ISpecialArmor.ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, + @Nonnull DamageSource source, double damage, + EntityEquipmentSlot equipmentSlot) { int damageLimit = (int) Math.min(Integer.MAX_VALUE, burnTimer * 1.0 / 32 * 25.0); if (source.isUnblockable()) return new ISpecialArmor.ArmorProperties(0, 0.0, 0); return new ISpecialArmor.ArmorProperties(0, 0, damageLimit); @@ -247,9 +259,11 @@ public int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int sl public class Behaviour implements IItemDurabilityManager, IItemCapabilityProvider, IItemBehaviour, ISubItemHandler { private static final IFilter JETPACK_FUEL_FILTER = new IFilter<>() { + @Override public boolean test(@Nonnull FluidStack fluidStack) { - return RecipeMaps.COMBUSTION_GENERATOR_FUELS.find(Collections.emptyList(), Collections.singletonList(fluidStack), (Objects::nonNull)) != null; + return RecipeMaps.COMBUSTION_GENERATOR_FUELS.find(Collections.emptyList(), + Collections.singletonList(fluidStack), (Objects::nonNull)) != null; } @Override @@ -268,7 +282,8 @@ public Behaviour(int internalCapacity) { @Override public double getDurabilityForDisplay(@Nonnull ItemStack itemStack) { - IFluidHandlerItem fluidHandlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = itemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) return 0; IFluidTankProperties fluidTankProperties = fluidHandlerItem.getTankProperties()[0]; FluidStack fluidStack = fluidTankProperties.getContents(); @@ -312,7 +327,8 @@ public String getItemSubType(ItemStack itemStack) { @Override public void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullList subItems) { ItemStack copy = itemStack.copy(); - IFluidHandlerItem fluidHandlerItem = copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = copy + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem != null) { fluidHandlerItem.fill(Materials.Diesel.getFluid(tankCapacity), true); subItems.add(copy); diff --git a/src/main/java/gregtech/common/items/armor/QuarkTechSuite.java b/src/main/java/gregtech/common/items/armor/QuarkTechSuite.java index 682899fed7b..93b914363ce 100644 --- a/src/main/java/gregtech/common/items/armor/QuarkTechSuite.java +++ b/src/main/java/gregtech/common/items/armor/QuarkTechSuite.java @@ -7,6 +7,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; import gregtech.common.items.MetaItems; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; @@ -28,12 +29,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.util.IdentityHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; + public class QuarkTechSuite extends ArmorLogicSuite implements IStepAssist { protected static final Map potionRemovalCost = new IdentityHashMap<>(); @@ -47,7 +49,7 @@ public QuarkTechSuite(EntityEquipmentSlot slot, int energyPerUse, long capacity, potionRemovalCost.put(MobEffects.POISON, 10000); potionRemovalCost.put(MobEffects.WITHER, 25000); if (ArmorUtils.SIDE.isClient() && this.shouldDrawHUD()) { - //noinspection NewExpressionSideOnly + // noinspection NewExpressionSideOnly HUD = new ArmorUtils.ModularHUD(); } } @@ -61,12 +63,15 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { NBTTagCompound data = GTUtility.getOrCreateNbtCompound(itemStack); byte toggleTimer = data.hasKey("toggleTimer") ? data.getByte("toggleTimer") : 0; - if (!player.getItemStackFromSlot(EntityEquipmentSlot.HEAD).isItemEqual(MetaItems.QUANTUM_HELMET.getStackForm())) { + if (!player.getItemStackFromSlot(EntityEquipmentSlot.HEAD) + .isItemEqual(MetaItems.QUANTUM_HELMET.getStackForm())) { disableNightVision(world, player, false); - } else if (!player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isItemEqual(MetaItems.QUANTUM_CHESTPLATE.getStackForm()) && - !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isItemEqual(MetaItems.QUANTUM_CHESTPLATE_ADVANCED.getStackForm())) { - if (!world.isRemote) player.isImmuneToFire = false; - } + } else if (!player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) + .isItemEqual(MetaItems.QUANTUM_CHESTPLATE.getStackForm()) && + !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) + .isItemEqual(MetaItems.QUANTUM_CHESTPLATE_ADVANCED.getStackForm())) { + if (!world.isRemote) player.isImmuneToFire = false; + } boolean ret = false; if (SLOT == EntityEquipmentSlot.HEAD) { @@ -119,7 +124,8 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if (!nightvision && item.getCharge() >= 4) { nightvision = true; if (!world.isRemote) - player.sendStatusMessage(new TextComponentTranslation("metaarmor.qts.nightvision.enabled"), true); + player.sendStatusMessage(new TextComponentTranslation("metaarmor.qts.nightvision.enabled"), + true); } else if (nightvision) { nightvision = false; disableNightVision(world, player, true); @@ -149,7 +155,8 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if (player.isBurning()) player.extinguish(); } else if (SLOT == EntityEquipmentSlot.LEGS) { - if (item.canUse(energyPerUse / 100) && (player.onGround || player.isInWater()) && KeyBind.VANILLA_FORWARD.isKeyDown(player) && (player.isSprinting())) { + if (item.canUse(energyPerUse / 100) && (player.onGround || player.isInWater()) && + KeyBind.VANILLA_FORWARD.isKeyDown(player) && (player.isSprinting())) { byte consumerTicks = data.getByte("consumerTicks"); ++consumerTicks; if (consumerTicks >= 10) { @@ -166,21 +173,23 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { } } player.moveRelative(0.0F, 0.0F, 1.0F, speed); - } else if (item.canUse(energyPerUse / 100) && player.isInWater() && KeyBind.VANILLA_SNEAK.isKeyDown(player) || KeyBind.VANILLA_JUMP.isKeyDown(player)) { - byte consumerTicks = data.getByte("consumerTicks"); - ++consumerTicks; - if (consumerTicks >= 10) { - consumerTicks = 0; - item.discharge(energyPerUse / 100, item.getTier(), true, false, false); - ret = true; - } - data.setByte("consumerTicks", consumerTicks); - double acceleration = 0.085D; - if (KeyBind.VANILLA_SNEAK.isKeyDown(player)) - player.motionY -= acceleration; - if (KeyBind.VANILLA_JUMP.isKeyDown(player)) - player.motionY += acceleration; - } + } else + if (item.canUse(energyPerUse / 100) && player.isInWater() && KeyBind.VANILLA_SNEAK.isKeyDown(player) || + KeyBind.VANILLA_JUMP.isKeyDown(player)) { + byte consumerTicks = data.getByte("consumerTicks"); + ++consumerTicks; + if (consumerTicks >= 10) { + consumerTicks = 0; + item.discharge(energyPerUse / 100, item.getTier(), true, false, false); + ret = true; + } + data.setByte("consumerTicks", consumerTicks); + double acceleration = 0.085D; + if (KeyBind.VANILLA_SNEAK.isKeyDown(player)) + player.motionY -= acceleration; + if (KeyBind.VANILLA_JUMP.isKeyDown(player)) + player.motionY += acceleration; + } } else if (SLOT == EntityEquipmentSlot.FEET) { if (!world.isRemote) { boolean onGround = !data.hasKey("onGround") || data.getBoolean("onGround"); @@ -222,12 +231,14 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { public static void disableNightVision(@Nonnull World world, EntityPlayer player, boolean sendMsg) { if (!world.isRemote) { player.removePotionEffect(MobEffects.NIGHT_VISION); - if (sendMsg) player.sendStatusMessage(new TextComponentTranslation("metaarmor.qts.nightvision.disabled"), true); + if (sendMsg) + player.sendStatusMessage(new TextComponentTranslation("metaarmor.qts.nightvision.disabled"), true); } } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { int damageLimit = Integer.MAX_VALUE; IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (item == null) { @@ -250,12 +261,15 @@ public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack } @Override - public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { - return source != DamageSource.FALL && source != DamageSource.DROWN && source != DamageSource.STARVE && source != DamageSource.OUT_OF_WORLD; + public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { + return source != DamageSource.FALL && source != DamageSource.DROWN && source != DamageSource.STARVE && + source != DamageSource.OUT_OF_WORLD; } @Override - public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack itemStack, DamageSource source, int damage, EntityEquipmentSlot equipmentSlot) { + public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack itemStack, DamageSource source, int damage, + EntityEquipmentSlot equipmentSlot) { IElectricItem item = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (item == null) { return; @@ -265,7 +279,8 @@ public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack itemStack, D @Override public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { - ItemStack currentChest = Minecraft.getMinecraft().player.inventory.armorItemInSlot(EntityEquipmentSlot.CHEST.getIndex()); + ItemStack currentChest = Minecraft.getMinecraft().player.inventory + .armorItemInSlot(EntityEquipmentSlot.CHEST.getIndex()); ItemStack advancedChest = MetaItems.QUANTUM_CHESTPLATE_ADVANCED.getStackForm(); String armorTexture = "quark_tech_suite"; if (advancedChest.isItemEqual(currentChest)) armorTexture = "advanced_quark_tech_suite"; diff --git a/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java b/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java index 1dfc3d10f62..9e110edccb3 100644 --- a/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java @@ -9,15 +9,18 @@ import gregtech.api.unification.material.Materials; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.util.LocalizationUtils; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.Constants.NBT; -import javax.annotation.Nonnull; import java.util.List; -public abstract class AbstractMaterialPartBehavior implements IItemBehaviour, IItemDurabilityManager, IItemColorProvider, IItemNameProvider { +import javax.annotation.Nonnull; + +public abstract class AbstractMaterialPartBehavior implements IItemBehaviour, IItemDurabilityManager, + IItemColorProvider, IItemNameProvider { protected static NBTTagCompound getPartStatsTag(ItemStack itemStack) { return itemStack.getSubCompound("GT.PartStats"); diff --git a/src/main/java/gregtech/common/items/behaviors/AbstractUsableBehaviour.java b/src/main/java/gregtech/common/items/behaviors/AbstractUsableBehaviour.java index 441b8565e5e..1b7528c0c59 100644 --- a/src/main/java/gregtech/common/items/behaviors/AbstractUsableBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/AbstractUsableBehaviour.java @@ -1,6 +1,7 @@ package gregtech.common.items.behaviors; import gregtech.api.items.metaitem.stats.IItemBehaviour; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -20,10 +21,10 @@ public boolean useItemDurability(EntityPlayer player, EnumHand hand, ItemStack s if (!player.capabilities.isCreativeMode) { if (--usesLeft <= 0) { if (replacementStack.isEmpty()) { - //if replacement stack is empty, just shrink resulting stack + // if replacement stack is empty, just shrink resulting stack stack.shrink(1); } else { - //otherwise, update held item to replacement stack + // otherwise, update held item to replacement stack player.setHeldItem(hand, replacementStack); } return true; @@ -48,5 +49,4 @@ public static void setUsesLeft(ItemStack itemStack, int usesLeft) { } tagCompound.setInteger("GT.UsesLeft", usesLeft); } - } diff --git a/src/main/java/gregtech/common/items/behaviors/ClipboardBehavior.java b/src/main/java/gregtech/common/items/behaviors/ClipboardBehavior.java index 492a08d5d03..3100a76249e 100644 --- a/src/main/java/gregtech/common/items/behaviors/ClipboardBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ClipboardBehavior.java @@ -1,6 +1,5 @@ package gregtech.common.items.behaviors; -import codechicken.lib.raytracer.RayTracer; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.widgets.ClickButtonWidget; @@ -13,6 +12,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.items.MetaItems; import gregtech.common.metatileentities.MetaTileEntityClipboard; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; @@ -26,6 +26,8 @@ import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; +import codechicken.lib.raytracer.RayTracer; + import java.util.ArrayList; import java.util.List; @@ -33,6 +35,7 @@ import static gregtech.common.metatileentities.MetaTileEntities.CLIPBOARD_TILE; public class ClipboardBehavior implements IItemBehaviour, ItemUIFactory { + public static final int MAX_PAGES = 25; private static final int TEXT_COLOR = 0x1E1E1E; @@ -55,9 +58,10 @@ public ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlaye () -> getButtonState(holder, finalI), (x) -> setButton(holder, finalI, x))); builder.image(32, 58 + 22 * i, 140, 12, GuiTextures.CLIPBOARD_TEXT_BOX); - textFields.add(new TextFieldWidget2(34, 60 + 22 * i, 136, 9, () -> getString(holder, finalI), val -> setString(holder, finalI, val)) - .setMaxLength(23) - .setTextColor(TEXT_COLOR)); + textFields.add(new TextFieldWidget2(34, 60 + 22 * i, 136, 9, () -> getString(holder, finalI), + val -> setString(holder, finalI, val)) + .setMaxLength(23) + .setTextColor(TEXT_COLOR)); } for (TextFieldWidget2 textField : textFields) { @@ -79,20 +83,22 @@ public ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlaye return builder.build(holder, entityPlayer); } - public static ModularUI createMTEUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer) { // So that people don't click on any text fields + public static ModularUI createMTEUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer) { // So that people + // don't click on any + // text fields initNBT(holder.getCurrentItem()); ModularUI.Builder builder = ModularUI.builder(GuiTextures.CLIPBOARD_PAPER_BACKGROUND, 170, 238); builder.image(18, 8, 130, 14, GuiTextures.CLIPBOARD_TEXT_BOX); builder.widget(new SimpleTextWidget(20, 10, "", TEXT_COLOR, () -> getTitle(holder), true).setCenter(false)); - for (int i = 0; i < 8; i++) { int finalI = i; builder.widget(new ImageCycleButtonWidget(6, 37 + 20 * i, 15, 15, GuiTextures.CLIPBOARD_BUTTON, 4, () -> getButtonState(holder, finalI), (x) -> setButton(holder, finalI, x))); builder.image(22, 38 + 20 * i, 140, 12, GuiTextures.CLIPBOARD_TEXT_BOX); - builder.widget(new SimpleTextWidget(24, 40 + 20 * i, "", TEXT_COLOR, () -> getString(holder, finalI), true).setCenter(false)); + builder.widget(new SimpleTextWidget(24, 40 + 20 * i, "", TEXT_COLOR, () -> getString(holder, finalI), true) + .setCenter(false)); } builder.widget(new ClickButtonWidget(30, 200, 16, 16, "", (x) -> incrPageNum(holder, x.isShiftClick ? -10 : -1)) @@ -227,7 +233,11 @@ private static void incrPageNum(PlayerInventoryHolder holder, int increment) { @Override public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack heldItem = player.getHeldItem(hand); - if (!world.isRemote && RayTracer.retrace(player).typeOfHit != RayTraceResult.Type.BLOCK) { // So that the player doesn't place a clipboard before suddenly getting the GUI + if (!world.isRemote && RayTracer.retrace(player).typeOfHit != RayTraceResult.Type.BLOCK) { // So that the player + // doesn't place a + // clipboard before + // suddenly getting + // the GUI PlayerInventoryHolder holder = new PlayerInventoryHolder(player, hand); holder.openUI(); } @@ -235,7 +245,8 @@ public ActionResult onItemRightClick(World world, EntityPlayer player } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { if (!world.isRemote && facing.getAxis() != EnumFacing.Axis.Y) { ItemStack heldItem = player.getHeldItem(hand).copy(); heldItem.setCount(1); // don't place multiple items at a time @@ -254,7 +265,8 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block // And manipulate it to our liking IGregTechTileEntity holder = (IGregTechTileEntity) world.getTileEntity(shiftedPos); if (holder != null) { - MetaTileEntityClipboard clipboard = (MetaTileEntityClipboard) holder.setMetaTileEntity(CLIPBOARD_TILE); + MetaTileEntityClipboard clipboard = (MetaTileEntityClipboard) holder + .setMetaTileEntity(CLIPBOARD_TILE); if (clipboard != null) { clipboard.initializeClipboard(heldItem); clipboard.setFrontFacing(facing.getOpposite()); diff --git a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java index 18bae3d88ca..a3b48ebc133 100644 --- a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java @@ -1,7 +1,5 @@ package gregtech.common.items.behaviors; -import appeng.api.util.AEColor; -import appeng.tile.networking.TileCableBus; import gregtech.api.GTValues; import gregtech.api.items.metaitem.stats.IItemDurabilityManager; import gregtech.api.metatileentity.MetaTileEntity; @@ -9,6 +7,7 @@ import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.util.GradientUtil; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.Block; import net.minecraft.block.BlockColored; import net.minecraft.block.BlockStainedGlass; @@ -25,12 +24,16 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.Loader; + +import appeng.api.util.AEColor; +import appeng.tile.networking.TileCableBus; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.awt.*; import java.util.List; +import javax.annotation.Nullable; + public class ColorSprayBehaviour extends AbstractUsableBehaviour implements IItemDurabilityManager { private final ItemStack empty; @@ -48,7 +51,8 @@ public ColorSprayBehaviour(ItemStack empty, int totalUses, int color) { } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (!player.canPlayerEdit(pos, facing, stack)) { return ActionResult.newResult(EnumActionResult.FAIL, player.getHeldItem(hand)); @@ -57,7 +61,8 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } useItemDurability(player, hand, stack, empty.copy()); - world.playSound(null, player.posX, player.posY, player.posZ, GTSoundEvents.SPRAY_CAN_TOOL, SoundCategory.PLAYERS, 1.0f, 1.0f); + world.playSound(null, player.posX, player.posY, player.posZ, GTSoundEvents.SPRAY_CAN_TOOL, + SoundCategory.PLAYERS, 1.0f, 1.0f); return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); } @@ -104,7 +109,8 @@ private boolean tryPaintSpecialBlock(EntityPlayer player, World world, BlockPos } @SuppressWarnings("unchecked, rawtypes") - private static boolean tryStripBlockColor(EntityPlayer player, World world, BlockPos pos, Block block, EnumFacing side) { + private static boolean tryStripBlockColor(EntityPlayer player, World world, BlockPos pos, Block block, + EnumFacing side) { // MC special cases if (block == Blocks.STAINED_GLASS) { world.setBlockState(pos, Blocks.GLASS.getDefaultState()); diff --git a/src/main/java/gregtech/common/items/behaviors/CoverDigitalInterfaceWirelessPlaceBehaviour.java b/src/main/java/gregtech/common/items/behaviors/CoverDigitalInterfaceWirelessPlaceBehaviour.java index df452695dc8..44ae32d3a66 100644 --- a/src/main/java/gregtech/common/items/behaviors/CoverDigitalInterfaceWirelessPlaceBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/CoverDigitalInterfaceWirelessPlaceBehaviour.java @@ -5,6 +5,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.handler.BlockPosHighlightRenderer; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -23,6 +24,7 @@ import java.util.List; public class CoverDigitalInterfaceWirelessPlaceBehaviour extends CoverItemBehavior { + public CoverDigitalInterfaceWirelessPlaceBehaviour(CoverDefinition coverDefinition) { super(coverDefinition); } @@ -59,9 +61,11 @@ public void onUpdate(ItemStack itemStack, Entity entity) { } @Override - public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, + float hitY, float hitZ, EnumHand hand) { TileEntity tileEntity = world.getTileEntity(pos); - if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityCentralMonitor) { + if (tileEntity instanceof IGregTechTileEntity && + ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityCentralMonitor) { ItemStack itemStack = player.getHeldItem(hand); itemStack.setTagCompound(NBTUtil.createPosTag(pos)); NBTTagCompound tag = itemStack.getTagCompound(); diff --git a/src/main/java/gregtech/common/items/behaviors/DataItemBehavior.java b/src/main/java/gregtech/common/items/behaviors/DataItemBehavior.java index 2dd9805fbfe..04532515be4 100644 --- a/src/main/java/gregtech/common/items/behaviors/DataItemBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/DataItemBehavior.java @@ -6,14 +6,17 @@ import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.machines.IResearchRecipeMap; import gregtech.api.util.AssemblyLineManager; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.Collection; import java.util.List; +import javax.annotation.Nonnull; + public class DataItemBehavior implements IItemBehaviour, IDataItem { private final boolean requireDataBank; @@ -35,7 +38,8 @@ public boolean requireDataBank() { public void addInformation(@Nonnull ItemStack itemStack, List lines) { String researchId = AssemblyLineManager.readResearchId(itemStack); if (researchId == null) return; - Collection recipes = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES).getDataStickEntry(researchId); + Collection recipes = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES) + .getDataStickEntry(researchId); if (recipes != null && !recipes.isEmpty()) { lines.add(I18n.format("behavior.data_item.assemblyline.title")); Collection added = new ObjectOpenHashSet<>(); diff --git a/src/main/java/gregtech/common/items/behaviors/DoorBehavior.java b/src/main/java/gregtech/common/items/behaviors/DoorBehavior.java index 8c6e45bd159..d54b2e558a0 100644 --- a/src/main/java/gregtech/common/items/behaviors/DoorBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/DoorBehavior.java @@ -1,6 +1,7 @@ package gregtech.common.items.behaviors; import gregtech.api.items.metaitem.stats.IItemBehaviour; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.entity.player.EntityPlayer; @@ -19,7 +20,8 @@ public DoorBehavior(Block block) { } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { // Copied from ItemDoor ItemStack stack = player.getHeldItem(hand); if (facing != EnumFacing.UP) { @@ -37,8 +39,10 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block playerFacing.getZOffset() < 0 && hitX > 0.5f || playerFacing.getZOffset() > 0 && hitX < 0.5f; ItemDoor.placeDoor(world, pos, playerFacing, this.block, isRightHinge); - SoundType soundType = world.getBlockState(pos).getBlock().getSoundType(world.getBlockState(pos), world, pos, player); - world.playSound(player, pos, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1) / 2, soundType.getPitch() * 0.8f); + SoundType soundType = world.getBlockState(pos).getBlock().getSoundType(world.getBlockState(pos), world, pos, + player); + world.playSound(player, pos, soundType.getPlaceSound(), SoundCategory.BLOCKS, + (soundType.getVolume() + 1) / 2, soundType.getPitch() * 0.8f); if (!player.isCreative()) { stack.shrink(1); } diff --git a/src/main/java/gregtech/common/items/behaviors/DynamiteBehaviour.java b/src/main/java/gregtech/common/items/behaviors/DynamiteBehaviour.java index f53dfd82cb2..d2684bc31e8 100644 --- a/src/main/java/gregtech/common/items/behaviors/DynamiteBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/DynamiteBehaviour.java @@ -2,6 +2,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.common.entities.DynamiteEntity; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; diff --git a/src/main/java/gregtech/common/items/behaviors/FacadeItem.java b/src/main/java/gregtech/common/items/behaviors/FacadeItem.java index 1cdfe1f047d..81008400cd9 100644 --- a/src/main/java/gregtech/common/items/behaviors/FacadeItem.java +++ b/src/main/java/gregtech/common/items/behaviors/FacadeItem.java @@ -1,11 +1,11 @@ package gregtech.common.items.behaviors; -import com.google.common.collect.ImmutableList; import gregtech.api.items.metaitem.stats.IItemNameProvider; import gregtech.api.items.metaitem.stats.ISubItemHandler; import gregtech.api.util.LocalizationUtils; import gregtech.common.ConfigHolder; import gregtech.common.covers.facade.FacadeHelper; + import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -15,6 +15,8 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.Constants.NBT; +import com.google.common.collect.ImmutableList; + import java.util.List; import java.util.Objects; @@ -46,7 +48,8 @@ public void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullLi public String getItemSubType(ItemStack itemStack) { ItemStack facadeStack = getFacadeStack(itemStack); ResourceLocation registryName = Objects.requireNonNull(facadeStack.getItem().getRegistryName()); - return String.format("%s:%s@%d", registryName.getNamespace(), registryName.getPath(), Items.FEATHER.getDamage(facadeStack)); + return String.format("%s:%s@%d", registryName.getNamespace(), registryName.getPath(), + Items.FEATHER.getDamage(facadeStack)); } public static void setFacadeStack(ItemStack itemStack, ItemStack facadeStack) { diff --git a/src/main/java/gregtech/common/items/behaviors/FertilizerBehavior.java b/src/main/java/gregtech/common/items/behaviors/FertilizerBehavior.java index 4e2648f9266..2ac30b9d2aa 100644 --- a/src/main/java/gregtech/common/items/behaviors/FertilizerBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/FertilizerBehavior.java @@ -1,6 +1,7 @@ package gregtech.common.items.behaviors; import gregtech.api.items.metaitem.stats.IItemBehaviour; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; @@ -14,7 +15,8 @@ public class FertilizerBehavior implements IItemBehaviour { @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = player.getHeldItem(hand); if (!player.canPlayerEdit(pos.offset(facing), facing, heldItem)) { return ActionResult.newResult(EnumActionResult.FAIL, heldItem); diff --git a/src/main/java/gregtech/common/items/behaviors/FoamSprayerBehavior.java b/src/main/java/gregtech/common/items/behaviors/FoamSprayerBehavior.java index 83304faf8d6..8d8d7541a25 100644 --- a/src/main/java/gregtech/common/items/behaviors/FoamSprayerBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/FoamSprayerBehavior.java @@ -11,7 +11,7 @@ import gregtech.api.util.GradientUtil; import gregtech.common.blocks.BlockFrame; import gregtech.common.blocks.MetaBlocks; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -25,16 +25,20 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.IFluidTankProperties; + +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.awt.*; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Set; -public class FoamSprayerBehavior implements IItemCapabilityProvider, IItemDurabilityManager, IItemBehaviour, ISubItemHandler { +import javax.annotation.Nullable; + +public class FoamSprayerBehavior implements IItemCapabilityProvider, IItemDurabilityManager, IItemBehaviour, + ISubItemHandler { private static final int FLUID_PER_BLOCK = 100; @@ -45,9 +49,11 @@ public FoamSprayerBehavior() { } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack itemStack = player.getHeldItem(hand); - IFluidHandlerItem fluidHandlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = itemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) { return ActionResult.newResult(EnumActionResult.FAIL, itemStack); } @@ -80,7 +86,8 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block @Override public double getDurabilityForDisplay(ItemStack itemStack) { - IFluidHandlerItem fluidHandlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = itemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) return 0; IFluidTankProperties fluidTankProperties = fluidHandlerItem.getTankProperties()[0]; FluidStack fluidStack = fluidTankProperties.getContents(); @@ -103,7 +110,7 @@ private static int foamAllFrameBlocks(World world, BlockPos pos, int maxBlocksTo List frameBlocks = gatherFrameBlocks(world, pos, 1024); frameBlocks = frameBlocks.subList(0, Math.min(frameBlocks.size(), maxBlocksToFoam)); - //replace blocks without updating physics + // replace blocks without updating physics for (BlockPos framePos : frameBlocks) { IBlockState blockState = world.getBlockState(framePos); boolean isNormalFrame = isSneaking || @@ -111,11 +118,12 @@ private static int foamAllFrameBlocks(World world, BlockPos pos, int maxBlocksTo if (isNormalFrame) { blockState.getBlock().dropBlockAsItem(world, framePos, blockState, 0); } - IBlockState foamToPlace = isNormalFrame ? MetaBlocks.FOAM.getDefaultState() : MetaBlocks.REINFORCED_FOAM.getDefaultState(); + IBlockState foamToPlace = isNormalFrame ? MetaBlocks.FOAM.getDefaultState() : + MetaBlocks.REINFORCED_FOAM.getDefaultState(); world.setBlockState(framePos, foamToPlace, 2); } - //perform block physics updates + // perform block physics updates for (BlockPos blockPos : frameBlocks) { IBlockState blockState = world.getBlockState(blockPos); world.notifyNeighborsRespectDebug(blockPos, blockState.getBlock(), true); @@ -128,11 +136,11 @@ private static int foamReplacableBlocks(World world, BlockPos pos, int maxBlocks replacableBlocks = replacableBlocks.subList(0, Math.min(replacableBlocks.size(), maxBlocksToFoam)); for (BlockPos blockPos : replacableBlocks) { - //foaming air blocks doesn't cause updates of other blocks, so just proceed + // foaming air blocks doesn't cause updates of other blocks, so just proceed world.setBlockState(blockPos, MetaBlocks.FOAM.getDefaultState(), 2); } - //perform block physics updates + // perform block physics updates for (BlockPos blockPos : replacableBlocks) { IBlockState blockState = world.getBlockState(blockPos); world.notifyNeighborsRespectDebug(pos, blockState.getBlock(), true); @@ -152,7 +160,8 @@ private static List gatherReplacableBlocks(World world, BlockPos cente for (EnumFacing facing : EnumFacing.VALUES) { currentPos.move(facing); IBlockState blockStateHere = world.getBlockState(currentPos); - //if there is node, and it can connect with previous node, add it to list, and set previous node as current + // if there is node, and it can connect with previous node, add it to list, and set previous node as + // current if (blockStateHere.getBlock().isReplaceable(world, currentPos) && currentPos.distanceSq(centerPos) <= maxRadiusSq && !observedSet.contains(currentPos)) { BlockPos immutablePos = currentPos.toImmutable(); @@ -183,7 +192,8 @@ private static List gatherFrameBlocks(World world, BlockPos centerPos, for (EnumFacing facing : EnumFacing.VALUES) { currentPos.move(facing); IBlockState blockStateHere = world.getBlockState(currentPos); - //if there is node, and it can connect with previous node, add it to list, and set previous node as current + // if there is node, and it can connect with previous node, add it to list, and set previous node as + // current if (blockStateHere.getBlock() instanceof BlockFrame && currentPos.distanceSq(centerPos) <= maxRadiusSq && (frameState == null || frameState == blockStateHere) && !observedSet.contains(currentPos)) { @@ -211,7 +221,8 @@ public String getItemSubType(ItemStack itemStack) { @Override public void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullList subItems) { ItemStack copy = itemStack.copy(); - IFluidHandlerItem fluidHandlerItem = copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (fluidHandlerItem != null) { fluidHandlerItem.fill(Materials.ConstructionFoam.getFluid(10000), true); subItems.add(copy); diff --git a/src/main/java/gregtech/common/items/behaviors/GTBoatBehavior.java b/src/main/java/gregtech/common/items/behaviors/GTBoatBehavior.java index 24cf2763414..2c89da1475d 100644 --- a/src/main/java/gregtech/common/items/behaviors/GTBoatBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/GTBoatBehavior.java @@ -3,6 +3,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.common.entities.GTBoatEntity; import gregtech.common.entities.GTBoatEntity.GTBoatType; + import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -27,7 +28,8 @@ public GTBoatBehavior(GTBoatType type) { } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { // almost exact copy of ItemBoat#onItemRightClick ItemStack stack = player.getHeldItem(hand); float realPitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch); @@ -68,7 +70,8 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block Block block = world.getBlockState(ray.getBlockPos()).getBlock(); boolean rayHitWater = block == Blocks.WATER || block == Blocks.FLOWING_WATER; - GTBoatEntity boat = new GTBoatEntity(world, ray.hitVec.x, rayHitWater ? ray.hitVec.y - 0.12 : ray.hitVec.y, ray.hitVec.z); + GTBoatEntity boat = new GTBoatEntity(world, ray.hitVec.x, rayHitWater ? ray.hitVec.y - 0.12 : ray.hitVec.y, + ray.hitVec.z); boat.setGTBoatType(this.type); boat.rotationYaw = player.rotationYaw; diff --git a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java index 23a4bf7b059..0588cfc1b83 100644 --- a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java @@ -12,6 +12,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.recipes.ingredients.IntCircuitIngredient; import gregtech.api.util.GTUtility; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -31,7 +32,8 @@ public void addInformation(ItemStack itemStack, List lines) { } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { MetaTileEntity mte = GTUtility.getMetaTileEntity(world, pos); ItemStack stack = player.getHeldItem(hand); @@ -57,11 +59,17 @@ public ActionResult onItemRightClick(World world, EntityPlayer player public ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer) { return ModularUI.builder(GuiTextures.BACKGROUND, 176, 60) .label(9, 8, "metaitem.circuit.integrated.gui") - .widget(new DynamicLabelWidget(82, 30, () -> Integer.toString(IntCircuitIngredient.getCircuitConfiguration(holder.getCurrentItem())), 0x4D4040)) - .widget(new ClickButtonWidget(15, 24, 20, 20, "-5", data -> IntCircuitIngredient.adjustConfiguration(holder, -5))) - .widget(new ClickButtonWidget(50, 24, 20, 20, "-1", data -> IntCircuitIngredient.adjustConfiguration(holder, -1))) - .widget(new ClickButtonWidget(104, 24, 20, 20, "+1", data -> IntCircuitIngredient.adjustConfiguration(holder, +1))) - .widget(new ClickButtonWidget(141, 24, 20, 20, "+5", data -> IntCircuitIngredient.adjustConfiguration(holder, +5))) + .widget(new DynamicLabelWidget(82, 30, + () -> Integer.toString(IntCircuitIngredient.getCircuitConfiguration(holder.getCurrentItem())), + 0x4D4040)) + .widget(new ClickButtonWidget(15, 24, 20, 20, "-5", + data -> IntCircuitIngredient.adjustConfiguration(holder, -5))) + .widget(new ClickButtonWidget(50, 24, 20, 20, "-1", + data -> IntCircuitIngredient.adjustConfiguration(holder, -1))) + .widget(new ClickButtonWidget(104, 24, 20, 20, "+1", + data -> IntCircuitIngredient.adjustConfiguration(holder, +1))) + .widget(new ClickButtonWidget(141, 24, 20, 20, "+5", + data -> IntCircuitIngredient.adjustConfiguration(holder, +5))) .build(holder, entityPlayer); } diff --git a/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java b/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java index 215fc99755e..8d12bdc0f9b 100644 --- a/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java @@ -6,6 +6,7 @@ import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.integration.baubles.BaublesModule; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -28,9 +29,10 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class ItemMagnetBehavior implements IItemBehaviour { private final int range; @@ -45,7 +47,8 @@ public ItemMagnetBehavior(int range) { @Override public ActionResult onItemRightClick(World world, @Nonnull EntityPlayer player, EnumHand hand) { if (!player.world.isRemote && player.isSneaking()) { - player.sendStatusMessage(new TextComponentTranslation(toggleActive(player.getHeldItem(hand)) ? "behavior.item_magnet.enabled" : "behavior.item_magnet.disabled"), true); + player.sendStatusMessage(new TextComponentTranslation(toggleActive(player.getHeldItem(hand)) ? + "behavior.item_magnet.enabled" : "behavior.item_magnet.disabled"), true); } return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } @@ -69,7 +72,7 @@ private static boolean toggleActive(ItemStack stack) { if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } - //noinspection ConstantConditions + // noinspection ConstantConditions stack.getTagCompound().setBoolean("IsActive", !isActive); return !isActive; } @@ -78,13 +81,16 @@ private static boolean toggleActive(ItemStack stack) { public void onUpdate(ItemStack stack, Entity entity) { // Adapted logic from Draconic Evolution // https://github.com/Draconic-Inc/Draconic-Evolution/blob/1.12.2/src/main/java/com/brandon3055/draconicevolution/items/tools/Magnet.java - if (!entity.isSneaking() && entity.ticksExisted % 10 == 0 && isActive(stack) && entity instanceof EntityPlayer player) { + if (!entity.isSneaking() && entity.ticksExisted % 10 == 0 && isActive(stack) && + entity instanceof EntityPlayer player) { World world = entity.getEntityWorld(); if (!drainEnergy(true, stack, energyDraw)) { return; } - List items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ).grow(range, range, range)); + List items = world.getEntitiesWithinAABB(EntityItem.class, + new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ) + .grow(range, range, range)); boolean didMoveEntity = false; for (EntityItem itemEntity : items) { @@ -97,7 +103,8 @@ public void onUpdate(ItemStack stack, Entity entity) { continue; } - if (itemEntity.getThrower() != null && itemEntity.getThrower().equals(entity.getName()) && itemEntity.pickupDelay > 0) { + if (itemEntity.getThrower() != null && itemEntity.getThrower().equals(entity.getName()) && + itemEntity.pickupDelay > 0) { continue; } @@ -111,16 +118,21 @@ public void onUpdate(ItemStack stack, Entity entity) { itemEntity.pickupDelay = 0; } itemEntity.motionX = itemEntity.motionY = itemEntity.motionZ = 0; - itemEntity.setPosition(entity.posX - 0.2 + (world.rand.nextDouble() * 0.4), entity.posY - 0.6, entity.posZ - 0.2 + (world.rand.nextDouble() * 0.4)); + itemEntity.setPosition(entity.posX - 0.2 + (world.rand.nextDouble() * 0.4), entity.posY - 0.6, + entity.posZ - 0.2 + (world.rand.nextDouble() * 0.4)); didMoveEntity = true; } } if (didMoveEntity) { - world.playSound(null, entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 0.1F, 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 2F)); + world.playSound(null, entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, + SoundCategory.PLAYERS, 0.1F, + 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 2F)); } - List xp = world.getEntitiesWithinAABB(EntityXPOrb.class, new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ).grow(4, 4, 4)); + List xp = world.getEntitiesWithinAABB(EntityXPOrb.class, + new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ) + .grow(4, 4, 4)); for (EntityXPOrb orb : xp) { if (!world.isRemote && !orb.isDead) { @@ -128,7 +140,9 @@ public void onUpdate(ItemStack stack, Entity entity) { if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(player, orb))) { continue; } - world.playSound(null, entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 0.1F, 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.8F)); + world.playSound(null, entity.posX, entity.posY, entity.posZ, + SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 0.1F, + 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.8F)); player.onItemPickup(orb, 1); player.addExperience(orb.xpValue); orb.setDead(); @@ -162,7 +176,7 @@ public void onItemToss(@Nonnull ItemTossEvent event) { } private boolean isMagnet(@Nonnull ItemStack stack) { - if (stack.getItem() instanceof MetaItem metaItem) { + if (stack.getItem() instanceof MetaItemmetaItem) { for (var behavior : metaItem.getBehaviours(stack)) { if (behavior instanceof ItemMagnetBehavior) { return true; diff --git a/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java b/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java index 9b07671682f..807453d3333 100644 --- a/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java @@ -7,6 +7,7 @@ import gregtech.api.unification.material.Materials; import gregtech.api.util.GTUtility; import gregtech.api.util.GradientUtil; + import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.block.Block; import net.minecraft.block.BlockTNT; @@ -30,13 +31,15 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.IFluidTankProperties; + import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.awt.*; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class LighterBehaviour implements IItemBehaviour, IItemDurabilityManager, ISubItemHandler { private static final String LIGHTER_OPEN = "lighterOpen"; @@ -56,13 +59,15 @@ public LighterBehaviour(boolean usesFluid, boolean hasMultipleUses, boolean canO this(null, usesFluid, hasMultipleUses, canOpen); } - public LighterBehaviour(boolean usesFluid, boolean hasMultipleUses, boolean canOpen, Item destroyItem, int maxUses) { + public LighterBehaviour(boolean usesFluid, boolean hasMultipleUses, boolean canOpen, Item destroyItem, + int maxUses) { this(null, usesFluid, hasMultipleUses, canOpen); this.maxUses = maxUses; this.destroyItem = destroyItem; } - public LighterBehaviour(@Nullable ResourceLocation overrideLocation, boolean usesFluid, boolean hasMultipleUses, boolean canOpen) { + public LighterBehaviour(@Nullable ResourceLocation overrideLocation, boolean usesFluid, boolean hasMultipleUses, + boolean canOpen) { this.overrideLocation = overrideLocation; this.usesFluid = usesFluid; this.hasMultipleUses = hasMultipleUses; @@ -75,7 +80,8 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity en NBTTagCompound compound = GTUtility.getOrCreateNbtCompound(stack); // If this item does not have opening mechanics, or if it does and is currently open if ((!canOpen || compound.getBoolean(LIGHTER_OPEN)) && consumeFuel(player, stack)) { - player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 1.0F, GTValues.RNG.nextFloat() * 0.4F + 0.8F); + player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.ITEM_FLINTANDSTEEL_USE, + SoundCategory.PLAYERS, 1.0F, GTValues.RNG.nextFloat() * 0.4F + 0.8F); ((EntityCreeper) entity).ignite(); return true; } @@ -84,7 +90,8 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity en } @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, BlockPos pos, + EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); NBTTagCompound compound = GTUtility.getOrCreateNbtCompound(stack); @@ -97,7 +104,8 @@ public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull Wo if (!player.canPlayerEdit(pos, side, player.getHeldItem(hand))) return EnumActionResult.FAIL; // If this item does not have opening mechanics, or if it does and is currently open if ((!canOpen || compound.getBoolean(LIGHTER_OPEN)) && consumeFuel(player, stack)) { - player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 1.0F, GTValues.RNG.nextFloat() * 0.4F + 0.8F); + player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.ITEM_FLINTANDSTEEL_USE, + SoundCategory.PLAYERS, 1.0F, GTValues.RNG.nextFloat() * 0.4F + 0.8F); IBlockState blockState = world.getBlockState(pos); Block block = blockState.getBlock(); if (block instanceof BlockTNT) { @@ -141,7 +149,8 @@ public boolean consumeFuel(EntityPlayer entity, ItemStack stack) { private int getUsesLeft(@Nonnull ItemStack stack) { if (usesFluid) { - IFluidHandlerItem fluidHandlerItem = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = stack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) return 0; @@ -162,7 +171,8 @@ private int getUsesLeft(@Nonnull ItemStack stack) { private void setUsesLeft(EntityPlayer entity, @Nonnull ItemStack stack, int usesLeft) { if (usesFluid) { - IFluidHandlerItem fluidHandlerItem = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = stack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem != null) { FluidStack drained = fluidHandlerItem.drain(Integer.MAX_VALUE, false); if (drained != null) { @@ -185,7 +195,8 @@ private void setUsesLeft(EntityPlayer entity, @Nonnull ItemStack stack, int uses public void addPropertyOverride(@Nonnull Item item) { if (overrideLocation != null) { item.addPropertyOverride(overrideLocation, - (stack, world, entity) -> GTUtility.getOrCreateNbtCompound(stack).getBoolean(LIGHTER_OPEN) ? 1.0F : 0.0F); + (stack, world, entity) -> GTUtility.getOrCreateNbtCompound(stack).getBoolean(LIGHTER_OPEN) ? 1.0F : + 0.0F); } } @@ -193,7 +204,8 @@ public void addPropertyOverride(@Nonnull Item item) { public double getDurabilityForDisplay(ItemStack itemStack) { if (usesFluid) { // Lighters - IFluidHandlerItem fluidHandlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = itemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) return 0.0; IFluidTankProperties properties = fluidHandlerItem.getTankProperties()[0]; FluidStack fluidStack = properties.getContents(); @@ -242,7 +254,8 @@ public void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullLi if (usesFluid) { // Show Lighters as filled in JEI ItemStack copy = itemStack.copy(); - IFluidHandlerItem fluidHandlerItem = copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = copy + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem != null) { fluidHandlerItem.fill(Materials.Butane.getFluid(Integer.MAX_VALUE), true); subItems.add(copy); diff --git a/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java b/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java index d854f679a49..91686747900 100644 --- a/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java @@ -3,6 +3,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.util.GTUtility; import gregtech.common.items.behaviors.ModeSwitchBehavior.ILocalizationKey; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -13,6 +14,7 @@ import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; + import org.apache.commons.lang3.ArrayUtils; import java.util.List; @@ -53,7 +55,8 @@ public ActionResult onItemRightClick(World world, EntityPlayer player T nextMode = enumConstants[(currentModeIndex + 1) % enumConstants.length]; setModeForItemStack(itemStack, nextMode); ITextComponent newModeComponent = new TextComponentTranslation(nextMode.getUnlocalizedName()); - ITextComponent textComponent = new TextComponentTranslation("metaitem.behavior.mode_switch.mode_switched", newModeComponent); + ITextComponent textComponent = new TextComponentTranslation("metaitem.behavior.mode_switch.mode_switched", + newModeComponent); player.sendStatusMessage(textComponent, true); return ActionResult.newResult(EnumActionResult.SUCCESS, itemStack); } @@ -64,10 +67,12 @@ public ActionResult onItemRightClick(World world, EntityPlayer player public void addInformation(ItemStack itemStack, List lines) { T currentMode = getModeFromItemStack(itemStack); lines.add(I18n.format("metaitem.behavior.mode_switch.tooltip")); - lines.add(I18n.format("metaitem.behavior.mode_switch.current_mode", I18n.format(currentMode.getUnlocalizedName()))); + lines.add(I18n.format("metaitem.behavior.mode_switch.current_mode", + I18n.format(currentMode.getUnlocalizedName()))); } public interface ILocalizationKey { + String getUnlocalizedName(); } } diff --git a/src/main/java/gregtech/common/items/behaviors/MultiblockBuilderBehavior.java b/src/main/java/gregtech/common/items/behaviors/MultiblockBuilderBehavior.java index 9519e33cf71..2473d00ae53 100644 --- a/src/main/java/gregtech/common/items/behaviors/MultiblockBuilderBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/MultiblockBuilderBehavior.java @@ -6,6 +6,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.pattern.PatternError; import gregtech.api.util.GTUtility; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -21,13 +22,15 @@ import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class MultiblockBuilderBehavior implements IItemBehaviour { @Override - public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, + float hitY, float hitZ, EnumHand hand) { // Initial checks TileEntity tileEntity = world.getTileEntity(pos); if (!(tileEntity instanceof IGregTechTileEntity)) return EnumActionResult.PASS; @@ -50,7 +53,8 @@ public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPo if (!multiblock.isStructureFormed()) { PatternError error = multiblock.structurePattern.getError(); if (error != null) { - player.sendMessage(new TextComponentTranslation("gregtech.multiblock.pattern.error_message_header")); + player.sendMessage( + new TextComponentTranslation("gregtech.multiblock.pattern.error_message_header")); player.sendMessage(new TextComponentString(error.getErrorInfo())); return EnumActionResult.SUCCESS; } diff --git a/src/main/java/gregtech/common/items/behaviors/NanoSaberBehavior.java b/src/main/java/gregtech/common/items/behaviors/NanoSaberBehavior.java index fb74b635a26..f6555636fa7 100644 --- a/src/main/java/gregtech/common/items/behaviors/NanoSaberBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/NanoSaberBehavior.java @@ -1,10 +1,9 @@ package gregtech.common.items.behaviors; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; import gregtech.api.items.metaitem.stats.IEnchantabilityHelper; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; @@ -14,6 +13,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; + import java.util.UUID; public class NanoSaberBehavior extends ToggleEnergyConsumerBehavior implements IEnchantabilityHelper { @@ -36,8 +38,10 @@ public Multimap getAttributeModifiers(EntityEquipment HashMultimap modifiers = HashMultimap.create(); if (slot == EntityEquipmentSlot.MAINHAND) { double attackDamage = baseAttackDamage + (isItemActive(stack) ? additionalAttackDamage : 0.0D); - modifiers.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.0, 0)); - modifiers.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon Modifier", attackDamage, 0)); + modifiers.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), + new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.0, 0)); + modifiers.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), + new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon Modifier", attackDamage, 0)); } return modifiers; } diff --git a/src/main/java/gregtech/common/items/behaviors/ProspectorScannerBehavior.java b/src/main/java/gregtech/common/items/behaviors/ProspectorScannerBehavior.java index 78bc38c653d..6e2360254b2 100644 --- a/src/main/java/gregtech/common/items/behaviors/ProspectorScannerBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ProspectorScannerBehavior.java @@ -15,6 +15,7 @@ import gregtech.common.terminal.app.prospector.widget.WidgetOreList; import gregtech.common.terminal.app.prospector.widget.WidgetProspectingMap; import gregtech.common.terminal.component.SearchComponent; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -27,12 +28,13 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; -import javax.annotation.Nonnull; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.function.Consumer; +import javax.annotation.Nonnull; + public class ProspectorScannerBehavior implements IItemBehaviour, ItemUIFactory, SearchComponent.IWidgetSearch { private static final long VOLTAGE_FACTOR = 16L; @@ -112,11 +114,13 @@ public ModularUI createUI(PlayerInventoryHolder holder, @Nonnull EntityPlayer en this.widgetOreList = new WidgetOreList(32 * radius - 6, 18, 332 - 32 * radius, 176); builder.widget(this.widgetOreList); builder.widget(new WidgetProspectingMap(6, 18, radius, this.widgetOreList, mode, 1)); - //Cardinal directions + // Cardinal directions builder.widget(new LabelWidget(3 + (16 * (radius * 2 - 1)) / 2, 14, "N", 0xAAAAAA).setShadow(true)); - builder.widget(new LabelWidget(3 + (16 * (radius * 2 - 1)) / 2, 14 + 16 * (radius * 2 - 1), "S", 0xAAAAAA).setShadow(true)); + builder.widget(new LabelWidget(3 + (16 * (radius * 2 - 1)) / 2, 14 + 16 * (radius * 2 - 1), "S", 0xAAAAAA) + .setShadow(true)); builder.widget(new LabelWidget(3, 15 + (16 * (radius * 2 - 1)) / 2, "W", 0xAAAAAA).setShadow(true)); - builder.widget(new LabelWidget(3 + 16 * (radius * 2 - 1), 15 + (16 * (radius * 2 - 1)) / 2, "E", 0xAAAAAA).setShadow(true)); + builder.widget(new LabelWidget(3 + 16 * (radius * 2 - 1), 15 + (16 * (radius * 2 - 1)) / 2, "E", 0xAAAAAA) + .setShadow(true)); return builder.label(6, 6, getTranslationKey()).build(holder, entityPlayer); } @@ -170,7 +174,8 @@ public void onUpdate(ItemStack itemStack, Entity entity) { if (player.openContainer instanceof ModularUIContainer) { ModularUIContainer modularUIContainer = (ModularUIContainer) player.openContainer; if (modularUIContainer.getModularUI().holder instanceof PlayerInventoryHolder) { - if (((PlayerInventoryHolder) (modularUIContainer).getModularUI().holder).getCurrentItem() == itemStack) { + if (((PlayerInventoryHolder) (modularUIContainer).getModularUI().holder).getCurrentItem() == + itemStack) { if (!player.isCreative()) { if (checkCanUseScanner(itemStack, player, true)) drainEnergy(itemStack, GTValues.V[tier] / VOLTAGE_FACTOR, false); diff --git a/src/main/java/gregtech/common/items/behaviors/TerminalBehaviour.java b/src/main/java/gregtech/common/items/behaviors/TerminalBehaviour.java index 4d490c087eb..6ffc8919a40 100644 --- a/src/main/java/gregtech/common/items/behaviors/TerminalBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/TerminalBehaviour.java @@ -13,6 +13,7 @@ import gregtech.api.terminal.hardware.HardwareProvider; import gregtech.api.terminal.os.TerminalOSWidget; import gregtech.common.terminal.hardware.BatteryHardware; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -30,7 +31,8 @@ public class TerminalBehaviour implements IItemBehaviour, ItemUIFactory, ISubItemHandler { @Override - public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, + float hitY, float hitZ, EnumHand hand) { if (player.isSneaking()) { ItemStack itemStack = player.getHeldItem(hand); itemStack.getOrCreateSubCompound("terminal").removeTag("_click"); @@ -63,7 +65,8 @@ public void onUpdate(ItemStack itemStack, Entity entity) { if (entity.ticksExisted % 20 == 0 && tabletNBT.hasKey("_ar")) { if (entity instanceof EntityLivingBase) { EntityLivingBase livingBase = (EntityLivingBase) entity; - if (!livingBase.getHeldItemMainhand().isItemEqual(itemStack) && !livingBase.getHeldItemOffhand().isItemEqual(itemStack)) { + if (!livingBase.getHeldItemMainhand().isItemEqual(itemStack) && + !livingBase.getHeldItemOffhand().isItemEqual(itemStack)) { return; } } @@ -81,7 +84,8 @@ public void onUpdate(ItemStack itemStack, Entity entity) { } } if (cost > 0) { - IElectricItem electricItem = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem electricItem = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (electricItem != null) { long back = electricItem.discharge(cost, 999, true, false, false); if (back != cost) { diff --git a/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java b/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java index e2ba3d85ed0..d8ef0816dfa 100644 --- a/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java @@ -3,6 +3,7 @@ import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IElectricItem; import gregtech.api.items.metaitem.stats.IItemBehaviour; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -39,7 +40,8 @@ public ActionResult onItemRightClick(World world, EntityPlayer player } private boolean drainActivationEnergy(IElectricItem electricItem, boolean simulate) { - return electricItem.discharge(energyUsagePerTick, electricItem.getTier(), true, false, simulate) >= energyUsagePerTick; + return electricItem.discharge(energyUsagePerTick, electricItem.getTier(), true, false, simulate) >= + energyUsagePerTick; } @Override diff --git a/src/main/java/gregtech/common/items/behaviors/TooltipBehavior.java b/src/main/java/gregtech/common/items/behaviors/TooltipBehavior.java index 979891fb825..3f2b455aa90 100644 --- a/src/main/java/gregtech/common/items/behaviors/TooltipBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/TooltipBehavior.java @@ -1,12 +1,14 @@ package gregtech.common.items.behaviors; import gregtech.api.items.metaitem.stats.IItemBehaviour; + import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; import java.util.List; import java.util.function.Consumer; +import javax.annotation.Nonnull; + /** * Adds tooltips with multiple translation keys */ diff --git a/src/main/java/gregtech/common/items/behaviors/TricorderBehavior.java b/src/main/java/gregtech/common/items/behaviors/TricorderBehavior.java index 5242fb3a456..9a33d1cfa1d 100644 --- a/src/main/java/gregtech/common/items/behaviors/TricorderBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/TricorderBehavior.java @@ -17,6 +17,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipe; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; @@ -39,12 +40,13 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidTank; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; +import javax.annotation.Nonnull; + public class TricorderBehavior implements IItemBehaviour { private final int debugLevel; @@ -55,7 +57,8 @@ public TricorderBehavior(int debugLevel) { } @Override - public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, + float hitY, float hitZ, EnumHand hand) { if (!world.isRemote && !world.isAirBlock(pos)) { List info = getScannerInfo(player, world, pos); @@ -88,23 +91,29 @@ public List getScannerInfo(EntityPlayer player, World world, Blo // coordinates of the block list.add(new TextComponentTranslation("behavior.tricorder.position", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(pos.getX())).setStyle(new Style().setColor(TextFormatting.AQUA)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(pos.getY())).setStyle(new Style().setColor(TextFormatting.AQUA)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(pos.getZ())).setStyle(new Style().setColor(TextFormatting.AQUA)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(world.provider.getDimension())).setStyle(new Style().setColor(TextFormatting.AQUA)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(pos.getX())) + .setStyle(new Style().setColor(TextFormatting.AQUA)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(pos.getY())) + .setStyle(new Style().setColor(TextFormatting.AQUA)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(pos.getZ())) + .setStyle(new Style().setColor(TextFormatting.AQUA)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(world.provider.getDimension())) + .setStyle(new Style().setColor(TextFormatting.AQUA)))); // hardness and blast resistance list.add(new TextComponentTranslation("behavior.tricorder.block_hardness", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(block.getBlockHardness(state, world, pos))).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(block.getExplosionResistance(player))).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(block.getBlockHardness(state, world, pos))) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(block.getExplosionResistance(player))) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); if (debugLevel > 2) { for (Map.Entry, Comparable> prop : state.getProperties().entrySet()) { list.add(new TextComponentTranslation("behavior.tricorder.state", new TextComponentTranslation(prop.getKey().getName()), - new TextComponentTranslation(prop.getValue().toString()).setStyle(new Style().setColor(TextFormatting.AQUA)))); + new TextComponentTranslation(prop.getValue().toString()) + .setStyle(new Style().setColor(TextFormatting.AQUA)))); } if (state instanceof IExtendedBlockState) { IExtendedBlockState extState = (IExtendedBlockState) state; @@ -112,7 +121,8 @@ public List getScannerInfo(EntityPlayer player, World world, Blo if (prop.getValue().isPresent()) { list.add(new TextComponentTranslation("behavior.tricorder.state", new TextComponentTranslation(prop.getKey().getName()), - new TextComponentTranslation(prop.getValue().get().toString()).setStyle(new Style().setColor(TextFormatting.AQUA)))); + new TextComponentTranslation(prop.getValue().get().toString()) + .setStyle(new Style().setColor(TextFormatting.AQUA)))); } } } @@ -126,9 +136,11 @@ public List getScannerInfo(EntityPlayer player, World world, Blo // name of the machine list.add(new TextComponentTranslation("behavior.tricorder.block_name", - new TextComponentTranslation(LocalizationUtils.format(metaTileEntity.getMetaFullName())).setStyle(new Style().setColor(TextFormatting.BLUE)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(GregTechAPI.MTE_REGISTRY.getIdByObjectName(metaTileEntity.metaTileEntityId))).setStyle(new Style().setColor(TextFormatting.BLUE)) - )); + new TextComponentTranslation(LocalizationUtils.format(metaTileEntity.getMetaFullName())) + .setStyle(new Style().setColor(TextFormatting.BLUE)), + new TextComponentTranslation(TextFormattingUtil + .formatNumbers(GregTechAPI.MTE_REGISTRY.getIdByObjectName(metaTileEntity.metaTileEntityId))) + .setStyle(new Style().setColor(TextFormatting.BLUE)))); list.add(new TextComponentTranslation("behavior.tricorder.divider")); @@ -145,10 +157,12 @@ public List getScannerInfo(EntityPlayer player, World world, Blo allTanksEmpty = false; list.add(new TextComponentTranslation("behavior.tricorder.tank", i, - new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getFluid().amount)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getCapacity())).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(tank.getFluid().getLocalizedName()).setStyle(new Style().setColor(TextFormatting.GOLD)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getFluid().amount)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getCapacity())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation(tank.getFluid().getLocalizedName()) + .setStyle(new Style().setColor(TextFormatting.GOLD)))); } tankIndex += tanks.getFluidTanks().size(); } @@ -162,10 +176,12 @@ public List getScannerInfo(EntityPlayer player, World world, Blo allTanksEmpty = false; list.add(new TextComponentTranslation("behavior.tricorder.tank", tankIndex + i, - new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getFluid().amount)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getCapacity())).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(tank.getFluid().getLocalizedName()).setStyle(new Style().setColor(TextFormatting.GOLD)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getFluid().amount)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getCapacity())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation(tank.getFluid().getLocalizedName()) + .setStyle(new Style().setColor(TextFormatting.GOLD)))); } } @@ -175,48 +191,61 @@ public List getScannerInfo(EntityPlayer player, World world, Blo // sound muffling energyCost += 500; if (metaTileEntity.isMuffled()) - list.add(new TextComponentTranslation("behavior.tricorder.muffled").setStyle(new Style().setColor(TextFormatting.GREEN))); + list.add(new TextComponentTranslation("behavior.tricorder.muffled") + .setStyle(new Style().setColor(TextFormatting.GREEN))); // workable progress info IWorkable workable = metaTileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_WORKABLE, null); if (workable != null) { if (!workable.isWorkingEnabled()) { - list.add(new TextComponentTranslation("behavior.tricorder.machine_disabled").setStyle(new Style().setColor(TextFormatting.RED))); + list.add(new TextComponentTranslation("behavior.tricorder.machine_disabled") + .setStyle(new Style().setColor(TextFormatting.RED))); } - // if (workable.wasShutdown()) { //todo - // list.add(new TextComponentTranslation("behavior.tricorder.machine_power_loss").setStyle(new Style().setColor(TextFormatting.RED))); - // } + // if (workable.wasShutdown()) { //todo + // list.add(new TextComponentTranslation("behavior.tricorder.machine_power_loss").setStyle(new + // Style().setColor(TextFormatting.RED))); + // } energyCost += 400; if (workable.getMaxProgress() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.machine_progress", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getProgress())).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getMaxProgress())).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getProgress())) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getMaxProgress())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } } // energy container - IEnergyContainer container = metaTileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); + IEnergyContainer container = metaTileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + null); if (container != null && container.getEnergyCapacity() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.divider")); if (container.getInputVoltage() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.energy_container_in", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getInputVoltage())).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(GTValues.VN[GTUtility.getTierByVoltage(container.getInputVoltage())]).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getInputAmperage())).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getInputVoltage())) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + GTValues.VN[GTUtility.getTierByVoltage(container.getInputVoltage())]) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getInputAmperage())) + .setStyle(new Style().setColor(TextFormatting.RED)))); } if (container.getOutputVoltage() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.energy_container_out", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getOutputVoltage())).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(GTValues.VN[GTUtility.getTierByVoltage(container.getOutputVoltage())]).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getOutputAmperage())).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getOutputVoltage())) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + GTValues.VN[GTUtility.getTierByVoltage(container.getOutputVoltage())]) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(container.getOutputAmperage())) + .setStyle(new Style().setColor(TextFormatting.RED)))); } list.add(new TextComponentTranslation("behavior.tricorder.energy_container_storage", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getEnergyStored())).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getEnergyCapacity())).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getEnergyStored())) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getEnergyCapacity())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } // machine-specific info @@ -238,9 +267,12 @@ else if (metaTileEntity instanceof IDataInfoProvider) if (pipeTile.getPipeBlock().getRegistryName() != null) { list.add(new TextComponentTranslation("behavior.tricorder.block_name", - new TextComponentTranslation(LocalizationUtils.format(pipeTile.getPipeBlock().getTranslationKey())).setStyle(new Style().setColor(TextFormatting.BLUE)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(block.getMetaFromState(world.getBlockState(pos)))).setStyle(new Style().setColor(TextFormatting.BLUE)) - )); + new TextComponentTranslation( + LocalizationUtils.format(pipeTile.getPipeBlock().getTranslationKey())) + .setStyle(new Style().setColor(TextFormatting.BLUE)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(block.getMetaFromState(world.getBlockState(pos)))) + .setStyle(new Style().setColor(TextFormatting.BLUE)))); } // pipe-specific info @@ -264,42 +296,49 @@ else if (metaTileEntity instanceof IDataInfoProvider) list.addAll(provider.getDataInfo()); } else { list.add(new TextComponentTranslation("behavior.tricorder.block_name", - new TextComponentTranslation(LocalizationUtils.format(block.getLocalizedName())).setStyle(new Style().setColor(TextFormatting.BLUE)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(block.getMetaFromState(world.getBlockState(pos)))).setStyle(new Style().setColor(TextFormatting.BLUE)) - )); + new TextComponentTranslation(LocalizationUtils.format(block.getLocalizedName())) + .setStyle(new Style().setColor(TextFormatting.BLUE)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(block.getMetaFromState(world.getBlockState(pos)))) + .setStyle(new Style().setColor(TextFormatting.BLUE)))); } - // crops (adds 1000EU) // bedrock fluids list.add(new TextComponentTranslation("behavior.tricorder.divider")); - Fluid fluid = BedrockFluidVeinHandler.getFluidInChunk(world, pos.getX() / 16, pos.getZ() / 16);//-# to only read + Fluid fluid = BedrockFluidVeinHandler.getFluidInChunk(world, pos.getX() / 16, pos.getZ() / 16);// -# to only + // read if (fluid != null) { - FluidStack stack = new FluidStack(fluid, BedrockFluidVeinHandler.getOperationsRemaining(world, pos.getX() / 16, pos.getZ() / 16)); + FluidStack stack = new FluidStack(fluid, + BedrockFluidVeinHandler.getOperationsRemaining(world, pos.getX() / 16, pos.getZ() / 16)); double fluidPercent = stack.amount * 100.0 / BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS; if (player.isCreative()) { list.add(new TextComponentTranslation("behavior.tricorder.bedrock_fluid.amount", - new TextComponentTranslation(fluid.getLocalizedName(stack)).setStyle(new Style().setColor(TextFormatting.GOLD)), - new TextComponentTranslation(String.valueOf(BedrockFluidVeinHandler.getFluidYield(world, pos.getX() / 16, pos.getZ() / 16))).setStyle(new Style().setColor(TextFormatting.GOLD)), - new TextComponentTranslation(String.valueOf(fluidPercent)).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(fluid.getLocalizedName(stack)) + .setStyle(new Style().setColor(TextFormatting.GOLD)), + new TextComponentTranslation(String.valueOf( + BedrockFluidVeinHandler.getFluidYield(world, pos.getX() / 16, pos.getZ() / 16))) + .setStyle(new Style().setColor(TextFormatting.GOLD)), + new TextComponentTranslation(String.valueOf(fluidPercent)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } else { list.add(new TextComponentTranslation("behavior.tricorder.bedrock_fluid.amount_unknown", - new TextComponentTranslation(String.valueOf(fluidPercent)).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(String.valueOf(fluidPercent)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } } else { list.add(new TextComponentTranslation("behavior.tricorder.bedrock_fluid.nothing")); } // pollution -// if (GT_Pollution.hasPollution(currentChunk)) { -// list.add("Pollution in Chunk: " + TextFormatting.RED + GTUtility.formatNumbers(GT_Pollution.getPollution(currentChunk)) + TextFormatting.RESET + " gibbl"); -// } else { -// list.add(TextFormatting.GREEN + "No Pollution in Chunk! HAYO!" + TextFormatting.RESET); -// } + // if (GT_Pollution.hasPollution(currentChunk)) { + // list.add("Pollution in Chunk: " + TextFormatting.RED + + // GTUtility.formatNumbers(GT_Pollution.getPollution(currentChunk)) + TextFormatting.RESET + " gibbl"); + // } else { + // list.add(TextFormatting.GREEN + "No Pollution in Chunk! HAYO!" + TextFormatting.RESET); + // } // debug TODO if (tileEntity instanceof MetaTileEntityHolder) { diff --git a/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java b/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java index 508764a1249..3b181f12548 100644 --- a/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java @@ -6,16 +6,18 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.material.properties.RotorProperty; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class TurbineRotorBehavior extends AbstractMaterialPartBehavior implements IItemMaxStackSizeProvider { - //TODO rework rotor stats once material stats are also reworked + // TODO rework rotor stats once material stats are also reworked @Override public int getPartMaxDurability(ItemStack itemStack) { Material material = getPartMaterial(itemStack); diff --git a/src/main/java/gregtech/common/items/behaviors/monitorplugin/AdvancedMonitorPluginBehavior.java b/src/main/java/gregtech/common/items/behaviors/monitorplugin/AdvancedMonitorPluginBehavior.java index 21882bf830a..7c3da2f0166 100644 --- a/src/main/java/gregtech/common/items/behaviors/monitorplugin/AdvancedMonitorPluginBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/monitorplugin/AdvancedMonitorPluginBehavior.java @@ -1,10 +1,5 @@ package gregtech.common.items.behaviors.monitorplugin; -import codechicken.lib.render.BlockRenderer; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Translation; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.gui.IUIHolder; import gregtech.api.gui.widgets.LabelWidget; @@ -23,6 +18,7 @@ import gregtech.common.gui.widget.monitor.WidgetPluginConfig; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; @@ -43,16 +39,24 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.BlockRenderer; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Translation; import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; -import javax.vecmath.Vector3f; import java.util.*; import java.util.stream.Collectors; +import javax.vecmath.Vector3f; + public class AdvancedMonitorPluginBehavior extends ProxyHolderPluginBehavior { + @SideOnly(Side.CLIENT) private static Framebuffer FBO; private static final int RESOLUTION = 1080; @@ -63,7 +67,7 @@ public class AdvancedMonitorPluginBehavior extends ProxyHolderPluginBehavior { private float spin; private boolean connect; - //run-time + // run-time @SideOnly(Side.CLIENT) private FBOWorldSceneRenderer worldSceneRenderer; @SideOnly(Side.CLIENT) @@ -98,20 +102,22 @@ private void createWorldScene() { FBO = new Framebuffer(RESOLUTION, RESOLUTION, true); } TrackedDummyWorld dummyWorld = new TrackedDummyWorld(world); - dummyWorld.setRenderFilter(pos->validPos.contains(pos)); + dummyWorld.setRenderFilter(pos -> validPos.contains(pos)); worldSceneRenderer = new FBOWorldSceneRenderer(dummyWorld, FBO); worldSceneRenderer.addRenderedBlocks(validPos, null); center = new Vector3f((minX + maxX) / 2f + 0.5f, (minY + maxY) / 2f + 0.5f, (minZ + maxZ) / 2f + 0.5f); - worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); worldSceneRenderer.setBeforeWorldRender(this::renderBefore); worldSceneRenderer.setAfterWorldRender(this::renderAfter); - worldSceneRenderer.setOnLookingAt(rayTrace->renderBlockOverLay(rayTrace.getBlockPos())); + worldSceneRenderer.setOnLookingAt(rayTrace -> renderBlockOverLay(rayTrace.getBlockPos())); } @SideOnly(Side.CLIENT) private void renderBefore(WorldSceneRenderer renderer) { if (spin > 0 && lastMouse == null) { - worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); } } @@ -145,7 +151,8 @@ private void renderAfter(WorldSceneRenderer renderer) { } } if (connect && connections != null) { - for (Map.Entry, Vector3f>> entry : connections.entrySet()) { + for (Map.Entry, Vector3f>> entry : connections + .entrySet()) { BlockPos pos = entry.getKey(); Vector3f winPos = WorldSceneRenderer.project(pos); entry.getValue().setValue(winPos); @@ -184,7 +191,8 @@ private void renderBlockOverLay(BlockPos pos) { } public void setConfig(float scale, int rY, int rX, float spin, boolean connect) { - if (this.scale == scale && this.rotationPitch == rY && this.rotationYaw == rX && this.spin == spin && this.connect == connect) + if (this.scale == scale && this.rotationPitch == rY && this.rotationYaw == rX && this.spin == spin && + this.connect == connect) return; if (scale < 0.3 || scale > 2 || rY < 0 || rY > 360 || rX < -90 || rX > 90 || spin < 0 || spin > 2) return; @@ -217,16 +225,20 @@ public void update() { if (worldSceneRenderer == null && validPos != null && validPos.size() > 0) { createWorldScene(); } - if (this.connect && worldSceneRenderer != null && this.screen.getController() instanceof MetaTileEntityCentralMonitor) { + if (this.connect && worldSceneRenderer != null && + this.screen.getController() instanceof MetaTileEntityCentralMonitor) { if (connections == null) connections = new HashMap<>(); connections.clear(); - for (MetaTileEntityMonitorScreen[] monitorScreens : ((MetaTileEntityCentralMonitor) this.screen.getController()).screens) { + for (MetaTileEntityMonitorScreen[] monitorScreens : ((MetaTileEntityCentralMonitor) this.screen + .getController()).screens) { for (MetaTileEntityMonitorScreen screen : monitorScreens) { - if (screen != null && screen.plugin instanceof FakeGuiPluginBehavior && ((FakeGuiPluginBehavior) screen.plugin).getHolder() == this.holder) { + if (screen != null && screen.plugin instanceof FakeGuiPluginBehavior && + ((FakeGuiPluginBehavior) screen.plugin).getHolder() == this.holder) { MetaTileEntity met = ((FakeGuiPluginBehavior) screen.plugin).getRealMTE(); if (met != null) { BlockPos pos = met.getPos(); - Pair, Vector3f> tuple = connections.getOrDefault(pos, new MutablePair<>(new ArrayList<>(), null)); + Pair, Vector3f> tuple = connections + .getOrDefault(pos, new MutablePair<>(new ArrayList<>(), null)); tuple.getLeft().add(screen); connections.put(pos, tuple); } @@ -240,9 +252,11 @@ public void update() { if (entity.isStructureFormed()) { if (!isValid) { PatternMatchContext result = entity.structurePattern.checkPatternFastAt( - entity.getWorld(), entity.getPos(), entity.getFrontFacing().getOpposite(), entity.getUpwardsFacing(), entity.allowsFlip()); + entity.getWorld(), entity.getPos(), entity.getFrontFacing().getOpposite(), + entity.getUpwardsFacing(), entity.allowsFlip()); if (result != null) { - validPos = entity.structurePattern.cache.keySet().stream().map(BlockPos::fromLong).collect(Collectors.toSet()); + validPos = entity.structurePattern.cache.keySet().stream().map(BlockPos::fromLong) + .collect(Collectors.toSet()); writePluginData(GregtechDataCodes.UPDATE_ADVANCED_VALID_POS, buf -> { buf.writeVarInt(validPos.size()); for (BlockPos pos : validPos) { @@ -262,19 +276,28 @@ public void update() { } } if (this.screen.getWorld().isRemote && spin > 0 && lastMouse == null) { - rotationPitch = (int) ((rotationPitch + spin * 4)% 360); + rotationPitch = (int) ((rotationPitch + spin * 4) % 360); } } @Override public WidgetPluginConfig customUI(WidgetPluginConfig widgetGroup, IUIHolder holder, EntityPlayer entityPlayer) { return widgetGroup.setSize(260, 170) - .widget(new WidgetScrollBar(25, 20, 210, 0.3f, 2, 0.1f, value -> setConfig(value, this.rotationPitch, this.rotationYaw, this.spin, this.connect)).setTitle("zoom", 0XFFFFFFFF).setInitValue(this.scale)) - .widget(new WidgetScrollBar(25, 40, 210, 0, 360, 1, value -> setConfig(this.scale, value.intValue(), this.rotationYaw, this.spin, this.connect)).setTitle("rotationPitch", 0XFFFFFFFF).setInitValue(this.rotationPitch)) - .widget(new WidgetScrollBar(25, 60, 210, -90, 90, 1, value -> setConfig(this.scale, this.rotationPitch, value.intValue(), this.spin, this.connect)).setTitle("rotationYaw", 0XFFFFFFFF).setInitValue(this.rotationYaw)) - .widget(new WidgetScrollBar(25, 100, 210, 0, 2, 0.1f, value -> setConfig(this.scale, this.rotationPitch, this.rotationYaw, value, this.connect)).setTitle("spinDur", 0XFFFFFFFF).setInitValue(this.spin)) + .widget(new WidgetScrollBar(25, 20, 210, 0.3f, 2, 0.1f, + value -> setConfig(value, this.rotationPitch, this.rotationYaw, this.spin, this.connect)) + .setTitle("zoom", 0XFFFFFFFF).setInitValue(this.scale)) + .widget(new WidgetScrollBar(25, 40, 210, 0, 360, 1, + value -> setConfig(this.scale, value.intValue(), this.rotationYaw, this.spin, this.connect)) + .setTitle("rotationPitch", 0XFFFFFFFF).setInitValue(this.rotationPitch)) + .widget(new WidgetScrollBar(25, 60, 210, -90, 90, 1, + value -> setConfig(this.scale, this.rotationPitch, value.intValue(), this.spin, this.connect)) + .setTitle("rotationYaw", 0XFFFFFFFF).setInitValue(this.rotationYaw)) + .widget(new WidgetScrollBar(25, 100, 210, 0, 2, 0.1f, + value -> setConfig(this.scale, this.rotationPitch, this.rotationYaw, value, this.connect)) + .setTitle("spinDur", 0XFFFFFFFF).setInitValue(this.spin)) .widget(new LabelWidget(25, 135, "Fake GUI:", 0XFFFFFFFF)) - .widget(new ToggleButtonWidget(80, 130, 20, 20, () -> this.connect, state -> setConfig(this.scale, this.rotationPitch, this.rotationYaw, this.spin, state))); + .widget(new ToggleButtonWidget(80, 130, 20, 20, () -> this.connect, + state -> setConfig(this.scale, this.rotationPitch, this.rotationYaw, this.spin, state))); } @Override @@ -326,7 +349,8 @@ public void readPluginData(int id, PacketBuffer buf) { this.spin = buf.readFloat(); this.connect = buf.readBoolean(); if (worldSceneRenderer != null) { - worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); } } } @@ -348,22 +372,26 @@ private void loadValidPos(PacketBuffer buf) { @Override public void readPluginAction(EntityPlayerMP player, int id, PacketBuffer buf) { - if (id == GregtechDataCodes.ACTION_PLUGIN_CONFIG) { //open GUI + if (id == GregtechDataCodes.ACTION_PLUGIN_CONFIG) { // open GUI BlockPos pos = buf.readBlockPos(); TileEntity tileEntity = this.screen.getWorld().getTileEntity(pos); if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).isValid()) { - ((IGregTechTileEntity) tileEntity).getMetaTileEntity().onRightClick(player, EnumHand.MAIN_HAND, ((IGregTechTileEntity) tileEntity).getMetaTileEntity().getFrontFacing(), null); + ((IGregTechTileEntity) tileEntity).getMetaTileEntity().onRightClick(player, EnumHand.MAIN_HAND, + ((IGregTechTileEntity) tileEntity).getMetaTileEntity().getFrontFacing(), null); } } } @Override - public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, double y) { + public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, + double y) { if (this.screen.getWorld().isRemote) { if (this.worldSceneRenderer != null) { - RayTraceResult rayTrace = this.worldSceneRenderer.screenPos2BlockPosFace((int) (x * RESOLUTION), (int) ((1 - y) * RESOLUTION)); + RayTraceResult rayTrace = this.worldSceneRenderer.screenPos2BlockPosFace((int) (x * RESOLUTION), + (int) ((1 - y) * RESOLUTION)); if (rayTrace != null && isRight) { - writePluginAction(GregtechDataCodes.ACTION_PLUGIN_CONFIG, buf -> buf.writeBlockPos(rayTrace.getBlockPos())); + writePluginAction(GregtechDataCodes.ACTION_PLUGIN_CONFIG, + buf -> buf.writeBlockPos(rayTrace.getBlockPos())); } } } @@ -391,14 +419,16 @@ public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) { GlStateManager.translate(-0.5, -0.5, 0.01); double[] currentMouse = this.screen.checkLookingAt(rayTraceResult); if (currentMouse != null) { - worldSceneRenderer.render(0, 0, 1, 1, (float)currentMouse[0], (float)currentMouse[1]); + worldSceneRenderer.render(0, 0, 1, 1, (float) currentMouse[0], (float) currentMouse[1]); if (lastMouse != null) { if (Mouse.isButtonDown(0)) { rotationPitch += (currentMouse[0] - lastMouse[0]) * 300; rotationPitch = rotationPitch % 360; - rotationYaw = (int) MathHelper.clamp(rotationYaw + (currentMouse[1] - lastMouse[1]) * 300, -89.9, 89.9); + rotationYaw = (int) MathHelper.clamp(rotationYaw + (currentMouse[1] - lastMouse[1]) * 300, + -89.9, 89.9); } - worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); } } else { worldSceneRenderer.render(0, 0, 1, 1, 0, 0); @@ -420,12 +450,14 @@ public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) { float dY = screen.getY() - this.screen.getY() + screen.scale / 2 - 0.025f; float rX = screen.getX() - this.screen.getX() + screen.scale - 0.025f; float rY = screen.getY() - this.screen.getY() + screen.scale / 2 - 0.025f; - if ((oX - dX) * (oX - dX) + (oY - dY) * (oY - dY) > (oX - rX) * (oX - rX) + (oY - rY) * (oY - rY)) { + if ((oX - dX) * (oX - dX) + (oY - dY) * (oY - dY) > + (oX - rX) * (oX - rX) + (oY - rY) * (oY - rY)) { dX = rX; dY = rY; } RenderUtil.renderRect(dX, dY, 0.05f, 0.05f, 0.002f, screen.frameColor); - RenderUtil.renderLine(oX + 0.025f, oY + 0.025f, dX + 0.025f, dY + 0.025f, 0.01f, screen.frameColor); + RenderUtil.renderLine(oX + 0.025f, oY + 0.025f, dX + 0.025f, dY + 0.025f, 0.01f, + screen.frameColor); } } diff --git a/src/main/java/gregtech/common/items/behaviors/monitorplugin/FakeGuiPluginBehavior.java b/src/main/java/gregtech/common/items/behaviors/monitorplugin/FakeGuiPluginBehavior.java index e2d674ecc4d..3328ee49a26 100644 --- a/src/main/java/gregtech/common/items/behaviors/monitorplugin/FakeGuiPluginBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/monitorplugin/FakeGuiPluginBehavior.java @@ -20,6 +20,7 @@ import gregtech.api.util.GregFakePlayer; import gregtech.common.gui.impl.FakeModularUIPluginContainer; import gregtech.common.gui.widget.monitor.WidgetPluginConfig; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -44,19 +45,20 @@ public class FakeGuiPluginBehavior extends ProxyHolderPluginBehavior { private int partIndex; - //run-time + // run-time @SideOnly(Side.CLIENT) private FakeModularGui fakeModularGui; private BlockPos partPos; private FakeModularUIPluginContainer fakeModularUIContainer; private GregFakePlayer fakePlayer; - private static final Method methodCreateUI = ObfuscationReflectionHelper.findMethod(MetaTileEntity.class, "createUI", ModularUI.class, EntityPlayer.class); - static{ + private static final Method methodCreateUI = ObfuscationReflectionHelper.findMethod(MetaTileEntity.class, + "createUI", ModularUI.class, EntityPlayer.class); + static { methodCreateUI.setAccessible(true); } public void setConfig(int partIndex) { - if(this.partIndex == partIndex || partIndex < 0) return; + if (this.partIndex == partIndex || partIndex < 0) return; this.partIndex = partIndex; this.partPos = null; writePluginData(GregtechDataCodes.UPDATE_PLUGIN_CONFIG, buffer -> buffer.writeVarInt(this.partIndex)); @@ -76,13 +78,14 @@ public MetaTileEntity getRealMTE() { } } PatternMatchContext context = multi.structurePattern.checkPatternFastAt( - target.getWorld(), target.getPos(), target.getFrontFacing().getOpposite(), multi.getUpwardsFacing(), multi.allowsFlip()); + target.getWorld(), target.getPos(), target.getFrontFacing().getOpposite(), multi.getUpwardsFacing(), + multi.allowsFlip()); if (context == null) { return null; } Set rawPartsSet = context.getOrCreate("MultiblockParts", HashSet::new); List parts = new ArrayList<>(rawPartsSet); - parts.sort(Comparator.comparing((it) -> ((MetaTileEntity)it).getPos().hashCode())); + parts.sort(Comparator.comparing((it) -> ((MetaTileEntity) it).getPos().hashCode())); if (parts.size() > partIndex - 1 && parts.get(partIndex - 1) instanceof MetaTileEntity) { target = (MetaTileEntity) parts.get(partIndex - 1); partPos = target.getPos(); @@ -125,7 +128,8 @@ public void createFakeGui() { } widgets.add(widget); } - ModularUI.Builder builder = new ModularUI.Builder(ui.backgroundPath, ui.getWidth(), ui.getHeight() - (hasPlayerInventory? 80:0)); + ModularUI.Builder builder = new ModularUI.Builder(ui.backgroundPath, ui.getWidth(), + ui.getHeight() - (hasPlayerInventory ? 80 : 0)); for (Widget widget : widgets) { builder.widget(widget); } @@ -161,7 +165,7 @@ public void writeToNBT(NBTTagCompound data) { @Override public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); - partIndex = data.hasKey("part")? data.getInteger("part"):0; + partIndex = data.hasKey("part") ? data.getInteger("part") : 0; } @Override @@ -191,7 +195,8 @@ public void update() { } else { if (partIndex > 0 && this.screen.getOffsetTimer() % 20 == 0) { if (fakeModularUIContainer != null && getRealMTE() == null) { - this.writePluginData(GregtechDataCodes.UPDATE_PLUGIN_CONFIG, buf-> buf.writeVarInt(this.partIndex)); + this.writePluginData(GregtechDataCodes.UPDATE_PLUGIN_CONFIG, + buf -> buf.writeVarInt(this.partIndex)); fakeModularUIContainer = null; } } @@ -218,23 +223,25 @@ public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) { } @Override - public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, double y) { + public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, + double y) { if (this.screen.getWorld().isRemote) return true; - if (fakeModularUIContainer != null && fakeModularUIContainer.modularUI != null && !ToolHelper.isTool(playerIn.getHeldItemMainhand(), ToolClasses.SCREWDRIVER)) { + if (fakeModularUIContainer != null && fakeModularUIContainer.modularUI != null && + !ToolHelper.isTool(playerIn.getHeldItemMainhand(), ToolClasses.SCREWDRIVER)) { int width = fakeModularUIContainer.modularUI.getWidth(); int height = fakeModularUIContainer.modularUI.getHeight(); float halfW = width / 2f; float halfH = height / 2f; float scale = 0.5f / Math.max(halfW, halfH); - int mouseX = (int) ((x / scale) + (halfW > halfH? 0: (halfW - halfH))); - int mouseY = (int) ((y / scale) + (halfH > halfW? 0: (halfH - halfW))); + int mouseX = (int) ((x / scale) + (halfW > halfH ? 0 : (halfW - halfH))); + int mouseY = (int) ((y / scale) + (halfH > halfW ? 0 : (halfH - halfW))); MetaTileEntity mte = getRealMTE(); - if (mte != null && 0 <= mouseX && mouseX <= width && 0 <= mouseY&& mouseY <= height) { + if (mte != null && 0 <= mouseX && mouseX <= width && 0 <= mouseY && mouseY <= height) { if (playerIn.isSneaking()) { - writePluginData(GregtechDataCodes.UPDATE_PLUGIN_CLICK, buf->{ + writePluginData(GregtechDataCodes.UPDATE_PLUGIN_CLICK, buf -> { buf.writeVarInt(mouseX); buf.writeVarInt(mouseY); - buf.writeVarInt(isRight?1:0); + buf.writeVarInt(isRight ? 1 : 0); buf.writeVarInt(fakeModularUIContainer.syncId); }); } else { @@ -251,8 +258,7 @@ public void readPluginData(int id, PacketBuffer buf) { this.partIndex = buf.readVarInt(); this.partPos = null; createFakeGui(); - } - else if (id == GregtechDataCodes.UPDATE_FAKE_GUI) { + } else if (id == GregtechDataCodes.UPDATE_FAKE_GUI) { int windowID = buf.readVarInt(); int widgetID = buf.readVarInt(); if (fakeModularGui != null) @@ -265,7 +271,7 @@ else if (id == GregtechDataCodes.UPDATE_FAKE_GUI) { int mouseY = buf.readVarInt(); int button = buf.readVarInt(); int syncID = buf.readVarInt(); - if (fakeModularGui != null && fakeModularUIContainer != null) { + if (fakeModularGui != null && fakeModularUIContainer != null) { fakeModularUIContainer.syncId = syncID; fakeModularGui.mouseClicked(mouseX, mouseY, button); } diff --git a/src/main/java/gregtech/common/items/behaviors/monitorplugin/OnlinePicPluginBehavior.java b/src/main/java/gregtech/common/items/behaviors/monitorplugin/OnlinePicPluginBehavior.java index 583a17aeb2a..ec033addc52 100644 --- a/src/main/java/gregtech/common/items/behaviors/monitorplugin/OnlinePicPluginBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/monitorplugin/OnlinePicPluginBehavior.java @@ -8,6 +8,7 @@ import gregtech.api.items.behavior.MonitorPluginBaseBehavior; import gregtech.common.gui.widget.WidgetScrollBar; import gregtech.common.gui.widget.monitor.WidgetPluginConfig; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -37,7 +38,9 @@ public class OnlinePicPluginBehavior extends MonitorPluginBaseBehavior { public String error; public void setConfig(String url, float rotation, float scaleX, float scaleY, boolean flippedX, boolean flippedY) { - if (url.length() > 200 || (this.url.equals(url) && this.rotation == rotation && this.scaleX == scaleX && this.scaleY == scaleY && this.flippedX == flippedX && this.flippedY == flippedY)) return; + if (url.length() > 200 || (this.url.equals(url) && this.rotation == rotation && this.scaleX == scaleX && + this.scaleY == scaleY && this.flippedX == flippedX && this.flippedY == flippedY)) + return; this.url = url; this.rotation = rotation; this.scaleX = scaleX; @@ -57,7 +60,7 @@ public void setConfig(String url, float rotation, float scaleX, float scaleY, bo @Override public void readPluginData(int id, PacketBuffer buf) { - if(id == GregtechDataCodes.UPDATE_PLUGIN_CONFIG){ + if (id == GregtechDataCodes.UPDATE_PLUGIN_CONFIG) { String _url = buf.readString(200); if (!this.url.equals(_url)) { this.url = _url; @@ -87,10 +90,10 @@ public void writeToNBT(NBTTagCompound data) { @Override public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); - this.url = data.hasKey("url")? data.getString("url"):""; - this.rotation = data.hasKey("rotation")? data.getFloat("rotation"):0; - this.scaleX = data.hasKey("scaleX")? data.getFloat("scaleX"):1; - this.scaleY = data.hasKey("scaleY")? data.getFloat("scaleY"):1; + this.url = data.hasKey("url") ? data.getString("url") : ""; + this.rotation = data.hasKey("rotation") ? data.getFloat("rotation") : 0; + this.scaleX = data.hasKey("scaleX") ? data.getFloat("scaleX") : 1; + this.scaleY = data.hasKey("scaleY") ? data.getFloat("scaleY") : 1; this.flippedX = data.hasKey("flippedX") && data.getBoolean("flippedX"); this.flippedY = data.hasKey("flippedY") && data.getBoolean("flippedY"); } @@ -104,24 +107,35 @@ public MonitorPluginBaseBehavior createPlugin() { public WidgetPluginConfig customUI(WidgetPluginConfig widgetGroup, IUIHolder holder, EntityPlayer entityPlayer) { tmpUrl = url; return widgetGroup.setSize(260, 150) - .widget(new DynamicLabelWidget(20, 20, ()->url.length() > 40?(url.substring(0, 39) + "..."):url,0XFFFFFFFF)) - .widget(new TextFieldWidget(20, 30, 175, 10, true, ()-> tmpUrl, (text)->{ + .widget(new DynamicLabelWidget(20, 20, () -> url.length() > 40 ? (url.substring(0, 39) + "...") : url, + 0XFFFFFFFF)) + .widget(new TextFieldWidget(20, 30, 175, 10, true, () -> tmpUrl, (text) -> { tmpUrl = text; - }).setValidator((data)->true).setMaxStringLength(200)) - .widget(new ClickButtonWidget(200, 30, 45, 10, "confirm", pressed-> setConfig(tmpUrl, this.rotation, this.scaleX, this.scaleY, this.flippedX, this.flippedY))) - .widget(new WidgetScrollBar(25, 40, 210, -180, 180, 1, value -> setConfig(this.url, value, this.scaleX, this.scaleY, this.flippedX, this.flippedY)).setTitle("rotation", 0XFFFFFFFF).setInitValue(this.rotation)) - .widget(new WidgetScrollBar(25, 60, 210, 0, 1, 0.05f, value -> setConfig(this.url, this.rotation, value, this.scaleY, this.flippedX, this.flippedY)).setTitle("scaleX", 0XFFFFFFFF).setInitValue(this.scaleX)) - .widget(new WidgetScrollBar(25, 80, 210, 0, 1, 0.05f, value -> setConfig(this.url, this.rotation, this.scaleX, value, this.flippedX, this.flippedY)).setTitle("scaleY", 0XFFFFFFFF).setInitValue(this.scaleY)) + }).setValidator((data) -> true).setMaxStringLength(200)) + .widget(new ClickButtonWidget(200, 30, 45, 10, "confirm", + pressed -> setConfig(tmpUrl, this.rotation, this.scaleX, this.scaleY, this.flippedX, + this.flippedY))) + .widget(new WidgetScrollBar(25, 40, 210, -180, 180, 1, + value -> setConfig(this.url, value, this.scaleX, this.scaleY, this.flippedX, this.flippedY)) + .setTitle("rotation", 0XFFFFFFFF).setInitValue(this.rotation)) + .widget(new WidgetScrollBar(25, 60, 210, 0, 1, 0.05f, + value -> setConfig(this.url, this.rotation, value, this.scaleY, this.flippedX, this.flippedY)) + .setTitle("scaleX", 0XFFFFFFFF).setInitValue(this.scaleX)) + .widget(new WidgetScrollBar(25, 80, 210, 0, 1, 0.05f, + value -> setConfig(this.url, this.rotation, this.scaleX, value, this.flippedX, this.flippedY)) + .setTitle("scaleY", 0XFFFFFFFF).setInitValue(this.scaleY)) .widget(new LabelWidget(40, 115, "flippedX:", 0XFFFFFFFF)) - .widget(new ToggleButtonWidget(90, 110, 20, 20, ()->this.flippedX, state -> setConfig(this.url, this.rotation, this.scaleX, this.scaleY, state, this.flippedY))) + .widget(new ToggleButtonWidget(90, 110, 20, 20, () -> this.flippedX, + state -> setConfig(this.url, this.rotation, this.scaleX, this.scaleY, state, this.flippedY))) .widget(new LabelWidget(140, 115, "flippedY:", 0XFFFFFFFF)) - .widget(new ToggleButtonWidget(190, 110, 20, 20, ()->this.flippedY, state -> setConfig(this.url, this.rotation, this.scaleX, this.scaleY, this.flippedX, state))); + .widget(new ToggleButtonWidget(190, 110, 20, 20, () -> this.flippedY, + state -> setConfig(this.url, this.rotation, this.scaleX, this.scaleY, this.flippedX, state))); } @Override public void update() { - if(this.screen != null && this.screen.getWorld().isRemote) { - if(this.texture != null) { + if (this.screen != null && this.screen.getWorld().isRemote) { + if (this.texture != null) { texture.tick(); // gif update } } @@ -131,7 +145,8 @@ public void update() { public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) { if (!this.url.isEmpty()) { if (texture != null && texture.hasTexture()) { - texture.render(-0.5f, -0.5f, 1, 1, this.rotation, this.scaleX, this.scaleY, this.flippedX, this.flippedY); + texture.render(-0.5f, -0.5f, 1, 1, this.rotation, this.scaleX, this.scaleY, this.flippedX, + this.flippedY); } else this.loadTexture(); } @@ -158,7 +173,8 @@ public void loadTexture() { if (downloader.hasFailed()) { failed = true; error = downloader.getError(); - DownloadThread.LOGGER.error("Could not load image of " + (this.screen!=null?this.screen.getPos().toString():"") + " " + error); + DownloadThread.LOGGER.error("Could not load image of " + + (this.screen != null ? this.screen.getPos().toString() : "") + " " + error); } else { texture = DownloadThread.loadImage(downloader); } diff --git a/src/main/java/gregtech/common/items/behaviors/monitorplugin/TextPluginBehavior.java b/src/main/java/gregtech/common/items/behaviors/monitorplugin/TextPluginBehavior.java index 43dd37c57ad..4c1584cbe17 100644 --- a/src/main/java/gregtech/common/items/behaviors/monitorplugin/TextPluginBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/monitorplugin/TextPluginBehavior.java @@ -7,6 +7,7 @@ import gregtech.client.utils.RenderUtil; import gregtech.common.gui.widget.WidgetARGB; import gregtech.common.gui.widget.monitor.WidgetPluginConfig; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -17,6 +18,7 @@ import java.util.Arrays; public class TextPluginBehavior extends MonitorPluginBaseBehavior { + public String[] texts; public int[] colors; @@ -36,7 +38,7 @@ public void setText(int line, String text, int color) { @Override public void readPluginData(int id, PacketBuffer buf) { - if(id == GregtechDataCodes.UPDATE_PLUGIN_CONFIG){ + if (id == GregtechDataCodes.UPDATE_PLUGIN_CONFIG) { texts = new String[buf.readInt()]; colors = new int[texts.length]; for (int i = 0; i < texts.length; i++) { @@ -48,7 +50,7 @@ public void readPluginData(int id, PacketBuffer buf) { @Override public MonitorPluginBaseBehavior createPlugin() { - TextPluginBehavior plugin = new TextPluginBehavior(); + TextPluginBehavior plugin = new TextPluginBehavior(); plugin.texts = new String[16]; plugin.colors = new int[16]; return plugin; @@ -67,9 +69,9 @@ public void writeToNBT(NBTTagCompound data) { public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); for (int i = 0; i < texts.length; i++) { - texts[i] = data.hasKey("t" + i)? data.getString("t" + i) : ""; + texts[i] = data.hasKey("t" + i) ? data.getString("t" + i) : ""; } - if(data.hasKey("color")) { + if (data.hasKey("color")) { colors = data.getIntArray("color"); } else { Arrays.fill(colors, 0XFFFFFFFF); @@ -80,7 +82,7 @@ public void readFromNBT(NBTTagCompound data) { @Override public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) { for (int i = 0; i < texts.length; i++) { - RenderUtil.renderText(-0.5f, -0.4625f + i / 16f, 0.002f, 1/128f, colors[i], texts[i], false); + RenderUtil.renderText(-0.5f, -0.4625f + i / 16f, 0.002f, 1 / 128f, colors[i], texts[i], false); } } @@ -94,10 +96,11 @@ public WidgetPluginConfig customUI(WidgetPluginConfig widgets, IUIHolder holder, widgets.setSize(260, 210); for (int i = 0; i < texts.length; i++) { int finalI = i; - widgets.addWidget(new TextFieldWidget(25, 25 + i * 10, 100, 10, true, ()-> this.texts[finalI], (text)-> setText(finalI, text, this.colors[finalI])).setValidator((data)->true)); - widgets.addWidget(new WidgetARGB(135, 25 + i * 10, 10, colors[i], color-> setText(finalI, this.texts[finalI], color))); + widgets.addWidget(new TextFieldWidget(25, 25 + i * 10, 100, 10, true, () -> this.texts[finalI], + (text) -> setText(finalI, text, this.colors[finalI])).setValidator((data) -> true)); + widgets.addWidget(new WidgetARGB(135, 25 + i * 10, 10, colors[i], + color -> setText(finalI, this.texts[finalI], color))); } return widgets; } - } diff --git a/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java b/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java index ac3193aa5c6..3bacf7994a8 100644 --- a/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java +++ b/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java @@ -1,11 +1,11 @@ package gregtech.common.items.tool; -import codechicken.lib.raytracer.RayTracer; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.items.tool.rotation.CustomBlockRotations; import gregtech.common.items.tool.rotation.ICustomRotationBehavior; + import net.minecraft.block.Block; import net.minecraft.block.BlockRailBase; import net.minecraft.block.state.IBlockState; @@ -20,9 +20,12 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import codechicken.lib.raytracer.RayTracer; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class BlockRotatingBehavior implements IToolBehavior { @@ -31,7 +34,9 @@ public class BlockRotatingBehavior implements IToolBehavior { protected BlockRotatingBehavior() {/**/} @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { TileEntity te = world.getTileEntity(pos); // MTEs have special handling on rotation if (te instanceof IGregTechTileEntity) { @@ -62,7 +67,8 @@ public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull Wo } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.block_rotation")); } } diff --git a/src/main/java/gregtech/common/items/tool/DisableShieldBehavior.java b/src/main/java/gregtech/common/items/tool/DisableShieldBehavior.java index 18f5193ab7b..bd58c22f24c 100644 --- a/src/main/java/gregtech/common/items/tool/DisableShieldBehavior.java +++ b/src/main/java/gregtech/common/items/tool/DisableShieldBehavior.java @@ -2,6 +2,7 @@ import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLivingBase; @@ -9,9 +10,10 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class DisableShieldBehavior implements IToolBehavior { @@ -20,7 +22,8 @@ public class DisableShieldBehavior implements IToolBehavior { protected DisableShieldBehavior() {/**/} @Override - public boolean canDisableShield(ItemStack stack, ItemStack shield, EntityLivingBase entity, EntityLivingBase attacker) { + public boolean canDisableShield(ItemStack stack, ItemStack shield, EntityLivingBase entity, + EntityLivingBase attacker) { return true; } @@ -30,7 +33,8 @@ public void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.shield_disable")); } } diff --git a/src/main/java/gregtech/common/items/tool/EntityDamageBehavior.java b/src/main/java/gregtech/common/items/tool/EntityDamageBehavior.java index 7d07dc16b1e..3a2c446df87 100644 --- a/src/main/java/gregtech/common/items/tool/EntityDamageBehavior.java +++ b/src/main/java/gregtech/common/items/tool/EntityDamageBehavior.java @@ -2,6 +2,7 @@ import gregtech.api.damagesources.DamageSources; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLivingBase; @@ -10,13 +11,14 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.function.Function; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Add to tools to have them deal bonus damage to specific mobs. * Pass null for the mobType parameter to ignore the tooltip. @@ -51,20 +53,23 @@ public EntityDamageBehavior(String mobType, Map, Float> entities) { } @Override - public void hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, @Nonnull EntityLivingBase attacker) { - float damageBonus = shouldDoBonusList.stream().map(func -> func.apply(target)).filter(f -> f > 0).findFirst().orElse(0f); + public void hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, + @Nonnull EntityLivingBase attacker) { + float damageBonus = shouldDoBonusList.stream().map(func -> func.apply(target)).filter(f -> f > 0).findFirst() + .orElse(0f); if (damageBonus != 0f) { - DamageSource source = attacker instanceof EntityPlayer - ? DamageSources.getPlayerDamage((EntityPlayer) attacker) - : DamageSources.getMobDamage(attacker); + DamageSource source = attacker instanceof EntityPlayer ? + DamageSources.getPlayerDamage((EntityPlayer) attacker) : DamageSources.getMobDamage(attacker); target.attackEntityFrom(source, damageBonus); } } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { if (mobType != null && !mobType.isEmpty()) { - tooltip.add(I18n.format("item.gt.tool.behavior.damage_boost", I18n.format("item.gt.tool.behavior.damage_boost_" + mobType))); + tooltip.add(I18n.format("item.gt.tool.behavior.damage_boost", + I18n.format("item.gt.tool.behavior.damage_boost_" + mobType))); } } } diff --git a/src/main/java/gregtech/common/items/tool/GrassPathBehavior.java b/src/main/java/gregtech/common/items/tool/GrassPathBehavior.java index e9e7d39fa40..ad4a2dee266 100644 --- a/src/main/java/gregtech/common/items/tool/GrassPathBehavior.java +++ b/src/main/java/gregtech/common/items/tool/GrassPathBehavior.java @@ -1,9 +1,9 @@ package gregtech.common.items.tool; -import com.google.common.collect.ImmutableSet; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.aoe.AoESymmetrical; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.block.Block; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; @@ -19,11 +19,14 @@ import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.ImmutableSet; + import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class GrassPathBehavior implements IToolBehavior { public static final GrassPathBehavior INSTANCE = new GrassPathBehavior(); @@ -32,7 +35,9 @@ protected GrassPathBehavior() {/**/} @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { if (facing == EnumFacing.DOWN) return EnumActionResult.PASS; ItemStack stack = player.getHeldItem(hand); @@ -63,7 +68,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w } if (pathed) { - world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundCategory.PLAYERS, 1.0F, 1.0F); + world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ITEM_SHOVEL_FLATTEN, + SoundCategory.PLAYERS, 1.0F, 1.0F); player.swingArm(hand); return EnumActionResult.SUCCESS; } @@ -71,11 +77,14 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w return EnumActionResult.PASS; } - public static Set getPathConvertibleBlocks(ItemStack stack, AoESymmetrical aoeDefinition, World world, EntityPlayer player, RayTraceResult rayTraceResult) { - return ToolHelper.iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, GrassPathBehavior::isBlockPathConvertible); + public static Set getPathConvertibleBlocks(ItemStack stack, AoESymmetrical aoeDefinition, World world, + EntityPlayer player, RayTraceResult rayTraceResult) { + return ToolHelper.iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, + GrassPathBehavior::isBlockPathConvertible); } - private static boolean isBlockPathConvertible(ItemStack stack, World world, EntityPlayer player, BlockPos pos, @Nullable BlockPos hitBlockPos) { + private static boolean isBlockPathConvertible(ItemStack stack, World world, EntityPlayer player, BlockPos pos, + @Nullable BlockPos hitBlockPos) { if (world.isAirBlock(pos.up())) { Block block = world.getBlockState(pos).getBlock(); return block == Blocks.GRASS || block == Blocks.DIRT; // native dirt to path @@ -84,7 +93,8 @@ private static boolean isBlockPathConvertible(ItemStack stack, World world, Enti } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.grass_path")); } } diff --git a/src/main/java/gregtech/common/items/tool/HarvestCropsBehavior.java b/src/main/java/gregtech/common/items/tool/HarvestCropsBehavior.java index d8dd25a9bd0..94c665d5dcc 100644 --- a/src/main/java/gregtech/common/items/tool/HarvestCropsBehavior.java +++ b/src/main/java/gregtech/common/items/tool/HarvestCropsBehavior.java @@ -1,10 +1,10 @@ package gregtech.common.items.tool; -import com.google.common.collect.ImmutableSet; import gregtech.api.GTValues; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.aoe.AoESymmetrical; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.block.Block; import net.minecraft.block.BlockCrops; import net.minecraft.block.state.IBlockState; @@ -21,11 +21,14 @@ import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.ImmutableSet; + import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class HarvestCropsBehavior implements IToolBehavior { public static final HarvestCropsBehavior INSTANCE = new HarvestCropsBehavior(); @@ -34,9 +37,10 @@ protected HarvestCropsBehavior() {/**/} @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { - - if(world.isRemote) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { + if (world.isRemote) { return EnumActionResult.PASS; } ItemStack stack = player.getHeldItem(hand); @@ -45,7 +49,7 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w Set blocks; - if(aoeDefinition == AoESymmetrical.none()) { + if (aoeDefinition == AoESymmetrical.none()) { blocks = ImmutableSet.of(pos); } else { RayTraceResult rayTraceResult = ToolHelper.getPlayerDefaultRaytrace(player); @@ -54,15 +58,16 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w if (rayTraceResult.typeOfHit != RayTraceResult.Type.BLOCK) return EnumActionResult.PASS; if (rayTraceResult.sideHit == null) return EnumActionResult.PASS; - blocks = ToolHelper.iterateAoE(stack, aoeDefinition, player.world, player, rayTraceResult, HarvestCropsBehavior::isBlockCrops); - if(isBlockCrops(stack, world, player, rayTraceResult.getBlockPos(), null)) { + blocks = ToolHelper.iterateAoE(stack, aoeDefinition, player.world, player, rayTraceResult, + HarvestCropsBehavior::isBlockCrops); + if (isBlockCrops(stack, world, player, rayTraceResult.getBlockPos(), null)) { blocks.add(rayTraceResult.getBlockPos()); } } boolean harvested = false; for (BlockPos blockPos : blocks) { - if(harvestBlockRoutine(stack, blockPos, player)) { + if (harvestBlockRoutine(stack, blockPos, player)) { harvested = true; } } @@ -70,7 +75,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w return harvested ? EnumActionResult.SUCCESS : EnumActionResult.PASS; } - private static boolean isBlockCrops(ItemStack stack, World world, EntityPlayer player, BlockPos pos, @Nullable BlockPos hitBlockPos) { + private static boolean isBlockCrops(ItemStack stack, World world, EntityPlayer player, BlockPos pos, + @Nullable BlockPos hitBlockPos) { if (world.isAirBlock(pos.up())) { Block block = world.getBlockState(pos).getBlock(); return block instanceof BlockCrops; @@ -103,14 +109,16 @@ private static void dropListOfItems(World world, BlockPos pos, List d double offX = (GTValues.RNG.nextFloat() * f) + (1.0F - f) * 0.5D; double offY = (GTValues.RNG.nextFloat() * f) + (1.0F - f) * 0.5D; double offZ = (GTValues.RNG.nextFloat() * f) + (1.0F - f) * 0.5D; - EntityItem entityItem = new EntityItem(world, pos.getX() + offX, pos.getY() + offY, pos.getZ() + offZ, stack); + EntityItem entityItem = new EntityItem(world, pos.getX() + offX, pos.getY() + offY, pos.getZ() + offZ, + stack); entityItem.setDefaultPickupDelay(); world.spawnEntity(entityItem); } } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.crop_harvesting")); } } diff --git a/src/main/java/gregtech/common/items/tool/HarvestIceBehavior.java b/src/main/java/gregtech/common/items/tool/HarvestIceBehavior.java index c38d9f20de1..aa31daa3138 100644 --- a/src/main/java/gregtech/common/items/tool/HarvestIceBehavior.java +++ b/src/main/java/gregtech/common/items/tool/HarvestIceBehavior.java @@ -2,6 +2,7 @@ import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; @@ -9,9 +10,10 @@ import net.minecraft.world.World; import net.minecraftforge.event.world.BlockEvent; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; /** * @see gregtech.common.ToolEventHandlers#onHarvestDrops(BlockEvent.HarvestDropsEvent) @@ -30,7 +32,8 @@ public void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.silk_ice")); } } diff --git a/src/main/java/gregtech/common/items/tool/HoeGroundBehavior.java b/src/main/java/gregtech/common/items/tool/HoeGroundBehavior.java index e647d56db81..c771191d1cf 100644 --- a/src/main/java/gregtech/common/items/tool/HoeGroundBehavior.java +++ b/src/main/java/gregtech/common/items/tool/HoeGroundBehavior.java @@ -1,9 +1,9 @@ package gregtech.common.items.tool; -import com.google.common.collect.ImmutableSet; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.aoe.AoESymmetrical; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.block.Block; import net.minecraft.block.BlockDirt; import net.minecraft.block.state.IBlockState; @@ -22,13 +22,17 @@ import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.ImmutableSet; + import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** - * Used to allow a tool to hoe the ground, only if it cannot extend the {@link gregtech.api.items.toolitem.ItemGTHoe} class. + * Used to allow a tool to hoe the ground, only if it cannot extend the {@link gregtech.api.items.toolitem.ItemGTHoe} + * class. */ public class HoeGroundBehavior implements IToolBehavior { @@ -38,7 +42,9 @@ protected HoeGroundBehavior() {/**/} @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { if (facing == EnumFacing.DOWN) return EnumActionResult.PASS; ItemStack stack = player.getHeldItem(hand); @@ -57,7 +63,7 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w if (rayTraceResult.sideHit == null) return EnumActionResult.PASS; blocks = getTillableBlocks(stack, aoeDefinition, world, player, rayTraceResult); - if(isBlockTillable(stack, world, player, rayTraceResult.getBlockPos(), null)) { + if (isBlockTillable(stack, world, player, rayTraceResult.getBlockPos(), null)) { blocks.add(rayTraceResult.getBlockPos()); } } @@ -81,7 +87,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w break; } case COARSE_DIRT: { - tillGround(world, player, stack, blockPos, Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + tillGround(world, player, stack, blockPos, + Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); tilled = true; break; } @@ -90,7 +97,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w } if (tilled) { - world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ITEM_HOE_TILL, SoundCategory.PLAYERS, 1.0F, 1.0F); + world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ITEM_HOE_TILL, + SoundCategory.PLAYERS, 1.0F, 1.0F); player.swingArm(hand); return EnumActionResult.SUCCESS; } @@ -98,11 +106,14 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w return EnumActionResult.PASS; } - public static Set getTillableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, World world, EntityPlayer player, RayTraceResult rayTraceResult) { - return ToolHelper.iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, HoeGroundBehavior::isBlockTillable); + public static Set getTillableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, World world, + EntityPlayer player, RayTraceResult rayTraceResult) { + return ToolHelper.iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, + HoeGroundBehavior::isBlockTillable); } - private static boolean isBlockTillable(ItemStack stack, World world, EntityPlayer player, BlockPos pos, @Nullable BlockPos hitBlockPos) { + private static boolean isBlockTillable(ItemStack stack, World world, EntityPlayer player, BlockPos pos, + @Nullable BlockPos hitBlockPos) { if (world.isAirBlock(pos.up())) { Block block = world.getBlockState(pos).getBlock(); return block == Blocks.GRASS || block == Blocks.GRASS_PATH || block == Blocks.DIRT; @@ -110,7 +121,8 @@ private static boolean isBlockTillable(ItemStack stack, World world, EntityPlaye return false; } - private static void tillGround(@Nonnull World world, EntityPlayer player, ItemStack stack, BlockPos pos, IBlockState state) { + private static void tillGround(@Nonnull World world, EntityPlayer player, ItemStack stack, BlockPos pos, + IBlockState state) { world.setBlockState(pos, state, 11); if (!player.isCreative()) { ToolHelper.damageItem(stack, player); @@ -118,7 +130,8 @@ private static void tillGround(@Nonnull World world, EntityPlayer player, ItemSt } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.ground_tilling")); } } diff --git a/src/main/java/gregtech/common/items/tool/PlungerBehavior.java b/src/main/java/gregtech/common/items/tool/PlungerBehavior.java index ebeb8399f79..ed75344db98 100644 --- a/src/main/java/gregtech/common/items/tool/PlungerBehavior.java +++ b/src/main/java/gregtech/common/items/tool/PlungerBehavior.java @@ -4,6 +4,7 @@ import gregtech.api.capability.impl.VoidFluidHandlerItemStack; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; @@ -19,9 +20,10 @@ import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.capability.IFluidHandler; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class PlungerBehavior implements IToolBehavior { @@ -30,7 +32,9 @@ public class PlungerBehavior implements IToolBehavior { protected PlungerBehavior() {/**/} @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { IFluidHandler fluidHandler = FluidUtil.getFluidHandler(world, pos, facing); if (fluidHandler == null) { return EnumActionResult.PASS; @@ -50,6 +54,7 @@ public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull Wo @Override public ICapabilityProvider createProvider(ItemStack stack, @Nullable NBTTagCompound tag) { return new VoidFluidHandlerItemStack(stack) { + @Override public int fill(FluidStack resource, boolean doFill) { int result = super.fill(resource, doFill); @@ -62,7 +67,8 @@ public int fill(FluidStack resource, boolean doFill) { } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.plunger")); } } diff --git a/src/main/java/gregtech/common/items/tool/RotateRailBehavior.java b/src/main/java/gregtech/common/items/tool/RotateRailBehavior.java index 483aab04252..262007f9643 100644 --- a/src/main/java/gregtech/common/items/tool/RotateRailBehavior.java +++ b/src/main/java/gregtech/common/items/tool/RotateRailBehavior.java @@ -2,6 +2,7 @@ import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.block.BlockRailBase; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; @@ -15,9 +16,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class RotateRailBehavior implements IToolBehavior { @@ -27,7 +29,9 @@ protected RotateRailBehavior() {/**/} @Nonnull @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { IBlockState state = world.getBlockState(pos); if (state.getBlock() instanceof BlockRailBase) { if (world.setBlockState(pos, state.withRotation(Rotation.CLOCKWISE_90))) { @@ -39,7 +43,8 @@ public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull Wo } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.rail_rotation")); } } diff --git a/src/main/java/gregtech/common/items/tool/TorchPlaceBehavior.java b/src/main/java/gregtech/common/items/tool/TorchPlaceBehavior.java index 3dbaea43b4b..59cd4a2d44f 100644 --- a/src/main/java/gregtech/common/items/tool/TorchPlaceBehavior.java +++ b/src/main/java/gregtech/common/items/tool/TorchPlaceBehavior.java @@ -3,6 +3,7 @@ import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; import gregtech.api.unification.OreDictUnifier; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; @@ -21,9 +22,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; import static gregtech.api.items.toolitem.ToolHelper.TORCH_PLACING_KEY; @@ -35,7 +37,9 @@ protected TorchPlaceBehavior() {/**/} @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { ItemStack stack = player.getHeldItem(hand); NBTTagCompound behaviourTag = ToolHelper.getBehaviorsTag(stack); if (behaviourTag.getBoolean(ToolHelper.TORCH_PLACING_KEY)) { @@ -70,7 +74,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w return EnumActionResult.PASS; } - private static boolean checkAndPlaceTorch(ItemStack slotStack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + private static boolean checkAndPlaceTorch(ItemStack slotStack, EntityPlayer player, World world, BlockPos pos, + EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!slotStack.isEmpty()) { Item slotItem = slotStack.getItem(); if (slotItem instanceof ItemBlock) { @@ -84,13 +89,17 @@ private static boolean checkAndPlaceTorch(ItemStack slotStack, EntityPlayer play if (!block.isReplaceable(world, pos)) { pos = pos.offset(facing); } - if (player.canPlayerEdit(pos, facing, slotStack) && world.mayPlace(slotBlock, pos, false, facing, player)) { + if (player.canPlayerEdit(pos, facing, slotStack) && + world.mayPlace(slotBlock, pos, false, facing, player)) { int i = slotItemBlock.getMetadata(slotStack.getMetadata()); - IBlockState slotState = slotBlock.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, i, player, hand); - if (slotItemBlock.placeBlockAt(slotStack, player, world, pos, facing, hitX, hitY, hitZ, slotState)) { + IBlockState slotState = slotBlock.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, i, + player, hand); + if (slotItemBlock.placeBlockAt(slotStack, player, world, pos, facing, hitX, hitY, hitZ, + slotState)) { slotState = world.getBlockState(pos); SoundType soundtype = slotState.getBlock().getSoundType(slotState, world, pos, player); - world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); + world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, + (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); if (!player.isCreative()) slotStack.shrink(1); return true; } @@ -107,7 +116,8 @@ public void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.torch_place")); } } diff --git a/src/main/java/gregtech/common/items/tool/TreeFellingBehavior.java b/src/main/java/gregtech/common/items/tool/TreeFellingBehavior.java index 38cd033fcfc..06046b9c447 100644 --- a/src/main/java/gregtech/common/items/tool/TreeFellingBehavior.java +++ b/src/main/java/gregtech/common/items/tool/TreeFellingBehavior.java @@ -2,6 +2,7 @@ import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; @@ -11,12 +12,14 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; /** - * The Tree Felling Behavior must be handled in a special way in {@link gregtech.api.items.toolitem.IGTTool#definition$onBlockStartBreak(ItemStack, BlockPos, EntityPlayer)} + * The Tree Felling Behavior must be handled in a special way in + * {@link gregtech.api.items.toolitem.IGTTool#definition$onBlockStartBreak(ItemStack, BlockPos, EntityPlayer)} * * @see gregtech.api.items.toolitem.ToolHelper#treeFellingRoutine(EntityPlayerMP, ItemStack, BlockPos) */ @@ -32,7 +35,8 @@ public void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.tree_felling")); } } diff --git a/src/main/java/gregtech/common/items/tool/rotation/CustomBlockRotations.java b/src/main/java/gregtech/common/items/tool/rotation/CustomBlockRotations.java index 94cd7c3f8c3..c684ae749d9 100644 --- a/src/main/java/gregtech/common/items/tool/rotation/CustomBlockRotations.java +++ b/src/main/java/gregtech/common/items/tool/rotation/CustomBlockRotations.java @@ -1,7 +1,7 @@ package gregtech.common.items.tool.rotation; import gregtech.api.cover.CoverRayTracer; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.Block; import net.minecraft.block.BlockDirectional; import net.minecraft.block.BlockHopper; @@ -12,6 +12,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; + +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.ApiStatus; import java.util.Map; @@ -35,6 +37,7 @@ public static ICustomRotationBehavior getCustomRotation(Block block) { } public static final ICustomRotationBehavior BLOCK_HORIZONTAL_BEHAVIOR = new ICustomRotationBehavior() { + @Override public boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult) { EnumFacing gridSide = CoverRayTracer.determineGridSideHit(hitResult); @@ -56,6 +59,7 @@ public boolean showXOnSide(IBlockState state, EnumFacing facing) { }; public static final ICustomRotationBehavior BLOCK_DIRECTIONAL_BEHAVIOR = new ICustomRotationBehavior() { + @Override public boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult) { EnumFacing gridSide = CoverRayTracer.determineGridSideHit(hitResult); @@ -97,6 +101,7 @@ private enum CustomRotations { // Cannot face up, and uses a custom BlockState property key HOPPER(Blocks.HOPPER, new ICustomRotationBehavior() { + @Override public boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult) { EnumFacing gridSide = CoverRayTracer.determineGridSideHit(hitResult); diff --git a/src/main/java/gregtech/common/items/tool/rotation/ICustomRotationBehavior.java b/src/main/java/gregtech/common/items/tool/rotation/ICustomRotationBehavior.java index f39c3cdcb1d..0d4833617ce 100644 --- a/src/main/java/gregtech/common/items/tool/rotation/ICustomRotationBehavior.java +++ b/src/main/java/gregtech/common/items/tool/rotation/ICustomRotationBehavior.java @@ -9,7 +9,10 @@ public interface ICustomRotationBehavior { - /** Custom implementation of {@link Block#rotateBlock(World, BlockPos, EnumFacing)} for when that behavior isn't ideal. */ + /** + * Custom implementation of {@link Block#rotateBlock(World, BlockPos, EnumFacing)} for when that behavior isn't + * ideal. + */ boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult); /** Whether to show the 9-sectioned highlight grid when looking at this block while holding a Wrench. */ diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java index 2bd9f3efa0a..912811fa70a 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java @@ -48,6 +48,7 @@ import gregtech.common.pipelike.fluidpipe.longdistance.MetaTileEntityLDFluidEndpoint; import gregtech.common.pipelike.itempipe.longdistance.MetaTileEntityLDItemEndpoint; import gregtech.integration.jei.multiblock.MultiblockInfoCategory; + import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.Loader; @@ -60,62 +61,92 @@ public class MetaTileEntities { - //HULLS + // HULLS public static final MetaTileEntityHull[] HULL = new MetaTileEntityHull[GTValues.V.length]; - public static final MetaTileEntityTransformer[] TRANSFORMER = new MetaTileEntityTransformer[GTValues.V.length - 1]; // no MAX - public static final MetaTileEntityTransformer[] HI_AMP_TRANSFORMER = new MetaTileEntityTransformer[GTValues.V.length - 1]; /// no MAX - public static final MetaTileEntityTransformer[] POWER_TRANSFORMER = new MetaTileEntityTransformer[GTValues.V.length - 1]; // no MAX + public static final MetaTileEntityTransformer[] TRANSFORMER = new MetaTileEntityTransformer[GTValues.V.length - 1]; // no + // MAX + public static final MetaTileEntityTransformer[] HI_AMP_TRANSFORMER = new MetaTileEntityTransformer[GTValues.V.length - + 1]; /// no MAX + public static final MetaTileEntityTransformer[] POWER_TRANSFORMER = new MetaTileEntityTransformer[GTValues.V.length - + 1]; // no MAX public static final MetaTileEntityDiode[] DIODES = new MetaTileEntityDiode[GTValues.V.length]; public static final MetaTileEntityBatteryBuffer[][] BATTERY_BUFFER = new MetaTileEntityBatteryBuffer[3][GTValues.V.length]; public static final MetaTileEntityCharger[] CHARGER = new MetaTileEntityCharger[GTValues.V.length]; - //SIMPLE MACHINES SECTION - public static final SimpleMachineMetaTileEntity[] ELECTRIC_FURNACE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] MACERATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] ALLOY_SMELTER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] ARC_FURNACE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] ASSEMBLER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] AUTOCLAVE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + // SIMPLE MACHINES SECTION + public static final SimpleMachineMetaTileEntity[] ELECTRIC_FURNACE = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] MACERATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] ALLOY_SMELTER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] ARC_FURNACE = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] ASSEMBLER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] AUTOCLAVE = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] BENDER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; public static final SimpleMachineMetaTileEntity[] BREWERY = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; public static final SimpleMachineMetaTileEntity[] CANNER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] CENTRIFUGE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] CHEMICAL_BATH = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] CHEMICAL_REACTOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] COMPRESSOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] CENTRIFUGE = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] CHEMICAL_BATH = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] CHEMICAL_REACTOR = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] COMPRESSOR = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] CUTTER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] DISTILLERY = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] ELECTROLYZER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] ELECTROMAGNETIC_SEPARATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] EXTRACTOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] DISTILLERY = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] ELECTROLYZER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] ELECTROMAGNETIC_SEPARATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] EXTRACTOR = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] EXTRUDER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] FERMENTER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] FLUID_HEATER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] FLUID_SOLIDIFIER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] FORGE_HAMMER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] FORMING_PRESS = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] FERMENTER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] FLUID_HEATER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] FLUID_SOLIDIFIER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] FORGE_HAMMER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] FORMING_PRESS = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] LATHE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; public static final SimpleMachineMetaTileEntity[] MIXER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] ORE_WASHER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] ORE_WASHER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] PACKER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; public static final SimpleMachineMetaTileEntity[] UNPACKER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] POLARIZER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] LASER_ENGRAVER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] POLARIZER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] LASER_ENGRAVER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] SIFTER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] THERMAL_CENTRIFUGE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] THERMAL_CENTRIFUGE = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] WIREMILL = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] CIRCUIT_ASSEMBLER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] CIRCUIT_ASSEMBLER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; // TODO Replication system - //public static final SimpleMachineMetaTileEntity[] MASS_FABRICATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - //public static final SimpleMachineMetaTileEntity[] REPLICATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + // public static final SimpleMachineMetaTileEntity[] MASS_FABRICATOR = new + // SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + // public static final SimpleMachineMetaTileEntity[] REPLICATOR = new SimpleMachineMetaTileEntity[GTValues.V.length + // - 1]; public static final SimpleMachineMetaTileEntity[] SCANNER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] GAS_COLLECTOR = new MetaTileEntityGasCollector[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] GAS_COLLECTOR = new MetaTileEntityGasCollector[GTValues.V.length - + 1]; public static final MetaTileEntityRockBreaker[] ROCK_BREAKER = new MetaTileEntityRockBreaker[GTValues.V.length - 1]; public static final MetaTileEntityMiner[] MINER = new MetaTileEntityMiner[GTValues.V.length - 1]; - //GENERATORS SECTION + // GENERATORS SECTION public static final SimpleGeneratorMetaTileEntity[] COMBUSTION_GENERATOR = new SimpleGeneratorMetaTileEntity[4]; public static final SimpleGeneratorMetaTileEntity[] STEAM_TURBINE = new SimpleGeneratorMetaTileEntity[4]; public static final SimpleGeneratorMetaTileEntity[] GAS_TURBINE = new SimpleGeneratorMetaTileEntity[4]; - //MULTIBLOCK PARTS SECTION + // MULTIBLOCK PARTS SECTION public static final MetaTileEntityItemBus[] ITEM_IMPORT_BUS = new MetaTileEntityItemBus[GTValues.UHV + 1]; // ULV-UHV public static final MetaTileEntityItemBus[] ITEM_EXPORT_BUS = new MetaTileEntityItemBus[GTValues.UHV + 1]; public static final MetaTileEntityFluidHatch[] FLUID_IMPORT_HATCH = new MetaTileEntityFluidHatch[GTValues.UHV + 1]; @@ -125,14 +156,39 @@ public class MetaTileEntities { public static final MetaTileEntityMultiFluidHatch[] QUADRUPLE_EXPORT_HATCH = new MetaTileEntityMultiFluidHatch[6]; // EV-UHV public static final MetaTileEntityMultiFluidHatch[] NONUPLE_EXPORT_HATCH = new MetaTileEntityMultiFluidHatch[6]; // EV-UHV public static final MetaTileEntityEnergyHatch[] ENERGY_INPUT_HATCH = new MetaTileEntityEnergyHatch[GTValues.V.length]; - public static final MetaTileEntityEnergyHatch[] ENERGY_INPUT_HATCH_4A = new MetaTileEntityEnergyHatch[6]; // EV, IV, LuV, ZPM, UV, UHV - public static final MetaTileEntityEnergyHatch[] ENERGY_INPUT_HATCH_16A = new MetaTileEntityEnergyHatch[5]; // IV, LuV, ZPM, UV, UHV + public static final MetaTileEntityEnergyHatch[] ENERGY_INPUT_HATCH_4A = new MetaTileEntityEnergyHatch[6]; // EV, IV, + // LuV, + // ZPM, + // UV, UHV + public static final MetaTileEntityEnergyHatch[] ENERGY_INPUT_HATCH_16A = new MetaTileEntityEnergyHatch[5]; // IV, + // LuV, + // ZPM, + // UV, + // UHV public static final MetaTileEntityEnergyHatch[] ENERGY_OUTPUT_HATCH = new MetaTileEntityEnergyHatch[GTValues.V.length]; - public static final MetaTileEntityEnergyHatch[] ENERGY_OUTPUT_HATCH_4A = new MetaTileEntityEnergyHatch[6]; // EV, IV, LuV, ZPM, UV, UHV - public static final MetaTileEntityEnergyHatch[] ENERGY_OUTPUT_HATCH_16A = new MetaTileEntityEnergyHatch[5]; // IV, LuV, ZPM, UV, UHV - public static final MetaTileEntitySubstationEnergyHatch[] SUBSTATION_ENERGY_INPUT_HATCH = new MetaTileEntitySubstationEnergyHatch[5]; // IV, LuV, ZPM, UV, UHV - public static final MetaTileEntitySubstationEnergyHatch[] SUBSTATION_ENERGY_OUTPUT_HATCH = new MetaTileEntitySubstationEnergyHatch[5]; // IV, LuV, ZPM, UV, UHV - public static final MetaTileEntityRotorHolder[] ROTOR_HOLDER = new MetaTileEntityRotorHolder[6]; //HV, EV, IV, LuV, ZPM, UV + public static final MetaTileEntityEnergyHatch[] ENERGY_OUTPUT_HATCH_4A = new MetaTileEntityEnergyHatch[6]; // EV, + // IV, + // LuV, + // ZPM, + // UV, + // UHV + public static final MetaTileEntityEnergyHatch[] ENERGY_OUTPUT_HATCH_16A = new MetaTileEntityEnergyHatch[5]; // IV, + // LuV, + // ZPM, + // UV, + // UHV + public static final MetaTileEntitySubstationEnergyHatch[] SUBSTATION_ENERGY_INPUT_HATCH = new MetaTileEntitySubstationEnergyHatch[5]; // IV, + // LuV, + // ZPM, + // UV, + // UHV + public static final MetaTileEntitySubstationEnergyHatch[] SUBSTATION_ENERGY_OUTPUT_HATCH = new MetaTileEntitySubstationEnergyHatch[5]; // IV, + // LuV, + // ZPM, + // UV, + // UHV + public static final MetaTileEntityRotorHolder[] ROTOR_HOLDER = new MetaTileEntityRotorHolder[6]; // HV, EV, IV, LuV, + // ZPM, UV public static final MetaTileEntityMufflerHatch[] MUFFLER_HATCH = new MetaTileEntityMufflerHatch[GTValues.UV]; // LV-UV public static final MetaTileEntityFusionReactor[] FUSION_REACTOR = new MetaTileEntityFusionReactor[3]; public static final MetaTileEntityQuantumChest[] QUANTUM_CHEST = new MetaTileEntityQuantumChest[10]; @@ -171,7 +227,7 @@ public class MetaTileEntities { // Used for addons if they wish to disable certain tiers of machines private static final Map MID_TIER = new HashMap<>(); private static final Map HIGH_TIER = new HashMap<>(); - //STEAM AGE SECTION + // STEAM AGE SECTION public static SteamCoalBoiler STEAM_BOILER_COAL_BRONZE; public static SteamCoalBoiler STEAM_BOILER_COAL_STEEL; public static SteamSolarBoiler STEAM_BOILER_SOLAR_BRONZE; @@ -204,7 +260,7 @@ public class MetaTileEntities { public static MetaTileEntityMaintenanceHatch CONFIGURABLE_MAINTENANCE_HATCH; public static MetaTileEntityAutoMaintenanceHatch AUTO_MAINTENANCE_HATCH; public static MetaTileEntityCleaningMaintenanceHatch CLEANING_MAINTENANCE_HATCH; - //MULTIBLOCKS SECTION + // MULTIBLOCKS SECTION public static MetaTileEntityPrimitiveBlastFurnace PRIMITIVE_BLAST_FURNACE; public static MetaTileEntityCokeOven COKE_OVEN; public static MetaTileEntityElectricBlastFurnace ELECTRIC_BLAST_FURNACE; @@ -244,7 +300,7 @@ public class MetaTileEntities { public static MetaTileEntityPowerSubstation POWER_SUBSTATION; public static MetaTileEntityActiveTransformer ACTIVE_TRANSFORMER; - //STORAGE SECTION + // STORAGE SECTION public static MetaTileEntityLockedSafe LOCKED_SAFE; public static MetaTileEntityTankValve WOODEN_TANK_VALVE; public static MetaTileEntityTankValve STEEL_TANK_VALVE; @@ -265,7 +321,7 @@ public class MetaTileEntities { public static MetaTileEntityCrate STAINLESS_STEEL_CRATE; public static MetaTileEntityCrate TITANIUM_CRATE; public static MetaTileEntityCrate TUNGSTENSTEEL_CRATE; - //MISC MACHINES SECTION + // MISC MACHINES SECTION public static MetaTileEntityWorkbench WORKBENCH; public static MetaTileEntityCreativeEnergy CREATIVE_ENERGY; public static MetaTileEntityCreativeTank CREATIVE_TANK; @@ -286,23 +342,35 @@ public class MetaTileEntities { public static void init() { GTLog.logger.info("Registering MetaTileEntities"); - STEAM_BOILER_COAL_BRONZE = registerMetaTileEntity(1, new SteamCoalBoiler(gregtechId("steam_boiler_coal_bronze"), false)); - STEAM_BOILER_COAL_STEEL = registerMetaTileEntity(2, new SteamCoalBoiler(gregtechId("steam_boiler_coal_steel"), true)); + STEAM_BOILER_COAL_BRONZE = registerMetaTileEntity(1, + new SteamCoalBoiler(gregtechId("steam_boiler_coal_bronze"), false)); + STEAM_BOILER_COAL_STEEL = registerMetaTileEntity(2, + new SteamCoalBoiler(gregtechId("steam_boiler_coal_steel"), true)); - STEAM_BOILER_SOLAR_BRONZE = registerMetaTileEntity(3, new SteamSolarBoiler(gregtechId("steam_boiler_solar_bronze"), false)); - STEAM_BOILER_SOLAR_STEEL = registerMetaTileEntity(4, new SteamSolarBoiler(gregtechId("steam_boiler_solar_steel"), true)); + STEAM_BOILER_SOLAR_BRONZE = registerMetaTileEntity(3, + new SteamSolarBoiler(gregtechId("steam_boiler_solar_bronze"), false)); + STEAM_BOILER_SOLAR_STEEL = registerMetaTileEntity(4, + new SteamSolarBoiler(gregtechId("steam_boiler_solar_steel"), true)); - STEAM_BOILER_LAVA_BRONZE = registerMetaTileEntity(5, new SteamLavaBoiler(gregtechId("steam_boiler_lava_bronze"), false)); - STEAM_BOILER_LAVA_STEEL = registerMetaTileEntity(6, new SteamLavaBoiler(gregtechId("steam_boiler_lava_steel"), true)); + STEAM_BOILER_LAVA_BRONZE = registerMetaTileEntity(5, + new SteamLavaBoiler(gregtechId("steam_boiler_lava_bronze"), false)); + STEAM_BOILER_LAVA_STEEL = registerMetaTileEntity(6, + new SteamLavaBoiler(gregtechId("steam_boiler_lava_steel"), true)); - STEAM_EXTRACTOR_BRONZE = registerMetaTileEntity(7, new SteamExtractor(gregtechId("steam_extractor_bronze"), false)); - STEAM_EXTRACTOR_STEEL = registerMetaTileEntity(8, new SteamExtractor(gregtechId("steam_extractor_steel"), true)); + STEAM_EXTRACTOR_BRONZE = registerMetaTileEntity(7, + new SteamExtractor(gregtechId("steam_extractor_bronze"), false)); + STEAM_EXTRACTOR_STEEL = registerMetaTileEntity(8, + new SteamExtractor(gregtechId("steam_extractor_steel"), true)); - STEAM_MACERATOR_BRONZE = registerMetaTileEntity(9, new SteamMacerator(gregtechId("steam_macerator_bronze"), false)); - STEAM_MACERATOR_STEEL = registerMetaTileEntity(10, new SteamMacerator(gregtechId("steam_macerator_steel"), true)); + STEAM_MACERATOR_BRONZE = registerMetaTileEntity(9, + new SteamMacerator(gregtechId("steam_macerator_bronze"), false)); + STEAM_MACERATOR_STEEL = registerMetaTileEntity(10, + new SteamMacerator(gregtechId("steam_macerator_steel"), true)); - STEAM_COMPRESSOR_BRONZE = registerMetaTileEntity(11, new SteamCompressor(gregtechId("steam_compressor_bronze"), false)); - STEAM_COMPRESSOR_STEEL = registerMetaTileEntity(12, new SteamCompressor(gregtechId("steam_compressor_steel"), true)); + STEAM_COMPRESSOR_BRONZE = registerMetaTileEntity(11, + new SteamCompressor(gregtechId("steam_compressor_bronze"), false)); + STEAM_COMPRESSOR_STEEL = registerMetaTileEntity(12, + new SteamCompressor(gregtechId("steam_compressor_steel"), true)); STEAM_HAMMER_BRONZE = registerMetaTileEntity(13, new SteamHammer(gregtechId("steam_hammer_bronze"), false)); STEAM_HAMMER_STEEL = registerMetaTileEntity(14, new SteamHammer(gregtechId("steam_hammer_steel"), true)); @@ -310,37 +378,43 @@ public static void init() { STEAM_FURNACE_BRONZE = registerMetaTileEntity(15, new SteamFurnace(gregtechId("steam_furnace_bronze"), false)); STEAM_FURNACE_STEEL = registerMetaTileEntity(16, new SteamFurnace(gregtechId("steam_furnace_steel"), true)); - STEAM_ALLOY_SMELTER_BRONZE = registerMetaTileEntity(17, new SteamAlloySmelter(gregtechId("steam_alloy_smelter_bronze"), false)); - STEAM_ALLOY_SMELTER_STEEL = registerMetaTileEntity(18, new SteamAlloySmelter(gregtechId("steam_alloy_smelter_steel"), true)); + STEAM_ALLOY_SMELTER_BRONZE = registerMetaTileEntity(17, + new SteamAlloySmelter(gregtechId("steam_alloy_smelter_bronze"), false)); + STEAM_ALLOY_SMELTER_STEEL = registerMetaTileEntity(18, + new SteamAlloySmelter(gregtechId("steam_alloy_smelter_steel"), true)); - STEAM_ROCK_BREAKER_BRONZE = registerMetaTileEntity(19, new SteamRockBreaker(gregtechId("steam_rock_breaker_bronze"), false)); - STEAM_ROCK_BREAKER_STEEL = registerMetaTileEntity(20, new SteamRockBreaker(gregtechId("steam_rock_breaker_steel"), true)); + STEAM_ROCK_BREAKER_BRONZE = registerMetaTileEntity(19, + new SteamRockBreaker(gregtechId("steam_rock_breaker_bronze"), false)); + STEAM_ROCK_BREAKER_STEEL = registerMetaTileEntity(20, + new SteamRockBreaker(gregtechId("steam_rock_breaker_steel"), true)); STEAM_MINER = registerMetaTileEntity(21, new SteamMiner(gregtechId("steam_miner"), 320, 4, 0)); // Electric Furnace, IDs 50-64 - registerSimpleMetaTileEntity(ELECTRIC_FURNACE, 50, "electric_furnace", RecipeMaps.FURNACE_RECIPES, Textures.ELECTRIC_FURNACE_OVERLAY, true); + registerSimpleMetaTileEntity(ELECTRIC_FURNACE, 50, "electric_furnace", RecipeMaps.FURNACE_RECIPES, + Textures.ELECTRIC_FURNACE_OVERLAY, true); // Macerator, IDs 65-79 - registerMetaTileEntities(MACERATOR, 65, "macerator", (tier, voltageName) -> - new SimpleMachineMetaTileEntityResizable( + registerMetaTileEntities(MACERATOR, 65, "macerator", + (tier, voltageName) -> new SimpleMachineMetaTileEntityResizable( gregtechId(String.format("%s.%s", "macerator", voltageName)), RecipeMaps.MACERATOR_RECIPES, -1, switch (tier) { - case 1, 2 -> 1; - case 3 -> 3; - default -> 4; + case 1, 2 -> 1; + case 3 -> 3; + default -> 4; }, tier <= GTValues.MV ? Textures.MACERATOR_OVERLAY : Textures.PULVERIZER_OVERLAY, tier)); // Alloy Smelter, IDs 80-94 - registerSimpleMetaTileEntity(ALLOY_SMELTER, 80, "alloy_smelter", RecipeMaps.ALLOY_SMELTER_RECIPES, Textures.ALLOY_SMELTER_OVERLAY, true); + registerSimpleMetaTileEntity(ALLOY_SMELTER, 80, "alloy_smelter", RecipeMaps.ALLOY_SMELTER_RECIPES, + Textures.ALLOY_SMELTER_OVERLAY, true); // Arc Furnace, IDs 95-109 - registerMetaTileEntities(ARC_FURNACE, 95, "arc_furnace", (tier, voltageName) -> - new SimpleMachineMetaTileEntityResizable( + registerMetaTileEntities(ARC_FURNACE, 95, "arc_furnace", + (tier, voltageName) -> new SimpleMachineMetaTileEntityResizable( gregtechId(String.format("%s.%s", "arc_furnace", voltageName)), RecipeMaps.ARC_FURNACE_RECIPES, -1, @@ -351,84 +425,107 @@ public static void init() { GTUtility.hvCappedTankSizeFunction)); // Assembler, IDs 110-124 - registerSimpleMetaTileEntity(ASSEMBLER, 110, "assembler", RecipeMaps.ASSEMBLER_RECIPES, Textures.ASSEMBLER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(ASSEMBLER, 110, "assembler", RecipeMaps.ASSEMBLER_RECIPES, + Textures.ASSEMBLER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // Autoclave, IDs 125-139 - registerSimpleMetaTileEntity(AUTOCLAVE, 125, "autoclave", RecipeMaps.AUTOCLAVE_RECIPES, Textures.AUTOCLAVE_OVERLAY, false, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(AUTOCLAVE, 125, "autoclave", RecipeMaps.AUTOCLAVE_RECIPES, + Textures.AUTOCLAVE_OVERLAY, false, GTUtility.hvCappedTankSizeFunction); // Bender, IDs 140-154 registerSimpleMetaTileEntity(BENDER, 140, "bender", RecipeMaps.BENDER_RECIPES, Textures.BENDER_OVERLAY, true); // Brewery, IDs 155-169 - registerSimpleMetaTileEntity(BREWERY, 155, "brewery", RecipeMaps.BREWING_RECIPES, Textures.BREWERY_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(BREWERY, 155, "brewery", RecipeMaps.BREWING_RECIPES, Textures.BREWERY_OVERLAY, + true, GTUtility.hvCappedTankSizeFunction); // Canner, IDs 170-184 registerSimpleMetaTileEntity(CANNER, 170, "canner", RecipeMaps.CANNER_RECIPES, Textures.CANNER_OVERLAY, true); // Centrifuge, IDs 185-199 - registerSimpleMetaTileEntity(CENTRIFUGE, 185, "centrifuge", RecipeMaps.CENTRIFUGE_RECIPES, Textures.CENTRIFUGE_OVERLAY, false, GTUtility.largeTankSizeFunction); + registerSimpleMetaTileEntity(CENTRIFUGE, 185, "centrifuge", RecipeMaps.CENTRIFUGE_RECIPES, + Textures.CENTRIFUGE_OVERLAY, false, GTUtility.largeTankSizeFunction); // Chemical Bath, IDs 200-214 - registerSimpleMetaTileEntity(CHEMICAL_BATH, 200, "chemical_bath", RecipeMaps.CHEMICAL_BATH_RECIPES, Textures.CHEMICAL_BATH_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(CHEMICAL_BATH, 200, "chemical_bath", RecipeMaps.CHEMICAL_BATH_RECIPES, + Textures.CHEMICAL_BATH_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // Chemical Reactor, IDs 215-229 - registerSimpleMetaTileEntity(CHEMICAL_REACTOR, 215, "chemical_reactor", RecipeMaps.CHEMICAL_RECIPES, Textures.CHEMICAL_REACTOR_OVERLAY, true, tier -> 16000); + registerSimpleMetaTileEntity(CHEMICAL_REACTOR, 215, "chemical_reactor", RecipeMaps.CHEMICAL_RECIPES, + Textures.CHEMICAL_REACTOR_OVERLAY, true, tier -> 16000); // Compressor, IDs 230-244 - registerSimpleMetaTileEntity(COMPRESSOR, 230, "compressor", RecipeMaps.COMPRESSOR_RECIPES, Textures.COMPRESSOR_OVERLAY, true); + registerSimpleMetaTileEntity(COMPRESSOR, 230, "compressor", RecipeMaps.COMPRESSOR_RECIPES, + Textures.COMPRESSOR_OVERLAY, true); // Cutter, IDs 245-259 registerSimpleMetaTileEntity(CUTTER, 245, "cutter", RecipeMaps.CUTTER_RECIPES, Textures.CUTTER_OVERLAY, true); // Distillery, IDs 260-274 - registerSimpleMetaTileEntity(DISTILLERY, 260, "distillery", RecipeMaps.DISTILLERY_RECIPES, Textures.DISTILLERY_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(DISTILLERY, 260, "distillery", RecipeMaps.DISTILLERY_RECIPES, + Textures.DISTILLERY_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // Electrolyzer, IDs 275-289 - registerSimpleMetaTileEntity(ELECTROLYZER, 275, "electrolyzer", RecipeMaps.ELECTROLYZER_RECIPES, Textures.ELECTROLYZER_OVERLAY, false, GTUtility.largeTankSizeFunction); + registerSimpleMetaTileEntity(ELECTROLYZER, 275, "electrolyzer", RecipeMaps.ELECTROLYZER_RECIPES, + Textures.ELECTROLYZER_OVERLAY, false, GTUtility.largeTankSizeFunction); // Electromagnetic Separator, IDs 290-304 - registerSimpleMetaTileEntity(ELECTROMAGNETIC_SEPARATOR, 290, "electromagnetic_separator", RecipeMaps.ELECTROMAGNETIC_SEPARATOR_RECIPES, Textures.ELECTROMAGNETIC_SEPARATOR_OVERLAY, true); + registerSimpleMetaTileEntity(ELECTROMAGNETIC_SEPARATOR, 290, "electromagnetic_separator", + RecipeMaps.ELECTROMAGNETIC_SEPARATOR_RECIPES, Textures.ELECTROMAGNETIC_SEPARATOR_OVERLAY, true); // Extractor, IDs 305-319 - registerSimpleMetaTileEntity(EXTRACTOR, 305, "extractor", RecipeMaps.EXTRACTOR_RECIPES, Textures.EXTRACTOR_OVERLAY, true); + registerSimpleMetaTileEntity(EXTRACTOR, 305, "extractor", RecipeMaps.EXTRACTOR_RECIPES, + Textures.EXTRACTOR_OVERLAY, true); // Extruder, IDs 320-334 - registerSimpleMetaTileEntity(EXTRUDER, 320, "extruder", RecipeMaps.EXTRUDER_RECIPES, Textures.EXTRUDER_OVERLAY, true); + registerSimpleMetaTileEntity(EXTRUDER, 320, "extruder", RecipeMaps.EXTRUDER_RECIPES, Textures.EXTRUDER_OVERLAY, + true); // Fermenter, IDs 335-349 - registerSimpleMetaTileEntity(FERMENTER, 335, "fermenter", RecipeMaps.FERMENTING_RECIPES, Textures.FERMENTER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(FERMENTER, 335, "fermenter", RecipeMaps.FERMENTING_RECIPES, + Textures.FERMENTER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // TODO Replication system // Mass Fabricator, IDs 350-364 - //registerSimpleMetaTileEntity(MASS_FABRICATOR, 350, "mass_fabricator", RecipeMaps.MASS_FABRICATOR_RECIPES, Textures.MASS_FABRICATOR_OVERLAY, true); + // registerSimpleMetaTileEntity(MASS_FABRICATOR, 350, "mass_fabricator", RecipeMaps.MASS_FABRICATOR_RECIPES, + // Textures.MASS_FABRICATOR_OVERLAY, true); - // TODO Should anonymously override SimpleMachineMetaTileEntity#getCircuitSlotOverlay() to display the data stick overlay + // TODO Should anonymously override SimpleMachineMetaTileEntity#getCircuitSlotOverlay() to display the data + // stick overlay // Replicator, IDs 365-379 - //registerSimpleMetaTileEntity(REPLICATOR, 365, "replicator", RecipeMaps.REPLICATOR_RECIPES, Textures.REPLICATOR_OVERLAY, true); + // registerSimpleMetaTileEntity(REPLICATOR, 365, "replicator", RecipeMaps.REPLICATOR_RECIPES, + // Textures.REPLICATOR_OVERLAY, true); // Fluid Heater, IDs 380-394 - registerSimpleMetaTileEntity(FLUID_HEATER, 380, "fluid_heater", RecipeMaps.FLUID_HEATER_RECIPES, Textures.FLUID_HEATER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(FLUID_HEATER, 380, "fluid_heater", RecipeMaps.FLUID_HEATER_RECIPES, + Textures.FLUID_HEATER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // Fluid Solidifier, IDs 395-409 - registerSimpleMetaTileEntity(FLUID_SOLIDIFIER, 395, "fluid_solidifier", RecipeMaps.FLUID_SOLIDFICATION_RECIPES, Textures.FLUID_SOLIDIFIER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(FLUID_SOLIDIFIER, 395, "fluid_solidifier", RecipeMaps.FLUID_SOLIDFICATION_RECIPES, + Textures.FLUID_SOLIDIFIER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // Forge Hammer, IDs 410-424 - registerSimpleMetaTileEntity(FORGE_HAMMER, 410, "forge_hammer", RecipeMaps.FORGE_HAMMER_RECIPES, Textures.FORGE_HAMMER_OVERLAY, true); + registerSimpleMetaTileEntity(FORGE_HAMMER, 410, "forge_hammer", RecipeMaps.FORGE_HAMMER_RECIPES, + Textures.FORGE_HAMMER_OVERLAY, true); // Forming Press, IDs 425-439 - registerSimpleMetaTileEntity(FORMING_PRESS, 425, "forming_press", RecipeMaps.FORMING_PRESS_RECIPES, Textures.FORMING_PRESS_OVERLAY, true); + registerSimpleMetaTileEntity(FORMING_PRESS, 425, "forming_press", RecipeMaps.FORMING_PRESS_RECIPES, + Textures.FORMING_PRESS_OVERLAY, true); // Lathe, IDs 440-454 registerSimpleMetaTileEntity(LATHE, 440, "lathe", RecipeMaps.LATHE_RECIPES, Textures.LATHE_OVERLAY, true); // Scanner, IDs 455-469 - registerSimpleMetaTileEntity(SCANNER, 455, "scanner", RecipeMaps.SCANNER_RECIPES, Textures.SCANNER_OVERLAY, true); + registerSimpleMetaTileEntity(SCANNER, 455, "scanner", RecipeMaps.SCANNER_RECIPES, Textures.SCANNER_OVERLAY, + true); // Mixer, IDs 470-484 - registerSimpleMetaTileEntity(MIXER, 470, "mixer", RecipeMaps.MIXER_RECIPES, Textures.MIXER_OVERLAY, false, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(MIXER, 470, "mixer", RecipeMaps.MIXER_RECIPES, Textures.MIXER_OVERLAY, false, + GTUtility.hvCappedTankSizeFunction); // Ore Washer, IDs 485-499 - registerSimpleMetaTileEntity(ORE_WASHER, 485, "ore_washer", RecipeMaps.ORE_WASHER_RECIPES, Textures.ORE_WASHER_OVERLAY, true); + registerSimpleMetaTileEntity(ORE_WASHER, 485, "ore_washer", RecipeMaps.ORE_WASHER_RECIPES, + Textures.ORE_WASHER_OVERLAY, true); // Packer, IDs 500-514 registerSimpleMetaTileEntity(PACKER, 500, "packer", RecipeMaps.PACKER_RECIPES, Textures.PACKER_OVERLAY, true); @@ -436,12 +533,18 @@ public static void init() { // FREE, IDs 515-529 // Gas Collectors, IDs 530-544 - registerMetaTileEntities(GAS_COLLECTOR, 530, "gas_collector", (tier, voltageName) -> new MetaTileEntityGasCollector(gregtechId(String.format("%s.%s", "gas_collector", voltageName)), RecipeMaps.GAS_COLLECTOR_RECIPES, Textures.GAS_COLLECTOR_OVERLAY, tier, false, GTUtility.largeTankSizeFunction)); + registerMetaTileEntities(GAS_COLLECTOR, 530, "gas_collector", + (tier, voltageName) -> new MetaTileEntityGasCollector( + gregtechId(String.format("%s.%s", "gas_collector", voltageName)), + RecipeMaps.GAS_COLLECTOR_RECIPES, Textures.GAS_COLLECTOR_OVERLAY, tier, false, + GTUtility.largeTankSizeFunction)); // Polarizer, IDs 545-559 - registerSimpleMetaTileEntity(POLARIZER, 545, "polarizer", RecipeMaps.POLARIZER_RECIPES, Textures.POLARIZER_OVERLAY, true); + registerSimpleMetaTileEntity(POLARIZER, 545, "polarizer", RecipeMaps.POLARIZER_RECIPES, + Textures.POLARIZER_OVERLAY, true); // Laser Engraver, IDs 560-574 - registerSimpleMetaTileEntity(LASER_ENGRAVER, 560, "laser_engraver", RecipeMaps.LASER_ENGRAVER_RECIPES, Textures.LASER_ENGRAVER_OVERLAY, true); + registerSimpleMetaTileEntity(LASER_ENGRAVER, 560, "laser_engraver", RecipeMaps.LASER_ENGRAVER_RECIPES, + Textures.LASER_ENGRAVER_OVERLAY, true); // Sifter, IDs 575-589 registerSimpleMetaTileEntity(SIFTER, 575, "sifter", RecipeMaps.SIFTER_RECIPES, Textures.SIFTER_OVERLAY, true); @@ -449,16 +552,22 @@ public static void init() { // FREE, IDs 590-604 // Thermal Centrifuge, IDs 605-619 - registerSimpleMetaTileEntity(THERMAL_CENTRIFUGE, 605, "thermal_centrifuge", RecipeMaps.THERMAL_CENTRIFUGE_RECIPES, Textures.THERMAL_CENTRIFUGE_OVERLAY, true); + registerSimpleMetaTileEntity(THERMAL_CENTRIFUGE, 605, "thermal_centrifuge", + RecipeMaps.THERMAL_CENTRIFUGE_RECIPES, Textures.THERMAL_CENTRIFUGE_OVERLAY, true); // Wire Mill, IDs 620-634 - registerSimpleMetaTileEntity(WIREMILL, 620, "wiremill", RecipeMaps.WIREMILL_RECIPES, Textures.WIREMILL_OVERLAY, true); + registerSimpleMetaTileEntity(WIREMILL, 620, "wiremill", RecipeMaps.WIREMILL_RECIPES, Textures.WIREMILL_OVERLAY, + true); // Circuit Assembler, IDs 650-664 - registerSimpleMetaTileEntity(CIRCUIT_ASSEMBLER, 635, "circuit_assembler", RecipeMaps.CIRCUIT_ASSEMBLER_RECIPES, Textures.ASSEMBLER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(CIRCUIT_ASSEMBLER, 635, "circuit_assembler", RecipeMaps.CIRCUIT_ASSEMBLER_RECIPES, + Textures.ASSEMBLER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // Rock Breaker, IDs 665-679 - registerMetaTileEntities(ROCK_BREAKER, 665, "rock_breaker", (tier, voltageName) -> new MetaTileEntityRockBreaker(gregtechId(String.format("%s.%s", "rock_breaker", voltageName)), RecipeMaps.ROCK_BREAKER_RECIPES, Textures.ROCK_BREAKER_OVERLAY, tier)); + registerMetaTileEntities(ROCK_BREAKER, 665, "rock_breaker", + (tier, voltageName) -> new MetaTileEntityRockBreaker( + gregtechId(String.format("%s.%s", "rock_breaker", voltageName)), + RecipeMaps.ROCK_BREAKER_RECIPES, Textures.ROCK_BREAKER_OVERLAY, tier)); // Some space here for more SimpleMachines @@ -471,27 +580,53 @@ public static void init() { MINER[2] = registerMetaTileEntity(922, new MetaTileEntityMiner(gregtechId("miner.hv"), 3, 40, 24, 3)); // Diesel Generator, IDs 935-949 - COMBUSTION_GENERATOR[0] = registerMetaTileEntity(935, new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.lv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 1, GTUtility.genericGeneratorTankSizeFunction)); - COMBUSTION_GENERATOR[1] = registerMetaTileEntity(936, new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.mv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 2, GTUtility.genericGeneratorTankSizeFunction)); - COMBUSTION_GENERATOR[2] = registerMetaTileEntity(937, new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.hv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 3, GTUtility.genericGeneratorTankSizeFunction)); + COMBUSTION_GENERATOR[0] = registerMetaTileEntity(935, + new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.lv"), + RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 1, + GTUtility.genericGeneratorTankSizeFunction)); + COMBUSTION_GENERATOR[1] = registerMetaTileEntity(936, + new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.mv"), + RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 2, + GTUtility.genericGeneratorTankSizeFunction)); + COMBUSTION_GENERATOR[2] = registerMetaTileEntity(937, + new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.hv"), + RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 3, + GTUtility.genericGeneratorTankSizeFunction)); // Steam Turbine, IDs 950-964 - STEAM_TURBINE[0] = registerMetaTileEntity(950, new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.lv"), RecipeMaps.STEAM_TURBINE_FUELS, Textures.STEAM_TURBINE_OVERLAY, 1, GTUtility.steamGeneratorTankSizeFunction)); - STEAM_TURBINE[1] = registerMetaTileEntity(951, new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.mv"), RecipeMaps.STEAM_TURBINE_FUELS, Textures.STEAM_TURBINE_OVERLAY, 2, GTUtility.steamGeneratorTankSizeFunction)); - STEAM_TURBINE[2] = registerMetaTileEntity(952, new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.hv"), RecipeMaps.STEAM_TURBINE_FUELS, Textures.STEAM_TURBINE_OVERLAY, 3, GTUtility.steamGeneratorTankSizeFunction)); + STEAM_TURBINE[0] = registerMetaTileEntity(950, + new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.lv"), RecipeMaps.STEAM_TURBINE_FUELS, + Textures.STEAM_TURBINE_OVERLAY, 1, GTUtility.steamGeneratorTankSizeFunction)); + STEAM_TURBINE[1] = registerMetaTileEntity(951, + new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.mv"), RecipeMaps.STEAM_TURBINE_FUELS, + Textures.STEAM_TURBINE_OVERLAY, 2, GTUtility.steamGeneratorTankSizeFunction)); + STEAM_TURBINE[2] = registerMetaTileEntity(952, + new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.hv"), RecipeMaps.STEAM_TURBINE_FUELS, + Textures.STEAM_TURBINE_OVERLAY, 3, GTUtility.steamGeneratorTankSizeFunction)); // Gas Turbine, IDs 965-979 - GAS_TURBINE[0] = registerMetaTileEntity(965, new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.lv"), RecipeMaps.GAS_TURBINE_FUELS, Textures.GAS_TURBINE_OVERLAY, 1, GTUtility.genericGeneratorTankSizeFunction)); - GAS_TURBINE[1] = registerMetaTileEntity(966, new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.mv"), RecipeMaps.GAS_TURBINE_FUELS, Textures.GAS_TURBINE_OVERLAY, 2, GTUtility.genericGeneratorTankSizeFunction)); - GAS_TURBINE[2] = registerMetaTileEntity(967, new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.hv"), RecipeMaps.GAS_TURBINE_FUELS, Textures.GAS_TURBINE_OVERLAY, 3, GTUtility.genericGeneratorTankSizeFunction)); + GAS_TURBINE[0] = registerMetaTileEntity(965, + new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.lv"), RecipeMaps.GAS_TURBINE_FUELS, + Textures.GAS_TURBINE_OVERLAY, 1, GTUtility.genericGeneratorTankSizeFunction)); + GAS_TURBINE[1] = registerMetaTileEntity(966, + new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.mv"), RecipeMaps.GAS_TURBINE_FUELS, + Textures.GAS_TURBINE_OVERLAY, 2, GTUtility.genericGeneratorTankSizeFunction)); + GAS_TURBINE[2] = registerMetaTileEntity(967, + new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.hv"), RecipeMaps.GAS_TURBINE_FUELS, + Textures.GAS_TURBINE_OVERLAY, 3, GTUtility.genericGeneratorTankSizeFunction)); // Item Collector, IDs 980-983 - ITEM_COLLECTOR[0] = registerMetaTileEntity(980, new MetaTileEntityItemCollector(gregtechId("item_collector.lv"), 1, 8)); - ITEM_COLLECTOR[1] = registerMetaTileEntity(981, new MetaTileEntityItemCollector(gregtechId("item_collector.mv"), 2, 16)); - ITEM_COLLECTOR[2] = registerMetaTileEntity(982, new MetaTileEntityItemCollector(gregtechId("item_collector.hv"), 3, 32)); - ITEM_COLLECTOR[3] = registerMetaTileEntity(983, new MetaTileEntityItemCollector(gregtechId("item_collector.ev"), 4, 64)); - - MAGIC_ENERGY_ABSORBER = registerMetaTileEntity(984, new MetaTileEntityMagicEnergyAbsorber(gregtechId("magic_energy_absorber"))); + ITEM_COLLECTOR[0] = registerMetaTileEntity(980, + new MetaTileEntityItemCollector(gregtechId("item_collector.lv"), 1, 8)); + ITEM_COLLECTOR[1] = registerMetaTileEntity(981, + new MetaTileEntityItemCollector(gregtechId("item_collector.mv"), 2, 16)); + ITEM_COLLECTOR[2] = registerMetaTileEntity(982, + new MetaTileEntityItemCollector(gregtechId("item_collector.hv"), 3, 32)); + ITEM_COLLECTOR[3] = registerMetaTileEntity(983, + new MetaTileEntityItemCollector(gregtechId("item_collector.ev"), 4, 64)); + + MAGIC_ENERGY_ABSORBER = registerMetaTileEntity(984, + new MetaTileEntityMagicEnergyAbsorber(gregtechId("magic_energy_absorber"))); // Hulls, IDs 985-999 int endPos = GregTechAPI.isHighTier() ? HULL.length : Math.min(HULL.length - 1, GTValues.UV + 2); @@ -501,63 +636,103 @@ public static void init() { } // MULTIBLOCK START: IDs 1000-1149. Space left for addons to register Multiblocks grouped with the rest in JEI - PRIMITIVE_BLAST_FURNACE = registerMetaTileEntity(1000, new MetaTileEntityPrimitiveBlastFurnace(gregtechId("primitive_blast_furnace.bronze"))); - ELECTRIC_BLAST_FURNACE = registerMetaTileEntity(1001, new MetaTileEntityElectricBlastFurnace(gregtechId("electric_blast_furnace"))); + PRIMITIVE_BLAST_FURNACE = registerMetaTileEntity(1000, + new MetaTileEntityPrimitiveBlastFurnace(gregtechId("primitive_blast_furnace.bronze"))); + ELECTRIC_BLAST_FURNACE = registerMetaTileEntity(1001, + new MetaTileEntityElectricBlastFurnace(gregtechId("electric_blast_furnace"))); VACUUM_FREEZER = registerMetaTileEntity(1002, new MetaTileEntityVacuumFreezer(gregtechId("vacuum_freezer"))); - IMPLOSION_COMPRESSOR = registerMetaTileEntity(1003, new MetaTileEntityImplosionCompressor(gregtechId("implosion_compressor"))); + IMPLOSION_COMPRESSOR = registerMetaTileEntity(1003, + new MetaTileEntityImplosionCompressor(gregtechId("implosion_compressor"))); PYROLYSE_OVEN = registerMetaTileEntity(1004, new MetaTileEntityPyrolyseOven(gregtechId("pyrolyse_oven"))); - DISTILLATION_TOWER = registerMetaTileEntity(1005, new MetaTileEntityDistillationTower(gregtechId("distillation_tower"))); + DISTILLATION_TOWER = registerMetaTileEntity(1005, + new MetaTileEntityDistillationTower(gregtechId("distillation_tower"))); MULTI_FURNACE = registerMetaTileEntity(1006, new MetaTileEntityMultiSmelter(gregtechId("multi_furnace"))); - LARGE_COMBUSTION_ENGINE = registerMetaTileEntity(1007, new MetaTileEntityLargeCombustionEngine(gregtechId("large_combustion_engine"), GTValues.EV)); - EXTREME_COMBUSTION_ENGINE = registerMetaTileEntity(1008, new MetaTileEntityLargeCombustionEngine(gregtechId("extreme_combustion_engine"), GTValues.IV)); + LARGE_COMBUSTION_ENGINE = registerMetaTileEntity(1007, + new MetaTileEntityLargeCombustionEngine(gregtechId("large_combustion_engine"), GTValues.EV)); + EXTREME_COMBUSTION_ENGINE = registerMetaTileEntity(1008, + new MetaTileEntityLargeCombustionEngine(gregtechId("extreme_combustion_engine"), GTValues.IV)); CRACKER = registerMetaTileEntity(1009, new MetaTileEntityCrackingUnit(gregtechId("cracker"))); - LARGE_STEAM_TURBINE = registerMetaTileEntity(1010, new MetaTileEntityLargeTurbine(gregtechId("large_turbine.steam"), RecipeMaps.STEAM_TURBINE_FUELS, 3, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_TURBINE_CASING), MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_GEARBOX), Textures.SOLID_STEEL_CASING, false, Textures.LARGE_STEAM_TURBINE_OVERLAY)); - LARGE_GAS_TURBINE = registerMetaTileEntity(1011, new MetaTileEntityLargeTurbine(gregtechId("large_turbine.gas"), RecipeMaps.GAS_TURBINE_FUELS, 4, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_TURBINE_CASING), MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_STEEL_GEARBOX), Textures.CLEAN_STAINLESS_STEEL_CASING, true, Textures.LARGE_GAS_TURBINE_OVERLAY)); - LARGE_PLASMA_TURBINE = registerMetaTileEntity(1012, new MetaTileEntityLargeTurbine(gregtechId("large_turbine.plasma"), RecipeMaps.PLASMA_GENERATOR_FUELS, 5, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.TUNGSTENSTEEL_TURBINE_CASING), MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.TUNGSTENSTEEL_GEARBOX), Textures.ROBUST_TUNGSTENSTEEL_CASING, false, Textures.LARGE_PLASMA_TURBINE_OVERLAY)); - - LARGE_BRONZE_BOILER = registerMetaTileEntity(1013, new MetaTileEntityLargeBoiler(gregtechId("large_boiler.bronze"), BoilerType.BRONZE)); - LARGE_STEEL_BOILER = registerMetaTileEntity(1014, new MetaTileEntityLargeBoiler(gregtechId("large_boiler.steel"), BoilerType.STEEL)); - LARGE_TITANIUM_BOILER = registerMetaTileEntity(1015, new MetaTileEntityLargeBoiler(gregtechId("large_boiler.titanium"), BoilerType.TITANIUM)); - LARGE_TUNGSTENSTEEL_BOILER = registerMetaTileEntity(1016, new MetaTileEntityLargeBoiler(gregtechId("large_boiler.tungstensteel"), BoilerType.TUNGSTENSTEEL)); + LARGE_STEAM_TURBINE = registerMetaTileEntity(1010, + new MetaTileEntityLargeTurbine(gregtechId("large_turbine.steam"), RecipeMaps.STEAM_TURBINE_FUELS, 3, + MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_TURBINE_CASING), + MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_GEARBOX), + Textures.SOLID_STEEL_CASING, false, Textures.LARGE_STEAM_TURBINE_OVERLAY)); + LARGE_GAS_TURBINE = registerMetaTileEntity(1011, new MetaTileEntityLargeTurbine(gregtechId("large_turbine.gas"), + RecipeMaps.GAS_TURBINE_FUELS, 4, + MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_TURBINE_CASING), + MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_STEEL_GEARBOX), + Textures.CLEAN_STAINLESS_STEEL_CASING, true, Textures.LARGE_GAS_TURBINE_OVERLAY)); + LARGE_PLASMA_TURBINE = registerMetaTileEntity(1012, + new MetaTileEntityLargeTurbine(gregtechId("large_turbine.plasma"), RecipeMaps.PLASMA_GENERATOR_FUELS, 5, + MetaBlocks.TURBINE_CASING + .getState(BlockTurbineCasing.TurbineCasingType.TUNGSTENSTEEL_TURBINE_CASING), + MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.TUNGSTENSTEEL_GEARBOX), + Textures.ROBUST_TUNGSTENSTEEL_CASING, false, Textures.LARGE_PLASMA_TURBINE_OVERLAY)); + + LARGE_BRONZE_BOILER = registerMetaTileEntity(1013, + new MetaTileEntityLargeBoiler(gregtechId("large_boiler.bronze"), BoilerType.BRONZE)); + LARGE_STEEL_BOILER = registerMetaTileEntity(1014, + new MetaTileEntityLargeBoiler(gregtechId("large_boiler.steel"), BoilerType.STEEL)); + LARGE_TITANIUM_BOILER = registerMetaTileEntity(1015, + new MetaTileEntityLargeBoiler(gregtechId("large_boiler.titanium"), BoilerType.TITANIUM)); + LARGE_TUNGSTENSTEEL_BOILER = registerMetaTileEntity(1016, + new MetaTileEntityLargeBoiler(gregtechId("large_boiler.tungstensteel"), BoilerType.TUNGSTENSTEEL)); COKE_OVEN = registerMetaTileEntity(1017, new MetaTileEntityCokeOven(gregtechId("coke_oven"))); COKE_OVEN_HATCH = registerMetaTileEntity(1018, new MetaTileEntityCokeOvenHatch(gregtechId("coke_oven_hatch"))); ASSEMBLY_LINE = registerMetaTileEntity(1019, new MetaTileEntityAssemblyLine(gregtechId("assembly_line"))); - FUSION_REACTOR[0] = registerMetaTileEntity(1020, new MetaTileEntityFusionReactor(gregtechId("fusion_reactor.luv"), GTValues.LuV)); - FUSION_REACTOR[1] = registerMetaTileEntity(1021, new MetaTileEntityFusionReactor(gregtechId("fusion_reactor.zpm"), GTValues.ZPM)); - FUSION_REACTOR[2] = registerMetaTileEntity(1022, new MetaTileEntityFusionReactor(gregtechId("fusion_reactor.uv"), GTValues.UV)); + FUSION_REACTOR[0] = registerMetaTileEntity(1020, + new MetaTileEntityFusionReactor(gregtechId("fusion_reactor.luv"), GTValues.LuV)); + FUSION_REACTOR[1] = registerMetaTileEntity(1021, + new MetaTileEntityFusionReactor(gregtechId("fusion_reactor.zpm"), GTValues.ZPM)); + FUSION_REACTOR[2] = registerMetaTileEntity(1022, + new MetaTileEntityFusionReactor(gregtechId("fusion_reactor.uv"), GTValues.UV)); - LARGE_CHEMICAL_REACTOR = registerMetaTileEntity(1023, new MetaTileEntityLargeChemicalReactor(gregtechId("large_chemical_reactor"))); + LARGE_CHEMICAL_REACTOR = registerMetaTileEntity(1023, + new MetaTileEntityLargeChemicalReactor(gregtechId("large_chemical_reactor"))); STEAM_OVEN = registerMetaTileEntity(1024, new MetaTileEntitySteamOven(gregtechId("steam_oven"))); STEAM_GRINDER = registerMetaTileEntity(1025, new MetaTileEntitySteamGrinder(gregtechId("steam_grinder"))); - BASIC_LARGE_MINER = registerMetaTileEntity(1026, new MetaTileEntityLargeMiner(gregtechId("large_miner.ev"), GTValues.EV, 16, 3, 4, Materials.Steel, 8)); - LARGE_MINER = registerMetaTileEntity(1027, new MetaTileEntityLargeMiner(gregtechId("large_miner.iv"), GTValues.IV, 4, 5, 5, Materials.Titanium, 16)); - ADVANCED_LARGE_MINER = registerMetaTileEntity(1028, new MetaTileEntityLargeMiner(gregtechId("large_miner.luv"), GTValues.LuV, 1, 7, 6, Materials.TungstenSteel, 32)); + BASIC_LARGE_MINER = registerMetaTileEntity(1026, + new MetaTileEntityLargeMiner(gregtechId("large_miner.ev"), GTValues.EV, 16, 3, 4, Materials.Steel, 8)); + LARGE_MINER = registerMetaTileEntity(1027, new MetaTileEntityLargeMiner(gregtechId("large_miner.iv"), + GTValues.IV, 4, 5, 5, Materials.Titanium, 16)); + ADVANCED_LARGE_MINER = registerMetaTileEntity(1028, new MetaTileEntityLargeMiner(gregtechId("large_miner.luv"), + GTValues.LuV, 1, 7, 6, Materials.TungstenSteel, 32)); CENTRAL_MONITOR = registerMetaTileEntity(1029, new MetaTileEntityCentralMonitor(gregtechId("central_monitor"))); - PROCESSING_ARRAY = registerMetaTileEntity(1030, new MetaTileEntityProcessingArray(gregtechId("processing_array"), 0)); - ADVANCED_PROCESSING_ARRAY = registerMetaTileEntity(1031, new MetaTileEntityProcessingArray(gregtechId("advanced_processing_array"), 1)); + PROCESSING_ARRAY = registerMetaTileEntity(1030, + new MetaTileEntityProcessingArray(gregtechId("processing_array"), 0)); + ADVANCED_PROCESSING_ARRAY = registerMetaTileEntity(1031, + new MetaTileEntityProcessingArray(gregtechId("advanced_processing_array"), 1)); - BASIC_FLUID_DRILLING_RIG = registerMetaTileEntity(1032, new MetaTileEntityFluidDrill(gregtechId("fluid_drilling_rig.mv"), 2)); - FLUID_DRILLING_RIG = registerMetaTileEntity(1033, new MetaTileEntityFluidDrill(gregtechId("fluid_drilling_rig.hv"), 3)); - ADVANCED_FLUID_DRILLING_RIG = registerMetaTileEntity(1034, new MetaTileEntityFluidDrill(gregtechId("fluid_drilling_rig.ev"), 4)); + BASIC_FLUID_DRILLING_RIG = registerMetaTileEntity(1032, + new MetaTileEntityFluidDrill(gregtechId("fluid_drilling_rig.mv"), 2)); + FLUID_DRILLING_RIG = registerMetaTileEntity(1033, + new MetaTileEntityFluidDrill(gregtechId("fluid_drilling_rig.hv"), 3)); + ADVANCED_FLUID_DRILLING_RIG = registerMetaTileEntity(1034, + new MetaTileEntityFluidDrill(gregtechId("fluid_drilling_rig.ev"), 4)); CLEANROOM = registerMetaTileEntity(1035, new MetaTileEntityCleanroom(gregtechId("cleanroom"))); - CHARCOAL_PILE_IGNITER = registerMetaTileEntity(1036, new MetaTileEntityCharcoalPileIgniter(gregtechId("charcoal_pile"))); + CHARCOAL_PILE_IGNITER = registerMetaTileEntity(1036, + new MetaTileEntityCharcoalPileIgniter(gregtechId("charcoal_pile"))); DATA_BANK = registerMetaTileEntity(1037, new MetaTileEntityDataBank(gregtechId("data_bank"))); - RESEARCH_STATION = registerMetaTileEntity(1038, new MetaTileEntityResearchStation(gregtechId("research_station"))); - HIGH_PERFORMANCE_COMPUTING_ARRAY = registerMetaTileEntity(1039, new MetaTileEntityHPCA(gregtechId("high_performance_computing_array"))); + RESEARCH_STATION = registerMetaTileEntity(1038, + new MetaTileEntityResearchStation(gregtechId("research_station"))); + HIGH_PERFORMANCE_COMPUTING_ARRAY = registerMetaTileEntity(1039, + new MetaTileEntityHPCA(gregtechId("high_performance_computing_array"))); NETWORK_SWITCH = registerMetaTileEntity(1040, new MetaTileEntityNetworkSwitch(gregtechId("network_switch"))); - POWER_SUBSTATION = registerMetaTileEntity(1041, new MetaTileEntityPowerSubstation(gregtechId("power_substation"))); - ACTIVE_TRANSFORMER = registerMetaTileEntity(1042, new MetaTileEntityActiveTransformer(gregtechId("active_transformer"))); + POWER_SUBSTATION = registerMetaTileEntity(1041, + new MetaTileEntityPowerSubstation(gregtechId("power_substation"))); + ACTIVE_TRANSFORMER = registerMetaTileEntity(1042, + new MetaTileEntityActiveTransformer(gregtechId("active_transformer"))); // MISC MTE's START: IDs 1150-2000 @@ -566,8 +741,10 @@ public static void init() { String voltageName = GTValues.VN[i].toLowerCase(); ITEM_IMPORT_BUS[i] = new MetaTileEntityItemBus(gregtechId("item_bus.import." + voltageName), i, false); ITEM_EXPORT_BUS[i] = new MetaTileEntityItemBus(gregtechId("item_bus.export." + voltageName), i, true); - FLUID_IMPORT_HATCH[i] = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import." + voltageName), i, false); - FLUID_EXPORT_HATCH[i] = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export." + voltageName), i, true); + FLUID_IMPORT_HATCH[i] = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import." + voltageName), i, + false); + FLUID_EXPORT_HATCH[i] = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export." + voltageName), i, + true); registerMetaTileEntity(1150 + i, ITEM_IMPORT_BUS[i]); registerMetaTileEntity(1165 + i, ITEM_EXPORT_BUS[i]); @@ -578,36 +755,53 @@ public static void init() { // IDs 1190, 1191, 1205, and 1206 reserved for multi-fluid hatches // Energy Input/Output Hatches, IDs 1210-1269 - endPos = GregTechAPI.isHighTier() ? ENERGY_INPUT_HATCH.length - 1 : Math.min(ENERGY_INPUT_HATCH.length - 1, GTValues.UV + 2); + endPos = GregTechAPI.isHighTier() ? ENERGY_INPUT_HATCH.length - 1 : + Math.min(ENERGY_INPUT_HATCH.length - 1, GTValues.UV + 2); for (int i = 0; i < endPos; i++) { String voltageName = GTValues.VN[i].toLowerCase(); - ENERGY_INPUT_HATCH[i] = registerMetaTileEntity(1210 + i, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input." + voltageName), i, 2, false)); - ENERGY_OUTPUT_HATCH[i] = registerMetaTileEntity(1225 + i, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output." + voltageName), i, 2, true)); + ENERGY_INPUT_HATCH[i] = registerMetaTileEntity(1210 + i, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input." + voltageName), i, 2, false)); + ENERGY_OUTPUT_HATCH[i] = registerMetaTileEntity(1225 + i, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output." + voltageName), i, 2, true)); if (i >= GTValues.IV && i <= GTValues.UHV) { - ENERGY_INPUT_HATCH_4A[i + 1 - GTValues.IV] = registerMetaTileEntity(1240 + i - GTValues.IV, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input_4a." + voltageName), i, 4, false)); - ENERGY_INPUT_HATCH_16A[i - GTValues.IV] = registerMetaTileEntity(1245 + i - GTValues.IV, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input_16a." + voltageName), i, 16, false)); - ENERGY_OUTPUT_HATCH_4A[i + 1 - GTValues.IV] = registerMetaTileEntity(1250 + i - GTValues.IV, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output_4a." + voltageName), i, 4, true)); - ENERGY_OUTPUT_HATCH_16A[i - GTValues.IV] = registerMetaTileEntity(1255 + i - GTValues.IV, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output_16a." + voltageName), i, 16, true)); - SUBSTATION_ENERGY_INPUT_HATCH[i - GTValues.IV] = registerMetaTileEntity(1260 + i - GTValues.IV, new MetaTileEntitySubstationEnergyHatch(gregtechId("substation_hatch.input_64a." + voltageName), i, 64, false)); - SUBSTATION_ENERGY_OUTPUT_HATCH[i - GTValues.IV] = registerMetaTileEntity(1265 + i - GTValues.IV, new MetaTileEntitySubstationEnergyHatch(gregtechId("substation_hatch.output_64a." + voltageName), i, 64, true)); + ENERGY_INPUT_HATCH_4A[i + 1 - GTValues.IV] = registerMetaTileEntity(1240 + i - GTValues.IV, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input_4a." + voltageName), i, 4, false)); + ENERGY_INPUT_HATCH_16A[i - GTValues.IV] = registerMetaTileEntity(1245 + i - GTValues.IV, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input_16a." + voltageName), i, 16, + false)); + ENERGY_OUTPUT_HATCH_4A[i + 1 - GTValues.IV] = registerMetaTileEntity(1250 + i - GTValues.IV, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output_4a." + voltageName), i, 4, true)); + ENERGY_OUTPUT_HATCH_16A[i - GTValues.IV] = registerMetaTileEntity(1255 + i - GTValues.IV, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output_16a." + voltageName), i, 16, + true)); + SUBSTATION_ENERGY_INPUT_HATCH[i - GTValues.IV] = registerMetaTileEntity(1260 + i - GTValues.IV, + new MetaTileEntitySubstationEnergyHatch(gregtechId("substation_hatch.input_64a." + voltageName), + i, 64, false)); + SUBSTATION_ENERGY_OUTPUT_HATCH[i - GTValues.IV] = registerMetaTileEntity(1265 + i - GTValues.IV, + new MetaTileEntitySubstationEnergyHatch( + gregtechId("substation_hatch.output_64a." + voltageName), i, 64, true)); } } - ENERGY_INPUT_HATCH_4A[0] = registerMetaTileEntity(1399, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input_4a.ev"), GTValues.EV, 4, false)); - ENERGY_OUTPUT_HATCH_4A[0] = registerMetaTileEntity(1400, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output_4a.ev"), GTValues.EV, 4, true)); - + ENERGY_INPUT_HATCH_4A[0] = registerMetaTileEntity(1399, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input_4a.ev"), GTValues.EV, 4, false)); + ENERGY_OUTPUT_HATCH_4A[0] = registerMetaTileEntity(1400, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output_4a.ev"), GTValues.EV, 4, true)); // Transformer, IDs 1270-1299 endPos = GregTechAPI.isHighTier() ? TRANSFORMER.length - 1 : Math.min(TRANSFORMER.length - 1, GTValues.UV); for (int i = 0; i <= endPos; i++) { // 1A <-> 4A - MetaTileEntityTransformer transformer = new MetaTileEntityTransformer(gregtechId("transformer." + GTValues.VN[i].toLowerCase()), i); + MetaTileEntityTransformer transformer = new MetaTileEntityTransformer( + gregtechId("transformer." + GTValues.VN[i].toLowerCase()), i); TRANSFORMER[i] = registerMetaTileEntity(1270 + (i), transformer); // 2A <-> 8A and 4A <-> 16A - MetaTileEntityTransformer adjustableTransformer = new MetaTileEntityTransformer(gregtechId("transformer.hi_amp." + GTValues.VN[i].toLowerCase()), i, 2, 4); + MetaTileEntityTransformer adjustableTransformer = new MetaTileEntityTransformer( + gregtechId("transformer.hi_amp." + GTValues.VN[i].toLowerCase()), i, 2, 4); HI_AMP_TRANSFORMER[i] = registerMetaTileEntity(1730 + i, adjustableTransformer); // 16A <-> 64A (can do other amperages because of legacy compat) - adjustableTransformer = new MetaTileEntityTransformer(gregtechId("transformer.adjustable." + GTValues.VN[i].toLowerCase()), i, 1, 2, 4, 16); + adjustableTransformer = new MetaTileEntityTransformer( + gregtechId("transformer.adjustable." + GTValues.VN[i].toLowerCase()), i, 1, 2, 4, 16); POWER_TRANSFORMER[i] = registerMetaTileEntity(1285 + (i), adjustableTransformer); } @@ -620,14 +814,17 @@ public static void init() { } // Battery Buffer, IDs 1315-1360 - endPos = GregTechAPI.isHighTier() ? BATTERY_BUFFER[0].length - 1 : Math.min(BATTERY_BUFFER[0].length - 1, GTValues.UHV + 1); - int[] batteryBufferSlots = new int[]{4, 8, 16}; + endPos = GregTechAPI.isHighTier() ? BATTERY_BUFFER[0].length - 1 : + Math.min(BATTERY_BUFFER[0].length - 1, GTValues.UHV + 1); + int[] batteryBufferSlots = new int[] { 4, 8, 16 }; for (int slot = 0; slot < batteryBufferSlots.length; slot++) { BATTERY_BUFFER[slot] = new MetaTileEntityBatteryBuffer[endPos]; for (int i = 0; i < endPos; i++) { String bufferId = "battery_buffer." + GTValues.VN[i].toLowerCase() + "." + batteryBufferSlots[slot]; - MetaTileEntityBatteryBuffer batteryBuffer = new MetaTileEntityBatteryBuffer(gregtechId(bufferId), i, batteryBufferSlots[slot]); - BATTERY_BUFFER[slot][i] = registerMetaTileEntity(1315 + BATTERY_BUFFER[slot].length * slot + i, batteryBuffer); + MetaTileEntityBatteryBuffer batteryBuffer = new MetaTileEntityBatteryBuffer(gregtechId(bufferId), i, + batteryBufferSlots[slot]); + BATTERY_BUFFER[slot][i] = registerMetaTileEntity(1315 + BATTERY_BUFFER[slot].length * slot + i, + batteryBuffer); } } @@ -641,51 +838,83 @@ public static void init() { // World Accelerators, IDs 1390-1404 if (ConfigHolder.machines.enableWorldAccelerators) { - WORLD_ACCELERATOR[0] = registerMetaTileEntity(1390, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.lv"), 1)); - WORLD_ACCELERATOR[1] = registerMetaTileEntity(1391, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.mv"), 2)); - WORLD_ACCELERATOR[2] = registerMetaTileEntity(1392, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.hv"), 3)); - WORLD_ACCELERATOR[3] = registerMetaTileEntity(1393, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.ev"), 4)); - WORLD_ACCELERATOR[4] = registerMetaTileEntity(1394, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.iv"), 5)); - WORLD_ACCELERATOR[5] = registerMetaTileEntity(1395, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.luv"), 6)); - WORLD_ACCELERATOR[6] = registerMetaTileEntity(1396, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.zpm"), 7)); - WORLD_ACCELERATOR[7] = registerMetaTileEntity(1397, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.uv"), 8)); + WORLD_ACCELERATOR[0] = registerMetaTileEntity(1390, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.lv"), 1)); + WORLD_ACCELERATOR[1] = registerMetaTileEntity(1391, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.mv"), 2)); + WORLD_ACCELERATOR[2] = registerMetaTileEntity(1392, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.hv"), 3)); + WORLD_ACCELERATOR[3] = registerMetaTileEntity(1393, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.ev"), 4)); + WORLD_ACCELERATOR[4] = registerMetaTileEntity(1394, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.iv"), 5)); + WORLD_ACCELERATOR[5] = registerMetaTileEntity(1395, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.luv"), 6)); + WORLD_ACCELERATOR[6] = registerMetaTileEntity(1396, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.zpm"), 7)); + WORLD_ACCELERATOR[7] = registerMetaTileEntity(1397, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.uv"), 8)); } MACHINE_HATCH = registerMetaTileEntity(1398, new MetaTileEntityMachineHatch(gregtechId("machine_hatch"), 5)); // 1399 and 1400 are taken by the EV 4A hatches, and are grouped near the other registration rather than here - // 1401 is taken by the Cleanroom Maintenance hatches, and is grouped with the maintenance hatch registration rather than here - - PASSTHROUGH_HATCH_ITEM = registerMetaTileEntity(1402, new MetaTileEntityPassthroughHatchItem(gregtechId("passthrough_hatch_item"), 3)); - PASSTHROUGH_HATCH_FLUID = registerMetaTileEntity(1403, new MetaTileEntityPassthroughHatchFluid(gregtechId("passthrough_hatch_fluid"), 3)); - - DATA_ACCESS_HATCH = registerMetaTileEntity(1404, new MetaTileEntityDataAccessHatch(gregtechId("data_access_hatch"), GTValues.EV, false)); - ADVANCED_DATA_ACCESS_HATCH = registerMetaTileEntity(1405, new MetaTileEntityDataAccessHatch(gregtechId("data_access_hatch.advanced"), GTValues.LuV, false)); - CREATIVE_DATA_HATCH = registerMetaTileEntity(1406, new MetaTileEntityDataAccessHatch(gregtechId("data_access_hatch.creative"), GTValues.MAX, true)); - OPTICAL_DATA_HATCH_RECEIVER = registerMetaTileEntity(1407, new MetaTileEntityOpticalDataHatch(gregtechId("data_access_hatch.optical.receiver"), false)); - OPTICAL_DATA_HATCH_TRANSMITTER = registerMetaTileEntity(1408, new MetaTileEntityOpticalDataHatch(gregtechId("data_access_hatch.optical.transmitter"), true)); - COMPUTATION_HATCH_RECEIVER = registerMetaTileEntity(1409, new MetaTileEntityComputationHatch(gregtechId("computation_hatch.receiver"), false)); - COMPUTATION_HATCH_TRANSMITTER = registerMetaTileEntity(1410, new MetaTileEntityComputationHatch(gregtechId("computation_hatch.transmitter"), true)); - OBJECT_HOLDER = registerMetaTileEntity(1411, new MetaTileEntityObjectHolder(gregtechId("research_station.object_holder"))); - HPCA_EMPTY_COMPONENT = registerMetaTileEntity(1412, new MetaTileEntityHPCAEmpty(gregtechId("hpca.empty_component"))); - HPCA_COMPUTATION_COMPONENT = registerMetaTileEntity(1413, new MetaTileEntityHPCAComputation(gregtechId("hpca.computation_component"), false)); - HPCA_ADVANCED_COMPUTATION_COMPONENT = registerMetaTileEntity(1414, new MetaTileEntityHPCAComputation(gregtechId("hpca.advanced_computation_component"), true)); - HPCA_HEAT_SINK_COMPONENT = registerMetaTileEntity(1415, new MetaTileEntityHPCACooler(gregtechId("hpca.heat_sink_component"), false)); - HPCA_ACTIVE_COOLER_COMPONENT = registerMetaTileEntity(1416, new MetaTileEntityHPCACooler(gregtechId("hpca.active_cooler_component"), true)); - HPCA_BRIDGE_COMPONENT = registerMetaTileEntity(1417, new MetaTileEntityHPCABridge(gregtechId("hpca.bridge_component"))); + // 1401 is taken by the Cleanroom Maintenance hatches, and is grouped with the maintenance hatch registration + // rather than here + + PASSTHROUGH_HATCH_ITEM = registerMetaTileEntity(1402, + new MetaTileEntityPassthroughHatchItem(gregtechId("passthrough_hatch_item"), 3)); + PASSTHROUGH_HATCH_FLUID = registerMetaTileEntity(1403, + new MetaTileEntityPassthroughHatchFluid(gregtechId("passthrough_hatch_fluid"), 3)); + + DATA_ACCESS_HATCH = registerMetaTileEntity(1404, + new MetaTileEntityDataAccessHatch(gregtechId("data_access_hatch"), GTValues.EV, false)); + ADVANCED_DATA_ACCESS_HATCH = registerMetaTileEntity(1405, + new MetaTileEntityDataAccessHatch(gregtechId("data_access_hatch.advanced"), GTValues.LuV, false)); + CREATIVE_DATA_HATCH = registerMetaTileEntity(1406, + new MetaTileEntityDataAccessHatch(gregtechId("data_access_hatch.creative"), GTValues.MAX, true)); + OPTICAL_DATA_HATCH_RECEIVER = registerMetaTileEntity(1407, + new MetaTileEntityOpticalDataHatch(gregtechId("data_access_hatch.optical.receiver"), false)); + OPTICAL_DATA_HATCH_TRANSMITTER = registerMetaTileEntity(1408, + new MetaTileEntityOpticalDataHatch(gregtechId("data_access_hatch.optical.transmitter"), true)); + COMPUTATION_HATCH_RECEIVER = registerMetaTileEntity(1409, + new MetaTileEntityComputationHatch(gregtechId("computation_hatch.receiver"), false)); + COMPUTATION_HATCH_TRANSMITTER = registerMetaTileEntity(1410, + new MetaTileEntityComputationHatch(gregtechId("computation_hatch.transmitter"), true)); + OBJECT_HOLDER = registerMetaTileEntity(1411, + new MetaTileEntityObjectHolder(gregtechId("research_station.object_holder"))); + HPCA_EMPTY_COMPONENT = registerMetaTileEntity(1412, + new MetaTileEntityHPCAEmpty(gregtechId("hpca.empty_component"))); + HPCA_COMPUTATION_COMPONENT = registerMetaTileEntity(1413, + new MetaTileEntityHPCAComputation(gregtechId("hpca.computation_component"), false)); + HPCA_ADVANCED_COMPUTATION_COMPONENT = registerMetaTileEntity(1414, + new MetaTileEntityHPCAComputation(gregtechId("hpca.advanced_computation_component"), true)); + HPCA_HEAT_SINK_COMPONENT = registerMetaTileEntity(1415, + new MetaTileEntityHPCACooler(gregtechId("hpca.heat_sink_component"), false)); + HPCA_ACTIVE_COOLER_COMPONENT = registerMetaTileEntity(1416, + new MetaTileEntityHPCACooler(gregtechId("hpca.active_cooler_component"), true)); + HPCA_BRIDGE_COMPONENT = registerMetaTileEntity(1417, + new MetaTileEntityHPCABridge(gregtechId("hpca.bridge_component"))); RESERVOIR_HATCH = registerMetaTileEntity(1418, new MetaTileEntityReservoirHatch(gregtechId("reservoir_hatch"))); // Free ID 1419 - endPos = GregTechAPI.isHighTier() ? LASER_INPUT_HATCH_256.length - 1 : Math.min(LASER_INPUT_HATCH_256.length - 1, GTValues.UHV - GTValues.IV); + endPos = GregTechAPI.isHighTier() ? LASER_INPUT_HATCH_256.length - 1 : + Math.min(LASER_INPUT_HATCH_256.length - 1, GTValues.UHV - GTValues.IV); for (int i = 0; i < endPos; i++) { int v = i + GTValues.IV; String voltageName = GTValues.VN[v].toLowerCase(); - LASER_INPUT_HATCH_256[i] = registerMetaTileEntity(1420 + i, new MetaTileEntityLaserHatch(gregtechId("laser_hatch.target_256a." + voltageName), false, v, 256)); - LASER_OUTPUT_HATCH_256[i] = registerMetaTileEntity(1429 + i, new MetaTileEntityLaserHatch(gregtechId("laser_hatch.source_256a." + voltageName), true, v, 256)); - LASER_INPUT_HATCH_1024[i] = registerMetaTileEntity(1438 + i, new MetaTileEntityLaserHatch(gregtechId("laser_hatch.target_1024a." + voltageName), false, v, 1024)); - LASER_OUTPUT_HATCH_1024[i] = registerMetaTileEntity(1447 + i, new MetaTileEntityLaserHatch(gregtechId("laser_hatch.source_1024a." + voltageName), true, v, 1024)); - LASER_INPUT_HATCH_4096[i] = registerMetaTileEntity(1456 + i, new MetaTileEntityLaserHatch(gregtechId("laser_hatch.target_4096a." + voltageName), false, v, 4096)); - LASER_OUTPUT_HATCH_4096[i] = registerMetaTileEntity(1465 + i, new MetaTileEntityLaserHatch(gregtechId("laser_hatch.source_4096a." + voltageName), true, v, 4096)); + LASER_INPUT_HATCH_256[i] = registerMetaTileEntity(1420 + i, + new MetaTileEntityLaserHatch(gregtechId("laser_hatch.target_256a." + voltageName), false, v, 256)); + LASER_OUTPUT_HATCH_256[i] = registerMetaTileEntity(1429 + i, + new MetaTileEntityLaserHatch(gregtechId("laser_hatch.source_256a." + voltageName), true, v, 256)); + LASER_INPUT_HATCH_1024[i] = registerMetaTileEntity(1438 + i, new MetaTileEntityLaserHatch( + gregtechId("laser_hatch.target_1024a." + voltageName), false, v, 1024)); + LASER_OUTPUT_HATCH_1024[i] = registerMetaTileEntity(1447 + i, + new MetaTileEntityLaserHatch(gregtechId("laser_hatch.source_1024a." + voltageName), true, v, 1024)); + LASER_INPUT_HATCH_4096[i] = registerMetaTileEntity(1456 + i, new MetaTileEntityLaserHatch( + gregtechId("laser_hatch.target_4096a." + voltageName), false, v, 4096)); + LASER_OUTPUT_HATCH_4096[i] = registerMetaTileEntity(1465 + i, + new MetaTileEntityLaserHatch(gregtechId("laser_hatch.source_4096a." + voltageName), true, v, 4096)); } // Free Range: 1475-1509 @@ -711,7 +940,8 @@ public static void init() { // Super / Quantum Chests, IDs 1560-1574 for (int i = 0; i < 5; i++) { String voltageName = GTValues.VN[i + 1].toLowerCase(); - QUANTUM_CHEST[i] = new MetaTileEntityQuantumChest(gregtechId("super_chest." + voltageName), i + 1, 4000000L * (int) Math.pow(2, i)); + QUANTUM_CHEST[i] = new MetaTileEntityQuantumChest(gregtechId("super_chest." + voltageName), i + 1, + 4000000L * (int) Math.pow(2, i)); registerMetaTileEntity(1560 + i, QUANTUM_CHEST[i]); } @@ -725,7 +955,8 @@ public static void init() { // Super / Quantum Tanks, IDs 1575-1589 for (int i = 0; i < 5; i++) { String voltageName = GTValues.VN[i + 1].toLowerCase(); - QUANTUM_TANK[i] = new MetaTileEntityQuantumTank(gregtechId("super_tank." + voltageName), i + 1, 4000000 * (int) Math.pow(2, i)); + QUANTUM_TANK[i] = new MetaTileEntityQuantumTank(gregtechId("super_tank." + voltageName), i + 1, + 4000000 * (int) Math.pow(2, i)); registerMetaTileEntity(1575 + i, QUANTUM_TANK[i]); } @@ -744,56 +975,88 @@ public static void init() { } // Tanks, IDs 1595-1609 - WOODEN_TANK_VALVE = registerMetaTileEntity(1596, new MetaTileEntityTankValve(gregtechId("tank_valve.wood"), false)); - WOODEN_TANK = registerMetaTileEntity(1597, new MetaTileEntityMultiblockTank(gregtechId("tank.wood"), false, 250 * 1000)); + WOODEN_TANK_VALVE = registerMetaTileEntity(1596, + new MetaTileEntityTankValve(gregtechId("tank_valve.wood"), false)); + WOODEN_TANK = registerMetaTileEntity(1597, + new MetaTileEntityMultiblockTank(gregtechId("tank.wood"), false, 250 * 1000)); - STEEL_TANK_VALVE = registerMetaTileEntity(1598, new MetaTileEntityTankValve(gregtechId("tank_valve.steel"), true)); - STEEL_TANK = registerMetaTileEntity(1599, new MetaTileEntityMultiblockTank(gregtechId("tank.steel"), true, 1000 * 1000)); + STEEL_TANK_VALVE = registerMetaTileEntity(1598, + new MetaTileEntityTankValve(gregtechId("tank_valve.steel"), true)); + STEEL_TANK = registerMetaTileEntity(1599, + new MetaTileEntityMultiblockTank(gregtechId("tank.steel"), true, 1000 * 1000)); // Drums, IDs 1610-1624 - WOODEN_DRUM = registerMetaTileEntity(1610, new MetaTileEntityDrum(gregtechId("drum.wood"), Materials.Wood, 16000)); - BRONZE_DRUM = registerMetaTileEntity(1611, new MetaTileEntityDrum(gregtechId("drum.bronze"), Materials.Bronze, 32000)); - STEEL_DRUM = registerMetaTileEntity(1612, new MetaTileEntityDrum(gregtechId("drum.steel"), Materials.Steel, 64000)); - ALUMINIUM_DRUM = registerMetaTileEntity(1613, new MetaTileEntityDrum(gregtechId("drum.aluminium"), Materials.Aluminium, 128000)); - STAINLESS_STEEL_DRUM = registerMetaTileEntity(1614, new MetaTileEntityDrum(gregtechId("drum.stainless_steel"), Materials.StainlessSteel, 256000)); - TITANIUM_DRUM = registerMetaTileEntity(1615, new MetaTileEntityDrum(gregtechId("drum.titanium"), Materials.Titanium, 512000)); - TUNGSTENSTEEL_DRUM = registerMetaTileEntity(1616, new MetaTileEntityDrum(gregtechId("drum.tungstensteel"), Materials.TungstenSteel, 1024000)); - GOLD_DRUM = registerMetaTileEntity(1617, new MetaTileEntityDrum(gregtechId("drum.gold"), Materials.Gold, 32000)); + WOODEN_DRUM = registerMetaTileEntity(1610, + new MetaTileEntityDrum(gregtechId("drum.wood"), Materials.Wood, 16000)); + BRONZE_DRUM = registerMetaTileEntity(1611, + new MetaTileEntityDrum(gregtechId("drum.bronze"), Materials.Bronze, 32000)); + STEEL_DRUM = registerMetaTileEntity(1612, + new MetaTileEntityDrum(gregtechId("drum.steel"), Materials.Steel, 64000)); + ALUMINIUM_DRUM = registerMetaTileEntity(1613, + new MetaTileEntityDrum(gregtechId("drum.aluminium"), Materials.Aluminium, 128000)); + STAINLESS_STEEL_DRUM = registerMetaTileEntity(1614, + new MetaTileEntityDrum(gregtechId("drum.stainless_steel"), Materials.StainlessSteel, 256000)); + TITANIUM_DRUM = registerMetaTileEntity(1615, + new MetaTileEntityDrum(gregtechId("drum.titanium"), Materials.Titanium, 512000)); + TUNGSTENSTEEL_DRUM = registerMetaTileEntity(1616, + new MetaTileEntityDrum(gregtechId("drum.tungstensteel"), Materials.TungstenSteel, 1024000)); + GOLD_DRUM = registerMetaTileEntity(1617, + new MetaTileEntityDrum(gregtechId("drum.gold"), Materials.Gold, 32000)); // Crates, IDs 1625-1639 - WOODEN_CRATE = registerMetaTileEntity(1625, new MetaTileEntityCrate(gregtechId("crate.wood"), Materials.Wood, 27)); - BRONZE_CRATE = registerMetaTileEntity(1626, new MetaTileEntityCrate(gregtechId("crate.bronze"), Materials.Bronze, 54)); - STEEL_CRATE = registerMetaTileEntity(1627, new MetaTileEntityCrate(gregtechId("crate.steel"), Materials.Steel, 72)); - ALUMINIUM_CRATE = registerMetaTileEntity(1628, new MetaTileEntityCrate(gregtechId("crate.aluminium"), Materials.Aluminium, 90)); - STAINLESS_STEEL_CRATE = registerMetaTileEntity(1629, new MetaTileEntityCrate(gregtechId("crate.stainless_steel"), Materials.StainlessSteel, 108)); - TITANIUM_CRATE = registerMetaTileEntity(1630, new MetaTileEntityCrate(gregtechId("crate.titanium"), Materials.Titanium, 126)); - TUNGSTENSTEEL_CRATE = registerMetaTileEntity(1631, new MetaTileEntityCrate(gregtechId("crate.tungstensteel"), Materials.TungstenSteel, 144)); + WOODEN_CRATE = registerMetaTileEntity(1625, + new MetaTileEntityCrate(gregtechId("crate.wood"), Materials.Wood, 27)); + BRONZE_CRATE = registerMetaTileEntity(1626, + new MetaTileEntityCrate(gregtechId("crate.bronze"), Materials.Bronze, 54)); + STEEL_CRATE = registerMetaTileEntity(1627, + new MetaTileEntityCrate(gregtechId("crate.steel"), Materials.Steel, 72)); + ALUMINIUM_CRATE = registerMetaTileEntity(1628, + new MetaTileEntityCrate(gregtechId("crate.aluminium"), Materials.Aluminium, 90)); + STAINLESS_STEEL_CRATE = registerMetaTileEntity(1629, + new MetaTileEntityCrate(gregtechId("crate.stainless_steel"), Materials.StainlessSteel, 108)); + TITANIUM_CRATE = registerMetaTileEntity(1630, + new MetaTileEntityCrate(gregtechId("crate.titanium"), Materials.Titanium, 126)); + TUNGSTENSTEEL_CRATE = registerMetaTileEntity(1631, + new MetaTileEntityCrate(gregtechId("crate.tungstensteel"), Materials.TungstenSteel, 144)); // Rotor Holder, IDs 1640-1645 - ROTOR_HOLDER[0] = registerMetaTileEntity(1640, new MetaTileEntityRotorHolder(gregtechId("rotor_holder.hv"), GTValues.HV)); - ROTOR_HOLDER[1] = registerMetaTileEntity(1641, new MetaTileEntityRotorHolder(gregtechId("rotor_holder.ev"), GTValues.EV)); - ROTOR_HOLDER[2] = registerMetaTileEntity(1642, new MetaTileEntityRotorHolder(gregtechId("rotor_holder.iv"), GTValues.IV)); - ROTOR_HOLDER[3] = registerMetaTileEntity(1643, new MetaTileEntityRotorHolder(gregtechId("rotor_holder.luv"), GTValues.LuV)); - ROTOR_HOLDER[4] = registerMetaTileEntity(1644, new MetaTileEntityRotorHolder(gregtechId("rotor_holder.zpm"), GTValues.ZPM)); - ROTOR_HOLDER[5] = registerMetaTileEntity(1645, new MetaTileEntityRotorHolder(gregtechId("rotor_holder.uv"), GTValues.UV)); + ROTOR_HOLDER[0] = registerMetaTileEntity(1640, + new MetaTileEntityRotorHolder(gregtechId("rotor_holder.hv"), GTValues.HV)); + ROTOR_HOLDER[1] = registerMetaTileEntity(1641, + new MetaTileEntityRotorHolder(gregtechId("rotor_holder.ev"), GTValues.EV)); + ROTOR_HOLDER[2] = registerMetaTileEntity(1642, + new MetaTileEntityRotorHolder(gregtechId("rotor_holder.iv"), GTValues.IV)); + ROTOR_HOLDER[3] = registerMetaTileEntity(1643, + new MetaTileEntityRotorHolder(gregtechId("rotor_holder.luv"), GTValues.LuV)); + ROTOR_HOLDER[4] = registerMetaTileEntity(1644, + new MetaTileEntityRotorHolder(gregtechId("rotor_holder.zpm"), GTValues.ZPM)); + ROTOR_HOLDER[5] = registerMetaTileEntity(1645, + new MetaTileEntityRotorHolder(gregtechId("rotor_holder.uv"), GTValues.UV)); // Misc, IDs 1646-1999 LOCKED_SAFE = registerMetaTileEntity(1646, new MetaTileEntityLockedSafe(gregtechId("locked_safe"))); WORKBENCH = registerMetaTileEntity(1647, new MetaTileEntityWorkbench(gregtechId("workbench"))); - PRIMITIVE_WATER_PUMP = registerMetaTileEntity(1648, new MetaTileEntityPrimitiveWaterPump(gregtechId("primitive_water_pump"))); + PRIMITIVE_WATER_PUMP = registerMetaTileEntity(1648, + new MetaTileEntityPrimitiveWaterPump(gregtechId("primitive_water_pump"))); PUMP_OUTPUT_HATCH = registerMetaTileEntity(1649, new MetaTileEntityPumpHatch(gregtechId("pump_hatch"))); CREATIVE_ENERGY = registerMetaTileEntity(1650, new MetaTileEntityCreativeEnergy()); // Steam Hatches/Buses - STEAM_EXPORT_BUS = registerMetaTileEntity(1651, new MetaTileEntitySteamItemBus(gregtechId("steam_export_bus"), true)); - STEAM_IMPORT_BUS = registerMetaTileEntity(1652, new MetaTileEntitySteamItemBus(gregtechId("steam_import_bus"), false)); + STEAM_EXPORT_BUS = registerMetaTileEntity(1651, + new MetaTileEntitySteamItemBus(gregtechId("steam_export_bus"), true)); + STEAM_IMPORT_BUS = registerMetaTileEntity(1652, + new MetaTileEntitySteamItemBus(gregtechId("steam_import_bus"), false)); STEAM_HATCH = registerMetaTileEntity(1653, new MetaTileEntitySteamHatch(gregtechId("steam_hatch"))); // Maintenance Hatches, IDs 1654-1656 - MAINTENANCE_HATCH = registerMetaTileEntity(1654, new MetaTileEntityMaintenanceHatch(gregtechId("maintenance_hatch"), false)); - CONFIGURABLE_MAINTENANCE_HATCH = registerMetaTileEntity(1655, new MetaTileEntityMaintenanceHatch(gregtechId("maintenance_hatch_configurable"), true)); - AUTO_MAINTENANCE_HATCH = registerMetaTileEntity(1656, new MetaTileEntityAutoMaintenanceHatch(gregtechId("maintenance_hatch_full_auto"))); - CLEANING_MAINTENANCE_HATCH = registerMetaTileEntity(1401, new MetaTileEntityCleaningMaintenanceHatch(gregtechId("maintenance_hatch_cleanroom_auto"))); + MAINTENANCE_HATCH = registerMetaTileEntity(1654, + new MetaTileEntityMaintenanceHatch(gregtechId("maintenance_hatch"), false)); + CONFIGURABLE_MAINTENANCE_HATCH = registerMetaTileEntity(1655, + new MetaTileEntityMaintenanceHatch(gregtechId("maintenance_hatch_configurable"), true)); + AUTO_MAINTENANCE_HATCH = registerMetaTileEntity(1656, + new MetaTileEntityAutoMaintenanceHatch(gregtechId("maintenance_hatch_full_auto"))); + CLEANING_MAINTENANCE_HATCH = registerMetaTileEntity(1401, + new MetaTileEntityCleaningMaintenanceHatch(gregtechId("maintenance_hatch_cleanroom_auto"))); // Muffler Hatches, IDs 1657- for (int i = 0; i < MUFFLER_HATCH.length; i++) { @@ -812,8 +1075,9 @@ public static void init() { CREATIVE_TANK = registerMetaTileEntity(1669, new MetaTileEntityCreativeTank(gregtechId("creative_tank"))); // Energy Converter, IDs 1670-1729 - endPos = GregTechAPI.isHighTier() ? ENERGY_CONVERTER[0].length - 1 : Math.min(ENERGY_CONVERTER[0].length - 1, GTValues.UHV + 1); - int[] amps = {1, 4, 8, 16}; + endPos = GregTechAPI.isHighTier() ? ENERGY_CONVERTER[0].length - 1 : + Math.min(ENERGY_CONVERTER[0].length - 1, GTValues.UHV + 1); + int[] amps = { 1, 4, 8, 16 }; for (int i = 0; i < endPos; i++) { for (int j = 0; j < 4; j++) { String id = "energy_converter." + GTValues.VN[i].toLowerCase() + "." + amps[j]; @@ -821,38 +1085,52 @@ public static void init() { ENERGY_CONVERTER[j][i] = registerMetaTileEntity(1670 + j + i * 4, converter); } } - // IDs 1730-1744 are taken by 4A <-> 16A Transformers. They are grouped with other transformers for organization. + // IDs 1730-1744 are taken by 4A <-> 16A Transformers. They are grouped with other transformers for + // organization. // ME Hatches, IDs 1745-1748 if (Loader.isModLoaded(GTValues.MODID_APPENG)) { - FLUID_EXPORT_HATCH_ME = registerMetaTileEntity(1745, new MetaTileEntityMEOutputHatch(gregtechId("me_export_fluid_hatch"))); - ITEM_EXPORT_BUS_ME = registerMetaTileEntity(1746, new MetaTileEntityMEOutputBus(gregtechId("me_export_item_bus"))); - FLUID_IMPORT_HATCH_ME = registerMetaTileEntity(1747, new MetaTileEntityMEInputHatch(gregtechId("me_import_fluid_hatch"))); - ITEM_IMPORT_BUS_ME = registerMetaTileEntity(1748, new MetaTileEntityMEInputBus(gregtechId("me_import_item_bus"))); + FLUID_EXPORT_HATCH_ME = registerMetaTileEntity(1745, + new MetaTileEntityMEOutputHatch(gregtechId("me_export_fluid_hatch"))); + ITEM_EXPORT_BUS_ME = registerMetaTileEntity(1746, + new MetaTileEntityMEOutputBus(gregtechId("me_export_item_bus"))); + FLUID_IMPORT_HATCH_ME = registerMetaTileEntity(1747, + new MetaTileEntityMEInputHatch(gregtechId("me_import_fluid_hatch"))); + ITEM_IMPORT_BUS_ME = registerMetaTileEntity(1748, + new MetaTileEntityMEInputBus(gregtechId("me_import_item_bus"))); } - LONG_DIST_ITEM_ENDPOINT = registerMetaTileEntity(1749, new MetaTileEntityLDItemEndpoint(gregtechId("ld_item_endpoint"))); - LONG_DIST_FLUID_ENDPOINT = registerMetaTileEntity(1750, new MetaTileEntityLDFluidEndpoint(gregtechId("ld_fluid_endpoint"))); + LONG_DIST_ITEM_ENDPOINT = registerMetaTileEntity(1749, + new MetaTileEntityLDItemEndpoint(gregtechId("ld_item_endpoint"))); + LONG_DIST_FLUID_ENDPOINT = registerMetaTileEntity(1750, + new MetaTileEntityLDFluidEndpoint(gregtechId("ld_fluid_endpoint"))); // Alarm, ID 1751 ALARM = registerMetaTileEntity(1751, new MetaTileEntityAlarm(gregtechId("alarm"))); // Multi-Fluid Hatches, IDs 1190, 1191, 1205, 1206, 1780-1799 // EV hatches separate because of old names/IDs - QUADRUPLE_IMPORT_HATCH[0] = registerMetaTileEntity(1190, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_4x"), GTValues.EV, 4, false)); - NONUPLE_IMPORT_HATCH[0] = registerMetaTileEntity(1191, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_9x"), GTValues.EV, 9, false)); - QUADRUPLE_EXPORT_HATCH[0] = registerMetaTileEntity(1205, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_4x"), GTValues.EV, 4, true)); - NONUPLE_EXPORT_HATCH[0] = registerMetaTileEntity(1206, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_9x"), GTValues.EV, 9, true)); + QUADRUPLE_IMPORT_HATCH[0] = registerMetaTileEntity(1190, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_4x"), GTValues.EV, 4, false)); + NONUPLE_IMPORT_HATCH[0] = registerMetaTileEntity(1191, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_9x"), GTValues.EV, 9, false)); + QUADRUPLE_EXPORT_HATCH[0] = registerMetaTileEntity(1205, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_4x"), GTValues.EV, 4, true)); + NONUPLE_EXPORT_HATCH[0] = registerMetaTileEntity(1206, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_9x"), GTValues.EV, 9, true)); for (int i = GTValues.IV; i <= GTValues.UHV; i++) { int index = i - GTValues.IV; String tierName = GTValues.VN[i].toLowerCase(); - QUADRUPLE_IMPORT_HATCH[index + 1] = registerMetaTileEntity(1780 + index, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_4x." + tierName), i, 4, false)); - NONUPLE_IMPORT_HATCH[index + 1] = registerMetaTileEntity(1785 + index, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_9x." + tierName), i, 9, false)); - QUADRUPLE_EXPORT_HATCH[index + 1] = registerMetaTileEntity(1790 + index, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_4x." + tierName), i, 4, true)); - NONUPLE_EXPORT_HATCH[index + 1] = registerMetaTileEntity(1795 + index, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_9x." + tierName), i, 9, true)); + QUADRUPLE_IMPORT_HATCH[index + 1] = registerMetaTileEntity(1780 + index, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_4x." + tierName), i, 4, false)); + NONUPLE_IMPORT_HATCH[index + 1] = registerMetaTileEntity(1785 + index, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_9x." + tierName), i, 9, false)); + QUADRUPLE_EXPORT_HATCH[index + 1] = registerMetaTileEntity(1790 + index, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_4x." + tierName), i, 4, true)); + NONUPLE_EXPORT_HATCH[index + 1] = registerMetaTileEntity(1795 + index, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_9x." + tierName), i, 9, true)); } - /* * FOR ADDON DEVELOPERS: * @@ -883,7 +1161,8 @@ private static void registerSimpleMetaTileEntity(SimpleMachineMetaTileEntity[] m ICubeRenderer texture, boolean hasFrontFacing, Function tankScalingFunction) { - registerSimpleMetaTileEntity(machines, startId, name, map, texture, hasFrontFacing, GTUtility::gregtechId, tankScalingFunction); + registerSimpleMetaTileEntity(machines, startId, name, map, texture, hasFrontFacing, GTUtility::gregtechId, + tankScalingFunction); } private static void registerSimpleMetaTileEntity(SimpleMachineMetaTileEntity[] machines, @@ -892,7 +1171,8 @@ private static void registerSimpleMetaTileEntity(SimpleMachineMetaTileEntity[] m RecipeMap map, ICubeRenderer texture, boolean hasFrontFacing) { - registerSimpleMetaTileEntity(machines, startId, name, map, texture, hasFrontFacing, GTUtility.defaultTankSizeFunction); + registerSimpleMetaTileEntity(machines, startId, name, map, texture, hasFrontFacing, + GTUtility.defaultTankSizeFunction); } public static void registerSimpleMetaTileEntity(SimpleMachineMetaTileEntity[] machines, @@ -903,17 +1183,20 @@ public static void registerSimpleMetaTileEntity(SimpleMachineMetaTileEntity[] ma boolean hasFrontFacing, Function resourceId, Function tankScalingFunction) { - registerMetaTileEntities(machines, startId, name, (tier, voltageName) -> new SimpleMachineMetaTileEntity(resourceId.apply(String.format("%s.%s", name, voltageName)), map, texture, tier, hasFrontFacing, tankScalingFunction)); + registerMetaTileEntities(machines, startId, name, + (tier, voltageName) -> new SimpleMachineMetaTileEntity( + resourceId.apply(String.format("%s.%s", name, voltageName)), map, texture, tier, hasFrontFacing, + tankScalingFunction)); } /** * @param mteCreator Takes tier and voltage name for the machine, and outputs MTE to register */ public static void registerMetaTileEntities( - MetaTileEntity[] machines, - int startId, - String name, - BiFunction mteCreator) { + MetaTileEntity[] machines, + int startId, + String name, + BiFunction mteCreator) { for (int i = 0; i < machines.length - 1; i++) { if (i > 4 && !getMidTier(name)) continue; if (i > 7 && !getHighTier(name)) break; @@ -945,7 +1228,8 @@ public static void setMidTier(String key, boolean enabled) { public static void setHighTier(String key, boolean enabled) { HIGH_TIER.put(key, enabled); if (!GregTechAPI.isHighTier()) { - throw new IllegalArgumentException("Cannot set High-Tier machine without high tier being enabled in GregTechAPI."); + throw new IllegalArgumentException( + "Cannot set High-Tier machine without high tier being enabled in GregTechAPI."); } } diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java index 191cf952abf..99619665b4f 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java @@ -1,11 +1,5 @@ package gregtech.common.metatileentities; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Vector3; import gregtech.api.GregTechAPI; import gregtech.api.gui.ModularUI; import gregtech.api.gui.Widget; @@ -25,7 +19,7 @@ import gregtech.common.gui.impl.FakeModularUIContainerClipboard; import gregtech.common.items.behaviors.ClipboardBehavior; import gregtech.core.network.packets.PacketClipboardNBTUpdate; -import io.netty.buffer.Unpooled; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -48,30 +42,48 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Vector3; +import io.netty.buffer.Unpooled; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Optional; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static codechicken.lib.raytracer.RayTracer.*; import static gregtech.api.capability.GregtechDataCodes.*; import static gregtech.client.renderer.texture.Textures.CLIPBOARD_RENDERER; import static gregtech.common.items.MetaItems.CLIPBOARD; public class MetaTileEntityClipboard extends MetaTileEntity implements IFastRenderMetaTileEntity { - private static final AxisAlignedBB CLIPBOARD_AABB_NORTH = new AxisAlignedBB(2.75 / 16.0, 0, 0, 13.25 / 16.0, 16 / 16.0, 0.4 / 16.0); - private static final AxisAlignedBB CLIPBOARD_AABB_SOUTH = new AxisAlignedBB(13.25 / 16.0, 0, 16 / 16.0, 2.75 / 16.0, 16 / 16.0, 15.6 / 16.0); - private static final AxisAlignedBB CLIPBOARD_AABB_WEST = new AxisAlignedBB(0, 0, 13.25 / 16.0, 0.4 / 16.0, 16 / 16.0, 2.75 / 16.0); - private static final AxisAlignedBB CLIPBOARD_AABB_EAST = new AxisAlignedBB(16 / 16.0, 0, 2.75 / 16.0, 15.6 / 16.0, 16 / 16.0, 13.25 / 16.0); - private static final AxisAlignedBB PAGE_AABB_NORTH = new AxisAlignedBB(3 / 16.0, 0.25 / 16.0, 0.25 / 16.0, 13 / 16.0, 14.25 / 16.0, 0.3 / 16.0); - private static final AxisAlignedBB PAGE_AABB_SOUTH = new AxisAlignedBB(13 / 16.0, 0.25 / 16.0, 15.75 / 16.0, 3 / 16.0, 14.25 / 16.0, 15.7 / 16.0); - private static final AxisAlignedBB PAGE_AABB_WEST = new AxisAlignedBB(0.25 / 16.0, 0.25 / 16.0, 13 / 16.0, 0.3 / 16.0, 14.25 / 16.0, 3 / 16.0); - private static final AxisAlignedBB PAGE_AABB_EAST = new AxisAlignedBB(15.75 / 16.0, 0.25 / 16.0, 3 / 16.0, 15.7 / 16.0, 14.25 / 16.0, 13 / 16.0); + private static final AxisAlignedBB CLIPBOARD_AABB_NORTH = new AxisAlignedBB(2.75 / 16.0, 0, 0, 13.25 / 16.0, + 16 / 16.0, 0.4 / 16.0); + private static final AxisAlignedBB CLIPBOARD_AABB_SOUTH = new AxisAlignedBB(13.25 / 16.0, 0, 16 / 16.0, 2.75 / 16.0, + 16 / 16.0, 15.6 / 16.0); + private static final AxisAlignedBB CLIPBOARD_AABB_WEST = new AxisAlignedBB(0, 0, 13.25 / 16.0, 0.4 / 16.0, + 16 / 16.0, 2.75 / 16.0); + private static final AxisAlignedBB CLIPBOARD_AABB_EAST = new AxisAlignedBB(16 / 16.0, 0, 2.75 / 16.0, 15.6 / 16.0, + 16 / 16.0, 13.25 / 16.0); + + private static final AxisAlignedBB PAGE_AABB_NORTH = new AxisAlignedBB(3 / 16.0, 0.25 / 16.0, 0.25 / 16.0, + 13 / 16.0, 14.25 / 16.0, 0.3 / 16.0); + private static final AxisAlignedBB PAGE_AABB_SOUTH = new AxisAlignedBB(13 / 16.0, 0.25 / 16.0, 15.75 / 16.0, + 3 / 16.0, 14.25 / 16.0, 15.7 / 16.0); + private static final AxisAlignedBB PAGE_AABB_WEST = new AxisAlignedBB(0.25 / 16.0, 0.25 / 16.0, 13 / 16.0, + 0.3 / 16.0, 14.25 / 16.0, 3 / 16.0); + private static final AxisAlignedBB PAGE_AABB_EAST = new AxisAlignedBB(15.75 / 16.0, 0.25 / 16.0, 3 / 16.0, + 15.7 / 16.0, 14.25 / 16.0, 13 / 16.0); public static final float scale = 1; public FakeModularGui guiCache; @@ -105,7 +117,8 @@ public int getLightOpacity() { @Override public void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) { - ClipboardRenderer.renderBoard(renderState, translation.copy(), new IVertexOperation[]{}, getFrontFacing(), this, partialTicks); + ClipboardRenderer.renderBoard(renderState, translation.copy(), new IVertexOperation[] {}, getFrontFacing(), + this, partialTicks); } @Override @@ -137,13 +150,16 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { public ModularUI createUI(EntityPlayer entityPlayer) { if (getClipboard().isItemEqual(CLIPBOARD.getStackForm())) { List behaviours = ((MetaItem) getClipboard().getItem()).getBehaviours(getClipboard()); - Optional clipboardBehaviour = behaviours.stream().filter((x) -> x instanceof ClipboardBehavior).findFirst(); + Optional clipboardBehaviour = behaviours.stream() + .filter((x) -> x instanceof ClipboardBehavior).findFirst(); if (!clipboardBehaviour.isPresent()) return null; if (clipboardBehaviour.get() instanceof ClipboardBehavior) { - PlayerInventoryHolder holder = new PlayerInventoryHolder(new GregFakePlayer(entityPlayer.world), EnumHand.MAIN_HAND); // We can't have this actually set the player's hand + PlayerInventoryHolder holder = new PlayerInventoryHolder(new GregFakePlayer(entityPlayer.world), + EnumHand.MAIN_HAND); // We can't have this actually set the player's hand holder.setCustomValidityCheck(this::isValid).setCurrentItem(this.getClipboard()); - if (entityPlayer instanceof GregFakePlayer) { // This is how to tell if this is being called in-world or not + if (entityPlayer instanceof GregFakePlayer) { // This is how to tell if this is being called in-world or + // not return ClipboardBehavior.createMTEUI(holder, entityPlayer); } else { return ((ClipboardBehavior) clipboardBehaviour.get()).createUI(holder, entityPlayer); @@ -154,7 +170,8 @@ public ModularUI createUI(EntityPlayer entityPlayer) { } public void createFakeGui() { - // Basically just the original function from the PluginBehavior, but with a lot of now useless stuff stripped out. + // Basically just the original function from the PluginBehavior, but with a lot of now useless stuff stripped + // out. try { GregFakePlayer fakePlayer = new GregFakePlayer(this.getWorld()); fakePlayer.setHeldItem(EnumHand.MAIN_HAND, this.getClipboard()); @@ -179,7 +196,6 @@ public void createFakeGui() { } } - @Override protected void initializeInventory() { super.initializeInventory(); @@ -221,7 +237,8 @@ public int getHarvestLevel() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { if (getWorld() != null && !getWorld().isRemote) { MetaTileEntityUIFactory.INSTANCE.openUI(getHolder(), (EntityPlayerMP) playerIn); @@ -233,7 +250,8 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, + CuboidRayTraceResult hitResult) { return false; } @@ -258,7 +276,8 @@ public void onNeighborChanged() { if (!getWorld().isRemote && didSetFacing) { BlockPos pos = getPos().offset(getFrontFacing()); IBlockState state = getWorld().getBlockState(pos); - if (state.getBlock().isAir(state, getWorld(), pos) || !state.isSideSolid(getWorld(), pos, getFrontFacing())) { + if (state.getBlock().isAir(state, getWorld(), pos) || + !state.isSideSolid(getWorld(), pos, getFrontFacing())) { breakClipboard(null); } } @@ -321,10 +340,12 @@ public Pair checkLookingAt(EntityPlayer player) { if (this.getWorld() != null && player != null) { Vec3d startVec = getStartVec(player); Vec3d endVec = getEndVec(player); - CuboidRayTraceResult rayTraceResult = rayTrace(this.getPos(), new Vector3(startVec), new Vector3(endVec), getPageCuboid()); + CuboidRayTraceResult rayTraceResult = rayTrace(this.getPos(), new Vector3(startVec), new Vector3(endVec), + getPageCuboid()); if (rayTraceResult != null && rayTraceResult.sideHit == this.getFrontFacing().getOpposite()) { TileEntity tileEntity = this.getWorld().getTileEntity(rayTraceResult.getBlockPos()); - if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityClipboard) { + if (tileEntity instanceof IGregTechTileEntity && + ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityClipboard) { double[] pos = handleRayTraceResult(rayTraceResult, this.getFrontFacing().getOpposite()); if (pos[0] >= 0 && pos[0] <= 1 && pos[1] >= 0 && pos[1] <= 1) return Pair.of(pos[0], pos[1]); @@ -336,12 +357,12 @@ public Pair checkLookingAt(EntityPlayer player) { private static double[] handleRayTraceResult(CuboidRayTraceResult rayTraceResult, EnumFacing spin) { double x, y; - double dX = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.X - ? rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() - : rayTraceResult.hitVec.x - rayTraceResult.getBlockPos().getX(); - double dY = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.Y - ? rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() - : rayTraceResult.hitVec.y - rayTraceResult.getBlockPos().getY(); + double dX = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.X ? + rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() : + rayTraceResult.hitVec.x - rayTraceResult.getBlockPos().getX(); + double dY = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.Y ? + rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() : + rayTraceResult.hitVec.y - rayTraceResult.getBlockPos().getY(); if (spin == EnumFacing.NORTH) { x = 1 - dX; } else if (spin == EnumFacing.SOUTH) { @@ -366,7 +387,7 @@ private static double[] handleRayTraceResult(CuboidRayTraceResult rayTraceResult x /= 14.0 / 16; y /= 14.0 / 16; - return new double[]{x, y}; + return new double[] { x, y }; } @Override @@ -384,7 +405,6 @@ public NBTTagCompound writeToNBT(NBTTagCompound data) { return data; } - @Override public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); @@ -476,8 +496,7 @@ public void getSubItems(CreativeTabs creativeTab, NonNullList subItem } @Override - public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - } + public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {} public void readUIAction(EntityPlayerMP player, int id, PacketBuffer buf) { if (id == 1) { diff --git a/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java b/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java index 3838fb1a910..7d49388a390 100644 --- a/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java +++ b/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java @@ -7,6 +7,7 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.metatileentity.MTETrait; import gregtech.api.util.GTUtility; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -122,7 +123,8 @@ protected void pushEnergy() { if (ampsToInsert == 0) return; // send out energy - energyInserted = container.acceptEnergyFromNetwork(metaTileEntity.getFrontFacing().getOpposite(), voltage, ampsToInsert) * voltage; + energyInserted = container.acceptEnergyFromNetwork(metaTileEntity.getFrontFacing().getOpposite(), voltage, + ampsToInsert) * voltage; } else { // push out FE // Get the FE capability in front of us IEnergyStorage storage = getCapabilityAtFront(CapabilityEnergy.ENERGY); diff --git a/src/main/java/gregtech/common/metatileentities/converter/MetaTileEntityConverter.java b/src/main/java/gregtech/common/metatileentities/converter/MetaTileEntityConverter.java index 946ab130900..1aa2d2b0142 100644 --- a/src/main/java/gregtech/common/metatileentities/converter/MetaTileEntityConverter.java +++ b/src/main/java/gregtech/common/metatileentities/converter/MetaTileEntityConverter.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.converter; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.FeCompat; import gregtech.api.capability.GregtechCapabilities; @@ -16,6 +11,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.PipelineUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; @@ -30,12 +26,19 @@ import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.CapabilityEnergy; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.SYNC_TILE_MODE; public class MetaTileEntityConverter extends TieredMetaTileEntity { @@ -62,7 +65,8 @@ protected void reinitializeEnergyContainer() { } @Override - public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getWorld().isRemote) { scheduleRenderUpdate(); return true; @@ -129,12 +133,14 @@ public void receiveInitialSyncData(PacketBuffer buf) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); Textures.VOLTAGE_CASINGS[getTier()].render(renderState, translation, colouredPipeline); if (converterTrait.isFeToEu()) { for (EnumFacing facing : EnumFacing.VALUES) { if (facing == frontFacing) - Textures.ENERGY_OUT.renderSided(facing, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + Textures.ENERGY_OUT.renderSided(facing, renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); else Textures.CONVERTER_FE_IN.renderSided(facing, renderState, translation, pipeline); } @@ -143,7 +149,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, if (facing == frontFacing) Textures.CONVERTER_FE_OUT.renderSided(facing, renderState, translation, pipeline); else - Textures.ENERGY_IN.renderSided(facing, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + Textures.ENERGY_IN.renderSided(facing, renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); } } } @@ -190,8 +197,10 @@ public void addInformation(ItemStack stack, @Nullable World player, List long amps = converterTrait.getBaseAmps(); tooltip.add(I18n.format("gregtech.machine.energy_converter.description")); tooltip.add(I18n.format("gregtech.machine.energy_converter.tooltip_tool_usage")); - tooltip.add(I18n.format("gregtech.machine.energy_converter.tooltip_conversion_fe", FeCompat.toFe(voltage * amps, FeCompat.ratio(true)), amps, voltage, GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.machine.energy_converter.tooltip_conversion_eu", amps, voltage, GTValues.VNF[getTier()], FeCompat.toFe(voltage * amps, FeCompat.ratio(false)))); + tooltip.add(I18n.format("gregtech.machine.energy_converter.tooltip_conversion_fe", + FeCompat.toFe(voltage * amps, FeCompat.ratio(true)), amps, voltage, GTValues.VNF[getTier()])); + tooltip.add(I18n.format("gregtech.machine.energy_converter.tooltip_conversion_eu", amps, voltage, + GTValues.VNF[getTier()], FeCompat.toFe(voltage * amps, FeCompat.ratio(false)))); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAlarm.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAlarm.java index 0925e0ab727..cadf9768286 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAlarm.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAlarm.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.capability.GregtechDataCodes; @@ -15,10 +12,10 @@ import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.terminal.gui.widgets.SelectorWidget; -import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; @@ -28,6 +25,10 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.world.World; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -36,6 +37,7 @@ import java.util.stream.Collectors; public class MetaTileEntityAlarm extends TieredMetaTileEntity { + private SoundEvent selectedSound; private boolean isActive; private int radius = 64; @@ -52,10 +54,12 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_tick", BASE_EU_CONSUMPTION)); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { @@ -72,22 +76,25 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { return ModularUI.builder(GuiTextures.BACKGROUND, 240, 86) .widget(new LabelWidget(10, 5, getMetaFullName())) .widget(new SelectorWidget(10, 20, 220, 20, - getSounds().stream().map((event) -> event.getSoundName().toString()).collect(Collectors.toList()), + getSounds().stream().map((event) -> event.getSoundName().toString()) + .collect(Collectors.toList()), 0x555555, () -> this.selectedSound.getSoundName().toString(), true).setOnChanged((v) -> { - GregTechAPI.soundManager.stopTileSound(getPos()); - SoundEvent newSound = SoundEvent.REGISTRY.getObject(new ResourceLocation(v)); - if (this.selectedSound != newSound) { - this.selectedSound = SoundEvent.REGISTRY.getObject(new ResourceLocation(v)); - this.writeCustomData(GregtechDataCodes.UPDATE_SOUND, (writer) -> writer.writeResourceLocation(this.selectedSound.getSoundName())); - } - })) + GregTechAPI.soundManager.stopTileSound(getPos()); + SoundEvent newSound = SoundEvent.REGISTRY.getObject(new ResourceLocation(v)); + if (this.selectedSound != newSound) { + this.selectedSound = SoundEvent.REGISTRY.getObject(new ResourceLocation(v)); + this.writeCustomData(GregtechDataCodes.UPDATE_SOUND, + (writer) -> writer.writeResourceLocation(this.selectedSound.getSoundName())); + } + })) .widget(new ImageWidget(10, 54, 220, 20, GuiTextures.DISPLAY)) .label(10, 44, "gregtech.gui.alarm.radius") .widget(new TextFieldWidget2(12, 60, 216, 16, () -> String.valueOf(radius), value -> { if (!value.isEmpty()) { int newRadius = Integer.parseInt(value); if (newRadius != radius) { - this.writeCustomData(GregtechDataCodes.UPDATE_RADIUS, (writer) -> writer.writeInt(newRadius)); + this.writeCustomData(GregtechDataCodes.UPDATE_RADIUS, + (writer) -> writer.writeInt(newRadius)); radius = newRadius; } } @@ -114,7 +121,8 @@ public boolean isActive() { if (this.getWorld().isRemote) { return isActive; } - return this.isBlockRedstonePowered() && this.energyContainer.changeEnergy(-BASE_EU_CONSUMPTION) == -BASE_EU_CONSUMPTION; + return this.isBlockRedstonePowered() && + this.energyContainer.changeEnergy(-BASE_EU_CONSUMPTION) == -BASE_EU_CONSUMPTION; } @Override diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java index 620fbae4dc7..6c80ade0ec9 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.GregtechTileCapabilities; @@ -19,6 +16,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.PipelineUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -36,11 +34,16 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityBatteryBuffer extends TieredMetaTileEntity implements IControllable, IDataInfoProvider { private final int inventorySize; @@ -61,7 +64,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); } @Override @@ -101,6 +105,7 @@ public boolean isValidFrontFacing(EnumFacing facing) { @Override protected IItemHandlerModifiable createImportItemHandler() { return new ItemStackHandler(inventorySize) { + @Override protected void onContentsChanged(int slot) { ((EnergyContainerBatteryBuffer) energyContainer).notifyEnergyListener(false); @@ -112,7 +117,8 @@ protected void onContentsChanged(int slot) { public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if ((electricItem != null && getTier() >= electricItem.getTier()) || - (ConfigHolder.compat.energy.nativeEUToFE && stack.hasCapability(CapabilityEnergy.ENERGY, null))) { + (ConfigHolder.compat.energy.nativeEUToFE && + stack.hasCapability(CapabilityEnergy.ENERGY, null))) { return super.insertItem(slot, stack, simulate); } return stack; @@ -140,7 +146,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { colSize = 2; } Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, - 18 + 18 * colSize + 94) + 18 + 18 * colSize + 94) .label(6, 6, getMetaFullName()); int index = 0; @@ -160,7 +166,8 @@ public void addInformation(ItemStack stack, @Nullable World player, List String tierName = GTValues.VNF[getTier()]; tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in_out", energyContainer.getInputVoltage(), tierName)); + tooltip.add( + I18n.format("gregtech.universal.tooltip.voltage_in_out", energyContainer.getInputVoltage(), tierName)); tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_till", energyContainer.getInputAmperage())); tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out_till", energyContainer.getOutputAmperage())); } @@ -192,9 +199,11 @@ public void readFromNBT(NBTTagCompound data) { public List getDataInfo() { List list = new ArrayList<>(); list.add(new TextComponentTranslation("gregtech.battery_buffer.average_input", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getInputPerSec() / 20)).setStyle(new Style().setColor(TextFormatting.YELLOW)))); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getInputPerSec() / 20)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); list.add(new TextComponentTranslation("gregtech.battery_buffer.average_output", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getOutputPerSec() / 20)).setStyle(new Style().setColor(TextFormatting.YELLOW)))); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getOutputPerSec() / 20)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); return list; } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java index b53b1c49120..a8527b1eb99 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -18,6 +14,7 @@ import gregtech.api.util.GregFakePlayer; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.RenderUtil; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -37,10 +34,16 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nullable; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.Collections; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.UPDATE_OUTPUT_FACING; public class MetaTileEntityBlockBreaker extends TieredMetaTileEntity { @@ -62,8 +65,10 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - Textures.ROCK_BREAKER_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), false, false); - Textures.PIPE_OUT_OVERLAY.renderSided(getOutputFacing(), renderState, RenderUtil.adjustTrans(translation, getOutputFacing(), 2), pipeline); + Textures.ROCK_BREAKER_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), false, + false); + Textures.PIPE_OUT_OVERLAY.renderSided(getOutputFacing(), renderState, + RenderUtil.adjustTrans(translation, getOutputFacing(), 2), pipeline); } @Override @@ -122,7 +127,8 @@ private void addToInventoryOrDropItems(List drops) { } } - private List attemptBreakBlockAndObtainDrops(BlockPos blockPos, IBlockState blockState, EntityPlayer entityPlayer) { + private List attemptBreakBlockAndObtainDrops(BlockPos blockPos, IBlockState blockState, + EntityPlayer entityPlayer) { TileEntity tileEntity = getWorld().getTileEntity(blockPos); boolean result = blockState.getBlock().removedByPlayer(blockState, getWorld(), blockPos, entityPlayer, true); if (result) { @@ -130,14 +136,16 @@ private List attemptBreakBlockAndObtainDrops(BlockPos blockPos, IBloc blockState.getBlock().onPlayerDestroy(getWorld(), blockPos, blockState); BlockUtility.startCaptureDrops(); - blockState.getBlock().harvestBlock(getWorld(), entityPlayer, blockPos, blockState, tileEntity, ItemStack.EMPTY); + blockState.getBlock().harvestBlock(getWorld(), entityPlayer, blockPos, blockState, tileEntity, + ItemStack.EMPTY); return BlockUtility.stopCaptureDrops(); } return Collections.emptyList(); } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { EnumFacing currentOutputSide = getOutputFacing(); if (currentOutputSide == facing || getFrontFacing() == facing) return false; @@ -187,8 +195,8 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { @Override public boolean isValidFrontFacing(EnumFacing facing) { - //use direct outputFacing field instead of getter method because otherwise - //it will just return SOUTH for null output facing + // use direct outputFacing field instead of getter method because otherwise + // it will just return SOUTH for null output facing return super.isValidFrontFacing(facing) && facing != outputFacing; } @@ -209,7 +217,7 @@ public void setOutputFacing(EnumFacing outputFacing) { public void setFrontFacing(EnumFacing frontFacing) { super.setFrontFacing(frontFacing); if (this.outputFacing == null) { - //set initial output facing as opposite to front + // set initial output facing as opposite to front setOutputFacing(frontFacing.getOpposite()); } } @@ -265,8 +273,10 @@ public boolean getIsWeatherOrTerrainResistant() { public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.block_breaker.tooltip")); tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_op", getEnergyPerBlockBreak())); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", getInventorySize())); tooltip.add(I18n.format("gregtech.machine.block_breaker.speed_bonus", (int) (getEfficiencyMultiplier() * 100))); tooltip.add(I18n.format("gregtech.universal.tooltip.requires_redstone")); diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java index fc1e634a7b7..ffc8841a9fe 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java @@ -12,6 +12,7 @@ import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.ConfigHolder; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -21,9 +22,10 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntityCharger extends TieredMetaTileEntity { @@ -49,6 +51,7 @@ protected void reinitializeEnergyContainer() { @Override protected IItemHandlerModifiable createImportItemHandler() { return new ItemStackHandler(inventorySize) { + @Override protected void onContentsChanged(int slot) { MetaTileEntityCharger.this.markDirty(); @@ -59,7 +62,8 @@ protected void onContentsChanged(int slot) { public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if ((electricItem != null && getTier() >= electricItem.getTier()) || - (ConfigHolder.compat.energy.nativeEUToFE && stack.hasCapability(CapabilityEnergy.ENERGY, null))) { + (ConfigHolder.compat.energy.nativeEUToFE && + stack.hasCapability(CapabilityEnergy.ENERGY, null))) { return super.insertItem(slot, stack, simulate); } return stack; @@ -98,7 +102,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_till", energyContainer.getInputAmperage())); tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityDiode.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityDiode.java index a3dd8f29b6c..ce97300700e 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityDiode.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityDiode.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.impl.EnergyContainerHandler; @@ -16,6 +12,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.PipelineUtil; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -27,14 +24,21 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.Arrays; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.AMP_INDEX; -public class MetaTileEntityDiode extends MetaTileEntityMultiblockPart implements IPassthroughHatch, IMultiblockAbilityPart { +public class MetaTileEntityDiode extends MetaTileEntityMultiblockPart + implements IPassthroughHatch, IMultiblockAbilityPart { protected IEnergyContainer energyContainer; @@ -111,9 +115,10 @@ protected void reinitializeEnergyContainer() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - Textures.ENERGY_IN_MULTI.renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); - Arrays.stream(EnumFacing.values()).filter(f -> f != frontFacing).forEach(f -> - Textures.ENERGY_OUT.renderSided(f, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]))); + Textures.ENERGY_IN_MULTI.renderSided(getFrontFacing(), renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + Arrays.stream(EnumFacing.values()).filter(f -> f != frontFacing).forEach(f -> Textures.ENERGY_OUT.renderSided(f, + renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]))); } @Override @@ -122,7 +127,8 @@ public boolean isValidFrontFacing(EnumFacing facing) { } @Override - public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getWorld().isRemote) { scheduleRenderUpdate(); return true; @@ -143,10 +149,12 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { tooltip.add(I18n.format("gregtech.machine.diode.tooltip_general")); tooltip.add(I18n.format("gregtech.machine.diode.tooltip_starts_at")); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in_out", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in_out", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_out_till", getMaxAmperage())); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java index e284b5c7f6f..3ea24fabe41 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -14,6 +11,7 @@ import gregtech.api.unification.OreDictUnifier; import gregtech.api.util.GTTransferUtils; import gregtech.client.renderer.texture.Textures; + import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; import net.minecraft.client.resources.I18n; @@ -30,9 +28,14 @@ import net.minecraft.world.storage.loot.LootTableList; import net.minecraftforge.items.IItemHandlerModifiable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntityFisher extends TieredMetaTileEntity { @@ -60,7 +63,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { int rowSize = (int) Math.sqrt(inventorySize); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, - 18 + 18 * rowSize + 94) + 18 + 18 * rowSize + 94) .label(10, 5, getMetaFullName()) .widget(new SlotWidget(importItems, 0, 18, 18, true, true) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.STRING_SLOT_OVERLAY)); @@ -81,7 +84,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { public void update() { super.update(); ItemStack baitStack = importItems.getStackInSlot(0); - if (!getWorld().isRemote && energyContainer.getEnergyStored() >= energyAmountPerFish && getOffsetTimer() % fishingTicks == 0L && !baitStack.isEmpty()) { + if (!getWorld().isRemote && energyContainer.getEnergyStored() >= energyAmountPerFish && + getOffsetTimer() % fishingTicks == 0L && !baitStack.isEmpty()) { WorldServer world = (WorldServer) this.getWorld(); int waterCount = 0; int edgeSize = (int) Math.sqrt(WATER_CHECK_SIZE); @@ -142,9 +146,12 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.fisher.tooltip")); tooltip.add(I18n.format("gregtech.machine.fisher.speed", fishingTicks)); - tooltip.add(I18n.format("gregtech.machine.fisher.requirement", (int) Math.sqrt(WATER_CHECK_SIZE), (int) Math.sqrt(WATER_CHECK_SIZE))); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.machine.fisher.requirement", (int) Math.sqrt(WATER_CHECK_SIZE), + (int) Math.sqrt(WATER_CHECK_SIZE))); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); super.addInformation(stack, player, tooltip, advanced); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityGasCollector.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityGasCollector.java index 2ae05c894b9..e545c53df54 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityGasCollector.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityGasCollector.java @@ -11,16 +11,20 @@ import gregtech.api.recipes.recipeproperties.GasCollectorDimensionProperty; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; -import it.unimi.dsi.fastutil.ints.IntLists; + import net.minecraft.util.ResourceLocation; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.ints.IntLists; + import java.util.function.Function; import java.util.function.Supplier; +import javax.annotation.Nonnull; + public class MetaTileEntityGasCollector extends SimpleMachineMetaTileEntity { - public MetaTileEntityGasCollector(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, boolean hasFrontFacing, + public MetaTileEntityGasCollector(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, + int tier, boolean hasFrontFacing, Function tankScalingFunction) { super(metaTileEntityId, recipeMap, renderer, tier, hasFrontFacing, tankScalingFunction); } @@ -47,7 +51,8 @@ protected boolean checkRecipe(@Nonnull Recipe recipe) { private static class GasCollectorRecipeLogic extends RecipeLogicEnergy { - public GasCollectorRecipeLogic(MetaTileEntity metaTileEntity, RecipeMap recipeMap, Supplier energyContainer) { + public GasCollectorRecipeLogic(MetaTileEntity metaTileEntity, RecipeMap recipeMap, + Supplier energyContainer) { super(metaTileEntity, recipeMap, energyContainer); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java index 09cea6042cc..ed7065e1a15 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java @@ -1,11 +1,5 @@ package gregtech.common.metatileentities.electric; -import appeng.api.util.AECableType; -import appeng.api.util.AEPartLocation; -import appeng.me.helpers.AENetworkProxy; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.impl.EnergyContainerHandler; @@ -18,6 +12,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.PipelineUtil; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -27,11 +22,20 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional; +import appeng.api.util.AECableType; +import appeng.api.util.AEPartLocation; +import appeng.me.helpers.AENetworkProxy; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityHull extends MetaTileEntityMultiblockPart implements IPassthroughHatch, IMultiblockAbilityPart { +public class MetaTileEntityHull extends MetaTileEntityMultiblockPart + implements IPassthroughHatch, IMultiblockAbilityPart { protected IEnergyContainer energyContainer; private AENetworkProxy gridProxy; @@ -55,7 +59,8 @@ protected void reinitializeEnergyContainer() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); } @Override @@ -77,7 +82,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { String tierName = GTValues.VNF[getTier()]; tooltip.add(I18n.format("gregtech.machine.hull.tooltip")); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in_out", energyContainer.getInputVoltage(), tierName)); + tooltip.add( + I18n.format("gregtech.universal.tooltip.voltage_in_out", energyContainer.getInputVoltage(), tierName)); tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_out", 1)); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java index fe4f641aa5c..25a87803c16 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -19,6 +16,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; import gregtech.common.covers.filter.ItemFilterContainer; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -35,17 +33,21 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; -import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.IS_WORKING; public class MetaTileEntityItemCollector extends TieredMetaTileEntity { - private static final int[] INVENTORY_SIZES = {4, 9, 16, 25, 25}; + private static final int[] INVENTORY_SIZES = { 4, 9, 16, 25, 25 }; private static final double MOTION_MULTIPLIER = 0.04; private static final int BASE_EU_CONSUMPTION = 6; @@ -116,7 +118,8 @@ public void update() { return; } - boolean isWorkingNow = energyContainer.getEnergyStored() >= getEnergyConsumedPerTick() && isBlockRedstonePowered(); + boolean isWorkingNow = energyContainer.getEnergyStored() >= getEnergyConsumedPerTick() && + isBlockRedstonePowered(); if (isWorkingNow) { energyContainer.removeEnergy(getEnergyConsumedPerTick()); @@ -174,8 +177,10 @@ protected void moveItemsInEffectRange() { public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.item_collector.tooltip")); tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_tick", getEnergyConsumedPerTick())); - tooltip.add(I18n.format("gregtech.universal.tooltip.max_voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.max_voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); tooltip.add(I18n.format("gregtech.universal.tooltip.working_area", maxItemSuckingRange, maxItemSuckingRange)); } @@ -188,7 +193,8 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t @Override protected IItemHandlerModifiable createExportItemHandler() { - return new GTItemStackHandler(this, INVENTORY_SIZES[MathHelper.clamp(getTier(), 0, INVENTORY_SIZES.length - 1)]); + return new GTItemStackHandler(this, + INVENTORY_SIZES[MathHelper.clamp(getTier(), 0, INVENTORY_SIZES.length - 1)]); } @Override @@ -236,7 +242,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { builder.widget(new ClickButtonWidget(10, 20, 20, 20, "-1", data -> adjustSuckingRange(-1))); builder.widget(new ClickButtonWidget(146, 20, 20, 20, "+1", data -> adjustSuckingRange(+1))); builder.widget(new ImageWidget(30, 20, 116, 20, GuiTextures.DISPLAY)); - builder.widget(new SimpleTextWidget(88, 30, "gregtech.machine.item_collector.gui.collect_range", 0xFFFFFF, () -> Integer.toString(itemSuckingRange))); + builder.widget(new SimpleTextWidget(88, 30, "gregtech.machine.item_collector.gui.collect_range", 0xFFFFFF, + () -> Integer.toString(itemSuckingRange))); for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMagicEnergyAbsorber.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMagicEnergyAbsorber.java index 7475852317c..08784ed26b2 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMagicEnergyAbsorber.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMagicEnergyAbsorber.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.ModularUI; import gregtech.api.metatileentity.MetaTileEntity; @@ -12,8 +8,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; + import net.minecraft.block.BlockDragonEgg; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -37,14 +32,22 @@ import net.minecraft.world.biome.BiomeEndDecorator; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.IS_WORKING; public class MetaTileEntityMagicEnergyAbsorber extends TieredMetaTileEntity { @@ -76,7 +79,8 @@ public Pair getParticleTexture() { @Override @SideOnly(Side.CLIENT) public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); getRenderer().render(renderState, translation, colouredPipeline); } @@ -86,7 +90,7 @@ public void update() { if (getWorld().isRemote) return; if (!(getWorld().provider instanceof WorldProviderEnd)) { - return; //don't try to do anything outside end dimension + return; // don't try to do anything outside end dimension } if (getOffsetTimer() % 20 == 0 || isFirstTick()) { updateDragonEggStatus(); @@ -97,9 +101,9 @@ public void update() { int totalEnergyGeneration = 0; // enhanced for loops cause boxing and unboxing with FastUtil collections - //noinspection ForLoopReplaceableByForEach + // noinspection ForLoopReplaceableByForEach for (int i = 0; i < connectedCrystalsIds.size(); i++) { - //since we don't check quite often, check twice before outputting energy + // since we don't check quite often, check twice before outputting energy if (getWorld().getEntityByID(connectedCrystalsIds.get(i)) instanceof EntityEnderCrystal) { totalEnergyGeneration += hasDragonEggAmplifier ? 128 : 32; } @@ -161,31 +165,34 @@ private void updateConnectedCrystals() { this.connectedCrystalsIds.clear(); final double maxDistance = 64 * 64; List enderCrystals = Arrays.stream(BiomeEndDecorator.getSpikesForWorld(getWorld())) - .flatMap(endSpike -> getWorld().getEntitiesWithinAABB(EntityEnderCrystal.class, endSpike.getTopBoundingBox()).stream()) + .flatMap(endSpike -> getWorld() + .getEntitiesWithinAABB(EntityEnderCrystal.class, endSpike.getTopBoundingBox()).stream()) .filter(crystal -> crystal.getDistanceSq(getPos()) < maxDistance) .collect(Collectors.toList()); for (EntityEnderCrystal entityEnderCrystal : enderCrystals) { BlockPos beamTarget = entityEnderCrystal.getBeamTarget(); if (beamTarget == null) { - //if beam target is null, set ourselves as beam target + // if beam target is null, set ourselves as beam target entityEnderCrystal.setBeamTarget(getPos()); this.connectedCrystalsIds.add(entityEnderCrystal.getEntityId()); } else if (beamTarget.equals(getPos())) { - //if beam target is ourselves, just add it to list + // if beam target is ourselves, just add it to list this.connectedCrystalsIds.add(entityEnderCrystal.getEntityId()); } } for (EntityDragon entityDragon : getWorld().getEntities(EntityDragon.class, EntitySelectors.IS_ALIVE)) { - if (entityDragon.healingEnderCrystal != null && connectedCrystalsIds.contains(entityDragon.healingEnderCrystal.getEntityId())) { - //if dragon is healing from crystal we draw energy from, reset it's healing crystal + if (entityDragon.healingEnderCrystal != null && + connectedCrystalsIds.contains(entityDragon.healingEnderCrystal.getEntityId())) { + // if dragon is healing from crystal we draw energy from, reset it's healing crystal entityDragon.healingEnderCrystal = null; - //if dragon is holding pattern, than deal damage and set it's phase to attack ourselves + // if dragon is holding pattern, than deal damage and set it's phase to attack ourselves if (entityDragon.getPhaseManager().getCurrentPhase().getType() == PhaseList.HOLDING_PATTERN) { entityDragon.attackEntityFrom(DamageSource.causeExplosionDamage((EntityLivingBase) null), 10.0f); entityDragon.getPhaseManager().setPhase(PhaseList.CHARGING_PLAYER); - ((PhaseChargingPlayer) entityDragon.getPhaseManager().getCurrentPhase()).setTarget(new Vec3d(getPos())); + ((PhaseChargingPlayer) entityDragon.getPhaseManager().getCurrentPhase()) + .setTarget(new Vec3d(getPos())); } } } @@ -193,11 +200,12 @@ private void updateConnectedCrystals() { private void resetConnectedEnderCrystals() { // enhanced for loops cause boxing and unboxing with FastUtil collections - //noinspection ForLoopReplaceableByForEach + // noinspection ForLoopReplaceableByForEach for (int i = 0; i < connectedCrystalsIds.size(); i++) { - EntityEnderCrystal entityEnderCrystal = (EntityEnderCrystal) getWorld().getEntityByID(connectedCrystalsIds.get(i)); + EntityEnderCrystal entityEnderCrystal = (EntityEnderCrystal) getWorld() + .getEntityByID(connectedCrystalsIds.get(i)); if (entityEnderCrystal != null && getPos().equals(entityEnderCrystal.getBeamTarget())) { - //on removal, reset ender crystal beam location so somebody can use it + // on removal, reset ender crystal beam location so somebody can use it entityEnderCrystal.setBeamTarget(null); } } @@ -235,6 +243,7 @@ public void randomDisplayTick() { } } } + @Override public void addToolUsages(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.tool_action.screwdriver.access_covers")); diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java index 209dac726b2..6bea4afcdbf 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; @@ -22,6 +18,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -39,11 +36,17 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityMiner extends TieredMetaTileEntity implements IMiner, IControllable, IDataInfoProvider { private final ItemStackHandler chargerInventory; @@ -65,7 +68,8 @@ public MetaTileEntityMiner(ResourceLocation metaTileEntityId, int tier, int spee @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntityMiner(metaTileEntityId, getTier(), this.minerLogic.getSpeed(), this.minerLogic.getMaximumRadius(), this.minerLogic.getFortune()); + return new MetaTileEntityMiner(metaTileEntityId, getTier(), this.minerLogic.getSpeed(), + this.minerLogic.getMaximumRadius(), this.minerLogic.getFortune()); } @Override @@ -102,16 +106,18 @@ protected ModularUI createUI(@Nonnull EntityPlayer entityPlayer) { for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { int index = y * rowSize + x; - builder.widget(new SlotWidget(exportItems, index, 151 - rowSize * 9 + x * 18, 18 + y * 18, true, false) - .setBackgroundTexture(GuiTextures.SLOT)); + builder.widget( + new SlotWidget(exportItems, index, 151 - rowSize * 9 + x * 18, 18 + y * 18, true, false) + .setBackgroundTexture(GuiTextures.SLOT)); } } } else { for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { int index = y * rowSize + x; - builder.widget(new SlotWidget(exportItems, index, 142 - rowSize * 9 + x * 18, 18 + y * 18, true, false) - .setBackgroundTexture(GuiTextures.SLOT)); + builder.widget( + new SlotWidget(exportItems, index, 142 - rowSize * 9 + x * 18, 18 + y * 18, true, false) + .setBackgroundTexture(GuiTextures.SLOT)); } } } @@ -135,15 +141,19 @@ private void addDisplayText(@Nonnull List textList) { textList.add(new TextComponentTranslation("gregtech.machine.miner.startz", this.minerLogic.getZ().get())); textList.add(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); if (this.minerLogic.isDone()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.done").setStyle(new Style().setColor(TextFormatting.GREEN))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.done") + .setStyle(new Style().setColor(TextFormatting.GREEN))); else if (this.minerLogic.isWorking()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.working").setStyle(new Style().setColor(TextFormatting.GOLD))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.working") + .setStyle(new Style().setColor(TextFormatting.GOLD))); else if (!this.isWorkingEnabled()) textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); if (isInventoryFull) - textList.add(new TextComponentTranslation("gregtech.machine.miner.invfull").setStyle(new Style().setColor(TextFormatting.RED))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.invfull") + .setStyle(new Style().setColor(TextFormatting.RED))); if (!drainEnergy(true)) - textList.add(new TextComponentTranslation("gregtech.machine.miner.needspower").setStyle(new Style().setColor(TextFormatting.RED))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.needspower") + .setStyle(new Style().setColor(TextFormatting.RED))); } private void addDisplayText2(@Nonnull List textList) { @@ -153,13 +163,16 @@ private void addDisplayText2(@Nonnull List textList) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { int currentArea = getWorkingArea(minerLogic.getCurrentRadius()); tooltip.add(I18n.format("gregtech.machine.miner.tooltip", currentArea, currentArea)); - tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_tick", energyPerTick) - + TextFormatting.GRAY + ", " + I18n.format("gregtech.machine.miner.per_block", this.minerLogic.getSpeed() / 20)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_tick", energyPerTick) + TextFormatting.GRAY + + ", " + I18n.format("gregtech.machine.miner.per_block", this.minerLogic.getSpeed() / 20)); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); int maxArea = getWorkingArea(minerLogic.getMaximumRadius()); tooltip.add(I18n.format("gregtech.universal.tooltip.working_area_max", maxArea, maxArea)); } @@ -201,7 +214,8 @@ public void update() { } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getWorld().isRemote) return true; if (!this.isActive()) { @@ -216,7 +230,8 @@ else if (playerIn.isSneaking()) this.minerLogic.resetArea(); int workingArea = getWorkingArea(minerLogic.getCurrentRadius()); - playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); + playerIn.sendMessage( + new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); } else { playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.miner.errorradius")); } @@ -303,6 +318,7 @@ public boolean isActive() { @Override public List getDataInfo() { int workingArea = getWorkingArea(minerLogic.getCurrentRadius()); - return Collections.singletonList(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); + return Collections.singletonList( + new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java index 61fa5ecda80..acd9ac62b93 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.gui.GuiTextures; @@ -17,6 +12,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; + import net.minecraft.block.BlockLiquid; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; @@ -42,14 +38,21 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nullable; import java.util.ArrayDeque; import java.util.Deque; import java.util.List; import java.util.function.Consumer; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.PUMP_HEAD_LEVEL; public class MetaTileEntityPump extends TieredMetaTileEntity { @@ -81,7 +84,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @SideOnly(Side.CLIENT) public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - ColourMultiplier multiplier = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); + ColourMultiplier multiplier = new ColourMultiplier( + GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); IVertexOperation[] coloredPipeline = ArrayUtils.add(pipeline, multiplier); for (EnumFacing renderSide : EnumFacing.HORIZONTALS) { if (renderSide == getFrontFacing()) { @@ -148,8 +152,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)); tankDisplay.addWidget(new ToggleButtonWidget(7, 64, 18, 18, GuiTextures.BUTTON_LOCK, this::isLocked, this::setLocked) - .setTooltipText("gregtech.gui.fluid_lock.tooltip") - .shouldUseBaseBackground()); + .setTooltipText("gregtech.gui.fluid_lock.tooltip") + .shouldUseBaseBackground()); TankWidget tankWidget = new PhantomTankWidget(exportFluids.getTankAt(0), 67, 41, 18, 18, () -> this.lockedFluid, @@ -227,13 +231,13 @@ private void updateQueueState(int blocksToCheckAmount) { // Always recheck next time writeCustomData(PUMP_HEAD_LEVEL, b -> b.writeVarInt(pumpHeadY)); markDirty(); - //schedule queue rebuild because we changed our position and no fluid is available + // schedule queue rebuild because we changed our position and no fluid is available this.initializedQueue = false; } if (!initializedQueue || getOffsetTimer() % 6000 == 0 || isFirstTick()) { this.initializedQueue = true; - //just add ourselves to check list and see how this will go + // just add ourselves to check list and see how this will go this.blocksToCheck.add(selfPos); } } @@ -263,7 +267,7 @@ private void checkFluidBlockAt(BlockPos pumpHeadPos, BlockPos checkPos) { for (EnumFacing facing : EnumFacing.VALUES) { BlockPos offsetPos = checkPos.offset(facing); if (offsetPos.distanceSq(pumpHeadPos) > maxPumpRange * maxPumpRange) - continue; //do not add blocks outside bounds + continue; // do not add blocks outside bounds if (!fluidSourceBlocks.contains(offsetPos) && !blocksToCheck.contains(offsetPos)) { this.blocksToCheck.add(offsetPos); @@ -317,6 +321,7 @@ private void setLocked(boolean locked) { } this.lockedFluid = null; } + private Consumer> getFluidNameText(TankWidget tankWidget) { return (list) -> { TextComponentTranslation translation = tankWidget.getFluidTextComponent(); @@ -359,7 +364,7 @@ public void update() { pushFluidsIntoNearbyHandlers(getFrontFacing()); fillContainerFromInternalTank(); - //do not do anything without enough energy supplied + // do not do anything without enough energy supplied if (energyContainer.getEnergyStored() < GTValues.V[getTier()] * 2) { return; } @@ -397,11 +402,15 @@ public void addInformation(ItemStack stack, @Nullable World player, List tooltip.add(I18n.format("gregtech.machine.pump.tooltip")); if (ConfigHolder.machines.doTerrainExplosion) tooltip.add(I18n.format("gregtech.universal.tooltip.terrain_resist")); - tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_op", GTValues.V[getTier()] * 2) - + TextFormatting.GRAY + ", " + I18n.format("gregtech.machine.pump.tooltip_buckets", getPumpingCycleLength())); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); - tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", exportFluids.getTankAt(0).getCapacity())); + tooltip.add( + I18n.format("gregtech.universal.tooltip.uses_per_op", GTValues.V[getTier()] * 2) + TextFormatting.GRAY + + ", " + I18n.format("gregtech.machine.pump.tooltip_buckets", getPumpingCycleLength())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", + exportFluids.getTankAt(0).getCapacity())); tooltip.add(I18n.format("gregtech.universal.tooltip.working_area", getMaxPumpRange(), getMaxPumpRange())); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityRockBreaker.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityRockBreaker.java index daef625dc76..7ff2b055358 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityRockBreaker.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityRockBreaker.java @@ -9,6 +9,7 @@ import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; + import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; @@ -21,13 +22,15 @@ public class MetaTileEntityRockBreaker extends SimpleMachineMetaTileEntity { private boolean hasValidFluids; - public MetaTileEntityRockBreaker(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier) { + public MetaTileEntityRockBreaker(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, + int tier) { super(metaTileEntityId, recipeMap, renderer, tier, true); } @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntityRockBreaker(metaTileEntityId, RecipeMaps.ROCK_BREAKER_RECIPES, Textures.ROCK_BREAKER_OVERLAY, getTier()); + return new MetaTileEntityRockBreaker(metaTileEntityId, RecipeMaps.ROCK_BREAKER_RECIPES, + Textures.ROCK_BREAKER_OVERLAY, getTier()); } @Override @@ -94,7 +97,8 @@ public void readFromNBT(NBTTagCompound data) { protected class RockBreakerRecipeLogic extends RecipeLogicEnergy { - public RockBreakerRecipeLogic(MetaTileEntity metaTileEntity, RecipeMap recipeMap, Supplier energyContainer) { + public RockBreakerRecipeLogic(MetaTileEntity metaTileEntity, RecipeMap recipeMap, + Supplier energyContainer) { super(metaTileEntity, recipeMap, energyContainer); } @@ -105,7 +109,7 @@ protected boolean shouldSearchForRecipes() { } @Override - public boolean getIsWeatherOrTerrainResistant(){ + public boolean getIsWeatherOrTerrainResistant() { return true; } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java index 24808e63611..2c2c8fd360d 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java @@ -1,27 +1,32 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.SimpleGeneratorMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMap; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.function.Function; public class MetaTileEntitySingleCombustion extends SimpleGeneratorMetaTileEntity { - public MetaTileEntitySingleCombustion(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, Function tankScalingFunction) { + public MetaTileEntitySingleCombustion(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, + Function tankScalingFunction) { super(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction); } @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntitySingleCombustion(metaTileEntityId, recipeMap, renderer, getTier(), getTankScalingFunction()); + return new MetaTileEntitySingleCombustion(metaTileEntityId, recipeMap, renderer, getTier(), + getTankScalingFunction()); } @Override @@ -33,7 +38,8 @@ public boolean isValidFrontFacing(EnumFacing facing) { protected void renderOverlays(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { if (getFrontFacing() == EnumFacing.DOWN) { // Trick the render into rendering on the top, as this case didn't render otherwise - this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.NORTH, workable.isActive(), workable.isWorkingEnabled()); + this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.NORTH, workable.isActive(), + workable.isWorkingEnabled()); } else if (getFrontFacing() != EnumFacing.UP) { // Don't render the top overlay if the facing is up, as the textures // would collide, otherwise render normally. diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleTurbine.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleTurbine.java index 1fd8c2deb2b..c594e76e88e 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleTurbine.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleTurbine.java @@ -1,27 +1,32 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.SimpleGeneratorMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMap; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.function.Function; public class MetaTileEntitySingleTurbine extends SimpleGeneratorMetaTileEntity { - public MetaTileEntitySingleTurbine(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, Function tankScalingFunction) { + public MetaTileEntitySingleTurbine(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, + Function tankScalingFunction) { super(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction); } @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntitySingleTurbine(metaTileEntityId, recipeMap, renderer, getTier(), getTankScalingFunction()); + return new MetaTileEntitySingleTurbine(metaTileEntityId, recipeMap, renderer, getTier(), + getTankScalingFunction()); } @Override @@ -34,8 +39,10 @@ protected void renderOverlays(CCRenderState renderState, Matrix4 translation, IV if (getFrontFacing().getAxis() == EnumFacing.Axis.Y) { // If facing is up or down, render the turbine on all 4 sides. // Turbine renderer renders front and back, so just render it on both axes. - this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.NORTH, workable.isActive(), workable.isWorkingEnabled()); - this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.WEST, workable.isActive(), workable.isWorkingEnabled()); + this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.NORTH, workable.isActive(), + workable.isWorkingEnabled()); + this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.WEST, workable.isActive(), + workable.isWorkingEnabled()); } else { super.renderOverlays(renderState, translation, pipeline); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java index 7744434ee0f..d54d7c46f46 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.EnergyContainerHandler; import gregtech.api.gui.ModularUI; @@ -14,6 +10,7 @@ import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; import gregtech.client.utils.PipelineUtil; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -26,6 +23,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.Nullable; import java.util.Arrays; @@ -44,7 +46,7 @@ public class MetaTileEntityTransformer extends TieredMetaTileEntity { public MetaTileEntityTransformer(ResourceLocation metaTileEntityId, int tier, int... highAmperages) { super(metaTileEntityId, tier); if (highAmperages == null || highAmperages.length == 0) { - this.highAmperages = new int[]{1}; // fallback case, "normal" transformer + this.highAmperages = new int[] { 1 }; // fallback case, "normal" transformer } else { this.highAmperages = highAmperages; } @@ -151,13 +153,15 @@ protected void reinitializeEnergyContainer() { int lowAmperage = highAmperage * 4; if (isTransformUp) { - //storage = 1 amp high; input = tier / 4; amperage = 4; output = tier; amperage = 1 - this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 8L * lowAmperage, tierVoltage, lowAmperage, tierVoltage * 4, highAmperage); + // storage = 1 amp high; input = tier / 4; amperage = 4; output = tier; amperage = 1 + this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 8L * lowAmperage, tierVoltage, + lowAmperage, tierVoltage * 4, highAmperage); ((EnergyContainerHandler) this.energyContainer).setSideInputCondition(s -> s != getFrontFacing()); ((EnergyContainerHandler) this.energyContainer).setSideOutputCondition(s -> s == getFrontFacing()); } else { - //storage = 1 amp high; input = tier; amperage = 1; output = tier / 4; amperage = 4 - this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 8L * lowAmperage, tierVoltage * 4, highAmperage, tierVoltage, lowAmperage); + // storage = 1 amp high; input = tier; amperage = 1; output = tier / 4; amperage = 4 + this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 8L * lowAmperage, tierVoltage * 4, + highAmperage, tierVoltage, lowAmperage); ((EnergyContainerHandler) this.energyContainer).setSideInputCondition(s -> s == getFrontFacing()); ((EnergyContainerHandler) this.energyContainer).setSideOutputCondition(s -> s != getFrontFacing()); } @@ -189,9 +193,11 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } } - frontFaceTexture.renderSided(frontFacing, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() + 1])); + frontFaceTexture.renderSided(frontFacing, renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier() + 1])); Arrays.stream(EnumFacing.values()).filter(f -> f != frontFacing) - .forEach((f -> otherFaceTexture.renderSided(f, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])))); + .forEach((f -> otherFaceTexture.renderSided(f, renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])))); } @Override @@ -200,7 +206,8 @@ public boolean isValidFrontFacing(EnumFacing facing) { } @Override - public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getWorld().isRemote) { scheduleRenderUpdate(); return true; @@ -208,17 +215,20 @@ public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacin if (isTransformUp) { setTransformUp(false); playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.transformer.message_transform_down", - energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); + energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), + energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); } else { setTransformUp(true); playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.transformer.message_transform_up", - energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); + energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), + energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); } return true; } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (hasMultipleAmperages()) { if (getWorld().isRemote) { scheduleRenderUpdate(); @@ -227,7 +237,8 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci incrementAmpIndex(); playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.transformer_adjustable.message_adjust", - energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); + energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), + energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); return true; } @@ -262,8 +273,10 @@ public void addInformation(ItemStack stack, @Nullable World player, List if (hasMultipleAmperages()) { tooltip.add(I18n.format("gregtech.machine.transformer_adjustable.tooltip_tool_usage", higherAmperage)); } - tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_transform_down", lowerAmperage, higherVoltage, higherTierName, higherAmperage, lowerVoltage, lowerTierName)); - tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_transform_up", higherAmperage, lowerVoltage, lowerTierName, lowerAmperage, higherVoltage, higherTierName)); + tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_transform_down", lowerAmperage, higherVoltage, + higherTierName, higherAmperage, lowerVoltage, lowerTierName)); + tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_transform_up", higherAmperage, lowerVoltage, + lowerTierName, lowerAmperage, higherVoltage, higherTierName)); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java index 36738c40390..09c851400ce 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; @@ -16,9 +12,7 @@ import gregtech.api.util.GTLog; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.Object2BooleanFunction; -import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; @@ -36,6 +30,14 @@ import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import it.unimi.dsi.fastutil.objects.Object2BooleanFunction; +import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -59,7 +61,7 @@ public class MetaTileEntityWorldAccelerator extends TieredMetaTileEntity impleme // Variables for Random Tick mode optimization // limit = ((tier - min) / (max - min)) * 2^tier - private static final int[] SUCCESS_LIMITS = {1, 8, 27, 64, 125, 216, 343, 512}; + private static final int[] SUCCESS_LIMITS = { 1, 8, 27, 64, 125, 216, 343, 512 }; private final int successLimit; private BlockPos bottomLeftCorner; @@ -86,13 +88,17 @@ protected void reinitializeEnergyContainer() { @Override public void addInformation(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.world_accelerator.description")); - tooltip.add(I18n.format("gregtech.machine.world_accelerator.power_usage", getRandomTickModeAmperage(), getTEModeAmperage())); + tooltip.add(I18n.format("gregtech.machine.world_accelerator.power_usage", getRandomTickModeAmperage(), + getTEModeAmperage())); tooltip.add(I18n.format("gregtech.machine.world_accelerator.acceleration", speed)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); tooltip.add(I18n.format("gregtech.machine.world_accelerator.working_area")); tooltip.add(I18n.format("gregtech.machine.world_accelerator.working_area_tile")); - tooltip.add(I18n.format("gregtech.machine.world_accelerator.working_area_random", getTier() * 2 + 1, getTier() * 2 + 1)); + tooltip.add(I18n.format("gregtech.machine.world_accelerator.working_area_random", getTier() * 2 + 1, + getTier() * 2 + 1)); } @Override @@ -211,9 +217,11 @@ private BlockPos getCornerPos() { public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); if (isTEMode()) { - Textures.WORLD_ACCELERATOR_TE_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive, isWorkingEnabled()); + Textures.WORLD_ACCELERATOR_TE_OVERLAY.renderOrientedState(renderState, translation, pipeline, + getFrontFacing(), isActive, isWorkingEnabled()); } else { - Textures.WORLD_ACCELERATOR_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive, isWorkingEnabled()); + Textures.WORLD_ACCELERATOR_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + isActive, isWorkingEnabled()); } } @@ -228,14 +236,17 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { if (isTEMode()) { setTEMode(false); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.world_accelerator.mode_entity"), false); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.world_accelerator.mode_entity"), false); } else { setTEMode(true); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.world_accelerator.mode_tile"), false); + playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.world_accelerator.mode_tile"), + false); } } return true; diff --git a/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java b/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java index a6c3e345f7d..be43ffb1ab0 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java +++ b/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java @@ -6,6 +6,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMap; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.util.ResourceLocation; import net.minecraftforge.items.IItemHandlerModifiable; @@ -20,8 +21,10 @@ public class SimpleMachineMetaTileEntityResizable extends SimpleMachineMetaTileE private final int outputAmount; /** - * @param inputAmount Number of Item Input Slots for this machine. Pass -1 to use the default value from the RecipeMap. - * @param outputAmount Number of Item Output Slots for this machine. Pass -1 to use the default value from the RecipeMap. + * @param inputAmount Number of Item Input Slots for this machine. Pass -1 to use the default value from the + * RecipeMap. + * @param outputAmount Number of Item Output Slots for this machine. Pass -1 to use the default value from the + * RecipeMap. */ public SimpleMachineMetaTileEntityResizable(ResourceLocation metaTileEntityId, RecipeMap recipeMap, @@ -36,8 +39,10 @@ public SimpleMachineMetaTileEntityResizable(ResourceLocation metaTileEntityId, } /** - * @param inputAmount Number of Item Input Slots for this machine. Pass -1 to use the default value from the RecipeMap. - * @param outputAmount Number of Item Output Slots for this machine. Pass -1 to use the default value from the RecipeMap. + * @param inputAmount Number of Item Input Slots for this machine. Pass -1 to use the default value from the + * RecipeMap. + * @param outputAmount Number of Item Output Slots for this machine. Pass -1 to use the default value from the + * RecipeMap. */ public SimpleMachineMetaTileEntityResizable(ResourceLocation metaTileEntityId, RecipeMap recipeMap, @@ -71,7 +76,8 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new SimpleMachineMetaTileEntityResizable(metaTileEntityId, workable.getRecipeMap(), inputAmount, outputAmount, renderer, getTier()); + return new SimpleMachineMetaTileEntityResizable(metaTileEntityId, workable.getRecipeMap(), inputAmount, + outputAmount, renderer, getTier()); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/BoilerType.java b/src/main/java/gregtech/common/metatileentities/multi/BoilerType.java index 456c9ac7d52..033b03a971b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/BoilerType.java +++ b/src/main/java/gregtech/common/metatileentities/multi/BoilerType.java @@ -2,6 +2,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; + import net.minecraft.block.state.IBlockState; import static gregtech.common.blocks.BlockBoilerCasing.BoilerCasingType.*; @@ -70,7 +71,6 @@ public enum BoilerType { ICubeRenderer fireboxIdleRenderer, ICubeRenderer fireboxActiveRenderer, ICubeRenderer frontOverlay) { - this.steamPerTick = steamPerTick; this.ticksToBoiling = ticksToBoiling; @@ -93,11 +93,15 @@ public int getTicksToBoiling() { } public int runtimeBoost(int ticks) { - switch(this) { - case BRONZE: return ticks * 2; - case STEEL: return ticks * 150 / 100; - case TITANIUM: return ticks * 120 / 100; - case TUNGSTENSTEEL: return ticks; + switch (this) { + case BRONZE: + return ticks * 2; + case STEEL: + return ticks * 150 / 100; + case TITANIUM: + return ticks * 120 / 100; + case TUNGSTENSTEEL: + return ticks; } return 0; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java index f4e5f7f39c2..f0b9743edeb 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -22,6 +18,7 @@ import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -33,6 +30,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import javax.annotation.Nonnull; public class MetaTileEntityCokeOven extends RecipeMapPrimitiveMultiblockController { @@ -52,7 +54,9 @@ protected BlockPattern createStructurePattern() { .aisle("XXX", "XXX", "XXX") .aisle("XXX", "X#X", "XXX") .aisle("XXX", "XYX", "XXX") - .where('X', states(getCasingState()).or(metaTileEntities(MetaTileEntities.COKE_OVEN_HATCH).setMaxGlobalLimited(5))) + .where('X', + states(getCasingState()) + .or(metaTileEntities(MetaTileEntities.COKE_OVEN_HATCH).setMaxGlobalLimited(5))) .where('#', air()) .where('Y', selfPredicate()) .build(); @@ -71,7 +75,8 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); } @SideOnly(Side.CLIENT) @@ -93,7 +98,9 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { .widget(new LabelWidget(5, 5, getMetaFullName())) .widget(new SlotWidget(importItems, 0, 52, 30, true, true) .setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY)) - .widget(new RecipeProgressWidget(recipeMapWorkable::getProgressPercent, 76, 32, 20, 15, GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, ProgressWidget.MoveType.HORIZONTAL, RecipeMaps.COKE_OVEN_RECIPES)) + .widget(new RecipeProgressWidget(recipeMapWorkable::getProgressPercent, 76, 32, 20, 15, + GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, ProgressWidget.MoveType.HORIZONTAL, + RecipeMaps.COKE_OVEN_RECIPES)) .widget(new SlotWidget(exportItems, 0, 103, 30, true, false) .setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY)) .widget(new TankWidget(exportFluids.getTankAt(0), 134, 13, 20, 58) @@ -124,7 +131,8 @@ public void randomDisplayTick() { x += horizontalOffset; } if (ConfigHolder.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { - getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); + getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, + false); } getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, x, y, z, 0, 0, 0); getWorld().spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0); @@ -132,7 +140,8 @@ public void randomDisplayTick() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { // try to fill a bucket (or similar) with creosote on right click (if not sneaking) if (playerIn.getHeldItem(hand).hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { if (!playerIn.isSneaking()) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java index 6713e5caf40..2983dde660f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FluidHandlerProxy; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.capability.impl.ItemHandlerProxy; @@ -16,6 +12,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -30,9 +27,15 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -import javax.annotation.Nullable; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; +import javax.annotation.Nullable; + public class MetaTileEntityCokeOvenHatch extends MetaTileEntityMultiblockPart { public MetaTileEntityCokeOvenHatch(ResourceLocation metaTileEntityId) { @@ -55,11 +58,13 @@ public void update() { super.update(); if (!getWorld().isRemote && getOffsetTimer() % 5 == 0L && isAttachedToMultiBlock()) { TileEntity tileEntity = getNeighbor(getFrontFacing()); - IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); + IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); if (fluidHandler != null) { GTTransferUtils.transferFluids(fluidInventory, fluidHandler); } - IItemHandler itemHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); + IItemHandler itemHandler = tileEntity == null ? null : tileEntity + .getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); if (itemHandler != null) { GTTransferUtils.moveInventoryItems(this.itemInventory, itemHandler); } @@ -120,9 +125,11 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { // try to fill a bucket (or similar) with creosote on right click (if not sneaking) - if (!playerIn.isSneaking() && playerIn.getHeldItem(hand).hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { + if (!playerIn.isSneaking() && + playerIn.getHeldItem(hand).hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { return getWorld().isRemote || FluidUtil.interactWithFluidHandler(playerIn, hand, getFluidInventory()); } return super.onRightClick(playerIn, hand, facing, hitResult); diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java index 06ffe1ce621..f15008bab2e 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.BoilerRecipeLogic; import gregtech.api.capability.impl.CommonFluidFilters; import gregtech.api.capability.impl.FluidTankList; @@ -25,6 +22,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.utils.TooltipHelper; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -39,13 +37,18 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityLargeBoiler extends MultiblockWithDisplayBase implements IProgressBarMultiblock { public final BoilerType boilerType; @@ -152,8 +155,10 @@ protected void addWarningText(List textList) { if (isStructureFormed()) { int[] waterAmount = getWaterAmount(); if (waterAmount[0] == 0) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.large_boiler.no_water")); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.large_boiler.explosion_tooltip")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.large_boiler.no_water")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.large_boiler.explosion_tooltip")); } } } @@ -202,14 +207,16 @@ protected BlockPattern createStructurePattern() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.large_boiler.description")}; + return new String[] { I18n.format("gregtech.multiblock.large_boiler.description") }; } @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(I18n.format("gregtech.multiblock.large_boiler.rate_tooltip", (int) (boilerType.steamPerTick() * 20 * boilerType.runtimeBoost(20) / 20.0))); - tooltip.add(I18n.format("gregtech.multiblock.large_boiler.heat_time_tooltip", boilerType.getTicksToBoiling() / 20)); + tooltip.add(I18n.format("gregtech.multiblock.large_boiler.rate_tooltip", + (int) (boilerType.steamPerTick() * 20 * boilerType.runtimeBoost(20) / 20.0))); + tooltip.add( + I18n.format("gregtech.multiblock.large_boiler.heat_time_tooltip", boilerType.getTicksToBoiling() / 20)); tooltip.add(I18n.format("gregtech.universal.tooltip.base_production_fluid", boilerType.steamPerTick())); tooltip.add(TooltipHelper.BLINKING_RED + I18n.format("gregtech.multiblock.large_boiler.explosion_tooltip")); } @@ -217,7 +224,8 @@ public void addInformation(ItemStack stack, @Nullable World player, List @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive(), recipeLogic.isWorkingEnabled()); + this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive(), + recipeLogic.isWorkingEnabled()); } @SideOnly(Side.CLIENT) @@ -324,11 +332,13 @@ public TextureArea getProgressBarTexture(int index) { @Override public void addBarHoverText(List hoverList, int index) { if (!isStructureFormed()) { - hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.invalid_structure")); + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.invalid_structure")); } else { int[] waterAmount = getWaterAmount(); if (waterAmount[0] == 0) { - hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.large_boiler.no_water")); + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.large_boiler.no_water")); } else { ITextComponent waterInfo = TextComponentUtil.translationWithColor( TextFormatting.BLUE, @@ -347,7 +357,7 @@ public void addBarHoverText(List hoverList, int index) { * If there is no water in the boiler (or the structure isn't formed, both of these values will be zero. */ private int[] getWaterAmount() { - if (!isStructureFormed()) return new int[]{0, 0}; + if (!isStructureFormed()) return new int[] { 0, 0 }; List tanks = getAbilities(MultiblockAbility.IMPORT_FLUIDS); int filled = 0, capacity = 0; for (IFluidTank tank : tanks) { @@ -357,6 +367,6 @@ private int[] getWaterAmount() { capacity += tank.getCapacity(); } } - return new int[]{filled, capacity}; + return new int[] { filled, capacity }; } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java index 09062dfad75..17ffe999651 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FilteredFluidHandler; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.capability.impl.PropertyFluidFilter; @@ -23,6 +19,7 @@ import gregtech.common.blocks.BlockSteamCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -34,9 +31,15 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntityMultiblockTank extends MultiblockWithDisplayBase { @@ -116,7 +119,8 @@ public boolean hasMaintenanceMechanics() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!isStructureFormed()) return false; return super.onRightClick(playerIn, hand, facing, hitResult); @@ -146,7 +150,8 @@ protected ICubeRenderer getFrontOverlay() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.multiblock.tank.tooltip")); tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", capacity)); diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java index ed2a8309824..f8ea376d87f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -30,6 +25,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -39,13 +35,20 @@ import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import javax.annotation.Nonnull; public class MetaTileEntityPrimitiveBlastFurnace extends RecipeMapPrimitiveMultiblockController { - private static final TraceabilityPredicate SNOW_PREDICATE = new TraceabilityPredicate(bws -> GTUtility.isBlockSnow(bws.getBlockState())); + private static final TraceabilityPredicate SNOW_PREDICATE = new TraceabilityPredicate( + bws -> GTUtility.isBlockSnow(bws.getBlockState())); public MetaTileEntityPrimitiveBlastFurnace(ResourceLocation metaTileEntityId) { super(metaTileEntityId, RecipeMaps.PRIMITIVE_BLAST_FURNACE_RECIPES); @@ -64,7 +67,8 @@ protected BlockPattern createStructurePattern() { .aisle("XXX", "XYX", "XXX", "XXX") .where('X', states(MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.PRIMITIVE_BRICKS))) .where('#', air()) - .where('&', air().or(SNOW_PREDICATE)) // this won't stay in the structure, and will be broken while running + .where('&', air().or(SNOW_PREDICATE)) // this won't stay in the structure, and will be broken while + // running .where('Y', selfPredicate()) .build(); } @@ -86,7 +90,9 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { .setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_DUST_OVERLAY)) .widget(new SlotWidget(importItems, 2, 52, 56, true, true) .setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY)) - .widget(new RecipeProgressWidget(recipeMapWorkable::getProgressPercent, 77, 39, 20, 15, GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, ProgressWidget.MoveType.HORIZONTAL, RecipeMaps.PRIMITIVE_BLAST_FURNACE_RECIPES)) + .widget(new RecipeProgressWidget(recipeMapWorkable::getProgressPercent, 77, 39, 20, 15, + GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, ProgressWidget.MoveType.HORIZONTAL, + RecipeMaps.PRIMITIVE_BLAST_FURNACE_RECIPES)) .widget(new SlotWidget(exportItems, 0, 104, 38, true, false) .setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_INGOT_OVERLAY)) .widget(new SlotWidget(exportItems, 1, 122, 38, true, false) @@ -99,7 +105,8 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); if (recipeMapWorkable.isActive() && isStructureFormed()) { EnumFacing back = getFrontFacing().getOpposite(); Matrix4 offset = translation.copy().translate(back.getXOffset(), -0.3, back.getZOffset()); @@ -107,7 +114,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, Textures.RENDER_STATE.set(new CubeRendererState(op.layer, CubeRendererState.PASS_MASK, op.world)); Textures.renderFace(renderState, offset, ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), new ColourOperation(0xFFFFFFFF)), - EnumFacing.UP, Cuboid6.full, TextureUtils.getBlockTexture("lava_still"), BloomEffectUtil.getEffectiveBloomLayer()); + EnumFacing.UP, Cuboid6.full, TextureUtils.getBlockTexture("lava_still"), + BloomEffectUtil.getEffectiveBloomLayer()); Textures.RENDER_STATE.set(op); } } @@ -151,7 +159,8 @@ private void pollutionParticles() { private void damageEntitiesAndBreakSnow() { BlockPos middlePos = this.getPos(); middlePos = middlePos.offset(getFrontFacing().getOpposite()); - this.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(middlePos)).forEach(entity -> entity.attackEntityFrom(DamageSource.LAVA, 3.0f)); + this.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(middlePos)) + .forEach(entity -> entity.attackEntityFrom(DamageSource.LAVA, 3.0f)); if (getOffsetTimer() % 10 == 0) { IBlockState state = getWorld().getBlockState(middlePos); @@ -180,7 +189,8 @@ public void randomDisplayTick() { x += horizontalOffset; } if (ConfigHolder.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { - getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); + getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, + false); } getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, x, y, z, 0, 0, 0); getWorld().spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0); diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveWaterPump.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveWaterPump.java index 5db50d20918..d1c13cadedb 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveWaterPump.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveWaterPump.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.gui.ModularUI; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; @@ -20,6 +17,7 @@ import gregtech.common.blocks.BlockSteamCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; @@ -32,12 +30,17 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; + public class MetaTileEntityPrimitiveWaterPump extends MultiblockControllerBase implements IPrimitivePump { private IFluidTank waterTank; @@ -84,13 +87,14 @@ private int getAmount() { return 350; } else if (biomeTypes.contains(BiomeDictionary.Type.SNOWY)) { return 300; - } else if (biomeTypes.contains(BiomeDictionary.Type.PLAINS) || biomeTypes.contains(BiomeDictionary.Type.FOREST)) { - return 250; - } else if (biomeTypes.contains(BiomeDictionary.Type.COLD)) { - return 175; - } else if (biomeTypes.contains(BiomeDictionary.Type.BEACH)) { - return 170; - } + } else + if (biomeTypes.contains(BiomeDictionary.Type.PLAINS) || biomeTypes.contains(BiomeDictionary.Type.FOREST)) { + return 250; + } else if (biomeTypes.contains(BiomeDictionary.Type.COLD)) { + return 175; + } else if (biomeTypes.contains(BiomeDictionary.Type.BEACH)) { + return 170; + } return 100; } @@ -105,9 +109,7 @@ protected boolean openGUIOnRightClick() { } @Override - protected void updateFormedValid() { - - } + protected void updateFormedValid() {} @Override protected void formStructure(PatternMatchContext context) { @@ -145,7 +147,9 @@ protected BlockPattern createStructurePattern() { .where('S', selfPredicate()) .where('X', states(MetaBlocks.STEAM_CASING.getState(BlockSteamCasing.SteamCasingType.PUMP_DECK))) .where('F', frames(Materials.TreatedWood)) - .where('H', abilities(MultiblockAbility.PUMP_FLUID_HATCH).or(metaTileEntities(MetaTileEntities.FLUID_EXPORT_HATCH[0], MetaTileEntities.FLUID_EXPORT_HATCH[1]))) + .where('H', + abilities(MultiblockAbility.PUMP_FLUID_HATCH).or(metaTileEntities( + MetaTileEntities.FLUID_EXPORT_HATCH[0], MetaTileEntities.FLUID_EXPORT_HATCH[1]))) .where('*', any()) .build(); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java index 2071ccbe1c7..e257f788f2d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FilteredItemHandler; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.gui.GuiTextures; @@ -20,6 +17,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; import gregtech.common.metatileentities.storage.MetaTileEntityQuantumTank; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -31,10 +29,16 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; -public class MetaTileEntityPumpHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart { +import javax.annotation.Nullable; + +public class MetaTileEntityPumpHatch extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart { private static final int FLUID_TANK_SIZE = 1000; @@ -52,7 +56,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); if (data.hasKey("ContainerInventory")) { - MetaTileEntityQuantumTank.legacyTankItemHandlerNBTReading(this, data.getCompoundTag("ContainerInventory"), 0, 1); + MetaTileEntityQuantumTank.legacyTankItemHandlerNBTReading(this, data.getCompoundTag("ContainerInventory"), + 0, 1); } } @@ -79,7 +84,8 @@ protected FluidTankList createExportFluidHandler() { @Override protected IItemHandlerModifiable createImportItemHandler() { - return new FilteredItemHandler(this, 1).setFillPredicate(FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); + return new FilteredItemHandler(this, 1).setFillPredicate( + FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java index 9197bbab4b5..f4a242788cd 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FluidHandlerProxy; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.gui.ModularUI; @@ -15,6 +12,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -25,11 +23,17 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityTankValve extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart { +public class MetaTileEntityTankValve extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart { private final boolean isMetal; @@ -67,9 +71,11 @@ public int getDefaultPaintingColor() { @Override public void update() { super.update(); - if (!getWorld().isRemote && getOffsetTimer() % 5 == 0L && isAttachedToMultiBlock() && getFrontFacing() == EnumFacing.DOWN) { + if (!getWorld().isRemote && getOffsetTimer() % 5 == 0L && isAttachedToMultiBlock() && + getFrontFacing() == EnumFacing.DOWN) { TileEntity tileEntity = getNeighbor(getFrontFacing()); - IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); + IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); if (fluidHandler != null) { GTTransferUtils.transferFluids(fluidInventory, fluidHandler); } @@ -83,7 +89,8 @@ protected void initializeInventory() { } /** - * When this block is not connected to any multiblock it uses dummy inventory to prevent problems with capability checks + * When this block is not connected to any multiblock it uses dummy inventory to prevent problems with capability + * checks */ private void initializeDummyInventory() { this.fluidInventory = new FluidHandlerProxy(new FluidTankList(false), new FluidTankList(false)); @@ -92,7 +99,8 @@ private void initializeDummyInventory() { @Override public void addToMultiBlock(MultiblockControllerBase controllerBase) { super.addToMultiBlock(controllerBase); - this.fluidInventory = controllerBase.getFluidInventory(); //directly use controllers fluid inventory as there is no reason to proxy it + this.fluidInventory = controllerBase.getFluidInventory(); // directly use controllers fluid inventory as there + // is no reason to proxy it } @Override @@ -132,7 +140,8 @@ protected boolean shouldSerializeInventories() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.tank_valve.tooltip")); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityActiveTransformer.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityActiveTransformer.java index c7dee6a3957..059ec0264a7 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityActiveTransformer.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityActiveTransformer.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; @@ -24,6 +21,7 @@ import gregtech.common.blocks.BlockComputerCasing; import gregtech.common.blocks.BlockFusionCasing; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -36,6 +34,10 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -144,13 +146,15 @@ protected IBlockState getCasingState() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), this.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), + this.isWorkingEnabled()); } @Override protected void addDisplayText(List textList) { MultiblockDisplayText.builder(textList, isStructureFormed()) - .setWorkingStatus(true, isActive()) // set to true because we only want a two-state system (running or not running) + .setWorkingStatus(true, isActive()) // set to true because we only want a two-state system (running or + // not running) .setWorkingStatusKeys( "gregtech.multiblock.idling", "gregtech.multiblock.idling", @@ -244,10 +248,11 @@ public T getCapability(Capability capability, EnumFacing side) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { tooltip.add(I18n.format("gregtech.machine.active_transformer.tooltip1")); tooltip.add(I18n.format("gregtech.machine.active_transformer.tooltip2")); - tooltip.add(I18n.format("gregtech.machine.active_transformer.tooltip3") - + TooltipHelper.RAINBOW_SLOW + I18n.format("gregtech.machine.active_transformer.tooltip3.5")); + tooltip.add(I18n.format("gregtech.machine.active_transformer.tooltip3") + TooltipHelper.RAINBOW_SLOW + + I18n.format("gregtech.machine.active_transformer.tooltip3.5")); } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityAssemblyLine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityAssemblyLine.java index 79c74db35ca..eb6bfff35b7 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityAssemblyLine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityAssemblyLine.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Vector3; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IDataAccessHatch; @@ -33,6 +29,7 @@ import gregtech.common.metatileentities.MetaTileEntities; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiFluidHatch; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -47,17 +44,24 @@ import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Vector3; + import java.util.List; import java.util.function.Function; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.util.RelativeDirection.*; public class MetaTileEntityAssemblyLine extends RecipeMapMultiblockController { private static final ResourceLocation LASER_LOCATION = GTUtility.gregtechId("textures/fx/laser/laser.png"); - private static final ResourceLocation LASER_HEAD_LOCATION = GTUtility.gregtechId("textures/fx/laser/laser_start.png"); + private static final ResourceLocation LASER_HEAD_LOCATION = GTUtility + .gregtechId("textures/fx/laser/laser_start.png"); @SideOnly(Side.CLIENT) private GTLaserBeamParticle[][] beamParticles; @@ -91,9 +95,13 @@ protected BlockPattern createStructurePattern() { .setMaxGlobalLimited(3))) .where('I', metaTileEntities(MetaTileEntities.ITEM_IMPORT_BUS[GTValues.ULV])) .where('G', states(getGrateState())) - .where('A', states(MetaBlocks.MULTIBLOCK_CASING.getState(BlockMultiblockCasing.MultiblockCasingType.ASSEMBLY_CONTROL))) + .where('A', + states(MetaBlocks.MULTIBLOCK_CASING + .getState(BlockMultiblockCasing.MultiblockCasingType.ASSEMBLY_CONTROL))) .where('R', states(MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.LAMINATED_GLASS))) - .where('T', states(MetaBlocks.MULTIBLOCK_CASING.getState(BlockMultiblockCasing.MultiblockCasingType.ASSEMBLY_LINE_CASING))) + .where('T', + states(MetaBlocks.MULTIBLOCK_CASING + .getState(BlockMultiblockCasing.MultiblockCasingType.ASSEMBLY_LINE_CASING))) .where('D', dataHatchPredicate()) .where(' ', any()); return pattern.build(); @@ -116,7 +124,7 @@ protected static TraceabilityPredicate fluidInputPredicate() { return metaTileEntities(MultiblockAbility.REGISTRY.get(MultiblockAbility.IMPORT_FLUIDS).stream() .filter(mte -> !(mte instanceof MetaTileEntityMultiFluidHatch)) .toArray(MetaTileEntity[]::new)) - .setMaxGlobalLimited(4); + .setMaxGlobalLimited(4); } return abilities(MultiblockAbility.IMPORT_FLUIDS); } @@ -161,7 +169,8 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); } @Override @@ -241,8 +250,10 @@ private void readParticles(@Nonnull PacketBuffer buf) { } BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(getPos()); - EnumFacing relativeUp = RelativeDirection.UP.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); - EnumFacing relativeLeft = RelativeDirection.LEFT.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); + EnumFacing relativeUp = RelativeDirection.UP.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), + isFlipped()); + EnumFacing relativeLeft = RelativeDirection.LEFT.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), + isFlipped()); boolean negativeUp = relativeUp.getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE; for (int i = 0; i < beamParticles.length; i++) { @@ -347,7 +358,8 @@ public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { isRecipeAvailable(getAbilities(MultiblockAbility.OPTICAL_DATA_RECEPTION), recipe); } - private static boolean isRecipeAvailable(@Nonnull Iterable hatches, @Nonnull Recipe recipe) { + private static boolean isRecipeAvailable(@Nonnull Iterable hatches, + @Nonnull Recipe recipe) { for (IDataAccessHatch hatch : hatches) { // creative hatches do not need to check, they always have the recipe if (hatch.isCreative()) return true; @@ -359,7 +371,8 @@ private static boolean isRecipeAvailable(@Nonnull Iterable tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + boolean advanced) { if (ConfigHolder.machines.orderedAssembly && ConfigHolder.machines.orderedFluidAssembly) { tooltip.add(I18n.format("gregtech.machine.assembly_line.tooltip_ordered_both")); } else if (ConfigHolder.machines.orderedAssembly) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java index 252b4225bfb..4ce376d8597 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import appeng.core.AEConfig; -import appeng.core.features.AEFeature; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.*; import gregtech.api.capability.impl.CleanroomLogic; @@ -31,6 +26,7 @@ import gregtech.common.metatileentities.multi.MetaTileEntityPrimitiveWaterPump; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.Block; import net.minecraft.block.BlockDoor; import net.minecraft.block.state.IBlockState; @@ -48,7 +44,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; @@ -56,13 +51,21 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import appeng.core.AEConfig; +import appeng.core.features.AEFeature; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; +import java.util.*; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.*; -public class MetaTileEntityCleanroom extends MultiblockWithDisplayBase implements ICleanroomProvider, IWorkable, IDataInfoProvider { +public class MetaTileEntityCleanroom extends MultiblockWithDisplayBase + implements ICleanroomProvider, IWorkable, IDataInfoProvider { public static final int CLEAN_AMOUNT_THRESHOLD = 90; public static final int MIN_CLEAN_AMOUNT = 0; @@ -119,7 +122,8 @@ protected void formStructure(PatternMatchContext context) { // max progress is based on the dimensions of the structure: (x^3)-(x^2) // taller cleanrooms take longer than wider ones // minimum of 100 is a 5x5x5 cleanroom: 125-25=100 ticks - this.cleanroomLogic.setMaxProgress(Math.max(100, ((lDist + rDist + 1) * (bDist + fDist + 1) * hDist) - ((lDist + rDist + 1) * (bDist + fDist + 1)))); + this.cleanroomLogic.setMaxProgress(Math.max(100, + ((lDist + rDist + 1) * (bDist + fDist + 1) * hDist) - ((lDist + rDist + 1) * (bDist + fDist + 1)))); } @Override @@ -228,8 +232,10 @@ public boolean updateStructureDimensions() { * @param direction the direction to move * @return if a block is a valid wall block at pos moved in direction */ - public boolean isBlockEdge(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, @Nonnull EnumFacing direction) { - return world.getBlockState(pos.move(direction)) == MetaBlocks.CLEANROOM_CASING.getState(BlockCleanroomCasing.CasingType.PLASCRETE); + public boolean isBlockEdge(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, + @Nonnull EnumFacing direction) { + return world.getBlockState(pos.move(direction)) == + MetaBlocks.CLEANROOM_CASING.getState(BlockCleanroomCasing.CasingType.PLASCRETE); } /** @@ -238,8 +244,10 @@ public boolean isBlockEdge(@Nonnull World world, @Nonnull BlockPos.MutableBlockP * @param direction the direction to move * @return if a block is a valid floor block at pos moved in direction */ - public boolean isBlockFloor(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, @Nonnull EnumFacing direction) { - return isBlockEdge(world, pos, direction) || world.getBlockState(pos) == MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.CLEANROOM_GLASS); + public boolean isBlockFloor(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, + @Nonnull EnumFacing direction) { + return isBlockEdge(world, pos, direction) || world.getBlockState(pos) == + MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.CLEANROOM_GLASS); } @Nonnull @@ -265,7 +273,7 @@ protected BlockPattern createStructurePattern() { // build each row of the structure StringBuilder borderBuilder = new StringBuilder(); // BBBBB StringBuilder wallBuilder = new StringBuilder(); // BXXXB - StringBuilder insideBuilder = new StringBuilder(); // X X + StringBuilder insideBuilder = new StringBuilder(); // X X StringBuilder roofBuilder = new StringBuilder(); // BFFFB StringBuilder controllerBuilder = new StringBuilder(); // BFSFB StringBuilder centerBuilder = new StringBuilder(); // BXKXB @@ -320,12 +328,12 @@ protected BlockPattern createStructurePattern() { wall[0] = borderBuilder.toString(); wall[wall.length - 1] = borderBuilder.toString(); - String[] slice = new String[hDist + 1]; // "BXXXB", "X X", "X X", "X X", "BFFFB" + String[] slice = new String[hDist + 1]; // "BXXXB", "X X", "X X", "X X", "BFFFB" Arrays.fill(slice, insideBuilder.toString()); slice[0] = wallBuilder.toString(); slice[slice.length - 1] = roofBuilder.toString(); - String[] center = Arrays.copyOf(slice, slice.length); // "BXKXB", "X X", "X X", "X X", "BFSFB" + String[] center = Arrays.copyOf(slice, slice.length); // "BXKXB", "X X", "X X", "X X", "BFSFB" if (this.frontFacing == EnumFacing.NORTH || this.frontFacing == EnumFacing.SOUTH) { center[0] = centerBuilder.reverse().toString(); center[center.length - 1] = controllerBuilder.reverse().toString(); @@ -350,7 +358,8 @@ protected BlockPattern createStructurePattern() { .where('X', wallPredicate.or(basePredicate) .or(doorPredicate().setMaxGlobalLimited(8)) .or(abilities(MultiblockAbility.PASSTHROUGH_HATCH).setMaxGlobalLimited(30))) - .where('K', wallPredicate) // the block beneath the controller must only be a casing for structure dimension checks + .where('K', wallPredicate) // the block beneath the controller must only be a casing for structure + // dimension checks .where('F', filterPredicate()) .where(' ', innerPredicate()) .build(); @@ -362,7 +371,8 @@ protected TraceabilityPredicate filterPredicate() { IBlockState blockState = blockWorldState.getBlockState(); Block block = blockState.getBlock(); if (block instanceof BlockCleanroomCasing) { - BlockCleanroomCasing.CasingType casingType = ((BlockCleanroomCasing) blockState.getBlock()).getState(blockState); + BlockCleanroomCasing.CasingType casingType = ((BlockCleanroomCasing) blockState.getBlock()) + .getState(blockState); if (casingType.equals(BlockCleanroomCasing.CasingType.PLASCRETE)) return false; Object currentFilter = blockWorldState.getMatchContext().getOrPut("FilterType", casingType); @@ -379,7 +389,7 @@ protected TraceabilityPredicate filterPredicate() { .filter(type -> !type.equals(BlockCleanroomCasing.CasingType.PLASCRETE)) .map(type -> new BlockInfo(MetaBlocks.CLEANROOM_CASING.getState(type), null)) .toArray(BlockInfo[]::new))) - .addTooltips("gregtech.multiblock.pattern.error.filters"); + .addTooltips("gregtech.multiblock.pattern.error.filters"); } @SideOnly(Side.CLIENT) @@ -401,7 +411,8 @@ protected IBlockState getGlassState() { @Nonnull protected static TraceabilityPredicate doorPredicate() { - return new TraceabilityPredicate(blockWorldState -> blockWorldState.getBlockState().getBlock() instanceof BlockDoor); + return new TraceabilityPredicate( + blockWorldState -> blockWorldState.getBlockState().getBlock() instanceof BlockDoor); } @Nonnull @@ -512,7 +523,9 @@ public void addInformation(ItemStack stack, @Nullable World player, List tooltip.add(I18n.format("gregtech.machine.cleanroom.tooltip.8")); tooltip.add(I18n.format("gregtech.machine.cleanroom.tooltip.9")); if (Loader.isModLoaded(GTValues.MODID_APPENG)) { - tooltip.add(I18n.format(AEConfig.instance().isFeatureEnabled(AEFeature.CHANNELS) ? "gregtech.machine.cleanroom.tooltip.ae2.channels" : "gregtech.machine.cleanroom.tooltip.ae2.no_channels")); + tooltip.add(I18n.format(AEConfig.instance().isFeatureEnabled(AEFeature.CHANNELS) ? + "gregtech.machine.cleanroom.tooltip.ae2.channels" : + "gregtech.machine.cleanroom.tooltip.ae2.no_channels")); } tooltip.add(""); } else { @@ -523,7 +536,8 @@ public void addInformation(ItemStack stack, @Nullable World player, List @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive(), isWorkingEnabled()); + this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive(), + isWorkingEnabled()); } @SideOnly(Side.CLIENT) @@ -557,7 +571,8 @@ public boolean isClean() { @Nonnull @Override public List getDataInfo() { - return Collections.singletonList(new TextComponentTranslation(isClean() ? "gregtech.multiblock.cleanroom.clean_state" : "gregtech.multiblock.cleanroom.dirty_state")); + return Collections.singletonList(new TextComponentTranslation( + isClean() ? "gregtech.multiblock.cleanroom.clean_state" : "gregtech.multiblock.cleanroom.dirty_state")); } @Override @@ -603,7 +618,8 @@ public long getEnergyInputPerSecond() { } public boolean drainEnergy(boolean simulate) { - long energyToDrain = isClean() ? (long) Math.min(4, Math.pow(4, getEnergyTier())) : GTValues.VA[getEnergyTier()]; + long energyToDrain = isClean() ? (long) Math.min(4, Math.pow(4, getEnergyTier())) : + GTValues.VA[getEnergyTier()]; long resultEnergy = energyContainer.getEnergyStored() - energyToDrain; if (resultEnergy >= 0L && resultEnergy <= energyContainer.getEnergyCapacity()) { if (!simulate) @@ -712,13 +728,20 @@ public List getMatchingShapes() { .where('L', MetaTileEntities.PASSTHROUGH_HATCH_FLUID, EnumFacing.NORTH) .where('H', MetaTileEntities.HULL[GTValues.HV], EnumFacing.NORTH) .where('D', MetaTileEntities.DIODES[GTValues.HV], EnumFacing.NORTH) - .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : MetaBlocks.CLEANROOM_CASING.getState(BlockCleanroomCasing.CasingType.PLASCRETE), EnumFacing.SOUTH) - .where('O', Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.NORTH).withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER)) - .where('R', Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.NORTH).withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER)); + .where('M', + () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + MetaBlocks.CLEANROOM_CASING.getState(BlockCleanroomCasing.CasingType.PLASCRETE), + EnumFacing.SOUTH) + .where('O', + Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.NORTH) + .withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER)) + .where('R', Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.NORTH) + .withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER)); Arrays.stream(BlockCleanroomCasing.CasingType.values()) .filter(casingType -> !casingType.equals(BlockCleanroomCasing.CasingType.PLASCRETE)) - .forEach(casingType -> shapeInfo.add(builder.where('F', MetaBlocks.CLEANROOM_CASING.getState(casingType)).build())); + .forEach(casingType -> shapeInfo + .add(builder.where('F', MetaBlocks.CLEANROOM_CASING.getState(casingType)).build())); return shapeInfo; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java index 5386c82fa0c..c4a3c65ca5e 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java @@ -19,6 +19,7 @@ import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -30,9 +31,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntityCrackingUnit extends RecipeMapMultiblockController { @@ -85,7 +87,8 @@ protected void addDisplayText(List textList) { .addCustom(tl -> { // Coil energy discount line if (isStructureFormed()) { - ITextComponent energyDiscount = TextComponentUtil.stringWithColor(TextFormatting.AQUA, (100 - 10 * coilTier) + "%"); + ITextComponent energyDiscount = TextComponentUtil.stringWithColor(TextFormatting.AQUA, + (100 - 10 * coilTier) + "%"); ITextComponent base = TextComponentUtil.translationWithColor( TextFormatting.GRAY, @@ -153,7 +156,8 @@ protected void modifyOverclockPost(int[] resultOverclock, @Nonnull IRecipeProper if (coilTier <= 0) return; - resultOverclock[0] *= 1.0f - coilTier * 0.1; // each coil above cupronickel (coilTier = 0) uses 10% less energy + resultOverclock[0] *= 1.0f - coilTier * 0.1; // each coil above cupronickel (coilTier = 0) uses 10% less + // energy resultOverclock[0] = Math.max(1, resultOverclock[0]); } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java index 55a8b966fa7..ed12643fe4a 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.*; import gregtech.api.capability.impl.EnergyContainerList; @@ -22,6 +19,7 @@ import gregtech.common.blocks.BlockComputerCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -31,19 +29,21 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentTranslation; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityDataBank extends MultiblockWithDisplayBase implements IControllable { private static final int EUT_PER_HATCH = GTValues.VA[GTValues.EV]; @@ -215,7 +215,8 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), this.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), + this.isWorkingEnabled()); } @SideOnly(Side.CLIENT) @@ -237,13 +238,16 @@ public SoundEvent getSound() { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.2")); tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.3")); - tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.4", TextFormattingUtil.formatNumbers(EUT_PER_HATCH))); - tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.5", TextFormattingUtil.formatNumbers(EUT_PER_HATCH_CHAINED))); + tooltip.add( + I18n.format("gregtech.machine.data_bank.tooltip.4", TextFormattingUtil.formatNumbers(EUT_PER_HATCH))); + tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.5", + TextFormattingUtil.formatNumbers(EUT_PER_HATCH_CHAINED))); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java index 3dddb3d390b..4918d203a08 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java @@ -9,8 +9,8 @@ import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.recipes.RecipeMaps; import gregtech.api.util.GTUtility; -import gregtech.api.util.TextComponentUtil; import gregtech.api.util.RelativeDirection; +import gregtech.api.util.TextComponentUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; @@ -18,6 +18,7 @@ import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiFluidHatch; import gregtech.common.metatileentities.multi.multiblockpart.appeng.MetaTileEntityMEOutputHatch; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; @@ -28,10 +29,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.util.List; import java.util.function.Function; +import javax.annotation.Nonnull; + import static gregtech.api.util.RelativeDirection.*; public class MetaTileEntityDistillationTower extends RecipeMapMultiblockController { @@ -60,7 +62,8 @@ protected void addDisplayText(List textList) { if (isStructureFormed()) { FluidStack stackInTank = importFluids.drain(Integer.MAX_VALUE, false); if (stackInTank != null && stackInTank.amount > 0) { - ITextComponent fluidName = TextComponentUtil.setColor(GTUtility.getFluidTranslation(stackInTank), TextFormatting.AQUA); + ITextComponent fluidName = TextComponentUtil.setColor(GTUtility.getFluidTranslation(stackInTank), + TextFormatting.AQUA); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.distillation_tower.distilling_fluid", @@ -83,9 +86,10 @@ protected BlockPattern createStructurePattern() { .or(abilities(MultiblockAbility.IMPORT_FLUIDS).setExactLimit(1))) .where('X', states(getCasingState()) .or(metaTileEntities(MultiblockAbility.REGISTRY.get(MultiblockAbility.EXPORT_FLUIDS).stream() - .filter(mte -> !(mte instanceof MetaTileEntityMultiFluidHatch) && !(mte instanceof MetaTileEntityMEOutputHatch)) + .filter(mte -> !(mte instanceof MetaTileEntityMultiFluidHatch) && + !(mte instanceof MetaTileEntityMEOutputHatch)) .toArray(MetaTileEntity[]::new)) - .setMinLayerLimited(1).setMaxLayerLimited(1)) + .setMinLayerLimited(1).setMaxLayerLimited(1)) .or(autoAbilities(true, false))) .where('#', air()) .build(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java index 2136e3a2d91..51ba3cdb73a 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java @@ -29,6 +29,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; @@ -44,12 +45,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Comparator; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityElectricBlastFurnace extends RecipeMapMultiblockController implements IHeatingCoil { private int blastFurnaceTemperature; @@ -97,8 +99,9 @@ protected void formStructure(PatternMatchContext context) { } else { this.blastFurnaceTemperature = CoilType.CUPRONICKEL.getCoilTemperature(); } - //the subtracted tier gives the starting level (exclusive) of the +100K heat bonus - this.blastFurnaceTemperature += 100 * Math.max(0, GTUtility.getFloorTierByVoltage(getEnergyContainer().getInputVoltage()) - GTValues.MV); + // the subtracted tier gives the starting level (exclusive) of the +100K heat bonus + this.blastFurnaceTemperature += 100 * + Math.max(0, GTUtility.getFloorTierByVoltage(getEnergyContainer().getInputVoltage()) - GTValues.MV); } @Override @@ -138,7 +141,8 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.electric_blast_furnace.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.electric_blast_furnace.tooltip.2")); @@ -188,7 +192,8 @@ public List getMatchingShapes() { .where('F', MetaTileEntities.FLUID_IMPORT_HATCH[GTValues.LV], EnumFacing.WEST) .where('D', MetaTileEntities.FLUID_EXPORT_HATCH[GTValues.LV], EnumFacing.EAST) .where('H', MetaTileEntities.MUFFLER_HATCH[GTValues.LV], EnumFacing.UP) - .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : MetaBlocks.METAL_CASING.getState(MetalCasingType.INVAR_HEATPROOF), EnumFacing.NORTH); + .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + MetaBlocks.METAL_CASING.getState(MetalCasingType.INVAR_HEATPROOF), EnumFacing.NORTH); GregTechAPI.HEATING_COILS.entrySet().stream() .sorted(Comparator.comparingInt(entry -> entry.getValue().getTier())) .forEach(entry -> shapeInfo.add(builder.where('C', entry.getKey()).build())); @@ -200,7 +205,8 @@ public List getMatchingShapes() { public List getDataInfo() { List list = super.getDataInfo(); list.add(new TextComponentTranslation("gregtech.multiblock.blast_furnace.max_temperature", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(blastFurnaceTemperature) + "K").setStyle(new Style().setColor(TextFormatting.RED)))); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(blastFurnaceTemperature) + "K") + .setStyle(new Style().setColor(TextFormatting.RED)))); return list; } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java index 0f435fece95..d7955df7bdb 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IEnergyContainer; @@ -32,6 +28,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -48,12 +45,19 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import com.google.common.collect.Lists; + import java.util.Collections; import java.util.List; -public class MetaTileEntityFluidDrill extends MultiblockWithDisplayBase implements ITieredMetaTileEntity, IWorkable, IProgressBarMultiblock { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class MetaTileEntityFluidDrill extends MultiblockWithDisplayBase + implements ITieredMetaTileEntity, IWorkable, IProgressBarMultiblock { private final FluidDrillLogic minerLogic; private final int tier; @@ -169,7 +173,8 @@ protected void addDisplayText(List textList) { if (minerLogic.getDrilledFluid() != null) { // Fluid name Fluid drilledFluid = minerLogic.getDrilledFluid(); - ITextComponent fluidInfo = TextComponentUtil.setColor(GTUtility.getFluidTranslation(drilledFluid), TextFormatting.GREEN); + ITextComponent fluidInfo = TextComponentUtil + .setColor(GTUtility.getFluidTranslation(drilledFluid), TextFormatting.GREEN); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.fluid_rig.drilled_fluid", @@ -178,13 +183,16 @@ protected void addDisplayText(List textList) { // Fluid amount ITextComponent amountInfo = TextComponentUtil.stringWithColor( TextFormatting.BLUE, - TextFormattingUtil.formatNumbers(minerLogic.getFluidToProduce() * 20L / FluidDrillLogic.MAX_PROGRESS) + " L/t"); + TextFormattingUtil.formatNumbers( + minerLogic.getFluidToProduce() * 20L / FluidDrillLogic.MAX_PROGRESS) + + " L/t"); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.fluid_rig.fluid_amount", amountInfo)); } else { - ITextComponent noFluid = TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.fluid_rig.no_fluid_in_area"); + ITextComponent noFluid = TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.fluid_rig.no_fluid_in_area"); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.fluid_rig.drilled_fluid", @@ -212,9 +220,12 @@ protected void addWarningText(List textList) { @Override public void addInformation(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.description")); - tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.depletion", TextFormattingUtil.formatNumbers(100.0 / getDepletionChance()))); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_tier_range", GTValues.VNF[this.tier], GTValues.VNF[this.tier + 1])); - tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.production", getRigMultiplier(), TextFormattingUtil.formatNumbers(getRigMultiplier() * 1.5))); + tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.depletion", + TextFormattingUtil.formatNumbers(100.0 / getDepletionChance()))); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_tier_range", GTValues.VNF[this.tier], + GTValues.VNF[this.tier + 1])); + tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.production", getRigMultiplier(), + TextFormattingUtil.formatNumbers(getRigMultiplier() * 1.5))); if (tier > GTValues.MV) { tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.shows_depletion")); } @@ -262,7 +273,8 @@ protected ICubeRenderer getFrontOverlay() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.minerLogic.isActive(), this.minerLogic.isWorkingEnabled()); + this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + this.minerLogic.isActive(), this.minerLogic.isWorkingEnabled()); } @Override @@ -276,12 +288,14 @@ public void setWorkingEnabled(boolean isActivationAllowed) { } public boolean fillTanks(FluidStack stack, boolean simulate) { - return GTTransferUtils.addFluidsToFluidHandler(outputFluidInventory, simulate, Collections.singletonList(stack)); + return GTTransferUtils.addFluidsToFluidHandler(outputFluidInventory, simulate, + Collections.singletonList(stack)); } public int getEnergyTier() { if (energyContainer == null) return this.tier; - return Math.min(this.tier + 1 , Math.max(this.tier, GTUtility.getFloorTierByVoltage(energyContainer.getInputVoltage()))); + return Math.min(this.tier + 1, + Math.max(this.tier, GTUtility.getFloorTierByVoltage(energyContainer.getInputVoltage()))); } public long getEnergyInputPerSecond() { @@ -365,7 +379,8 @@ public boolean showProgressBar() { @Override public double getFillPercentage(int index) { - int numOperationsLeft = BedrockFluidVeinHandler.getOperationsRemaining(getWorld(), minerLogic.getChunkX(), minerLogic.getChunkZ()); + int numOperationsLeft = BedrockFluidVeinHandler.getOperationsRemaining(getWorld(), minerLogic.getChunkX(), + minerLogic.getChunkZ()); int maxOperations = BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS; return 1.0 * numOperationsLeft / maxOperations; } @@ -377,13 +392,16 @@ public TextureArea getProgressBarTexture(int index) { @Override public void addBarHoverText(List hoverList, int index) { - int numOperationsLeft = BedrockFluidVeinHandler.getOperationsRemaining(getWorld(), minerLogic.getChunkX(), minerLogic.getChunkZ()); + int numOperationsLeft = BedrockFluidVeinHandler.getOperationsRemaining(getWorld(), minerLogic.getChunkX(), + minerLogic.getChunkZ()); int maxOperations = BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS; int percentage = (int) Math.round(1.0 * numOperationsLeft / maxOperations * 100); - TextFormatting color = percentage > 40 ? TextFormatting.GREEN : percentage > 10 ? TextFormatting.YELLOW : TextFormatting.RED; + TextFormatting color = percentage > 40 ? TextFormatting.GREEN : + percentage > 10 ? TextFormatting.YELLOW : TextFormatting.RED; if (numOperationsLeft == 0) { - hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.fluid_rig.vein_depleted")); + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.fluid_rig.vein_depleted")); } else { ITextComponent veinInfo = TextComponentUtil.stringWithColor(color, percentage + "%"); hoverList.add(TextComponentUtil.translationWithColor( diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java index 957fbbe570f..8de28fd4ae8 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java @@ -1,7 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import com.google.common.collect.Lists; -import com.google.common.util.concurrent.AtomicDouble; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IEnergyContainer; @@ -39,6 +37,7 @@ import gregtech.common.blocks.BlockGlassCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -59,17 +58,22 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.collect.Lists; +import com.google.common.util.concurrent.AtomicDouble; import org.lwjgl.opengl.GL11; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.DoubleSupplier; -public class MetaTileEntityFusionReactor extends RecipeMapMultiblockController implements IFastRenderMetaTileEntity, IBloomEffect { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class MetaTileEntityFusionReactor extends RecipeMapMultiblockController + implements IFastRenderMetaTileEntity, IBloomEffect { private final int tier; private EnergyContainerList inputEnergyContainers; @@ -86,6 +90,7 @@ public MetaTileEntityFusionReactor(ResourceLocation metaTileEntityId, int tier) this.recipeMapWorkable = new FusionRecipeLogic(this); this.tier = tier; this.energyContainer = new EnergyContainerHandler(this, 0, 0, 0, 0, 0) { + @Nonnull @Override public String getName() { @@ -121,15 +126,18 @@ protected BlockPattern createStructurePattern() { .aisle("###############", "######OSO######", "###############") .where('S', selfPredicate()) .where('G', states(getCasingState(), getGlassState())) - .where('E', states(getCasingState(), getGlassState()).or(metaTileEntities(Arrays.stream(MetaTileEntities.ENERGY_INPUT_HATCH) - .filter(mte -> mte != null && tier <= mte.getTier() && mte.getTier() <= GTValues.UV) - .toArray(MetaTileEntity[]::new)) - .setMinGlobalLimited(1).setPreviewCount(16))) + .where('E', + states(getCasingState(), getGlassState()).or(metaTileEntities(Arrays + .stream(MetaTileEntities.ENERGY_INPUT_HATCH) + .filter(mte -> mte != null && tier <= mte.getTier() && mte.getTier() <= GTValues.UV) + .toArray(MetaTileEntity[]::new)) + .setMinGlobalLimited(1).setPreviewCount(16))) .where('C', states(getCasingState())) .where('K', states(getCoilState())) .where('O', states(getCasingState(), getGlassState()).or(abilities(MultiblockAbility.EXPORT_FLUIDS))) .where('A', air()) - .where('I', states(getCasingState()).or(abilities(MultiblockAbility.IMPORT_FLUIDS).setMinGlobalLimited(2))) + .where('I', + states(getCasingState()).or(abilities(MultiblockAbility.IMPORT_FLUIDS).setMinGlobalLimited(2))) .where('#', any()) .build(); } @@ -173,8 +181,7 @@ public List getMatchingShapes() { shapeInfos.add(baseBuilder.shallowCopy() .where('G', getCasingState()) - .build() - ); + .build()); shapeInfos.add(baseBuilder.build()); return shapeInfos; } @@ -221,6 +228,7 @@ protected void formStructure(PatternMatchContext context) { public void invalidateStructure() { super.invalidateStructure(); this.energyContainer = new EnergyContainerHandler(this, 0, 0, 0, 0, 0) { + @Nonnull @Override public String getName() { @@ -241,6 +249,7 @@ protected void initializeAbilities() { this.inputEnergyContainers = new EnergyContainerList(energyInputs); long euCapacity = calculateEnergyStorageFactor(energyInputs.size()); this.energyContainer = new EnergyContainerHandler(this, euCapacity, GTValues.V[tier], 0, 0, 0) { + @Nonnull @Override public String getName() { @@ -261,8 +270,10 @@ protected void updateFormedValid() { } super.updateFormedValid(); if (recipeMapWorkable.isWorking() && color == null) { - if (recipeMapWorkable.getPreviousRecipe() != null && !recipeMapWorkable.getPreviousRecipe().getFluidOutputs().isEmpty()) { - int newColor = 0xFF000000 | recipeMapWorkable.getPreviousRecipe().getFluidOutputs().get(0).getFluid().getColor(); + if (recipeMapWorkable.getPreviousRecipe() != null && + !recipeMapWorkable.getPreviousRecipe().getFluidOutputs().isEmpty()) { + int newColor = 0xFF000000 | + recipeMapWorkable.getPreviousRecipe().getFluidOutputs().get(0).getFluid().getColor(); if (!Objects.equals(color, newColor)) { color = newColor; writeCustomData(GregtechDataCodes.UPDATE_COLOR, this::writeColor); @@ -306,9 +317,11 @@ private void writeColor(PacketBuffer buf) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(I18n.format("gregtech.machine.fusion_reactor.capacity", calculateEnergyStorageFactor(16) / 1000000L)); + tooltip.add( + I18n.format("gregtech.machine.fusion_reactor.capacity", calculateEnergyStorageFactor(16) / 1000000L)); tooltip.add(I18n.format("gregtech.machine.fusion_reactor.overclocking")); } @@ -338,17 +351,18 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { // Energy Bar builder.widget(new ProgressWidget( - () -> energyContainer.getEnergyCapacity() > 0 ? 1.0 * energyContainer.getEnergyStored() / energyContainer.getEnergyCapacity() : 0, + () -> energyContainer.getEnergyCapacity() > 0 ? + 1.0 * energyContainer.getEnergyStored() / energyContainer.getEnergyCapacity() : 0, 4, 144, 94, 7, GuiTextures.PROGRESS_BAR_FUSION_ENERGY, ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(this::addEnergyBarHoverText)); + .setHoverTextConsumer(this::addEnergyBarHoverText)); // Heat Bar builder.widget(new ProgressWidget( () -> energyContainer.getEnergyCapacity() > 0 ? 1.0 * heat / energyContainer.getEnergyCapacity() : 0, 100, 144, 94, 7, GuiTextures.PROGRESS_BAR_FUSION_HEAT, ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(this::addHeatBarHoverText)); + .setHoverTextConsumer(this::addHeatBarHoverText)); // Indicator Widget builder.widget(new IndicatorImageWidget(174, 122, 17, 17, getLogo()) @@ -385,7 +399,7 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { // Voiding Mode Button builder.widget(new ImageCycleButtonWidget(173, 189, 18, 18, GuiTextures.BUTTON_VOID_MULTIBLOCK, 4, this::getVoidingMode, this::setVoidingMode) - .setTooltipHoverString(MultiblockWithDisplayBase::getVoidingModeTooltip)); + .setTooltipHoverString(MultiblockWithDisplayBase::getVoidingModeTooltip)); // Distinct Buses Unavailable Image builder.widget(new ImageWidget(173, 171, 18, 18, GuiTextures.BUTTON_NO_DISTINCT_BUSES) @@ -402,8 +416,8 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { private void addEnergyBarHoverText(List hoverList) { ITextComponent energyInfo = TextComponentUtil.stringWithColor( TextFormatting.AQUA, - TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored()) + " / " - + TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity()) + " EU"); + TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored()) + " / " + + TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity()) + " EU"); hoverList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.energy_stored", @@ -413,7 +427,8 @@ private void addEnergyBarHoverText(List hoverList) { private void addHeatBarHoverText(List hoverList) { ITextComponent heatInfo = TextComponentUtil.stringWithColor( TextFormatting.RED, - TextFormattingUtil.formatNumbers(heat) + " / " + TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())); + TextFormattingUtil.formatNumbers(heat) + " / " + + TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())); hoverList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.fusion_reactor.heat", @@ -431,6 +446,7 @@ private static class FusionProgressSupplier { public FusionProgressSupplier() { // Bottom Left, fill on [0, 0.25) bottomLeft = new ProgressWidget.TimedProgressSupplier(200, 164, false) { + @Override public double getAsDouble() { double val = super.getAsDouble(); @@ -496,6 +512,7 @@ public DoubleSupplier getSupplier(Type type) { } private enum Type { + BOTTOM_LEFT( 61, 66, 35, 41, GuiTextures.PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BL, ProgressWidget.MoveType.VERTICAL), @@ -527,12 +544,15 @@ private enum Type { public ProgressWidget getWidget(MetaTileEntityFusionReactor instance) { return new ProgressWidget( - () -> instance.recipeMapWorkable.isActive() ? instance.progressBarSupplier.getSupplier(this).getAsDouble() : 0, + () -> instance.recipeMapWorkable.isActive() ? + instance.progressBarSupplier.getSupplier(this).getAsDouble() : 0, x, y, width, height, texture, moveType) - .setIgnoreColor(true) - .setHoverTextConsumer(tl -> MultiblockDisplayText.builder(tl, instance.isStructureFormed()) - .setWorkingStatus(instance.recipeMapWorkable.isWorkingEnabled(), instance.recipeMapWorkable.isActive()) - .addWorkingStatusLine()); + .setIgnoreColor(true) + .setHoverTextConsumer( + tl -> MultiblockDisplayText.builder(tl, instance.isStructureFormed()) + .setWorkingStatus(instance.recipeMapWorkable.isWorkingEnabled(), + instance.recipeMapWorkable.isActive()) + .addWorkingStatusLine()); } } } @@ -561,8 +581,10 @@ public long getMaxVoltage() { @Override public void updateWorkable() { super.updateWorkable(); - // Drain heat when the reactor is not active, is paused via soft mallet, or does not have enough energy and has fully wiped recipe progress - // Don't drain heat when there is not enough energy and there is still some recipe progress, as that makes it doubly hard to complete the recipe + // Drain heat when the reactor is not active, is paused via soft mallet, or does not have enough energy and + // has fully wiped recipe progress + // Don't drain heat when there is not enough energy and there is still some recipe progress, as that makes + // it doubly hard to complete the recipe // (Will have to recover heat and recipe progress) if (heat > 0) { if (!isActive || !workingEnabled || (hasNotEnoughEnergy && progressTime == 0)) { @@ -623,7 +645,8 @@ protected void setActive(boolean active) { @SideOnly(Side.CLIENT) public void renderMetaTileEntity(double x, double y, double z, float partialTicks) { if (this.color != null && this.bloomRenderTicket == null) { - this.bloomRenderTicket = BloomEffectUtil.registerBloomRender(FusionBloomSetup.INSTANCE, getBloomType(), this); + this.bloomRenderTicket = BloomEffectUtil.registerBloomRender(FusionBloomSetup.INSTANCE, getBloomType(), + this); } } @@ -638,8 +661,10 @@ public void renderBloomEffect(@Nonnull BufferBuilder buffer, @Nonnull EffectRend float r = (float) (color >> 16 & 255) / 255.0F; float g = (float) (color >> 8 & 255) / 255.0F; float b = (float) (color & 255) / 255.0F; - EnumFacing relativeBack = RelativeDirection.BACK.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); - EnumFacing.Axis axis = RelativeDirection.UP.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()).getAxis(); + EnumFacing relativeBack = RelativeDirection.BACK.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), + isFlipped()); + EnumFacing.Axis axis = RelativeDirection.UP.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()) + .getAxis(); RenderBufferHelper.renderRing(buffer, getPos().getX() - context.cameraX() + relativeBack.getXOffset() * 7 + 0.5, @@ -657,8 +682,10 @@ public boolean shouldRenderBloomEffect(@Nonnull EffectRenderContext context) { @Override public AxisAlignedBB getRenderBoundingBox() { - EnumFacing relativeRight = RelativeDirection.RIGHT.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); - EnumFacing relativeBack = RelativeDirection.BACK.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); + EnumFacing relativeRight = RelativeDirection.RIGHT.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), + isFlipped()); + EnumFacing relativeBack = RelativeDirection.BACK.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), + isFlipped()); return new AxisAlignedBB( this.getPos().offset(relativeBack).offset(relativeRight, 6), diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java index 71dc6444a95..46098a29b79 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.*; import gregtech.api.capability.impl.EnergyContainerList; @@ -32,8 +29,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.core.sound.GTSoundEvents; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -53,6 +49,12 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -62,7 +64,8 @@ import java.util.Set; import java.util.function.Supplier; -public class MetaTileEntityHPCA extends MultiblockWithDisplayBase implements IOpticalComputationProvider, IControllable, IProgressBarMultiblock { +public class MetaTileEntityHPCA extends MultiblockWithDisplayBase + implements IOpticalComputationProvider, IControllable, IProgressBarMultiblock { private static final double IDLE_TEMPERATURE = 200; private static final double DAMAGE_TEMPERATURE = 1000; @@ -131,7 +134,8 @@ public void update() { // we need to know what components we have on the client if (getWorld().isRemote) { if (isStructureFormed()) { - hpcaHandler.tryGatherClientComponents(getWorld(), getPos(), getFrontFacing(), getUpwardsFacing(), isFlipped()); + hpcaHandler.tryGatherClientComponents(getWorld(), getPos(), getFrontFacing(), getUpwardsFacing(), + isFlipped()); } else { hpcaHandler.clearClientComponents(); } @@ -144,7 +148,8 @@ protected void updateFormedValid() { if (isActive()) { // forcibly use active coolers at full rate if temperature is half-way to damaging temperature double midpoint = (DAMAGE_TEMPERATURE - IDLE_TEMPERATURE) / 2; - double temperatureChange = hpcaHandler.calculateTemperatureChange(coolantHandler, temperature >= midpoint) / 2.0; + double temperatureChange = hpcaHandler.calculateTemperatureChange(coolantHandler, temperature >= midpoint) / + 2.0; if (temperature + temperatureChange <= IDLE_TEMPERATURE) { temperature = IDLE_TEMPERATURE; } else { @@ -237,7 +242,8 @@ public List getMatchingShapes() { .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[GTValues.LuV], EnumFacing.NORTH) .where('H', MetaTileEntities.FLUID_IMPORT_HATCH[GTValues.LV], EnumFacing.NORTH) .where('O', MetaTileEntities.COMPUTATION_HATCH_TRANSMITTER, EnumFacing.SOUTH) - .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : getCasingState(), EnumFacing.NORTH); + .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + getCasingState(), EnumFacing.NORTH); // a few example structures shapeInfo.add(builder.shallowCopy() @@ -309,7 +315,8 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), this.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), + this.isWorkingEnabled()); } @Override @@ -351,15 +358,16 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { builder.widget(new ProgressWidget( () -> hpcaHandler.getAllocatedCWUt() > 0 ? progressSupplier.getAsDouble() : 0, 74, 57, 47, 47, GuiTextures.HPCA_COMPONENT_OUTLINE, ProgressWidget.MoveType.HORIZONTAL) - .setIgnoreColor(true) - .setHoverTextConsumer(hpcaHandler::addInfo)); + .setIgnoreColor(true) + .setHoverTextConsumer(hpcaHandler::addInfo)); int startX = 76; int startY = 59; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { final int index = i * 3 + j; Supplier textureSupplier = () -> hpcaHandler.getComponentTexture(index); - builder.widget(new SuppliedImageWidget(startX + (15 * j), startY + (15 * i), 13, 13, textureSupplier).setIgnoreColor(true)); + builder.widget(new SuppliedImageWidget(startX + (15 * j), startY + (15 * i), 13, 13, textureSupplier) + .setIgnoreColor(true)); } } return builder; @@ -368,7 +376,8 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { @Override protected void addDisplayText(List textList) { MultiblockDisplayText.builder(textList, isStructureFormed()) - .setWorkingStatus(true, hpcaHandler.getAllocatedCWUt() > 0) // transform into two-state system for display + .setWorkingStatus(true, hpcaHandler.getAllocatedCWUt() > 0) // transform into two-state system for + // display .setWorkingStatusKeys( "gregtech.multiblock.idling", "gregtech.multiblock.idling", @@ -376,7 +385,8 @@ protected void addDisplayText(List textList) { .addCustom(tl -> { if (isStructureFormed()) { // Energy Usage - ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getTierByVoltage(hpcaHandler.getMaxEUt())]); + ITextComponent voltageName = new TextComponentString( + GTValues.VNF[GTUtility.getTierByVoltage(hpcaHandler.getMaxEUt())]); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.hpca.energy", @@ -436,14 +446,16 @@ protected void addErrorText(List textList) { super.addErrorText(textList); if (isStructureFormed()) { if (temperature > 1000) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.hpca.error_temperature")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.hpca.error_temperature")); } hpcaHandler.addErrors(textList); } } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.high_performance_computing_array.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.high_performance_computing_array.tooltip.2")); @@ -521,16 +533,13 @@ public int getNumProgressBars() { @Override public double getFillPercentage(int index) { - return index == 0 - ? 1.0 * hpcaHandler.cachedCWUt / hpcaHandler.getMaxCWUt() - : Math.min(1.0, temperature / DAMAGE_TEMPERATURE); + return index == 0 ? 1.0 * hpcaHandler.cachedCWUt / hpcaHandler.getMaxCWUt() : + Math.min(1.0, temperature / DAMAGE_TEMPERATURE); } @Override public TextureArea getProgressBarTexture(int index) { - return index == 0 - ? GuiTextures.PROGRESS_BAR_HPCA_COMPUTATION - : GuiTextures.PROGRESS_BAR_FUSION_HEAT; + return index == 0 ? GuiTextures.PROGRESS_BAR_HPCA_COMPUTATION : GuiTextures.PROGRESS_BAR_FUSION_HEAT; } @Override @@ -825,57 +834,71 @@ public int getMaxCoolantDemand() { public void addInfo(List textList) { // Max Computation - ITextComponent data = TextComponentUtil.stringWithColor(TextFormatting.AQUA, Integer.toString(getMaxCWUt())); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.info_max_computation", data)); + ITextComponent data = TextComponentUtil.stringWithColor(TextFormatting.AQUA, + Integer.toString(getMaxCWUt())); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.info_max_computation", data)); // Cooling - TextFormatting coolingColor = getMaxCoolingAmount() < getMaxCoolingDemand() ? TextFormatting.RED : TextFormatting.GREEN; + TextFormatting coolingColor = getMaxCoolingAmount() < getMaxCoolingDemand() ? TextFormatting.RED : + TextFormatting.GREEN; data = TextComponentUtil.stringWithColor(coolingColor, Integer.toString(getMaxCoolingDemand())); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.info_max_cooling_demand", data)); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.info_max_cooling_demand", data)); data = TextComponentUtil.stringWithColor(coolingColor, Integer.toString(getMaxCoolingAmount())); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.info_max_cooling_available", data)); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.info_max_cooling_available", data)); // Coolant Required if (getMaxCoolantDemand() > 0) { data = TextComponentUtil.stringWithColor( TextFormatting.YELLOW, getMaxCoolantDemand() + "L "); - ITextComponent coolantName = TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.hpca.info_coolant_name"); + ITextComponent coolantName = TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.hpca.info_coolant_name"); data.appendSibling(coolantName); } else { data = TextComponentUtil.stringWithColor(TextFormatting.GREEN, "0"); } - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.info_max_coolant_required", data)); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.info_max_coolant_required", data)); // Bridging if (numBridges > 0) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GREEN, "gregtech.multiblock.hpca.info_bridging_enabled")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GREEN, + "gregtech.multiblock.hpca.info_bridging_enabled")); } else { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.hpca.info_bridging_disabled")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.hpca.info_bridging_disabled")); } } public void addWarnings(List textList) { List warnings = new ArrayList<>(); if (numBridges > 1) { - warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.warning_multiple_bridges")); + warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.warning_multiple_bridges")); } if (computationProviders.isEmpty()) { - warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.warning_no_computation")); + warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.warning_no_computation")); } if (getMaxCoolingDemand() > getMaxCoolingAmount()) { - warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.warning_low_cooling")); + warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.warning_low_cooling")); } if (!warnings.isEmpty()) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.hpca.warning_structure_header")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.hpca.warning_structure_header")); textList.addAll(warnings); } } public void addErrors(List textList) { if (components.stream().anyMatch(IHPCAComponentHatch::isDamaged)) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.hpca.error_damaged")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.hpca.error_damaged")); } } @@ -886,7 +909,8 @@ public TextureArea getComponentTexture(int index) { return components.get(index).getComponentIcon(); } - public void tryGatherClientComponents(World world, BlockPos pos, EnumFacing frontFacing, EnumFacing upwardsFacing, boolean flip) { + public void tryGatherClientComponents(World world, BlockPos pos, EnumFacing frontFacing, + EnumFacing upwardsFacing, boolean flip) { EnumFacing relativeUp = RelativeDirection.UP.getRelativeFacing(frontFacing, upwardsFacing, flip); if (components.isEmpty()) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityImplosionCompressor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityImplosionCompressor.java index 4a3e201012f..a3fc6af4dbf 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityImplosionCompressor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityImplosionCompressor.java @@ -12,6 +12,7 @@ import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeChemicalReactor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeChemicalReactor.java index bd00d438aa2..2f755707636 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeChemicalReactor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeChemicalReactor.java @@ -20,6 +20,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -30,11 +31,12 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityLargeChemicalReactor extends RecipeMapMultiblockController { public MetaTileEntityLargeChemicalReactor(ResourceLocation metaTileEntityId) { @@ -70,48 +72,47 @@ public List getMatchingShapes() { MultiblockShapeInfo.Builder baseBuilder = MultiblockShapeInfo.builder() .where('S', MetaTileEntities.LARGE_CHEMICAL_REACTOR, EnumFacing.SOUTH) .where('X', MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.PTFE_INERT_CASING)) - .where('P', MetaBlocks.BOILER_CASING.getState(BlockBoilerCasing.BoilerCasingType.POLYTETRAFLUOROETHYLENE_PIPE)) + .where('P', + MetaBlocks.BOILER_CASING + .getState(BlockBoilerCasing.BoilerCasingType.POLYTETRAFLUOROETHYLENE_PIPE)) .where('C', MetaBlocks.WIRE_COIL.getState(BlockWireCoil.CoilType.CUPRONICKEL)) .where('I', MetaTileEntities.ITEM_IMPORT_BUS[3], EnumFacing.SOUTH) .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[3], EnumFacing.NORTH) .where('O', MetaTileEntities.ITEM_EXPORT_BUS[3], EnumFacing.SOUTH) .where('F', MetaTileEntities.FLUID_IMPORT_HATCH[3], EnumFacing.SOUTH) .where('H', MetaTileEntities.FLUID_EXPORT_HATCH[3], EnumFacing.SOUTH) - .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.PTFE_INERT_CASING), EnumFacing.SOUTH); + .where('M', + () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.PTFE_INERT_CASING), + EnumFacing.SOUTH); shapeInfo.add(baseBuilder.shallowCopy() .aisle("XEX", "XCX", "XXX") .aisle("XXX", "XPX", "XXX") .aisle("IMO", "FSH", "XXX") - .build() - ); + .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("XEX", "XXX", "XXX") .aisle("XXX", "XPX", "XCX") .aisle("IMO", "FSH", "XXX") - .build() - ); + .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("XEX", "XXX", "XXX") .aisle("XCX", "XPX", "XXX") .aisle("IMO", "FSH", "XXX") - .build() - ); + .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("XEX", "XXX", "XXX") .aisle("XXX", "CPX", "XXX") .aisle("IMO", "FSH", "XXX") - .build() - ); + .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("XEX", "XXX", "XXX") .aisle("XXX", "XPC", "XXX") .aisle("IMO", "FSH", "XXX") - .build() - ); + .build()); return shapeInfo; } - @SideOnly(Side.CLIENT) @Override public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @@ -143,5 +144,4 @@ public void addInformation(ItemStack stack, @Nullable World player, List protected ICubeRenderer getFrontOverlay() { return Textures.LARGE_CHEMICAL_REACTOR_OVERLAY; } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java index dd52ae74fda..166073d5cec 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.capability.*; import gregtech.api.capability.impl.EnergyContainerList; @@ -38,6 +33,7 @@ import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -56,16 +52,24 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.unification.material.Materials.DrillingFluid; -public class MetaTileEntityLargeMiner extends MultiblockWithDisplayBase implements IMiner, IControllable, IDataInfoProvider { +public class MetaTileEntityLargeMiner extends MultiblockWithDisplayBase + implements IMiner, IControllable, IDataInfoProvider { private static final int CHUNK_LENGTH = 16; @@ -85,17 +89,21 @@ public class MetaTileEntityLargeMiner extends MultiblockWithDisplayBase implemen private final MultiblockMinerLogic minerLogic; - public MetaTileEntityLargeMiner(ResourceLocation metaTileEntityId, int tier, int speed, int maximumChunkDiameter, int fortune, Material material, int drillingFluidConsumePerTick) { + public MetaTileEntityLargeMiner(ResourceLocation metaTileEntityId, int tier, int speed, int maximumChunkDiameter, + int fortune, Material material, int drillingFluidConsumePerTick) { super(metaTileEntityId); this.material = material; this.tier = tier; this.drillingFluidConsumePerTick = drillingFluidConsumePerTick; - this.minerLogic = new MultiblockMinerLogic(this, fortune, speed, maximumChunkDiameter * CHUNK_LENGTH / 2, RecipeMaps.MACERATOR_RECIPES); + this.minerLogic = new MultiblockMinerLogic(this, fortune, speed, maximumChunkDiameter * CHUNK_LENGTH / 2, + RecipeMaps.MACERATOR_RECIPES); } @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntityLargeMiner(metaTileEntityId, this.tier, this.minerLogic.getSpeed(), this.minerLogic.getMaximumRadius() * 2 / CHUNK_LENGTH, this.minerLogic.getFortune(), getMaterial(), getDrillingFluidConsumePerTick()); + return new MetaTileEntityLargeMiner(metaTileEntityId, this.tier, this.minerLogic.getSpeed(), + this.minerLogic.getMaximumRadius() * 2 / CHUNK_LENGTH, this.minerLogic.getFortune(), getMaterial(), + getDrillingFluidConsumePerTick()); } @Override @@ -117,7 +125,8 @@ private void initializeAbilities() { this.outputInventory = new ItemHandlerList(getAbilities(MultiblockAbility.EXPORT_ITEMS)); this.energyContainer = new EnergyContainerList(getAbilities(MultiblockAbility.INPUT_ENERGY)); this.minerLogic.setVoltageTier(GTUtility.getTierByVoltage(this.energyContainer.getInputVoltage())); - this.minerLogic.setOverclockAmount(Math.max(1, GTUtility.getTierByVoltage(this.energyContainer.getInputVoltage()) - this.tier)); + this.minerLogic.setOverclockAmount( + Math.max(1, GTUtility.getTierByVoltage(this.energyContainer.getInputVoltage()) - this.tier)); this.minerLogic.initPos(getPos(), this.minerLogic.getCurrentRadius()); } @@ -129,7 +138,8 @@ private void resetTileAbilities() { public int getEnergyTier() { if (energyContainer == null) return this.tier; - return Math.min(this.tier + 1, Math.max(this.tier, GTUtility.getFloorTierByVoltage(energyContainer.getInputVoltage()))); + return Math.min(this.tier + 1, + Math.max(this.tier, GTUtility.getFloorTierByVoltage(energyContainer.getInputVoltage()))); } @Override @@ -146,9 +156,11 @@ public boolean drainEnergy(boolean simulate) { @Override public boolean drainFluid(boolean simulate) { - FluidStack drillingFluid = DrillingFluid.getFluid(this.drillingFluidConsumePerTick * this.minerLogic.getOverclockAmount()); + FluidStack drillingFluid = DrillingFluid + .getFluid(this.drillingFluidConsumePerTick * this.minerLogic.getOverclockAmount()); FluidStack fluidStack = inputFluidInventory.getTankAt(0).getFluid(); - if (fluidStack != null && fluidStack.isFluidEqual(DrillingFluid.getFluid(1)) && fluidStack.amount >= drillingFluid.amount) { + if (fluidStack != null && fluidStack.isFluidEqual(DrillingFluid.getFluid(1)) && + fluidStack.amount >= drillingFluid.amount) { if (!simulate) inputFluidInventory.drain(drillingFluid, true); return true; @@ -160,7 +172,8 @@ public boolean drainFluid(boolean simulate) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.minerLogic.isWorking(), this.isWorkingEnabled()); + this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + this.minerLogic.isWorking(), this.isWorkingEnabled()); minerLogic.renderPipe(renderState, translation, pipeline); } @@ -183,7 +196,8 @@ protected BlockPattern createStructurePattern() { .where('X', states(getCasingState()) .or(abilities(MultiblockAbility.EXPORT_ITEMS).setMaxGlobalLimited(1).setPreviewCount(1)) .or(abilities(MultiblockAbility.IMPORT_FLUIDS).setExactLimit(1).setPreviewCount(1)) - .or(abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(3).setPreviewCount(1))) + .or(abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(3) + .setPreviewCount(1))) .where('C', states(getCasingState())) .where('F', getFramePredicate()) .where('#', any()) @@ -192,17 +206,21 @@ protected BlockPattern createStructurePattern() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.machine.miner.multi.description")}; + return new String[] { I18n.format("gregtech.machine.miner.multi.description") }; } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { int workingAreaChunks = this.minerLogic.getCurrentRadius() * 2 / CHUNK_LENGTH; tooltip.add(I18n.format("gregtech.machine.miner.multi.modes")); tooltip.add(I18n.format("gregtech.machine.miner.multi.production")); - tooltip.add(I18n.format("gregtech.machine.miner.fluid_usage", getDrillingFluidConsumePerTick(), DrillingFluid.getLocalizedName())); - tooltip.add(I18n.format("gregtech.universal.tooltip.working_area_chunks_max", workingAreaChunks, workingAreaChunks)); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_tier_range", GTValues.VNF[this.tier], GTValues.VNF[this.tier + 1])); + tooltip.add(I18n.format("gregtech.machine.miner.fluid_usage", getDrillingFluidConsumePerTick(), + DrillingFluid.getLocalizedName())); + tooltip.add(I18n.format("gregtech.universal.tooltip.working_area_chunks_max", workingAreaChunks, + workingAreaChunks)); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_tier_range", GTValues.VNF[this.tier], + GTValues.VNF[this.tier + 1])); } @Override @@ -224,23 +242,31 @@ protected void addDisplayText(List textList) { int energyContainer = getEnergyTier(); long maxVoltage = GTValues.V[energyContainer]; String voltageName = GTValues.VNF[energyContainer]; - textList.add(new TextComponentTranslation("gregtech.multiblock.max_energy_per_tick", maxVoltage, voltageName)); + textList.add(new TextComponentTranslation("gregtech.multiblock.max_energy_per_tick", maxVoltage, + voltageName)); } int workingAreaChunks = this.minerLogic.getCurrentRadius() * 2 / CHUNK_LENGTH; int workingArea = getWorkingArea(minerLogic.getCurrentRadius()); - textList.add(new TextComponentTranslation("gregtech.machine.miner.startx", this.minerLogic.getX().get() == Integer.MAX_VALUE ? 0 : this.minerLogic.getX().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.starty", this.minerLogic.getY().get() == Integer.MAX_VALUE ? 0 : this.minerLogic.getY().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.startz", this.minerLogic.getZ().get() == Integer.MAX_VALUE ? 0 : this.minerLogic.getZ().get())); + textList.add(new TextComponentTranslation("gregtech.machine.miner.startx", + this.minerLogic.getX().get() == Integer.MAX_VALUE ? 0 : this.minerLogic.getX().get())); + textList.add(new TextComponentTranslation("gregtech.machine.miner.starty", + this.minerLogic.getY().get() == Integer.MAX_VALUE ? 0 : this.minerLogic.getY().get())); + textList.add(new TextComponentTranslation("gregtech.machine.miner.startz", + this.minerLogic.getZ().get() == Integer.MAX_VALUE ? 0 : this.minerLogic.getZ().get())); if (this.minerLogic.isChunkMode()) { - textList.add(new TextComponentTranslation("gregtech.machine.miner.working_area_chunks", workingAreaChunks, workingAreaChunks)); + textList.add(new TextComponentTranslation("gregtech.machine.miner.working_area_chunks", + workingAreaChunks, workingAreaChunks)); } else { - textList.add(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); + textList.add( + new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); } if (this.minerLogic.isDone()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.done").setStyle(new Style().setColor(TextFormatting.GREEN))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.done") + .setStyle(new Style().setColor(TextFormatting.GREEN))); else if (this.minerLogic.isWorking()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.working").setStyle(new Style().setColor(TextFormatting.GOLD))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.working") + .setStyle(new Style().setColor(TextFormatting.GOLD))); else if (!this.isWorkingEnabled()) textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); } @@ -249,11 +275,14 @@ else if (!this.isWorkingEnabled()) private void addDisplayText2(List textList) { if (this.isStructureFormed()) { ITextComponent mCoords = new TextComponentString(" ") - .appendSibling(new TextComponentTranslation("gregtech.machine.miner.minex", this.minerLogic.getMineX().get())) + .appendSibling(new TextComponentTranslation("gregtech.machine.miner.minex", + this.minerLogic.getMineX().get())) .appendText("\n ") - .appendSibling(new TextComponentTranslation("gregtech.machine.miner.miney", this.minerLogic.getMineY().get())) + .appendSibling(new TextComponentTranslation("gregtech.machine.miner.miney", + this.minerLogic.getMineY().get())) .appendText("\n ") - .appendSibling(new TextComponentTranslation("gregtech.machine.miner.minez", this.minerLogic.getMineZ().get())); + .appendSibling(new TextComponentTranslation("gregtech.machine.miner.minez", + this.minerLogic.getMineZ().get())); textList.add(mCoords); } } @@ -275,7 +304,8 @@ protected void addWarningText(List textList) { protected void addErrorText(List textList) { super.addErrorText(textList); if (isStructureFormed() && !drainFluid(true)) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.machine.miner.multi.needsfluid")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.machine.miner.multi.needsfluid")); } } @@ -322,7 +352,6 @@ public void readFromNBT(NBTTagCompound data) { this.minerLogic.readFromNBT(data); } - @Override public void writeInitialSyncData(PacketBuffer buf) { super.writeInitialSyncData(buf); @@ -406,17 +435,19 @@ private void setCurrentMode(int mode) { @Override protected @NotNull Widget getFlexButton(int x, int y, int width, int height) { - return new ImageCycleButtonWidget(x, y, width, height, GuiTextures.BUTTON_MINER_MODES, 4, this::getCurrentMode, this::setCurrentMode) - .setTooltipHoverString(mode -> switch (mode) { - case 0 -> "gregtech.multiblock.miner.neither_mode"; - case 1 -> "gregtech.multiblock.miner.chunk_mode"; - case 2 -> "gregtech.multiblock.miner.silk_touch_mode"; - default -> "gregtech.multiblock.miner.both_modes"; - }); + return new ImageCycleButtonWidget(x, y, width, height, GuiTextures.BUTTON_MINER_MODES, 4, this::getCurrentMode, + this::setCurrentMode) + .setTooltipHoverString(mode -> switch (mode) { + case 0 -> "gregtech.multiblock.miner.neither_mode"; + case 1 -> "gregtech.multiblock.miner.chunk_mode"; + case 2 -> "gregtech.multiblock.miner.silk_touch_mode"; + default -> "gregtech.multiblock.miner.both_modes"; + }); } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getWorld().isRemote || !this.isStructureFormed()) return true; @@ -429,7 +460,8 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci this.minerLogic.setCurrentRadius(currentRadius - CHUNK_LENGTH); } int workingAreaChunks = this.minerLogic.getCurrentRadius() * 2 / CHUNK_LENGTH; - playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.miner.working_area_chunks", workingAreaChunks, workingAreaChunks)); + playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.miner.working_area_chunks", + workingAreaChunks, workingAreaChunks)); } else { if (currentRadius - CHUNK_LENGTH / 2 <= 0) { this.minerLogic.setCurrentRadius(this.minerLogic.getMaximumRadius()); @@ -437,7 +469,8 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci this.minerLogic.setCurrentRadius(currentRadius - CHUNK_LENGTH / 2); } int workingArea = getWorkingArea(minerLogic.getCurrentRadius()); - playerIn.sendMessage(new TextComponentTranslation("gregtech.universal.tooltip.working_area", workingArea, workingArea)); + playerIn.sendMessage(new TextComponentTranslation("gregtech.universal.tooltip.working_area", + workingArea, workingArea)); } this.minerLogic.resetArea(); } else { @@ -514,7 +547,8 @@ public boolean isActive() { @Override public List getDataInfo() { int workingArea = getWorkingArea(this.minerLogic.getCurrentRadius()); - return Collections.singletonList(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); + return Collections.singletonList( + new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java index f6c6f6241de..831012eac9f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java @@ -20,17 +20,18 @@ import gregtech.common.blocks.BlockWireCoil.CoilType; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.*; -import net.minecraft.util.text.event.HoverEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class MetaTileEntityMultiSmelter extends RecipeMapMultiblockController { protected int heatingCoilLevel; @@ -121,7 +122,9 @@ protected BlockPattern createStructurePattern() { .aisle("XXX", "C#C", "XMX") .aisle("XSX", "CCC", "XXX") .where('S', selfPredicate()) - .where('X', states(getCasingState()).setMinGlobalLimited(9).or(autoAbilities(true, true, true, true, true, true, false))) + .where('X', + states(getCasingState()).setMinGlobalLimited(9) + .or(autoAbilities(true, true, true, true, true, true, false))) .where('M', abilities(MultiblockAbility.MUFFLER_HATCH)) .where('C', heatingCoils()) .where('#', air()) @@ -173,7 +176,7 @@ public static int getMaxParallel(int heatingCoilLevel) { } /** - * @param parallel the amount of parallel recipes + * @param parallel the amount of parallel recipes * @param parallelLimit the maximum limit on parallel recipes * @return the un-overclocked duration for an amount of parallel recipes */ diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityNetworkSwitch.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityNetworkSwitch.java index 80d51586aef..fc49827d51b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityNetworkSwitch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityNetworkSwitch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IOpticalComputationHatch; import gregtech.api.capability.IOpticalComputationProvider; @@ -21,7 +18,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.blocks.BlockComputerCasing; import gregtech.common.blocks.MetaBlocks; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -31,6 +28,8 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -136,11 +135,13 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { tooltip.add(I18n.format("gregtech.machine.network_switch.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.network_switch.tooltip.2")); tooltip.add(I18n.format("gregtech.machine.network_switch.tooltip.3")); - tooltip.add(I18n.format("gregtech.machine.network_switch.tooltip.4", TextFormattingUtil.formatNumbers(EUT_PER_HATCH))); + tooltip.add(I18n.format("gregtech.machine.network_switch.tooltip.4", + TextFormattingUtil.formatNumbers(EUT_PER_HATCH))); } @Override @@ -167,7 +168,8 @@ protected void addWarningText(List textList) { } /** Handles computation load across multiple receivers and to multiple transmitters. */ - private static class MultipleComputationHandler implements IOpticalComputationProvider, IOpticalComputationReceiver { + private static class MultipleComputationHandler implements IOpticalComputationProvider, + IOpticalComputationReceiver { // providers in the NS provide distributable computation to the NS private final Set providers = new ObjectOpenHashSet<>(); @@ -176,7 +178,8 @@ private static class MultipleComputationHandler implements IOpticalComputationPr private int EUt; - private void onStructureForm(Collection providers, Collection transmitters) { + private void onStructureForm(Collection providers, + Collection transmitters) { reset(); this.providers.addAll(providers); this.transmitters.addAll(transmitters); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPowerSubstation.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPowerSubstation.java index e80fb1044b0..c6ee87449d2 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPowerSubstation.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPowerSubstation.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.capability.GregtechDataCodes; @@ -26,6 +23,7 @@ import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -40,6 +38,10 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.VisibleForTesting; @@ -51,7 +53,8 @@ import static gregtech.api.util.RelativeDirection.*; -public class MetaTileEntityPowerSubstation extends MultiblockWithDisplayBase implements IControllable, IProgressBarMultiblock { +public class MetaTileEntityPowerSubstation extends MultiblockWithDisplayBase + implements IControllable, IProgressBarMultiblock { // Structure Constants public static final int MAX_BATTERY_LAYERS = 18; @@ -107,7 +110,8 @@ protected void formStructure(PatternMatchContext context) { List parts = new ArrayList<>(); for (Map.Entry battery : context.entrySet()) { - if (battery.getKey().startsWith(PMC_BATTERY_HEADER) && battery.getValue() instanceof BatteryMatchWrapper wrapper) { + if (battery.getKey().startsWith(PMC_BATTERY_HEADER) && + battery.getValue() instanceof BatteryMatchWrapper wrapper) { for (int i = 0; i < wrapper.amount; i++) { parts.add(wrapper.partType); } @@ -160,7 +164,8 @@ protected void updateFormedValid() { netIOLastSec -= energyPassiveDrained; // Debank to Dynamo Hatches - long energyDebanked = energyBank.drain(outputHatches.getEnergyCapacity() - outputHatches.getEnergyStored()); + long energyDebanked = energyBank + .drain(outputHatches.getEnergyCapacity() - outputHatches.getEnergyStored()); outputHatches.changeEnergy(energyDebanked); netIOLastSec -= energyDebanked; } @@ -222,10 +227,12 @@ protected BlockPattern createStructurePattern() { .aisle("GGGGG", "GGGGG", "GGGGG", "GGGGG", "GGGGG") .where('S', selfPredicate()) .where('C', states(getCasingState())) - .where('X' ,states(getCasingState()).setMinGlobalLimited(MIN_CASINGS) + .where('X', states(getCasingState()).setMinGlobalLimited(MIN_CASINGS) .or(maintenancePredicate()) - .or(abilities(MultiblockAbility.INPUT_ENERGY, MultiblockAbility.SUBSTATION_INPUT_ENERGY, MultiblockAbility.INPUT_LASER).setMinGlobalLimited(1)) - .or(abilities(MultiblockAbility.OUTPUT_ENERGY, MultiblockAbility.SUBSTATION_OUTPUT_ENERGY, MultiblockAbility.OUTPUT_LASER).setMinGlobalLimited(1))) + .or(abilities(MultiblockAbility.INPUT_ENERGY, MultiblockAbility.SUBSTATION_INPUT_ENERGY, + MultiblockAbility.INPUT_LASER).setMinGlobalLimited(1)) + .or(abilities(MultiblockAbility.OUTPUT_ENERGY, MultiblockAbility.SUBSTATION_OUTPUT_ENERGY, + MultiblockAbility.OUTPUT_LASER).setMinGlobalLimited(1))) .where('G', states(getGlassState())) .where('B', BATTERY_PREDICATE.get()) .build(); @@ -247,9 +254,9 @@ public List getMatchingShapes() { .where('N', MetaTileEntities.SUBSTATION_ENERGY_INPUT_HATCH[0], EnumFacing.SOUTH) .where('O', MetaTileEntities.ENERGY_OUTPUT_HATCH[GTValues.HV], EnumFacing.SOUTH) .where('T', MetaTileEntities.SUBSTATION_ENERGY_OUTPUT_HATCH[0], EnumFacing.SOUTH) - .where('M', () -> ConfigHolder.machines.enableMaintenance - ? MetaTileEntities.MAINTENANCE_HATCH - : MetaBlocks.METAL_CASING.getState(MetalCasingType.PALLADIUM_SUBSTATION), + .where('M', + () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + MetaBlocks.METAL_CASING.getState(MetalCasingType.PALLADIUM_SUBSTATION), EnumFacing.SOUTH); GregTechAPI.PSS_BATTERIES.entrySet().stream() @@ -270,26 +277,27 @@ protected IBlockState getGlassState() { return MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.LAMINATED_GLASS); } - protected static final Supplier BATTERY_PREDICATE = () -> new TraceabilityPredicate(blockWorldState -> { - IBlockState state = blockWorldState.getBlockState(); - if (GregTechAPI.PSS_BATTERIES.containsKey(state)) { - IBatteryData battery = GregTechAPI.PSS_BATTERIES.get(state); - // Allow unfilled batteries in the structure, but do not add them to match context. - // This lets you use empty batteries as "filler slots" for convenience if desired. - if (battery.getTier() != -1 && battery.getCapacity() > 0) { - String key = PMC_BATTERY_HEADER + battery.getBatteryName(); - BatteryMatchWrapper wrapper = blockWorldState.getMatchContext().get(key); - if (wrapper == null) wrapper = new BatteryMatchWrapper(battery); - blockWorldState.getMatchContext().set(key, wrapper.increment()); - } - return true; - } - return false; - }, () -> GregTechAPI.PSS_BATTERIES.entrySet().stream() - .sorted(Comparator.comparingInt(entry -> entry.getValue().getTier())) - .map(entry -> new BlockInfo(entry.getKey(), null)) - .toArray(BlockInfo[]::new)) - .addTooltips("gregtech.multiblock.pattern.error.batteries"); + protected static final Supplier BATTERY_PREDICATE = () -> new TraceabilityPredicate( + blockWorldState -> { + IBlockState state = blockWorldState.getBlockState(); + if (GregTechAPI.PSS_BATTERIES.containsKey(state)) { + IBatteryData battery = GregTechAPI.PSS_BATTERIES.get(state); + // Allow unfilled batteries in the structure, but do not add them to match context. + // This lets you use empty batteries as "filler slots" for convenience if desired. + if (battery.getTier() != -1 && battery.getCapacity() > 0) { + String key = PMC_BATTERY_HEADER + battery.getBatteryName(); + BatteryMatchWrapper wrapper = blockWorldState.getMatchContext().get(key); + if (wrapper == null) wrapper = new BatteryMatchWrapper(battery); + blockWorldState.getMatchContext().set(key, wrapper.increment()); + } + return true; + } + return false; + }, () -> GregTechAPI.PSS_BATTERIES.entrySet().stream() + .sorted(Comparator.comparingInt(entry -> entry.getValue().getTier())) + .map(entry -> new BlockInfo(entry.getKey(), null)) + .toArray(BlockInfo[]::new)) + .addTooltips("gregtech.multiblock.pattern.error.batteries"); @SideOnly(Side.CLIENT) @Override @@ -307,7 +315,8 @@ protected ICubeRenderer getFrontOverlay() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), this.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), + this.isWorkingEnabled()); } @Override @@ -378,14 +387,16 @@ protected void addDisplayText(List textList) { // Time to fill/drain line if (averageIOLastSec > 0) { - ITextComponent timeToFill = getTimeToFillDrainText(energyCapacity.subtract(energyStored).divide(BigInteger.valueOf(averageIOLastSec * 20))); + ITextComponent timeToFill = getTimeToFillDrainText(energyCapacity.subtract(energyStored) + .divide(BigInteger.valueOf(averageIOLastSec * 20))); TextComponentUtil.setColor(timeToFill, TextFormatting.GREEN); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.power_substation.time_to_fill", timeToFill)); } else if (averageIOLastSec < 0) { - ITextComponent timeToDrain = getTimeToFillDrainText(energyStored.divide(BigInteger.valueOf(Math.abs(averageIOLastSec) * 20))); + ITextComponent timeToDrain = getTimeToFillDrainText( + energyStored.divide(BigInteger.valueOf(Math.abs(averageIOLastSec) * 20))); TextComponentUtil.setColor(timeToDrain, TextFormatting.RED); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, @@ -402,7 +413,8 @@ protected void addWarningText(List textList) { super.addWarningText(textList); if (isStructureFormed()) { if (averageIOLastSec < 0) { // decreasing - BigInteger timeToDrainSeconds = energyBank.getStored().divide(BigInteger.valueOf(Math.abs(averageIOLastSec) * 20)); + BigInteger timeToDrainSeconds = energyBank.getStored() + .divide(BigInteger.valueOf(Math.abs(averageIOLastSec) * 20)); if (timeToDrainSeconds.compareTo(BigInteger.valueOf(60 * 60)) < 0) { // less than 1 hour left textList.add(TextComponentUtil.translationWithColor( TextFormatting.YELLOW, @@ -499,14 +511,15 @@ public T getCapability(Capability capability, EnumFacing side) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip1")); tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip2")); tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip3", MAX_BATTERY_LAYERS)); tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip4")); tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip5", PASSIVE_DRAIN_MAX_PER_STORAGE)); - tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip6") - + TooltipHelper.RAINBOW_SLOW + I18n.format("gregtech.machine.power_substation.tooltip6.5")); + tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip6") + TooltipHelper.RAINBOW_SLOW + + I18n.format("gregtech.machine.power_substation.tooltip6.5")); } public String getStored() { diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java index a680fd7e0bd..41cce088abd 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java @@ -26,6 +26,7 @@ import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -38,11 +39,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + import org.apache.commons.lang3.ArrayUtils; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; import static gregtech.api.GTValues.ULV; @@ -92,17 +95,14 @@ protected BlockPattern createStructurePattern() { } public IBlockState getCasingState() { - return tier == 0 - ? MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.TUNGSTENSTEEL_ROBUST) - : MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.HSSE_STURDY); + return tier == 0 ? MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.TUNGSTENSTEEL_ROBUST) : + MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.HSSE_STURDY); } @SideOnly(Side.CLIENT) @Override public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { - return tier == 0 - ? Textures.ROBUST_TUNGSTENSTEEL_CASING - : Textures.STURDY_HSSE_CASING; + return tier == 0 ? Textures.ROBUST_TUNGSTENSTEEL_CASING : Textures.STURDY_HSSE_CASING; } @Override @@ -118,27 +118,35 @@ protected void addDisplayText(List textList) { // Machine mode text // Shared text components for both states - ITextComponent maxMachinesText = TextComponentUtil.stringWithColor(TextFormatting.DARK_PURPLE, Integer.toString(getMachineLimit())); - maxMachinesText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines_max", maxMachinesText); + ITextComponent maxMachinesText = TextComponentUtil.stringWithColor(TextFormatting.DARK_PURPLE, + Integer.toString(getMachineLimit())); + maxMachinesText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.machine.machine_hatch.machines_max", maxMachinesText); if (logic.activeRecipeMap == null) { // No machines in hatch - ITextComponent noneText = TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.machine.machine_hatch.machines_none"); - ITextComponent bodyText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines", noneText); - ITextComponent hoverText1 = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines_none_hover"); + ITextComponent noneText = TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.machine.machine_hatch.machines_none"); + ITextComponent bodyText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.machine.machine_hatch.machines", noneText); + ITextComponent hoverText1 = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.machine.machine_hatch.machines_none_hover"); tl.add(TextComponentUtil.setHover(bodyText, hoverText1, maxMachinesText)); } else { // Some amount of machines in hatch String key = logic.getMachineStack().getTranslationKey(); - ITextComponent mapText = TextComponentUtil.translationWithColor(TextFormatting.DARK_PURPLE, key + ".name"); + ITextComponent mapText = TextComponentUtil.translationWithColor(TextFormatting.DARK_PURPLE, + key + ".name"); mapText = TextComponentUtil.translationWithColor( TextFormatting.DARK_PURPLE, "%sx %s", logic.getParallelLimit(), mapText); - ITextComponent bodyText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines", mapText); + ITextComponent bodyText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.machine.machine_hatch.machines", mapText); ITextComponent voltageName = new TextComponentString(GTValues.VNF[logic.machineTier]); int amps = logic.getMachineStack().getCount(); - String energyFormatted = TextFormattingUtil.formatNumbers(GTValues.V[logic.machineTier] * amps); + String energyFormatted = TextFormattingUtil + .formatNumbers(GTValues.V[logic.machineTier] * amps); ITextComponent hoverText = TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines_max_eut", @@ -148,7 +156,8 @@ protected void addDisplayText(List textList) { // Hatch locked status if (isActive()) { - tl.add(TextComponentUtil.translationWithColor(TextFormatting.DARK_RED, "gregtech.machine.machine_hatch.locked")); + tl.add(TextComponentUtil.translationWithColor(TextFormatting.DARK_RED, + "gregtech.machine.machine_hatch.locked")); } } }) @@ -160,9 +169,7 @@ protected void addDisplayText(List textList) { @Nonnull @Override protected OrientedOverlayRenderer getFrontOverlay() { - return tier == 0 - ? Textures.PROCESSING_ARRAY_OVERLAY - : Textures.ADVANCED_PROCESSING_ARRAY_OVERLAY; + return tier == 0 ? Textures.PROCESSING_ARRAY_OVERLAY : Textures.ADVANCED_PROCESSING_ARRAY_OVERLAY; } @Override @@ -191,9 +198,12 @@ public SoundEvent getSound() { } @Override - public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, boolean checkMaintenance, boolean checkItemIn, boolean checkItemOut, boolean checkFluidIn, boolean checkFluidOut, boolean checkMuffler) { + public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, boolean checkMaintenance, boolean checkItemIn, + boolean checkItemOut, boolean checkFluidIn, boolean checkFluidOut, + boolean checkMuffler) { TraceabilityPredicate predicate = super.autoAbilities(checkMaintenance, checkMuffler) - .or(checkEnergyIn ? abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(4).setPreviewCount(1) : new TraceabilityPredicate()); + .or(checkEnergyIn ? abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1) + .setMaxGlobalLimited(4).setPreviewCount(1) : new TraceabilityPredicate()); predicate = predicate.or(abilities(MultiblockAbility.IMPORT_ITEMS).setPreviewCount(1)); @@ -217,7 +227,6 @@ public int getItemOutputLimit() { ItemStack machineStack = ((ProcessingArrayWorkable) this.recipeMapWorkable).getMachineStack(); MetaTileEntity mte = GTUtility.getMetaTileEntity(machineStack); return mte == null ? 0 : mte.getItemOutputLimit(); - } @SuppressWarnings("InnerClassMayBeStatic") @@ -227,11 +236,11 @@ protected class ProcessingArrayWorkable extends MultiblockRecipeLogic { ItemStack currentMachineStack = ItemStack.EMPTY; MetaTileEntity mte = null; - //The Voltage Tier of the machines the PA is operating upon, from GTValues.V + // The Voltage Tier of the machines the PA is operating upon, from GTValues.V private int machineTier; - //The maximum Voltage of the machines the PA is operating upon + // The maximum Voltage of the machines the PA is operating upon private long machineVoltage; - //The Recipe Map of the machines the PA is operating upon + // The Recipe Map of the machines the PA is operating upon private RecipeMap activeRecipeMap; public ProcessingArrayWorkable(RecipeMapMultiblockController tileEntity) { @@ -243,7 +252,7 @@ public void invalidate() { super.invalidate(); // invalidate mte's cleanroom reference - if (mte != null && mte instanceof ICleanroomReceiver){ + if (mte != null && mte instanceof ICleanroomReceiver) { ((ICleanroomReceiver) mte).setCleanroom(null); } @@ -265,11 +274,13 @@ public void invalidate() { */ @Override public boolean isRecipeMapValid(@Nonnull RecipeMap recipeMap) { - if (ArrayUtils.contains(((IMachineHatchMultiblock) metaTileEntity).getBlacklist(), recipeMap.getUnlocalizedName())) { + if (ArrayUtils.contains(((IMachineHatchMultiblock) metaTileEntity).getBlacklist(), + recipeMap.getUnlocalizedName())) { return false; } - return GTUtility.isMachineValidForMachineHatch(currentMachineStack, ((IMachineHatchMultiblock) metaTileEntity).getBlacklist()); + return GTUtility.isMachineValidForMachineHatch(currentMachineStack, + ((IMachineHatchMultiblock) metaTileEntity).getBlacklist()); } @Override @@ -300,10 +311,9 @@ public RecipeMap getRecipeMap() { public void findMachineStack() { RecipeMapMultiblockController controller = (RecipeMapMultiblockController) this.metaTileEntity; - //The Processing Array is limited to 1 Machine Interface per multiblock, and only has 1 slot + // The Processing Array is limited to 1 Machine Interface per multiblock, and only has 1 slot ItemStack machine = controller.getAbilities(MultiblockAbility.MACHINE_HATCH).get(0).getStackInSlot(0); - mte = GTUtility.getMetaTileEntity(machine); if (mte == null) { @@ -326,7 +336,7 @@ public void findMachineStack() { } } - //Find the voltage tier of the machine. + // Find the voltage tier of the machine. this.machineTier = mte instanceof ITieredMetaTileEntity ? ((ITieredMetaTileEntity) mte).getTier() : 0; this.machineVoltage = GTValues.V[this.machineTier]; @@ -351,7 +361,8 @@ protected int getOverclockForTier(long voltage) { @Override public int getParallelLimit() { - return (currentMachineStack == null || currentMachineStack.isEmpty()) ? getMachineLimit() : Math.min(currentMachineStack.getCount(), getMachineLimit()); + return (currentMachineStack == null || currentMachineStack.isEmpty()) ? getMachineLimit() : + Math.min(currentMachineStack.getCount(), getMachineLimit()); } @Override @@ -370,10 +381,12 @@ public long getMaxVoltage() { protected int getNumberOfOCs(int recipeEUt) { if (!isAllowOverclocking()) return 0; - int recipeTier = Math.max(0, GTUtility.getTierByVoltage(recipeEUt / Math.max(1, this.parallelRecipesPerformed))); + int recipeTier = Math.max(0, + GTUtility.getTierByVoltage(recipeEUt / Math.max(1, this.parallelRecipesPerformed))); int maximumTier = Math.min(this.machineTier, GTUtility.getTierByVoltage(getMaxVoltage())); - // The maximum number of overclocks is determined by the difference between the tier the recipe is running at, + // The maximum number of overclocks is determined by the difference between the tier the recipe is running + // at, // and the maximum tier that the machine can overclock to. int numberOfOCs = maximumTier - recipeTier; if (recipeTier == ULV) numberOfOCs--; // no ULV overclocking diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java index 6aa26293409..5528e207359 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java @@ -19,21 +19,22 @@ import gregtech.common.blocks.BlockMachineCasing.MachineCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntityPyrolyseOven extends RecipeMapMultiblockController { @@ -180,8 +181,7 @@ protected void modifyOverclockPost(int[] resultOverclock, @Nonnull IRecipeProper if (coilTier == 0) { resultOverclock[1] *= 5.0 / 4; // 25% slower with cupronickel (coilTier = 0) - } - else resultOverclock[1] *= 2.0f / (coilTier + 1); // each coil above kanthal (coilTier = 1) is 50% faster + } else resultOverclock[1] *= 2.0f / (coilTier + 1); // each coil above kanthal (coilTier = 1) is 50% faster resultOverclock[1] = Math.max(1, resultOverclock[1]); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java index e7c20439a0c..17fafd955ae 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java @@ -26,6 +26,7 @@ import gregtech.common.blocks.BlockComputerCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; @@ -37,13 +38,15 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -public class MetaTileEntityResearchStation extends RecipeMapMultiblockController implements IOpticalComputationReceiver { +public class MetaTileEntityResearchStation extends RecipeMapMultiblockController + implements IOpticalComputationReceiver { private IOpticalComputationProvider computationProvider; private IObjectHolder objectHolder; @@ -156,7 +159,10 @@ public List getMatchingShapes() { .where('P', getCasingState()) .where('O', MetaTileEntities.COMPUTATION_HATCH_RECEIVER, EnumFacing.NORTH) .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[GTValues.LuV], EnumFacing.NORTH) - .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : getCasingState(), EnumFacing.NORTH) + .where('M', + () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + getCasingState(), + EnumFacing.NORTH) .where('H', MetaTileEntities.OBJECT_HOLDER, EnumFacing.NORTH) .build()); } @@ -205,7 +211,8 @@ public boolean canVoidRecipeItemOutputs() { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.research_station.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.research_station.tooltip.2")); @@ -255,9 +262,10 @@ public boolean isAllowOverclocking() { } @Override - protected boolean setupAndConsumeRecipeInputs(@NotNull Recipe recipe, @NotNull IItemHandlerModifiable importInventory) { + protected boolean setupAndConsumeRecipeInputs(@NotNull Recipe recipe, + @NotNull IItemHandlerModifiable importInventory) { // this machine cannot overclock, so don't bother calling it - this.overclockResults = new int[]{recipe.getEUt(), recipe.getDuration()}; + this.overclockResults = new int[] { recipe.getEUt(), recipe.getDuration() }; if (!hasEnoughPower(overclockResults)) { return false; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityVacuumFreezer.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityVacuumFreezer.java index aa374cb8c68..d2d7af8a7b9 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityVacuumFreezer.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityVacuumFreezer.java @@ -12,6 +12,7 @@ import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; @@ -21,6 +22,7 @@ import javax.annotation.Nonnull; public class MetaTileEntityVacuumFreezer extends RecipeMapMultiblockController { + public MetaTileEntityVacuumFreezer(ResourceLocation metaTileEntityId) { super(metaTileEntityId, RecipeMaps.VACUUM_RECIPES); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java index 94334c5e427..5146f61dcc3 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.electric.centralmonitor; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IEnergyContainer; @@ -37,6 +34,7 @@ import gregtech.common.pipelike.cable.net.EnergyNet; import gregtech.common.pipelike.cable.net.WorldENet; import gregtech.common.pipelike.cable.tile.TileEntityCable; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -58,15 +56,21 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.lwjgl.opengl.GL11; -import javax.annotation.Nullable; import java.lang.ref.WeakReference; import java.util.*; +import javax.annotation.Nullable; + import static gregtech.api.util.RelativeDirection.*; public class MetaTileEntityCentralMonitor extends MultiblockWithDisplayBase implements IFastRenderMetaTileEntity { + private final static long ENERGY_COST = -ConfigHolder.machines.centralMonitorEuCost; public final static int MAX_HEIGHT = 9; public final static int MAX_WIDTH = 14; @@ -95,10 +99,12 @@ private EnergyNet getEnergyNet() { if (te instanceof TileEntityCable) { TileEntityPipeBase tileEntityCable = (TileEntityCable) te; EnergyNet currentEnergyNet = this.currentEnergyNet.get(); - if (currentEnergyNet != null && currentEnergyNet.isValid() && currentEnergyNet.containsNode(tileEntityCable.getPipePos())) { - return currentEnergyNet; //return current net if it is still valid + if (currentEnergyNet != null && currentEnergyNet.isValid() && + currentEnergyNet.containsNode(tileEntityCable.getPipePos())) { + return currentEnergyNet; // return current net if it is still valid } - WorldENet worldENet = (WorldENet) tileEntityCable.getPipeBlock().getWorldPipeNet(tileEntityCable.getPipeWorld()); + WorldENet worldENet = (WorldENet) tileEntityCable.getPipeBlock() + .getWorldPipeNet(tileEntityCable.getPipeWorld()); currentEnergyNet = worldENet.getNetFromPos(tileEntityCable.getPipePos()); if (currentEnergyNet != null) { this.currentEnergyNet = new WeakReference<>(currentEnergyNet); @@ -184,25 +190,24 @@ private boolean checkCovers() { } private void writeCovers(PacketBuffer buf) { - if(netCovers == null) { + if (netCovers == null) { buf.writeInt(0); } else { buf.writeInt(netCovers.size()); - for (FacingPos cover : netCovers){ + for (FacingPos cover : netCovers) { buf.writeBlockPos(cover.getPos()); buf.writeByte(cover.getFacing().getIndex()); } } - if(remoteCovers == null) { + if (remoteCovers == null) { buf.writeInt(0); } else { buf.writeInt(remoteCovers.size()); - for (FacingPos cover : remoteCovers){ + for (FacingPos cover : remoteCovers) { buf.writeBlockPos(cover.getPos()); buf.writeByte(cover.getFacing().getIndex()); } } - } private void readCovers(PacketBuffer buf) { @@ -219,8 +224,9 @@ private void readCovers(PacketBuffer buf) { } private void writeParts(PacketBuffer buf) { - buf.writeInt((int) this.getMultiblockParts().stream().filter(MetaTileEntityMonitorScreen.class::isInstance).count()); - this.getMultiblockParts().forEach(part->{ + buf.writeInt( + (int) this.getMultiblockParts().stream().filter(MetaTileEntityMonitorScreen.class::isInstance).count()); + this.getMultiblockParts().forEach(part -> { if (part instanceof MetaTileEntityMonitorScreen) { buf.writeBlockPos(((MetaTileEntityMonitorScreen) part).getPos()); } @@ -237,15 +243,15 @@ private void readParts(PacketBuffer buf) { } public void setHeight(int height) { - if(this.height == height || height < 2 || height > MAX_HEIGHT) return; + if (this.height == height || height < 2 || height > MAX_HEIGHT) return; this.height = height; reinitializeStructurePattern(); checkStructurePattern(); - writeCustomData(GregtechDataCodes.UPDATE_HEIGHT, buf-> buf.writeInt(height)); + writeCustomData(GregtechDataCodes.UPDATE_HEIGHT, buf -> buf.writeInt(height)); } private void setActive(boolean isActive) { - if(isActive == this.isActive) return; + if (isActive == this.isActive) return; this.isActive = isActive; writeCustomData(GregtechDataCodes.UPDATE_ACTIVE, buf -> buf.writeBoolean(this.isActive)); } @@ -258,7 +264,7 @@ private void clearScreens() { if (screens != null) { for (MetaTileEntityMonitorScreen[] screen : screens) { for (MetaTileEntityMonitorScreen s : screen) { - if(s != null) s.removeFromMultiBlock(this); + if (s != null) s.removeFromMultiBlock(this); } } } @@ -277,7 +283,8 @@ protected void addDisplayText(List textList) { super.addDisplayText(textList); textList.add(new TextComponentTranslation("gregtech.multiblock.central_monitor.height", this.height)); if (!isStructureFormed()) { - ITextComponent buttonText = new TextComponentTranslation("gregtech.multiblock.central_monitor.height_modify", height); + ITextComponent buttonText = new TextComponentTranslation( + "gregtech.multiblock.central_monitor.height_modify", height); buttonText.appendText(" "); buttonText.appendSibling(AdvancedTextWidget.withButton(new TextComponentString("[-]"), "sub")); buttonText.appendText(" "); @@ -363,8 +370,9 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity metaTileEntityHol @Override protected void updateFormedValid() { - if (this.getOffsetTimer() % 20 ==0) { - setActive(inputEnergy.changeEnergy(ENERGY_COST * this.getMultiblockParts().size()) == ENERGY_COST * this.getMultiblockParts().size()); + if (this.getOffsetTimer() % 20 == 0) { + setActive(inputEnergy.changeEnergy(ENERGY_COST * this.getMultiblockParts().size()) == + ENERGY_COST * this.getMultiblockParts().size()); if (checkCovers()) { this.getMultiblockParts().forEach(part -> { Set covers = getAllCovers(); @@ -404,14 +412,15 @@ protected BlockPattern createStructurePattern() { .aisle(end.toString()) .where('S', selfPredicate()) .where('A', states(MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.STEEL_SOLID)) - .or(abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(3).setPreviewCount(1))) + .or(abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(3) + .setPreviewCount(1))) .where('B', metaTileEntities(MetaTileEntities.MONITOR_SCREEN)) .build(); } @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.central_monitor.tooltip.1")}; + return new String[] { I18n.format("gregtech.multiblock.central_monitor.tooltip.1") }; } @Override @@ -448,7 +457,7 @@ protected void formStructure(PatternMatchContext context) { @Override public T getCapability(Capability capability, EnumFacing side) { - if(side == this.frontFacing.getOpposite() && capability == GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER) { + if (side == this.frontFacing.getOpposite() && capability == GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER) { return GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER.cast(IEnergyContainer.DEFAULT); } return null; @@ -478,13 +487,13 @@ public boolean isGlobalRenderer() { @SideOnly(Side.CLIENT) public void renderMetaTileEntity(double x, double y, double z, float partialTicks) { if (!this.isStructureFormed()) return; - RenderUtil.useStencil(()->{ + RenderUtil.useStencil(() -> { GlStateManager.pushMatrix(); RenderUtil.moveToFace(x, y, z, this.frontFacing); RenderUtil.rotateToFace(this.frontFacing, this.upwardsFacing); RenderUtil.renderRect(0.5f, -0.5f - (height - 2), width, height, 0.001f, 0xFF000000); GlStateManager.popMatrix(); - }, ()->{ + }, () -> { if (isActive) { GlStateManager.pushMatrix(); /* hack the lightmap */ @@ -494,7 +503,8 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick float lastBrightnessY = OpenGlHelper.lastBrightnessY; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); EntityPlayer player = Minecraft.getMinecraft().player; - RayTraceResult rayTraceResult = player == null ? null : player.rayTrace(Minecraft.getMinecraft().playerController.getBlockReachDistance(), partialTicks); + RayTraceResult rayTraceResult = player == null ? null : player + .rayTrace(Minecraft.getMinecraft().playerController.getBlockReachDistance(), partialTicks); int size = 0; for (int w = 0; w < width; w++) { for (int h = 0; h < height; h++) { @@ -505,7 +515,8 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick BlockPos pos = screen.getPos(); BlockPos pos2 = this.getPos(); GlStateManager.pushMatrix(); - RenderUtil.moveToFace(x + pos.getX() - pos2.getX(), y + pos.getY() - pos2.getY(), z + pos.getZ() - pos2.getZ(), this.frontFacing); + RenderUtil.moveToFace(x + pos.getX() - pos2.getX(), y + pos.getY() - pos2.getY(), + z + pos.getZ() - pos2.getZ(), this.frontFacing); RenderUtil.rotateToFace(this.frontFacing, this.upwardsFacing); screen.renderScreen(partialTicks, rayTraceResult); GlStateManager.popMatrix(); @@ -518,8 +529,10 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick clearScreens(); for (BlockPos pos : parts) { TileEntity tileEntity = getWorld().getTileEntity(pos); - if(tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { - MetaTileEntityMonitorScreen screen = (MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity) + .getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { + MetaTileEntityMonitorScreen screen = (MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity) + .getMetaTileEntity(); screen.addToMultiBlock(this); int sx = screen.getX(), sy = screen.getY(); if (sx < 0 || sx >= width || sy < 0 || sy >= height) { @@ -532,7 +545,7 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick } } - /* restore the lightmap */ + /* restore the lightmap */ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting(); GL11.glPopAttrib(); @@ -551,7 +564,7 @@ public AxisAlignedBB getRenderBoundingBox() { } else { if (spin == EnumFacing.NORTH) { sp = this.getPos().offset(EnumFacing.DOWN, 2); - ep = sp.offset(EnumFacing.UP, height + 1).offset(this.frontFacing.rotateY(), - width - 2); + ep = sp.offset(EnumFacing.UP, height + 1).offset(this.frontFacing.rotateY(), -width - 2); } else if (spin == EnumFacing.SOUTH) { sp = this.getPos().offset(EnumFacing.UP, 2); ep = sp.offset(EnumFacing.DOWN, height + 1).offset(this.frontFacing.rotateY(), width + 2); @@ -586,7 +599,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { } } if (!this.getWorld().isRemote) { - this.getMultiblockParts().forEach(part->{ + this.getMultiblockParts().forEach(part -> { if (part instanceof MetaTileEntityMonitorScreen) { int x = ((MetaTileEntityMonitorScreen) part).getX(); int y = ((MetaTileEntityMonitorScreen) part).getY(); @@ -594,10 +607,12 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { } }); } else { - parts.forEach(partPos->{ + parts.forEach(partPos -> { TileEntity tileEntity = this.getWorld().getTileEntity(partPos); - if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { - MetaTileEntityMonitorScreen part = (MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity) + .getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { + MetaTileEntityMonitorScreen part = (MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity) + .getMetaTileEntity(); int x = part.getX(); int y = part.getY(); screenGrids[x][y].setScreen(part); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityMonitorScreen.java b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityMonitorScreen.java index 9bba55693a3..bd18ff1df86 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityMonitorScreen.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityMonitorScreen.java @@ -1,6 +1,5 @@ package gregtech.common.metatileentities.multi.electric.centralmonitor; -import codechicken.lib.raytracer.CuboidRayTraceResult; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.cover.Cover; import gregtech.api.cover.CoverHolder; @@ -27,6 +26,7 @@ import gregtech.common.gui.widget.monitor.WidgetPluginConfig; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; @@ -53,14 +53,17 @@ import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.IOException; import java.util.*; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityMonitorScreen extends MetaTileEntityMultiblockPart { // run-time data @@ -84,7 +87,8 @@ public void setMode(FacingPos cover, CoverDigitalInterface.MODE mode) { CoverDigitalInterface last_cover = this.getCoverFromPosSide(coverPos); CoverDigitalInterface now_cover = this.getCoverFromPosSide(cover); if (this.mode == mode) { - if (Objects.equals(cover, coverPos) && last_cover == null && cover == null || last_cover != null && last_cover == now_cover) { + if (Objects.equals(cover, coverPos) && last_cover == null && cover == null || + last_cover != null && last_cover == now_cover) { return; } } @@ -110,7 +114,8 @@ public void setMode(CoverDigitalInterface.MODE mode) { } public void setConfig(int slot, float scale, int color) { - if ((this.scale == scale || scale < 1 || scale > 8) && (this.slot == slot || slot < 0) && this.frameColor == color) + if ((this.scale == scale || scale < 1 || scale > 8) && (this.slot == slot || slot < 0) && + this.frameColor == color) return; this.slot = slot; this.scale = scale; @@ -125,7 +130,7 @@ public CoverDigitalInterface getCoverFromPosSide(FacingPos posFacing) { IGregTechTileEntity holder = getHolderFromPos(posFacing.getPos()); if (holder == null) { TileEntity te = this.getWorld() == null ? null : this.getWorld().getTileEntity(posFacing.getPos()); - if (te instanceof IPipeTile pipeTile) { + if (te instanceof IPipeTilepipeTile) { coverHolder = pipeTile.getCoverableImplementation(); } } else { @@ -211,12 +216,12 @@ public int getX() { public int getY() { if (this.getController() != null) { - return ((MetaTileEntityCentralMonitor) this.getController()).height - (this.getPos().getY() + 1 - this.getController().getPos().getY()) - 1; + return ((MetaTileEntityCentralMonitor) this.getController()).height - + (this.getPos().getY() + 1 - this.getController().getPos().getY()) - 1; } return -1; } - public boolean isActive() { if (this.coverPos != null && this.mode != CoverDigitalInterface.MODE.PROXY) { CoverDigitalInterface cover = coverTMP != null ? coverTMP : this.getCoverFromPosSide(this.coverPos); @@ -238,7 +243,7 @@ public void pluginDirty() { } private void loadPlugin(MonitorPluginBaseBehavior plugin) { - if (plugin !=null && this.plugin != plugin) { + if (plugin != null && this.plugin != plugin) { this.plugin = plugin.createPlugin(); this.plugin.readFromNBT(this.itemInventory.getStackInSlot(0).getOrCreateSubCompound("monitor_plugin")); this.plugin.onMonitorValid(this, true); @@ -274,7 +279,8 @@ public void renderScreen(float partialTicks, RayTraceResult rayTraceResult) { if (coverTMP != null) { boolean flag = true; - if (checkLookingAt(rayTraceResult) != null && plugin == null && this.mode != CoverDigitalInterface.MODE.PROXY) { + if (checkLookingAt(rayTraceResult) != null && plugin == null && + this.mode != CoverDigitalInterface.MODE.PROXY) { if (coverTMP.renderSneakingLookAt(rayTraceResult.getBlockPos(), side, slot, partialTicks)) { flag = false; } @@ -290,7 +296,9 @@ public void renderScreen(float partialTicks, RayTraceResult rayTraceResult) { itemStack = ((IGregTechTileEntity) te).getMetaTileEntity().getStackForm(); } else { BlockPos pos = te.getPos(); - itemStack = te.getBlockType().getPickBlock(te.getWorld().getBlockState(pos), new RayTraceResult(new Vec3d(0.5, 0.5, 0.5), coverTMP.getCoveredFacing(), pos), te.getWorld(), pos, Minecraft.getMinecraft().player); + itemStack = te.getBlockType().getPickBlock(te.getWorld().getBlockState(pos), + new RayTraceResult(new Vec3d(0.5, 0.5, 0.5), coverTMP.getCoveredFacing(), pos), + te.getWorld(), pos, Minecraft.getMinecraft().player); } String name = itemStack.getDisplayName(); // render machine @@ -347,7 +355,7 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { super.receiveCustomData(dataId, buf); if (dataId == GregtechDataCodes.UPDATE_ALL) { readSync(buf); - } else if (dataId == GregtechDataCodes.UPDATE_PLUGIN_DATA) { //plugin + } else if (dataId == GregtechDataCodes.UPDATE_PLUGIN_DATA) { // plugin if (plugin != null) { plugin.readPluginData(buf.readVarInt(), buf); } @@ -408,6 +416,7 @@ public void readFromNBT(NBTTagCompound data) { protected void initializeInventory() { super.initializeInventory(); this.inventory = new GTItemStackHandler(this) { + @Override public int getSlotLimit(int slot) { return 1; @@ -455,7 +464,8 @@ public void onRemoval() { @Override public T getCapability(Capability capability, EnumFacing side) { - if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || + capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { Cover cover = getCoverFromPosSide(this.coverPos); if (cover != null) { return cover.getCoverableView().getCapability(capability, cover.getAttachedSide()); @@ -476,37 +486,52 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { int width = 330; int height = 260; ToggleButtonWidget[] buttons = new ToggleButtonWidget[5]; - buttons[0] = new ToggleButtonWidget(width - 135, 25, 20, 20, GuiTextures.BUTTON_FLUID, () -> this.mode == CoverDigitalInterface.MODE.FLUID, (isPressed) -> { - if (isPressed) setMode(CoverDigitalInterface.MODE.FLUID); - }).setTooltipText("metaitem.cover.digital.mode.fluid"); - buttons[1] = new ToggleButtonWidget(width - 115, 25, 20, 20, GuiTextures.BUTTON_ITEM, () -> this.mode == CoverDigitalInterface.MODE.ITEM, (isPressed) -> { - if (isPressed) setMode(CoverDigitalInterface.MODE.ITEM); - }).setTooltipText("metaitem.cover.digital.mode.item"); - buttons[2] = new ToggleButtonWidget(width - 95, 25, 20, 20, GuiTextures.BUTTON_ENERGY, () -> this.mode == CoverDigitalInterface.MODE.ENERGY, (isPressed) -> { - if (isPressed) setMode(CoverDigitalInterface.MODE.ENERGY); - }).setTooltipText("metaitem.cover.digital.mode.energy"); - buttons[3] = new ToggleButtonWidget(width - 75, 25, 20, 20, GuiTextures.BUTTON_MACHINE, () -> this.mode == CoverDigitalInterface.MODE.MACHINE, (isPressed) -> { - if (isPressed) setMode(CoverDigitalInterface.MODE.MACHINE); - }).setTooltipText("metaitem.cover.digital.mode.machine"); - buttons[4] = new ToggleButtonWidget(width - 35, 25, 20, 20, GuiTextures.BUTTON_INTERFACE, () -> this.mode == CoverDigitalInterface.MODE.PROXY, (isPressed) -> { - if (isPressed) setMode(CoverDigitalInterface.MODE.PROXY); - }).setTooltipText("metaitem.cover.digital.mode.proxy"); + buttons[0] = new ToggleButtonWidget(width - 135, 25, 20, 20, GuiTextures.BUTTON_FLUID, + () -> this.mode == CoverDigitalInterface.MODE.FLUID, (isPressed) -> { + if (isPressed) setMode(CoverDigitalInterface.MODE.FLUID); + }).setTooltipText("metaitem.cover.digital.mode.fluid"); + buttons[1] = new ToggleButtonWidget(width - 115, 25, 20, 20, GuiTextures.BUTTON_ITEM, + () -> this.mode == CoverDigitalInterface.MODE.ITEM, (isPressed) -> { + if (isPressed) setMode(CoverDigitalInterface.MODE.ITEM); + }).setTooltipText("metaitem.cover.digital.mode.item"); + buttons[2] = new ToggleButtonWidget(width - 95, 25, 20, 20, GuiTextures.BUTTON_ENERGY, + () -> this.mode == CoverDigitalInterface.MODE.ENERGY, (isPressed) -> { + if (isPressed) setMode(CoverDigitalInterface.MODE.ENERGY); + }).setTooltipText("metaitem.cover.digital.mode.energy"); + buttons[3] = new ToggleButtonWidget(width - 75, 25, 20, 20, GuiTextures.BUTTON_MACHINE, + () -> this.mode == CoverDigitalInterface.MODE.MACHINE, (isPressed) -> { + if (isPressed) setMode(CoverDigitalInterface.MODE.MACHINE); + }).setTooltipText("metaitem.cover.digital.mode.machine"); + buttons[4] = new ToggleButtonWidget(width - 35, 25, 20, 20, GuiTextures.BUTTON_INTERFACE, + () -> this.mode == CoverDigitalInterface.MODE.PROXY, (isPressed) -> { + if (isPressed) setMode(CoverDigitalInterface.MODE.PROXY); + }).setTooltipText("metaitem.cover.digital.mode.proxy"); List covers = new ArrayList<>(); - ((MetaTileEntityCentralMonitor) controller).getAllCovers().forEach(coverPos -> covers.add(getCoverFromPosSide(coverPos))); + ((MetaTileEntityCentralMonitor) controller).getAllCovers() + .forEach(coverPos -> covers.add(getCoverFromPosSide(coverPos))); WidgetPluginConfig pluginWidget = new WidgetPluginConfig(); WidgetPluginConfig mainGroup = new WidgetPluginConfig().setSize(width, height); mainGroup.widget(new LabelWidget(15, 55, "monitor.gui.title.scale", 0xFFFFFFFF)) - .widget(new ClickButtonWidget(50, 50, 20, 20, "-1", (data) -> setConfig(this.slot, ((float) Math.round((scale - (data.isShiftClick ? 1.0f : 0.1f)) * 10) / 10), this.frameColor))) - .widget(new ClickButtonWidget(130, 50, 20, 20, "+1", (data) -> setConfig(this.slot, ((float) Math.round((scale + (data.isShiftClick ? 1.0f : 0.1f)) * 10) / 10), this.frameColor))) + .widget(new ClickButtonWidget(50, 50, 20, 20, "-1", + (data) -> setConfig(this.slot, + ((float) Math.round((scale - (data.isShiftClick ? 1.0f : 0.1f)) * 10) / 10), + this.frameColor))) + .widget(new ClickButtonWidget(130, 50, 20, 20, "+1", + (data) -> setConfig(this.slot, + ((float) Math.round((scale + (data.isShiftClick ? 1.0f : 0.1f)) * 10) / 10), + this.frameColor))) .widget(new ImageWidget(70, 50, 60, 20, GuiTextures.DISPLAY)) .widget(new SimpleTextWidget(100, 60, "", 16777215, () -> Float.toString(scale))) .widget(new LabelWidget(15, 85, "monitor.gui.title.argb", 0xFFFFFFFF)) - .widget(new WidgetARGB(50, 80, 20, this.frameColor, (color) -> setConfig(this.slot, this.scale, color))) + .widget(new WidgetARGB(50, 80, 20, this.frameColor, + (color) -> setConfig(this.slot, this.scale, color))) .widget(new LabelWidget(15, 110, "monitor.gui.title.slot", 0xFFFFFFFF)) - .widget(new ClickButtonWidget(50, 105, 20, 20, "-1", (data) -> setConfig(this.slot - 1, this.scale, this.frameColor))) - .widget(new ClickButtonWidget(130, 105, 20, 20, "+1", (data) -> setConfig(this.slot + 1, this.scale, this.frameColor))) + .widget(new ClickButtonWidget(50, 105, 20, 20, "-1", + (data) -> setConfig(this.slot - 1, this.scale, this.frameColor))) + .widget(new ClickButtonWidget(130, 105, 20, 20, "+1", + (data) -> setConfig(this.slot + 1, this.scale, this.frameColor))) .widget(new ImageWidget(70, 105, 60, 20, GuiTextures.DISPLAY)) .widget(new SimpleTextWidget(100, 115, "", 16777215, () -> Integer.toString(slot))) @@ -515,13 +540,15 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .setBackgroundTexture(GuiTextures.SLOT) .setChangeListener(() -> { if (this.getWorld() != null && !this.getWorld().isRemote) { - MonitorPluginBaseBehavior behavior = MonitorPluginBaseBehavior.getBehavior(inventory.getStackInSlot(0)); + MonitorPluginBaseBehavior behavior = MonitorPluginBaseBehavior + .getBehavior(inventory.getStackInSlot(0)); if (behavior == null) { unloadPlugin(); } else { loadPlugin(behavior); } - writeCustomData(GregtechDataCodes.UPDATE_PLUGIN_ITEM, packetBuffer -> packetBuffer.writeItemStack(inventory.getStackInSlot(0))); + writeCustomData(GregtechDataCodes.UPDATE_PLUGIN_ITEM, + packetBuffer -> packetBuffer.writeItemStack(inventory.getStackInSlot(0))); } })) .widget(new ClickButtonWidget(80, 130, 40, 20, "monitor.gui.title.config", (data) -> { @@ -530,6 +557,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { mainGroup.setVisible(false); } }) { + @Override protected void triggerButton() { super.triggerButton(); @@ -540,13 +568,14 @@ protected void triggerButton() { } }) - .widget(new WidgetCoverList(width - 140, 50, 120, 11, covers, getCoverFromPosSide(this.coverPos), (coverPos) -> { - if (coverPos == null) { - this.setMode(null, this.mode); - } else { - this.setMode(new FacingPos(coverPos.getPos(), coverPos.getAttachedSide())); - } - })) + .widget(new WidgetCoverList(width - 140, 50, 120, 11, covers, getCoverFromPosSide(this.coverPos), + (coverPos) -> { + if (coverPos == null) { + this.setMode(null, this.mode); + } else { + this.setMode(new FacingPos(coverPos.getPos(), coverPos.getAttachedSide())); + } + })) .widget(buttons[0]) .widget(buttons[1]) @@ -562,7 +591,8 @@ protected void triggerButton() { .widget(new LabelWidget(15, 13, "gregtech.machine.monitor_screen.name", 0XFFFFFFFF)) .widget(new ClickButtonWidget(15, 25, 40, 20, "monitor.gui.title.back", data -> { if (mainGroup.isVisible() && controller.isActive() && controller.isValid()) { - MetaTileEntityUIFactory.INSTANCE.openUI(controller.getHolder(), (EntityPlayerMP) entityPlayer); + MetaTileEntityUIFactory.INSTANCE.openUI(controller.getHolder(), + (EntityPlayerMP) entityPlayer); } else if (!mainGroup.isVisible()) { pluginWidget.removePluginWidget(); mainGroup.setVisible(true); @@ -571,6 +601,7 @@ protected void triggerButton() { } } }) { + @Override protected void triggerButton() { super.triggerButton(); @@ -593,8 +624,10 @@ protected void triggerButton() { return null; } - // adaptive click, supports scaling. x and y is the pos of the origin screen (scale = 1). this func must be called when screen is active. - public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, double y) { + // adaptive click, supports scaling. x and y is the pos of the origin screen (scale = 1). this func must be called + // when screen is active. + public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, + double y) { if (this.plugin != null) { boolean flag = this.plugin.onClickLogic(playerIn, hand, facing, isRight, x, y); if (flag) return true; @@ -618,7 +651,8 @@ public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing fac if (te != null) { BlockPos pos = te.getPos(); IBlockState state = te.getWorld().getBlockState(pos); - state.getBlock().onBlockActivated(cover.getWorld(), pos, state, playerIn, hand, cover.getCoveredFacing(), 0.5f, 0.5f, 0.5f); + state.getBlock().onBlockActivated(cover.getWorld(), pos, state, playerIn, hand, + cover.getCoveredFacing(), 0.5f, 0.5f, 0.5f); } return true; } else { @@ -636,15 +670,15 @@ public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing fac } private static double[] handleRayTraceResult(RayTraceResult rayTraceResult) { - double dX = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.X - ? rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() - : rayTraceResult.hitVec.x - rayTraceResult.getBlockPos().getX(); - double dY = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.Y - ? rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() - : rayTraceResult.hitVec.y - rayTraceResult.getBlockPos().getY(); + double dX = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.X ? + rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() : + rayTraceResult.hitVec.x - rayTraceResult.getBlockPos().getX(); + double dY = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.Y ? + rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() : + rayTraceResult.hitVec.y - rayTraceResult.getBlockPos().getY(); dX = 1 - dX; dY = 1 - dY; - if(rayTraceResult.sideHit.getYOffset() < 0) { + if (rayTraceResult.sideHit.getYOffset() < 0) { dY = 1 - dY; } if (rayTraceResult.sideHit == EnumFacing.WEST || rayTraceResult.sideHit == EnumFacing.SOUTH) { @@ -653,12 +687,14 @@ private static double[] handleRayTraceResult(RayTraceResult rayTraceResult) { dX = 1 - dX; dY = 1 - dY; } - return new double[]{dX, dY}; + return new double[] { dX, dY }; } - private boolean handleHitResultWithScale(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, CuboidRayTraceResult rayTraceResult) { + private boolean handleHitResultWithScale(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, + CuboidRayTraceResult rayTraceResult) { boolean flag = false; - if (rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && this.getController() != null) { + if (rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && + this.getController() != null) { double[] pos = handleRayTraceResult(rayTraceResult); MetaTileEntityMonitorScreen[][] screens = ((MetaTileEntityCentralMonitor) this.getController()).screens; int mX = this.getX(), mY = this.getY(); @@ -684,20 +720,25 @@ private boolean handleHitResultWithScale(EntityPlayer playerIn, EnumHand hand, E public double[] checkLookingAt(RayTraceResult rayTraceResult) { if (this.getWorld() != null) { MultiblockControllerBase controller = this.getController(); - if (rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && controller != null && rayTraceResult.sideHit == controller.getFrontFacing()) { + if (rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && controller != null && + rayTraceResult.sideHit == controller.getFrontFacing()) { int i, j; TileEntity tileEntity = this.getWorld().getTileEntity(rayTraceResult.getBlockPos()); - if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { - MetaTileEntityMonitorScreen screenHit = (MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (tileEntity instanceof IGregTechTileEntity && + ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { + MetaTileEntityMonitorScreen screenHit = (MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity) + .getMetaTileEntity(); if (controller == screenHit.getController()) { - i = ((MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()).getX() - this.getX(); - j = ((MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()).getY() - this.getY(); + i = ((MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()) + .getX() - this.getX(); + j = ((MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()) + .getY() - this.getY(); double[] pos = handleRayTraceResult(rayTraceResult); if ((i >= 0 && j >= 0)) { pos[0] = (pos[0] + i) / this.scale; pos[1] = (pos[1] + j) / this.scale; if (pos[0] >= 0 && pos[0] <= 1 && pos[1] >= 0 && pos[1] <= 1) - return new double[]{pos[0], pos[1]}; + return new double[] { pos[0], pos[1] }; } } } @@ -707,9 +748,10 @@ public double[] checkLookingAt(RayTraceResult rayTraceResult) { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { - if (!(!playerIn.isSneaking() && ToolHelper.isTool(playerIn.getHeldItem(hand), ToolClasses.SCREWDRIVER)) - && !MetaTileEntities.MONITOR_SCREEN.getStackForm().isItemEqual(playerIn.getHeldItem(hand))) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { + if (!(!playerIn.isSneaking() && ToolHelper.isTool(playerIn.getHeldItem(hand), ToolClasses.SCREWDRIVER)) && + !MetaTileEntities.MONITOR_SCREEN.getStackForm().isItemEqual(playerIn.getHeldItem(hand))) { if (playerIn.world.getTotalWorldTime() - lastClickTime < 2 && playerIn.getPersistentID().equals(lastClickUUID)) { return true; @@ -727,7 +769,8 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking() && this.getWorld() != null && !this.getWorld().isRemote) { MetaTileEntityUIFactory.INSTANCE.openUI(this.getHolder(), (EntityPlayerMP) playerIn); return true; @@ -738,7 +781,8 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci @Override public void onLeftClick(EntityPlayer playerIn, EnumFacing facing, CuboidRayTraceResult hitResult) { - if (playerIn.world.getTotalWorldTime() - lastClickTime < 2 && playerIn.getPersistentID().equals(lastClickUUID)) { + if (playerIn.world.getTotalWorldTime() - lastClickTime < 2 && + playerIn.getPersistentID().equals(lastClickUUID)) { return; } lastClickTime = playerIn.world.getTotalWorldTime(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java index b095670187e..98344cce952 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java @@ -8,9 +8,9 @@ import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeBuilder; + import net.minecraft.util.math.MathHelper; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.IFluidHandler; @@ -32,7 +32,7 @@ protected void updateRecipeProgress() { if (canRecipeProgress) { // turbines can void energy drawEnergy(recipeEUt, false); - //as recipe starts with progress on 1 this has to be > only not => to compensate for it + // as recipe starts with progress on 1 this has to be > only not => to compensate for it if (++progressTime > maxProgressTime) { completeRecipe(); } @@ -44,7 +44,9 @@ public FluidStack getInputFluidStack() { if (previousRecipe == null) { Recipe recipe = findRecipe(Integer.MAX_VALUE, getInputInventory(), getInputTank()); - return recipe == null ? null : getInputTank().drain(new FluidStack(recipe.getFluidInputs().get(0).getInputFluidStack().getFluid(), Integer.MAX_VALUE), false); + return recipe == null ? null : getInputTank().drain( + new FluidStack(recipe.getFluidInputs().get(0).getInputFluidStack().getFluid(), Integer.MAX_VALUE), + false); } FluidStack fuelStack = previousRecipe.getFluidInputs().get(0).getInputFluidStack(); return getInputTank().drain(new FluidStack(fuelStack.getFluid(), Integer.MAX_VALUE), false); @@ -85,9 +87,9 @@ protected boolean prepareRecipe(Recipe recipe) { excessVoltage -= turbineMaxVoltage; } else { double holderEfficiency = rotorHolder.getTotalEfficiency() / 100.0; - //get the amount of parallel required to match the desired output voltage + // get the amount of parallel required to match the desired output voltage parallel = MathHelper.ceil((turbineMaxVoltage - excessVoltage) / - (Math.abs(recipe.getEUt()) * holderEfficiency)); + (Math.abs(recipe.getEUt()) * holderEfficiency)); // Null check fluid here, since it can return null on first join into world or first form FluidStack inputFluid = getInputFluidStack(); @@ -95,11 +97,11 @@ protected boolean prepareRecipe(Recipe recipe) { return false; } - //this is necessary to prevent over-consumption of fuel + // this is necessary to prevent over-consumption of fuel excessVoltage += (int) (parallel * Math.abs(recipe.getEUt()) * holderEfficiency - turbineMaxVoltage); } - //rebuild the recipe and adjust voltage to match the turbine + // rebuild the recipe and adjust voltage to match the turbine RecipeBuilder recipeBuilder = getRecipeMap().recipeBuilder(); recipeBuilder.append(recipe, parallel, false) .EUt(-turbineMaxVoltage); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java index 7499bbf37f4..a5a2a51ae86 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java @@ -24,6 +24,7 @@ import gregtech.common.blocks.BlockMultiblockCasing.MultiblockCasingType; import gregtech.common.blocks.BlockTurbineCasing.TurbineCasingType; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -37,9 +38,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntityLargeCombustionEngine extends FuelMultiblockController implements IProgressBarMultiblock { @@ -76,9 +78,8 @@ protected void addDisplayText(List textList) { builder.addFuelNeededLine(recipeLogic.getRecipeFluidInputInfo(), recipeLogic.getPreviousRecipeDuration()) .addCustom(tl -> { if (isStructureFormed() && recipeLogic.isOxygenBoosted) { - String key = isExtreme - ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_boosted" - : "gregtech.multiblock.large_combustion_engine.oxygen_boosted"; + String key = isExtreme ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_boosted" : + "gregtech.multiblock.large_combustion_engine.oxygen_boosted"; tl.add(TextComponentUtil.translationWithColor(TextFormatting.AQUA, key)); } }) @@ -90,13 +91,17 @@ protected void addErrorText(List textList) { super.addErrorText(textList); if (isStructureFormed()) { if (checkIntakesObstructed()) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.large_combustion_engine.obstructed")); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.large_combustion_engine.obstructed.desc")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.large_combustion_engine.obstructed")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.large_combustion_engine.obstructed.desc")); } - FluidStack lubricantStack = getInputFluidInventory().drain(Materials.Lubricant.getFluid(Integer.MAX_VALUE), false); + FluidStack lubricantStack = getInputFluidInventory().drain(Materials.Lubricant.getFluid(Integer.MAX_VALUE), + false); if (lubricantStack == null || lubricantStack.amount == 0) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.large_combustion_engine.no_lubricant")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.large_combustion_engine.no_lubricant")); } } } @@ -107,9 +112,11 @@ public void addInformation(ItemStack stack, @Nullable World player, List tooltip.add(I18n.format("gregtech.universal.tooltip.base_production_eut", GTValues.V[tier])); tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_hour_lubricant", 1000)); if (isExtreme) { - tooltip.add(I18n.format("gregtech.machine.large_combustion_engine.tooltip.boost_extreme", GTValues.V[tier] * 4)); + tooltip.add(I18n.format("gregtech.machine.large_combustion_engine.tooltip.boost_extreme", + GTValues.V[tier] * 4)); } else { - tooltip.add(I18n.format("gregtech.machine.large_combustion_engine.tooltip.boost_regular", GTValues.V[tier] * 3)); + tooltip.add(I18n.format("gregtech.machine.large_combustion_engine.tooltip.boost_regular", + GTValues.V[tier] * 3)); } } @@ -122,14 +129,18 @@ protected BlockPattern createStructurePattern() { .aisle("AAA", "AYA", "AAA") .where('X', states(getCasingState())) .where('G', states(getGearboxState())) - .where('C', states(getCasingState()).setMinGlobalLimited(3).or(autoAbilities(false, true, true, true, true, true, true))) + .where('C', + states(getCasingState()).setMinGlobalLimited(3) + .or(autoAbilities(false, true, true, true, true, true, true))) .where('D', metaTileEntities(MultiblockAbility.REGISTRY.get(MultiblockAbility.OUTPUT_ENERGY).stream() .filter(mte -> { - IEnergyContainer container = mte.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); - return container != null && container.getOutputVoltage() * container.getOutputAmperage() >= GTValues.V[tier]; + IEnergyContainer container = mte + .getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); + return container != null && + container.getOutputVoltage() * container.getOutputAmperage() >= GTValues.V[tier]; }) .toArray(MetaTileEntity[]::new)) - .addTooltip("gregtech.multiblock.pattern.error.limited.1", GTValues.VN[tier])) + .addTooltip("gregtech.multiblock.pattern.error.limited.1", GTValues.VN[tier])) .where('A', states(getIntakeState()).addTooltips("gregtech.multiblock.pattern.clear_amount_1")) .where('Y', selfPredicate()) .build(); @@ -186,7 +197,7 @@ private boolean checkIntakesObstructed() { BlockPos centerPos = this.getPos().offset(facing); for (int x = -1; x < 2; x++) { for (int y = -1; y < 2; y++) { - //Skip the controller block itself + // Skip the controller block itself if (x == 0 && y == 0) continue; BlockPos blockPos = centerPos.add(permuteXZ ? x : 0, y, permuteXZ ? 0 : x); @@ -228,16 +239,17 @@ public double getFillPercentage(int index) { } else if (index == 1) { int[] lubricantAmount = new int[2]; if (getInputFluidInventory() != null) { - lubricantAmount = getTotalFluidAmount(Materials.Lubricant.getFluid(Integer.MAX_VALUE), getInputFluidInventory()); + lubricantAmount = getTotalFluidAmount(Materials.Lubricant.getFluid(Integer.MAX_VALUE), + getInputFluidInventory()); } return lubricantAmount[1] != 0 ? 1.0 * lubricantAmount[0] / lubricantAmount[1] : 0; } else { int[] oxygenAmount = new int[2]; if (getInputFluidInventory() != null) { if (isBoostAllowed()) { - FluidStack oxygenStack = isExtreme - ? Materials.Oxygen.getFluid(FluidStorageKeys.LIQUID, Integer.MAX_VALUE) - : Materials.Oxygen.getFluid(Integer.MAX_VALUE); + FluidStack oxygenStack = isExtreme ? + Materials.Oxygen.getFluid(FluidStorageKeys.LIQUID, Integer.MAX_VALUE) : + Materials.Oxygen.getFluid(Integer.MAX_VALUE); oxygenAmount = getTotalFluidAmount(oxygenStack, getInputFluidInventory()); } } @@ -266,14 +278,16 @@ public void addBarHoverText(List hoverList, int index) { int lubricantCapacity = 0; if (isStructureFormed() && getInputFluidInventory() != null) { // Hunt for tanks with lubricant in them - int[] lubricantAmount = getTotalFluidAmount(Materials.Lubricant.getFluid(Integer.MAX_VALUE), getInputFluidInventory()); + int[] lubricantAmount = getTotalFluidAmount(Materials.Lubricant.getFluid(Integer.MAX_VALUE), + getInputFluidInventory()); lubricantStored = lubricantAmount[0]; lubricantCapacity = lubricantAmount[1]; } ITextComponent lubricantInfo = TextComponentUtil.stringWithColor( TextFormatting.GOLD, - TextFormattingUtil.formatNumbers(lubricantStored) + " / " + TextFormattingUtil.formatNumbers(lubricantCapacity) + " L"); + TextFormattingUtil.formatNumbers(lubricantStored) + " / " + + TextFormattingUtil.formatNumbers(lubricantCapacity) + " L"); hoverList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.large_combustion_engine.lubricant_amount", @@ -285,9 +299,9 @@ public void addBarHoverText(List hoverList, int index) { int oxygenCapacity = 0; if (isStructureFormed() && getInputFluidInventory() != null) { // Hunt for tanks with Oxygen or LOX (depending on tier) in them - FluidStack oxygenStack = isExtreme - ? Materials.Oxygen.getFluid(FluidStorageKeys.LIQUID, Integer.MAX_VALUE) - : Materials.Oxygen.getFluid(Integer.MAX_VALUE); + FluidStack oxygenStack = isExtreme ? + Materials.Oxygen.getFluid(FluidStorageKeys.LIQUID, Integer.MAX_VALUE) : + Materials.Oxygen.getFluid(Integer.MAX_VALUE); int[] oxygenAmount = getTotalFluidAmount(oxygenStack, getInputFluidInventory()); oxygenStored = oxygenAmount[0]; oxygenCapacity = oxygenAmount[1]; @@ -295,15 +309,14 @@ public void addBarHoverText(List hoverList, int index) { ITextComponent oxygenInfo = TextComponentUtil.stringWithColor( TextFormatting.AQUA, - TextFormattingUtil.formatNumbers(oxygenStored) + " / " + TextFormattingUtil.formatNumbers(oxygenCapacity) + " L"); - String key = isExtreme - ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_amount" - : "gregtech.multiblock.large_combustion_engine.oxygen_amount"; + TextFormattingUtil.formatNumbers(oxygenStored) + " / " + + TextFormattingUtil.formatNumbers(oxygenCapacity) + " L"); + String key = isExtreme ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_amount" : + "gregtech.multiblock.large_combustion_engine.oxygen_amount"; hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, key, oxygenInfo)); } else { - String key = isExtreme - ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_boost_disallowed" - : "gregtech.multiblock.large_combustion_engine.oxygen_boost_disallowed"; + String key = isExtreme ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_boost_disallowed" : + "gregtech.multiblock.large_combustion_engine.oxygen_boost_disallowed"; hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, key)); } } @@ -332,7 +345,7 @@ public LargeCombustionEngineWorkableHandler(RecipeMapMultiblockController tileEn protected void updateRecipeProgress() { if (canRecipeProgress && drawEnergy(recipeEUt, true)) { - //drain lubricant and invalidate if it fails + // drain lubricant and invalidate if it fails if (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 72 == 0) { IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); if (LUBRICANT_STACK.isFluidStackIdentical(inputTank.drain(LUBRICANT_STACK, false))) { @@ -343,8 +356,9 @@ protected void updateRecipeProgress() { } } - //drain oxygen if present to boost production, and if the dynamo hatch supports it - if (combustionEngine.isBoostAllowed() && (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 20 == 0)) { + // drain oxygen if present to boost production, and if the dynamo hatch supports it + if (combustionEngine.isBoostAllowed() && + (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 20 == 0)) { IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); FluidStack boosterStack = isExtreme ? LIQUID_OXYGEN_STACK : OXYGEN_STACK; if (boosterStack.isFluidStackIdentical(inputTank.drain(boosterStack, false))) { @@ -357,7 +371,7 @@ protected void updateRecipeProgress() { drawEnergy(recipeEUt, false); - //as recipe starts with progress on 1 this has to be > only not => to compensate for it + // as recipe starts with progress on 1 this has to be > only not => to compensate for it if (++progressTime > maxProgressTime) { completeRecipe(); } @@ -366,12 +380,14 @@ protected void updateRecipeProgress() { @Override protected boolean shouldSearchForRecipes() { - return super.shouldSearchForRecipes() && LUBRICANT_STACK.isFluidStackIdentical(((RecipeMapMultiblockController) metaTileEntity).getInputFluidInventory().drain(LUBRICANT_STACK, false)); + return super.shouldSearchForRecipes() && + LUBRICANT_STACK.isFluidStackIdentical(((RecipeMapMultiblockController) metaTileEntity) + .getInputFluidInventory().drain(LUBRICANT_STACK, false)); } @Override public long getMaxVoltage() { - //this multiplies consumption through parallel + // this multiplies consumption through parallel if (isOxygenBoosted) return GTValues.V[tier] * 2; else @@ -380,13 +396,13 @@ public long getMaxVoltage() { @Override protected long boostProduction(long production) { - //this multiplies production without increasing consumption + // this multiplies production without increasing consumption if (isOxygenBoosted) if (!isExtreme) - //recipe gives 2A EV and we want 3A EV, for 150% efficiency + // recipe gives 2A EV and we want 3A EV, for 150% efficiency return production * 3 / 2; else - //recipe gives 2A IV and we want 4A IV, for 200% efficiency + // recipe gives 2A IV and we want 4A IV, for 200% efficiency return production * 2; return production; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java index 8a3e139e26b..105a5c3db29 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java @@ -17,6 +17,7 @@ import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -29,11 +30,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityLargeTurbine extends FuelMultiblockController implements ITieredMetaTileEntity, IProgressBarMultiblock { +public class MetaTileEntityLargeTurbine extends FuelMultiblockController + implements ITieredMetaTileEntity, IProgressBarMultiblock { public final int tier; @@ -47,7 +50,9 @@ public class MetaTileEntityLargeTurbine extends FuelMultiblockController impleme public IFluidHandler exportFluidHandler; - public MetaTileEntityLargeTurbine(ResourceLocation metaTileEntityId, RecipeMap recipeMap, int tier, IBlockState casingState, IBlockState gearboxState, ICubeRenderer casingRenderer, boolean hasMufflerHatch, ICubeRenderer frontOverlay) { + public MetaTileEntityLargeTurbine(ResourceLocation metaTileEntityId, RecipeMap recipeMap, int tier, + IBlockState casingState, IBlockState gearboxState, ICubeRenderer casingRenderer, + boolean hasMufflerHatch, ICubeRenderer frontOverlay) { super(metaTileEntityId, recipeMap, tier); this.casingState = casingState; this.gearboxState = gearboxState; @@ -61,7 +66,8 @@ public MetaTileEntityLargeTurbine(ResourceLocation metaTileEntityId, RecipeMap textList) { IRotorHolder rotorHolder = getRotorHolder(); if (rotorHolder.getRotorEfficiency() > 0) { ITextComponent efficiencyInfo = TextComponentUtil.stringWithColor( - TextFormatting.AQUA, TextFormattingUtil.formatNumbers(rotorHolder.getTotalEfficiency()) + "%"); + TextFormatting.AQUA, + TextFormattingUtil.formatNumbers(rotorHolder.getTotalEfficiency()) + "%"); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.turbine.efficiency", @@ -155,13 +162,16 @@ protected void addErrorText(List textList) { super.addErrorText(textList); if (isStructureFormed()) { if (!isRotorFaceFree()) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.turbine.obstructed")); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.turbine.obstructed.desc")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.turbine.obstructed")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.turbine.obstructed.desc")); } IRotorHolder rotorHolder = getRotorHolder(); if (rotorHolder.getRotorEfficiency() <= 0) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.turbine.no_rotor")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.turbine.no_rotor")); } } } @@ -183,19 +193,20 @@ protected BlockPattern createStructurePattern() { .where('G', states(getGearBoxState())) .where('C', states(getCasingState())) .where('R', metaTileEntities(MultiblockAbility.REGISTRY.get(MultiblockAbility.ROTOR_HOLDER).stream() - .filter(mte -> (mte instanceof ITieredMetaTileEntity) && (((ITieredMetaTileEntity) mte).getTier() >= tier)) + .filter(mte -> (mte instanceof ITieredMetaTileEntity) && + (((ITieredMetaTileEntity) mte).getTier() >= tier)) .toArray(MetaTileEntity[]::new)) - .addTooltips("gregtech.multiblock.pattern.clear_amount_3") - .addTooltip("gregtech.multiblock.pattern.error.limited.1", GTValues.VN[tier]) - .setExactLimit(1) - .or(abilities(MultiblockAbility.OUTPUT_ENERGY)).setExactLimit(1)) + .addTooltips("gregtech.multiblock.pattern.clear_amount_3") + .addTooltip("gregtech.multiblock.pattern.error.limited.1", GTValues.VN[tier]) + .setExactLimit(1) + .or(abilities(MultiblockAbility.OUTPUT_ENERGY)).setExactLimit(1)) .where('H', states(getCasingState()).or(autoAbilities(false, true, false, false, true, true, true))) .build(); } @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.large_turbine.description")}; + return new String[] { I18n.format("gregtech.multiblock.large_turbine.description") }; } public IBlockState getCasingState() { @@ -296,7 +307,8 @@ public void addBarHoverText(List hoverList, int index) { // Rotor speed IRotorHolder rotorHolder = getRotorHolder(); if (rotorHolder == null || rotorHolder.getRotorEfficiency() <= 0) { - hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.turbine.no_rotor")); + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.turbine.no_rotor")); } else { int rotorSpeed = rotorHolder.getRotorSpeed(); int rotorMaxSpeed = rotorHolder.getMaxRotorHolderSpeed(); @@ -319,7 +331,8 @@ public void addBarHoverText(List hoverList, int index) { IRotorHolder rotorHolder = getRotorHolder(); if (rotorHolder == null || rotorHolder.getRotorEfficiency() <= 0) { // No rotor found - hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.turbine.no_rotor")); + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.turbine.no_rotor")); } else { int rotorDurability = rotorHolder.getRotorDurabilityPercent(); ITextComponent rotorInfo = TextComponentUtil.stringWithColor( diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityAutoMaintenanceHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityAutoMaintenanceHatch.java index e5807b2359e..4f6c8eeff2b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityAutoMaintenanceHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityAutoMaintenanceHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.IMaintenanceHatch; import gregtech.api.gui.ModularUI; import gregtech.api.metatileentity.MetaTileEntity; @@ -12,6 +9,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -21,10 +19,16 @@ import net.minecraft.util.Tuple; import net.minecraft.world.World; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; -public class MetaTileEntityAutoMaintenanceHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IMaintenanceHatch { +import javax.annotation.Nullable; + +public class MetaTileEntityAutoMaintenanceHatch extends MetaTileEntityMultiblockPart implements + IMultiblockAbilityPart, IMaintenanceHatch { public MetaTileEntityAutoMaintenanceHatch(ResourceLocation metaTileEntityId) { super(metaTileEntityId, 3); @@ -57,12 +61,10 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t } @Override - public void setTaped(boolean ignored) { - } + public void setTaped(boolean ignored) {} @Override - public void storeMaintenanceData(byte ignored1, int ignored2) { - } + public void storeMaintenanceData(byte ignored1, int ignored2) {} @Override public boolean hasMaintenanceData() { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityCleaningMaintenanceHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityCleaningMaintenanceHatch.java index 1801b18b91a..716fef7515d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityCleaningMaintenanceHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityCleaningMaintenanceHatch.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import com.google.common.collect.ImmutableSet; import gregtech.api.GTValues; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; @@ -12,7 +7,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; @@ -20,13 +15,21 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import com.google.common.collect.ImmutableSet; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityCleaningMaintenanceHatch extends MetaTileEntityAutoMaintenanceHatch { protected static final Set CLEANED_TYPES = new ObjectOpenHashSet<>(); @@ -50,7 +53,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @Override public void addToMultiBlock(MultiblockControllerBase controllerBase) { super.addToMultiBlock(controllerBase); - if (controllerBase instanceof ICleanroomReceiver && ((ICleanroomReceiver) controllerBase).getCleanroom() == null) { + if (controllerBase instanceof ICleanroomReceiver && + ((ICleanroomReceiver) controllerBase).getCleanroom() == null) { ((ICleanroomReceiver) controllerBase).setCleanroom(DUMMY_CLEANROOM); } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java index 175c8775eef..5787bfaae36 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IOpticalComputationHatch; @@ -15,18 +12,25 @@ import gregtech.api.util.GTLog; import gregtech.client.renderer.texture.Textures; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.Collection; import java.util.List; -public class MetaTileEntityComputationHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IOpticalComputationHatch { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class MetaTileEntityComputationHatch extends MetaTileEntityMultiblockPart implements + IMultiblockAbilityPart, IOpticalComputationHatch { private final boolean isTransmitter; @@ -115,7 +119,8 @@ private IOpticalComputationProvider getOpticalNetProvider() { if (tileEntity == null) return null; if (tileEntity instanceof TileEntityOpticalPipe) { - return tileEntity.getCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER, getFrontFacing().getOpposite()); + return tileEntity.getCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER, + getFrontFacing().getOpposite()); } return null; } @@ -146,9 +151,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, @Override public MultiblockAbility getAbility() { - return isTransmitter() - ? MultiblockAbility.COMPUTATION_DATA_TRANSMISSION - : MultiblockAbility.COMPUTATION_DATA_RECEPTION; + return isTransmitter() ? MultiblockAbility.COMPUTATION_DATA_TRANSMISSION : + MultiblockAbility.COMPUTATION_DATA_RECEPTION; } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityDataAccessHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityDataAccessHatch.java index ce0efdb5a9b..ea812b787c3 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityDataAccessHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityDataAccessHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IDataAccessHatch; import gregtech.api.capability.impl.NotifiableItemStackHandler; @@ -25,8 +22,7 @@ import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.electric.MetaTileEntityDataBank; -import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -39,11 +35,20 @@ import net.minecraft.world.World; import net.minecraftforge.items.IItemHandlerModifiable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + +import java.util.*; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.*; -public class MetaTileEntityDataAccessHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IDataAccessHatch, IDataInfoProvider { +public class MetaTileEntityDataAccessHatch extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart, IDataAccessHatch, + IDataInfoProvider { private final Set recipes; private final boolean isCreative; @@ -64,6 +69,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { protected IItemHandlerModifiable createImportItemHandler() { if (isCreative) return super.createImportItemHandler(); return new NotifiableItemStackHandler(this, getInventorySize(), getController(), false) { + @Override public void onContentsChanged(int slot) { super.onContentsChanged(slot); @@ -75,7 +81,8 @@ public void onContentsChanged(int slot) { public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { var controller = MetaTileEntityDataAccessHatch.this.getController(); boolean isDataBank = controller instanceof MetaTileEntityDataBank; - if (AssemblyLineManager.isStackDataItem(stack, isDataBank) && AssemblyLineManager.hasResearchTag(stack)) { + if (AssemblyLineManager.isStackDataItem(stack, isDataBank) && + AssemblyLineManager.hasResearchTag(stack)) { return super.insertItem(slot, stack, simulate); } return stack; @@ -107,7 +114,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { int index = y * rowSize + x; builder.widget(new SlotWidget(isExportHatch ? exportItems : importItems, index, 88 - rowSize * 9 + x * 18, 18 + y * 18, true, !isExportHatch) - .setBackgroundTexture(GuiTextures.SLOT)); + .setBackgroundTexture(GuiTextures.SLOT)); } } return builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 18 + 18 * rowSize + 12) @@ -131,7 +138,8 @@ private void rebuildData(boolean isDataBank) { String researchId = AssemblyLineManager.readResearchId(stack); boolean isValid = AssemblyLineManager.isStackDataItem(stack, isDataBank); if (researchId != null && isValid) { - Collection collection = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES).getDataStickEntry(researchId); + Collection collection = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES) + .getDataStickEntry(researchId); if (collection != null) { recipes.addAll(collection); } @@ -158,13 +166,13 @@ public void getSubItems(CreativeTabs creativeTab, NonNullList subItem } @Override - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.data_access_hatch.tooltip.1")); if (isCreative) { - tooltip.add(I18n.format("gregtech.creative_tooltip.1") - + TooltipHelper.RAINBOW + I18n.format("gregtech.creative_tooltip.2") - + I18n.format("gregtech.creative_tooltip.3")); + tooltip.add(I18n.format("gregtech.creative_tooltip.1") + TooltipHelper.RAINBOW + + I18n.format("gregtech.creative_tooltip.2") + I18n.format("gregtech.creative_tooltip.3")); } else { tooltip.add(I18n.format("gregtech.machine.data_access_hatch.tooltip.2", getInventorySize())); } @@ -183,7 +191,8 @@ public List getDataInfo() { ItemStack stack = recipe.getOutputs().get(0); if (!itemsAdded.contains(stack)) { itemsAdded.add(stack); - list.add(new TextComponentTranslation("behavior.data_item.assemblyline.data", LocalizationUtils.format(stack.getTranslationKey()))); + list.add(new TextComponentTranslation("behavior.data_item.assemblyline.data", + LocalizationUtils.format(stack.getTranslationKey()))); } } return list; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityEnergyHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityEnergyHatch.java index 92a53c79041..34c53e7a0cb 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityEnergyHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityEnergyHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.impl.EnergyContainerHandler; @@ -15,6 +12,7 @@ import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; import gregtech.client.utils.PipelineUtil; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -23,11 +21,17 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityEnergyHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart { +public class MetaTileEntityEnergyHatch extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart { protected final boolean isExportHatch; protected final int amperage; @@ -38,10 +42,12 @@ public MetaTileEntityEnergyHatch(ResourceLocation metaTileEntityId, int tier, in this.isExportHatch = isExportHatch; this.amperage = amperage; if (isExportHatch) { - this.energyContainer = EnergyContainerHandler.emitterContainer(this, GTValues.V[tier] * 64L * amperage, GTValues.V[tier], amperage); + this.energyContainer = EnergyContainerHandler.emitterContainer(this, GTValues.V[tier] * 64L * amperage, + GTValues.V[tier], amperage); ((EnergyContainerHandler) this.energyContainer).setSideOutputCondition(s -> s == getFrontFacing()); } else { - this.energyContainer = EnergyContainerHandler.receiverContainer(this, GTValues.V[tier] * 16L * amperage, GTValues.V[tier], amperage); + this.energyContainer = EnergyContainerHandler.receiverContainer(this, GTValues.V[tier] * 16L * amperage, + GTValues.V[tier], amperage); } } @@ -54,7 +60,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); if (shouldRenderOverlay()) { - getOverlay().renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + getOverlay().renderSided(getFrontFacing(), renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); } } @@ -115,17 +122,22 @@ public void addInformation(ItemStack stack, @Nullable World world, List addDescriptorTooltip(stack, world, tooltip, advanced); if (isExportHatch) { - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); - tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out_till", energyContainer.getOutputAmperage())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), + tierName)); + tooltip.add( + I18n.format("gregtech.universal.tooltip.amperage_out_till", energyContainer.getOutputAmperage())); } else { - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); + tooltip.add( + I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_till", energyContainer.getInputAmperage())); } - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); tooltip.add(I18n.format("gregtech.universal.enabled")); } - protected void addDescriptorTooltip(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { + protected void addDescriptorTooltip(ItemStack stack, @Nullable World world, List tooltip, + boolean advanced) { if (isExportHatch) { if (amperage > 2) { tooltip.add(I18n.format("gregtech.machine.energy_hatch.output_hi_amp.tooltip")); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java index a2fe88ea34b..6d23c88bd56 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.*; import gregtech.api.capability.impl.FilteredItemHandler; import gregtech.api.capability.impl.FluidTankList; @@ -20,6 +17,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; import gregtech.common.metatileentities.storage.MetaTileEntityQuantumTank; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -37,12 +35,18 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; import java.util.function.Consumer; -public class MetaTileEntityFluidHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IControllable { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class MetaTileEntityFluidHatch extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart, IControllable { private static final int INITIAL_INVENTORY_SIZE = 8000; @@ -87,11 +91,13 @@ public void readFromNBT(NBTTagCompound data) { this.workingEnabled = data.getBoolean("workingEnabled"); } if (data.hasKey("ContainerInventory")) { - MetaTileEntityQuantumTank.legacyTankItemHandlerNBTReading(this, data.getCompoundTag("ContainerInventory"), 0, 1); + MetaTileEntityQuantumTank.legacyTankItemHandlerNBTReading(this, data.getCompoundTag("ContainerInventory"), + 0, 1); } if (isExportHatch) { this.locked = data.getBoolean("IsLocked"); - this.lockedFluid = this.locked ? FluidStack.loadFluidStackFromNBT(data.getCompoundTag("LockedFluid")) : null; + this.lockedFluid = this.locked ? FluidStack.loadFluidStackFromNBT(data.getCompoundTag("LockedFluid")) : + null; } } @@ -165,7 +171,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, if (shouldRenderOverlay()) { SimpleOverlayRenderer renderer = isExportHatch ? Textures.PIPE_OUT_OVERLAY : Textures.PIPE_IN_OVERLAY; renderer.renderSided(getFrontFacing(), renderState, translation, pipeline); - SimpleOverlayRenderer overlay = isExportHatch ? Textures.FLUID_HATCH_OUTPUT_OVERLAY : Textures.FLUID_HATCH_INPUT_OVERLAY; + SimpleOverlayRenderer overlay = isExportHatch ? Textures.FLUID_HATCH_OUTPUT_OVERLAY : + Textures.FLUID_HATCH_INPUT_OVERLAY; overlay.renderSided(getFrontFacing(), renderState, translation, pipeline); } } @@ -186,7 +193,8 @@ protected FluidTankList createExportFluidHandler() { @Override protected IItemHandlerModifiable createImportItemHandler() { - return new FilteredItemHandler(this, 1).setFillPredicate(FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); + return new FilteredItemHandler(this, 1).setFillPredicate( + FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); } @Override @@ -231,15 +239,15 @@ public ModularUI.Builder createTankUI(IFluidTank fluidTank, String title, Entity this.lockedFluid.amount = 1; } }) - .setAlwaysShowFull(true).setDrawHoveringText(false); + .setAlwaysShowFull(true).setDrawHoveringText(false); builder.image(7, 16, 81, 46, GuiTextures.DISPLAY) .widget(new SlotWidget(exportItems, 0, 90, 44, true, false) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)) .widget(new ToggleButtonWidget(7, 64, 18, 18, GuiTextures.BUTTON_LOCK, this::isLocked, this::setLocked) - .setTooltipText("gregtech.gui.fluid_lock.tooltip") - .shouldUseBaseBackground()); + .setTooltipText("gregtech.gui.fluid_lock.tooltip") + .shouldUseBaseBackground()); } else { tankWidget = new TankWidget(fluidTank, 69, 52, 18, 18) .setAlwaysShowFull(true).setDrawHoveringText(false); @@ -295,7 +303,8 @@ private Consumer> getFluidAmountText(TankWidget tankWidget) } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { if (this.isExportHatch) tooltip.add(I18n.format("gregtech.machine.fluid_hatch.export.tooltip")); else diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java index e6fedc3cde8..db97935abe0 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.*; import gregtech.api.capability.impl.GhostCircuitItemStackHandler; import gregtech.api.capability.impl.ItemHandlerList; @@ -23,8 +19,7 @@ import gregtech.api.util.GTHashMaps; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; -import gregtech.integration.jei.recipe.IntCircuitCategory; -import it.unimi.dsi.fastutil.objects.Object2IntMap; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -39,13 +34,22 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import it.unimi.dsi.fastutil.objects.Object2IntMap; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class MetaTileEntityItemBus extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IControllable, IGhostSlotConfigurable { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class MetaTileEntityItemBus extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart, IControllable, + IGhostSlotConfigurable { @Nullable protected GhostCircuitItemStackHandler circuitInventory; @@ -120,9 +124,11 @@ public void update() { } // Only attempt to auto collapse the inventory contents once the bus has been notified if (isAutoCollapse()) { - // Exclude the ghost circuit inventory from the auto collapse, so it does not extract any ghost circuits from the slot + // Exclude the ghost circuit inventory from the auto collapse, so it does not extract any ghost circuits + // from the slot IItemHandlerModifiable inventory = (isExportHatch ? this.getExportItems() : super.getImportItems()); - if (isExportHatch ? this.getNotifiedItemOutputList().contains(inventory) : this.getNotifiedItemInputList().contains(inventory)) { + if (isExportHatch ? this.getNotifiedItemOutputList().contains(inventory) : + this.getNotifiedItemInputList().contains(inventory)) { collapseInventorySlotContents(inventory); } } @@ -157,7 +163,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, if (shouldRenderOverlay()) { SimpleOverlayRenderer renderer = isExportHatch ? Textures.PIPE_OUT_OVERLAY : Textures.PIPE_IN_OVERLAY; renderer.renderSided(getFrontFacing(), renderState, translation, pipeline); - SimpleOverlayRenderer overlay = isExportHatch ? Textures.ITEM_HATCH_OUTPUT_OVERLAY : Textures.ITEM_HATCH_INPUT_OVERLAY; + SimpleOverlayRenderer overlay = isExportHatch ? Textures.ITEM_HATCH_OUTPUT_OVERLAY : + Textures.ITEM_HATCH_INPUT_OVERLAY; overlay.renderSided(getFrontFacing(), renderState, translation, pipeline); } } @@ -169,12 +176,14 @@ private int getInventorySize() { @Override protected IItemHandlerModifiable createExportItemHandler() { - return isExportHatch ? new NotifiableItemStackHandler(this, getInventorySize(), getController(), true) : new GTItemStackHandler(this, 0); + return isExportHatch ? new NotifiableItemStackHandler(this, getInventorySize(), getController(), true) : + new GTItemStackHandler(this, 0); } @Override protected IItemHandlerModifiable createImportItemHandler() { - return isExportHatch ? new GTItemStackHandler(this, 0) : new NotifiableItemStackHandler(this, getInventorySize(), getController(), false); + return isExportHatch ? new GTItemStackHandler(this, 0) : + new NotifiableItemStackHandler(this, getInventorySize(), getController(), false); } @Override @@ -265,7 +274,7 @@ private ModularUI.Builder createUITemplate(EntityPlayer player, int gridSize) { builder.widget(new SlotWidget(isExportHatch ? exportItems : importItems, index, gridStartX + x * 18, 18 + y * 18, true, !isExportHatch) - .setBackgroundTexture(GuiTextures.SLOT)); + .setBackgroundTexture(GuiTextures.SLOT)); } } @@ -342,8 +351,8 @@ private static void collapseInventorySlotContents(IItemHandlerModifiable invento } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { - + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { boolean isAttached = false; if (this.isAttachedToMultiBlock()) { setAutoCollapse(!this.autoCollapse); @@ -378,7 +387,8 @@ public void setAutoCollapse(boolean inverted) { addNotifiedInput(super.getImportItems()); } } - writeCustomData(GregtechDataCodes.TOGGLE_COLLAPSE_ITEMS, packetBuffer -> packetBuffer.writeBoolean(autoCollapse)); + writeCustomData(GregtechDataCodes.TOGGLE_COLLAPSE_ITEMS, + packetBuffer -> packetBuffer.writeBoolean(autoCollapse)); notifyBlockUpdate(); markDirty(); } @@ -396,7 +406,8 @@ public void setGhostCircuitConfig(int config) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { if (this.isExportHatch) tooltip.add(I18n.format("gregtech.machine.item_bus.export.tooltip")); else diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityLaserHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityLaserHatch.java index 18b373c0aca..2f622588c7b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityLaserHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityLaserHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.ILaserContainer; import gregtech.api.capability.impl.LaserContainerHandler; @@ -13,6 +10,7 @@ import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -22,6 +20,10 @@ import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -31,7 +33,8 @@ import static gregtech.api.GTValues.V; import static gregtech.api.GTValues.VN; -public class MetaTileEntityLaserHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IDataInfoProvider { +public class MetaTileEntityLaserHatch extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart, IDataInfoProvider { private final boolean isOutput; private final int tier; @@ -44,10 +47,12 @@ public MetaTileEntityLaserHatch(ResourceLocation metaTileEntityId, boolean isOut this.tier = tier; this.amperage = amperage; if (isOutput) { - this.buffer = LaserContainerHandler.emitterContainer(this, GTValues.V[tier] * 64L * amperage, GTValues.V[tier], amperage); + this.buffer = LaserContainerHandler.emitterContainer(this, GTValues.V[tier] * 64L * amperage, + GTValues.V[tier], amperage); ((LaserContainerHandler) this.buffer).setSideOutputCondition(s -> s == getFrontFacing()); } else { - this.buffer = LaserContainerHandler.receiverContainer(this, GTValues.V[tier] * 64L * amperage, GTValues.V[tier], amperage); + this.buffer = LaserContainerHandler.receiverContainer(this, GTValues.V[tier] * 64L * amperage, + GTValues.V[tier], amperage); ((LaserContainerHandler) this.buffer).setSideInputCondition(s -> s == getFrontFacing()); } } @@ -95,8 +100,10 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { - tooltip.add(I18n.format(isOutput ? "gregtech.machine.laser_hatch.source.tooltip1" : "gregtech.machine.laser_hatch.target.tooltip1")); + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { + tooltip.add(I18n.format(isOutput ? "gregtech.machine.laser_hatch.source.tooltip1" : + "gregtech.machine.laser_hatch.target.tooltip1")); tooltip.add(I18n.format("gregtech.machine.laser_hatch.tooltip2")); if (isOutput) { @@ -113,7 +120,8 @@ public void addInformation(ItemStack stack, @Nullable World world, @NotNull List @NotNull @Override public List getDataInfo() { - return Collections.singletonList(new TextComponentString(String.format("%d/%d EU", this.buffer.getEnergyStored(), this.buffer.getEnergyCapacity()))); + return Collections.singletonList(new TextComponentString( + String.format("%d/%d EU", this.buffer.getEnergyStored(), this.buffer.getEnergyCapacity()))); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java index 4a19067eb7f..f6897f1144b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.NotifiableItemStackHandler; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -17,6 +14,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.ItemStackHashStrategy; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -24,11 +22,17 @@ import net.minecraft.world.World; import net.minecraftforge.items.IItemHandlerModifiable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityMachineHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart { +public class MetaTileEntityMachineHatch extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart { private final IItemHandlerModifiable machineHandler; @@ -61,14 +65,15 @@ protected IItemHandlerModifiable createImportItemHandler() { @Override protected ModularUI createUI(EntityPlayer entityPlayer) { ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, - 18 + 18 + 94) + 18 + 18 + 94) .label(10, 5, getMetaFullName()); builder.widget(new BlockableSlotWidget(machineHandler, 0, 81, 18, true, true) .setIsBlocked(this::isSlotBlocked) .setBackgroundTexture(GuiTextures.SLOT)); - return builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 18 + 18 + 12).build(getHolder(), entityPlayer); + return builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 18 + 18 + 12).build(getHolder(), + entityPlayer); } @Override @@ -119,27 +124,28 @@ public LimitedImportHandler(MetaTileEntity metaTileEntity) { @Override // Insert item returns the remainder stack that was not inserted public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { - // If the item was not valid, nothing from the stack can be inserted if (!isItemValid(slot, stack)) { return stack; } // Return Empty if passed Empty - if(stack.isEmpty()) { + if (stack.isEmpty()) { return ItemStack.EMPTY; } // If the stacks do not match, nothing can be inserted - if(!ItemStackHashStrategy.comparingAllButCount().equals(stack, this.getStackInSlot(slot)) && !this.getStackInSlot(slot).isEmpty()) { + if (!ItemStackHashStrategy.comparingAllButCount().equals(stack, this.getStackInSlot(slot)) && + !this.getStackInSlot(slot).isEmpty()) { return stack; } int amountInSlot = this.getStackInSlot(slot).getCount(); int slotLimit = getSlotLimit(slot); - // If the current stack size in the slot is greater than the limit of the Multiblock, nothing can be inserted - if(amountInSlot >= slotLimit) { + // If the current stack size in the slot is greater than the limit of the Multiblock, nothing can be + // inserted + if (amountInSlot >= slotLimit) { return stack; } @@ -155,13 +161,12 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate // Handle any remainder ItemStack remainder = ItemStack.EMPTY; - if(remainderAmount > 0) { + if (remainderAmount > 0) { remainder = stack.copy(); remainder.setCount(remainderAmount); } - - if(!simulate) { + if (!simulate) { // Perform the actual insertion ItemStack temp = stack.copy(); temp.setCount(amountInSlot + amountToInsert); @@ -173,14 +178,15 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate @Override public boolean isItemValid(int slot, @Nonnull ItemStack stack) { - - boolean slotMatches = this.getStackInSlot(slot).isEmpty() || ItemStackHashStrategy.comparingAllButCount().equals(this.getStackInSlot(slot), stack); + boolean slotMatches = this.getStackInSlot(slot).isEmpty() || + ItemStackHashStrategy.comparingAllButCount().equals(this.getStackInSlot(slot), stack); MultiblockControllerBase controller = getController(); if (controller instanceof IMachineHatchMultiblock) - return slotMatches && GTUtility.isMachineValidForMachineHatch(stack, ((IMachineHatchMultiblock) controller).getBlacklist()); + return slotMatches && GTUtility.isMachineValidForMachineHatch(stack, + ((IMachineHatchMultiblock) controller).getBlacklist()); - //If the controller is null, this part is not attached to any Multiblock + // If the controller is null, this part is not attached to any Multiblock return slotMatches; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMaintenanceHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMaintenanceHatch.java index 7cc57b4c50b..8a9445d70fd 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMaintenanceHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMaintenanceHatch.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IMaintenanceHatch; import gregtech.api.gui.GuiTextures; @@ -28,6 +24,7 @@ import gregtech.common.gui.widget.among_us.FixWiringTaskWidget; import gregtech.common.inventory.handlers.TapeItemStackHandler; import gregtech.common.items.MetaItems; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -44,8 +41,11 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.math.BigDecimal; import java.math.RoundingMode; import java.util.Arrays; @@ -55,9 +55,13 @@ import java.util.function.Function; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.*; -public class MetaTileEntityMaintenanceHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IMaintenanceHatch { +public class MetaTileEntityMaintenanceHatch extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart, IMaintenanceHatch { private final boolean isConfigurable; private GTItemStackHandler itemStackHandler; @@ -95,8 +99,9 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, super.renderMetaTileEntity(renderState, translation, pipeline); if (shouldRenderOverlay()) { - (isConfigurable ? Textures.MAINTENANCE_OVERLAY_CONFIGURABLE : isTaped ? Textures.MAINTENANCE_OVERLAY_TAPED : Textures.MAINTENANCE_OVERLAY) - .renderSided(getFrontFacing(), renderState, translation, pipeline); + (isConfigurable ? Textures.MAINTENANCE_OVERLAY_CONFIGURABLE : + isTaped ? Textures.MAINTENANCE_OVERLAY_TAPED : Textures.MAINTENANCE_OVERLAY) + .renderSided(getFrontFacing(), renderState, translation, pipeline); } } @@ -115,6 +120,7 @@ public void clearMachineInventory(NonNullList itemBuffer) { /** * Sets this Maintenance Hatch as being duct taped + * * @param isTaped is the state of the hatch being taped or not */ @Override @@ -128,8 +134,9 @@ public void setTaped(boolean isTaped) { /** * Stores maintenance data to this MetaTileEntity + * * @param maintenanceProblems is the byte value representing the problems - * @param timeActive is the int value representing the total time the parent multiblock has been active + * @param timeActive is the int value representing the total time the parent multiblock has been active */ @Override public void storeMaintenanceData(byte maintenanceProblems, int timeActive) { @@ -154,6 +161,7 @@ public boolean hasMaintenanceData() { /** * reads this MetaTileEntity's maintenance data + * * @return Tuple of Byte, Integer corresponding to the maintenance problems, and total time active */ @Override @@ -186,6 +194,7 @@ public void update() { /** * Fixes the maintenance problems of this hatch's Multiblock Controller + * * @param entityPlayer the player performing the fixing */ private void fixMaintenanceProblems(@Nullable EntityPlayer entityPlayer) { @@ -219,7 +228,7 @@ private void fixMaintenanceProblems(@Nullable EntityPlayer entityPlayer) { * Handles duct taping for manual and auto-taping use * * @param handler is the handler to get duct tape from - * @param slot is the inventory slot to check for tape + * @param slot is the inventory slot to check for tape * @return true if tape was consumed, else false */ private boolean consumeDuctTape(@Nullable IItemHandler handler, int slot) { @@ -242,7 +251,7 @@ private boolean consumeDuctTape(@Nullable EntityPlayer player, ItemStack itemSta * Attempts to fix a provided maintenance problem with a tool in the player's * inventory, if the tool exists. * - * @param problems Problem Flags + * @param problems Problem Flags * @param entityPlayer Target Player which their inventory would be scanned for tools to fix */ private void fixProblemsWithTools(byte problems, EntityPlayer entityPlayer) { @@ -368,7 +377,8 @@ public void onRemoval() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getController() instanceof IMaintenance && ((IMaintenance) getController()).hasMaintenanceProblems()) { if (consumeDuctTape(playerIn, playerIn.getHeldItem(hand))) { fixAllMaintenanceProblems(); @@ -391,15 +401,20 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .setCanInteractPredicate(this::isAttachedToMultiBlock)); } else { builder.widget(new SlotWidget(itemStackHandler, 0, 89 - 10, 18 - 1) - .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.DUCT_TAPE_OVERLAY).setTooltipText("gregtech.machine.maintenance_hatch_tape_slot.tooltip")) - .widget(new ClickButtonWidget(89 - 10 - 1, 18 * 2 + 3, 20, 20, "", data -> fixMaintenanceProblems(entityPlayer)) - .setButtonTexture(GuiTextures.MAINTENANCE_ICON).setTooltipText("gregtech.machine.maintenance_hatch_tool_slot.tooltip")); + .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.DUCT_TAPE_OVERLAY) + .setTooltipText("gregtech.machine.maintenance_hatch_tape_slot.tooltip")) + .widget(new ClickButtonWidget(89 - 10 - 1, 18 * 2 + 3, 20, 20, "", + data -> fixMaintenanceProblems(entityPlayer)) + .setButtonTexture(GuiTextures.MAINTENANCE_ICON) + .setTooltipText("gregtech.machine.maintenance_hatch_tool_slot.tooltip")); } if (isConfigurable) { - builder.widget(new AdvancedTextWidget(5, 25, getTextWidgetText("duration", this::getDurationMultiplier), 0x404040)) + builder.widget( + new AdvancedTextWidget(5, 25, getTextWidgetText("duration", this::getDurationMultiplier), 0x404040)) .widget(new AdvancedTextWidget(5, 39, getTextWidgetText("time", this::getTimeMultiplier), 0x404040)) .widget(new ClickButtonWidget(9, 18 * 3 + 16 - 18, 12, 12, "-", this::decInternalMultiplier)) - .widget(new ClickButtonWidget(9 + 18 * 2, 18 * 3 + 16 - 18, 12, 12, "+", this::incInternalMultiplier)); + .widget(new ClickButtonWidget(9 + 18 * 2, 18 * 3 + 16 - 18, 12, 12, "+", + this::incInternalMultiplier)); } return builder.build(getHolder(), entityPlayer); } @@ -408,9 +423,11 @@ private static Consumer> getTextWidgetText(String type, Sup return (list) -> { ITextComponent tooltip; if (multiplier.get() == 1.0) { - tooltip = new TextComponentTranslation("gregtech.maintenance.configurable_" + type + ".unchanged_description"); + tooltip = new TextComponentTranslation( + "gregtech.maintenance.configurable_" + type + ".unchanged_description"); } else { - tooltip = new TextComponentTranslation("gregtech.maintenance.configurable_" + type + ".changed_description", multiplier.get()); + tooltip = new TextComponentTranslation( + "gregtech.maintenance.configurable_" + type + ".changed_description", multiplier.get()); } list.add(new TextComponentTranslation("gregtech.maintenance.configurable_" + type, multiplier.get()) .setStyle(new Style().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)))); @@ -499,7 +516,8 @@ public void getSubItems(CreativeTabs creativeTab, NonNullList subItem } @Override - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.universal.disabled")); if (isConfigurable) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java index 5c5e2b6600b..6f8088743c7 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IMufflerHatch; import gregtech.api.gui.GuiTextures; @@ -19,6 +16,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.TooltipHelper; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -32,10 +30,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; -public class MetaTileEntityMufflerHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, ITieredMetaTileEntity, IMufflerHatch { +import javax.annotation.Nullable; + +public class MetaTileEntityMufflerHatch extends MetaTileEntityMultiblockPart implements + IMultiblockAbilityPart, ITieredMetaTileEntity, IMufflerHatch { private final int recoveryChance; private final GTItemStackHandler inventory; @@ -63,7 +67,8 @@ public void update() { this.frontFaceFree = checkFrontFaceFree(); } - if (getWorld().isRemote && getController() instanceof MultiblockWithDisplayBase controller && controller.isActive()) { + if (getWorld().isRemote && getController() instanceof MultiblockWithDisplayBase controller && + controller.isActive()) { pollutionParticles(); } } @@ -85,7 +90,6 @@ private boolean calculateChance() { return recoveryChance >= 100 || recoveryChance > GTValues.RNG.nextInt(100); } - /** * @return true if front face is free and contains only air blocks in 1x1 area */ @@ -178,7 +182,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { private ModularUI.Builder createUITemplate(EntityPlayer player, int rowSize, int xOffset) { ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176 + xOffset * 2, - 18 + 18 * rowSize + 94) + 18 + 18 * rowSize + 94) .label(10, 5, getMetaFullName()); for (int y = 0; y < rowSize; y++) { @@ -186,7 +190,7 @@ private ModularUI.Builder createUITemplate(EntityPlayer player, int rowSize, int int index = y * rowSize + x; builder.widget(new SlotWidget(inventory, index, (88 - rowSize * 9 + x * 18) + xOffset, 18 + y * 18, true, false) - .setBackgroundTexture(GuiTextures.SLOT)); + .setBackgroundTexture(GuiTextures.SLOT)); } } return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, 7 + xOffset, 18 + 18 * rowSize + 12); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java index b6dab63c91b..2c6c4fcf309 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -18,6 +15,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -30,10 +28,16 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidTank; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; -public class MetaTileEntityMultiFluidHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IControllable { +import javax.annotation.Nullable; + +public class MetaTileEntityMultiFluidHatch extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart, IControllable { private static final int BASE_TANK_SIZE = 8000; @@ -44,7 +48,8 @@ public class MetaTileEntityMultiFluidHatch extends MetaTileEntityMultiblockNotif private final FluidTankList fluidTankList; private boolean workingEnabled; - public MetaTileEntityMultiFluidHatch(ResourceLocation metaTileEntityId, int tier, int numSlots, boolean isExportHatch) { + public MetaTileEntityMultiFluidHatch(ResourceLocation metaTileEntityId, int tier, int numSlots, + boolean isExportHatch) { super(metaTileEntityId, tier, isExportHatch); this.workingEnabled = true; this.numSlots = numSlots; @@ -144,7 +149,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format(isExportHatch ? "gregtech.machine.fluid_hatch.export.tooltip" : "gregtech.machine.fluid_hatch.import.tooltip")); + tooltip.add(I18n.format(isExportHatch ? "gregtech.machine.fluid_hatch.export.tooltip" : + "gregtech.machine.fluid_hatch.import.tooltip")); tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity_mult", numSlots, tankSize)); tooltip.add(I18n.format("gregtech.universal.enabled")); } @@ -180,16 +186,17 @@ public void registerAbilities(List abilityList) { protected ModularUI createUI(EntityPlayer entityPlayer) { int rowSize = (int) Math.sqrt(numSlots); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, - 18 + 18 * rowSize + 94) + 18 + 18 * rowSize + 94) .label(10, 5, getMetaFullName()); for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { int index = y * rowSize + x; - builder.widget(new TankWidget(fluidTankList.getTankAt(index), 89 - rowSize * 9 + x * 18, 18 + y * 18, 18, 18) - .setBackgroundTexture(GuiTextures.FLUID_SLOT) - .setContainerClicking(true, !isExportHatch) - .setAlwaysShowFull(true)); + builder.widget( + new TankWidget(fluidTankList.getTankAt(index), 89 - rowSize * 9 + x * 18, 18 + y * 18, 18, 18) + .setBackgroundTexture(GuiTextures.FLUID_SLOT) + .setContainerClicking(true, !isExportHatch) + .setAlwaysShowFull(true)); } } builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 18 + 18 * rowSize + 12); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockNotifiablePart.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockNotifiablePart.java index 888cf9f94f7..6af14227d09 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockNotifiablePart.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockNotifiablePart.java @@ -5,6 +5,7 @@ import gregtech.api.capability.impl.FluidTankList; import gregtech.api.capability.impl.NotifiableItemStackHandler; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; + import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.IFluidTank; @@ -12,6 +13,7 @@ import java.util.List; public abstract class MetaTileEntityMultiblockNotifiablePart extends MetaTileEntityMultiblockPart { + protected final boolean isExportHatch; public MetaTileEntityMultiblockNotifiablePart(ResourceLocation metaTileEntityId, int tier, boolean isExportHatch) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockPart.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockPart.java index 56d2dd7adfe..04b67b858b2 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockPart.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockPart.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.metatileentity.ITieredMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockPart; @@ -13,17 +9,24 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOrientedCubeRenderer; import gregtech.client.renderer.texture.custom.FireboxActiveRenderer; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.network.PacketBuffer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import static gregtech.api.capability.GregtechDataCodes.SYNC_CONTROLLER; -public abstract class MetaTileEntityMultiblockPart extends MetaTileEntity implements IMultiblockPart, ITieredMetaTileEntity { +public abstract class MetaTileEntityMultiblockPart extends MetaTileEntity + implements IMultiblockPart, ITieredMetaTileEntity { private final int tier; private BlockPos controllerPos; @@ -44,7 +47,8 @@ public Pair getParticleTexture() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { ICubeRenderer baseTexture = getBaseTexture(); - pipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + pipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); if (baseTexture instanceof FireboxActiveRenderer || baseTexture instanceof SimpleOrientedCubeRenderer) { baseTexture.renderOriented(renderState, translation, pipeline, getFrontFacing()); @@ -58,15 +62,17 @@ public int getTier() { } public MultiblockControllerBase getController() { - if (getWorld() != null && getWorld().isRemote) { //check this only clientside + if (getWorld() != null && getWorld().isRemote) { // check this only clientside if (controllerTile == null && controllerPos != null) { this.controllerTile = (MultiblockControllerBase) GTUtility.getMetaTileEntity(getWorld(), controllerPos); } } if (controllerTile != null && (controllerTile.getHolder() == null || - !controllerTile.isValid() || !(getWorld().isRemote || controllerTile.getMultiblockParts().contains(this)))) { - //tile can become invalid for many reasons, and can also forgot to remove us once we aren't in structure anymore - //so check it here to prevent bugs with dangling controller reference and wrong texture + !controllerTile.isValid() || + !(getWorld().isRemote || controllerTile.getMultiblockParts().contains(this)))) { + // tile can become invalid for many reasons, and can also forgot to remove us once we aren't in structure + // anymore + // so check it here to prevent bugs with dangling controller reference and wrong texture this.controllerTile = null; } return controllerTile; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityObjectHolder.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityObjectHolder.java index f7a0b6613e9..5658841fcda 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityObjectHolder.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityObjectHolder.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IObjectHolder; @@ -20,6 +17,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -28,11 +26,16 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import java.util.List; -public class MetaTileEntityObjectHolder extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IObjectHolder { +public class MetaTileEntityObjectHolder extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart, IObjectHolder { // purposefully not exposed to automation or capabilities private final ObjectHolderHandler heldItems; @@ -138,7 +141,7 @@ public void setLocked(boolean locked) { @Override public @NotNull IItemHandler getAsHandler() { - //noinspection ReturnOfInnerClass + // noinspection ReturnOfInnerClass return this.heldItems; } @@ -234,7 +237,7 @@ public boolean isItemValid(int slot, @NotNull ItemStack stack) { } boolean isDataItem = false; - if (stack.getItem() instanceof MetaItem metaItem) { + if (stack.getItem() instanceof MetaItemmetaItem) { for (IItemBehaviour behaviour : metaItem.getBehaviours(stack)) { if (behaviour instanceof IDataItem) { isDataItem = true; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java index de63e673534..497b36e22f7 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IDataAccessHatch; @@ -16,17 +13,24 @@ import gregtech.api.recipes.Recipe; import gregtech.client.renderer.texture.Textures; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; -import javax.annotation.Nonnull; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.Collection; import java.util.List; -public class MetaTileEntityOpticalDataHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IOpticalDataAccessHatch { +import javax.annotation.Nonnull; + +public class MetaTileEntityOpticalDataHatch extends MetaTileEntityMultiblockNotifiablePart implements + IMultiblockAbilityPart, IOpticalDataAccessHatch { private final boolean isTransmitter; @@ -71,13 +75,15 @@ public boolean isRecipeAvailable(@Nonnull Recipe recipe, @Nonnull Collection { +public class MetaTileEntityPassthroughHatchFluid extends MetaTileEntityMultiblockPart implements IPassthroughHatch, + IMultiblockAbilityPart { private static final int TANK_SIZE = 16_000; @@ -82,7 +86,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, // back side output Textures.PIPE_OUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, pipeline); - Textures.FLUID_HATCH_OUTPUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, pipeline); + Textures.FLUID_HATCH_OUTPUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, + pipeline); } } @@ -110,10 +115,11 @@ private ModularUI.Builder createUITemplate(EntityPlayer player, int rowSize) { for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { int index = y * rowSize + x; - builder.widget(new TankWidget(fluidTankList.getTankAt(index), 89 - rowSize * 9 + x * 18, 18 + y * 18, 18, 18) - .setBackgroundTexture(GuiTextures.FLUID_SLOT) - .setContainerClicking(true, true) - .setAlwaysShowFull(true)); + builder.widget( + new TankWidget(fluidTankList.getTankAt(index), 89 - rowSize * 9 + x * 18, 18 + y * 18, 18, 18) + .setBackgroundTexture(GuiTextures.FLUID_SLOT) + .setContainerClicking(true, true) + .setAlwaysShowFull(true)); } } return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, 7, 18 + 18 * rowSize + 12); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java index 41002c534f6..64baf3c2d36 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.ItemHandlerProxy; import gregtech.api.capability.impl.NotifiableItemStackHandler; import gregtech.api.gui.GuiTextures; @@ -15,6 +12,7 @@ import gregtech.api.metatileentity.multiblock.IPassthroughHatch; import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -29,11 +27,17 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityPassthroughHatchItem extends MetaTileEntityMultiblockPart implements IPassthroughHatch, IMultiblockAbilityPart { +public class MetaTileEntityPassthroughHatchItem extends MetaTileEntityMultiblockPart implements IPassthroughHatch, + IMultiblockAbilityPart { private ItemStackHandler itemStackHandler; @@ -82,7 +86,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, // back side output Textures.PIPE_OUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, pipeline); - Textures.ITEM_HATCH_OUTPUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, pipeline); + Textures.ITEM_HATCH_OUTPUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, + pipeline); } } @@ -112,7 +117,7 @@ private ModularUI.Builder createUITemplate(EntityPlayer player, int rowSize) { int index = y * rowSize + x; builder.widget(new SlotWidget(itemStackHandler, index, (88 - rowSize * 9 + x * 18), 18 + y * 18, true, true) - .setBackgroundTexture(GuiTextures.SLOT)); + .setBackgroundTexture(GuiTextures.SLOT)); } } return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, 7, 18 + 18 * rowSize + 12); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java index 17dcb28d766..d8f4e9ae716 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.FilteredItemHandler; import gregtech.api.capability.impl.FluidTankList; @@ -15,6 +12,7 @@ import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -32,12 +30,18 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; import java.util.function.Consumer; -public class MetaTileEntityReservoirHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class MetaTileEntityReservoirHatch extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart { private final InfiniteWaterTank fluidTank; @@ -92,7 +96,8 @@ protected FluidTankList createImportFluidHandler() { @Override protected IItemHandlerModifiable createImportItemHandler() { - return new FilteredItemHandler(this).setFillPredicate(FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); + return new FilteredItemHandler(this).setFillPredicate( + FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); } @Override @@ -159,7 +164,8 @@ private Consumer> getFluidAmountText(TankWidget tankWidget) } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", getInventorySize())); tooltip.add(I18n.format("gregtech.universal.enabled")); } @@ -171,6 +177,7 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t } private static class InfiniteWaterTank extends NotifiableFluidTank { + private final FluidStack BIG_WATER = new FluidStack(FluidRegistry.WATER, Integer.MAX_VALUE); public InfiniteWaterTank(int capacity, MetaTileEntity entityToNotify) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java index 0da91d04d61..df13c768d74 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IRotorHolder; import gregtech.api.damagesources.DamageSources; @@ -19,6 +15,7 @@ import gregtech.common.items.behaviors.TurbineRotorBehavior; import gregtech.common.metatileentities.multi.electric.generator.MetaTileEntityLargeTurbine; import gregtech.core.advancement.AdvancementTriggers; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -33,11 +30,18 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityRotorHolder extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IRotorHolder { +public class MetaTileEntityRotorHolder extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart, IRotorHolder { static final int SPEED_INCREMENT = 1; static final int SPEED_DECREMENT = 3; @@ -257,17 +261,20 @@ private int getTierDifference() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { return onRotorHolderInteract(playerIn) || super.onRightClick(playerIn, hand, facing, hitResult); } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { return onRotorHolderInteract(playerIn) || super.onWrenchClick(playerIn, hand, facing, hitResult); } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { return onRotorHolderInteract(playerIn); } @@ -382,35 +389,34 @@ private boolean hasRotor() { private int getRotorColor() { if (!hasRotor()) return -1; - //noinspection ConstantConditions + // noinspection ConstantConditions return getTurbineBehavior().getPartMaterial(getStackInSlot(0)).getMaterialRGB(); - } private int getRotorDurabilityPercent() { if (!hasRotor()) return 0; - //noinspection ConstantConditions + // noinspection ConstantConditions return getTurbineBehavior().getRotorDurabilityPercent(getStackInSlot(0)); } private int getRotorEfficiency() { if (!hasRotor()) return -1; - //noinspection ConstantConditions + // noinspection ConstantConditions return getTurbineBehavior().getRotorEfficiency(getTurbineStack()); } private int getRotorPower() { if (!hasRotor()) return -1; - //noinspection ConstantConditions + // noinspection ConstantConditions return getTurbineBehavior().getRotorPower(getTurbineStack()); } private void damageRotor(int damageAmount) { if (!hasRotor()) return; - //noinspection ConstantConditions + // noinspection ConstantConditions getTurbineBehavior().applyRotorDamage(getStackInSlot(0), damageAmount); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntitySubstationEnergyHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntitySubstationEnergyHatch.java index 5db2a2fdea8..d2ed31587aa 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntitySubstationEnergyHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntitySubstationEnergyHatch.java @@ -4,10 +4,12 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.MultiblockAbility; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -16,7 +18,8 @@ // much higher amperages, without hard-coding values in the super class. public class MetaTileEntitySubstationEnergyHatch extends MetaTileEntityEnergyHatch { - public MetaTileEntitySubstationEnergyHatch(ResourceLocation metaTileEntityId, int tier, int amperage, boolean isExportHatch) { + public MetaTileEntitySubstationEnergyHatch(ResourceLocation metaTileEntityId, int tier, int amperage, + boolean isExportHatch) { super(metaTileEntityId, tier, amperage, isExportHatch); } @@ -31,7 +34,8 @@ public MultiblockAbility getAbility() { } @Override - protected void addDescriptorTooltip(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { + protected void addDescriptorTooltip(ItemStack stack, @Nullable World world, List tooltip, + boolean advanced) { if (isExportHatch) { tooltip.add(I18n.format("gregtech.machine.substation_hatch.output.tooltip")); } else { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/ExportOnlyAESlot.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/ExportOnlyAESlot.java index 8bfbbf8fe53..e6a01b5e09f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/ExportOnlyAESlot.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/ExportOnlyAESlot.java @@ -1,9 +1,10 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng; -import appeng.api.storage.data.IAEStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.INBTSerializable; +import appeng.api.storage.data.IAEStack; + import javax.annotation.Nullable; /** @@ -11,7 +12,9 @@ * @Description A export only slot to hold {@link IAEStack} * @date 2023/4/22-13:42 */ -public abstract class ExportOnlyAESlot> implements IConfigurableSlot, INBTSerializable { +public abstract class ExportOnlyAESlot> + implements IConfigurableSlot, INBTSerializable { + protected final static String CONFIG_TAG = "config"; protected final static String STOCK_TAG = "stock"; protected T config; @@ -99,5 +102,4 @@ public void setConfig(T val) { public void setStock(T val) { this.stock = val; } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/IConfigurableSlot.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/IConfigurableSlot.java index 3e0ac7b2add..6cc3a48771d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/IConfigurableSlot.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/IConfigurableSlot.java @@ -16,5 +16,4 @@ public interface IConfigurableSlot { void setStock(T val); IConfigurableSlot copy(); - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java index 5680dbcbdb6..7d6866b2a6f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java @@ -1,5 +1,20 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng; +import gregtech.api.GTValues; +import gregtech.api.capability.IControllable; +import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.client.renderer.ICubeRenderer; +import gregtech.client.renderer.texture.Textures; +import gregtech.common.ConfigHolder; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockNotifiablePart; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; +import net.minecraft.util.ResourceLocation; + import appeng.api.AEApi; import appeng.api.networking.GridFlags; import appeng.api.networking.security.IActionHost; @@ -15,34 +30,25 @@ import appeng.me.helpers.BaseActionSource; import appeng.me.helpers.IGridProxyable; import appeng.me.helpers.MachineSource; -import gregtech.api.GTValues; -import gregtech.api.capability.IControllable; -import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.client.renderer.ICubeRenderer; -import gregtech.client.renderer.texture.Textures; -import gregtech.common.ConfigHolder; -import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockNotifiablePart; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.IOException; import java.util.EnumSet; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @Author GlodBlock * @Description It can connect to ME network. * @Date 2023/4/18-23:17 */ -public abstract class MetaTileEntityAEHostablePart extends MetaTileEntityMultiblockNotifiablePart implements IControllable { +public abstract class MetaTileEntityAEHostablePart extends MetaTileEntityMultiblockNotifiablePart + implements IControllable { - protected static final IStorageChannel ITEM_NET = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class); - protected static final IStorageChannel FLUID_NET = AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class); + protected static final IStorageChannel ITEM_NET = AEApi.instance().storage() + .getStorageChannel(IItemStorageChannel.class); + protected static final IStorageChannel FLUID_NET = AEApi.instance().storage() + .getStorageChannel(IFluidStorageChannel.class); private final static int ME_UPDATE_INTERVAL = ConfigHolder.compat.ae2.updateIntervals; private AENetworkProxy aeProxy; @@ -166,6 +172,7 @@ public void gridChanged() { /** * Update me network connection status. + * * @return the updated status. */ public boolean updateMEStatus() { @@ -192,7 +199,8 @@ protected IActionSource getActionSource() { @Nullable private AENetworkProxy createProxy() { if (this.getHolder() instanceof IGridProxyable) { - AENetworkProxy proxy = new AENetworkProxy((IGridProxyable) this.getHolder(), "mte_proxy", this.getStackForm(), true); + AENetworkProxy proxy = new AENetworkProxy((IGridProxyable) this.getHolder(), "mte_proxy", + this.getStackForm(), true); proxy.setFlags(GridFlags.REQUIRE_CHANNEL); proxy.setIdlePowerUsage(ConfigHolder.compat.ae2.meHatchEnergyUsage); proxy.setValidSides(EnumSet.of(this.getFrontFacing())); @@ -200,5 +208,4 @@ private AENetworkProxy createProxy() { } return null; } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java index cf86a8e3c0f..67e0a12fdcd 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java @@ -1,12 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng; -import appeng.api.config.Actionable; -import appeng.api.storage.IMEMonitor; -import appeng.api.storage.data.IAEItemStack; -import appeng.me.GridAccessException; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -20,6 +13,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.gui.widget.appeng.AEItemConfigWidget; import gregtech.common.metatileentities.multi.multiblockpart.appeng.stack.WrappedItemStack; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -33,17 +27,27 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import appeng.api.config.Actionable; +import appeng.api.storage.IMEMonitor; +import appeng.api.storage.data.IAEItemStack; +import appeng.me.GridAccessException; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; import java.util.function.Consumer; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @Author GlodBlock * @Description The Input Bus that can auto fetch item ME storage network. * @Date 2023/4/22-13:34 */ -public class MetaTileEntityMEInputBus extends MetaTileEntityAEHostablePart implements IMultiblockAbilityPart { +public class MetaTileEntityMEInputBus extends MetaTileEntityAEHostablePart + implements IMultiblockAbilityPart { public final static String ITEM_BUFFER_TAG = "ItemSlots"; public final static String WORKING_TAG = "WorkingEnabled"; @@ -83,7 +87,8 @@ public void update() { IAEItemStack exceedItem = aeSlot.exceedStack(); if (exceedItem != null) { long total = exceedItem.getStackSize(); - IAEItemStack notInserted = aeNetwork.injectItems(exceedItem, Actionable.MODULATE, this.getActionSource()); + IAEItemStack notInserted = aeNetwork.injectItems(exceedItem, Actionable.MODULATE, + this.getActionSource()); if (notInserted != null && notInserted.getStackSize() > 0) { aeSlot.extractItem(0, (int) (total - notInserted.getStackSize()), false); continue; @@ -94,14 +99,14 @@ public void update() { // Fill it IAEItemStack reqItem = aeSlot.requestStack(); if (reqItem != null) { - IAEItemStack extracted = aeNetwork.extractItems(reqItem, Actionable.MODULATE, this.getActionSource()); + IAEItemStack extracted = aeNetwork.extractItems(reqItem, Actionable.MODULATE, + this.getActionSource()); if (extracted != null) { aeSlot.addStack(extracted); } } } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} } } } @@ -119,8 +124,7 @@ public void onRemoval() { aeNetwork.injectItems(stock, Actionable.MODULATE, this.getActionSource()); } } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} super.onRemoval(); } @@ -136,8 +140,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .label(10, 5, getMetaFullName()); // ME Network status builder.dynamicLabel(10, 15, () -> this.isOnline ? - I18n.format("gregtech.gui.me_network.online") : - I18n.format("gregtech.gui.me_network.offline"), + I18n.format("gregtech.gui.me_network.online") : + I18n.format("gregtech.gui.me_network.offline"), 0xFFFFFFFF); // Config slots @@ -186,7 +190,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound data) { super.writeToNBT(data); data.setBoolean(WORKING_TAG, this.workingEnabled); NBTTagList slots = new NBTTagList(); - for (int i = 0; i < CONFIG_SIZE; i ++) { + for (int i = 0; i < CONFIG_SIZE; i++) { ExportOnlyAEItem slot = this.aeItemHandler.inventory[i]; NBTTagCompound slotTag = new NBTTagCompound(); slotTag.setInteger("slot", i); @@ -223,7 +227,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.item_bus.import.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.item_import.tooltip")); @@ -244,11 +249,10 @@ private static class ExportOnlyAEItemList extends NotifiableItemStackHandler { ExportOnlyAEItem[] inventory; - public ExportOnlyAEItemList(MetaTileEntity holder, int slots, MetaTileEntity entityToNotify) { super(holder, slots, entityToNotify, false); this.inventory = new ExportOnlyAEItem[CONFIG_SIZE]; - for (int i = 0; i < CONFIG_SIZE; i ++) { + for (int i = 0; i < CONFIG_SIZE; i++) { this.inventory[i] = new ExportOnlyAEItem(null, null); } for (ExportOnlyAEItem slot : this.inventory) { @@ -258,7 +262,7 @@ public ExportOnlyAEItemList(MetaTileEntity holder, int slots, MetaTileEntity ent @Override public void deserializeNBT(NBTTagCompound nbt) { - for (int index = 0; index < CONFIG_SIZE; index ++) { + for (int index = 0; index < CONFIG_SIZE; index++) { if (nbt.hasKey("#" + index)) { NBTTagCompound slotTag = nbt.getCompoundTag("#" + index); this.inventory[index].deserializeNBT(slotTag); @@ -269,7 +273,7 @@ public void deserializeNBT(NBTTagCompound nbt) { @Override public NBTTagCompound serializeNBT() { NBTTagCompound nbt = new NBTTagCompound(); - for (int index = 0; index < CONFIG_SIZE; index ++) { + for (int index = 0; index < CONFIG_SIZE; index++) { NBTTagCompound slot = this.inventory[index].serializeNBT(); nbt.setTag("#" + index, slot); } @@ -319,10 +323,10 @@ public int getSlotLimit(int slot) { protected int getStackLimit(int slot, @Nonnull ItemStack stack) { return Integer.MAX_VALUE; } - } public static class ExportOnlyAEItem extends ExportOnlyAESlot implements IItemHandlerModifiable { + private Consumer trigger; public ExportOnlyAEItem(IAEItemStack config, IAEItemStack stock) { @@ -347,8 +351,7 @@ public void deserializeNBT(NBTTagCompound nbt) { public ExportOnlyAEItem copy() { return new ExportOnlyAEItem( this.config == null ? null : this.config.copy(), - this.stock == null ? null : this.stock.copy() - ); + this.stock == null ? null : this.stock.copy()); } @Override @@ -432,5 +435,4 @@ public int getSlotLimit(int slot) { return Integer.MAX_VALUE; } } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java index 9e5096150c9..0ce47737b7d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java @@ -1,12 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng; -import appeng.api.config.Actionable; -import appeng.api.storage.IMEMonitor; -import appeng.api.storage.data.IAEFluidStack; -import appeng.me.GridAccessException; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -21,6 +14,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.gui.widget.appeng.AEFluidConfigWidget; import gregtech.common.metatileentities.multi.multiblockpart.appeng.stack.WrappedFluidStack; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -39,18 +33,28 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import appeng.api.config.Actionable; +import appeng.api.storage.IMEMonitor; +import appeng.api.storage.data.IAEFluidStack; +import appeng.me.GridAccessException; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @Author GlodBlock * @Description The Input Hatch that can auto fetch fluid ME storage network. * @Date 2023/4/20-21:21 */ -public class MetaTileEntityMEInputHatch extends MetaTileEntityAEHostablePart implements IMultiblockAbilityPart { +public class MetaTileEntityMEInputHatch extends MetaTileEntityAEHostablePart + implements IMultiblockAbilityPart { public final static String FLUID_BUFFER_TAG = "FluidTanks"; public final static String WORKING_TAG = "WorkingEnabled"; @@ -66,7 +70,7 @@ public MetaTileEntityMEInputHatch(ResourceLocation metaTileEntityId) { @Override protected void initializeInventory() { this.aeFluidTanks = new ExportOnlyAEFluid[CONFIG_SIZE]; - for (int i = 0; i < CONFIG_SIZE; i ++) { + for (int i = 0; i < CONFIG_SIZE; i++) { this.aeFluidTanks[i] = new ExportOnlyAEFluid(this, null, null, this.getController()); } super.initializeInventory(); @@ -89,7 +93,8 @@ public void update() { IAEFluidStack exceedFluid = aeTank.exceedStack(); if (exceedFluid != null) { long total = exceedFluid.getStackSize(); - IAEFluidStack notInserted = aeNetwork.injectItems(exceedFluid, Actionable.MODULATE, this.getActionSource()); + IAEFluidStack notInserted = aeNetwork.injectItems(exceedFluid, Actionable.MODULATE, + this.getActionSource()); if (notInserted != null && notInserted.getStackSize() > 0) { aeTank.drain((int) (total - notInserted.getStackSize()), true); continue; @@ -100,14 +105,14 @@ public void update() { // Fill it IAEFluidStack reqFluid = aeTank.requestStack(); if (reqFluid != null) { - IAEFluidStack extracted = aeNetwork.extractItems(reqFluid, Actionable.MODULATE, this.getActionSource()); + IAEFluidStack extracted = aeNetwork.extractItems(reqFluid, Actionable.MODULATE, + this.getActionSource()); if (extracted != null) { aeTank.addStack(extracted); } } } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} } } } @@ -125,8 +130,7 @@ public void onRemoval() { aeNetwork.injectItems(stock, Actionable.MODULATE, this.getActionSource()); } } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} super.onRemoval(); } @@ -142,8 +146,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .label(10, 5, getMetaFullName()); // ME Network status builder.dynamicLabel(10, 15, () -> this.isOnline ? - I18n.format("gregtech.gui.me_network.online") : - I18n.format("gregtech.gui.me_network.offline"), + I18n.format("gregtech.gui.me_network.online") : + I18n.format("gregtech.gui.me_network.offline"), 0xFFFFFFFF); // Config slots @@ -192,7 +196,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound data) { super.writeToNBT(data); data.setBoolean(WORKING_TAG, this.workingEnabled); NBTTagList tanks = new NBTTagList(); - for (int i = 0; i < CONFIG_SIZE; i ++) { + for (int i = 0; i < CONFIG_SIZE; i++) { ExportOnlyAEFluid tank = this.aeFluidTanks[i]; NBTTagCompound tankTag = new NBTTagCompound(); tankTag.setInteger("slot", i); @@ -228,7 +232,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.fluid_hatch.import.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.fluid_import.tooltip")); @@ -245,7 +250,9 @@ public void registerAbilities(List list) { list.addAll(Arrays.asList(this.aeFluidTanks)); } - public static class ExportOnlyAEFluid extends ExportOnlyAESlot implements IFluidTank, INotifiableHandler, IFluidHandler { + public static class ExportOnlyAEFluid extends ExportOnlyAESlot + implements IFluidTank, INotifiableHandler, IFluidHandler { + private final List notifiableEntities = new ArrayList<>(); private MetaTileEntity holder; @@ -390,9 +397,7 @@ public ExportOnlyAEFluid copy() { this.holder, this.config == null ? null : this.config.copy(), this.stock == null ? null : this.stock.copy(), - null - ); + null); } } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputBus.java index a75f6bc96ef..8f84d35c711 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputBus.java @@ -1,14 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng; -import appeng.api.config.Actionable; -import appeng.api.storage.IMEMonitor; -import appeng.api.storage.data.IAEItemStack; -import appeng.api.storage.data.IItemList; -import appeng.me.GridAccessException; -import appeng.util.item.AEItemStack; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -24,6 +15,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.gui.widget.appeng.AEItemGridWidget; import gregtech.common.inventory.appeng.SerializableItemList; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -36,17 +28,29 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import appeng.api.config.Actionable; +import appeng.api.storage.IMEMonitor; +import appeng.api.storage.data.IAEItemStack; +import appeng.api.storage.data.IItemList; +import appeng.me.GridAccessException; +import appeng.util.item.AEItemStack; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @Author GlodBlock * @Description The Output Bus that can directly send its contents to ME storage network. * @Date 2023/4/19-20:37 */ -public class MetaTileEntityMEOutputBus extends MetaTileEntityAEHostablePart implements IMultiblockAbilityPart { +public class MetaTileEntityMEOutputBus extends MetaTileEntityAEHostablePart + implements IMultiblockAbilityPart { public final static String ITEM_BUFFER_TAG = "ItemBuffer"; public final static String WORKING_TAG = "WorkingEnabled"; @@ -73,15 +77,15 @@ public void update() { try { IMEMonitor aeNetwork = this.getProxy().getStorage().getInventory(ITEM_NET); for (IAEItemStack item : this.internalBuffer) { - IAEItemStack notInserted = aeNetwork.injectItems(item.copy(), Actionable.MODULATE, this.getActionSource()); + IAEItemStack notInserted = aeNetwork.injectItems(item.copy(), Actionable.MODULATE, + this.getActionSource()); if (notInserted != null && notInserted.getStackSize() > 0) { item.setStackSize(notInserted.getStackSize()); } else { item.reset(); } } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} } } } @@ -94,8 +98,7 @@ public void onRemoval() { for (IAEItemStack item : this.internalBuffer) { aeNetwork.injectItems(item.copy(), Actionable.MODULATE, this.getActionSource()); } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} super.onRemoval(); } @@ -111,8 +114,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .label(10, 5, getMetaFullName()); // ME Network status builder.dynamicLabel(10, 15, () -> this.isOnline ? - I18n.format("gregtech.gui.me_network.online") : - I18n.format("gregtech.gui.me_network.offline"), + I18n.format("gregtech.gui.me_network.online") : + I18n.format("gregtech.gui.me_network.offline"), 0xFFFFFFFF); builder.label(10, 25, "gregtech.gui.waiting_list", 0xFFFFFFFF); builder.widget(new AEItemGridWidget(10, 35, 3, this.internalBuffer)); @@ -183,7 +186,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.item_bus.export.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.item_export.tooltip")); @@ -210,11 +214,13 @@ public void addToMultiBlock(MultiblockControllerBase controllerBase) { } private static class InaccessibleInfiniteSlot implements IItemHandlerModifiable, INotifiableHandler { + private final IItemList internalBuffer; private final List notifiableEntities = new ArrayList<>(); private final MetaTileEntity holder; - public InaccessibleInfiniteSlot(MetaTileEntity holder, IItemList internalBuffer, MetaTileEntity mte) { + public InaccessibleInfiniteSlot(MetaTileEntity holder, IItemList internalBuffer, + MetaTileEntity mte) { this.holder = holder; this.internalBuffer = internalBuffer; this.notifiableEntities.add(mte); @@ -281,5 +287,4 @@ private void trigger() { } } } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputHatch.java index 1a7bb420560..8eb67f78225 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputHatch.java @@ -1,14 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng; -import appeng.api.config.Actionable; -import appeng.api.storage.IMEMonitor; -import appeng.api.storage.data.IAEFluidStack; -import appeng.api.storage.data.IItemList; -import appeng.fluids.util.AEFluidStack; -import appeng.me.GridAccessException; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -24,6 +15,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.gui.widget.appeng.AEFluidGridWidget; import gregtech.common.inventory.appeng.SerializableFluidList; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -38,17 +30,29 @@ import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidTank; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import appeng.api.config.Actionable; +import appeng.api.storage.IMEMonitor; +import appeng.api.storage.data.IAEFluidStack; +import appeng.api.storage.data.IItemList; +import appeng.fluids.util.AEFluidStack; +import appeng.me.GridAccessException; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @Author GlodBlock * @Description The Output Hatch that can directly send its contents to ME storage network. * @Date 2023/4/19-1:18 */ -public class MetaTileEntityMEOutputHatch extends MetaTileEntityAEHostablePart implements IMultiblockAbilityPart { +public class MetaTileEntityMEOutputHatch extends MetaTileEntityAEHostablePart + implements IMultiblockAbilityPart { public final static String FLUID_BUFFER_TAG = "FluidBuffer"; public final static String WORKING_TAG = "WorkingEnabled"; @@ -75,15 +79,15 @@ public void update() { try { IMEMonitor aeNetwork = this.getProxy().getStorage().getInventory(FLUID_NET); for (IAEFluidStack fluid : this.internalBuffer) { - IAEFluidStack notInserted = aeNetwork.injectItems(fluid.copy(), Actionable.MODULATE, this.getActionSource()); + IAEFluidStack notInserted = aeNetwork.injectItems(fluid.copy(), Actionable.MODULATE, + this.getActionSource()); if (notInserted != null && notInserted.getStackSize() > 0) { fluid.setStackSize(notInserted.getStackSize()); } else { fluid.reset(); } } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} } } } @@ -96,8 +100,7 @@ public void onRemoval() { for (IAEFluidStack fluid : this.internalBuffer) { aeNetwork.injectItems(fluid.copy(), Actionable.MODULATE, this.getActionSource()); } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} super.onRemoval(); } @@ -113,8 +116,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .label(10, 5, getMetaFullName()); // ME Network status builder.dynamicLabel(10, 15, () -> this.isOnline ? - I18n.format("gregtech.gui.me_network.online") : - I18n.format("gregtech.gui.me_network.offline"), + I18n.format("gregtech.gui.me_network.online") : + I18n.format("gregtech.gui.me_network.offline"), 0xFFFFFFFF); builder.label(10, 25, "gregtech.gui.waiting_list", 0xFFFFFFFF); builder.widget(new AEFluidGridWidget(10, 35, 3, this.internalBuffer)); @@ -185,7 +188,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.fluid_hatch.export.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.fluid_export.tooltip")); @@ -212,11 +216,13 @@ public void addToMultiBlock(MultiblockControllerBase controllerBase) { } private static class InaccessibleInfiniteTank implements IFluidTank, INotifiableHandler { + private final IItemList internalBuffer; private final List notifiableEntities = new ArrayList<>(); private final MetaTileEntity holder; - public InaccessibleInfiniteTank(MetaTileEntity holder, IItemList internalBuffer, MetaTileEntity mte) { + public InaccessibleInfiniteTank(MetaTileEntity holder, IItemList internalBuffer, + MetaTileEntity mte) { this.holder = holder; this.internalBuffer = internalBuffer; this.notifiableEntities.add(mte); @@ -280,5 +286,4 @@ private void trigger() { } } } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedFluidStack.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedFluidStack.java index ba379c9bd24..06aa7a5a41c 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedFluidStack.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedFluidStack.java @@ -1,5 +1,11 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng.stack; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + import appeng.api.AEApi; import appeng.api.config.FuzzyMode; import appeng.api.storage.IStorageChannel; @@ -7,15 +13,11 @@ import appeng.api.storage.data.IAEFluidStack; import appeng.fluids.util.AEFluidStack; import io.netty.buffer.ByteBuf; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; import java.nio.charset.StandardCharsets; +import javax.annotation.Nonnull; + /** * @Author GlodBlock * @Date 2023/4/22-19:25 @@ -141,7 +143,7 @@ public boolean fuzzyComparison(IAEFluidStack stack, FuzzyMode fuzzyMode) { @Override public void writeToPacket(ByteBuf buffer) { byte[] name = this.delegate.getFluid().getName().getBytes(StandardCharsets.UTF_8); - buffer.writeByte((byte)name.length); + buffer.writeByte((byte) name.length); buffer.writeBytes(name); buffer.writeInt(this.delegate.amount); } @@ -189,7 +191,8 @@ public boolean equals(Object other) { return ((WrappedFluidStack) other).delegate.isFluidEqual(this.delegate); } else if (other instanceof FluidStack) { return ((FluidStack) other).isFluidEqual(this.delegate); - } return false; + } + return false; } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java index 23529516cf3..14efe091f7d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java @@ -1,5 +1,10 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng.stack; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fml.common.network.ByteBufUtils; + import appeng.api.config.FuzzyMode; import appeng.api.storage.IStorageChannel; import appeng.api.storage.channels.IItemStorageChannel; @@ -7,10 +12,6 @@ import appeng.core.Api; import appeng.util.item.AEItemStack; import io.netty.buffer.ByteBuf; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fml.common.network.ByteBufUtils; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -213,7 +214,8 @@ public boolean equals(ItemStack itemStack) { public boolean equals(Object other) { if (other instanceof IAEItemStack) { return this.delegate.isItemEqual(((IAEItemStack) other).createItemStack()); - } if (other instanceof ItemStack) { + } + if (other instanceof ItemStack) { return this.delegate.isItemEqual((ItemStack) other); } return false; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCABridge.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCABridge.java index 41112608963..9af74c4227b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCABridge.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCABridge.java @@ -7,6 +7,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; + import net.minecraft.util.ResourceLocation; public class MetaTileEntityHPCABridge extends MetaTileEntityHPCAComponent { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComponent.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComponent.java index 0b9fd6b3139..4a8da7d2234 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComponent.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComponent.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart.hpca; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IHPCAComponentHatch; @@ -21,6 +18,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.multi.electric.MetaTileEntityHPCA; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -30,12 +28,17 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; -public abstract class MetaTileEntityHPCAComponent extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IHPCAComponentHatch { +public abstract class MetaTileEntityHPCAComponent extends MetaTileEntityMultiblockPart implements + IMultiblockAbilityPart, IHPCAComponentHatch { private boolean damaged; @@ -117,7 +120,8 @@ public boolean canPartShare() { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { if (isBridge()) { tooltip.add(I18n.format("gregtech.machine.hpca.component_type.bridge")); } @@ -137,14 +141,16 @@ public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip.add(I18n.format("gregtech.machine.hpca.component_type.cooler_active_coolant", provider.getMaxCoolantPerTick(), I18n.format(Materials.PCBCoolant.getUnlocalizedName()))); } else { - tooltip.add(I18n.format("gregtech.machine.hpca.component_type.cooler_passive")); + tooltip.add(I18n.format("gregtech.machine.hpca.component_type.cooler_passive")); } - tooltip.add(I18n.format("gregtech.machine.hpca.component_type.cooler_cooling", provider.getCoolingAmount())); + tooltip.add( + I18n.format("gregtech.machine.hpca.component_type.cooler_cooling", provider.getCoolingAmount())); } if (this instanceof IHPCAComputationProvider provider) { tooltip.add(I18n.format("gregtech.machine.hpca.component_type.computation_cwut", provider.getCWUPerTick())); - tooltip.add(I18n.format("gregtech.machine.hpca.component_type.computation_cooling", provider.getCoolingPerTick())); + tooltip.add(I18n.format("gregtech.machine.hpca.component_type.computation_cooling", + provider.getCoolingPerTick())); } if (canBeDamaged()) { @@ -233,9 +239,11 @@ public boolean shouldDropWhenDestroyed() { public void getDrops(NonNullList dropsList, @Nullable EntityPlayer harvester) { if (canBeDamaged() && isDamaged()) { if (isAdvanced()) { - dropsList.add(MetaBlocks.COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.ADVANCED_COMPUTER_CASING)); + dropsList.add(MetaBlocks.COMPUTER_CASING + .getItemVariant(BlockComputerCasing.CasingType.ADVANCED_COMPUTER_CASING)); } else { - dropsList.add(MetaBlocks.COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_CASING)); + dropsList + .add(MetaBlocks.COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_CASING)); } } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComputation.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComputation.java index c0ad45c0dfb..a27376901c9 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComputation.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComputation.java @@ -8,6 +8,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; + import net.minecraft.util.ResourceLocation; public class MetaTileEntityHPCAComputation extends MetaTileEntityHPCAComponent implements IHPCAComputationProvider { @@ -38,14 +39,17 @@ public SimpleOverlayRenderer getFrontOverlay() { @Override public TextureArea getComponentIcon() { if (isDamaged()) { - return advanced ? GuiTextures.HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT : GuiTextures.HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT; + return advanced ? GuiTextures.HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT : + GuiTextures.HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT; } - return advanced ? GuiTextures.HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT : GuiTextures.HPCA_ICON_COMPUTATION_COMPONENT; + return advanced ? GuiTextures.HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT : + GuiTextures.HPCA_ICON_COMPUTATION_COMPONENT; } @Override public SimpleOverlayRenderer getFrontActiveOverlay() { - if (isDamaged()) return advanced ? Textures.HPCA_ADVANCED_DAMAGED_ACTIVE_OVERLAY : Textures.HPCA_DAMAGED_ACTIVE_OVERLAY; + if (isDamaged()) + return advanced ? Textures.HPCA_ADVANCED_DAMAGED_ACTIVE_OVERLAY : Textures.HPCA_DAMAGED_ACTIVE_OVERLAY; return advanced ? Textures.HPCA_ADVANCED_COMPUTATION_ACTIVE_OVERLAY : Textures.HPCA_COMPUTATION_ACTIVE_OVERLAY; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCACooler.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCACooler.java index d96354f50f7..90d00239f88 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCACooler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCACooler.java @@ -8,6 +8,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; + import net.minecraft.util.ResourceLocation; public class MetaTileEntityHPCACooler extends MetaTileEntityHPCAComponent implements IHPCACoolantProvider { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAEmpty.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAEmpty.java index c666ccba379..9c25261401e 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAEmpty.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAEmpty.java @@ -6,6 +6,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; + import net.minecraft.util.ResourceLocation; public class MetaTileEntityHPCAEmpty extends MetaTileEntityHPCAComponent { diff --git a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java index 41510d00689..97fae542c2d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java +++ b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java @@ -14,6 +14,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -22,9 +23,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; import static gregtech.client.renderer.texture.Textures.BRONZE_PLATED_BRICKS; import static gregtech.client.renderer.texture.Textures.SOLID_STEEL_CASING; diff --git a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java index 78300bb88b3..5fb3ee75612 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java @@ -15,6 +15,7 @@ import gregtech.common.blocks.BlockFireboxCasing; import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -23,9 +24,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntitySteamOven extends RecipeMapSteamMultiblockController { @@ -50,7 +52,8 @@ protected BlockPattern createStructurePattern() { .aisle("XXX", "CSC", "#C#") .where('S', selfPredicate()) .where('X', states(getFireboxState()) - .or(autoAbilities(true, false, false, false, false).setMinGlobalLimited(1).setMaxGlobalLimited(3))) + .or(autoAbilities(true, false, false, false, false).setMinGlobalLimited(1) + .setMaxGlobalLimited(3))) .where('C', states(getCasingState()).setMinGlobalLimited(6) .or(autoAbilities(false, false, true, true, false))) .where('#', any()) diff --git a/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java b/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java index 788093220fa..051db7649d3 100644 --- a/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java +++ b/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java @@ -1,11 +1,5 @@ package gregtech.common.metatileentities.primitive; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.block.IBlock; -import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -25,8 +19,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.behaviors.LighterBehaviour; import gregtech.common.metatileentities.MetaTileEntities; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.block.Block; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -48,16 +41,26 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.block.IBlock; +import crafttweaker.api.minecraft.CraftTweakerMC; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @ZenClass("mods.gregtech.machines.CharcoalPileIgniter") @ZenRegister public class MetaTileEntityCharcoalPileIgniter extends MultiblockControllerBase implements IWorkable { @@ -97,7 +100,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - Textures.CHARCOAL_PILE_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive, true); + Textures.CHARCOAL_PILE_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + isActive, true); } @Override @@ -128,8 +132,8 @@ protected BlockPattern createStructurePattern() { if (rDist < 1) rDist = MIN_RADIUS; if (hDist < 2) hDist = MIN_DEPTH; - //swap the left and right distances if the front facing is east or west - //i guess allows BlockPattern checkPatternAt to get the correct relative position, somehow. + // swap the left and right distances if the front facing is east or west + // i guess allows BlockPattern checkPatternAt to get the correct relative position, somehow. if (this.frontFacing == EnumFacing.EAST || this.frontFacing == EnumFacing.WEST) { int tmp = lDist; lDist = rDist; @@ -138,7 +142,7 @@ protected BlockPattern createStructurePattern() { StringBuilder wallBuilder = new StringBuilder(); // " XXX " StringBuilder floorBuilder = new StringBuilder(); // " BBB " - StringBuilder cornerBuilder = new StringBuilder(); // " " + StringBuilder cornerBuilder = new StringBuilder(); // " " StringBuilder ctrlBuilder = new StringBuilder(); // " XSX " StringBuilder woodBuilder = new StringBuilder(); // "XCCCX" @@ -181,7 +185,7 @@ protected BlockPattern createStructurePattern() { ctrlBuilder.append(" "); woodBuilder.append("X"); - String[] wall = new String[hDist + 1]; // " ", " XXX ", " " + String[] wall = new String[hDist + 1]; // " ", " XXX ", " " Arrays.fill(wall, wallBuilder.toString()); wall[0] = cornerBuilder.toString(); wall[wall.length - 1] = cornerBuilder.toString(); @@ -191,7 +195,7 @@ protected BlockPattern createStructurePattern() { slice[0] = floorBuilder.toString(); String[] center = Arrays.copyOf(slice, slice.length); // " BBB ", "XCCCX", " XSX " - //inverse the center slice if facing east or west. + // inverse the center slice if facing east or west. if (this.frontFacing == EnumFacing.EAST || this.frontFacing == EnumFacing.WEST) { center[center.length - 1] = ctrlBuilder.reverse().toString(); } else { @@ -218,7 +222,8 @@ protected BlockPattern createStructurePattern() { @Nonnull private TraceabilityPredicate logPredicate() { return new TraceabilityPredicate(blockWorldState -> { - if (blockWorldState.getBlockState().getBlock().isWood(blockWorldState.getWorld(), blockWorldState.getPos())) { + if (blockWorldState.getBlockState().getBlock().isWood(blockWorldState.getWorld(), + blockWorldState.getPos())) { // store the position of every log, so we can easily turn them into charcoal logPositions.add(blockWorldState.getPos()); return true; @@ -269,7 +274,8 @@ private boolean updateStructureDimensions() { return true; } - private static boolean isBlockWall(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, @Nonnull EnumFacing direction) { + private static boolean isBlockWall(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, + @Nonnull EnumFacing direction) { return WALL_BLOCKS.contains(world.getBlockState(pos.move(direction)).getBlock()); } @@ -342,7 +348,8 @@ protected boolean openGUIOnRightClick() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.charcoal_pile.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.charcoal_pile.tooltip.2")); @@ -455,9 +462,7 @@ public boolean isWorkingEnabled() { } @Override - public void setWorkingEnabled(boolean isActivationAllowed) { - - } + public void setWorkingEnabled(boolean isActivationAllowed) {} @Override public int getProgress() { @@ -502,7 +507,8 @@ public static void onItemUse(@Nonnull PlayerInteractEvent.RightClickBlock event) stack.damageItem(1, event.getEntityPlayer()); // flint and steel sound does not get played when handled like this - event.getWorld().playSound(null, event.getPos(), SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 1.0F, 1.0F); + event.getWorld().playSound(null, event.getPos(), SoundEvents.ITEM_FLINTANDSTEEL_USE, + SoundCategory.PLAYERS, 1.0F, 1.0F); shouldActivate = true; } else if (stack.getItem() instanceof ItemFireball) { @@ -510,7 +516,8 @@ public static void onItemUse(@Nonnull PlayerInteractEvent.RightClickBlock event) stack.shrink(1); // fire charge sound does not get played when handled like this - event.getWorld().playSound(null, event.getPos(), SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.PLAYERS, 1.0F, 1.0F); + event.getWorld().playSound(null, event.getPos(), SoundEvents.ITEM_FIRECHARGE_USE, + SoundCategory.PLAYERS, 1.0F, 1.0F); shouldActivate = true; } else if (stack.getItem() instanceof MetaItem) { @@ -518,9 +525,11 @@ public static void onItemUse(@Nonnull PlayerInteractEvent.RightClickBlock event) MetaItem.MetaValueItem valueItem = ((MetaItem) stack.getItem()).getItem(stack); if (valueItem != null) { for (IItemBehaviour behaviour : valueItem.getBehaviours()) { - if (behaviour instanceof LighterBehaviour && ((LighterBehaviour) behaviour).consumeFuel(event.getEntityPlayer(), stack)) { + if (behaviour instanceof LighterBehaviour && + ((LighterBehaviour) behaviour).consumeFuel(event.getEntityPlayer(), stack)) { // lighter sound does not get played when handled like this - event.getWorld().playSound(null, event.getPos(), SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 1.0F, 1.0F); + event.getWorld().playSound(null, event.getPos(), SoundEvents.ITEM_FLINTANDSTEEL_USE, + SoundCategory.PLAYERS, 1.0F, 1.0F); shouldActivate = true; break; diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamAlloySmelter.java b/src/main/java/gregtech/common/metatileentities/steam/SteamAlloySmelter.java index 2cb0ef88750..c75459c8df7 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamAlloySmelter.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamAlloySmelter.java @@ -10,6 +10,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; @@ -46,10 +47,13 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.FURNACE_OVERLAY_STEAM.get(isHighPressure)) - .slot(this.importItems, 1, 35, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.FURNACE_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.FURNACE_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 1, 35, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.FURNACE_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 79, 26, 20, 16, - GuiTextures.PROGRESS_BAR_ARROW_STEAM.get(isHighPressure), MoveType.HORIZONTAL, workableHandler.getRecipeMap()) + GuiTextures.PROGRESS_BAR_ARROW_STEAM.get(isHighPressure), MoveType.HORIZONTAL, + workableHandler.getRecipeMap()) .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure)) .build(getHolder(), player); } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamCompressor.java b/src/main/java/gregtech/common/metatileentities/steam/SteamCompressor.java index 2cfd574cf03..6e5ab571600 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamCompressor.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamCompressor.java @@ -9,6 +9,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; @@ -39,9 +40,11 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.COMPRESSOR_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.COMPRESSOR_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 78, 25, 20, 18, - GuiTextures.PROGRESS_BAR_COMPRESS_STEAM.get(isHighPressure), MoveType.HORIZONTAL, workableHandler.getRecipeMap()) + GuiTextures.PROGRESS_BAR_COMPRESS_STEAM.get(isHighPressure), MoveType.HORIZONTAL, + workableHandler.getRecipeMap()) .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure)) .build(getHolder(), player); } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamExtractor.java b/src/main/java/gregtech/common/metatileentities/steam/SteamExtractor.java index 326cfd50f34..e71cc0d1201 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamExtractor.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamExtractor.java @@ -9,6 +9,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; @@ -40,9 +41,11 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.EXTRACTOR_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.EXTRACTOR_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 79, 25, 20, 18, - GuiTextures.PROGRESS_BAR_EXTRACT_STEAM.get(isHighPressure), MoveType.HORIZONTAL, workableHandler.getRecipeMap()) + GuiTextures.PROGRESS_BAR_EXTRACT_STEAM.get(isHighPressure), MoveType.HORIZONTAL, + workableHandler.getRecipeMap()) .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure)) .build(getHolder(), player); } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamFurnace.java b/src/main/java/gregtech/common/metatileentities/steam/SteamFurnace.java index 3ab4d606469..ec1bfb1b2e9 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamFurnace.java @@ -9,6 +9,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; @@ -45,9 +46,11 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.FURNACE_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.FURNACE_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 79, 26, 20, 16, - GuiTextures.PROGRESS_BAR_ARROW_STEAM.get(isHighPressure), MoveType.HORIZONTAL, workableHandler.getRecipeMap()) + GuiTextures.PROGRESS_BAR_ARROW_STEAM.get(isHighPressure), MoveType.HORIZONTAL, + workableHandler.getRecipeMap()) .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure)) .build(getHolder(), player); } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamHammer.java b/src/main/java/gregtech/common/metatileentities/steam/SteamHammer.java index d07fec97104..f31bc66214f 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamHammer.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamHammer.java @@ -9,6 +9,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; @@ -39,9 +40,11 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.HAMMER_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.HAMMER_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 79, 25, 20, 18, - GuiTextures.PROGRESS_BAR_HAMMER_STEAM.get(isHighPressure), MoveType.VERTICAL_DOWNWARDS, workableHandler.getRecipeMap()) + GuiTextures.PROGRESS_BAR_HAMMER_STEAM.get(isHighPressure), MoveType.VERTICAL_DOWNWARDS, + workableHandler.getRecipeMap()) .image(79, 41, 20, 18, GuiTextures.PROGRESS_BAR_HAMMER_BASE_STEAM.get(isHighPressure)) .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure)) .build(getHolder(), player); diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamMacerator.java b/src/main/java/gregtech/common/metatileentities/steam/SteamMacerator.java index 9f242d44811..51a3716025d 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamMacerator.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamMacerator.java @@ -10,6 +10,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; @@ -42,10 +43,13 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 79, 26, 21, 18, - GuiTextures.PROGRESS_BAR_MACERATE_STEAM.get(isHighPressure), MoveType.HORIZONTAL, workableHandler.getRecipeMap()) - .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.DUST_OVERLAY_STEAM.get(isHighPressure)) + GuiTextures.PROGRESS_BAR_MACERATE_STEAM.get(isHighPressure), MoveType.HORIZONTAL, + workableHandler.getRecipeMap()) + .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.DUST_OVERLAY_STEAM.get(isHighPressure)) .build(getHolder(), player); } @@ -60,8 +64,10 @@ public void randomDisplayTick() { if (isActive()) { final BlockPos pos = getPos(); final float horizontalOffset = GTValues.RNG.nextFloat() * 0.6F - 0.3F; - getWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX() + horizontalOffset, pos.getY() + 0.52F, pos.getZ() + horizontalOffset, - GTValues.RNG.nextFloat() * 0.125F, GTValues.RNG.nextFloat() * 0.375F, GTValues.RNG.nextFloat() * 0.125F); + getWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX() + horizontalOffset, pos.getY() + 0.52F, + pos.getZ() + horizontalOffset, + GTValues.RNG.nextFloat() * 0.125F, GTValues.RNG.nextFloat() * 0.375F, + GTValues.RNG.nextFloat() * 0.125F); } } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java index f42401d1b17..50f298cb4e8 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.steam; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.*; import gregtech.api.capability.impl.CommonFluidFilters; import gregtech.api.capability.impl.FilteredFluidHandler; @@ -23,6 +19,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.ConfigHolder; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -46,14 +43,20 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class SteamMiner extends MetaTileEntity implements IMiner, IControllable, IVentable, IDataInfoProvider { private boolean needsVenting = false; @@ -75,7 +78,8 @@ public SteamMiner(ResourceLocation metaTileEntityId, int speed, int maximumRadiu @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new SteamMiner(metaTileEntityId, this.minerLogic.getSpeed(), this.minerLogic.getMaximumRadius(), this.minerLogic.getFortune()); + return new SteamMiner(metaTileEntityId, this.minerLogic.getSpeed(), this.minerLogic.getMaximumRadius(), + this.minerLogic.getFortune()); } @Override @@ -95,7 +99,8 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override @SideOnly(Side.CLIENT) public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - ColourMultiplier multiplier = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); + ColourMultiplier multiplier = new ColourMultiplier( + GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); IVertexOperation[] coloredPipeline = ArrayUtils.add(pipeline, multiplier); Textures.STEAM_CASING_BRONZE.render(renderState, translation, coloredPipeline); for (EnumFacing renderSide : EnumFacing.HORIZONTALS) { @@ -132,7 +137,6 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { builder.widget(new AdvancedTextWidget(70, 19, this::addDisplayText2, 0xFFFFFF) .setMaxWidthLimit(84)); - return builder.build(getHolder(), entityPlayer); } @@ -143,17 +147,22 @@ void addDisplayText(List textList) { textList.add(new TextComponentTranslation("gregtech.machine.miner.startz", this.minerLogic.getZ().get())); textList.add(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); if (this.minerLogic.isDone()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.done").setStyle(new Style().setColor(TextFormatting.GREEN))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.done") + .setStyle(new Style().setColor(TextFormatting.GREEN))); else if (this.minerLogic.isWorking()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.working").setStyle(new Style().setColor(TextFormatting.GOLD))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.working") + .setStyle(new Style().setColor(TextFormatting.GOLD))); else if (!this.isWorkingEnabled()) textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); if (this.isInventoryFull) - textList.add(new TextComponentTranslation("gregtech.machine.miner.invfull").setStyle(new Style().setColor(TextFormatting.RED))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.invfull") + .setStyle(new Style().setColor(TextFormatting.RED))); if (ventingStuck) - textList.add(new TextComponentTranslation("gregtech.machine.steam_miner.vent").setStyle(new Style().setColor(TextFormatting.RED))); + textList.add(new TextComponentTranslation("gregtech.machine.steam_miner.vent") + .setStyle(new Style().setColor(TextFormatting.RED))); else if (!drainEnergy(true)) - textList.add(new TextComponentTranslation("gregtech.machine.steam_miner.steam").setStyle(new Style().setColor(TextFormatting.RED))); + textList.add(new TextComponentTranslation("gregtech.machine.steam_miner.steam") + .setStyle(new Style().setColor(TextFormatting.RED))); } void addDisplayText2(List textList) { @@ -164,8 +173,8 @@ void addDisplayText2(List textList) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_tick_steam", energyPerTick) - + TextFormatting.GRAY + ", " + I18n.format("gregtech.machine.miner.per_block", this.minerLogic.getSpeed() / 20)); + tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_tick_steam", energyPerTick) + TextFormatting.GRAY + + ", " + I18n.format("gregtech.machine.miner.per_block", this.minerLogic.getSpeed() / 20)); int maxArea = getWorkingArea(minerLogic.getMaximumRadius()); tooltip.add(I18n.format("gregtech.universal.tooltip.working_area", maxArea, maxArea)); } @@ -248,7 +257,8 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { @SideOnly(Side.CLIENT) public Pair getParticleTexture() { - return Pair.of(Textures.STEAM_CASING_BRONZE.getSpriteOnSide(SimpleSidedCubeRenderer.RenderSide.TOP), getPaintingColorForRendering()); + return Pair.of(Textures.STEAM_CASING_BRONZE.getSpriteOnSide(SimpleSidedCubeRenderer.RenderSide.TOP), + getPaintingColorForRendering()); } public void setVentingStuck(boolean ventingStuck) { @@ -311,14 +321,20 @@ public void tryDoVenting() { BlockPos ventingBlockPos = machinePos.offset(ventingSide); IBlockState blockOnPos = this.getWorld().getBlockState(ventingBlockPos); if (blockOnPos.getCollisionBoundingBox(this.getWorld(), ventingBlockPos) == Block.NULL_AABB) { - this.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), EntitySelectors.CAN_AI_TARGET).forEach((entity) -> entity.attackEntityFrom(DamageSources.getHeatDamage(), 6.0F)); + this.getWorld() + .getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), + EntitySelectors.CAN_AI_TARGET) + .forEach((entity) -> entity.attackEntityFrom(DamageSources.getHeatDamage(), 6.0F)); WorldServer world = (WorldServer) this.getWorld(); double posX = (double) machinePos.getX() + 0.5D + (double) ventingSide.getXOffset() * 0.6D; double posY = (double) machinePos.getY() + 0.5D + (double) ventingSide.getYOffset() * 0.6D; double posZ = (double) machinePos.getZ() + 0.5D + (double) ventingSide.getZOffset() * 0.6D; - world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, posX, posY, posZ, 7 + world.rand.nextInt(3), (double) ventingSide.getXOffset() / 2.0D, (double) ventingSide.getYOffset() / 2.0D, (double) ventingSide.getZOffset() / 2.0D, 0.1D); + world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, posX, posY, posZ, 7 + world.rand.nextInt(3), + (double) ventingSide.getXOffset() / 2.0D, (double) ventingSide.getYOffset() / 2.0D, + (double) ventingSide.getZOffset() / 2.0D, 0.1D); if (ConfigHolder.machines.machineSounds && !this.isMuffled()) { - world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, + 1.0F); } this.setNeedsVenting(false); } else if (!this.ventingStuck) { @@ -335,6 +351,7 @@ public boolean isVentingStuck() { @Override public List getDataInfo() { int workingArea = getWorkingArea(this.minerLogic.getCurrentRadius()); - return Collections.singletonList(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); + return Collections.singletonList( + new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamRockBreaker.java b/src/main/java/gregtech/common/metatileentities/steam/SteamRockBreaker.java index 84cc188c3b2..5dbf91b5d8e 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamRockBreaker.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamRockBreaker.java @@ -11,6 +11,7 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -82,13 +83,19 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(importItems, 0, 53, 34, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.DUST_OVERLAY_STEAM.get(isHighPressure)) + .slot(importItems, 0, 53, 34, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.DUST_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 79, 35, 21, 18, - GuiTextures.PROGRESS_BAR_MACERATE_STEAM.get(isHighPressure), MoveType.HORIZONTAL, workableHandler.getRecipeMap()) - .slot(exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) - .slot(exportItems, 1, 125, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) - .slot(exportItems, 2, 107, 43, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) - .slot(exportItems, 3, 125, 43, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) + GuiTextures.PROGRESS_BAR_MACERATE_STEAM.get(isHighPressure), MoveType.HORIZONTAL, + workableHandler.getRecipeMap()) + .slot(exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) + .slot(exportItems, 1, 125, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) + .slot(exportItems, 2, 107, 43, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) + .slot(exportItems, 3, 125, 43, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) .build(getHolder(), player); } @@ -115,7 +122,8 @@ protected void randomDisplayTick(float x, float y, float z, EnumParticleTypes fl protected class SteamRockBreakerRecipeLogic extends RecipeLogicSteam { - public SteamRockBreakerRecipeLogic(MetaTileEntity tileEntity, RecipeMap recipeMap, boolean isHighPressure, IFluidTank steamFluidTank, double conversionRate) { + public SteamRockBreakerRecipeLogic(MetaTileEntity tileEntity, RecipeMap recipeMap, boolean isHighPressure, + IFluidTank steamFluidTank, double conversionRate) { super(tileEntity, recipeMap, isHighPressure, steamFluidTank, conversionRate); } diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java index 44e97729e31..9c564c1fa78 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.steam.boiler; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.CommonFluidFilters; import gregtech.api.capability.impl.FilteredFluidHandler; @@ -27,6 +23,7 @@ import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.ConfigHolder; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -44,16 +41,22 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.IS_WORKING; public abstract class SteamBoiler extends MetaTileEntity implements IDataInfoProvider { @@ -113,7 +116,8 @@ public Pair getParticleTexture() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); getBaseRenderer().render(renderState, translation, colouredPipeline); renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isBurning(), true); } @@ -214,7 +218,7 @@ private void updateCurrentTemperature() { if (fuelBurnTimeLeft == 0) { this.fuelMaxBurnTime = 0; this.timeBeforeCoolingDown = getCooldownInterval(); - //boiler has no fuel now, so queue burning state update + // boiler has no fuel now, so queue burning state update this.wasBurningAndNeedsUpdate = true; } } @@ -223,7 +227,7 @@ private void updateCurrentTemperature() { currentTemperature -= getCoolDownRate(); timeBeforeCoolingDown = getCooldownInterval(); } - } else --timeBeforeCoolingDown; + } else--timeBeforeCoolingDown; } protected abstract int getBaseSteamOutput(); @@ -264,7 +268,8 @@ private void generateSteam() { getFrontFacing().getZOffset() / 2.0, 0.1); if (ConfigHolder.machines.machineSounds && !this.isMuffled()) { - getWorld().playSound(null, x, y, z, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); + getWorld().playSound(null, x, y, z, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, + 1.0f); } steamFluidTank.drain(4000, true); @@ -336,9 +341,11 @@ public ModularUI.Builder createUITemplate(EntityPlayer player) { .setBackgroundTexture(GuiTextures.PROGRESS_BAR_BOILER_EMPTY.get(isHighPressure))) .widget(new FluidContainerSlotWidget(containerInventory, 0, 43, 26, true) - .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.IN_SLOT_OVERLAY_STEAM.get(isHighPressure))) + .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.IN_SLOT_OVERLAY_STEAM.get(isHighPressure))) .slot(containerInventory, 1, 43, 62, true, false, - GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.OUT_SLOT_OVERLAY_STEAM.get(isHighPressure)) + GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.OUT_SLOT_OVERLAY_STEAM.get(isHighPressure)) .image(43, 44, 18, 18, GuiTextures.CANISTER_OVERLAY_STEAM.get(isHighPressure)) .bindPlayerInventory(player.inventory, GuiTextures.SLOT_STEAM.get(isHighPressure), 0); @@ -372,7 +379,8 @@ public void clearMachineInventory(NonNullList itemBuffer) { @Nonnull @Override public List getDataInfo() { - return Collections.singletonList(new TextComponentTranslation("gregtech.machine.steam_boiler.heat_amount", TextFormattingUtil.formatNumbers((int) (this.getTemperaturePercent() * 100)))); + return Collections.singletonList(new TextComponentTranslation("gregtech.machine.steam_boiler.heat_amount", + TextFormattingUtil.formatNumbers((int) (this.getTemperaturePercent() * 100)))); } @SideOnly(Side.CLIENT) @@ -384,7 +392,8 @@ public void randomDisplayTick() { float z = pos.getZ() + 0.5F; if (GTValues.RNG.nextDouble() < 0.1) { - getWorld().playSound(x, pos.getY(), z + 0.5F, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); + getWorld().playSound(x, pos.getY(), z + 0.5F, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, + SoundCategory.BLOCKS, 1.0F, 1.0F, false); } final EnumFacing facing = getFrontFacing(); @@ -406,7 +415,8 @@ public void randomDisplayTick() { @SideOnly(Side.CLIENT) protected void randomDisplayTick(float x, float y, float z) { - getWorld().spawnParticle(isHighPressure ? EnumParticleTypes.SMOKE_LARGE : EnumParticleTypes.SMOKE_NORMAL, x, y, z, 0, 0, 0); + getWorld().spawnParticle(isHighPressure ? EnumParticleTypes.SMOKE_LARGE : EnumParticleTypes.SMOKE_NORMAL, x, y, + z, 0, 0, 0); getWorld().spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0); } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamCoalBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamCoalBoiler.java index 2bc3fa58a03..9159b29cbaa 100755 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamCoalBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamCoalBoiler.java @@ -8,6 +8,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.ModHandler; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityFurnace; @@ -38,14 +39,14 @@ protected void tryConsumeNewFuel() { ItemStack fuelInSlot = importItems.extractItem(0, 1, true); if (fuelInSlot.isEmpty()) return; // Prevent consuming buckets with burn time - if(FluidUtil.getFluidHandler(fuelInSlot) != null) { + if (FluidUtil.getFluidHandler(fuelInSlot) != null) { return; } int burnTime = TileEntityFurnace.getItemBurnTime(fuelInSlot); if (burnTime <= 0) return; importItems.extractItem(0, 1, false); ItemStack remainderAsh = ModHandler.getBurningFuelRemainder(fuelInSlot); - if (!remainderAsh.isEmpty()) { //we don't care if we can't insert ash - it's chanced anyway + if (!remainderAsh.isEmpty()) { // we don't care if we can't insert ash - it's chanced anyway exportItems.insertItem(0, remainderAsh, false); } setFuelMaxBurnTime(burnTime); @@ -69,6 +70,7 @@ public IItemHandlerModifiable createExportItemHandler() { @Override public IItemHandlerModifiable createImportItemHandler() { return new GTItemStackHandler(this, 1) { + @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java index ecbd0782fc5..9d9511d1fd7 100755 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java @@ -12,9 +12,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.unification.material.Materials; import gregtech.client.renderer.texture.Textures; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntMaps; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; @@ -24,15 +22,21 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntMaps; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.Objects; +import javax.annotation.Nonnull; + public class SteamLavaBoiler extends SteamBoiler { private static final Object2IntMap BOILER_FUEL_TO_CONSUMPTION = new Object2IntOpenHashMap<>(); private static boolean initialized; private static final IFilter FUEL_FILTER = new IFilter<>() { + @Override public boolean test(@Nonnull FluidStack fluidStack) { for (Fluid fluid : getBoilerFuelToConsumption().keySet()) { @@ -126,7 +130,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { public void randomDisplayTick(float x, float y, float z) { super.randomDisplayTick(x, y, z); if (GTValues.RNG.nextFloat() < 0.3F) { - getWorld().spawnParticle(EnumParticleTypes.LAVA, x + GTValues.RNG.nextFloat(), y, z + GTValues.RNG.nextFloat(), 0.0F, 0.0F, 0.0F); + getWorld().spawnParticle(EnumParticleTypes.LAVA, x + GTValues.RNG.nextFloat(), y, + z + GTValues.RNG.nextFloat(), 0.0F, 0.0F, 0.0F); } } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamSolarBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamSolarBoiler.java index 1bdf8a8c8df..970afae65d3 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamSolarBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamSolarBoiler.java @@ -7,6 +7,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java index 63357b15870..d03a6ac6e75 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java +++ b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.steam.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.CommonFluidFilters; import gregtech.api.capability.impl.FilteredFluidHandler; import gregtech.api.capability.impl.FilteredItemHandler; @@ -25,6 +22,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; import gregtech.common.metatileentities.storage.MetaTileEntityQuantumTank; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -35,10 +33,16 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; -public class MetaTileEntitySteamHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart { +import javax.annotation.Nullable; + +public class MetaTileEntitySteamHatch extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart { private static final int INVENTORY_SIZE = 64000; private static final boolean IS_STEEL = ConfigHolder.machines.steelSteamMultiblocks; @@ -56,7 +60,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); if (data.hasKey("ContainerInventory")) { - MetaTileEntityQuantumTank.legacyTankItemHandlerNBTReading(this, data.getCompoundTag("ContainerInventory"), 0, 1); + MetaTileEntityQuantumTank.legacyTankItemHandlerNBTReading(this, data.getCompoundTag("ContainerInventory"), + 0, 1); } } @@ -100,7 +105,8 @@ protected FluidTankList createImportFluidHandler() { @Override protected IItemHandlerModifiable createImportItemHandler() { - return new FilteredItemHandler(this, 1).setFillPredicate(FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); + return new FilteredItemHandler(this, 1).setFillPredicate( + FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); } @Override @@ -136,10 +142,12 @@ public ModularUI.Builder createTankUI(IFluidTank fluidTank, String title, Entity builder.dynamicLabel(11, 40, tankWidget::getFluidLocalizedName, 0xFFFFFF); return builder.label(6, 6, title) .widget(new FluidContainerSlotWidget(importItems, 0, 90, 17, false) - .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(IS_STEEL), GuiTextures.IN_SLOT_OVERLAY_STEAM.get(IS_STEEL))) + .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(IS_STEEL), + GuiTextures.IN_SLOT_OVERLAY_STEAM.get(IS_STEEL))) .widget(new ImageWidget(91, 36, 14, 15, GuiTextures.TANK_ICON)) // todo tank icon .widget(new SlotWidget(exportItems, 0, 90, 54, true, false) - .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(IS_STEEL), GuiTextures.OUT_SLOT_OVERLAY_STEAM.get(IS_STEEL))) + .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(IS_STEEL), + GuiTextures.OUT_SLOT_OVERLAY_STEAM.get(IS_STEEL))) .bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT_STEAM.get(IS_STEEL), 7, 83); } diff --git a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java index 2cc0a0f1755..19bca0ef1e5 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.steam.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.metatileentity.MetaTileEntity; @@ -15,6 +12,7 @@ import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityItemBus; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -22,9 +20,14 @@ import net.minecraft.world.World; import net.minecraftforge.items.IItemHandlerModifiable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntitySteamItemBus extends MetaTileEntityItemBus { @@ -60,7 +63,8 @@ public ICubeRenderer getBaseTexture() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(TooltipHelper.BLINKING_ORANGE + I18n.format("gregtech.machine.steam_bus.tooltip")); } @@ -88,7 +92,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { for (int y = 0; y < 2; y++) { for (int x = 0; x < 2; x++) { int index = y * 2 + x; - builder.slot(isExportHatch ? exportItems : importItems, index, 70 + x * 18, 31 + y * 18, true, !isExportHatch, + builder.slot(isExportHatch ? exportItems : importItems, index, 70 + x * 18, 31 + y * 18, true, + !isExportHatch, GuiTextures.SLOT_STEAM.get(IS_STEEL)); } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/CachedRecipeData.java b/src/main/java/gregtech/common/metatileentities/storage/CachedRecipeData.java index 07e9277213b..403eed12261 100755 --- a/src/main/java/gregtech/common/metatileentities/storage/CachedRecipeData.java +++ b/src/main/java/gregtech/common/metatileentities/storage/CachedRecipeData.java @@ -4,22 +4,26 @@ import gregtech.common.crafting.ShapedOreEnergyTransferRecipe; import gregtech.common.inventory.IItemList; import gregtech.common.inventory.itemsource.ItemSources; + +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.world.World; + import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import it.unimi.dsi.fastutil.objects.Object2BooleanOpenCustomHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.world.World; public class CachedRecipeData { + private final ItemSources itemSources; private IRecipe recipe; - private final Object2IntMap requiredItems = new Object2IntOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + private final Object2IntMap requiredItems = new Object2IntOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); private final Int2ObjectMap> replaceAttemptMap = new Int2ObjectArrayMap<>(); private final InventoryCrafting inventory; @@ -34,7 +38,7 @@ public short attemptMatchRecipe() { this.requiredItems.clear(); for (int i = 0; i < inventory.getSizeInventory(); i++) { if (getIngredientEquivalent(i)) - itemsFound += 1 << i; //ingredient was found, and indicate in the short of this fact + itemsFound += 1 << i; // ingredient was found, and indicate in the short of this fact } if (itemsFound != CraftingRecipeLogic.ALL_INGREDIENTS_PRESENT) { requiredItems.clear(); @@ -44,7 +48,8 @@ public short attemptMatchRecipe() { protected boolean consumeRecipeItems() { boolean gathered = true; - Object2IntMap gatheredItems = new Object2IntOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + Object2IntMap gatheredItems = new Object2IntOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); if (requiredItems.isEmpty()) { return false; } @@ -62,7 +67,8 @@ protected boolean consumeRecipeItems() { } if (!gathered) { for (Object2IntMap.Entry entry : gatheredItems.object2IntEntrySet()) { - itemSources.insertItem(entry.getKey(), entry.getIntValue(), false, IItemList.InsertMode.HIGHEST_PRIORITY); + itemSources.insertItem(entry.getKey(), entry.getIntValue(), false, + IItemList.InsertMode.HIGHEST_PRIORITY); } } return gathered; @@ -71,7 +77,7 @@ protected boolean consumeRecipeItems() { public boolean getIngredientEquivalent(int slot) { ItemStack currentStack = inventory.getStackInSlot(slot); if (currentStack.isEmpty()) { - return true; //stack is empty, nothing to return + return true; // stack is empty, nothing to return } if (simulateExtractItem(currentStack)) { @@ -80,16 +86,17 @@ public boolean getIngredientEquivalent(int slot) { ItemStack previousStack = recipe.getCraftingResult(inventory); - Object2BooleanMap map = replaceAttemptMap.computeIfAbsent(slot, (m) -> new Object2BooleanOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount())); + Object2BooleanMap map = replaceAttemptMap.computeIfAbsent(slot, + (m) -> new Object2BooleanOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount())); - //iterate stored items to find equivalent + // iterate stored items to find equivalent for (ItemStack itemStack : itemSources.getStoredItems()) { boolean matchedPreviously = false; if (map.containsKey(itemStack)) { if (!map.get(itemStack)) { continue; } else { - //cant return here before checking if: + // cant return here before checking if: // The item is available for extraction // The recipe output is still the same, as depending on the ingredient, the output NBT may change matchedPreviously = true; @@ -98,9 +105,9 @@ public boolean getIngredientEquivalent(int slot) { if (!matchedPreviously) { boolean matched = false; - //Matching shapeless recipes actually is very bad for performance, as it checks the entire - //recipe ingredients recursively, so we fail early here if none of the recipes ingredients can - //take the stack + // Matching shapeless recipes actually is very bad for performance, as it checks the entire + // recipe ingredients recursively, so we fail early here if none of the recipes ingredients can + // take the stack for (Ingredient in : recipe.getIngredients()) { if (in.apply(itemStack)) { matched = true; @@ -113,12 +120,13 @@ public boolean getIngredientEquivalent(int slot) { } } - //update item in slot, and check that recipe matches and output item is equal to the expected one + // update item in slot, and check that recipe matches and output item is equal to the expected one inventory.setInventorySlotContents(slot, itemStack); if (recipe.matches(inventory, itemSources.getWorld()) && - (ItemStack.areItemStacksEqual(recipe.getCraftingResult(inventory), previousStack) || recipe instanceof ShapedOreEnergyTransferRecipe)) { + (ItemStack.areItemStacksEqual(recipe.getCraftingResult(inventory), previousStack) || + recipe instanceof ShapedOreEnergyTransferRecipe)) { map.put(itemStack, true); - //ingredient matched, attempt to extract it and return if successful + // ingredient matched, attempt to extract it and return if successful if (simulateExtractItem(itemStack)) { return true; } @@ -126,7 +134,7 @@ public boolean getIngredientEquivalent(int slot) { map.put(itemStack, false); inventory.setInventorySlotContents(slot, currentStack); } - //nothing matched, so return null + // nothing matched, so return null return false; } diff --git a/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java b/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java index 3958de6c670..f5efc438a37 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java +++ b/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java @@ -1,11 +1,11 @@ package gregtech.common.metatileentities.storage; -import com.google.common.collect.Lists; import gregtech.api.storage.ICraftingStorage; import gregtech.api.util.DummyContainer; import gregtech.common.inventory.IItemList; import gregtech.common.inventory.itemsource.ItemSources; import gregtech.common.inventory.itemsource.sources.TileItemSource; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; @@ -21,6 +21,8 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.items.ItemStackHandler; +import com.google.common.collect.Lists; + import java.util.Collections; import java.util.Map; @@ -93,10 +95,10 @@ private boolean hasCraftingGridUpdated() { craftingGridChanged = true; } else if (!ItemStack.areItemsEqual(oldStack, newStack) || !ItemStack.areItemStackTagsEqual(oldStack, newStack)) { - oldCraftingGrid[i] = newStack; - inventoryCrafting.setInventorySlotContents(i, newStack.copy()); - craftingGridChanged = true; - } + oldCraftingGrid[i] = newStack; + inventoryCrafting.setInventorySlotContents(i, newStack.copy()); + craftingGridChanged = true; + } } return craftingGridChanged; } @@ -109,7 +111,9 @@ public boolean performRecipe(EntityPlayer player) { return false; } ForgeHooks.setCraftingPlayer(player); - NonNullList remainingItems = cachedRecipe.getRemainingItems(inventoryCrafting); // todo right here is where tools get damaged (in UI) + NonNullList remainingItems = cachedRecipe.getRemainingItems(inventoryCrafting); // todo right here is + // where tools get + // damaged (in UI) ForgeHooks.setCraftingPlayer(null); for (int i = 0; i < remainingItems.size(); i++) { ItemStack itemStack = remainingItems.get(i); @@ -119,11 +123,12 @@ public boolean performRecipe(EntityPlayer player) { ItemStack current = inventoryCrafting.getStackInSlot(i); inventoryCrafting.setInventorySlotContents(i, itemStack); - if (!cachedRecipe.matches(inventoryCrafting, itemSources.getWorld())){ + if (!cachedRecipe.matches(inventoryCrafting, itemSources.getWorld())) { inventoryCrafting.setInventorySlotContents(i, current); } - int remainingAmount = itemStack.getCount() - itemSources.insertItem(itemStack, itemStack.getCount(), false, IItemList.InsertMode.HIGHEST_PRIORITY); + int remainingAmount = itemStack.getCount() - itemSources.insertItem(itemStack, itemStack.getCount(), false, + IItemList.InsertMode.HIGHEST_PRIORITY); if (remainingAmount > 0) { itemStack.setCount(remainingAmount); player.addItemStackToInventory(itemStack); @@ -138,7 +143,7 @@ public boolean performRecipe(EntityPlayer player) { public void handleItemCraft(ItemStack itemStack, EntityPlayer player) { itemStack.onCrafting(world, player, 1); itemStack.getItem().onCreated(itemStack, world, player); - //if we're not simulated, fire the event, unlock recipe and add crafted items, and play sounds + // if we're not simulated, fire the event, unlock recipe and add crafted items, and play sounds FMLCommonHandler.instance().firePlayerCraftingEvent(player, itemStack, inventoryCrafting); if (cachedRecipe != null && !cachedRecipe.isDynamic()) { @@ -160,11 +165,13 @@ public void refreshOutputSlot() { } public boolean isRecipeValid() { - return cachedRecipeData.getRecipe() != null && cachedRecipeData.matches(inventoryCrafting, this.world) && cachedRecipeData.attemptMatchRecipe() == ALL_INGREDIENTS_PRESENT; + return cachedRecipeData.getRecipe() != null && cachedRecipeData.matches(inventoryCrafting, this.world) && + cachedRecipeData.attemptMatchRecipe() == ALL_INGREDIENTS_PRESENT; } private void updateCurrentRecipe() { - if (!cachedRecipeData.matches(inventoryCrafting, world) || !ItemStack.areItemStacksEqual(oldResult, cachedRecipe.getCraftingResult(inventoryCrafting))) { + if (!cachedRecipeData.matches(inventoryCrafting, world) || + !ItemStack.areItemStacksEqual(oldResult, cachedRecipe.getCraftingResult(inventoryCrafting))) { IRecipe newRecipe = CraftingManager.findMatchingRecipe(inventoryCrafting, world); this.cachedRecipe = newRecipe; ItemStack resultStack = ItemStack.EMPTY; @@ -178,12 +185,11 @@ private void updateCurrentRecipe() { } public void update() { - //update item sources every tick for fast tinting updates + // update item sources every tick for fast tinting updates itemSources.update(); if (getCachedRecipeData().getRecipe() != null) { tintLocation = getCachedRecipeData().attemptMatchRecipe(); - } - else { + } else { tintLocation = ALL_INGREDIENTS_PRESENT; } if (hasCraftingGridUpdated()) { diff --git a/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeMemory.java b/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeMemory.java index 8d1800f9df7..17a26c15475 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeMemory.java +++ b/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeMemory.java @@ -47,7 +47,8 @@ private MemorizedRecipe offsetRecipe(int startIndex) { private MemorizedRecipe findOrCreateRecipe(ItemStack resultItemStack) { // search preexisting recipe with identical recipe result for (MemorizedRecipe memorizedRecipe : memorizedRecipes) { - if (memorizedRecipe != null && ItemStack.areItemStacksEqual(memorizedRecipe.recipeResult, resultItemStack)) { + if (memorizedRecipe != null && + ItemStack.areItemStacksEqual(memorizedRecipe.recipeResult, resultItemStack)) { return memorizedRecipe; } } @@ -112,6 +113,7 @@ private static void copyInventoryItems(IItemHandler src, IItemHandlerModifiable } public static class MemorizedRecipe { + private final ItemStackHandler craftingMatrix = new ItemStackHandler(9); private ItemStack recipeResult; private boolean recipeLocked = false; @@ -147,7 +149,7 @@ private void initialize(ItemStack recipeResult) { } private void updateCraftingMatrix(IItemHandler craftingGrid) { - //do not modify crafting grid for locked recipes + // do not modify crafting grid for locked recipes if (!recipeLocked) { copyInventoryItems(craftingGrid, craftingMatrix); } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java index 4b74235b915..2b1264ae613 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FilteredFluidHandler; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.gui.GuiTextures; @@ -15,6 +11,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -25,12 +22,18 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public class MetaTileEntityBuffer extends MetaTileEntity implements ITieredMetaTileEntity { private static final int TANK_SIZE = 64000; @@ -53,7 +56,7 @@ protected void initializeInventory() { fluidHandlers[i] = new FilteredFluidHandler(TANK_SIZE); } fluidInventory = fluidTankList = new FluidTankList(false, fluidHandlers); - itemInventory = itemStackHandler = new GTItemStackHandler(this, ((int)Math.pow(tier + 2, 2))); + itemInventory = itemStackHandler = new GTItemStackHandler(this, ((int) Math.pow(tier + 2, 2))); } @Override @@ -70,7 +73,7 @@ public Pair getParticleTexture() { protected ModularUI createUI(EntityPlayer entityPlayer) { int invTier = tier + 2; ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, - 176, Math.max(166, 18 + 18 * invTier + 94));//176, 166 + 176, Math.max(166, 18 + 18 * invTier + 94));// 176, 166 for (int i = 0; i < this.fluidTankList.getTanks(); i++) { builder.widget(new TankWidget(this.fluidTankList.getTankAt(i), 176 - 8 - 18, 18 + 18 * i, 18, 18) .setAlwaysShowFull(true) @@ -140,7 +143,7 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t tooltip.add(I18n.format("gregtech.tool_action.screwdriver.access_covers")); // TODO Add this when the Buffer gets an auto-output side, and change the above to // "gregtech.tool_action.screwdriver.auto_output_covers" - //tooltip.add(I18n.format("gregtech.tool_action.wrench.set_facing")); + // tooltip.add(I18n.format("gregtech.tool_action.wrench.set_facing")); super.addToolUsages(stack, world, tooltip, advanced); } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java index a8c68fbc476..ba35f958fd3 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.ModularUI.Builder; @@ -17,6 +12,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.items.MetaItems; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -31,11 +27,18 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.colour.ColourRGBA; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.IS_TAPED; import static gregtech.api.capability.GregtechDataCodes.TAG_KEY_PAINTING_COLOR; @@ -83,7 +86,7 @@ protected void initializeInventory() { @Override public void clearMachineInventory(NonNullList itemBuffer) { - if(!isTaped) { + if (!isTaped) { clearInventory(itemBuffer, inventory); } } @@ -105,9 +108,11 @@ public Pair getParticleTexture() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { if (material.toString().contains("wood")) { - Textures.WOODEN_CRATE.render(renderState, translation, GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()), pipeline); + Textures.WOODEN_CRATE.render(renderState, translation, + GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()), pipeline); } else { - int baseColor = ColourRGBA.multiply(GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB()), GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); + int baseColor = ColourRGBA.multiply(GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB()), + GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); Textures.METAL_CRATE.render(renderState, translation, baseColor, pipeline); } boolean taped = isTaped; @@ -130,19 +135,25 @@ public int getDefaultPaintingColor() { @Override protected ModularUI createUI(EntityPlayer entityPlayer) { int factor = inventorySize / 9 > 8 ? 18 : 9; - Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176 + (factor == 18 ? 176 : 0), 8 + inventorySize / factor * 18 + 104).label(5, 5, getMetaFullName()); + Builder builder = ModularUI + .builder(GuiTextures.BACKGROUND, 176 + (factor == 18 ? 176 : 0), 8 + inventorySize / factor * 18 + 104) + .label(5, 5, getMetaFullName()); for (int i = 0; i < inventorySize; i++) { - builder.slot(inventory, i, 7 * (factor == 18 ? 2 : 1) + i % factor * 18, 18 + i / factor * 18, GuiTextures.SLOT); + builder.slot(inventory, i, 7 * (factor == 18 ? 2 : 1) + i % factor * 18, 18 + i / factor * 18, + GuiTextures.SLOT); } - builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7 + (factor == 18 ? 88 : 0), 18 + inventorySize / factor * 18 + 11); + builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7 + (factor == 18 ? 88 : 0), + 18 + inventorySize / factor * 18 + 11); return builder.build(getHolder(), entityPlayer); } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { ItemStack stack = playerIn.getHeldItem(hand); - if(playerIn.isSneaking() && !isTaped) { - if (stack.isItemEqual(MetaItems.DUCT_TAPE.getStackForm()) || stack.isItemEqual(MetaItems.BASIC_TAPE.getStackForm())) { + if (playerIn.isSneaking() && !isTaped) { + if (stack.isItemEqual(MetaItems.DUCT_TAPE.getStackForm()) || + stack.isItemEqual(MetaItems.BASIC_TAPE.getStackForm())) { if (!playerIn.isCreative()) { stack.shrink(1); } @@ -178,7 +189,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound data) { public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); this.inventory.deserializeNBT(data.getCompoundTag("Inventory")); - if(data.hasKey(TAPED_NBT)) { + if (data.hasKey(TAPED_NBT)) { this.isTaped = data.getBoolean(TAPED_NBT); } } @@ -190,7 +201,7 @@ public void initFromItemStackData(NBTTagCompound data) { this.setPaintingColor(data.getInteger(TAG_KEY_PAINTING_COLOR)); } this.isTaped = data.getBoolean(TAPED_NBT); - if(isTaped) { + if (isTaped) { this.inventory.deserializeNBT(data.getCompoundTag("Inventory")); } @@ -209,7 +220,7 @@ public void writeItemStackData(NBTTagCompound data) { data.setInteger(TAG_KEY_PAINTING_COLOR, this.getPaintingColor()); } // Don't write tape NBT if not taped, to stack with ones from JEI - if(isTaped) { + if (isTaped) { data.setBoolean(TAPED_NBT, isTaped); data.setTag("Inventory", inventory.serializeNBT()); } @@ -219,7 +230,7 @@ public void writeItemStackData(NBTTagCompound data) { public void receiveCustomData(int dataId, PacketBuffer buf) { super.receiveCustomData(dataId, buf); - if(dataId == IS_TAPED) { + if (dataId == IS_TAPED) { this.isTaped = buf.readBoolean(); scheduleRenderUpdate(); markDirty(); diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java index a792a2ee44c..d30b53f5242 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -19,6 +15,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.custom.QuantumStorageRenderer; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -30,17 +27,24 @@ import net.minecraft.world.World; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public class MetaTileEntityCreativeChest extends MetaTileEntityQuantumChest { private int itemsPerCycle = 1; private int ticksPerCycle = 1; - private final GTItemStackHandler handler = new GTItemStackHandler(this,1) { + private final GTItemStackHandler handler = new GTItemStackHandler(this, 1) { + @Override protected int getStackLimit(int slot, ItemStack stack) { return 1; @@ -64,7 +68,8 @@ public MetaTileEntityCreativeChest(ResourceLocation metaTileEntityId) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { Textures.QUANTUM_STORAGE_RENDERER.renderMachine(renderState, translation, - ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), + ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), this.getFrontFacing(), this.getTier()); Textures.CREATIVE_CONTAINER_OVERLAY.renderSided(EnumFacing.UP, renderState, translation, pipeline); Textures.PIPE_OUT_OVERLAY.renderSided(this.getOutputFacing(), renderState, translation, pipeline); @@ -76,7 +81,6 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick QuantumStorageRenderer.renderChestStack(x, y, z, this, this.virtualItemStack, 420, partialTicks); } - @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new MetaTileEntityCreativeChest(this.metaTileEntityId); @@ -107,8 +111,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { }).setMaxLength(11).setNumbersOnly(1, Integer.MAX_VALUE)); builder.label(7, 65, "gregtech.creative.chest.tpc"); - - builder.widget(new CycleButtonWidget(7, 101, 162, 20, () -> active, value -> active = value, "gregtech.creative.activity.off", "gregtech.creative.activity.on")); + builder.widget(new CycleButtonWidget(7, 101, 162, 20, () -> active, value -> active = value, + "gregtech.creative.activity.off", "gregtech.creative.activity.on")); return builder.build(getHolder(), entityPlayer); } @@ -123,7 +127,8 @@ public void update() { TileEntity tile = getNeighbor(getOutputFacing()); if (tile != null) { - IItemHandler container = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, this.getOutputFacing().getOpposite()); + IItemHandler container = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + this.getOutputFacing().getOpposite()); if (container == null || container.getSlots() == 0) return; stack.setCount(itemsPerCycle); @@ -179,9 +184,8 @@ public void writeItemStackData(NBTTagCompound tag) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.creative_tooltip.1") - + TooltipHelper.RAINBOW + I18n.format("gregtech.creative_tooltip.2") - + I18n.format("gregtech.creative_tooltip.3")); + tooltip.add(I18n.format("gregtech.creative_tooltip.1") + TooltipHelper.RAINBOW + + I18n.format("gregtech.creative_tooltip.2") + I18n.format("gregtech.creative_tooltip.3")); // do not append the normal tooltips } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java index d8c856f03b5..eb62f8c1fe2 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.GregtechTileCapabilities; @@ -21,6 +16,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -31,13 +27,20 @@ import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.util.List; import java.util.function.Function; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.MAX; import static gregtech.api.GTValues.V; import static gregtech.api.capability.GregtechDataCodes.UPDATE_IO_SPEED; @@ -63,7 +66,8 @@ public MetaTileEntityCreativeEnergy() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] renderPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] renderPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); Textures.VOLTAGE_CASINGS[14].render(renderState, translation, renderPipeline, Cuboid6.full); for (EnumFacing face : EnumFacing.VALUES) { Textures.INFINITE_EMITTER_FACE.renderSided(face, renderState, translation, pipeline); @@ -123,7 +127,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { builder.dynamicLabel(7, 110, () -> "Energy I/O per sec: " + this.lastEnergyIOPerSec, 0x232323); - builder.widget(new CycleButtonWidget(7, 139, 77, 20, () -> active, value -> active = value, "gregtech.creative.activity.off", "gregtech.creative.activity.on")); + builder.widget(new CycleButtonWidget(7, 139, 77, 20, () -> active, value -> active = value, + "gregtech.creative.activity.off", "gregtech.creative.activity.on")); builder.widget(new CycleButtonWidget(85, 139, 77, 20, () -> source, value -> { source = value; if (source) { @@ -148,9 +153,8 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t @Override public void addInformation(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.creative_tooltip.1") - + TooltipHelper.RAINBOW + I18n.format("gregtech.creative_tooltip.2") - + I18n.format("gregtech.creative_tooltip.3")); + tooltip.add(I18n.format("gregtech.creative_tooltip.1") + TooltipHelper.RAINBOW + + I18n.format("gregtech.creative_tooltip.2") + I18n.format("gregtech.creative_tooltip.3")); } @Override @@ -178,7 +182,8 @@ public void update() { EnumFacing opposite = facing.getOpposite(); TileEntity tile = getNeighbor(facing); if (tile != null) { - IEnergyContainer container = tile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, opposite); + IEnergyContainer container = tile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + opposite); // Try to get laser capability if (container == null) container = tile.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, opposite); @@ -317,5 +322,4 @@ public static Function getTextFieldValidator() { return val; }; } - } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java index 8e20dcfabbd..8a006937579 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -17,6 +13,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.custom.QuantumStorageRenderer; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -29,11 +26,17 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public class MetaTileEntityCreativeTank extends MetaTileEntityQuantumTank { private int mBPerCycle = 1; @@ -48,7 +51,8 @@ public MetaTileEntityCreativeTank(ResourceLocation metaTileEntityId) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { Textures.QUANTUM_STORAGE_RENDERER.renderMachine(renderState, translation, - ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), + ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), this.getFrontFacing(), this.getTier()); Textures.CREATIVE_CONTAINER_OVERLAY.renderSided(EnumFacing.UP, renderState, translation, pipeline); if (this.getOutputFacing() != null) { @@ -57,7 +61,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, Textures.FLUID_OUTPUT_OVERLAY.renderSided(this.getOutputFacing(), renderState, translation, pipeline); } } - QuantumStorageRenderer.renderTankFluid(renderState, translation, pipeline, this.fluidTank, getWorld(), getPos(), getFrontFacing()); + QuantumStorageRenderer.renderTankFluid(renderState, translation, pipeline, this.fluidTank, getWorld(), getPos(), + getFrontFacing()); } @Override @@ -77,8 +82,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .bindPlayerInventory(entityPlayer.inventory, 126); builder.widget(new PhantomFluidWidget(36, 6, 18, 18, () -> this.fluidTank.getFluid(), data -> { - this.fluidTank.setFluid(data); - }).showTip(false)); + this.fluidTank.setFluid(data); + }).showTip(false)); builder.label(7, 9, "gregtech.creative.tank.fluid"); builder.widget(new ImageWidget(7, 45, 154, 14, GuiTextures.DISPLAY)); builder.widget(new TextFieldWidget2(9, 47, 152, 10, () -> String.valueOf(mBPerCycle), value -> { @@ -96,8 +101,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { }).setMaxLength(11).setNumbersOnly(1, Integer.MAX_VALUE)); builder.label(7, 65, "gregtech.creative.tank.tpc"); - - builder.widget(new CycleButtonWidget(7, 101, 162, 20, () -> active, value -> active = value, "gregtech.creative.activity.off", "gregtech.creative.activity.on")); + builder.widget(new CycleButtonWidget(7, 101, 162, 20, () -> active, value -> active = value, + "gregtech.creative.activity.off", "gregtech.creative.activity.on")); return builder.build(getHolder(), entityPlayer); } @@ -105,12 +110,14 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { @Override public void update() { super.update(); - if (ticksPerCycle == 0 || getOffsetTimer() % ticksPerCycle != 0 || fluidTank.getFluid() == null - || getWorld().isRemote || !active) return; + if (ticksPerCycle == 0 || getOffsetTimer() % ticksPerCycle != 0 || fluidTank.getFluid() == null || + getWorld().isRemote || !active) + return; TileEntity tile = getNeighbor(getOutputFacing()); if (tile != null) { - IFluidHandler fluidHandler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getOutputFacing().getOpposite()); + IFluidHandler fluidHandler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + getOutputFacing().getOpposite()); if (fluidHandler == null || fluidHandler.getTankProperties().length == 0) return; @@ -155,9 +162,8 @@ public void writeItemStackData(NBTTagCompound itemStack) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.creative_tooltip.1") - + TooltipHelper.RAINBOW + I18n.format("gregtech.creative_tooltip.2") - + I18n.format("gregtech.creative_tooltip.3")); + tooltip.add(I18n.format("gregtech.creative_tooltip.1") + TooltipHelper.RAINBOW + + I18n.format("gregtech.creative_tooltip.2") + I18n.format("gregtech.creative_tooltip.3")); // do not append the normal tooltips } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java index 58b1ea098aa..0ab8ba0093d 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java @@ -1,11 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.IPropertyFluidFilter; import gregtech.api.capability.impl.FilteredFluidHandler; import gregtech.api.capability.impl.GTFluidHandlerItemStack; @@ -20,6 +14,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -40,13 +35,21 @@ import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.colour.ColourRGBA; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.io.IOException; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.UPDATE_AUTO_OUTPUT; public class MetaTileEntityDrum extends MetaTileEntity { @@ -94,7 +97,8 @@ protected void initializeInventory() { super.initializeInventory(); IPropertyFluidFilter filter = this.material.getProperty(PropertyKey.FLUID_PIPE); if (filter == null) { - throw new IllegalArgumentException(String.format("Material %s requires FluidPipePropety for Drums", material)); + throw new IllegalArgumentException( + String.format("Material %s requires FluidPipePropety for Drums", material)); } this.fluidInventory = this.fluidTank = new FilteredFluidHandler(tankSize).setFilter(filter); } @@ -103,7 +107,8 @@ protected void initializeInventory() { public void initFromItemStackData(NBTTagCompound itemStack) { super.initFromItemStackData(itemStack); if (itemStack.hasKey(FluidHandlerItemStack.FLUID_NBT_KEY, Constants.NBT.TAG_COMPOUND)) { - FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(itemStack.getCompoundTag(FluidHandlerItemStack.FLUID_NBT_KEY)); + FluidStack fluidStack = FluidStack + .loadFluidStackFromNBT(itemStack.getCompoundTag(FluidHandlerItemStack.FLUID_NBT_KEY)); fluidTank.setFluid(fluidStack); } } @@ -145,8 +150,7 @@ public void receiveInitialSyncData(PacketBuffer buf) { try { NBTTagCompound tagCompound = buf.readCompoundTag(); fluidStack = FluidStack.loadFluidStackFromNBT(tagCompound); - } catch (IOException ignored) { - } + } catch (IOException ignored) {} } fluidTank.setFluid(fluidStack); isAutoOutput = buf.readBoolean(); @@ -172,21 +176,25 @@ public void update() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (playerIn.getHeldItem(hand).hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { - return getWorld().isRemote || (!playerIn.isSneaking() && FluidUtil.interactWithFluidHandler(playerIn, hand, fluidTank)); + return getWorld().isRemote || + (!playerIn.isSneaking() && FluidUtil.interactWithFluidHandler(playerIn, hand, fluidTank)); } return super.onRightClick(playerIn, hand, facing, hitResult); } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { if (getWorld().isRemote) { scheduleRenderUpdate(); return true; } - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.drum." + (isAutoOutput ? "disable" : "enable") + "_output"), true); + playerIn.sendStatusMessage(new TextComponentTranslation( + "gregtech.machine.drum." + (isAutoOutput ? "disable" : "enable") + "_output"), true); toggleOutput(); return true; } @@ -219,10 +227,14 @@ public Pair getParticleTexture() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { if (ModHandler.isMaterialWood(material)) { - ColourMultiplier multiplier = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); - Textures.WOODEN_DRUM.render(renderState, translation, ArrayUtils.add(pipeline, multiplier), getFrontFacing()); + ColourMultiplier multiplier = new ColourMultiplier( + GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); + Textures.WOODEN_DRUM.render(renderState, translation, ArrayUtils.add(pipeline, multiplier), + getFrontFacing()); } else { - ColourMultiplier multiplier = new ColourMultiplier(ColourRGBA.multiply(GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB()), GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + ColourMultiplier multiplier = new ColourMultiplier( + ColourRGBA.multiply(GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB()), + GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); Textures.DRUM.render(renderState, translation, ArrayUtils.add(pipeline, multiplier), getFrontFacing()); Textures.DRUM_OVERLAY.render(renderState, translation, pipeline); } @@ -254,7 +266,8 @@ public void addInformation(ItemStack stack, @Nullable World player, List if (tagCompound != null && tagCompound.hasKey("Fluid", Constants.NBT.TAG_COMPOUND)) { FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tagCompound.getCompoundTag("Fluid")); if (fluidStack == null) return; - tooltip.add(I18n.format("gregtech.machine.fluid_tank.fluid", fluidStack.amount, I18n.format(fluidStack.getUnlocalizedName()))); + tooltip.add(I18n.format("gregtech.machine.fluid_tank.fluid", fluidStack.amount, + I18n.format(fluidStack.getUnlocalizedName()))); } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java index 805a10f145d..8c9bb85a6f9 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java @@ -1,12 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -27,6 +20,7 @@ import gregtech.common.worldgen.LootTableHelper; import gregtech.loaders.recipe.CraftingComponent; import gregtech.loaders.recipe.CraftingComponent.Component; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -43,14 +37,23 @@ import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.oredict.OreDictionary; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.List; import java.util.Random; import java.util.function.DoubleSupplier; +import javax.annotation.Nonnull; + import static gregtech.api.capability.GregtechDataCodes.UPDATE_CONTENTS_SEED; import static gregtech.api.capability.GregtechDataCodes.UPDATE_LOCKED_STATE; @@ -58,7 +61,8 @@ public class MetaTileEntityLockedSafe extends MetaTileEntity implements IFastRen private static final int MAX_UNLOCK_PROGRESS = 100; private static Component[] ALLOWED_COMPONENTS; - private static final IndexedCuboid6 COLLISION_BOX = new IndexedCuboid6(null, new Cuboid6(3 / 16.0, 0 / 16.0, 3 / 16.0, 13 / 16.0, 14 / 16.0, 13 / 16.0)); + private static final IndexedCuboid6 COLLISION_BOX = new IndexedCuboid6(null, + new Cuboid6(3 / 16.0, 0 / 16.0, 3 / 16.0, 13 / 16.0, 14 / 16.0, 13 / 16.0)); private int unlockProgress = -1; private int unlockComponentTier = 1; @@ -67,6 +71,7 @@ public class MetaTileEntityLockedSafe extends MetaTileEntity implements IFastRen private long unlockComponentsSeed = 0L; private final ItemStackHandler unlockComponents = new GTItemStackHandler(this, 2); private final ItemStackHandler unlockInventory = new GTItemStackHandler(this, 2) { + @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { @@ -115,7 +120,8 @@ public void update() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { generateUnlockComponents(); return super.onRightClick(playerIn, hand, facing, hitResult); } @@ -150,7 +156,8 @@ private void updateDisplayUnlockComponents() { GTRecipeInput[] unlockComponents = getUnlockComponents(); for (int i = 0; i < Math.min(this.unlockComponents.getSlots(), unlockComponents.length); i++) { if (unlockComponents[i].isOreDict()) { - this.unlockComponents.setStackInSlot(i, OreDictionary.getOres(OreDictionary.getOreName(unlockComponents[i].getOreDict())).get(0)); + this.unlockComponents.setStackInSlot(i, + OreDictionary.getOres(OreDictionary.getOreName(unlockComponents[i].getOreDict())).get(0)); } else { this.unlockComponents.setStackInSlot(i, (unlockComponents[i].getInputStacks()[0])); } @@ -159,12 +166,14 @@ private void updateDisplayUnlockComponents() { private GTRecipeInput[] getUnlockComponents() { if (ALLOWED_COMPONENTS == null) - ALLOWED_COMPONENTS = new Component[]{CraftingComponent.PUMP, CraftingComponent.CONVEYOR, CraftingComponent.EMITTER, CraftingComponent.SENSOR}; + ALLOWED_COMPONENTS = new Component[] { CraftingComponent.PUMP, CraftingComponent.CONVEYOR, + CraftingComponent.EMITTER, CraftingComponent.SENSOR }; Random random = new Random(unlockComponentsSeed); - return new GTRecipeInput[]{ + return new GTRecipeInput[] { new GTRecipeOreInput(CraftingComponent.CIRCUIT.getIngredient(unlockComponentTier).toString()), - new GTRecipeItemInput((ItemStack) ALLOWED_COMPONENTS[random.nextInt(ALLOWED_COMPONENTS.length)].getIngredient(unlockComponentTier)), + new GTRecipeItemInput((ItemStack) ALLOWED_COMPONENTS[random.nextInt(ALLOWED_COMPONENTS.length)] + .getIngredient(unlockComponentTier)), }; } @@ -341,16 +350,17 @@ public void readFromNBT(NBTTagCompound data) { } @Override - public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - } + public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {} @Override public void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) { - ColourMultiplier colourMultiplier = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(GTValues.VC[unlockComponentTier])); + ColourMultiplier colourMultiplier = new ColourMultiplier( + GTUtility.convertRGBtoOpaqueRGBA_CL(GTValues.VC[unlockComponentTier])); float angle = prevDoorAngle + (doorAngle - prevDoorAngle) * partialTicks; angle = 1.0f - (1.0f - angle) * (1.0f - angle) * (1.0f - angle); float resultDoorAngle = angle * 120.0f; - Textures.SAFE.render(renderState, translation, new IVertexOperation[]{colourMultiplier}, getFrontFacing(), resultDoorAngle); + Textures.SAFE.render(renderState, translation, new IVertexOperation[] { colourMultiplier }, getFrontFacing(), + resultDoorAngle); } @Override @@ -386,8 +396,10 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { lockedGroup.addWidget(new LabelWidget(5, 20, "gregtech.machine.locked_safe.malfunctioning")); lockedGroup.addWidget(new LabelWidget(5, 30, "gregtech.machine.locked_safe.requirements")); - lockedGroup.addWidget(new SlotWidget(unlockInventory, 0, 70, 40, false, true).setBackgroundTexture(GuiTextures.SLOT)); - lockedGroup.addWidget(new SlotWidget(unlockInventory, 1, 70 + 18, 40, false, true).setBackgroundTexture(GuiTextures.SLOT)); + lockedGroup.addWidget( + new SlotWidget(unlockInventory, 0, 70, 40, false, true).setBackgroundTexture(GuiTextures.SLOT)); + lockedGroup.addWidget( + new SlotWidget(unlockInventory, 1, 70 + 18, 40, false, true).setBackgroundTexture(GuiTextures.SLOT)); lockedGroup.addWidget(new SlotWidget(unlockComponents, 0, 70, 58, false, false)); lockedGroup.addWidget(new SlotWidget(unlockComponents, 1, 70 + 18, 58, false, false)); diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java index 7233e398669..81ed97cf149 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java @@ -1,12 +1,12 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.raytracer.CuboidRayTraceResult; import gregtech.api.metatileentity.IDataInfoProvider; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.pipenet.longdist.ILDEndpoint; import gregtech.api.pipenet.longdist.LongDistanceNetwork; import gregtech.api.pipenet.longdist.LongDistancePipeType; import gregtech.common.ConfigHolder; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -18,15 +18,19 @@ import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; + +import codechicken.lib.raytracer.CuboidRayTraceResult; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Objects; -public abstract class MetaTileEntityLongDistanceEndpoint extends MetaTileEntity implements ILDEndpoint, IDataInfoProvider { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class MetaTileEntityLongDistanceEndpoint extends MetaTileEntity + implements ILDEndpoint, IDataInfoProvider { private final LongDistancePipeType pipeType; private IOType ioType = IOType.NONE; @@ -61,7 +65,8 @@ public void updateNetwork() { } } - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, + CuboidRayTraceResult hitResult) { return super.onWrenchClick(playerIn, hand, wrenchSide.getOpposite(), hitResult); } @@ -208,7 +213,8 @@ protected boolean openGUIOnRightClick() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { tooltip.add(I18n.format("gregtech.machine.endpoint.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.endpoint.tooltip.2")); tooltip.add(I18n.format("gregtech.machine.endpoint.tooltip.3")); @@ -261,10 +267,8 @@ public BlockPos pos() { } @Override - public void onNeighborChanged(@NotNull EnumFacing facing) { - } + public void onNeighborChanged(@NotNull EnumFacing facing) {} @Override - public void markAsDirty() { - } + public void markAsDirty() {} } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java index 6bc0842e3b5..ae6cfd69a76 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IActiveOutputSide; import gregtech.api.capability.impl.ItemHandlerList; @@ -27,6 +22,7 @@ import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.custom.QuantumStorageRenderer; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -47,19 +43,26 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import static gregtech.api.capability.GregtechDataCodes.*; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; -public class MetaTileEntityQuantumChest extends MetaTileEntity implements ITieredMetaTileEntity, IActiveOutputSide, IFastRenderMetaTileEntity { +import static gregtech.api.capability.GregtechDataCodes.*; +public class MetaTileEntityQuantumChest extends MetaTileEntity + implements ITieredMetaTileEntity, IActiveOutputSide, IFastRenderMetaTileEntity { private final int tier; protected final long maxStoredItems; @@ -95,11 +98,11 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new MetaTileEntityQuantumChest(metaTileEntityId, tier, maxStoredItems); } - @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { Textures.QUANTUM_STORAGE_RENDERER.renderMachine(renderState, translation, - ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), + ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), this.getFrontFacing(), this.tier); Textures.QUANTUM_CHEST_OVERLAY.renderSided(EnumFacing.UP, renderState, translation, pipeline); if (outputFacing != null) { @@ -128,7 +131,8 @@ public void update() { if (itemsStoredInside < maxStoredItems) { ItemStack inputStack = importItems.getStackInSlot(0); ItemStack outputStack = exportItems.getStackInSlot(0); - if (!inputStack.isEmpty() && (virtualItemStack.isEmpty() || areItemStackIdentical(outputStack, inputStack))) { + if (!inputStack.isEmpty() && + (virtualItemStack.isEmpty() || areItemStackIdentical(outputStack, inputStack))) { GTTransferUtils.moveInventoryItems(importItems, combinedInventory); markDirty(); @@ -137,7 +141,8 @@ public void update() { if (itemsStoredInside > 0 && !virtualItemStack.isEmpty()) { ItemStack outputStack = exportItems.getStackInSlot(0); int maxStackSize = virtualItemStack.getMaxStackSize(); - if (outputStack.isEmpty() || (areItemStackIdentical(virtualItemStack, outputStack) && outputStack.getCount() < maxStackSize)) { + if (outputStack.isEmpty() || (areItemStackIdentical(virtualItemStack, outputStack) && + outputStack.getCount() < maxStackSize)) { GTTransferUtils.moveInventoryItems(itemInventory, exportItems); markDirty(); @@ -173,7 +178,8 @@ protected void addDisplayInformation(List textList) { textList.add(new TextComponentString(String.format("%,d", itemsStoredInside))); ItemStack export = exportItems.getStackInSlot(0); if (!export.isEmpty()) { - textList.add(new TextComponentString(TextFormattingUtil.formatStringWithNewlines(export.getDisplayName(), 14))); + textList.add( + new TextComponentString(TextFormattingUtil.formatStringWithNewlines(export.getDisplayName(), 14))); } } @@ -219,7 +225,6 @@ protected void initializeInventory() { temp.add(this.itemInventory); this.combinedInventory = new ItemHandlerList(temp); this.outputItemInventory = new ItemHandlerProxy(new GTItemStackHandler(this, 0), combinedInventory); - } @Override @@ -242,7 +247,9 @@ public boolean isItemValid(int slot, @Nonnull ItemStack stack) { outStackMatch = areItemStackIdentical(stack, outStack); } if (compound == null) return true; - return outStackMatch && !(compound.hasKey(NBT_ITEMSTACK, NBT.TAG_COMPOUND) || compound.hasKey("Fluid", NBT.TAG_COMPOUND)); //prevents inserting items with NBT to the Quantum Chest + return outStackMatch && !(compound.hasKey(NBT_ITEMSTACK, NBT.TAG_COMPOUND) || + compound.hasKey("Fluid", NBT.TAG_COMPOUND)); // prevents inserting items with NBT to the Quantum + // Chest } }; } @@ -278,7 +285,7 @@ public void readFromNBT(NBTTagCompound data) { this.itemsStoredInside = data.getLong(NBT_ITEMCOUNT); } } - if (data.hasKey(IS_VOIDING)){ + if (data.hasKey(IS_VOIDING)) { this.voiding = data.getBoolean(IS_VOIDING); } } @@ -313,7 +320,6 @@ public void writeItemStackData(NBTTagCompound itemStack) { itemStack.setTag(NBT_PARTIALSTACK, partialStack.writeToNBT(new NBTTagCompound())); } - if (this.voiding) { itemStack.setBoolean(IS_VOIDING, true); } @@ -334,12 +340,13 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .widget(new SlotWidget(exportItems, 0, 90, 44, true, false) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)) .widget(new ToggleButtonWidget(7, 64, 18, 18, - GuiTextures.BUTTON_ITEM_OUTPUT, this::isAutoOutputItems, this::setAutoOutputItems).shouldUseBaseBackground() - .setTooltipText("gregtech.gui.item_auto_output.tooltip")) + GuiTextures.BUTTON_ITEM_OUTPUT, this::isAutoOutputItems, this::setAutoOutputItems) + .shouldUseBaseBackground() + .setTooltipText("gregtech.gui.item_auto_output.tooltip")) .widget(new ToggleButtonWidget(25, 64, 18, 18, GuiTextures.BUTTON_ITEM_VOID, this::isVoiding, this::setVoiding) - .setTooltipText("gregtech.gui.item_voiding.tooltip") - .shouldUseBaseBackground()) + .setTooltipText("gregtech.gui.item_voiding.tooltip") + .shouldUseBaseBackground()) .bindPlayerInventory(entityPlayer.inventory); return builder.build(getHolder(), entityPlayer); @@ -359,7 +366,8 @@ public void setOutputFacing(EnumFacing outputFacing) { } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { if (getOutputFacing() == facing || getFrontFacing() == facing) { return false; @@ -390,7 +398,8 @@ public void receiveInitialSyncData(PacketBuffer buf) { try { this.virtualItemStack = buf.readItemStack(); } catch (IOException ignored) { - GTLog.logger.warn("Failed to load item from NBT in a quantum chest at " + this.getPos() + " on initial server/client sync"); + GTLog.logger.warn("Failed to load item from NBT in a quantum chest at " + this.getPos() + + " on initial server/client sync"); } this.itemsStoredInside = buf.readLong(); this.voiding = buf.readBoolean(); @@ -398,8 +407,8 @@ public void receiveInitialSyncData(PacketBuffer buf) { @Override public boolean isValidFrontFacing(EnumFacing facing) { - //use direct outputFacing field instead of getter method because otherwise - //it will just return SOUTH for null output facing + // use direct outputFacing field instead of getter method because otherwise + // it will just return SOUTH for null output facing return super.isValidFrontFacing(facing) && facing != outputFacing; } @@ -458,7 +467,8 @@ public T getCapability(Capability capability, EnumFacing side) { if (side == null) return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(combinedInventory); // try fix being able to insert through output hole when input on output is disabled - IItemHandler itemHandler = (side == getOutputFacing() && !isAllowInputFromOutputSideItems()) ? outputItemInventory : combinedInventory; + IItemHandler itemHandler = (side == getOutputFacing() && !isAllowInputFromOutputSideItems()) ? + outputItemInventory : combinedInventory; if (itemHandler.getSlots() > 0) { return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(itemHandler); } @@ -479,7 +489,7 @@ public IItemHandler getOutputItemInventory() { public void setFrontFacing(EnumFacing frontFacing) { super.setFrontFacing(frontFacing); if (this.outputFacing == null) { - //set initial output facing as opposite to front + // set initial output facing as opposite to front setOutputFacing(frontFacing.getOpposite()); } } @@ -509,16 +519,20 @@ public void clearMachineInventory(NonNullList itemBuffer) { } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { EnumFacing hitFacing = CoverRayTracer.determineGridSideHit(hitResult); if (facing == getOutputFacing() || (hitFacing == getOutputFacing() && playerIn.isSneaking())) { if (!getWorld().isRemote) { if (isAllowInputFromOutputSideItems()) { setAllowInputFromOutputSide(false); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.disallow"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.disallow"), + true); } else { setAllowInputFromOutputSide(true); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.allow"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.allow"), true); } } return true; diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java index e1a0627775c..27f523a1b23 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IActiveOutputSide; import gregtech.api.capability.IFilter; @@ -26,6 +21,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.custom.QuantumStorageRenderer; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -49,19 +45,27 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.IOException; import java.util.List; import java.util.function.Consumer; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.*; import static net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack.FLUID_NBT_KEY; -public class MetaTileEntityQuantumTank extends MetaTileEntity implements ITieredMetaTileEntity, IActiveOutputSide, IFastRenderMetaTileEntity { +public class MetaTileEntityQuantumTank extends MetaTileEntity + implements ITieredMetaTileEntity, IActiveOutputSide, IFastRenderMetaTileEntity { private final int tier; private final int maxFluidCapacity; @@ -122,14 +126,16 @@ public void update() { if (currentFluid == null) { // tank had fluid, but now is empty updatePreviousFluid(null); - } else if (previousFluid.getFluid().equals(currentFluid.getFluid()) && previousFluid.amount != currentFluid.amount) { - // tank has fluid with changed amount - previousFluid.amount = currentFluid.amount; - writeCustomData(UPDATE_FLUID_AMOUNT, buf -> buf.writeInt(currentFluid.amount)); - } else if (!previousFluid.equals(currentFluid)) { - // tank has a different fluid from before - updatePreviousFluid(currentFluid); - } + } else if (previousFluid.getFluid().equals(currentFluid.getFluid()) && + previousFluid.amount != currentFluid.amount) { + // tank has fluid with changed amount + previousFluid.amount = currentFluid.amount; + writeCustomData(UPDATE_FLUID_AMOUNT, buf -> buf.writeInt(currentFluid.amount)); + } else + if (!previousFluid.equals(currentFluid)) { + // tank has a different fluid from before + updatePreviousFluid(currentFluid); + } } } } @@ -137,7 +143,8 @@ public void update() { // should only be called on the server protected void updatePreviousFluid(FluidStack currentFluid) { previousFluid = currentFluid == null ? null : currentFluid.copy(); - writeCustomData(UPDATE_FLUID, buf -> buf.writeCompoundTag(currentFluid == null ? null : currentFluid.writeToNBT(new NBTTagCompound()))); + writeCustomData(UPDATE_FLUID, buf -> buf + .writeCompoundTag(currentFluid == null ? null : currentFluid.writeToNBT(new NBTTagCompound()))); } @Override @@ -170,12 +177,14 @@ public void readFromNBT(NBTTagCompound data) { this.allowInputFromOutputSide = data.getBoolean("AllowInputFromOutputSideF"); } - public static void legacyTankItemHandlerNBTReading(MetaTileEntity mte, NBTTagCompound nbt, int inputSlot, int outputSlot) { + public static void legacyTankItemHandlerNBTReading(MetaTileEntity mte, NBTTagCompound nbt, int inputSlot, + int outputSlot) { if (mte == null || nbt == null) { return; } NBTTagList items = nbt.getTagList("Items", Constants.NBT.TAG_COMPOUND); - if (mte.getExportItems().getSlots() < 1 || mte.getImportItems().getSlots() < 1 || inputSlot < 0 || outputSlot < 0 || inputSlot == outputSlot) { + if (mte.getExportItems().getSlots() < 1 || mte.getImportItems().getSlots() < 1 || inputSlot < 0 || + outputSlot < 0 || inputSlot == outputSlot) { return; } for (int i = 0; i < items.tagCount(); ++i) { @@ -237,7 +246,8 @@ protected FluidTankList createExportFluidHandler() { @Override protected IItemHandlerModifiable createImportItemHandler() { - return new FilteredItemHandler(this, 1).setFillPredicate(FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); + return new FilteredItemHandler(this, 1).setFillPredicate( + FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); } @Override @@ -248,7 +258,8 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { Textures.QUANTUM_STORAGE_RENDERER.renderMachine(renderState, translation, - ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), + ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), this.getFrontFacing(), this.tier); Textures.QUANTUM_TANK_OVERLAY.renderSided(EnumFacing.UP, renderState, translation, pipeline); if (outputFacing != null) { @@ -257,7 +268,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, Textures.FLUID_OUTPUT_OVERLAY.renderSided(outputFacing, renderState, translation, pipeline); } } - QuantumStorageRenderer.renderTankFluid(renderState, translation, pipeline, fluidTank, getWorld(), getPos(), getFrontFacing()); + QuantumStorageRenderer.renderTankFluid(renderState, translation, pipeline, fluidTank, getWorld(), getPos(), + getFrontFacing()); } @Override @@ -282,7 +294,8 @@ public void addInformation(ItemStack stack, @Nullable World player, List if (tag.hasKey(FLUID_NBT_KEY, Constants.NBT.TAG_COMPOUND)) { FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tag.getCompoundTag(FLUID_NBT_KEY)); if (fluidStack != null) { - tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_stored", fluidStack.getLocalizedName(), fluidStack.amount)); + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_stored", fluidStack.getLocalizedName(), + fluidStack.amount)); } } if (tag.getBoolean("IsVoiding") || tag.getBoolean("IsPartialVoiding")) { // legacy save support @@ -315,7 +328,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { this.lockedFluid.amount = 1; } }) - .setAlwaysShowFull(true).setDrawHoveringText(false); + .setAlwaysShowFull(true).setDrawHoveringText(false); return ModularUI.defaultBuilder() .widget(new ImageWidget(7, 16, 81, 46, GuiTextures.DISPLAY)) @@ -330,16 +343,16 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)) .widget(new ToggleButtonWidget(7, 64, 18, 18, GuiTextures.BUTTON_FLUID_OUTPUT, this::isAutoOutputFluids, this::setAutoOutputFluids) - .setTooltipText("gregtech.gui.fluid_auto_output.tooltip") - .shouldUseBaseBackground()) + .setTooltipText("gregtech.gui.fluid_auto_output.tooltip") + .shouldUseBaseBackground()) .widget(new ToggleButtonWidget(25, 64, 18, 18, GuiTextures.BUTTON_LOCK, this::isLocked, this::setLocked) - .setTooltipText("gregtech.gui.fluid_lock.tooltip") - .shouldUseBaseBackground()) + .setTooltipText("gregtech.gui.fluid_lock.tooltip") + .shouldUseBaseBackground()) .widget(new ToggleButtonWidget(43, 64, 18, 18, GuiTextures.BUTTON_FLUID_VOID, this::isVoiding, this::setVoiding) - .setTooltipText("gregtech.gui.fluid_voiding.tooltip") - .shouldUseBaseBackground()) + .setTooltipText("gregtech.gui.fluid_voiding.tooltip") + .shouldUseBaseBackground()) .bindPlayerInventory(entityPlayer.inventory) .build(getHolder(), entityPlayer); } @@ -393,7 +406,7 @@ public void setFrontFacing(EnumFacing frontFacing) { super.setFrontFacing(frontFacing); } if (this.outputFacing == null) { - //set initial output facing as opposite to front + // set initial output facing as opposite to front setOutputFacing(frontFacing.getOpposite()); } } @@ -431,7 +444,8 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { try { this.fluidTank.setFluid(FluidStack.loadFluidStackFromNBT(buf.readCompoundTag())); } catch (IOException ignored) { - GTLog.logger.warn("Failed to load fluid from NBT in a quantum tank at " + this.getPos() + " on a routine fluid update"); + GTLog.logger.warn("Failed to load fluid from NBT in a quantum tank at " + this.getPos() + + " on a routine fluid update"); } scheduleRenderUpdate(); } else if (dataId == UPDATE_FLUID_AMOUNT) { @@ -456,7 +470,8 @@ public void writeInitialSyncData(PacketBuffer buf) { buf.writeByte(getOutputFacing().getIndex()); buf.writeBoolean(autoOutputFluids); buf.writeBoolean(locked); - buf.writeCompoundTag(fluidTank.getFluid() == null ? null : fluidTank.getFluid().writeToNBT(new NBTTagCompound())); + buf.writeCompoundTag( + fluidTank.getFluid() == null ? null : fluidTank.getFluid().writeToNBT(new NBTTagCompound())); buf.writeBoolean(voiding); } @@ -477,7 +492,8 @@ public void receiveInitialSyncData(PacketBuffer buf) { try { this.fluidTank.setFluid(FluidStack.loadFluidStackFromNBT(buf.readCompoundTag())); } catch (IOException e) { - GTLog.logger.warn("Failed to load fluid from NBT in a quantum tank at " + this.getPos() + " on initial server/client sync"); + GTLog.logger.warn("Failed to load fluid from NBT in a quantum tank at " + this.getPos() + + " on initial server/client sync"); } this.voiding = buf.readBoolean(); } @@ -499,7 +515,8 @@ public T getCapability(Capability capability, EnumFacing side) { } return null; } else if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { - IFluidHandler fluidHandler = (side == getOutputFacing() && !isAllowInputFromOutputSideFluids()) ? outputFluidInventory : fluidInventory; + IFluidHandler fluidHandler = (side == getOutputFacing() && !isAllowInputFromOutputSideFluids()) ? + outputFluidInventory : fluidInventory; if (fluidHandler.getTankProperties().length > 0) { return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(fluidHandler); } @@ -515,7 +532,8 @@ public ICapabilityProvider initItemStackCapabilities(ItemStack itemStack) { } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { if (getOutputFacing() == facing || getFrontFacing() == facing) { return false; @@ -529,16 +547,20 @@ public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fa } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { EnumFacing hitFacing = CoverRayTracer.determineGridSideHit(hitResult); if (facing == getOutputFacing() || (hitFacing == getOutputFacing() && playerIn.isSneaking())) { if (!getWorld().isRemote) { if (isAllowInputFromOutputSideFluids()) { setAllowInputFromOutputSide(false); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.disallow"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.disallow"), + true); } else { setAllowInputFromOutputSide(true); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.allow"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.allow"), true); } } return true; @@ -595,13 +617,13 @@ protected void setVoiding(boolean isPartialVoid) { @Override public ItemStack getPickItem(EntityPlayer player) { - if(!player.isCreative()) return super.getPickItem(player); + if (!player.isCreative()) return super.getPickItem(player); ItemStack baseItemStack = getStackForm(); NBTTagCompound tag = new NBTTagCompound(); this.writeItemStackData(tag); - if(!tag.isEmpty()) { + if (!tag.isEmpty()) { baseItemStack.setTagCompound(tag); } return baseItemStack; diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java index e1c46526e09..e46c10cef79 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import com.google.common.base.Preconditions; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.ModularUI.Builder; @@ -28,6 +23,7 @@ import gregtech.common.inventory.handlers.ToolItemStackHandler; import gregtech.common.inventory.itemsource.ItemSources; import gregtech.common.inventory.itemsource.sources.InventoryItemSource; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -39,18 +35,26 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import com.google.common.base.Preconditions; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityWorkbench extends MetaTileEntity implements ICraftingStorage { + private final ItemStackHandler internalInventory = new GTItemStackHandler(this, 18); private final ItemStackHandler craftingGrid = new SingleItemStackHandler(9); private final ItemStackHandler toolInventory = new ToolItemStackHandler(9); @@ -65,35 +69,43 @@ public MetaTileEntityWorkbench(ResourceLocation metaTileEntityId) { super(metaTileEntityId); } - public static AbstractWidgetGroup createWorkbenchTab(CraftingRecipeLogic craftingRecipeLogic, ItemStackHandler craftingGrid, CraftingRecipeMemory recipeMemory, - ItemStackHandler toolInventory, ItemStackHandler internalInventory) { + public static AbstractWidgetGroup createWorkbenchTab(CraftingRecipeLogic craftingRecipeLogic, + ItemStackHandler craftingGrid, + CraftingRecipeMemory recipeMemory, + ItemStackHandler toolInventory, + ItemStackHandler internalInventory) { WidgetGroup widgetGroup = new WidgetGroup(); widgetGroup.addWidget(new ImageWidget(88 - 13, 44 - 14, 26, 26, GuiTextures.SLOT)); widgetGroup.addWidget(new CraftingSlotWidget(craftingRecipeLogic, 0, 88 - 9, 44 - 9)); - //crafting grid + // crafting grid widgetGroup.addWidget(new CraftingStationInputWidgetGroup(4, 7, craftingGrid, craftingRecipeLogic)); Supplier textSupplier = () -> Integer.toString(craftingRecipeLogic.getItemsCraftedAmount()); widgetGroup.addWidget(new SimpleTextWidget(88, 44 + 19, "", textSupplier)); Consumer clearAction = (clickData) -> craftingRecipeLogic.clearCraftingGrid(); - widgetGroup.addWidget(new ClickButtonWidget(8 + 18 * 3 + 3, 16, 8, 8, "", clearAction).setButtonTexture(GuiTextures.BUTTON_CLEAR_GRID)); + widgetGroup.addWidget(new ClickButtonWidget(8 + 18 * 3 + 3, 16, 8, 8, "", clearAction) + .setButtonTexture(GuiTextures.BUTTON_CLEAR_GRID)); - widgetGroup.addWidget(new ImageWidget(168 - 18 * 3, 44 - 19 * 3 / 2, 18 * 3, 18 * 3, TextureArea.fullImage("textures/gui/base/darkened_slot.png"))); + widgetGroup.addWidget(new ImageWidget(168 - 18 * 3, 44 - 19 * 3 / 2, 18 * 3, 18 * 3, + TextureArea.fullImage("textures/gui/base/darkened_slot.png"))); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { - widgetGroup.addWidget(new MemorizedRecipeWidget(recipeMemory, j + i * 3, craftingGrid, 168 - 18 * 3 / 2 - 27 + j * 18, 44 - 28 + i * 18)); + widgetGroup.addWidget(new MemorizedRecipeWidget(recipeMemory, j + i * 3, craftingGrid, + 168 - 18 * 3 / 2 - 27 + j * 18, 44 - 28 + i * 18)); } } - //tool inventory + // tool inventory for (int i = 0; i < 9; i++) { - widgetGroup.addWidget(new SlotWidget(toolInventory, i, 7 + i * 18, 75).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.TOOL_SLOT_OVERLAY)); + widgetGroup.addWidget(new SlotWidget(toolInventory, i, 7 + i * 18, 75) + .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.TOOL_SLOT_OVERLAY)); } - //internal inventory + // internal inventory for (int i = 0; i < 2; ++i) { for (int j = 0; j < 9; ++j) { - widgetGroup.addWidget(new SlotWidget(internalInventory, j + i * 9, 7 + j * 18, 98 + i * 18).setBackgroundTexture(GuiTextures.SLOT)); + widgetGroup.addWidget(new SlotWidget(internalInventory, j + i * 9, 7 + j * 18, 98 + i * 18) + .setBackgroundTexture(GuiTextures.SLOT)); } } return widgetGroup; @@ -190,7 +202,6 @@ private AbstractWidgetGroup createItemListTab() { @Override protected ModularUI createUI(EntityPlayer entityPlayer) { - createCraftingRecipeLogic(entityPlayer); Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 221) @@ -199,7 +210,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { TabGroup tabGroup = new TabGroup<>(TabLocation.HORIZONTAL_TOP_LEFT, Position.ORIGIN); tabGroup.addTab(new ItemTabInfo("gregtech.machine.workbench.tab.workbench", - new ItemStack(Blocks.CRAFTING_TABLE)), createWorkbenchTab(recipeLogic, craftingGrid, recipeMemory, toolInventory, internalInventory)); + new ItemStack(Blocks.CRAFTING_TABLE)), + createWorkbenchTab(recipeLogic, craftingGrid, recipeMemory, toolInventory, internalInventory)); tabGroup.addTab(new ItemTabInfo("gregtech.machine.workbench.tab.item_list", new ItemStack(Blocks.CHEST)), createItemListTab()); builder.widget(tabGroup); diff --git a/src/main/java/gregtech/common/pipelike/cable/BlockCable.java b/src/main/java/gregtech/common/pipelike/cable/BlockCable.java index 24788e11b2a..70e789cec47 100644 --- a/src/main/java/gregtech/common/pipelike/cable/BlockCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/BlockCable.java @@ -1,6 +1,5 @@ package gregtech.common.pipelike.cable; -import com.google.common.base.Preconditions; import gregtech.api.GregTechAPI; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.damagesources.DamageSources; @@ -19,6 +18,7 @@ import gregtech.common.pipelike.cable.tile.TileEntityCable; import gregtech.common.pipelike.cable.tile.TileEntityCableTickable; import gregtech.core.advancement.AdvancementTriggers; + import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -37,15 +37,19 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.base.Preconditions; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.TreeMap; -public class BlockCable extends BlockMaterialPipe implements ITileEntityProvider { +import javax.annotation.Nonnull; + +public class BlockCable extends BlockMaterialPipe + implements ITileEntityProvider { private final Map enabledMaterials = new TreeMap<>(); @@ -58,7 +62,8 @@ public BlockCable(Insulation cableType, MaterialRegistry registry) { public void addCableMaterial(Material material, WireProperties wireProperties) { Preconditions.checkNotNull(material, "material was null"); Preconditions.checkNotNull(wireProperties, "material %s wireProperties was null", material); - Preconditions.checkArgument(material.getRegistry().getNameForObject(material) != null, "material %s is not registered", material); + Preconditions.checkArgument(material.getRegistry().getNameForObject(material) != null, + "material %s is not registered", material); if (!pipeType.orePrefix.isIgnored(material)) { this.enabledMaterials.put(material, wireProperties); } @@ -135,13 +140,16 @@ public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull I } @Override - public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, IPipeTile sideTile) { + public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, + IPipeTile sideTile) { return selfTile instanceof TileEntityCable && sideTile instanceof TileEntityCable; } @Override - public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, TileEntity tile) { - return tile != null && tile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, side.getOpposite()) != null; + public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, + TileEntity tile) { + return tile != null && + tile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, side.getOpposite()) != null; } @Override @@ -154,7 +162,8 @@ public boolean isHoldingPipe(EntityPlayer player) { } @Override - public void onEntityCollision(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Entity entityIn) { + public void onEntityCollision(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull Entity entityIn) { if (worldIn.isRemote) return; Insulation insulation = getPipeTileEntity(worldIn, pos).getPipeType(); if (insulation.insulationLevel == -1 && entityIn instanceof EntityLivingBase) { diff --git a/src/main/java/gregtech/common/pipelike/cable/Insulation.java b/src/main/java/gregtech/common/pipelike/cable/Insulation.java index f06508417d1..6587144ce8a 100644 --- a/src/main/java/gregtech/common/pipelike/cable/Insulation.java +++ b/src/main/java/gregtech/common/pipelike/cable/Insulation.java @@ -60,13 +60,13 @@ public boolean isCable() { @Override public WireProperties modifyProperties(WireProperties baseProperties) { - int lossPerBlock; if (!baseProperties.isSuperconductor() && baseProperties.getLossPerBlock() == 0) lossPerBlock = (int) (0.75 * lossMultiplier); else lossPerBlock = baseProperties.getLossPerBlock() * lossMultiplier; - return new WireProperties(baseProperties.getVoltage(), baseProperties.getAmperage() * amperage, lossPerBlock, baseProperties.isSuperconductor()); + return new WireProperties(baseProperties.getVoltage(), baseProperties.getAmperage() * amperage, lossPerBlock, + baseProperties.isSuperconductor()); } @Override diff --git a/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java b/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java index 5f6cc32fc60..f054c37746f 100644 --- a/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java @@ -7,12 +7,14 @@ import gregtech.api.util.GTUtility; import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -26,11 +28,13 @@ public ItemBlockCable(BlockCable block) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); WireProperties wireProperties = blockPipe.createItemProperties(stack); int tier = GTUtility.getTierByVoltage(wireProperties.getVoltage()); - if (wireProperties.isSuperconductor()) tooltip.add(I18n.format("gregtech.cable.superconductor", GTValues.VN[tier])); + if (wireProperties.isSuperconductor()) + tooltip.add(I18n.format("gregtech.cable.superconductor", GTValues.VN[tier])); tooltip.add(I18n.format("gregtech.cable.voltage", wireProperties.getVoltage(), GTValues.VNF[tier])); tooltip.add(I18n.format("gregtech.cable.amperage", wireProperties.getAmperage())); tooltip.add(I18n.format("gregtech.cable.loss_per_block", wireProperties.getLossPerBlock())); @@ -45,7 +49,8 @@ public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @N if (ConfigHolder.misc.debug) { BlockMaterialPipe blockMaterialPipe = (BlockMaterialPipe) blockPipe; - tooltip.add("MetaItem Id: " + blockMaterialPipe.getPrefix().name + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString()); + tooltip.add("MetaItem Id: " + blockMaterialPipe.getPrefix().name + + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString()); } } } diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java index 26cd507f124..8d6f7110cb1 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java @@ -4,11 +4,13 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.WireProperties; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.*; public class EnergyNet extends PipeNet { @@ -66,7 +68,8 @@ public void onPipeConnectionsUpdate() { } @Override - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { super.transferNodeData(transferredNodes, parentNet); NET_DATA.clear(); ((EnergyNet) parentNet).NET_DATA.clear(); diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetHandler.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetHandler.java index dbb47628a7b..181f78b2a96 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetHandler.java @@ -4,6 +4,7 @@ import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; import gregtech.common.pipelike.cable.tile.TileEntityCable; + import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; @@ -79,7 +80,9 @@ public long acceptEnergyFromNetwork(EnumFacing side, long voltage, long amperage boolean cableBroken = false; for (TileEntityCable cable : path.getPath()) { if (cable.getMaxVoltage() < voltage) { - int heat = (int) (Math.log(GTUtility.getTierByVoltage(voltage) - GTUtility.getTierByVoltage(cable.getMaxVoltage())) * 45 + 36.5); + int heat = (int) (Math.log( + GTUtility.getTierByVoltage(voltage) - GTUtility.getTierByVoltage(cable.getMaxVoltage())) * + 45 + 36.5); cable.applyHeat(heat); cableBroken = cable.isInvalid(); diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java index 3603d3fc85d..96aee6229b8 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java @@ -4,16 +4,19 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.pipenet.PipeNetWalker; import gregtech.common.pipelike.cable.tile.TileEntityCable; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + public class EnergyNetWalker extends PipeNetWalker { public static List createNetData(World world, BlockPos sourcePipe) { @@ -35,7 +38,8 @@ protected EnergyNetWalker(World world, BlockPos sourcePipe, int walkedBlocks, Li } @Override - protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, int walkedBlocks) { + protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, + int walkedBlocks) { EnergyNetWalker walker = new EnergyNetWalker(world, nextPos, walkedBlocks, routes); walker.loss = loss; walker.pipes = pipes; @@ -49,11 +53,14 @@ protected void checkPipe(TileEntityCable pipeTile, BlockPos pos) { } @Override - protected void checkNeighbour(TileEntityCable pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, @Nullable TileEntity neighbourTile) { + protected void checkNeighbour(TileEntityCable pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, + @Nullable TileEntity neighbourTile) { // assert that the last added pipe is the current pipe - if (pipeTile != pipes[pipes.length - 1]) throw new IllegalStateException("The current pipe is not the last added pipe. Something went seriously wrong!"); + if (pipeTile != pipes[pipes.length - 1]) throw new IllegalStateException( + "The current pipe is not the last added pipe. Something went seriously wrong!"); if (neighbourTile != null) { - IEnergyContainer container = neighbourTile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, faceToNeighbour.getOpposite()); + IEnergyContainer container = neighbourTile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + faceToNeighbour.getOpposite()); if (container != null) { routes.add(new EnergyRoutePath(faceToNeighbour, pipes, getWalkedBlocks(), loss)); } diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyRoutePath.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyRoutePath.java index a3b42b46174..83e2c9856d0 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/EnergyRoutePath.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyRoutePath.java @@ -4,7 +4,9 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.pipenet.IRoutePath; import gregtech.common.pipelike.cable.tile.TileEntityCable; + import net.minecraft.util.EnumFacing; + import org.jetbrains.annotations.NotNull; public class EnergyRoutePath implements IRoutePath { diff --git a/src/main/java/gregtech/common/pipelike/cable/net/WorldENet.java b/src/main/java/gregtech/common/pipelike/cable/net/WorldENet.java index 4ecb922beb2..32f06681d65 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/WorldENet.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/WorldENet.java @@ -2,6 +2,7 @@ import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.WireProperties; + import net.minecraft.world.World; public class WorldENet extends WorldPipeNet { @@ -27,5 +28,4 @@ public WorldENet(String name) { protected EnergyNet createNetInstance() { return new EnergyNet(this); } - } diff --git a/src/main/java/gregtech/common/pipelike/cable/tile/PerTickLongCounter.java b/src/main/java/gregtech/common/pipelike/cable/tile/PerTickLongCounter.java index c62785d3be7..e2fe2e9102e 100644 --- a/src/main/java/gregtech/common/pipelike/cable/tile/PerTickLongCounter.java +++ b/src/main/java/gregtech/common/pipelike/cable/tile/PerTickLongCounter.java @@ -24,11 +24,11 @@ private void checkValueState(World world) { long currentWorldTime = world.getTotalWorldTime(); if (currentWorldTime != lastUpdatedWorldTime) { if (currentWorldTime == lastUpdatedWorldTime + 1) { - //last updated time is 1 tick ago, so we can move current value to last - //before resetting it to default value + // last updated time is 1 tick ago, so we can move current value to last + // before resetting it to default value this.lastValue = currentValue; } else { - //otherwise, set last value as default value + // otherwise, set last value as default value this.lastValue = defaultValue; } this.lastUpdatedWorldTime = currentWorldTime; diff --git a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java index 913c7f429ef..5550648cd14 100644 --- a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java @@ -1,6 +1,5 @@ package gregtech.common.pipelike.cable.tile; -import codechicken.lib.vec.Cuboid6; import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IEnergyContainer; @@ -18,6 +17,7 @@ import gregtech.common.pipelike.cable.net.EnergyNet; import gregtech.common.pipelike.cable.net.EnergyNetHandler; import gregtech.common.pipelike.cable.net.WorldENet; + import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -30,17 +30,21 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.vec.Cuboid6; + import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.CABLE_TEMPERATURE; import static gregtech.api.capability.GregtechDataCodes.UPDATE_CONNECTIONS; -public class TileEntityCable extends TileEntityMaterialPipeBase implements IDataInfoProvider { +public class TileEntityCable extends TileEntityMaterialPipeBase + implements IDataInfoProvider { private static final int meltTemp = 3000; @@ -263,7 +267,6 @@ public T getCapabilityInternal(Capability capability, @Nullable EnumFacin return super.getCapabilityInternal(capability, facing); } - public void checkNetwork() { if (defaultHandler != null) { EnergyNet current = getEnergyNet(); @@ -282,7 +285,7 @@ private EnergyNet getEnergyNet() { EnergyNet currentEnergyNet = this.currentEnergyNet.get(); if (currentEnergyNet != null && currentEnergyNet.isValid() && currentEnergyNet.containsNode(getPos())) - return currentEnergyNet; //return current net if it is still valid + return currentEnergyNet; // return current net if it is still valid WorldENet worldENet = WorldENet.getWorldENet(getWorld()); currentEnergyNet = worldENet.getNetFromPos(getPos()); if (currentEnergyNet != null) { @@ -345,11 +348,11 @@ public void readFromNBT(@Nonnull NBTTagCompound compound) { public List getDataInfo() { List list = new ArrayList<>(); list.add(new TextComponentTranslation("behavior.tricorder.eut_per_sec", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(this.getAverageVoltage())).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(this.getAverageVoltage())) + .setStyle(new Style().setColor(TextFormatting.RED)))); list.add(new TextComponentTranslation("behavior.tricorder.amp_per_sec", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(this.getAverageAmperage())).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(this.getAverageAmperage())) + .setStyle(new Style().setColor(TextFormatting.RED)))); return list; } } diff --git a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCableTickable.java b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCableTickable.java index 214fd373856..29b9592cdb3 100644 --- a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCableTickable.java +++ b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCableTickable.java @@ -4,8 +4,7 @@ public class TileEntityCableTickable extends TileEntityCable implements ITickable { - public TileEntityCableTickable() { - } + public TileEntityCableTickable() {} @Override public void update() { diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/BlockFluidPipe.java b/src/main/java/gregtech/common/pipelike/fluidpipe/BlockFluidPipe.java index 49c777d6e10..71c10eed334 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/BlockFluidPipe.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/BlockFluidPipe.java @@ -1,6 +1,5 @@ package gregtech.common.pipelike.fluidpipe; -import com.google.common.base.Preconditions; import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.pipenet.block.material.BlockMaterialPipe; @@ -15,6 +14,7 @@ import gregtech.common.pipelike.fluidpipe.net.WorldFluidPipeNet; import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipe; import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipeTickable; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.creativetab.CreativeTabs; @@ -32,14 +32,17 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.base.Preconditions; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; import java.util.SortedMap; import java.util.TreeMap; +import javax.annotation.Nonnull; + public class BlockFluidPipe extends BlockMaterialPipe { private final SortedMap enabledMaterials = new TreeMap<>(); @@ -53,7 +56,8 @@ public BlockFluidPipe(FluidPipeType pipeType, MaterialRegistry registry) { public void addPipeMaterial(Material material, FluidPipeProperties fluidPipeProperties) { Preconditions.checkNotNull(material, "material"); Preconditions.checkNotNull(fluidPipeProperties, "material %s fluidPipeProperties was null", material); - Preconditions.checkArgument(material.getRegistry().getNameForObject(material) != null, "material %s is not registered", material); + Preconditions.checkArgument(material.getRegistry().getNameForObject(material) != null, + "material %s is not registered", material); this.enabledMaterials.put(material, fluidPipeProperties); } @@ -98,17 +102,20 @@ public void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList selfTile, EnumFacing side, IPipeTile sideTile) { + public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, + IPipeTile sideTile) { return selfTile instanceof TileEntityFluidPipe && sideTile instanceof TileEntityFluidPipe; } @Override - public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, TileEntity tile) { - return tile != null && tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side.getOpposite()) != null; + public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, + TileEntity tile) { + return tile != null && + tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side.getOpposite()) != null; } @Override @@ -121,10 +128,12 @@ public boolean isHoldingPipe(EntityPlayer player) { } @Override - public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Entity entityIn) { + public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull Entity entityIn) { if (worldIn.isRemote) return; TileEntityFluidPipe pipe = (TileEntityFluidPipe) getPipeTileEntity(worldIn, pos); - if (pipe instanceof TileEntityFluidPipeTickable && pipe.getFrameMaterial() == null && ((TileEntityFluidPipeTickable) pipe).getOffsetTimer() % 10 == 0) { + if (pipe instanceof TileEntityFluidPipeTickable && pipe.getFrameMaterial() == null && + ((TileEntityFluidPipeTickable) pipe).getOffsetTimer() % 10 == 0) { if (entityIn instanceof EntityLivingBase) { if (((TileEntityFluidPipeTickable) pipe).getFluidTanks().length > 1) { // apply temperature damage for the hottest and coldest pipe (multi fluid pipes) @@ -132,8 +141,10 @@ public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @No int minTemperature = Integer.MAX_VALUE; for (FluidTank tank : ((TileEntityFluidPipeTickable) pipe).getFluidTanks()) { if (tank.getFluid() != null && tank.getFluid().amount > 0) { - maxTemperature = Math.max(maxTemperature, tank.getFluid().getFluid().getTemperature(tank.getFluid())); - minTemperature = Math.min(minTemperature, tank.getFluid().getFluid().getTemperature(tank.getFluid())); + maxTemperature = Math.max(maxTemperature, + tank.getFluid().getFluid().getTemperature(tank.getFluid())); + minTemperature = Math.min(minTemperature, + tank.getFluid().getFluid().getTemperature(tank.getFluid())); } } if (maxTemperature != Integer.MIN_VALUE) { @@ -146,7 +157,8 @@ public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @No FluidTank tank = ((TileEntityFluidPipeTickable) pipe).getFluidTanks()[0]; if (tank.getFluid() != null && tank.getFluid().amount > 0) { // Apply temperature damage for the pipe (single fluid pipes) - EntityDamageUtil.applyTemperatureDamage((EntityLivingBase) entityIn, tank.getFluid().getFluid().getTemperature(), 1.0F, 5); + EntityDamageUtil.applyTemperatureDamage((EntityLivingBase) entityIn, + tank.getFluid().getFluid().getTemperature(), 1.0F, 5); } } } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/FluidPipeType.java b/src/main/java/gregtech/common/pipelike/fluidpipe/FluidPipeType.java index c82164d7540..bbb3339a507 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/FluidPipeType.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/FluidPipeType.java @@ -30,7 +30,8 @@ public enum FluidPipeType implements IMaterialPipeType { this(name, thickness, capacityMultiplier, orePrefix, opaque, 1); } - FluidPipeType(String name, float thickness, int capacityMultiplier, OrePrefix orePrefix, boolean opaque, int channels) { + FluidPipeType(String name, float thickness, int capacityMultiplier, OrePrefix orePrefix, boolean opaque, + int channels) { this.name = name; this.thickness = thickness; this.capacityMultiplier = capacityMultiplier; diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java b/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java index 7770ef5ae95..150879cd4b2 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java @@ -5,12 +5,14 @@ import gregtech.api.unification.material.properties.FluidPipeProperties; import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -24,13 +26,15 @@ public ItemBlockFluidPipe(BlockFluidPipe block) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); FluidPipeProperties pipeProperties = blockPipe.createItemProperties(stack); tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_transfer_rate", pipeProperties.getThroughput())); tooltip.add(I18n.format("gregtech.fluid_pipe.capacity", pipeProperties.getThroughput() * 20)); tooltip.add(I18n.format("gregtech.fluid_pipe.max_temperature", pipeProperties.getMaxFluidTemperature())); - if (pipeProperties.getTanks() > 1) tooltip.add(I18n.format("gregtech.fluid_pipe.channels", pipeProperties.getTanks())); + if (pipeProperties.getTanks() > 1) + tooltip.add(I18n.format("gregtech.fluid_pipe.channels", pipeProperties.getTanks())); pipeProperties.appendTooltips(tooltip, false, false); @@ -43,7 +47,8 @@ public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @N BlockMaterialPipe blockMaterialPipe = (BlockMaterialPipe) blockPipe; if (ConfigHolder.misc.debug) { - tooltip.add("MetaItem Id: " + blockMaterialPipe.getPrefix().name + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString()); + tooltip.add("MetaItem Id: " + blockMaterialPipe.getPrefix().name + + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString()); } } } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java b/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java index aa6817e0493..ecca27a4c52 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java @@ -1,9 +1,5 @@ package gregtech.common.pipelike.fluidpipe.longdistance; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.FluidHandlerDelegate; import gregtech.api.gui.ModularUI; @@ -13,6 +9,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.storage.MetaTileEntityLongDistanceEndpoint; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -23,6 +20,11 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; @@ -31,6 +33,7 @@ public class MetaTileEntityLDFluidEndpoint extends MetaTileEntityLongDistanceEndpoint { private static final FluidTank DEFAULT_TANK = new FluidTank(10000) { + @Override public int fill(FluidStack resource, boolean doFill) { return 0; @@ -70,7 +73,8 @@ public T getCapability(Capability capability, EnumFacing side) { if (te != null) { T t = te.getCapability(capability, outputFacing.getOpposite()); if (t != null) { - return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(new FluidHandlerWrapper((IFluidHandler) t)); + return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY + .cast(new FluidHandlerWrapper((IFluidHandler) t)); } } } @@ -81,7 +85,8 @@ public T getCapability(Capability capability, EnumFacing side) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); Textures.VOLTAGE_CASINGS[GTValues.LV].render(renderState, translation, colouredPipeline); Textures.LD_FLUID_PIPE.renderOrientedState(renderState, translation, pipeline, frontFacing, false, false); Textures.PIPE_IN_OVERLAY.renderSided(getFrontFacing(), renderState, translation, pipeline); diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java b/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java index 4fca0cce91d..e073fc74cce 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java @@ -3,6 +3,7 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.FluidPipeProperties; + import net.minecraft.nbt.NBTTagCompound; public class FluidPipeNet extends PipeNet { @@ -31,6 +32,7 @@ protected FluidPipeProperties readNodeData(NBTTagCompound tagCompound) { boolean cryoProof = tagCompound.getBoolean("cryo_proof"); boolean plasmaProof = tagCompound.getBoolean("plasma_proof"); int channels = tagCompound.getInteger("channels"); - return new FluidPipeProperties(maxTemperature, throughput, gasProof, acidProof, cryoProof, plasmaProof, channels); + return new FluidPipeProperties(maxTemperature, throughput, gasProof, acidProof, cryoProof, plasmaProof, + channels); } } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/net/PipeTankList.java b/src/main/java/gregtech/common/pipelike/fluidpipe/net/PipeTankList.java index b70b438a3ac..5309c429bd0 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/net/PipeTankList.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/net/PipeTankList.java @@ -2,6 +2,7 @@ import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipe; import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipeTickable; + import net.minecraft.util.EnumFacing; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; @@ -9,11 +10,12 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.Iterator; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class PipeTankList implements IFluidHandler, Iterable { private final TileEntityFluidPipeTickable pipe; @@ -55,7 +57,8 @@ else if (f.isFluidEqual(stack)) @Override public int fill(FluidStack resource, boolean doFill) { int channel; - if (pipe.isFaceBlocked(facing) || resource == null || resource.amount <= 0 || (channel = findChannel(resource)) < 0) + if (pipe.isFaceBlocked(facing) || resource == null || resource.amount <= 0 || + (channel = findChannel(resource)) < 0) return 0; return fill(resource, doFill, channel); diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/net/WorldFluidPipeNet.java b/src/main/java/gregtech/common/pipelike/fluidpipe/net/WorldFluidPipeNet.java index 016a04d9bb2..9e58ed1ec14 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/net/WorldFluidPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/net/WorldFluidPipeNet.java @@ -2,6 +2,7 @@ import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.FluidPipeProperties; + import net.minecraft.world.World; public class WorldFluidPipeNet extends WorldPipeNet { @@ -27,5 +28,4 @@ public WorldFluidPipeNet(String name) { protected FluidPipeNet createNetInstance() { return new FluidPipeNet(this); } - } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipe.java b/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipe.java index 0b76b7c3cd5..0a566171bda 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipe.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipe.java @@ -6,6 +6,7 @@ import gregtech.common.pipelike.fluidpipe.FluidPipeType; import gregtech.common.pipelike.fluidpipe.net.FluidPipeNet; import gregtech.common.pipelike.fluidpipe.net.WorldFluidPipeNet; + import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -41,7 +42,7 @@ public FluidPipeNet getFluidPipeNet() { FluidPipeNet currentPipeNet = this.currentPipeNet.get(); if (currentPipeNet != null && currentPipeNet.isValid() && currentPipeNet.containsNode(getPipePos())) - return currentPipeNet; //if current net is valid and does contain position, return it + return currentPipeNet; // if current net is valid and does contain position, return it WorldFluidPipeNet worldFluidPipeNet = (WorldFluidPipeNet) getPipeBlock().getWorldPipeNet(getPipeWorld()); currentPipeNet = worldFluidPipeNet.getNetFromPos(getPipePos()); if (currentPipeNet != null) { @@ -62,7 +63,8 @@ public static void setNeighboursToFire(World world, BlockPos selfPos) { } } - public static void spawnParticles(World worldIn, BlockPos pos, EnumFacing direction, EnumParticleTypes particleType, int particleCount) { + public static void spawnParticles(World worldIn, BlockPos pos, EnumFacing direction, EnumParticleTypes particleType, + int particleCount) { if (worldIn instanceof WorldServer) { ((WorldServer) worldIn).spawnParticle(particleType, pos.getX() + 0.5, diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipeTickable.java b/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipeTickable.java index 9b9102c7661..038fef391f8 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipeTickable.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipeTickable.java @@ -15,6 +15,7 @@ import gregtech.common.covers.CoverPump; import gregtech.common.covers.ManualImportExportMode; import gregtech.common.pipelike.fluidpipe.net.PipeTankList; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; @@ -36,6 +37,7 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -124,7 +126,8 @@ private void distributeFluid(int channel, FluidTank tank, FluidStack fluid) { TileEntity neighbor = getNeighbor(facing); if (neighbor == null) continue; - IFluidHandler fluidHandler = neighbor.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing.getOpposite()); + IFluidHandler fluidHandler = neighbor.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + facing.getOpposite()); if (fluidHandler == null) continue; IFluidHandler pipeTank = tank; @@ -136,7 +139,8 @@ private void distributeFluid(int channel, FluidTank tank, FluidStack fluid) { // Shutter covers return null capability when active, so check here to prevent NPE if (pipeTank == null || checkForPumpCover(cover)) continue; } else { - CoverableView coverable = neighbor.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, facing.getOpposite()); + CoverableView coverable = neighbor.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, + facing.getOpposite()); if (coverable != null) { cover = coverable.getCoverAtSide(facing.getOpposite()); if (checkForPumpCover(cover)) continue; @@ -166,10 +170,17 @@ private void distributeFluid(int channel, FluidTank tank, FluidStack fluid) { // Now distribute for (FluidTransaction transaction : tanks) { if (availableCapacity > maxAmount) { - transaction.amount = (int) Math.floor(transaction.amount * maxAmount / availableCapacity); // Distribute fluids based on percentage available space at destination + transaction.amount = (int) Math.floor(transaction.amount * maxAmount / availableCapacity); // Distribute + // fluids + // based on + // percentage + // available + // space at + // destination } if (transaction.amount == 0) { - if (tank.getFluidAmount() <= 0) break; // If there is no more stored fluid, stop transferring to prevent dupes + if (tank.getFluidAmount() <= 0) break; // If there is no more stored fluid, stop transferring to prevent + // dupes transaction.amount = 1; // If the percent is not enough to give at least 1L, try to give 1L } else if (transaction.amount < 0) { continue; @@ -231,23 +242,27 @@ public void checkAndDestroy(@NotNull FluidStack stack) { } } - public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, boolean isCorroding, boolean isShattering, boolean isMelting) { + public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, boolean isCorroding, + boolean isShattering, boolean isMelting) { // prevent the sound from spamming when filled from anything not a pipe if (getOffsetTimer() % 10 == 0) { world.playSound(null, pos, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, 1.0F); } if (isLeaking) { - TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.SMOKE_NORMAL, 7 + GTValues.RNG.nextInt(2)); + TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.SMOKE_NORMAL, + 7 + GTValues.RNG.nextInt(2)); // voids 10% stack.amount = Math.max(0, stack.amount * 9 / 10); // apply heat damage in area surrounding the pipe if (getOffsetTimer() % 20 == 0) { - List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPipePos()).grow(2)); + List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, + new AxisAlignedBB(getPipePos()).grow(2)); for (EntityLivingBase entityLivingBase : entities) { - EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getTemperature(stack), 2.0F, 10); + EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getTemperature(stack), + 2.0F, 10); } } @@ -258,14 +273,16 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, } if (isCorroding) { - TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.CRIT_MAGIC, 3 + GTValues.RNG.nextInt(2)); + TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.CRIT_MAGIC, + 3 + GTValues.RNG.nextInt(2)); // voids 25% stack.amount = Math.max(0, stack.amount * 3 / 4); // apply chemical damage in area surrounding the pipe if (getOffsetTimer() % 20 == 0) { - List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPipePos()).grow(1)); + List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, + new AxisAlignedBB(getPipePos()).grow(1)); for (EntityLivingBase entityLivingBase : entities) { EntityDamageUtil.applyChemicalDamage(entityLivingBase, 2); } @@ -279,7 +296,8 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, } if (isBurning || isMelting) { - TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.FLAME, (isMelting ? 7 : 3) + GTValues.RNG.nextInt(2)); + TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.FLAME, + (isMelting ? 7 : 3) + GTValues.RNG.nextInt(2)); // voids 75% stack.amount = Math.max(0, stack.amount / 4); @@ -291,9 +309,11 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, // apply heat damage in area surrounding the pipe if (isMelting && getOffsetTimer() % 20 == 0) { - List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPipePos()).grow(2)); + List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, + new AxisAlignedBB(getPipePos()).grow(2)); for (EntityLivingBase entityLivingBase : entities) { - EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getTemperature(stack), 2.0F, 10); + EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getTemperature(stack), + 2.0F, 10); } } @@ -305,16 +325,19 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, } if (isShattering) { - TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.CLOUD, 3 + GTValues.RNG.nextInt(2)); + TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.CLOUD, + 3 + GTValues.RNG.nextInt(2)); // voids 75% stack.amount = Math.max(0, stack.amount / 4); // apply frost damage in area surrounding the pipe if (getOffsetTimer() % 20 == 0) { - List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPipePos()).grow(2)); + List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, + new AxisAlignedBB(getPipePos()).grow(2)); for (EntityLivingBase entityLivingBase : entities) { - EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getTemperature(stack), 2.0F, 10); + EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getTemperature(stack), + 2.0F, 10); } } @@ -431,10 +454,12 @@ public List getDataInfo() { allTanksEmpty = false; list.add(new TextComponentTranslation("behavior.tricorder.tank", i, - new TextComponentTranslation(TextFormattingUtil.formatNumbers(fluids[i].amount)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(this.getCapacityPerTank())).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(fluids[i].getFluid().getLocalizedName(fluids[i])).setStyle(new Style().setColor(TextFormatting.GOLD)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(fluids[i].amount)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(this.getCapacityPerTank())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation(fluids[i].getFluid().getLocalizedName(fluids[i])) + .setStyle(new Style().setColor(TextFormatting.GOLD)))); } } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/BlockItemPipe.java b/src/main/java/gregtech/common/pipelike/itempipe/BlockItemPipe.java index d6a8bddf5d2..975aeac1701 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/BlockItemPipe.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/BlockItemPipe.java @@ -1,6 +1,5 @@ package gregtech.common.pipelike.itempipe; -import com.google.common.base.Preconditions; import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.pipenet.block.material.BlockMaterialPipe; @@ -14,6 +13,7 @@ import gregtech.common.pipelike.itempipe.net.WorldItemPipeNet; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipeTickable; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.creativetab.CreativeTabs; @@ -28,14 +28,17 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.CapabilityItemHandler; + +import com.google.common.base.Preconditions; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import javax.annotation.Nonnull; + public class BlockItemPipe extends BlockMaterialPipe { private final Map enabledMaterials = new HashMap<>(); @@ -49,7 +52,8 @@ public BlockItemPipe(ItemPipeType itemPipeType, MaterialRegistry registry) { public void addPipeMaterial(Material material, ItemPipeProperties properties) { Preconditions.checkNotNull(material, "material"); Preconditions.checkNotNull(properties, "material %s itemPipeProperties was null", material); - Preconditions.checkArgument(material.getRegistry().getNameForObject(material) != null, "material %s is not registered", material); + Preconditions.checkArgument(material.getRegistry().getNameForObject(material) != null, + "material %s is not registered", material); this.enabledMaterials.put(material, properties); } @@ -102,13 +106,16 @@ public void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList selfTile, EnumFacing side, IPipeTile sideTile) { + public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, + IPipeTile sideTile) { return selfTile instanceof TileEntityItemPipe && sideTile instanceof TileEntityItemPipe; } @Override - public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, TileEntity tile) { - return tile != null && tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()) != null; + public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, + TileEntity tile) { + return tile != null && + tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()) != null; } @Override @@ -127,6 +134,4 @@ public boolean isHoldingPipe(EntityPlayer player) { public EnumBlockRenderType getRenderType(@Nonnull IBlockState state) { return ItemPipeRenderer.INSTANCE.getBlockRenderType(); } - - } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/ItemBlockItemPipe.java b/src/main/java/gregtech/common/pipelike/itempipe/ItemBlockItemPipe.java index 5a984d30415..ae90e8dcab1 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/ItemBlockItemPipe.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/ItemBlockItemPipe.java @@ -5,12 +5,14 @@ import gregtech.api.unification.material.properties.ItemPipeProperties; import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -24,13 +26,16 @@ public ItemBlockItemPipe(BlockItemPipe block) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); ItemPipeProperties pipeProperties = blockPipe.createItemProperties(stack); if (pipeProperties.getTransferRate() % 1 != 0) { - tooltip.add(I18n.format("gregtech.universal.tooltip.item_transfer_rate", (int) ((pipeProperties.getTransferRate() * 64) + 0.5))); + tooltip.add(I18n.format("gregtech.universal.tooltip.item_transfer_rate", + (int) ((pipeProperties.getTransferRate() * 64) + 0.5))); } else { - tooltip.add(I18n.format("gregtech.universal.tooltip.item_transfer_rate_stacks", (int) pipeProperties.getTransferRate())); + tooltip.add(I18n.format("gregtech.universal.tooltip.item_transfer_rate_stacks", + (int) pipeProperties.getTransferRate())); } tooltip.add(I18n.format("gregtech.item_pipe.priority", pipeProperties.getPriority())); @@ -44,7 +49,8 @@ public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @N if (ConfigHolder.misc.debug) { BlockMaterialPipe blockMaterialPipe = (BlockMaterialPipe) blockPipe; - tooltip.add("MetaItem Id: " + blockMaterialPipe.getPrefix().name + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString()); + tooltip.add("MetaItem Id: " + blockMaterialPipe.getPrefix().name + + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString()); } } } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/ItemPipeType.java b/src/main/java/gregtech/common/pipelike/itempipe/ItemPipeType.java index a433e9621f8..d13e338c4e8 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/ItemPipeType.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/ItemPipeType.java @@ -7,7 +7,8 @@ import javax.annotation.Nonnull; public enum ItemPipeType implements IMaterialPipeType { - //TINY_OPAQUE("tiny", 0.25f, OrePrefix.pipeTinyItem, 0.25f, 2f), + + // TINY_OPAQUE("tiny", 0.25f, OrePrefix.pipeTinyItem, 0.25f, 2f), SMALL("small", 0.375f, OrePrefix.pipeSmallItem, 0.5f, 1.5f), NORMAL("normal", 0.5f, OrePrefix.pipeNormalItem, 1f, 1f), LARGE("large", 0.75f, OrePrefix.pipeLargeItem, 2f, 0.75f), @@ -52,7 +53,8 @@ public float getThickness() { @Override public ItemPipeProperties modifyProperties(ItemPipeProperties baseProperties) { - return new ItemPipeProperties((int) ((baseProperties.getPriority() * resistanceMultiplier) + 0.5), baseProperties.getTransferRate() * rateMultiplier); + return new ItemPipeProperties((int) ((baseProperties.getPriority() * resistanceMultiplier) + 0.5), + baseProperties.getTransferRate() * rateMultiplier); } public float getRateMultiplier() { diff --git a/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java b/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java index 94e15ccd456..706c5ef4f07 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java @@ -1,9 +1,5 @@ package gregtech.common.pipelike.itempipe.longdistance; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.ItemHandlerDelegate; import gregtech.api.gui.ModularUI; @@ -13,6 +9,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.storage.MetaTileEntityLongDistanceEndpoint; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -23,6 +20,11 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; @@ -31,6 +33,7 @@ public class MetaTileEntityLDItemEndpoint extends MetaTileEntityLongDistanceEndpoint { private static final ItemStackHandler DEFAULT_INVENTORY = new ItemStackHandler(1) { + @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { @@ -71,7 +74,8 @@ public T getCapability(Capability capability, EnumFacing side) { if (te != null) { T t = te.getCapability(capability, outputFacing.getOpposite()); if (t != null) { - return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(new ItemHandlerWrapper((IItemHandler) t)); + return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY + .cast(new ItemHandlerWrapper((IItemHandler) t)); } } } @@ -82,13 +86,15 @@ public T getCapability(Capability capability, EnumFacing side) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); Textures.VOLTAGE_CASINGS[GTValues.LV].render(renderState, translation, colouredPipeline); Textures.LD_ITEM_PIPE.renderOrientedState(renderState, translation, pipeline, frontFacing, false, false); Textures.PIPE_IN_OVERLAY.renderSided(getFrontFacing(), renderState, translation, pipeline); Textures.ITEM_HATCH_INPUT_OVERLAY.renderSided(getFrontFacing(), renderState, translation, pipeline); Textures.PIPE_OUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, pipeline); - Textures.ITEM_HATCH_OUTPUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, pipeline); + Textures.ITEM_HATCH_OUTPUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, + pipeline); } @Override diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java index 448a5402158..8590e1b2254 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java @@ -8,24 +8,26 @@ import gregtech.api.util.ItemStackHashStrategy; import gregtech.common.covers.*; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.ArrayList; import java.util.Comparator; import java.util.Iterator; import java.util.List; +import javax.annotation.Nonnull; + public class ItemNetHandler implements IItemHandler { private ItemPipeNet net; @@ -87,7 +89,8 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate return insertFirst(stack, simulate); CoverConveyor conveyor = (CoverConveyor) (pipeConveyor ? pipeCover : tileCover); - if (conveyor.getConveyorMode() == (pipeConveyor ? CoverConveyor.ConveyorMode.IMPORT : CoverConveyor.ConveyorMode.EXPORT)) { + if (conveyor.getConveyorMode() == + (pipeConveyor ? CoverConveyor.ConveyorMode.IMPORT : CoverConveyor.ConveyorMode.EXPORT)) { boolean roundRobinGlobal = conveyor.getDistributionMode() == DistributionMode.ROUND_ROBIN_GLOBAL; if (roundRobinGlobal || conveyor.getDistributionMode() == DistributionMode.ROUND_ROBIN_PRIO) return insertRoundRobin(stack, simulate, roundRobinGlobal); @@ -223,7 +226,8 @@ private ItemStack insertToHandlersEnhanced(List copy, ItemStack s // equally distribute items over all inventories // it takes into account how much was inserted in total - // f.e. if inv1 has 2 inserted and inv2 has 6 inserted, it will first try to insert 4 into inv1 so that both have 6 and then it will distribute the rest equally + // f.e. if inv1 has 2 inserted and inv2 has 6 inserted, it will first try to insert 4 into inv1 so that both + // have 6 and then it will distribute the rest equally outer: while (amount > 0 && !transferredCopy.isEmpty()) { Iterator iterator = transferredCopy.iterator(); @@ -236,7 +240,7 @@ private ItemStack insertToHandlersEnhanced(List copy, ItemStack s int toInsert; if (nextStep <= 0) { if (amount <= m) { - //break outer; + // break outer; toInsert = 1; } else { toInsert = Math.min(c, amount); @@ -295,34 +299,43 @@ public ItemStack insert(ItemRoutePath routePath, ItemStack stack, boolean simula } public ItemStack insert(ItemRoutePath routePath, ItemStack stack, boolean simulate, boolean ignoreLimit) { - int allowed = ignoreLimit ? stack.getCount() : checkTransferable(routePath.getProperties().getTransferRate(), stack.getCount(), simulate); + int allowed = ignoreLimit ? stack.getCount() : + checkTransferable(routePath.getProperties().getTransferRate(), stack.getCount(), simulate); if (allowed == 0 || !routePath.matchesFilters(stack)) { return stack; } - Cover pipeCover = routePath.getTargetPipe().getCoverableImplementation().getCoverAtSide(routePath.getTargetFacing()); + Cover pipeCover = routePath.getTargetPipe().getCoverableImplementation() + .getCoverAtSide(routePath.getTargetFacing()); Cover tileCover = getCoverOnNeighbour(routePath.getTargetPipe(), routePath.getTargetFacing()); if (pipeCover != null) { testHandler.setStackInSlot(0, stack.copy()); - IItemHandler itemHandler = pipeCover.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, testHandler); - if (itemHandler == null || (itemHandler != testHandler && (allowed = itemHandler.extractItem(0, allowed, true).getCount()) <= 0)) { + IItemHandler itemHandler = pipeCover.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + testHandler); + if (itemHandler == null || (itemHandler != testHandler && + (allowed = itemHandler.extractItem(0, allowed, true).getCount()) <= 0)) { testHandler.setStackInSlot(0, ItemStack.EMPTY); return stack; } testHandler.setStackInSlot(0, ItemStack.EMPTY); } IItemHandler neighbourHandler = routePath.getHandler(); - if (pipeCover instanceof CoverRoboticArm && ((CoverRoboticArm) pipeCover).getConveyorMode() == CoverConveyor.ConveyorMode.EXPORT) { - return insertOverRobotArm(neighbourHandler, (CoverRoboticArm) pipeCover, stack, simulate, allowed, ignoreLimit); + if (pipeCover instanceof CoverRoboticArm && + ((CoverRoboticArm) pipeCover).getConveyorMode() == CoverConveyor.ConveyorMode.EXPORT) { + return insertOverRobotArm(neighbourHandler, (CoverRoboticArm) pipeCover, stack, simulate, allowed, + ignoreLimit); } - if (tileCover instanceof CoverRoboticArm && ((CoverRoboticArm) tileCover).getConveyorMode() == CoverConveyor.ConveyorMode.IMPORT) { - return insertOverRobotArm(neighbourHandler, (CoverRoboticArm) tileCover, stack, simulate, allowed, ignoreLimit); + if (tileCover instanceof CoverRoboticArm && + ((CoverRoboticArm) tileCover).getConveyorMode() == CoverConveyor.ConveyorMode.IMPORT) { + return insertOverRobotArm(neighbourHandler, (CoverRoboticArm) tileCover, stack, simulate, allowed, + ignoreLimit); } return insert(neighbourHandler, stack, simulate, allowed, ignoreLimit); } - private ItemStack insert(IItemHandler handler, ItemStack stack, boolean simulate, int allowed, boolean ignoreLimit) { + private ItemStack insert(IItemHandler handler, ItemStack stack, boolean simulate, int allowed, + boolean ignoreLimit) { if (stack.getCount() == allowed) { ItemStack re = GTTransferUtils.insertItem(handler, stack, simulate); if (!ignoreLimit) @@ -342,14 +355,16 @@ private ItemStack insert(IItemHandler handler, ItemStack stack, boolean simulate public Cover getCoverOnNeighbour(TileEntityItemPipe itemPipe, EnumFacing facing) { TileEntity tile = itemPipe.getNeighbor(facing); if (tile != null) { - CoverHolder coverHolder = tile.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, facing.getOpposite()); + CoverHolder coverHolder = tile.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, + facing.getOpposite()); if (coverHolder == null) return null; return coverHolder.getCoverAtSide(facing.getOpposite()); } return null; } - public ItemStack insertOverRobotArm(IItemHandler handler, CoverRoboticArm arm, ItemStack stack, boolean simulate, int allowed, boolean ignoreLimit) { + public ItemStack insertOverRobotArm(IItemHandler handler, CoverRoboticArm arm, ItemStack stack, boolean simulate, + int allowed, boolean ignoreLimit) { int rate; boolean isStackSpecific = false; Object index = arm.getItemFilterContainer().matchItemStack(stack); @@ -440,11 +455,11 @@ private void transferTo(ItemRoutePath routePath, boolean simulate, int amount) { simulatedTransfersGlobalRoundRobin.merge(routePath.toFacingPos(), amount, Integer::sum); else pipe.getTransferred().merge(routePath.toFacingPos(), amount, Integer::sum); - } private boolean contains(ItemRoutePath routePath, boolean simulate) { - return simulate ? simulatedTransfersGlobalRoundRobin.containsKey(routePath.toFacingPos()) : pipe.getTransferred().containsKey(routePath.toFacingPos()); + return simulate ? simulatedTransfersGlobalRoundRobin.containsKey(routePath.toFacingPos()) : + pipe.getTransferred().containsKey(routePath.toFacingPos()); } private int didTransferTo(ItemRoutePath routePath, boolean simulate) { diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java index 00ea1d8faff..56b5af5ba7d 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java @@ -8,6 +8,7 @@ import gregtech.common.covers.CoverShutter; import gregtech.common.covers.ItemFilterMode; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; + import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -16,12 +17,13 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; import java.util.function.Predicate; +import javax.annotation.Nullable; + public class ItemNetWalker extends PipeNetWalker { public static List createNetData(World world, BlockPos sourcePipe, EnumFacing faceToSourceHandler) { @@ -42,14 +44,16 @@ public static List createNetData(World world, BlockPos sourcePipe private BlockPos sourcePipe; private EnumFacing facingToHandler; - protected ItemNetWalker(World world, BlockPos sourcePipe, int distance, List inventories, ItemPipeProperties properties) { + protected ItemNetWalker(World world, BlockPos sourcePipe, int distance, List inventories, + ItemPipeProperties properties) { super(world, sourcePipe, distance); this.inventories = inventories; this.minProperties = properties; } @Override - protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, int walkedBlocks) { + protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, + BlockPos nextPos, int walkedBlocks) { ItemNetWalker walker = new ItemNetWalker(world, nextPos, walkedBlocks, inventories, minProperties); walker.facingToHandler = facingToHandler; walker.sourcePipe = sourcePipe; @@ -73,16 +77,20 @@ protected void checkPipe(TileEntityItemPipe pipeTile, BlockPos pos) { if (minProperties == null) { minProperties = pipeProperties; } else { - minProperties = new ItemPipeProperties(minProperties.getPriority() + pipeProperties.getPriority(), Math.min(minProperties.getTransferRate(), pipeProperties.getTransferRate())); + minProperties = new ItemPipeProperties(minProperties.getPriority() + pipeProperties.getPriority(), + Math.min(minProperties.getTransferRate(), pipeProperties.getTransferRate())); } } @Override - protected void checkNeighbour(TileEntityItemPipe pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, @Nullable TileEntity neighbourTile) { - if (neighbourTile == null || (GTUtility.arePosEqual(pipePos, sourcePipe) && faceToNeighbour == facingToHandler)) { + protected void checkNeighbour(TileEntityItemPipe pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, + @Nullable TileEntity neighbourTile) { + if (neighbourTile == null || + (GTUtility.arePosEqual(pipePos, sourcePipe) && faceToNeighbour == facingToHandler)) { return; } - IItemHandler handler = neighbourTile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, faceToNeighbour.getOpposite()); + IItemHandler handler = neighbourTile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + faceToNeighbour.getOpposite()); if (handler != null) { List> filters = new ArrayList<>(this.filters); List> moreFilters = nextFilters.get(faceToNeighbour); @@ -99,20 +107,23 @@ protected Class getBasePipeClass() { } @Override - protected boolean isValidPipe(TileEntityItemPipe currentPipe, TileEntityItemPipe neighbourPipe, BlockPos pipePos, EnumFacing faceToNeighbour) { + protected boolean isValidPipe(TileEntityItemPipe currentPipe, TileEntityItemPipe neighbourPipe, BlockPos pipePos, + EnumFacing faceToNeighbour) { Cover thisCover = currentPipe.getCoverableImplementation().getCoverAtSide(faceToNeighbour); Cover neighbourCover = neighbourPipe.getCoverableImplementation().getCoverAtSide(faceToNeighbour.getOpposite()); List> filters = new ArrayList<>(); if (thisCover instanceof CoverShutter) { - filters.add(stack -> !((CoverShutter) thisCover).isWorkingEnabled()); - } else if (thisCover instanceof CoverItemFilter && ((CoverItemFilter) thisCover).getFilterMode() != ItemFilterMode.FILTER_INSERT) { - filters.add(((CoverItemFilter) thisCover)::testItemStack); - } + filters.add(stack -> !((CoverShutter) thisCover).isWorkingEnabled()); + } else if (thisCover instanceof CoverItemFilter && + ((CoverItemFilter) thisCover).getFilterMode() != ItemFilterMode.FILTER_INSERT) { + filters.add(((CoverItemFilter) thisCover)::testItemStack); + } if (neighbourCover instanceof CoverShutter) { filters.add(stack -> !((CoverShutter) neighbourCover).isWorkingEnabled()); - } else if (neighbourCover instanceof CoverItemFilter && ((CoverItemFilter) neighbourCover).getFilterMode() != ItemFilterMode.FILTER_EXTRACT) { - filters.add(((CoverItemFilter) neighbourCover)::testItemStack); - } + } else if (neighbourCover instanceof CoverItemFilter && + ((CoverItemFilter) neighbourCover).getFilterMode() != ItemFilterMode.FILTER_EXTRACT) { + filters.add(((CoverItemFilter) neighbourCover)::testItemStack); + } if (!filters.isEmpty()) { nextFilters.put(faceToNeighbour, filters); } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemPipeNet.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemPipeNet.java index 2aa9a845661..25e6534b0f4 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemPipeNet.java @@ -4,6 +4,7 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.ItemPipeProperties; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -43,7 +44,8 @@ public void onPipeConnectionsUpdate() { } @Override - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { super.transferNodeData(transferredNodes, parentNet); NET_DATA.clear(); ((ItemPipeNet) parentNet).NET_DATA.clear(); diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java index 057cd665609..ccafca7be9a 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java @@ -4,15 +4,17 @@ import gregtech.api.unification.material.properties.ItemPipeProperties; import gregtech.api.util.FacingPos; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; + import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -import javax.annotation.Nonnull; import java.util.List; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class ItemRoutePath implements IRoutePath { private final TileEntityItemPipe targetPipe; @@ -21,7 +23,8 @@ public class ItemRoutePath implements IRoutePath { private final ItemPipeProperties properties; private final Predicate filters; - public ItemRoutePath(TileEntityItemPipe targetPipe, EnumFacing facing, int distance, ItemPipeProperties properties, List> filters) { + public ItemRoutePath(TileEntityItemPipe targetPipe, EnumFacing facing, int distance, ItemPipeProperties properties, + List> filters) { this.targetPipe = targetPipe; this.faceToHandler = facing; this.distance = distance; diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/WorldItemPipeNet.java b/src/main/java/gregtech/common/pipelike/itempipe/net/WorldItemPipeNet.java index 02da7ef905a..62cac8b52af 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/WorldItemPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/WorldItemPipeNet.java @@ -2,6 +2,7 @@ import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.ItemPipeProperties; + import net.minecraft.world.World; public class WorldItemPipeNet extends WorldPipeNet { diff --git a/src/main/java/gregtech/common/pipelike/itempipe/tile/TileEntityItemPipe.java b/src/main/java/gregtech/common/pipelike/itempipe/tile/TileEntityItemPipe.java index 227470a6f3c..d6c5362f2ed 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/tile/TileEntityItemPipe.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/tile/TileEntityItemPipe.java @@ -8,18 +8,21 @@ import gregtech.common.pipelike.itempipe.net.ItemNetHandler; import gregtech.common.pipelike.itempipe.net.ItemPipeNet; import gregtech.common.pipelike.itempipe.net.WorldItemPipeNet; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.lang.ref.WeakReference; import java.util.EnumMap; +import javax.annotation.Nullable; + public class TileEntityItemPipe extends TileEntityMaterialPipeBase { private final EnumMap handlers = new EnumMap<>(EnumFacing.class); @@ -91,7 +94,7 @@ public ItemPipeNet getItemPipeNet() { ItemPipeNet currentPipeNet = this.currentPipeNet.get(); if (currentPipeNet != null && currentPipeNet.isValid() && currentPipeNet.containsNode(getPipePos())) - return currentPipeNet; //if current net is valid and does contain position, return it + return currentPipeNet; // if current net is valid and does contain position, return it WorldItemPipeNet worldFluidPipeNet = (WorldItemPipeNet) getPipeBlock().getWorldPipeNet(getPipeWorld()); currentPipeNet = worldFluidPipeNet.getNetFromPos(getPipePos()); if (currentPipeNet != null) { @@ -130,7 +133,7 @@ public void transferDataFrom(IPipeTile tileEnt // if 20 ticks passed since the last access it will reset it // this method is equal to // if (++time % 20 == 0) { - // this.transferredItems = 0; + // this.transferredItems = 0; // } // if it was in a ticking TileEntity private void updateTransferredState() { diff --git a/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java b/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java index 4caca6cedca..5c6b3075e41 100644 --- a/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java +++ b/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java @@ -11,6 +11,7 @@ import gregtech.client.utils.BloomEffectUtil; import gregtech.common.pipelike.laser.net.WorldLaserPipeNet; import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.creativetab.CreativeTabs; @@ -25,6 +26,7 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nonnull; @@ -96,7 +98,8 @@ public LaserPipeType getItemPipeType(ItemStack itemStack) { } @Override - public void setTileEntityData(TileEntityPipeBase pipeTile, ItemStack itemStack) { + public void setTileEntityData(TileEntityPipeBase pipeTile, + ItemStack itemStack) { pipeTile.setPipeData(this, pipeType); } @@ -111,13 +114,16 @@ protected boolean isPipeTool(@Nonnull ItemStack stack) { } @Override - public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, IPipeTile sideTile) { + public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, + IPipeTile sideTile) { return selfTile instanceof TileEntityLaserPipe && sideTile instanceof TileEntityLaserPipe; } @Override - public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, @Nullable TileEntity tile) { - return tile != null && tile.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, side.getOpposite()) != null; + public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, + @Nullable TileEntity tile) { + return tile != null && + tile.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, side.getOpposite()) != null; } @Override diff --git a/src/main/java/gregtech/common/pipelike/laser/ItemBlockLaserPipe.java b/src/main/java/gregtech/common/pipelike/laser/ItemBlockLaserPipe.java index 74e8028be48..18e9b0157d9 100644 --- a/src/main/java/gregtech/common/pipelike/laser/ItemBlockLaserPipe.java +++ b/src/main/java/gregtech/common/pipelike/laser/ItemBlockLaserPipe.java @@ -3,10 +3,12 @@ import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.ItemBlockPipe; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -19,7 +21,8 @@ public ItemBlockLaserPipe(BlockPipe block } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); tooltip.add(I18n.format("tile.laser_pipe_normal.tooltip1")); diff --git a/src/main/java/gregtech/common/pipelike/laser/LaserPipeType.java b/src/main/java/gregtech/common/pipelike/laser/LaserPipeType.java index 5b1fca8d23e..b524b392bb1 100644 --- a/src/main/java/gregtech/common/pipelike/laser/LaserPipeType.java +++ b/src/main/java/gregtech/common/pipelike/laser/LaserPipeType.java @@ -3,6 +3,7 @@ import gregtech.api.pipenet.block.IPipeType; public enum LaserPipeType implements IPipeType { + NORMAL; @Override diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java index 513598063b1..71d1829287d 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java @@ -2,6 +2,7 @@ import gregtech.api.capability.ILaserContainer; import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; + import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetWalker.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetWalker.java index e085988ab57..1637f17a3e6 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetWalker.java @@ -5,10 +5,12 @@ import gregtech.api.pipenet.PipeNetWalker; import gregtech.api.util.GTUtility; import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import org.jetbrains.annotations.Nullable; public class LaserNetWalker extends PipeNetWalker { @@ -25,9 +27,9 @@ public static LaserRoutePath createNetData(World world, BlockPos sourcePipe, Enu return walker.isFailed() ? FAILED_MARKER : walker.routePath; } - private static final EnumFacing[] X_AXIS_FACINGS = {EnumFacing.WEST, EnumFacing.EAST}; - private static final EnumFacing[] Y_AXIS_FACINGS = {EnumFacing.UP, EnumFacing.DOWN}; - private static final EnumFacing[] Z_AXIS_FACINGS = {EnumFacing.NORTH, EnumFacing.SOUTH}; + private static final EnumFacing[] X_AXIS_FACINGS = { EnumFacing.WEST, EnumFacing.EAST }; + private static final EnumFacing[] Y_AXIS_FACINGS = { EnumFacing.UP, EnumFacing.DOWN }; + private static final EnumFacing[] Z_AXIS_FACINGS = { EnumFacing.NORTH, EnumFacing.SOUTH }; private LaserRoutePath routePath; private BlockPos sourcePipe; @@ -39,7 +41,8 @@ protected LaserNetWalker(World world, BlockPos sourcePipe, int distance) { } @Override - protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, int walkedBlocks) { + protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, + BlockPos nextPos, int walkedBlocks) { LaserNetWalker walker = new LaserNetWalker(world, nextPos, walkedBlocks); walker.facingToHandler = facingToHandler; walker.sourcePipe = sourcePipe; @@ -57,17 +60,19 @@ protected EnumFacing[] getSurroundingPipeSides() { } @Override - protected void checkPipe(TileEntityLaserPipe pipeTile, BlockPos pos) { - } + protected void checkPipe(TileEntityLaserPipe pipeTile, BlockPos pos) {} @Override - protected void checkNeighbour(TileEntityLaserPipe pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, @Nullable TileEntity neighbourTile) { - if (neighbourTile == null || (GTUtility.arePosEqual(pipePos, sourcePipe) && faceToNeighbour == facingToHandler)) { + protected void checkNeighbour(TileEntityLaserPipe pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, + @Nullable TileEntity neighbourTile) { + if (neighbourTile == null || + (GTUtility.arePosEqual(pipePos, sourcePipe) && faceToNeighbour == facingToHandler)) { return; } if (((LaserNetWalker) root).routePath == null) { - ILaserContainer handler = neighbourTile.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, faceToNeighbour.getOpposite()); + ILaserContainer handler = neighbourTile.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, + faceToNeighbour.getOpposite()); if (handler != null) { ((LaserNetWalker) root).routePath = new LaserRoutePath(pipeTile, faceToNeighbour, getWalkedBlocks()); stop(); diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java index 7bd9478c42c..cff94155e38 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java @@ -4,14 +4,17 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.common.pipelike.laser.LaserPipeProperties; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; +import javax.annotation.Nullable; + public class LaserPipeNet extends PipeNet { private final Map netData = new Object2ObjectOpenHashMap<>(); @@ -45,15 +48,15 @@ public void onPipeConnectionsUpdate() { } @Override - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { super.transferNodeData(transferredNodes, parentNet); netData.clear(); ((LaserPipeNet) parentNet).netData.clear(); } @Override - protected void writeNodeData(LaserPipeProperties nodeData, NBTTagCompound tagCompound) { - } + protected void writeNodeData(LaserPipeProperties nodeData, NBTTagCompound tagCompound) {} @Override protected LaserPipeProperties readNodeData(NBTTagCompound tagCompound) { diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java index 48d23dbe268..8e72484bf40 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java @@ -3,8 +3,8 @@ import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.ILaserContainer; import gregtech.api.pipenet.IRoutePath; -import gregtech.common.pipelike.laser.LaserPipeProperties; import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; + import net.minecraft.util.EnumFacing; import javax.annotation.Nonnull; @@ -33,7 +33,6 @@ public EnumFacing getFaceToHandler() { return faceToHandler; } - @Nonnull @Override public TileEntityLaserPipe getTargetPipe() { diff --git a/src/main/java/gregtech/common/pipelike/laser/net/WorldLaserPipeNet.java b/src/main/java/gregtech/common/pipelike/laser/net/WorldLaserPipeNet.java index e0a614864c7..23c165a1df7 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/WorldLaserPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/WorldLaserPipeNet.java @@ -2,12 +2,15 @@ import gregtech.api.pipenet.WorldPipeNet; import gregtech.common.pipelike.laser.LaserPipeProperties; + import net.minecraft.world.World; import javax.annotation.Nonnull; public class WorldLaserPipeNet extends WorldPipeNet { + private static final String DATA_ID = "gregtech.laser_pipe_net"; + public WorldLaserPipeNet(String name) { super(name); } diff --git a/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java b/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java index c9801ac42f2..ff7e7a8727b 100644 --- a/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java +++ b/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java @@ -11,12 +11,14 @@ import gregtech.common.pipelike.laser.net.LaserNetHandler; import gregtech.common.pipelike.laser.net.LaserPipeNet; import gregtech.common.pipelike.laser.net.WorldLaserPipeNet; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -134,7 +136,8 @@ public void setConnection(EnumFacing side, boolean connected, boolean fromNeighb // check the same for the targeted pipe TileEntity tile = getWorld().getTileEntity(getPos().offset(side)); - if (tile instanceof IPipeTile pipeTile && pipeTile.getPipeType().getClass() == this.getPipeType().getClass()) { + if (tile instanceof IPipeTilepipeTile && + pipeTile.getPipeType().getClass() == this.getPipeType().getClass()) { connections = pipeTile.getConnections(); connections &= ~(1 << side.getIndex()); connections &= ~(1 << side.getOpposite().getIndex()); diff --git a/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java b/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java index a562aba2875..6b82c9e28bb 100644 --- a/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java +++ b/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java @@ -10,6 +10,7 @@ import gregtech.client.renderer.pipe.OpticalPipeRenderer; import gregtech.common.pipelike.optical.net.WorldOpticalPipeNet; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.creativetab.CreativeTabs; @@ -23,6 +24,7 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nonnull; @@ -94,7 +96,8 @@ public OpticalPipeType getItemPipeType(@Nonnull ItemStack itemStack) { } @Override - public void setTileEntityData(@Nonnull TileEntityPipeBase pipeTile, ItemStack itemStack) { + public void setTileEntityData(@Nonnull TileEntityPipeBase pipeTile, + ItemStack itemStack) { pipeTile.setPipeData(this, pipeType); } @@ -109,12 +112,14 @@ protected boolean isPipeTool(@Nonnull ItemStack stack) { } @Override - public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, IPipeTile sideTile) { + public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, + IPipeTile sideTile) { return selfTile instanceof TileEntityOpticalPipe && sideTile instanceof TileEntityOpticalPipe; } @Override - public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, @Nullable TileEntity tile) { + public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, + @Nullable TileEntity tile) { if (tile == null) return false; if (tile.hasCapability(GregtechTileCapabilities.CAPABILITY_DATA_ACCESS, side.getOpposite())) return true; return tile.hasCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER, side.getOpposite()); diff --git a/src/main/java/gregtech/common/pipelike/optical/ItemBlockOpticalPipe.java b/src/main/java/gregtech/common/pipelike/optical/ItemBlockOpticalPipe.java index dd5fda2a5bc..9269423dedd 100644 --- a/src/main/java/gregtech/common/pipelike/optical/ItemBlockOpticalPipe.java +++ b/src/main/java/gregtech/common/pipelike/optical/ItemBlockOpticalPipe.java @@ -2,10 +2,12 @@ import gregtech.api.pipenet.block.ItemBlockPipe; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -18,7 +20,8 @@ public ItemBlockOpticalPipe(BlockOpticalPipe block) { } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); tooltip.add(I18n.format("tile.optical_pipe_normal.tooltip1")); diff --git a/src/main/java/gregtech/common/pipelike/optical/OpticalPipeType.java b/src/main/java/gregtech/common/pipelike/optical/OpticalPipeType.java index 9ae57678db2..beeb47d7bc6 100644 --- a/src/main/java/gregtech/common/pipelike/optical/OpticalPipeType.java +++ b/src/main/java/gregtech/common/pipelike/optical/OpticalPipeType.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; public enum OpticalPipeType implements IPipeType { + NORMAL; @Override diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java index 3e5ede5700c..539af26786e 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java @@ -5,13 +5,15 @@ import gregtech.api.capability.IOpticalDataAccessHatch; import gregtech.api.recipes.Recipe; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; + import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import java.util.Collection; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Collection; public class OpticalNetHandler implements IDataAccessHatch, IOpticalComputationProvider { diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java index cd32b810f89..6f696565b37 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java @@ -4,6 +4,7 @@ import gregtech.api.pipenet.PipeNetWalker; import gregtech.api.util.GTUtility; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -33,7 +34,8 @@ protected OpticalNetWalker(World world, BlockPos sourcePipe, int distance) { } @Override - protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, int walkedBlocks) { + protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, + BlockPos nextPos, int walkedBlocks) { OpticalNetWalker walker = new OpticalNetWalker(world, nextPos, walkedBlocks); walker.facingToHandler = facingToHandler; walker.sourcePipe = sourcePipe; @@ -41,19 +43,23 @@ protected PipeNetWalker createSubWalker(World world, Enum } @Override - protected void checkPipe(TileEntityOpticalPipe pipeTile, BlockPos pos) { - } + protected void checkPipe(TileEntityOpticalPipe pipeTile, BlockPos pos) {} @Override - protected void checkNeighbour(TileEntityOpticalPipe pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, @Nullable TileEntity neighbourTile) { - if (neighbourTile == null || (GTUtility.arePosEqual(pipePos, sourcePipe) && faceToNeighbour == facingToHandler)) { + protected void checkNeighbour(TileEntityOpticalPipe pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, + @Nullable TileEntity neighbourTile) { + if (neighbourTile == null || + (GTUtility.arePosEqual(pipePos, sourcePipe) && faceToNeighbour == facingToHandler)) { return; } if (((OpticalNetWalker) root).routePath == null) { - if (neighbourTile.hasCapability(GregtechTileCapabilities.CAPABILITY_DATA_ACCESS, faceToNeighbour.getOpposite()) || - neighbourTile.hasCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER, faceToNeighbour.getOpposite())) { - ((OpticalNetWalker) root).routePath = new OpticalRoutePath(pipeTile, faceToNeighbour, getWalkedBlocks()); + if (neighbourTile.hasCapability(GregtechTileCapabilities.CAPABILITY_DATA_ACCESS, + faceToNeighbour.getOpposite()) || + neighbourTile.hasCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER, + faceToNeighbour.getOpposite())) { + ((OpticalNetWalker) root).routePath = new OpticalRoutePath(pipeTile, faceToNeighbour, + getWalkedBlocks()); stop(); } } diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java index 4708a4dbd90..09cfc97eb2c 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java @@ -4,14 +4,17 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.common.pipelike.optical.OpticalPipeProperties; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; +import javax.annotation.Nullable; + public class OpticalPipeNet extends PipeNet { private final Map NET_DATA = new Object2ObjectOpenHashMap<>(); @@ -46,20 +49,18 @@ public void onPipeConnectionsUpdate() { } @Override - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { super.transferNodeData(transferredNodes, parentNet); NET_DATA.clear(); ((OpticalPipeNet) parentNet).NET_DATA.clear(); } @Override - protected void writeNodeData(OpticalPipeProperties nodeData, NBTTagCompound tagCompound) { - - } + protected void writeNodeData(OpticalPipeProperties nodeData, NBTTagCompound tagCompound) {} @Override protected OpticalPipeProperties readNodeData(NBTTagCompound tagCompound) { return OpticalPipeProperties.INSTANCE; } - } diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java index 9489a4d5ca9..cc5b85ab500 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java @@ -5,13 +5,9 @@ import gregtech.api.capability.IOpticalComputationProvider; import gregtech.api.capability.IOpticalDataAccessHatch; import gregtech.api.pipenet.IRoutePath; -import gregtech.api.util.FacingPos; -import gregtech.common.pipelike.optical.OpticalPipeProperties; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; -import net.minecraft.tileentity.TileEntity; + import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/gregtech/common/pipelike/optical/net/WorldOpticalPipeNet.java b/src/main/java/gregtech/common/pipelike/optical/net/WorldOpticalPipeNet.java index 00bc97e9032..c4761328cbc 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/WorldOpticalPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/WorldOpticalPipeNet.java @@ -2,6 +2,7 @@ import gregtech.api.pipenet.WorldPipeNet; import gregtech.common.pipelike.optical.OpticalPipeProperties; + import net.minecraft.world.World; import javax.annotation.Nonnull; diff --git a/src/main/java/gregtech/common/pipelike/optical/tile/TileEntityOpticalPipe.java b/src/main/java/gregtech/common/pipelike/optical/tile/TileEntityOpticalPipe.java index b926ac514f6..82c80a09dcf 100644 --- a/src/main/java/gregtech/common/pipelike/optical/tile/TileEntityOpticalPipe.java +++ b/src/main/java/gregtech/common/pipelike/optical/tile/TileEntityOpticalPipe.java @@ -13,17 +13,19 @@ import gregtech.common.pipelike.optical.net.OpticalNetHandler; import gregtech.common.pipelike.optical.net.OpticalPipeNet; import gregtech.common.pipelike.optical.net.WorldOpticalPipeNet; + import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.lang.ref.WeakReference; import java.util.Collection; import java.util.EnumMap; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class TileEntityOpticalPipe extends TileEntityPipeBase { private final EnumMap handlers = new EnumMap<>(EnumFacing.class); @@ -82,7 +84,8 @@ public T getCapabilityInternal(Capability capability, @Nullable EnumFacin if (handlers.isEmpty()) initHandlers(); checkNetwork(); - return GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER.cast(handlers.getOrDefault(facing, defaultHandler)); + return GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER + .cast(handlers.getOrDefault(facing, defaultHandler)); } return super.getCapabilityInternal(capability, facing); } @@ -104,7 +107,7 @@ public OpticalPipeNet getOpticalPipeNet() { return null; OpticalPipeNet currentPipeNet = this.currentPipeNet.get(); if (currentPipeNet != null && currentPipeNet.isValid() && currentPipeNet.containsNode(getPipePos())) - return currentPipeNet; //if current net is valid and does contain position, return it + return currentPipeNet; // if current net is valid and does contain position, return it WorldOpticalPipeNet worldNet = (WorldOpticalPipeNet) getPipeBlock().getWorldPipeNet(getPipeWorld()); currentPipeNet = worldNet.getNetFromPos(getPipePos()); if (currentPipeNet != null) { @@ -139,7 +142,8 @@ public void setConnection(EnumFacing side, boolean connected, boolean fromNeighb // also check the other pipe TileEntity tile = getWorld().getTileEntity(getPos().offset(side)); - if (tile instanceof IPipeTile pipeTile && pipeTile.getPipeType().getClass() == this.getPipeType().getClass()) { + if (tile instanceof IPipeTilepipeTile && + pipeTile.getPipeType().getClass() == this.getPipeType().getClass()) { if (pipeTile.getNumConnections() >= 2) return; } } diff --git a/src/main/java/gregtech/common/terminal/app/VirtualTankApp.java b/src/main/java/gregtech/common/terminal/app/VirtualTankApp.java index 9468da006e6..b6a24a190b9 100644 --- a/src/main/java/gregtech/common/terminal/app/VirtualTankApp.java +++ b/src/main/java/gregtech/common/terminal/app/VirtualTankApp.java @@ -14,6 +14,7 @@ import gregtech.api.util.GTLog; import gregtech.api.util.VirtualTankRegistry; import gregtech.common.terminal.component.SearchComponent; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fluids.FluidStack; @@ -21,6 +22,7 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; @@ -45,7 +47,7 @@ public AbstractApplication initApp() { this.addWidget(new ImageWidget(5, 5, 333 - 10, 232 - 10, TerminalTheme.COLOR_B_2)); this.addWidget(new LabelWidget(10, 10, "terminal.vtank_viewer.title", -1)); this.addWidget(new RectButtonWidget(216, 7, 110, 18) - .setClickListener(cd->{ + .setClickListener(cd -> { if (cd.isClient) { reloadWidgets(cacheClient); } @@ -71,7 +73,8 @@ public AbstractApplication initApp() { private List> findVirtualTanks() { List> result = new LinkedList<>(); Map> tankMap = VirtualTankRegistry.getTankMap(); - for (UUID uuid : tankMap.keySet().stream().sorted(Comparator.nullsLast(UUID::compareTo)).collect(Collectors.toList())) { + for (UUID uuid : tankMap.keySet().stream().sorted(Comparator.nullsLast(UUID::compareTo)) + .collect(Collectors.toList())) { if (uuid == null || uuid.equals(gui.entityPlayer.getUniqueID())) { for (String key : tankMap.get(uuid).keySet().stream().sorted().collect(Collectors.toList())) { result.add(new ImmutablePair<>(uuid, key)); @@ -116,7 +119,7 @@ private void refresh() { } } if (!toUpdated.isEmpty()) { - writeUpdateInfo(-2, buffer->{ // update specific info + writeUpdateInfo(-2, buffer -> { // update specific info buffer.writeVarInt(toUpdated.size()); for (Pair update : toUpdated) { buffer.writeBoolean(update.getKey() != null); @@ -227,7 +230,8 @@ public List getMenuComponents() { @Override public String resultDisplay(Pair result) { FluidStack fluidStack = VirtualTankRegistry.getTankMap().get(result.getKey()).get(result.getValue()).getFluid(); - return String.format("Lock: %b, ID: %s, Fluid: %s", result.getKey() != null, result.getValue(), fluidStack == null ? "-" : fluidStack.getLocalizedName()); + return String.format("Lock: %b, ID: %s, Fluid: %s", result.getKey() != null, result.getValue(), + fluidStack == null ? "-" : fluidStack.getLocalizedName()); } @Override @@ -243,7 +247,8 @@ public void search(String word, Consumer> find) { return; for (Map.Entry, IFluidTank> access : cacheClient.entrySet()) { Pair accessingCover = access.getKey(); - if (accessingCover.getValue() != null && accessingCover.getValue().toLowerCase().contains(word.toLowerCase())) { + if (accessingCover.getValue() != null && + accessingCover.getValue().toLowerCase().contains(word.toLowerCase())) { find.accept(accessingCover); } else { FluidStack fluidStack = access.getValue().getFluid(); diff --git a/src/main/java/gregtech/common/terminal/app/appstore/AppCardWidget.java b/src/main/java/gregtech/common/terminal/app/appstore/AppCardWidget.java index 8d6c31e5b51..f06ec173db3 100644 --- a/src/main/java/gregtech/common/terminal/app/appstore/AppCardWidget.java +++ b/src/main/java/gregtech/common/terminal/app/appstore/AppCardWidget.java @@ -4,17 +4,18 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.resources.*; import gregtech.api.gui.widgets.ImageWidget; -import gregtech.client.shader.Shaders; import gregtech.api.terminal.app.AbstractApplication; import gregtech.api.terminal.gui.widgets.AnimaWidgetGroup; import gregtech.api.terminal.gui.widgets.CircleButtonWidget; import gregtech.api.terminal.os.TerminalDialogWidget; import gregtech.api.terminal.os.TerminalOSWidget; import gregtech.api.terminal.os.TerminalTheme; -import gregtech.client.utils.RenderUtil; import gregtech.api.util.interpolate.Eases; import gregtech.api.util.interpolate.Interpolator; +import gregtech.client.shader.Shaders; +import gregtech.client.utils.RenderUtil; import gregtech.common.items.behaviors.TerminalBehaviour; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.network.PacketBuffer; @@ -25,6 +26,7 @@ import java.util.List; public class AppCardWidget extends AnimaWidgetGroup { + private final AbstractApplication application; private final AppStoreApp store; @SideOnly(Side.CLIENT) @@ -39,12 +41,12 @@ public class AppCardWidget extends AnimaWidgetGroup { private int alpha; public AppCardWidget(int x, int y, AbstractApplication application, AppStoreApp store) { - super(x, y , 100, 100); + super(x, y, 100, 100); this.application = application; this.store = store; TerminalOSWidget os = store.getOs(); if (os.isRemote()) { - this.addWidget(new CircleButtonWidget(15,17) + this.addWidget(new CircleButtonWidget(15, 17) .setColors(TerminalTheme.COLOR_B_2.getColor(), application.getThemeColor(), TerminalTheme.COLOR_B_2.getColor()) @@ -56,7 +58,9 @@ public AppCardWidget(int x, int y, AbstractApplication application, AppStoreApp offset = Math.abs(GTValues.RNG.nextInt()) % 200; banner = application.getBanner(); if (os.installedApps.contains(application)) { - if (TerminalBehaviour.isCreative(os.itemStack) || application.getMaxTier() == Math.min(os.tabletNBT.getCompoundTag(application.getRegistryName()).getInteger("_tier"), application.getMaxTier())) { + if (TerminalBehaviour.isCreative(os.itemStack) || application.getMaxTier() == + Math.min(os.tabletNBT.getCompoundTag(application.getRegistryName()).getInteger("_tier"), + application.getMaxTier())) { updateState(0); } else { updateState(1); @@ -82,7 +86,8 @@ public void updateState(int state) { removeWidget(stateWidget); removeWidget(bgWidget); } - stateWidget = new ImageWidget(15, 85, 70, 15, new TextTexture(text, -1).setWidth(70).setDropShadow(true).setType(TextTexture.TextType.HIDE)); + stateWidget = new ImageWidget(15, 85, 70, 15, + new TextTexture(text, -1).setWidth(70).setDropShadow(true).setType(TextTexture.TextType.HIDE)); bgWidget = new ImageWidget(15, 85, 70, 13, new ColorRectTexture(bg)); this.addWidget(bgWidget); this.addWidget(stateWidget); @@ -119,14 +124,15 @@ public void hookDrawInForeground(int mouseX, int mouseY) { int y = getPosition().y; int width = getSize().width; int height = getSize().height; - if (isMouseOverElement(mouseX, mouseY) && store.getOs().desktop.widgets.stream().noneMatch(app->app instanceof TerminalDialogWidget)) { + if (isMouseOverElement(mouseX, mouseY) && + store.getOs().desktop.widgets.stream().noneMatch(app -> app instanceof TerminalDialogWidget)) { int dur = 7; int maxAlpha = 100; // 0-255!!!!! float partialTicks = Minecraft.getMinecraft().getRenderPartialTicks(); if (alpha != maxAlpha && interpolator == null) { interpolator = new Interpolator(0, maxAlpha, dur, Eases.LINEAR, - value-> alpha = value.intValue(), - value-> interpolator = null); + value -> alpha = value.intValue(), + value -> interpolator = null); interpolator.start(); } // smooth @@ -134,17 +140,19 @@ public void hookDrawInForeground(int mouseX, int mouseY) { if (alpha == maxAlpha) { color = TerminalTheme.COLOR_B_2.getColor() & 0x00ffffff | ((alpha) << 24); } else { - color = TerminalTheme.COLOR_B_2.getColor() & 0x00ffffff | ((alpha + (int) (maxAlpha * partialTicks / dur)) << 24); + color = TerminalTheme.COLOR_B_2.getColor() & 0x00ffffff | + ((alpha + (int) (maxAlpha * partialTicks / dur)) << 24); } int finalColor = color; - RenderUtil.useScissor(store.getPosition().x, store.getPosition().y, store.getSize().width, store.getSize().height, ()->{ - drawSolidRect(0, 0, gui.getScreenWidth(), y, finalColor); - drawSolidRect(0, y + height, gui.getScreenWidth(), gui.getScreenHeight(), finalColor); - drawSolidRect(0, y, x, height, finalColor); - drawSolidRect(x + width, y, gui.getScreenWidth(), height, finalColor); + RenderUtil.useScissor(store.getPosition().x, store.getPosition().y, store.getSize().width, + store.getSize().height, () -> { + drawSolidRect(0, 0, gui.getScreenWidth(), y, finalColor); + drawSolidRect(0, y + height, gui.getScreenWidth(), gui.getScreenHeight(), finalColor); + drawSolidRect(0, y, x, height, finalColor); + drawSolidRect(x + width, y, gui.getScreenWidth(), height, finalColor); - drawBorder(x, y, width, height, application.getThemeColor(), -1); - }); + drawBorder(x, y, width, height, application.getThemeColor(), -1); + }); } else { alpha = 0; } @@ -166,7 +174,8 @@ public void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRe float time = offset + (gui.entityPlayer.ticksExisted + partialTicks) / 20f; ShaderTexture.createShader("banner.frag").draw(x, y, width, 34, uniformCache -> { uniformCache.glUniform1F("u_time", time); - uniformCache.glUniform3F("b_color", color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f); + uniformCache.glUniform3F("b_color", color.getRed() / 255f, color.getGreen() / 255f, + color.getBlue() / 255f); }); } else { drawSolidRect(x, y, width, 34, color.getRGB()); diff --git a/src/main/java/gregtech/common/terminal/app/appstore/AppPageWidget.java b/src/main/java/gregtech/common/terminal/app/appstore/AppPageWidget.java index 380f4fd325f..dc02aac2078 100644 --- a/src/main/java/gregtech/common/terminal/app/appstore/AppPageWidget.java +++ b/src/main/java/gregtech/common/terminal/app/appstore/AppPageWidget.java @@ -16,6 +16,7 @@ import gregtech.api.util.interpolate.Interpolator; import gregtech.common.inventory.handlers.SingleItemStackHandler; import gregtech.common.items.behaviors.TerminalBehaviour; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; @@ -32,6 +33,7 @@ import java.util.stream.Collectors; public class AppPageWidget extends TerminalDialogWidget { + private final AbstractApplication application; private final AppCardWidget appCardWidget; private final AppStoreApp store; @@ -53,7 +55,7 @@ public AppPageWidget(AbstractApplication application, AppStoreApp store, AppCard int tier = i; // upgrade button buttons[i] = new CircleButtonWidget(dur + dur * i, 110, 6, 2, 0) - .setClickListener(cd->buttonClicked(tier)); + .setClickListener(cd -> buttonClicked(tier)); this.addWidget(buttons[i]); } this.addWidget(new CircleButtonWidget(310, 10, 6, 1, 8) @@ -62,7 +64,7 @@ public AppPageWidget(AbstractApplication application, AppStoreApp store, AppCard TerminalTheme.COLOR_3.getColor()) .setIcon(GuiTextures.ICON_REMOVE) .setHoverText("terminal.store.close") - .setClickListener(cd->close())); + .setClickListener(cd -> close())); if (store.getOs().isRemote()) { // profile int color = application.getThemeColor(); @@ -73,20 +75,21 @@ public AppPageWidget(AbstractApplication application, AppStoreApp store, AppCard for (int i = 0; i < stage; i++) { List demand = TerminalRegistry.getAppHardwareDemand(name, i) .stream() - .map(hw-> hw.getLocalizedName() + "(" + hw.addInformation() + ")") + .map(hw -> hw.getLocalizedName() + "(" + hw.addInformation() + ")") .collect(Collectors.toList()); demand.add(0, application.getTierInformation(i)); buttons[i].setColors(0, lightColor, color).setHoverText(demand.toArray(new String[0])); List conditions = TerminalRegistry.getAppHardwareUpgradeConditions(name, i); // line if (conditions.size() > 0) { - this.addWidget(new ImageWidget(dur + dur * i, 115, 1, -18 + (conditions.size() >= 4 ? 4 * 25 : conditions.size() * 25), + this.addWidget(new ImageWidget(dur + dur * i, 115, 1, + -18 + (conditions.size() >= 4 ? 4 * 25 : conditions.size() * 25), new ColorRectTexture(0xafffffff))); } // conditions for (int j = 0; j < conditions.size(); j++) { this.addWidget(new SlotWidget(new SingleItemStackHandler(conditions.get(j)), 0, - dur + dur * i + 25 * (j / 4)- 9, 120 + 25 * (j % 4), false, false)); + dur + dur * i + 25 * (j / 4) - 9, 120 + 25 * (j % 4), false, false)); } } } @@ -100,7 +103,8 @@ private void buttonClicked(int tier) { } else if (TerminalBehaviour.isCreative(os.itemStack)) { lastTier = application.getMaxTier(); } else { - lastTier = Math.min(os.tabletNBT.getCompoundTag(application.getRegistryName()).getInteger("_tier"), application.getMaxTier()); + lastTier = Math.min(os.tabletNBT.getCompoundTag(application.getRegistryName()).getInteger("_tier"), + application.getMaxTier()); } String name = application.getRegistryName(); if (tier > lastTier) { @@ -146,34 +150,34 @@ private void buttonClicked(int tier) { } } - if (match) { if (os.isRemote()) { appCardWidget.updateState(tier == application.getMaxTier() ? 0 : 1); } if (!gui.entityPlayer.isCreative()) { // cost - TerminalDialogWidget.showConfirmDialog(store.getOs(), "terminal.dialog.notice", "terminal.store.match", res->{ - if (res) { - for (ItemStack requirement : requirements) { - int left = requirement.getCount(); - for (ItemStack hold : gui.entityPlayer.inventory.mainInventory) { - if (requirement.isItemEqual(hold)) { - if (hold.getCount() <= left) { - hold.setCount(0); - left -= hold.getCount(); - } else { - hold.setCount(hold.getCount() - left); - left = 0; - } - if (left == 0) { - break; + TerminalDialogWidget + .showConfirmDialog(store.getOs(), "terminal.dialog.notice", "terminal.store.match", res -> { + if (res) { + for (ItemStack requirement : requirements) { + int left = requirement.getCount(); + for (ItemStack hold : gui.entityPlayer.inventory.mainInventory) { + if (requirement.isItemEqual(hold)) { + if (hold.getCount() <= left) { + hold.setCount(0); + left -= hold.getCount(); + } else { + hold.setCount(hold.getCount() - left); + left = 0; + } + if (left == 0) { + break; + } + } } } + updateTerminalAppTier(tier, lastTier); } - } - updateTerminalAppTier(tier, lastTier); - } - }).open(); + }).open(); } else { updateTerminalAppTier(tier, lastTier); } @@ -191,9 +195,9 @@ private void buttonClicked(int tier) { private void updateTerminalAppTier(int tier, int lastTier) { TerminalOSWidget os = store.getOs(); os.openedApps.stream() - .filter(app->app.getRegistryName().equals(this.application.getRegistryName())) + .filter(app -> app.getRegistryName().equals(this.application.getRegistryName())) .findFirst() - .ifPresent(app->os.closeApplication(app, os.isRemote())); + .ifPresent(app -> os.closeApplication(app, os.isRemote())); if (lastTier == -1) { // update terminal NBTTagList installed = os.tabletNBT.getTagList("_installed", Constants.NBT.TAG_STRING); installed.appendTag(new NBTTagString(application.getRegistryName())); @@ -224,7 +228,8 @@ public void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRe } else if (TerminalBehaviour.isCreative(os.itemStack)) { stage = application.getMaxTier() + 1; } else { - stage = Math.min(os.tabletNBT.getCompoundTag(application.getRegistryName()).getInteger("_tier"), application.getMaxTier()) + 1; + stage = Math.min(os.tabletNBT.getCompoundTag(application.getRegistryName()).getInteger("_tier"), + application.getMaxTier()) + 1; } int maxStage = application.getMaxTier() + 1; int color = application.getThemeColor(); @@ -252,16 +257,16 @@ public void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRe if (lineWidth != end && (interpolator == null || back)) { back = false; interpolator = new Interpolator(lineWidth, end, (end - lineWidth) / 15, Eases.LINEAR, - value-> lineWidth = value.intValue(), - value-> interpolator = null); + value -> lineWidth = value.intValue(), + value -> interpolator = null); interpolator.start(); } } else { if (lineWidth != 0 && (interpolator == null || !back)) { back = true; interpolator = new Interpolator(lineWidth, 0, lineWidth / 15, Eases.LINEAR, - value-> lineWidth = value.intValue(), - value-> interpolator = null); + value -> lineWidth = value.intValue(), + value -> interpolator = null); interpolator.start(); } } @@ -286,7 +291,8 @@ public void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRe String localizedName = I18n.format(application.getUnlocalizedName()); drawStringSized(localizedName, x + 100, y + 14, fColor, store.darkMode, 2, false); if (isMouseOver(x + 100, y + 14, fr.getStringWidth(localizedName) * 2, fr.FONT_HEIGHT * 2, mouseX, mouseY)) { - drawHoveringText(ItemStack.EMPTY, Collections.singletonList("("+application.getRegistryName()+")"), 200, mouseX, mouseY); + drawHoveringText(ItemStack.EMPTY, Collections.singletonList("(" + application.getRegistryName() + ")"), 200, + mouseX, mouseY); } for (int i = 0; i < description.size(); i++) { fr.drawString(description.get(i), x + 100, y + 35 + i * fr.FONT_HEIGHT, fColor, store.darkMode); @@ -296,5 +302,4 @@ public void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRe GlStateManager.enableDepth(); } - } diff --git a/src/main/java/gregtech/common/terminal/app/appstore/AppStoreApp.java b/src/main/java/gregtech/common/terminal/app/appstore/AppStoreApp.java index 498dad07655..6e1ffea4e6e 100644 --- a/src/main/java/gregtech/common/terminal/app/appstore/AppStoreApp.java +++ b/src/main/java/gregtech/common/terminal/app/appstore/AppStoreApp.java @@ -17,6 +17,7 @@ import gregtech.api.util.Size; import gregtech.common.items.MetaItems; import gregtech.common.terminal.component.ClickComponent; + import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -25,6 +26,7 @@ import java.util.List; public class AppStoreApp extends AbstractApplication { + @SideOnly(Side.CLIENT) protected boolean darkMode; @@ -44,14 +46,16 @@ public AbstractApplication initApp() { int index = 0; int yOffset = 50; group.addWidget(new ImageWidget(0, 0, 333, 30, GuiTextures.UI_FRAME_SIDE_UP)); - group.addWidget(new LabelWidget(333 / 2, 10, getUnlocalizedName(), -1).setShadow(true).setYCentered(true).setXCentered(true)); + group.addWidget(new LabelWidget(333 / 2, 10, getUnlocalizedName(), -1).setShadow(true).setYCentered(true) + .setXCentered(true)); for (AbstractApplication app : TerminalRegistry.getAllApps()) { group.addWidget(new AppCardWidget(5 + 110 * (index % 3), yOffset + 110 * (index / 3), app, this)); index++; } int y = yOffset + 110 * ((index + 2) / 3); group.addWidget(new ImageWidget(0, y, 333, 30, new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()))); - group.addWidget(new ImageWidget(0, y, 333, 30, new TextTexture("Copyright @2021-xxxx Gregicality Team XD", -1))); + group.addWidget( + new ImageWidget(0, y, 333, 30, new TextTexture("Copyright @2021-xxxx Gregicality Team XD", -1))); loadLocalConfig(nbt -> this.darkMode = nbt.getBoolean("dark")); return this; } @@ -79,11 +83,12 @@ protected void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, @Override public List getMenuComponents() { - ClickComponent darkMode = new ClickComponent().setIcon(GuiTextures.ICON_VISIBLE).setHoverText("terminal.prospector.vis_mode").setClickConsumer(cd -> { - if (cd.isClient) { - this.darkMode = !this.darkMode; - } - }); + ClickComponent darkMode = new ClickComponent().setIcon(GuiTextures.ICON_VISIBLE) + .setHoverText("terminal.prospector.vis_mode").setClickConsumer(cd -> { + if (cd.isClient) { + this.darkMode = !this.darkMode; + } + }); return Collections.singletonList(darkMode); } diff --git a/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryManagerApp.java b/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryManagerApp.java index 684fdc41148..25fae6eee53 100644 --- a/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryManagerApp.java +++ b/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryManagerApp.java @@ -9,11 +9,13 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.common.items.MetaItems; import gregtech.common.terminal.hardware.BatteryHardware; + import net.minecraft.client.resources.I18n; import java.util.concurrent.atomic.AtomicInteger; public class BatteryManagerApp extends AbstractApplication { + public BatteryManagerApp() { super("battery"); } @@ -42,15 +44,20 @@ public AbstractApplication initApp() { private void addBatteryApps() { AtomicInteger index = new AtomicInteger(); for (AbstractApplication installed : getOs().installedApps) { - TerminalRegistry.getAppHardwareDemand(installed.getRegistryName(), getOs().tabletNBT.getCompoundTag(installed.getRegistryName()).getInteger("_tier")).stream() - .filter(i->i instanceof BatteryHardware).findFirst() - .ifPresent(battery-> { - long charge = ((BatteryHardware)battery).getCharge(); - this.addWidget(new RectButtonWidget(180 + (index.get() % 5) * 30, 15 + (index.get() / 5) * 30, 20, 20, 2) - .setIcon(installed.getIcon()) - // warn unsafe call the I18n here. - .setHoverText(I18n.format("terminal.battery.hover", I18n.format(installed.getUnlocalizedName()), charge)) - .setColors(0, TerminalTheme.COLOR_7.getColor(), 0)); + TerminalRegistry + .getAppHardwareDemand(installed.getRegistryName(), + getOs().tabletNBT.getCompoundTag(installed.getRegistryName()).getInteger("_tier")) + .stream() + .filter(i -> i instanceof BatteryHardware).findFirst() + .ifPresent(battery -> { + long charge = ((BatteryHardware) battery).getCharge(); + this.addWidget(new RectButtonWidget(180 + (index.get() % 5) * 30, 15 + (index.get() / 5) * 30, + 20, 20, 2) + .setIcon(installed.getIcon()) + // warn unsafe call the I18n here. + .setHoverText(I18n.format("terminal.battery.hover", + I18n.format(installed.getUnlocalizedName()), charge)) + .setColors(0, TerminalTheme.COLOR_7.getColor(), 0)); index.getAndIncrement(); }); } diff --git a/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryWidget.java b/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryWidget.java index c1a2c462ecb..50dc490e3dd 100644 --- a/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryWidget.java +++ b/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryWidget.java @@ -8,10 +8,12 @@ import gregtech.api.terminal.os.TerminalOSWidget; import gregtech.api.terminal.os.TerminalTheme; import gregtech.client.shader.Shaders; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BatteryWidget extends Widget { + @SideOnly(Side.CLIENT) private ShaderTexture battery; private final TerminalOSWidget os; @@ -29,9 +31,10 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender int width = getSize().width; int height = getSize().height; float left = 0; - IElectricItem electricItem = os.hardwareProvider.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem electricItem = os.hardwareProvider.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (electricItem != null) { - left = electricItem.getCharge() / (float)electricItem.getMaxCharge(); + left = electricItem.getCharge() / (float) electricItem.getMaxCharge(); } if (Shaders.allowedShader()) { float progress = left; @@ -44,14 +47,16 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender uniformCache.glUniform1F("u_time", time); uniformCache.glUniform1F("progress", progress); uniformCache.glUniform3F("c_ring", .55f, .7f, .7f); - uniformCache.glUniform3F("c_sector", (color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, (color & 255) / 255.0F); + uniformCache.glUniform3F("c_sector", (color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, + (color & 255) / 255.0F); uniformCache.glUniform3F("c_water", (1 - progress), progress, 0f); }); } else { - int b_color = (int)(255 * (1 - left)) << 16 | (int)(255 * left) << 8 | 255 << 24; + int b_color = (int) (255 * (1 - left)) << 16 | (int) (255 * left) << 8 | 255 << 24; drawBorder(x, y, width, height, TerminalTheme.COLOR_1.getColor(), 2); - drawSolidRect(x, y + height - (int)(height * left), width, (int)(height * left), b_color); + drawSolidRect(x, y + height - (int) (height * left), width, (int) (height * left), b_color); } - drawStringSized(String.format("%.2f%%", left * 100), x + width / 2f + 3, y + height / 2f - 7, -1, true, 2, true); + drawStringSized(String.format("%.2f%%", left * 100), x + width / 2f + 3, y + height / 2f - 7, -1, true, 2, + true); } } diff --git a/src/main/java/gregtech/common/terminal/app/capeselector/CapeSelectorApp.java b/src/main/java/gregtech/common/terminal/app/capeselector/CapeSelectorApp.java index 1f244022df5..2105e3ed11e 100644 --- a/src/main/java/gregtech/common/terminal/app/capeselector/CapeSelectorApp.java +++ b/src/main/java/gregtech/common/terminal/app/capeselector/CapeSelectorApp.java @@ -10,6 +10,7 @@ import gregtech.common.terminal.app.capeselector.widget.CapeListWidget; public class CapeSelectorApp extends AbstractApplication { + protected CapeListWidget capeListWidget; public CapeSelectorApp() { @@ -29,14 +30,14 @@ public AbstractApplication initApp() { this.getCapeList().setYScrollBarWidth(3).setYBarStyle(null, TerminalTheme.COLOR_F_1); this.addWidget(new SimpleTextWidget(166, 33, "", 0xFFFFFF, () -> { - if(this.getCapeList().getCapes() == null || this.getCapeList().getCapes().isEmpty()) { + if (this.getCapeList().getCapes() == null || this.getCapeList().getCapes().isEmpty()) { return "terminal.cape_selector.empty"; } return "terminal.cape_selector.select"; })); this.addWidget(new SimpleTextWidget(166, 45, "", 0xFFFFFF, () -> { - if(this.getCapeList().getCapes() == null || this.getCapeList().getCapes().isEmpty()) { + if (this.getCapeList().getCapes() == null || this.getCapeList().getCapes().isEmpty()) { return "terminal.cape_selector.tip"; } return ""; diff --git a/src/main/java/gregtech/common/terminal/app/capeselector/widget/CapeListWidget.java b/src/main/java/gregtech/common/terminal/app/capeselector/widget/CapeListWidget.java index 56202a76ec7..98f7bd57e35 100644 --- a/src/main/java/gregtech/common/terminal/app/capeselector/widget/CapeListWidget.java +++ b/src/main/java/gregtech/common/terminal/app/capeselector/widget/CapeListWidget.java @@ -9,6 +9,7 @@ import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.util.CapesRegistry; import gregtech.client.utils.RenderUtil; + import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; @@ -17,6 +18,7 @@ import java.util.UUID; public class CapeListWidget extends DraggableScrollableWidgetGroup { + private final UUID uuid; private List capes; private int selectedX, selectedY = -1; @@ -67,11 +69,13 @@ private void updateCapeCandidates(List capes) { int finalRowNumber = rowNumber; int finalI = i; ClickButtonWidget capeButton = new ClickButtonWidget(rowPosition * 70 + 21, rowNumber * 56, 28, 44, "", - (data) -> this.setCape(finalRowPosition, finalRowNumber, capes.get(finalI))).setButtonTexture(capeImage) - .setShouldClientCallback(true); + (data) -> this.setCape(finalRowPosition, finalRowNumber, capes.get(finalI))) + .setButtonTexture(capeImage) + .setShouldClientCallback(true); row.addWidget(capeButton); - if(capes.get(i).equals(CapesRegistry.getPlayerCape(uuid))) { // If this is the cape that the player is wearing right now, select it. + if (capes.get(i).equals(CapesRegistry.getPlayerCape(uuid))) { // If this is the cape that the player is + // wearing right now, select it. selectedX = finalRowPosition; selectedY = finalRowNumber; } @@ -113,9 +117,10 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender // Get selected cape button Widget button = ((WidgetGroup) this.widgets.get(this.selectedY)).widgets.get(this.selectedX); - RenderUtil.useScissor(getPosition().x, getPosition().y, getSize().width - yBarWidth, getSize().height - xBarHeight, () -> { - drawSelectionOverlay(button.getPosition().x - 6, button.getPosition().y - 6, - button.getSize().width + 12, button.getSize().height + 12); // Add a bit of margin - }); + RenderUtil.useScissor(getPosition().x, getPosition().y, getSize().width - yBarWidth, + getSize().height - xBarHeight, () -> { + drawSelectionOverlay(button.getPosition().x - 6, button.getPosition().y - 6, + button.getSize().width + 12, button.getSize().height + 12); // Add a bit of margin + }); } } diff --git a/src/main/java/gregtech/common/terminal/app/console/ConsoleApp.java b/src/main/java/gregtech/common/terminal/app/console/ConsoleApp.java index bb21dde690a..6147c219ad4 100644 --- a/src/main/java/gregtech/common/terminal/app/console/ConsoleApp.java +++ b/src/main/java/gregtech/common/terminal/app/console/ConsoleApp.java @@ -8,6 +8,7 @@ import gregtech.api.terminal.gui.widgets.MachineSceneWidget; import gregtech.api.terminal.os.TerminalDialogWidget; import gregtech.common.metatileentities.storage.MetaTileEntityWorkbench; + import net.minecraft.tileentity.TileEntity; public class ConsoleApp extends AbstractApplication { @@ -31,7 +32,7 @@ public AbstractApplication initApp() { IGregTechTileEntity mteResult = getMTE(); if (mteResult == null || - mteResult.getMetaTileEntity() instanceof MetaTileEntityWorkbench) // Remove Crafting Station compat + mteResult.getMetaTileEntity() instanceof MetaTileEntityWorkbench) // Remove Crafting Station compat { // 333 232 TerminalDialogWidget.showInfoDialog(os, "terminal.dialog.notice", @@ -42,7 +43,8 @@ public AbstractApplication initApp() { MachineConsoleWidget consoleWidget = new MachineConsoleWidget(200, 16, 133, 200); this.addWidget(consoleWidget); if (isClient) { - this.addWidget(0, new MachineSceneWidget(0, 16, 200, 200, os.clickPos).setOnSelected(consoleWidget::setFocus)); + this.addWidget(0, + new MachineSceneWidget(0, 16, 200, 200, os.clickPos).setOnSelected(consoleWidget::setFocus)); this.addWidget(new ImageWidget(0, 0, 333, 16, GuiTextures.UI_FRAME_SIDE_UP)); this.addWidget(new ImageWidget(0, 216, 333, 16, GuiTextures.UI_FRAME_SIDE_DOWN)); } else { diff --git a/src/main/java/gregtech/common/terminal/app/console/MachineConsoleWidget.java b/src/main/java/gregtech/common/terminal/app/console/MachineConsoleWidget.java index 0eb49bab023..a3272fa06c3 100644 --- a/src/main/java/gregtech/common/terminal/app/console/MachineConsoleWidget.java +++ b/src/main/java/gregtech/common/terminal/app/console/MachineConsoleWidget.java @@ -24,6 +24,7 @@ import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; import gregtech.common.metatileentities.storage.MetaTileEntityQuantumChest; import gregtech.common.metatileentities.storage.MetaTileEntityQuantumTank; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.init.Items; import net.minecraft.network.PacketBuffer; @@ -33,6 +34,7 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraftforge.items.ItemStackHandler; + import org.lwjgl.opengl.GL11; /** @@ -43,6 +45,7 @@ * @Description: */ public class MachineConsoleWidget extends WidgetGroup { + private BlockPos pos; private EnumFacing facing; private MetaTileEntity mte; @@ -76,7 +79,7 @@ private void checkMachine() { mte = ((IGregTechTileEntity) te).getMetaTileEntity(); initWidgets(); if (isRemote()) { - writeClientAction(5, buf->{ + writeClientAction(5, buf -> { buf.writeBlockPos(pos); buf.writeByte(facing.getIndex()); }); @@ -92,7 +95,8 @@ private void initWidgets() { uiWidgetGroup.setVisible(false); Size size = getSize(); addWidget(new ImageWidget(0, 0, size.width, size.height, GuiTextures.BACKGROUND)); - addWidget(new SimpleTextWidget(size.width / 2, 12, "", -1, ()->facing.toString().toUpperCase()).setShadow(true)); + addWidget(new SimpleTextWidget(size.width / 2, 12, "", -1, () -> facing.toString().toUpperCase()) + .setShadow(true)); int y = 20; if (mte.hasFrontFacing()) { addWidget(new RectButtonWidget(10, y, size.width - 20, 20, 1) @@ -101,7 +105,8 @@ private void initWidgets() { mte.setFrontFacing(facing); } }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.console.front", -1))); y += 25; } @@ -110,7 +115,7 @@ private void initWidgets() { IControllable controllable = mte.getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, facing); if (controllable != null) { addWidget(new RectButtonWidget(10, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_WORKING_ENABLE.getSubArea(0, 0, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_WORKING_ENABLE.getSubArea(0, 0, 1, 0.5), (c, p) -> { if (!isRemote()) { controllable.setWorkingEnabled(p); } @@ -120,13 +125,16 @@ private void initWidgets() { .setHoverText("terminal.console.controllable") .setIcon(GuiTextures.BUTTON_WORKING_ENABLE.getSubArea(0, 0.5, 1, 0.5))); // AbstractRecipeLogic - AbstractRecipeLogic recipeLogic = mte.getCapability(GregtechTileCapabilities.CAPABILITY_RECIPE_LOGIC, facing); + AbstractRecipeLogic recipeLogic = mte.getCapability(GregtechTileCapabilities.CAPABILITY_RECIPE_LOGIC, + facing); if (recipeLogic != null) { addWidget(new CycleButtonWidget(35, y, 20, 20, - recipeLogic.getAvailableOverclockingTiers(), recipeLogic::getOverclockTier, recipeLogic::setOverclockTier) - .setTooltipHoverString("gregtech.gui.overclock.description") - .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); - addWidget(new ProgressWidget(recipeLogic::getProgressPercent, 60, y, 63, 20, GuiTextures.PROGRESS_BAR_ARC_FURNACE, ProgressWidget.MoveType.HORIZONTAL)); + recipeLogic.getAvailableOverclockingTiers(), recipeLogic::getOverclockTier, + recipeLogic::setOverclockTier) + .setTooltipHoverString("gregtech.gui.overclock.description") + .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); + addWidget(new ProgressWidget(recipeLogic::getProgressPercent, 60, y, 63, 20, + GuiTextures.PROGRESS_BAR_ARC_FURNACE, ProgressWidget.MoveType.HORIZONTAL)); if (recipeLogic instanceof RecipeLogicSteam) { y += 25; addWidget(new RectButtonWidget(10, y, size.width - 20, 20, 1) @@ -135,7 +143,8 @@ private void initWidgets() { if (currentVentingSide == facing || mte.getFrontFacing() == facing) return; ((RecipeLogicSteam) recipeLogic).setVentingSide(facing); }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.console.venting", -1))); } } @@ -147,18 +156,20 @@ private void initWidgets() { SimpleMachineMetaTileEntity simpleMTE = (SimpleMachineMetaTileEntity) mte; // items output if (simpleMTE.getExportItems().getSlots() > 0) { - addWidget(new ImageWidget(10, y, 20 ,20, new ItemStackTexture(Items.GLOWSTONE_DUST))); + addWidget(new ImageWidget(10, y, 20, 20, new ItemStackTexture(Items.GLOWSTONE_DUST))); addWidget(new RectButtonWidget(33, y, 50, 20, 1) .setClickListener(clickData -> { if (!isRemote() && mte.getFrontFacing() != facing) { simpleMTE.setOutputFacingItems(facing); } }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setHoverText("terminal.console.items")); - addWidget(new SimpleTextWidget(58, y + 10, "", -1, ()->simpleMTE.getOutputFacingItems().toString())); + addWidget(new SimpleTextWidget(58, y + 10, "", -1, + () -> simpleMTE.getOutputFacingItems().toString())); addWidget(new RectButtonWidget(83, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_ITEM_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_ITEM_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p) -> { if (!isRemote()) { simpleMTE.setAutoOutputItems(p); } @@ -169,11 +180,12 @@ private void initWidgets() { .setHoverText("terminal.console.auto_output") .setIcon(GuiTextures.BUTTON_ITEM_OUTPUT.getSubArea(0, 0, 1, 0.5))); addWidget(new RectButtonWidget(103, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ - if (!isRemote()) { - simpleMTE.setAllowInputFromOutputSideItems(p); - } - }) + .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), + (c, p) -> { + if (!isRemote()) { + simpleMTE.setAllowInputFromOutputSideItems(p); + } + }) .setInitValue(simpleMTE.isAllowInputFromOutputSideItems()) .setValueSupplier(false, simpleMTE::isAllowInputFromOutputSideItems) .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), 0) @@ -184,18 +196,20 @@ private void initWidgets() { // fluids output if (simpleMTE.getExportFluids().getTanks() > 0) { - addWidget(new ImageWidget(10, y, 20 ,20, new ItemStackTexture(Items.WATER_BUCKET))); + addWidget(new ImageWidget(10, y, 20, 20, new ItemStackTexture(Items.WATER_BUCKET))); addWidget(new RectButtonWidget(33, y, 50, 20, 1) .setClickListener(clickData -> { if (!isRemote() && simpleMTE.getFrontFacing() != facing) { simpleMTE.setOutputFacingFluids(facing); } }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setHoverText("terminal.console.fluids")); - addWidget(new SimpleTextWidget(58, y + 10, "", -1, ()->simpleMTE.getOutputFacingFluids().toString())); + addWidget(new SimpleTextWidget(58, y + 10, "", -1, + () -> simpleMTE.getOutputFacingFluids().toString())); addWidget(new RectButtonWidget(83, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_FLUID_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_FLUID_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p) -> { if (!isRemote()) { simpleMTE.setAutoOutputFluids(p); } @@ -206,11 +220,12 @@ private void initWidgets() { .setHoverText("terminal.console.auto_output") .setIcon(GuiTextures.BUTTON_FLUID_OUTPUT.getSubArea(0, 0, 1, 0.5))); addWidget(new RectButtonWidget(103, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ - if (!isRemote()) { - simpleMTE.setAllowInputFromOutputSideFluids(p); - } - }) + .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), + (c, p) -> { + if (!isRemote()) { + simpleMTE.setAllowInputFromOutputSideFluids(p); + } + }) .setInitValue(simpleMTE.isAllowInputFromOutputSideFluids()) .setValueSupplier(false, simpleMTE::isAllowInputFromOutputSideFluids) .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), 0) @@ -224,18 +239,19 @@ private void initWidgets() { // MetaTileEntityQuantumTank if (mte instanceof MetaTileEntityQuantumChest) { MetaTileEntityQuantumChest chest = (MetaTileEntityQuantumChest) mte; - addWidget(new ImageWidget(10, y, 20 ,20, new ItemStackTexture(Items.GLOWSTONE_DUST))); + addWidget(new ImageWidget(10, y, 20, 20, new ItemStackTexture(Items.GLOWSTONE_DUST))); addWidget(new RectButtonWidget(33, y, 50, 20, 1) .setClickListener(clickData -> { if (!isRemote() && mte.getFrontFacing() != facing) { chest.setOutputFacing(facing); } }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setHoverText("terminal.console.items")); - addWidget(new SimpleTextWidget(58, y + 10, "", -1, ()->chest.getOutputFacing().toString())); + addWidget(new SimpleTextWidget(58, y + 10, "", -1, () -> chest.getOutputFacing().toString())); addWidget(new RectButtonWidget(83, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_ITEM_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_ITEM_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p) -> { if (!isRemote()) { chest.setAutoOutputItems(p); } @@ -246,7 +262,7 @@ private void initWidgets() { .setHoverText("terminal.console.auto_output") .setIcon(GuiTextures.BUTTON_ITEM_OUTPUT.getSubArea(0, 0, 1, 0.5))); addWidget(new RectButtonWidget(103, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), (c, p) -> { if (!isRemote()) { chest.setAllowInputFromOutputSide(p); } @@ -259,18 +275,19 @@ private void initWidgets() { y += 25; } else if (mte instanceof MetaTileEntityQuantumTank) { MetaTileEntityQuantumTank tank = (MetaTileEntityQuantumTank) mte; - addWidget(new ImageWidget(10, y, 20 ,20, new ItemStackTexture(Items.WATER_BUCKET))); + addWidget(new ImageWidget(10, y, 20, 20, new ItemStackTexture(Items.WATER_BUCKET))); addWidget(new RectButtonWidget(33, y, 50, 20, 1) .setClickListener(clickData -> { if (!isRemote() && tank.getFrontFacing() != facing) { tank.setOutputFacing(facing); } }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setHoverText("terminal.console.fluids")); - addWidget(new SimpleTextWidget(58, y + 10, "", -1, ()->tank.getOutputFacing().toString())); + addWidget(new SimpleTextWidget(58, y + 10, "", -1, () -> tank.getOutputFacing().toString())); addWidget(new RectButtonWidget(83, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_FLUID_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_FLUID_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p) -> { if (!isRemote()) { tank.setAutoOutputFluids(p); } @@ -281,7 +298,7 @@ private void initWidgets() { .setHoverText("terminal.console.auto_output") .setIcon(GuiTextures.BUTTON_FLUID_OUTPUT.getSubArea(0, 0, 1, 0.5))); addWidget(new RectButtonWidget(103, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), (c, p) -> { if (!isRemote()) { tank.setAllowInputFromOutputSide(p); } @@ -300,11 +317,12 @@ private void initWidgets() { if (mte instanceof MetaTileEntityMaintenanceHatch) { addWidget(new RectButtonWidget(10, y, size.width - 20, 20, 1) .setClickListener(clickData -> { - if (!isRemote()) { - ((MetaTileEntityMaintenanceHatch) mte).fixAllMaintenanceProblems(); - } + if (!isRemote()) { + ((MetaTileEntityMaintenanceHatch) mte).fixAllMaintenanceProblems(); + } }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.console.maintenance", -1))); y += 25; } @@ -316,18 +334,21 @@ private void initWidgets() { this.addWidget(new SlotWidget(new ItemStackHandler(NonNullList.withSize(1, cover.getPickItem())), 0, 10, y, false, false)); addWidget(new SimpleTextWidget(58, y + 10, "terminal.console.cover_rs", -1, - ()-> String.valueOf(cover.getRedstoneSignalOutput())).setShadow(true).setCenter(true)); + () -> String.valueOf(cover.getRedstoneSignalOutput())).setShadow(true).setCenter(true)); if (cover instanceof CoverWithUI) { addWidget(new RectButtonWidget(83, y, 40, 20, 1) - .setClickListener(clickData -> uiWidgetGroup.openUI(((CoverWithUI) cover).createUI(gui.entityPlayer))) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setClickListener( + clickData -> uiWidgetGroup.openUI(((CoverWithUI) cover).createUI(gui.entityPlayer))) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.console.cover_gui", -1))); } y += 25; } addWidget(new RectButtonWidget(10, y, size.width - 20, 20, 1) .setClickListener(clickData -> uiWidgetGroup.openUI(mte.getModularUI(gui.entityPlayer))) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.console.gui", -1))); addWidget(uiWidgetGroup); @@ -351,7 +372,8 @@ public void drawInForeground(int mouseX, int mouseY) { super.drawInForeground(mouseX, mouseY); } - private static class UIWidgetGroup extends WidgetGroup{ + private static class UIWidgetGroup extends WidgetGroup { + private IGuiTexture background; public void clearUI() { diff --git a/src/main/java/gregtech/common/terminal/app/game/maze/MazeApp.java b/src/main/java/gregtech/common/terminal/app/game/maze/MazeApp.java index 469aeb6968f..bd944c9d9da 100644 --- a/src/main/java/gregtech/common/terminal/app/game/maze/MazeApp.java +++ b/src/main/java/gregtech/common/terminal/app/game/maze/MazeApp.java @@ -11,6 +11,7 @@ import gregtech.common.terminal.app.game.maze.widget.EnemyWidget; import gregtech.common.terminal.app.game.maze.widget.MazeWidget; import gregtech.common.terminal.app.game.maze.widget.PlayerWidget; + import org.lwjgl.input.Keyboard; import java.util.ArrayList; @@ -19,6 +20,7 @@ import java.util.List; public class MazeApp extends AbstractApplication { + private int gameState = 0; private PlayerWidget player; private EnemyWidget enemy; @@ -48,7 +50,8 @@ public AbstractApplication initApp() { this.setOs(os); this.addWidget(new ImageWidget(5, 5, 333 - 10, 232 - 10, TerminalTheme.COLOR_B_2)); // enemy 0: Title - this.addWidget(new LabelWidget(333 / 2, 222 / 2 - 50, "terminal.maze.title", 0xFFFFFFFF).setXCentered(true), 0); + this.addWidget(new LabelWidget(333 / 2, 222 / 2 - 50, "terminal.maze.title", 0xFFFFFFFF).setXCentered(true), + 0); this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 - 10, 30, 30, "terminal.maze.play", (clickData -> { this.setGameState(1); @@ -60,19 +63,27 @@ public AbstractApplication initApp() { this.setEnemy(new EnemyWidget(-100, -100, this)); // GameState 2: Pause this.addWidget(new ImageWidget(5, 5, 333 - 10, 232 - 10, new ColorRectTexture(0xFF000000)), 2, 3); - this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 - 10, 50, 20, "terminal.maze.continue", (clickData) -> this.setGameState(1)).setShouldClientCallback(true), 2); - this.addWidget(new LabelWidget(333 / 2, 222 / 2 - 50, "terminal.maze.pause", 0xFFFFFFFF).setXCentered(true), 2); + this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 - 10, 50, 20, "terminal.maze.continue", + (clickData) -> this.setGameState(1)).setShouldClientCallback(true), 2); + this.addWidget(new LabelWidget(333 / 2, 222 / 2 - 50, "terminal.maze.pause", 0xFFFFFFFF).setXCentered(true), + 2); // GameState 3: Death - this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 40, "", 0xFFFFFFFF, () -> "terminal.maze.death.1", true), 3); - this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 28, "terminal.maze.death.2", 0xFFFFFFFF, () -> String.valueOf(this.getMazesSolved()),true), 3); - this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 16, "", 0xFFFFFFFF, () -> "terminal.maze.death.3", true), 3); - this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 + 10, 40, 20, "terminal.maze.retry", (clickData -> { - this.setGameState(1); - this.setMazesSolved(0); - MAZE_SIZE = 9; - speed = 25; - this.resetGame(); - })).setShouldClientCallback(true), 3); + this.addWidget( + new SimpleTextWidget(333 / 2, 232 / 2 - 40, "", 0xFFFFFFFF, () -> "terminal.maze.death.1", true), + 3); + this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 28, "terminal.maze.death.2", 0xFFFFFFFF, + () -> String.valueOf(this.getMazesSolved()), true), 3); + this.addWidget( + new SimpleTextWidget(333 / 2, 232 / 2 - 16, "", 0xFFFFFFFF, () -> "terminal.maze.death.3", true), + 3); + this.addWidget( + new ClickButtonWidget(323 / 2 - 10, 222 / 2 + 10, 40, 20, "terminal.maze.retry", (clickData -> { + this.setGameState(1); + this.setMazesSolved(0); + MAZE_SIZE = 9; + speed = 25; + this.resetGame(); + })).setShouldClientCallback(true), 3); } return this; } @@ -82,7 +93,7 @@ public void addWidget(Widget widget, int... visibleStates) { for (int state : visibleStates) { FSM[state].add(widget); } - widget.setVisible(Arrays.stream(visibleStates).allMatch(state->state==gameState)); + widget.setVisible(Arrays.stream(visibleStates).allMatch(state -> state == gameState)); } public void setPlayer(PlayerWidget player) { @@ -142,9 +153,9 @@ public void updateScreen() { } } if (gameState == 2) { - if(!Keyboard.isKeyDown(Keyboard.KEY_P)) + if (!Keyboard.isKeyDown(Keyboard.KEY_P)) lastPausePress = false; - if(Keyboard.isKeyDown(Keyboard.KEY_P) && !lastPausePress) + if (Keyboard.isKeyDown(Keyboard.KEY_P) && !lastPausePress) gameState = 1; } if (gameState != lastState) { diff --git a/src/main/java/gregtech/common/terminal/app/game/maze/widget/EnemyWidget.java b/src/main/java/gregtech/common/terminal/app/game/maze/widget/EnemyWidget.java index f3ec600aee8..e16117666e2 100644 --- a/src/main/java/gregtech/common/terminal/app/game/maze/widget/EnemyWidget.java +++ b/src/main/java/gregtech/common/terminal/app/game/maze/widget/EnemyWidget.java @@ -14,5 +14,4 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender this.setSelfPosition(new Position(app.getRenderX(posX), app.getRenderY(posY))); drawSolidRect(this.getPosition().x, this.getPosition().y, 10, 10, 0xFFFFAAAA); } - } diff --git a/src/main/java/gregtech/common/terminal/app/game/maze/widget/MazeWidget.java b/src/main/java/gregtech/common/terminal/app/game/maze/widget/MazeWidget.java index edcb57664c9..d3f71ebf18e 100644 --- a/src/main/java/gregtech/common/terminal/app/game/maze/widget/MazeWidget.java +++ b/src/main/java/gregtech/common/terminal/app/game/maze/widget/MazeWidget.java @@ -4,6 +4,7 @@ import gregtech.api.gui.Widget; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.util.math.Vec2f; import java.util.ArrayList; @@ -37,14 +38,17 @@ public void recalculateSize() { this.setSize(new Size(MAZE_SIZE * 10, MAZE_SIZE * 10)); topWalls = new boolean[MAZE_SIZE][MAZE_SIZE]; leftWalls = new boolean[MAZE_SIZE][MAZE_SIZE]; - } public void createBorder() { List lineBuffer = new ArrayList<>(); lineBuffer.add(new Vec2f(getPosition().x + 10, getPosition().y)); lineBuffer.add(new Vec2f(this.getSize().width + getPosition().x, getPosition().y)); - lineBuffer.add(new Vec2f(this.getSize().width + getPosition().x, this.getSize().height + getPosition().y + 2)); // Corrects for line width misalignment + lineBuffer.add(new Vec2f(this.getSize().width + getPosition().x, this.getSize().height + getPosition().y + 2)); // Corrects + // for + // line + // width + // misalignment drawLines(lineBuffer, 0xFFFFFFFF, 0xFFFFFFFF, 4); lineBuffer.clear(); lineBuffer.add(new Vec2f(this.getSize().width + getPosition().x - 10, this.getSize().height + getPosition().y)); @@ -95,10 +99,11 @@ public void initMaze() { } } - includedSpots[(int) (Math.random() * MAZE_SIZE)][(int) (Math.random() * MAZE_SIZE)] = true; // Can seed our particular maze + includedSpots[(int) (Math.random() * MAZE_SIZE)][(int) (Math.random() * MAZE_SIZE)] = true; // Can seed our + // particular maze // Improves maze randomization. List positions = new ArrayList<>(); - for(int i = 0; i < MAZE_SIZE * MAZE_SIZE; i++) { + for (int i = 0; i < MAZE_SIZE * MAZE_SIZE; i++) { positions.add(i); } Collections.shuffle(positions); @@ -107,7 +112,8 @@ public void initMaze() { if (!includedSpots[position / MAZE_SIZE][position % MAZE_SIZE]) { do { resetStuckCounter(); - } while (!this.createPath(position / MAZE_SIZE, position % MAZE_SIZE, new boolean[MAZE_SIZE][MAZE_SIZE])); + } while (!this.createPath(position / MAZE_SIZE, position % MAZE_SIZE, + new boolean[MAZE_SIZE][MAZE_SIZE])); } } } @@ -115,11 +121,11 @@ public void initMaze() { // Wilson random walk maze generation public boolean createPath(int x, int y, boolean[][] walkedPaths) { squaresChecked++; - if(squaresChecked > 20000) // Probably stuck. + if (squaresChecked > 20000) // Probably stuck. return false; - if(walkedPaths[x][y]) + if (walkedPaths[x][y]) return false; - if(this.includedSpots[x][y]) + if (this.includedSpots[x][y]) return true; this.includedSpots[x][y] = true; walkedPaths[x][y] = true; diff --git a/src/main/java/gregtech/common/terminal/app/game/maze/widget/PlayerWidget.java b/src/main/java/gregtech/common/terminal/app/game/maze/widget/PlayerWidget.java index 16dbea8b46b..2198456833c 100644 --- a/src/main/java/gregtech/common/terminal/app/game/maze/widget/PlayerWidget.java +++ b/src/main/java/gregtech/common/terminal/app/game/maze/widget/PlayerWidget.java @@ -6,9 +6,11 @@ import gregtech.common.terminal.app.game.maze.MazeApp; public class PlayerWidget extends Widget { + protected MazeApp app; public int posX; public int posY; + public PlayerWidget(int posX, int posY, MazeApp app) { super(app.getRenderX(posX), app.getRenderY(posY), 10, 10); this.app = app; @@ -27,7 +29,6 @@ public void move(int deltaX, int deltaY) { this.posY += deltaY; } - public void setGridPosition(int posX, int posY) { this.posX = posX; this.posY = posY; diff --git a/src/main/java/gregtech/common/terminal/app/game/minesweeper/MinesweeperApp.java b/src/main/java/gregtech/common/terminal/app/game/minesweeper/MinesweeperApp.java index ebe4fc13782..7608e54b85d 100644 --- a/src/main/java/gregtech/common/terminal/app/game/minesweeper/MinesweeperApp.java +++ b/src/main/java/gregtech/common/terminal/app/game/minesweeper/MinesweeperApp.java @@ -6,6 +6,7 @@ import gregtech.common.terminal.app.game.minesweeper.widget.MineMapWidget; public class MinesweeperApp extends AbstractApplication { + private MineMapWidget mineField; private WidgetGroup textGroup; private int timer; @@ -35,8 +36,8 @@ public boolean canOpenMenuOnEdge() { @Override public void updateScreen() { super.updateScreen(); - if(mineField.hasWon() || mineField.hasLost()) { - if(mineField.hasWon()) { + if (mineField.hasWon() || mineField.hasLost()) { + if (mineField.hasWon()) { mineField.notifyWon(); } resetCountdown--; @@ -55,21 +56,23 @@ public String getFlagsPercentage() { return mineField.flagsPlaced + "/" + mineField.mineCount; } - public void setTextStatus() { //swap widget for localization + public void setTextStatus() { // swap widget for localization if (resetCountdown == 100) { textGroup.clearAllWidgets(); - textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.time", 0xFFCCCCCC, ()->String.valueOf(timer / 20), true)); // Normal - } - else if(resetCountdown==99){ + textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.time", 0xFFCCCCCC, + () -> String.valueOf(timer / 20), true)); // Normal + } else if (resetCountdown == 99) { textGroup.clearAllWidgets(); - if(mineField.hasLost()){ - textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.lose", 0xFFCCCCCC, ()->String.valueOf(resetCountdown / 20), true)); // Losing condition - } else{ - textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.win.1", 0xFFCCCCCC, ()->String.valueOf(timer / 20), true)); // Winning condition - textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 20, "terminal.minesweeper.win.2", 0xFFCCCCCC, ()->String.valueOf(resetCountdown / 20), true)); + if (mineField.hasLost()) { + textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.lose", 0xFFCCCCCC, + () -> String.valueOf(resetCountdown / 20), true)); // Losing condition + } else { + textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.win.1", 0xFFCCCCCC, + () -> String.valueOf(timer / 20), true)); // Winning condition + textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 20, "terminal.minesweeper.win.2", 0xFFCCCCCC, + () -> String.valueOf(resetCountdown / 20), true)); } } - } @Override diff --git a/src/main/java/gregtech/common/terminal/app/game/minesweeper/widget/MineMapWidget.java b/src/main/java/gregtech/common/terminal/app/game/minesweeper/widget/MineMapWidget.java index ec3ad0f73fa..5037833c929 100644 --- a/src/main/java/gregtech/common/terminal/app/game/minesweeper/widget/MineMapWidget.java +++ b/src/main/java/gregtech/common/terminal/app/game/minesweeper/widget/MineMapWidget.java @@ -4,14 +4,18 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.resources.TextureArea; import gregtech.api.util.interpolate.RGBInterpolator; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; public class MineMapWidget extends Widget { - private static final TextureArea COVERED = new TextureArea(new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/covered.png"), 0, 0, 1, 1); - private static final TextureArea FLAG = new TextureArea(new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/flag.png"), 0, 0, 1, 1); - private static final TextureArea BOMB = new TextureArea(new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/bomb.png"), 0, 0, 1, 1); + private static final TextureArea COVERED = new TextureArea( + new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/covered.png"), 0, 0, 1, 1); + private static final TextureArea FLAG = new TextureArea( + new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/flag.png"), 0, 0, 1, 1); + private static final TextureArea BOMB = new TextureArea( + new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/bomb.png"), 0, 0, 1, 1); private static final TextureArea[] NUMBERS = { new TextureArea(new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/blank.png"), 0, 0, 1, 1), @@ -90,12 +94,11 @@ public void initMines(int startX, int startY) { } } - // Add to surrounding numbers for the mine // The weird ternaries here are making sure to not cause overflows for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { - if(mines[x][y]) { + if (mines[x][y]) { for (int xMod = x == 0 ? 0 : -1; xMod < (x == width - 1 ? 1 : 2); xMod++) { for (int yMod = y == 0 ? 0 : -1; yMod < (y == height - 1 ? 1 : 2); yMod++) { generatedNumbers[x + xMod][y + yMod]++; @@ -139,7 +142,8 @@ else if (!checkedSpaces[i][j]) { else COVERED.draw(i * 16 + getPosition().getX(), j * 16 + getPosition().getY(), 16, 16); } else if (!mines[i][j]) - NUMBERS[generatedNumbers[i][j]].draw(i * 16 + getPosition().getX(), j * 16 + getPosition().getY(), 16, 16); + NUMBERS[generatedNumbers[i][j]].draw(i * 16 + getPosition().getX(), j * 16 + getPosition().getY(), + 16, 16); else BOMB.draw(i * 16 + getPosition().getX(), j * 16 + getPosition().getY(), 16, 16); } @@ -148,7 +152,7 @@ else if (!checkedSpaces[i][j]) { @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { - if(isWon || isLost) { + if (isWon || isLost) { return false; // Don't let them interact now... } @@ -158,7 +162,6 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { return false; } - if (button == 0 && !flags[gridX][gridY]) { if (!isPrepared) initMines(gridX, gridY); @@ -181,7 +184,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { private void uncoverSafeTiles(int x, int y) { checkedSpaces[x][y] = true; - if(generatedNumbers[x][y] != 0) + if (generatedNumbers[x][y] != 0) return; // Weird ternaries again for preventing ArrayIndexOutOfBounds exceptions for (int xMod = x == 0 ? 0 : -1; xMod < (x == width - 1 ? 1 : 2); xMod++) { @@ -201,7 +204,9 @@ public boolean hasWon() { return false; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { - if (mines[i][j] != flags[i][j] || checkedSpaces[i][j] == mines[i][j]) { // If there is an unchecked safe square, or an uncovered bomb... + if (mines[i][j] != flags[i][j] || checkedSpaces[i][j] == mines[i][j]) { // If there is an unchecked safe + // square, or an uncovered + // bomb... return false; } } diff --git a/src/main/java/gregtech/common/terminal/app/game/pong/PongApp.java b/src/main/java/gregtech/common/terminal/app/game/pong/PongApp.java index 173b024b764..32d3ad523aa 100644 --- a/src/main/java/gregtech/common/terminal/app/game/pong/PongApp.java +++ b/src/main/java/gregtech/common/terminal/app/game/pong/PongApp.java @@ -8,6 +8,7 @@ import gregtech.api.util.Position; import gregtech.common.terminal.app.game.pong.widget.BallWidget; import gregtech.common.terminal.app.game.pong.widget.PaddleWidget; + import org.lwjgl.input.Keyboard; import org.lwjgl.util.vector.Vector2f; @@ -15,7 +16,6 @@ import java.util.ArrayList; import java.util.List; - public class PongApp extends AbstractApplication { private BallWidget ball; @@ -39,7 +39,8 @@ public AbstractApplication initApp() { this.addWidget(new ImageWidget(333 / 2 - 4, 5, 6, 232 - 10, new ColorRectTexture(0xAAAAAAAA))); this.setBall(new BallWidget(333 / 2 - 1, 232 / 2 - 1)); this.addWidget(new SimpleTextWidget(50, 20, "", 0xAAAAAA, () -> String.valueOf(this.getScore(true)), true)); - this.addWidget(new SimpleTextWidget(283, 20, "", 0xAAAAAA, () -> String.valueOf(this.getScore(false)), true)); + this.addWidget( + new SimpleTextWidget(283, 20, "", 0xAAAAAA, () -> String.valueOf(this.getScore(false)), true)); this.initPaddles(); } return this; @@ -90,11 +91,12 @@ public void updateScreenOnFrame() { paddles.forEach((paddle) -> solidObjects.add(new Rectangle(paddle.toSelfRectangleBox()))); int timeLeft = 1; - TwoDimensionalRayTracer.TwoDimensionalRayTraceResult result = TwoDimensionalRayTracer.nearestBoxSegmentCollision( - new Vector2f(ball.getSelfPosition().x, ball.getSelfPosition().y), - new Vector2f((float) (Math.cos(ball.theta) * 2), (float) (Math.sin(ball.theta) * 2)), - solidObjects, - new Vector2f(4, 4)); + TwoDimensionalRayTracer.TwoDimensionalRayTraceResult result = TwoDimensionalRayTracer + .nearestBoxSegmentCollision( + new Vector2f(ball.getSelfPosition().x, ball.getSelfPosition().y), + new Vector2f((float) (Math.cos(ball.theta) * 2), (float) (Math.sin(ball.theta) * 2)), + solidObjects, + new Vector2f(4, 4)); while (result.time != 1 && timeLeft != 0) { float angleMod = 0; if (result.pos.y < result.collidedWith.getCenterY() - 2) { @@ -102,7 +104,12 @@ public void updateScreenOnFrame() { } else if (result.pos.x > result.collidedWith.getCenterY() + 2) { angleMod += Math.signum(result.normal.x) * 0.6; } - ball.theta = (float) (Math.acos(result.normal.x) * 2 - ball.theta + Math.PI + angleMod) % (2 * Math.PI); // Reflects with a slight angle modification. + ball.theta = (float) (Math.acos(result.normal.x) * 2 - ball.theta + Math.PI + angleMod) % (2 * Math.PI); // Reflects + // with + // a + // slight + // angle + // modification. if (ball.theta > Math.PI / 2 - 0.5 && ball.theta < Math.PI / 2 + 0.5) { if (ball.theta <= Math.PI / 2) @@ -119,11 +126,13 @@ public void updateScreenOnFrame() { timeLeft -= result.time * timeLeft; result = TwoDimensionalRayTracer.nearestBoxSegmentCollision( new Vector2f(ball.getSelfPosition().x, ball.getSelfPosition().y), - new Vector2f((float) (Math.cos(ball.theta) * 3 * timeLeft), (float) (Math.sin(ball.theta) * 3 * timeLeft)), + new Vector2f((float) (Math.cos(ball.theta) * 3 * timeLeft), + (float) (Math.sin(ball.theta) * 3 * timeLeft)), solidObjects, new Vector2f(4, 4)); // To prevent it getting permanently lodged into something. - ball.addSelfPosition((Math.cos(ball.theta) * 2 * (result.time + 0.1) * (timeLeft + 0.1)), (Math.sin(ball.theta) * 2 * (result.time + 0.1) * (timeLeft + 0.1))); + ball.addSelfPosition((Math.cos(ball.theta) * 2 * (result.time + 0.1) * (timeLeft + 0.1)), + (Math.sin(ball.theta) * 2 * (result.time + 0.1) * (timeLeft + 0.1))); } ball.addSelfPosition((Math.cos(ball.theta) * 2 * timeLeft), (Math.sin(ball.theta) * 2 * timeLeft)); solidObjects.remove(2); @@ -150,7 +159,8 @@ public int simplePaddleAI(PaddleWidget paddle) { return -1; if ((ball.getSelfPosition().getY() + 2 * paddle.getSelfPosition().getY()) / 3 < paddle.getSelfPosition().getY()) return 1; - else if ((ball.getSelfPosition().getY() + 2 * paddle.getSelfPosition().getY()) / 3 > paddle.getSelfPosition().getY()) + else if ((ball.getSelfPosition().getY() + 2 * paddle.getSelfPosition().getY()) / 3 > + paddle.getSelfPosition().getY()) return 0; return -1; } diff --git a/src/main/java/gregtech/common/terminal/app/game/pong/TwoDimensionalRayTracer.java b/src/main/java/gregtech/common/terminal/app/game/pong/TwoDimensionalRayTracer.java index cfca6f473a5..a32469e6fcb 100644 --- a/src/main/java/gregtech/common/terminal/app/game/pong/TwoDimensionalRayTracer.java +++ b/src/main/java/gregtech/common/terminal/app/game/pong/TwoDimensionalRayTracer.java @@ -9,7 +9,9 @@ // Huge thanks to https://noonat.github.io/intersect! public class TwoDimensionalRayTracer { + public static class TwoDimensionalRayTraceResult { + public Vector2f pos = new Vector2f(); public Vector2f delta = new Vector2f(); public Vector2f normal = new Vector2f(); @@ -25,7 +27,8 @@ public static class TwoDimensionalRayTraceResult { * @param boxSize The half-width and half-height of the box * @return The resulting intersection between a segment and a box, or else null */ - public static TwoDimensionalRayTraceResult intersectBoxSegment(Vector2f pos, Vector2f delta, Vector2f boxCenter, Vector2f boxSize) { + public static TwoDimensionalRayTraceResult intersectBoxSegment(Vector2f pos, Vector2f delta, Vector2f boxCenter, + Vector2f boxSize) { float scaleX = (float) (1.0 / delta.x); float scaleY = (float) (1.0 / delta.y); float signX = Math.signum(scaleX); @@ -63,7 +66,8 @@ public static TwoDimensionalRayTraceResult intersectBoxSegment(Vector2f pos, Vec return result; } - public static TwoDimensionalRayTraceResult nearestBoxSegmentCollision(Vector2f pos, Vector2f delta, List boxes, Vector2f padding) { + public static TwoDimensionalRayTraceResult nearestBoxSegmentCollision(Vector2f pos, Vector2f delta, + List boxes, Vector2f padding) { TwoDimensionalRayTraceResult result = new TwoDimensionalRayTraceResult(); result.time = 1; result.pos.x = pos.x + delta.x; @@ -79,5 +83,4 @@ public static TwoDimensionalRayTraceResult nearestBoxSegmentCollision(Vector2f p } return result; } - } diff --git a/src/main/java/gregtech/common/terminal/app/game/pong/widget/BallWidget.java b/src/main/java/gregtech/common/terminal/app/game/pong/widget/BallWidget.java index b4e9b63e9e2..49aa63629af 100644 --- a/src/main/java/gregtech/common/terminal/app/game/pong/widget/BallWidget.java +++ b/src/main/java/gregtech/common/terminal/app/game/pong/widget/BallWidget.java @@ -3,16 +3,20 @@ import gregtech.api.gui.resources.TextureArea; import gregtech.api.gui.widgets.ImageWidget; import gregtech.api.util.Position; + import net.minecraft.util.ResourceLocation; + import org.lwjgl.util.vector.Vector2f; public class BallWidget extends ImageWidget { + public double theta; private double xAccurate; private double yAccurate; public BallWidget(int xPosition, int yPosition) { - super(xPosition, yPosition, 8, 8, new TextureArea(new ResourceLocation("gregtech:textures/gui/widget/pong_ball.png"), 0, 0, 1, 1)); + super(xPosition, yPosition, 8, 8, + new TextureArea(new ResourceLocation("gregtech:textures/gui/widget/pong_ball.png"), 0, 0, 1, 1)); theta = (Math.random() > 0.5 ? Math.PI : Math.PI / 2) + Math.random() * 0.2; xAccurate = xPosition; yAccurate = yPosition; @@ -39,6 +43,6 @@ public void addSelfPosition(double addX, double addY) { } public Vector2f getPreciseSelfPosition() { - return new Vector2f((float) xAccurate , (float) yAccurate); + return new Vector2f((float) xAccurate, (float) yAccurate); } } diff --git a/src/main/java/gregtech/common/terminal/app/game/pong/widget/PaddleWidget.java b/src/main/java/gregtech/common/terminal/app/game/pong/widget/PaddleWidget.java index 31a59aaa5fc..758f2c80a20 100644 --- a/src/main/java/gregtech/common/terminal/app/game/pong/widget/PaddleWidget.java +++ b/src/main/java/gregtech/common/terminal/app/game/pong/widget/PaddleWidget.java @@ -3,10 +3,12 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.util.Position; + import java.awt.*; import java.util.function.Function; public class PaddleWidget extends Widget { + Function controlSupplier; public PaddleWidget(int x, int y, int width, int height, Function controlSupplier) { @@ -16,7 +18,9 @@ public PaddleWidget(int x, int y, int width, int height, Function extends AbstractApplication implements - SearchComponent.IWidgetSearch>> { + SearchComponent.IWidgetSearch>> { + private GuidePageWidget pageWidget; private TreeListWidget tree; private TreeNode ROOT; @@ -90,6 +93,7 @@ protected IGuiTexture itemIcon(T item) { /** * Should return a localised representation of the item + * * @param item item * @return localised name */ @@ -130,7 +134,7 @@ public final void loadJsonFiles() { jsonObjectMap = new HashMap<>(); for (JsonObject json : jsons) { T t = ofJson(json); - if(t != null) { + if (t != null) { registerItem(t, json.get("section").getAsString()); jsonObjectMap.put(t, json); } @@ -153,13 +157,14 @@ public boolean isManualInterrupt() { @Override public void search(String word, Consumer>> find) { Stack> stack = new Stack<>(); - if(getTree() != null) { + if (getTree() != null) { stack.push(getTree()); dfsSearch(Thread.currentThread(), stack, word.toLowerCase(), find); } } - private boolean dfsSearch(Thread thread, Stack> stack, String regex, Consumer>> find) { + private boolean dfsSearch(Thread thread, Stack> stack, String regex, + Consumer>> find) { if (thread.isInterrupted()) { return true; } else { @@ -191,7 +196,7 @@ protected void registerItem(T item, String path) { String[] parts = path.split("/"); TreeNode child = ROOT; if (!parts[0].isEmpty()) { - for(String sub : parts) { + for (String sub : parts) { child = child.getOrCreateChild(sub); } } @@ -211,13 +216,13 @@ public void selectResult(Stack> result) { @Override public String resultDisplay(Stack> result) { Iterator> iterator = result.iterator(); - if(!iterator.hasNext()) return ""; + if (!iterator.hasNext()) return ""; iterator.next(); // skip root StringBuilder builder = new StringBuilder(); while (iterator.hasNext()) { TreeNode node = iterator.next(); builder.append(node.getContent() == null ? node.getKey() : itemName(node.getContent())); - if(iterator.hasNext()) + if (iterator.hasNext()) builder.append(" / "); } return builder.toString(); @@ -229,11 +234,12 @@ public List getMenuComponents() { } private void buildTree() { - this.tree = new TreeListWidget<>(0, 0, getOs().getSize().width - 200, getOs().getSize().height, getTree(), this::loadPage).setContentIconSupplier(this::itemIcon) - .setContentNameSupplier(this::itemName) - .setKeyNameSupplier(key -> key) - .setNodeTexture(GuiTextures.BORDERED_BACKGROUND) - .setLeafTexture(GuiTextures.SLOT_DARKENED); + this.tree = new TreeListWidget<>(0, 0, getOs().getSize().width - 200, getOs().getSize().height, getTree(), + this::loadPage).setContentIconSupplier(this::itemIcon) + .setContentNameSupplier(this::itemName) + .setKeyNameSupplier(key -> key) + .setNodeTexture(GuiTextures.BORDERED_BACKGROUND) + .setLeafTexture(GuiTextures.SLOT_DARKENED); this.addWidget(this.tree); } @@ -244,13 +250,12 @@ protected void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, Position position = this.pageWidget.getPosition(); mouseX = (int) ((mouseX - position.x * (1 - scale)) / scale); mouseY = (int) (mouseY / scale); - GlStateManager.translate(position.x * (1- scale), 0, 0); + GlStateManager.translate(position.x * (1 - scale), 0, 0); GlStateManager.scale(scale, scale, 1); this.pageWidget.drawInBackground(mouseX, mouseY, partialTicks, context); GlStateManager.scale(1 / scale, 1 / scale, 1); GlStateManager.translate(position.x * (scale - 1), 0, 0); } - } @Override @@ -260,11 +265,11 @@ protected void hookDrawInForeground(int mouseX, int mouseY) { Position position = this.pageWidget.getPosition(); mouseX = (int) ((mouseX - position.x * (1 - scale)) / scale); mouseY = (int) (mouseY / scale); - GlStateManager.translate(position.x * (1- scale), 0, 0); + GlStateManager.translate(position.x * (1 - scale), 0, 0); GlStateManager.scale(scale, scale, 1); this.pageWidget.drawInForeground(mouseX, mouseY); GlStateManager.scale(1 / scale, 1 / scale, 1); - GlStateManager.translate(position.x * (scale - 1) , 0, 0); + GlStateManager.translate(position.x * (scale - 1), 0, 0); } } diff --git a/src/main/java/gregtech/common/terminal/app/guide/ItemGuideApp.java b/src/main/java/gregtech/common/terminal/app/guide/ItemGuideApp.java index e1793934482..d86bfe35d0c 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/ItemGuideApp.java +++ b/src/main/java/gregtech/common/terminal/app/guide/ItemGuideApp.java @@ -1,14 +1,16 @@ package gregtech.common.terminal.app.guide; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.gui.resources.ItemStackTexture; import gregtech.api.items.metaitem.MetaItem; import gregtech.common.items.MetaItems; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.util.Objects; public class ItemGuideApp extends GuideApp { @@ -25,7 +27,8 @@ protected String itemName(GuideItem item) { @Override protected String rawItemName(GuideItem item) { if (item.stack.getItem() instanceof MetaItem) { - MetaItem.MetaValueItem metaValueItem = ((MetaItem) item.stack.getItem()).getItem((short) item.stack.getMetadata()); + MetaItem.MetaValueItem metaValueItem = ((MetaItem) item.stack.getItem()) + .getItem((short) item.stack.getMetadata()); if (metaValueItem != null) return metaValueItem.unlocalizedName; } return item.stack.getTranslationKey(); @@ -42,6 +45,7 @@ public GuideItem ofJson(JsonObject json) { } public static class GuideItem { + public final ItemStack stack; public final String name; @@ -75,7 +79,8 @@ public static GuideItem ofJson(JsonObject json) { if (json.has("metaitem")) { String metaItemId = json.get("metaitem").getAsString(); for (MetaItem metaItem : MetaItem.getMetaItems()) { - MetaItem.MetaValueItem metaValueItem = metaItem.getAllItems().stream().filter(m -> m.unlocalizedName.equals(metaItemId)).findFirst().orElse(null); + MetaItem.MetaValueItem metaValueItem = metaItem.getAllItems().stream() + .filter(m -> m.unlocalizedName.equals(metaItemId)).findFirst().orElse(null); if (metaValueItem != null) return new GuideItem(metaValueItem); } } diff --git a/src/main/java/gregtech/common/terminal/app/guide/MultiBlockGuideApp.java b/src/main/java/gregtech/common/terminal/app/guide/MultiBlockGuideApp.java index b0acc8b419d..6e261666def 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/MultiBlockGuideApp.java +++ b/src/main/java/gregtech/common/terminal/app/guide/MultiBlockGuideApp.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.guide; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.GregTechAPI; import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.gui.resources.ItemStackTexture; @@ -9,6 +7,9 @@ import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.MetaTileEntities; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + public class MultiBlockGuideApp extends GuideApp { public MultiBlockGuideApp() { @@ -17,7 +18,7 @@ public MultiBlockGuideApp() { @Override public MetaTileEntity ofJson(JsonObject json) { - String[] valids = {"multiblock", "metatileentity"}; + String[] valids = { "multiblock", "metatileentity" }; if (json.isJsonObject()) { for (String valid : valids) { JsonElement id = json.getAsJsonObject().get(valid); diff --git a/src/main/java/gregtech/common/terminal/app/guide/SimpleMachineGuideApp.java b/src/main/java/gregtech/common/terminal/app/guide/SimpleMachineGuideApp.java index 3e57cb3f3e8..171f108dfbb 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/SimpleMachineGuideApp.java +++ b/src/main/java/gregtech/common/terminal/app/guide/SimpleMachineGuideApp.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.guide; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.gui.resources.IGuiTexture; @@ -10,6 +8,9 @@ import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.MetaTileEntities; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + public class SimpleMachineGuideApp extends GuideApp { public SimpleMachineGuideApp() { @@ -33,7 +34,7 @@ protected String rawItemName(MetaTileEntity item) { @Override public MetaTileEntity ofJson(JsonObject json) { - String[] valids = {"machine", "generator", "metatileentity"}; + String[] valids = { "machine", "generator", "metatileentity" }; if (json.isJsonObject()) { for (String valid : valids) { JsonElement id = json.getAsJsonObject().get(valid); diff --git a/src/main/java/gregtech/common/terminal/app/guide/TutorialGuideApp.java b/src/main/java/gregtech/common/terminal/app/guide/TutorialGuideApp.java index 3bf5f1da190..eeed5585413 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/TutorialGuideApp.java +++ b/src/main/java/gregtech/common/terminal/app/guide/TutorialGuideApp.java @@ -1,10 +1,12 @@ package gregtech.common.terminal.app.guide; -import com.google.gson.JsonObject; import gregtech.api.gui.resources.ItemStackTexture; + import net.minecraft.client.resources.I18n; import net.minecraft.init.Items; +import com.google.gson.JsonObject; + public class TutorialGuideApp extends GuideApp { public TutorialGuideApp() { diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/CardWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/CardWidget.java index 7169c47c3af..3d59cc9f862 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/CardWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/CardWidget.java @@ -1,6 +1,5 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.JsonObject; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; @@ -9,12 +8,15 @@ import gregtech.common.terminal.app.guideeditor.widget.configurator.BooleanConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.NumberConfigurator; +import com.google.gson.JsonObject; + import java.util.function.Consumer; -public class CardWidget extends GuideWidget{ +public class CardWidget extends GuideWidget { + public final static String NAME = "card"; - //config + // config public int width; public int height; public boolean isShadow; @@ -35,7 +37,8 @@ public JsonObject getTemplate(boolean isFixed) { } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { group.addWidget(new BooleanConfigurator(group, config, "isShadow", true).setOnUpdated(needUpdate)); if (!isFixed) { group.addWidget(new NumberConfigurator(group, config, "width").setOnUpdated(needUpdate)); diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/GuidePageWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/GuidePageWidget.java index e0cd3599b4f..bf388e66b09 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/GuidePageWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/GuidePageWidget.java @@ -1,9 +1,5 @@ package gregtech.common.terminal.app.guide.widget; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; import gregtech.api.gui.Widget; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; @@ -12,14 +8,19 @@ import gregtech.api.util.interpolate.Eases; import gregtech.api.util.interpolate.Interpolator; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + import java.awt.*; -import java.util.List; import java.util.*; +import java.util.List; public class GuidePageWidget extends DraggableScrollableWidgetGroup { + public static final Map REGISTER_WIDGETS = new HashMap<>(); - static { //register guide widgets + static { // register guide widgets REGISTER_WIDGETS.put(TextBoxWidget.NAME, new TextBoxWidget()); REGISTER_WIDGETS.put(ImageWidget.NAME, new ImageWidget()); REGISTER_WIDGETS.put(CardWidget.NAME, new CardWidget()); @@ -42,7 +43,6 @@ public GuidePageWidget(int xPosition, int yPosition, int width, int height, int .setYBarStyle(new ColorRectTexture(new Color(142, 142, 142)), new ColorRectTexture(new Color(148, 226, 193))); this.setUseScissor(false); - } public int getPageWidth() { @@ -108,7 +108,8 @@ public void loadJsonConfig(JsonObject config) { int y = title.getSize().height + 10; for (JsonElement element : config.getAsJsonArray("stream")) { JsonObject widgetConfig = element.getAsJsonObject(); - Widget widget = REGISTER_WIDGETS.get(widgetConfig.get("type").getAsString()).updateOrCreateStreamWidget(margin, y, pageWidth - 2 * margin, widgetConfig); + Widget widget = REGISTER_WIDGETS.get(widgetConfig.get("type").getAsString()) + .updateOrCreateStreamWidget(margin, y, pageWidth - 2 * margin, widgetConfig); y += widget.getSize().height + 5; stream.add(widget); this.addWidget(widget); @@ -170,7 +171,8 @@ public void jumpToRef(String ref) { if (interpolator != null && !interpolator.isFinish()) return; for (Widget widget : widgets) { if (widget instanceof IGuideWidget && ref.equals(((IGuideWidget) widget).getRef())) { - interpolator = new Interpolator(scrollYOffset, widget.getSelfPosition().y + scrollYOffset, 20, Eases.QUAD_OUT, + interpolator = new Interpolator(scrollYOffset, widget.getSelfPosition().y + scrollYOffset, 20, + Eases.QUAD_OUT, value -> setScrollYOffset(value.intValue()), value -> interpolator = null); interpolator.start(); diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidget.java index e28909fe599..9055e6cf1cb 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidget.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; @@ -11,14 +9,19 @@ import gregtech.common.terminal.app.guideeditor.widget.configurator.NumberConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.StringConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.TextListConfigurator; + import net.minecraft.item.ItemStack; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; public abstract class GuideWidget extends Widget implements IGuideWidget { - //config + + // config public String ref; public int fill; public int stroke; @@ -34,7 +37,7 @@ public GuideWidget(int x, int y, int width, int height) { super(x, y, width, height); } - public GuideWidget(){ + public GuideWidget() { super(Position.ORIGIN, Size.ZERO); } @@ -50,7 +53,7 @@ public boolean isFixed() { protected abstract Widget initFixed(); - protected Widget initStream(){ + protected Widget initStream() { return initFixed(); } @@ -97,7 +100,8 @@ public JsonObject getTemplate(boolean isFixed) { } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { group.addWidget(new ColorConfigurator(group, config, "fill", 0).setOnUpdated(needUpdate)); group.addWidget(new ColorConfigurator(group, config, "stroke", 0).setOnUpdated(needUpdate)); group.addWidget(new NumberConfigurator(group, config, "stroke_width", 1).setOnUpdated(needUpdate)); @@ -162,7 +166,7 @@ public void drawInForeground(int mouseX, int mouseY) { public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { Position position = getPosition(); Size size = getSize(); - if(stroke != 0) { + if (stroke != 0) { drawBorder(position.x, position.y, size.width, size.height, stroke, stroke_width); } if (fill != 0) { @@ -173,8 +177,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { if (link != null && isMouseOverElement(mouseX, mouseY) && isCtrlDown()) { - page.jumpToRef(link); - return true; + page.jumpToRef(link); + return true; } return false; } diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidgetGroup.java b/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidgetGroup.java index db80974f163..51a91cf93dc 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidgetGroup.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidgetGroup.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.WidgetGroup; @@ -12,14 +10,19 @@ import gregtech.common.terminal.app.guideeditor.widget.configurator.NumberConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.StringConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.TextListConfigurator; + import net.minecraft.item.ItemStack; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; public abstract class GuideWidgetGroup extends WidgetGroup implements IGuideWidget { - //config + + // config public String ref; public int fill; public int stroke; @@ -35,7 +38,7 @@ public GuideWidgetGroup(int x, int y, int width, int height) { super(x, y, width, height); } - public GuideWidgetGroup(){ + public GuideWidgetGroup() { super(Position.ORIGIN, Size.ZERO); } @@ -92,7 +95,8 @@ public JsonObject getTemplate(boolean isFixed) { } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { group.addWidget(new ColorConfigurator(group, config, "fill", 0).setOnUpdated(needUpdate)); group.addWidget(new ColorConfigurator(group, config, "stroke", 0).setOnUpdated(needUpdate)); group.addWidget(new NumberConfigurator(group, config, "stroke_width", 1).setOnUpdated(needUpdate)); @@ -172,7 +176,7 @@ public void drawInForeground(int mouseX, int mouseY) { public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { Position position = getPosition(); Size size = getSize(); - if(stroke != 0) { + if (stroke != 0) { drawBorder(position.x, position.y, size.width, size.height, stroke, stroke_width); } if (fill != 0) { @@ -189,5 +193,4 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { } return super.mouseClicked(mouseX, mouseY, button); } - } diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/IGuideWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/IGuideWidget.java index 77fe7a8b4a1..7fb947c8c26 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/IGuideWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/IGuideWidget.java @@ -1,17 +1,19 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.gui.Widget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.util.Position; import gregtech.api.util.Size; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.lang.reflect.Field; import java.util.function.Consumer; public interface IGuideWidget { + String getRegistryName(); JsonObject getConfig(); @@ -24,7 +26,7 @@ public interface IGuideWidget { void setPage(GuidePageWidget page); - default void updateValue(String field){ + default void updateValue(String field) { JsonObject config = getConfig(); if (config != null && config.has(field)) { try { @@ -36,9 +38,9 @@ default void updateValue(String field){ f.set(this, new Gson().fromJson(value, f.getGenericType())); } if (isFixed()) { - updateOrCreateFixedWidget(0,0,0,0,null); + updateOrCreateFixedWidget(0, 0, 0, 0, null); } else { - updateOrCreateStreamWidget(0,0,0,null); + updateOrCreateStreamWidget(0, 0, 0, null); } } catch (Exception ignored) {} } @@ -48,11 +50,12 @@ default void updateValue(String field){ JsonObject getTemplate(boolean isFixed); - void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate); + void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate); void setStroke(int color); default void onFixedPositionSizeChanged(Position position, Size size) { - updateOrCreateFixedWidget(0,0,0,0,null); + updateOrCreateFixedWidget(0, 0, 0, 0, null); } } diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/ImageWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/ImageWidget.java index 9570dc7b01f..b5f6fd5d71b 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/ImageWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/ImageWidget.java @@ -1,6 +1,5 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.JsonObject; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.gui.resources.IGuiTexture; @@ -8,21 +7,25 @@ import gregtech.api.gui.resources.TextureArea; import gregtech.api.gui.resources.URLTexture; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; +import gregtech.api.util.Position; +import gregtech.api.util.Size; import gregtech.common.terminal.app.guideeditor.widget.configurator.NumberConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.SelectorConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.StringConfigurator; -import gregtech.api.util.Position; -import gregtech.api.util.Size; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; +import com.google.gson.JsonObject; + import java.util.Arrays; import java.util.function.Consumer; -public class ImageWidget extends GuideWidget{ +public class ImageWidget extends GuideWidget { + public final static String NAME = "image"; - //config + // config public String form; public String source; public int width; @@ -46,12 +49,14 @@ public JsonObject getTemplate(boolean isFixed) { } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { if (!isFixed) { group.addWidget(new NumberConfigurator(group, config, "width").setOnUpdated(needUpdate)); group.addWidget(new NumberConfigurator(group, config, "height").setOnUpdated(needUpdate)); } - group.addWidget(new SelectorConfigurator(group, config, "form", Arrays.asList("url", "item", "resource")).setOnUpdated(needUpdate)); + group.addWidget(new SelectorConfigurator(group, config, "form", Arrays.asList("url", "item", "resource")) + .setOnUpdated(needUpdate)); group.addWidget(new StringConfigurator(group, config, "source").setOnUpdated(needUpdate)); super.loadConfigurator(group, config, isFixed, needUpdate); } @@ -98,8 +103,8 @@ protected Widget initFixed() { @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { if (image != null) { - super.drawInBackground(mouseX, mouseY, partialTicks,context); - GlStateManager.color(1,1,1,1); + super.drawInBackground(mouseX, mouseY, partialTicks, context); + GlStateManager.color(1, 1, 1, 1); Position position = getPosition(); image.draw(position.x, position.y, getSize().width, getSize().height); } diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/SlotListWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/SlotListWidget.java index 7b5e20d5cbf..4fcb005954c 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/SlotListWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/SlotListWidget.java @@ -1,24 +1,27 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import gregtech.api.gui.Widget; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; -import gregtech.common.terminal.app.guideeditor.widget.configurator.ItemStackConfigurator; import gregtech.api.util.Size; +import gregtech.common.terminal.app.guideeditor.widget.configurator.ItemStackConfigurator; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.items.ItemStackHandler; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + import java.util.Collections; import java.util.List; import java.util.function.Consumer; public class SlotListWidget extends GuideWidgetGroup { + public final static String NAME = "slots"; // config @@ -62,17 +65,20 @@ public String getRegistryName() { @Override public JsonObject getTemplate(boolean isFixed) { JsonObject template = super.getTemplate(isFixed); - template.add("item_list", new Gson().toJsonTree(Collections.singletonList(new ItemStackInfo("minecraft:ender_pearl", 0, 1)))); + template.add("item_list", + new Gson().toJsonTree(Collections.singletonList(new ItemStackInfo("minecraft:ender_pearl", 0, 1)))); return template; } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { super.loadConfigurator(group, config, isFixed, needUpdate); group.addWidget(new ItemStackConfigurator(group, config, "item_list").setOnUpdated(needUpdate)); } public static class ItemStackInfo { + // config public String id; public int damage; @@ -80,9 +86,7 @@ public static class ItemStackInfo { private transient ItemStack itemStack; - public ItemStackInfo() { - - } + public ItemStackInfo() {} public void update(ItemStack itemStack) { ResourceLocation resourceLocation = itemStack.getItem().getRegistryName(); diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/TankListWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/TankListWidget.java index 847e4c21124..8de6641bd72 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/TankListWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/TankListWidget.java @@ -1,25 +1,28 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import gregtech.api.gui.Widget; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.gui.widgets.TankWidget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; -import gregtech.common.terminal.app.guideeditor.widget.configurator.FluidStackConfigurator; import gregtech.api.util.Size; +import gregtech.common.terminal.app.guideeditor.widget.configurator.FluidStackConfigurator; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + import java.awt.*; import java.util.Collections; import java.util.List; import java.util.function.Consumer; public class TankListWidget extends GuideWidgetGroup { + public final static String NAME = "tanks"; // config @@ -46,7 +49,8 @@ public Widget initFixed() { int i = x + y * maxXSize; if (i < size) { FluidStack fluidStack = fluid_list.get(i).getInstance(); - TankWidget widget = new TankWidget(new FluidTank(fluidStack, fluid_list.get(i).amount), xPos + x * 18, y * 18, 18, 18); + TankWidget widget = new TankWidget(new FluidTank(fluidStack, fluid_list.get(i).amount), + xPos + x * 18, y * 18, 18, 18); widget.setBackgroundTexture(background).setAlwaysShowFull(true).setClient(); this.addWidget(widget); } @@ -64,26 +68,27 @@ public String getRegistryName() { @Override public JsonObject getTemplate(boolean isFixed) { JsonObject template = super.getTemplate(isFixed); - template.add("fluid_list", new Gson().toJsonTree(Collections.singletonList(new FluidStackInfo("distilled_water", 1)))); + template.add("fluid_list", + new Gson().toJsonTree(Collections.singletonList(new FluidStackInfo("distilled_water", 1)))); return template; } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { super.loadConfigurator(group, config, isFixed, needUpdate); group.addWidget(new FluidStackConfigurator(group, config, "fluid_list").setOnUpdated(needUpdate)); } public static class FluidStackInfo { + // config public String id; public int amount = 1; private transient FluidStack fluidStack; - public FluidStackInfo() { - - } + public FluidStackInfo() {} public void update(FluidStack itemStack) { if (itemStack != null) { diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/TextBoxWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/TextBoxWidget.java index 756ba8875c9..465a4679b60 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/TextBoxWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/TextBoxWidget.java @@ -1,27 +1,30 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; +import gregtech.api.util.Position; +import gregtech.api.util.Size; import gregtech.common.terminal.app.guideeditor.widget.configurator.BooleanConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.ColorConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.NumberConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.TextListConfigurator; -import gregtech.api.util.Position; -import gregtech.api.util.Size; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Consumer; public class TextBoxWidget extends GuideWidget { + public final static String NAME = "textbox"; // config @@ -34,7 +37,8 @@ public class TextBoxWidget extends GuideWidget { private transient List textLines; - public TextBoxWidget(int x, int y, int width, List content, int space, int fontSize, int fontColor, int fill, int stroke, boolean isCenter, boolean isShadow) { + public TextBoxWidget(int x, int y, int width, List content, int space, int fontSize, int fontColor, + int fill, int stroke, boolean isCenter, boolean isShadow) { super(x, y, width, 0); this.content = content; this.space = space; @@ -67,7 +71,8 @@ public JsonObject getTemplate(boolean isFixed) { } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { group.addWidget(new TextListConfigurator(group, 200, config, "content").setOnUpdated(needUpdate)); group.addWidget(new BooleanConfigurator(group, config, "isCenter", false).setOnUpdated(needUpdate)); group.addWidget(new NumberConfigurator(group, config, "fontSize", 9).setOnUpdated(needUpdate)); diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/GuideEditorApp.java b/src/main/java/gregtech/common/terminal/app/guideeditor/GuideEditorApp.java index 8bd82660669..a8d19adf9e7 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/GuideEditorApp.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/GuideEditorApp.java @@ -33,21 +33,24 @@ public AbstractApplication initApp() { @Override public List getMenuComponents() { - ClickComponent newPage = new ClickComponent().setIcon(GuiTextures.ICON_NEW_PAGE).setHoverText("terminal.component.new_page").setClickConsumer(cd->{ - if (configEditor != null) { - configEditor.newPage(); - } - }); - ClickComponent importPage = new ClickComponent().setIcon(GuiTextures.ICON_LOAD).setHoverText("terminal.component.load_file").setClickConsumer(cd->{ - if (configEditor != null) { - configEditor.loadJson(); - } - }); - ClickComponent exportPage = new ClickComponent().setIcon(GuiTextures.ICON_SAVE).setHoverText("terminal.component.save_file").setClickConsumer(cd->{ - if (configEditor != null) { - configEditor.saveJson(); - } - }); + ClickComponent newPage = new ClickComponent().setIcon(GuiTextures.ICON_NEW_PAGE) + .setHoverText("terminal.component.new_page").setClickConsumer(cd -> { + if (configEditor != null) { + configEditor.newPage(); + } + }); + ClickComponent importPage = new ClickComponent().setIcon(GuiTextures.ICON_LOAD) + .setHoverText("terminal.component.load_file").setClickConsumer(cd -> { + if (configEditor != null) { + configEditor.loadJson(); + } + }); + ClickComponent exportPage = new ClickComponent().setIcon(GuiTextures.ICON_SAVE) + .setHoverText("terminal.component.save_file").setClickConsumer(cd -> { + if (configEditor != null) { + configEditor.saveJson(); + } + }); return Arrays.asList(newPage, importPage, exportPage); } @@ -55,5 +58,4 @@ public List getMenuComponents() { public boolean isClientSideApp() { return true; } - } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuideConfigEditor.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuideConfigEditor.java index 86a982affc0..83f6ad93091 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuideConfigEditor.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuideConfigEditor.java @@ -1,6 +1,5 @@ package gregtech.common.terminal.app.guideeditor.widget; -import com.google.gson.JsonObject; import gregtech.api.GregTechAPI; import gregtech.api.block.machines.MachineItemBlock; import gregtech.api.gui.GuiTextures; @@ -30,10 +29,13 @@ import gregtech.common.terminal.app.guide.widget.GuidePageWidget; import gregtech.common.terminal.app.guide.widget.IGuideWidget; import gregtech.common.terminal.app.guideeditor.GuideEditorApp; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandlerModifiable; +import com.google.gson.JsonObject; + import java.awt.*; import java.io.File; import java.util.List; @@ -42,6 +44,7 @@ import java.util.stream.Collectors; public class GuideConfigEditor extends TabGroup { + public String json; private IGuideWidget selected; private GuidePageEditorWidget pageEditor; @@ -57,23 +60,27 @@ public class GuideConfigEditor extends TabGroup { public GuideConfigEditor(int x, int y, int width, int height, GuideEditorApp app) { super(x, y + 10, new CustomTabListRenderer(TerminalTheme.COLOR_F_2, TerminalTheme.COLOR_B_3, 30, 10)); setSize(new Size(width, height)); - candidates = TerminalRegistry.getAllApps().stream().filter(GuideApp.class::isInstance).map(AbstractApplication::getUnlocalizedName).collect(Collectors.toList()); + candidates = TerminalRegistry.getAllApps().stream().filter(GuideApp.class::isInstance) + .map(AbstractApplication::getUnlocalizedName).collect(Collectors.toList()); type = candidates.get(candidates.size() - 1); handler = new SingleItemStackHandler(1); addButton = new CircleButtonWidget[2]; widgetSelector = createWidgetSelector(); widgetConfigurator = createConfigurator(); - this.addTab(new IGuiTextureTabInfo(new TextTexture("P", -1), "terminal.guide_editor.page_config"), createPageConfig()); - this.addTab(new IGuiTextureTabInfo(new TextTexture("W", -1), "terminal.guide_editor.widgets_box"), widgetSelector); - this.addTab(new IGuiTextureTabInfo(new TextTexture("C", -1), "terminal.guide_editor.widget_config"), widgetConfigurator); - this.setOnTabChanged((oldIndex, newIndex)->{ - if (newIndex == 1) { - addButton[0].setVisible(true); - addButton[1].setVisible(true); - } else { - addButton[0].setVisible(false); - addButton[1].setVisible(false); - } + this.addTab(new IGuiTextureTabInfo(new TextTexture("P", -1), "terminal.guide_editor.page_config"), + createPageConfig()); + this.addTab(new IGuiTextureTabInfo(new TextTexture("W", -1), "terminal.guide_editor.widgets_box"), + widgetSelector); + this.addTab(new IGuiTextureTabInfo(new TextTexture("C", -1), "terminal.guide_editor.widget_config"), + widgetConfigurator); + this.setOnTabChanged((oldIndex, newIndex) -> { + if (newIndex == 1) { + addButton[0].setVisible(true); + addButton[1].setVisible(true); + } else { + addButton[0].setVisible(false); + addButton[1].setVisible(false); + } }); addButton[0] = new CircleButtonWidget(115, 15, 8, 1, 8) .setColors(new Color(255, 255, 255, 0).getRGB(), @@ -105,34 +112,36 @@ public GuidePageEditorWidget getPageEditor() { } private DraggableScrollableWidgetGroup createPageConfig() { - DraggableScrollableWidgetGroup group = new DraggableScrollableWidgetGroup(0, 0, getSize().width, getSize().height - 10) - .setBackground(TerminalTheme.COLOR_B_3) - .setYScrollBarWidth(4) - .setYBarStyle(null, TerminalTheme.COLOR_F_1); + DraggableScrollableWidgetGroup group = new DraggableScrollableWidgetGroup(0, 0, getSize().width, + getSize().height - 10) + .setBackground(TerminalTheme.COLOR_B_3) + .setYScrollBarWidth(4) + .setYBarStyle(null, TerminalTheme.COLOR_F_1); group.addWidget(new LabelWidget(5, 5, "section", -1).setShadow(true)); group.addWidget(new TextFieldWidget(5, 15, 116, 20, new ColorRectTexture(0x9f000000), null, null) - .setTextResponder(s->{ + .setTextResponder(s -> { if (pageEditor != null) { pageEditor.setSection(s); } }, true) - .setTextSupplier(()-> getPageEditor().getSection(), true) + .setTextSupplier(() -> getPageEditor().getSection(), true) .setMaxStringLength(Integer.MAX_VALUE) - .setValidator(s->true)); - group.addWidget(new ImageWidget(5, 40,116, 1, new ColorRectTexture(-1))); + .setValidator(s -> true)); + group.addWidget(new ImageWidget(5, 40, 116, 1, new ColorRectTexture(-1))); group.addWidget(new LabelWidget(5, 45, "type", -1).setShadow(true)); group.addWidget(new SelectorWidget(30, 55, 91, 20, candidates, -1, - ()->type, true).setIsUp(true) - .setOnChanged(type-> this.type = type) - .setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), TerminalTheme.COLOR_B_2.getColor()) - .setBackground(TerminalTheme.COLOR_6)); + () -> type, true).setIsUp(true) + .setOnChanged(type -> this.type = type) + .setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), + TerminalTheme.COLOR_B_2.getColor()) + .setBackground(TerminalTheme.COLOR_6)); group.addWidget(new PhantomSlotWidget(handler, 0, 6, 56).setBackgroundTexture(TerminalTheme.COLOR_B_2)); - group.addWidget(new ImageWidget(5, 80,116, 1, new ColorRectTexture(-1))); + group.addWidget(new ImageWidget(5, 80, 116, 1, new ColorRectTexture(-1))); group.addWidget(new LabelWidget(5, 85, "title", -1).setShadow(true)); - titleEditor = new TextEditorWidget(5, 95, 116, 70, s->{ + titleEditor = new TextEditorWidget(5, 95, 116, 70, s -> { if (pageEditor != null) { pageEditor.setTitle(s); } @@ -146,16 +155,18 @@ public void updateTitle(String title) { } private DraggableScrollableWidgetGroup createWidgetSelector() { - DraggableScrollableWidgetGroup group = new DraggableScrollableWidgetGroup(0, 0, getSize().width, getSize().height - 10) - .setBackground(TerminalTheme.COLOR_B_3) - .setYScrollBarWidth(4) - .setYBarStyle(null, TerminalTheme.COLOR_F_1); - int y = 10; //133 + DraggableScrollableWidgetGroup group = new DraggableScrollableWidgetGroup(0, 0, getSize().width, + getSize().height - 10) + .setBackground(TerminalTheme.COLOR_B_3) + .setYScrollBarWidth(4) + .setYBarStyle(null, TerminalTheme.COLOR_F_1); + int y = 10; // 133 for (Map.Entry entry : GuidePageWidget.REGISTER_WIDGETS.entrySet()) { IGuideWidget widgetTemplate = entry.getValue(); JsonObject template = widgetTemplate.getTemplate(false); Widget guideWidget = widgetTemplate.updateOrCreateStreamWidget(5, y + 10, getSize().width - 14, template); - group.addWidget(new LabelWidget(getSize().width / 2 - 1, y - 3, entry.getKey(), -1).setXCentered(true).setShadow(true)); + group.addWidget(new LabelWidget(getSize().width / 2 - 1, y - 3, entry.getKey(), -1).setXCentered(true) + .setShadow(true)); y += guideWidget.getSize().height + 25; group.addWidget(guideWidget); } @@ -173,71 +184,76 @@ private DraggableScrollableWidgetGroup createConfigurator() { public void loadConfigurator(IGuideWidget widget) { widgetConfigurator.clearAllWidgets(); if (widget != null) { - widget.loadConfigurator(widgetConfigurator, widget.getConfig(), widget.isFixed(), type->{ + widget.loadConfigurator(widgetConfigurator, widget.getConfig(), widget.isFixed(), type -> { widget.updateValue(type); if (pageEditor != null) { pageEditor.computeMax(); } }); - widgetConfigurator.addWidget(new WidgetGroup(new Position(5, widgetConfigurator.getWidgetBottomHeight() + 5), Size.ZERO)); + widgetConfigurator.addWidget( + new WidgetGroup(new Position(5, widgetConfigurator.getWidgetBottomHeight() + 5), Size.ZERO)); } } public void newPage() { - TerminalDialogWidget.showConfirmDialog(app.getOs(), "terminal.component.new_page", "terminal.component.confirm", res->{ - if (res) { - pageEditor.loadJsonConfig("{\"section\":\"default\",\"title\":\"Template\",\"stream\":[],\"fixed\":[]}"); - getPageEditor().setSection("default"); - updateTitle("Template"); - type = candidates.get(candidates.size() - 1); - handler.setStackInSlot(0, ItemStack.EMPTY); - } - }).setClientSide().open(); + TerminalDialogWidget + .showConfirmDialog(app.getOs(), "terminal.component.new_page", "terminal.component.confirm", res -> { + if (res) { + pageEditor.loadJsonConfig( + "{\"section\":\"default\",\"title\":\"Template\",\"stream\":[],\"fixed\":[]}"); + getPageEditor().setSection("default"); + updateTitle("Template"); + type = candidates.get(candidates.size() - 1); + handler.setStackInSlot(0, ItemStack.EMPTY); + } + }).setClientSide().open(); } public void loadJson() { if (pageEditor != null) { - File file = new File(TerminalRegistry.TERMINAL_PATH,"guide"); - TerminalDialogWidget.showFileDialog(app.getOs(), "terminal.component.load_file", file, true, result->{ - if (result != null && result.isFile()) { - try { - JsonObject config = Objects.requireNonNull(FileUtility.loadJson(result)).getAsJsonObject(); - pageEditor.loadJsonConfig(config); - getPageEditor().setSection(config.get("section").getAsString()); - updateTitle(config.get("title").getAsString()); - for (AbstractApplication app : TerminalRegistry.getAllApps()) { - if (app instanceof GuideApp) { - Object object = ((GuideApp) app).ofJson(config); - if (object != null) { - type = app.getUnlocalizedName(); - if (object instanceof ItemGuideApp.GuideItem) { - handler.setStackInSlot(0, ((ItemGuideApp.GuideItem) object).stack.copy()); - } else if (object instanceof MetaTileEntity) { - handler.setStackInSlot(0, ((MetaTileEntity) object).getStackForm()); - } else if (object instanceof ItemStack) { - handler.setStackInSlot(0, ((ItemStack) object).copy()); - } else { - handler.setStackInSlot(0, ItemStack.EMPTY); - } - break; - } - } - } - } catch (Exception e) { - TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.error", "terminal.component.load_file.error").setClientSide().open(); - } - } + File file = new File(TerminalRegistry.TERMINAL_PATH, "guide"); + TerminalDialogWidget.showFileDialog(app.getOs(), "terminal.component.load_file", file, true, result -> { + if (result != null && result.isFile()) { + try { + JsonObject config = Objects.requireNonNull(FileUtility.loadJson(result)).getAsJsonObject(); + pageEditor.loadJsonConfig(config); + getPageEditor().setSection(config.get("section").getAsString()); + updateTitle(config.get("title").getAsString()); + for (AbstractApplication app : TerminalRegistry.getAllApps()) { + if (app instanceof GuideApp) { + Object object = ((GuideApp) app).ofJson(config); + if (object != null) { + type = app.getUnlocalizedName(); + if (object instanceof ItemGuideApp.GuideItem) { + handler.setStackInSlot(0, ((ItemGuideApp.GuideItem) object).stack.copy()); + } else if (object instanceof MetaTileEntity) { + handler.setStackInSlot(0, ((MetaTileEntity) object).getStackForm()); + } else if (object instanceof ItemStack) { + handler.setStackInSlot(0, ((ItemStack) object).copy()); + } else { + handler.setStackInSlot(0, ItemStack.EMPTY); + } + break; + } + } + } + } catch (Exception e) { + TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.error", + "terminal.component.load_file.error").setClientSide().open(); + } + } }).setClientSide().open(); } } public void saveJson() { - if(pageEditor != null) { - File file = new File(TerminalRegistry.TERMINAL_PATH,"guide"); - TerminalDialogWidget.showFileDialog(app.getOs(), "terminal.component.save_file", file, false, result->{ + if (pageEditor != null) { + File file = new File(TerminalRegistry.TERMINAL_PATH, "guide"); + TerminalDialogWidget.showFileDialog(app.getOs(), "terminal.component.save_file", file, false, result -> { if (result != null) { - if(!FileUtility.saveJson(result, saveType(pageEditor.getJsonConfig()))) { - TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.error", "terminal.component.save_file.error").setClientSide().open(); + if (!FileUtility.saveJson(result, saveType(pageEditor.getJsonConfig()))) { + TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.error", + "terminal.component.save_file.error").setClientSide().open(); } } }).setClientSide().open(); @@ -251,19 +267,23 @@ private JsonObject saveType(JsonObject jsonObject) { if (type.equals(app.getUnlocalizedName())) { if (app instanceof ItemGuideApp) { if (stack.isEmpty()) { - TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.warning", "terminal.guide_editor.error_type").setClientSide().open(); + TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.warning", + "terminal.guide_editor.error_type").setClientSide().open(); } else { - jsonObject.addProperty("item", Item.REGISTRY.getNameForObject(stack.getItem()).toString() + ":" + stack.getMetadata()); + jsonObject.addProperty("item", Item.REGISTRY.getNameForObject(stack.getItem()).toString() + + ":" + stack.getMetadata()); } - } else if ((app instanceof MultiBlockGuideApp || app instanceof SimpleMachineGuideApp) - && stack.getItem() instanceof MachineItemBlock) { - MetaTileEntity mte = GregTechAPI.MTE_REGISTRY.getObjectById(stack.getItemDamage()); - if (mte != null) { - jsonObject.addProperty("metatileentity", GregTechAPI.MTE_REGISTRY.getNameForObject(mte).getPath()); - } else { - TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.warning", "terminal.guide_editor.error_type").setClientSide().open(); - } - } + } else if ((app instanceof MultiBlockGuideApp || app instanceof SimpleMachineGuideApp) && + stack.getItem() instanceof MachineItemBlock) { + MetaTileEntity mte = GregTechAPI.MTE_REGISTRY.getObjectById(stack.getItemDamage()); + if (mte != null) { + jsonObject.addProperty("metatileentity", + GregTechAPI.MTE_REGISTRY.getNameForObject(mte).getPath()); + } else { + TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.warning", + "terminal.guide_editor.error_type").setClientSide().open(); + } + } return jsonObject; } } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuidePageEditorWidget.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuidePageEditorWidget.java index 1c78005ebd0..9f15e37b052 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuidePageEditorWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuidePageEditorWidget.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.guideeditor.widget; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; @@ -15,10 +13,15 @@ import gregtech.api.util.interpolate.Interpolator; import gregtech.common.terminal.app.guide.widget.GuidePageWidget; import gregtech.common.terminal.app.guide.widget.IGuideWidget; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; + public class GuidePageEditorWidget extends GuidePageWidget { + private Widget selected; private final WidgetGroup toolButtons; private final CustomPositionSizeWidget customPositionSizeWidget; @@ -29,7 +32,8 @@ public GuidePageEditorWidget(int xPosition, int yPosition, int width, int height super(xPosition, yPosition, width, height, margin); this.setDraggable(false); setTitle("Template"); - customPositionSizeWidget = new CustomPositionSizeWidget(0xff0000ff, 0xffff0000, 2).setOnUpdated(this::onPosSizeChanged); + customPositionSizeWidget = new CustomPositionSizeWidget(0xff0000ff, 0xffff0000, 2) + .setOnUpdated(this::onPosSizeChanged); toolButtons = new WidgetGroup(Position.ORIGIN, Size.ZERO); toolButtons.setVisible(false); toolButtons.addWidget(new CircleButtonWidget(-20, -4, 8, 1, 12) @@ -99,7 +103,8 @@ private void setToolButton(Widget widget) { customPositionSizeWidget.setVisible(true); customPositionSizeWidget.setActive(!(widget instanceof IGuideWidget) || ((IGuideWidget) widget).isFixed()); toolButtons.setVisible(true); - toolButtons.setSelfPosition(new Position(widget.getSelfPosition().x + widget.getSize().width / 2, widget.getSelfPosition().y)); + toolButtons.setSelfPosition( + new Position(widget.getSelfPosition().x + widget.getSize().width / 2, widget.getSelfPosition().y)); } private void delete(ClickData clickData) { @@ -170,7 +175,8 @@ public JsonObject addGuideWidget(IGuideWidget widget, boolean isFixed) { } stream.add(index + 1, guideWidget); } else { - guideWidget = widget.updateOrCreateStreamWidget(margin, getStreamBottom() + 5, pageWidth - 2 * margin, widgetConfig); + guideWidget = widget.updateOrCreateStreamWidget(margin, getStreamBottom() + 5, pageWidth - 2 * margin, + widgetConfig); stream.add(guideWidget); } this.addWidget(guideWidget); @@ -179,7 +185,6 @@ public JsonObject addGuideWidget(IGuideWidget widget, boolean isFixed) { return widgetConfig; } - public void moveUp(Widget widget) { int index = stream.indexOf(widget); if (index > 0) { @@ -190,13 +195,17 @@ public void moveUp(Widget widget) { int y1 = widget.getSelfPosition().y; int y2 = target.getSelfPosition().y; interpolator = new Interpolator(0, 1, 10, Eases.LINEAR, value -> { - widget.setSelfPosition(new Position(widget.getSelfPosition().x, (int) (y1 - value.floatValue() * offsetU))); - target.setSelfPosition(new Position(target.getSelfPosition().x, (int) (y2 + value.floatValue() * offsetD))); + widget.setSelfPosition( + new Position(widget.getSelfPosition().x, (int) (y1 - value.floatValue() * offsetU))); + target.setSelfPosition( + new Position(target.getSelfPosition().x, (int) (y2 + value.floatValue() * offsetD))); if (widget == selected) { setToolButton(selected); } - widget.setVisible(widget.getSelfPosition().y < scrollYOffset + getSize().height && widget.getSelfPosition().y + widget.getSize().height > 0); - target.setVisible(target.getSelfPosition().y < scrollYOffset + getSize().height && target.getSelfPosition().y + target.getSize().height > 0); + widget.setVisible(widget.getSelfPosition().y < scrollYOffset + getSize().height && + widget.getSelfPosition().y + widget.getSize().height > 0); + target.setVisible(target.getSelfPosition().y < scrollYOffset + getSize().height && + target.getSelfPosition().y + target.getSize().height > 0); }, value -> { interpolator = null; stream.remove(widget); @@ -223,13 +232,17 @@ public void moveDown(Widget widget) { int y1 = widget.getSelfPosition().y; int y2 = target.getSelfPosition().y; interpolator = new Interpolator(0, 1, 10, Eases.LINEAR, value -> { - widget.setSelfPosition(new Position(widget.getSelfPosition().x, (int) (y1 + value.floatValue() * offsetD))); - target.setSelfPosition(new Position(target.getSelfPosition().x, (int) (y2 - value.floatValue() * offsetU))); + widget.setSelfPosition( + new Position(widget.getSelfPosition().x, (int) (y1 + value.floatValue() * offsetD))); + target.setSelfPosition( + new Position(target.getSelfPosition().x, (int) (y2 - value.floatValue() * offsetU))); if (widget == selected) { setToolButton(selected); } - widget.setVisible(widget.getSelfPosition().y < getSize().height - xBarHeight && widget.getSelfPosition().y + widget.getSize().height > 0); - target.setVisible(target.getSelfPosition().y < getSize().height - xBarHeight && target.getSelfPosition().y + target.getSize().height > 0); + widget.setVisible(widget.getSelfPosition().y < getSize().height - xBarHeight && + widget.getSelfPosition().y + widget.getSize().height > 0); + target.setVisible(target.getSelfPosition().y < getSize().height - xBarHeight && + target.getSelfPosition().y + target.getSize().height > 0); }, value -> { interpolator = null; stream.remove(widget); diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/BooleanConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/BooleanConfigurator.java index ad021c5cc07..8814b973136 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/BooleanConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/BooleanConfigurator.java @@ -1,28 +1,30 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.JsonObject; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.terminal.gui.widgets.RectButtonWidget; import gregtech.api.terminal.os.TerminalTheme; +import com.google.gson.JsonObject; + import java.awt.*; -public class BooleanConfigurator extends ConfiguratorWidget{ +public class BooleanConfigurator extends ConfiguratorWidget { public BooleanConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name) { super(group, config, name); } - public BooleanConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, boolean defaultValue) { + public BooleanConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, + boolean defaultValue) { super(group, config, name, defaultValue); } - protected void init(){ + protected void init() { this.addWidget(new RectButtonWidget(0, 15, 10, 10, 2) - .setToggleButton(new ColorRectTexture(new Color(198, 198, 198).getRGB()), (c, p)->updateValue(p)) - .setValueSupplier(true, ()->{ - if(config.get(name).isJsonNull()) { + .setToggleButton(new ColorRectTexture(new Color(198, 198, 198).getRGB()), (c, p) -> updateValue(p)) + .setValueSupplier(true, () -> { + if (config.get(name).isJsonNull()) { return defaultValue; } return config.get(name).getAsBoolean(); diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ColorConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ColorConfigurator.java index fa36c712544..5ed6aec5fe6 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ColorConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ColorConfigurator.java @@ -1,10 +1,11 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.JsonObject; import gregtech.api.terminal.gui.widgets.ColorWidget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; -public class ColorConfigurator extends ConfiguratorWidget{ +import com.google.gson.JsonObject; + +public class ColorConfigurator extends ConfiguratorWidget { public ColorConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, int defaultValue) { super(group, config, name, defaultValue); @@ -14,14 +15,12 @@ public ColorConfigurator(DraggableScrollableWidgetGroup group, JsonObject config super(group, config, name); } - protected void init(){ - this.addWidget(new ColorWidget(0, 15, 85, 10).setColorSupplier(()->{ - if(config.get(name).isJsonNull()) { + protected void init() { + this.addWidget(new ColorWidget(0, 15, 85, 10).setColorSupplier(() -> { + if (config.get(name).isJsonNull()) { return defaultValue; } return config.get(name).getAsInt(); - },true).setOnColorChanged(this::updateValue)); + }, true).setOnColorChanged(this::updateValue)); } - - } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ConfiguratorWidget.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ConfiguratorWidget.java index 706efc8f659..6d05bbac593 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ConfiguratorWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ConfiguratorWidget.java @@ -1,20 +1,23 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.widgets.LabelWidget; import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.util.Position; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + import java.util.Collections; import java.util.function.Consumer; public class ConfiguratorWidget extends WidgetGroup { + protected T defaultValue; protected String name; protected boolean canDefault; @@ -36,7 +39,7 @@ public ConfiguratorWidget(DraggableScrollableWidgetGroup group, JsonObject confi this.canDefault = defaultValue != null; this.config = config; if (config.get(name) == null) { - config.addProperty(name, (String)null); + config.addProperty(name, (String) null); } if (canDefault && config.get(name).isJsonNull()) { isDefault = true; @@ -48,9 +51,7 @@ public ConfiguratorWidget(DraggableScrollableWidgetGroup group, JsonObject confi init(); } - protected void init() { - - } + protected void init() {} protected void updateValue(T value) { if (canDefault && isDefault) return; @@ -63,7 +64,7 @@ public ConfiguratorWidget setOnUpdated(Consumer onUpdated) { return this; } - protected void update(){ + protected void update() { if (onUpdated != null) { onUpdated.accept(name); } @@ -74,7 +75,8 @@ public void drawInForeground(int mouseX, int mouseY) { int x = getPosition().x; int y = getPosition().y; if (canDefault && isMouseOver(x + nameWidth + 4, y + 6, 5, 5, mouseX, mouseY)) { - drawHoveringText(ItemStack.EMPTY, Collections.singletonList(I18n.format("terminal.guide_editor.default")), 100, mouseX, mouseY); + drawHoveringText(ItemStack.EMPTY, Collections.singletonList(I18n.format("terminal.guide_editor.default")), + 100, mouseX, mouseY); } if (!isDefault) { super.drawInForeground(mouseX, mouseY); @@ -95,10 +97,9 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender if (canDefault && isDefault) { super.drawInBackground(-100, -100, partialTicks, context); drawSolidRect(x, y + 15, this.getSize().width, this.getSize().height - 15, 0x99000000); - } else { + } else { super.drawInBackground(mouseX, mouseY, partialTicks, context); } - } @Override @@ -121,6 +122,5 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { return false; } - protected void onDefault() { - } + protected void onDefault() {} } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/FluidStackConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/FluidStackConfigurator.java index 3ef59fb6823..21ab8671f03 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/FluidStackConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/FluidStackConfigurator.java @@ -1,8 +1,5 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.resources.TextTexture; import gregtech.api.gui.widgets.ImageWidget; @@ -14,10 +11,15 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.common.terminal.app.guide.widget.TankListWidget; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.List; -public class FluidStackConfigurator extends ConfiguratorWidget>{ +public class FluidStackConfigurator extends ConfiguratorWidget> { + DraggableScrollableWidgetGroup container; List tanks; @@ -26,11 +28,11 @@ public FluidStackConfigurator(DraggableScrollableWidgetGroup group, JsonObject c } protected void init() { - container = new DraggableScrollableWidgetGroup(0, 27,116, 100); + container = new DraggableScrollableWidgetGroup(0, 27, 116, 100); this.addWidget(container); this.addWidget(new RectButtonWidget(0, 15, 116, 10, 1) .setIcon(new TextTexture("terminal.guide_editor.add_slot", -1)) - .setClickListener(cd->{ + .setClickListener(cd -> { addSlot(container, new TankListWidget.FluidStackInfo(null, 0)); updateValue(); }) @@ -52,16 +54,17 @@ private void addSlot(DraggableScrollableWidgetGroup container, TankListWidget.Fl group.addWidget(new PhantomFluidWidget(1, 1, 18, 18, null, null) .setBackgroundTexture(TerminalTheme.COLOR_B_2) .setFluidStackSupplier(fluidStackInfo::getInstance, true) - .setFluidStackUpdater(fluidStack->{ + .setFluidStackUpdater(fluidStack -> { fluidStackInfo.update(fluidStack); updateValue(); - }, true)); + }, true)); group.addWidget(new RectButtonWidget(20, 0, 20, 20) .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()) .setClickListener(data -> { - fluidStackInfo.amount = Math.max(0, fluidStackInfo.amount - (data.isShiftClick ? data.isCtrlClick ? 1000 : 10 : data.isCtrlClick? 100: 1)); + fluidStackInfo.amount = Math.max(0, fluidStackInfo.amount - + (data.isShiftClick ? data.isCtrlClick ? 1000 : 10 : data.isCtrlClick ? 100 : 1)); updateValue(); }) .setHoverText("Shift -10|Ctrl -100|Shift+Ctrl -1000") @@ -71,13 +74,15 @@ private void addSlot(DraggableScrollableWidgetGroup container, TankListWidget.Fl TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()) .setClickListener(data -> { - fluidStackInfo.amount = Math.max(0, fluidStackInfo.amount + (data.isShiftClick ? data.isCtrlClick ? 1000 : 10 : data.isCtrlClick? 100: 1)); + fluidStackInfo.amount = Math.max(0, fluidStackInfo.amount + + (data.isShiftClick ? data.isCtrlClick ? 1000 : 10 : data.isCtrlClick ? 100 : 1)); updateValue(); }) .setHoverText("Shift +10|Ctrl +100|Shift+Ctrl +1000") .setIcon(new TextTexture("+1", -1))); group.addWidget(new ImageWidget(40, 0, 36, 20, TerminalTheme.COLOR_B_2)); - group.addWidget(new SimpleTextWidget(58, 10, "", 0xFFFFFF, () -> Integer.toString(fluidStackInfo.amount), true)); + group.addWidget( + new SimpleTextWidget(58, 10, "", 0xFFFFFF, () -> Integer.toString(fluidStackInfo.amount), true)); group.addWidget(new RectButtonWidget(96, 0, 20, 20) .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ItemStackConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ItemStackConfigurator.java index 5091280f5ac..5171fd0cab7 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ItemStackConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ItemStackConfigurator.java @@ -1,8 +1,5 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.resources.TextTexture; import gregtech.api.gui.widgets.ImageWidget; @@ -14,12 +11,18 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.common.inventory.handlers.SingleItemStackHandler; import gregtech.common.terminal.app.guide.widget.SlotListWidget; + import net.minecraftforge.items.IItemHandlerModifiable; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.List; -public class ItemStackConfigurator extends ConfiguratorWidget>{ +public class ItemStackConfigurator extends ConfiguratorWidget> { + DraggableScrollableWidgetGroup container; List slots; @@ -28,11 +31,11 @@ public ItemStackConfigurator(DraggableScrollableWidgetGroup group, JsonObject co } protected void init() { - container = new DraggableScrollableWidgetGroup(0, 27,116, 100); + container = new DraggableScrollableWidgetGroup(0, 27, 116, 100); this.addWidget(container); this.addWidget(new RectButtonWidget(0, 15, 116, 10, 1) .setIcon(new TextTexture("terminal.guide_editor.add_slot", -1)) - .setClickListener(cd->{ + .setClickListener(cd -> { addSlot(container, new SlotListWidget.ItemStackInfo("minecraft:air", 0, 0)); updateValue(); }) @@ -49,14 +52,15 @@ protected void init() { } private void addSlot(DraggableScrollableWidgetGroup container, SlotListWidget.ItemStackInfo itemStackInfo) { - WidgetGroup group = new WidgetGroup(0,slots.size() * 20, 116, 20); + WidgetGroup group = new WidgetGroup(0, slots.size() * 20, 116, 20); slots.add(itemStackInfo); IItemHandlerModifiable handler = new SingleItemStackHandler(1); handler.setStackInSlot(0, itemStackInfo.getInstance()); - group.addWidget(new PhantomSlotWidget(handler, 0, 1, 1).setBackgroundTexture(TerminalTheme.COLOR_B_2).setChangeListener(()->{ - itemStackInfo.update(handler.getStackInSlot(0)); - updateValue(); - })); + group.addWidget(new PhantomSlotWidget(handler, 0, 1, 1).setBackgroundTexture(TerminalTheme.COLOR_B_2) + .setChangeListener(() -> { + itemStackInfo.update(handler.getStackInSlot(0)); + updateValue(); + })); group.addWidget(new RectButtonWidget(20, 0, 20, 20) .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/NumberConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/NumberConfigurator.java index e3140aced5e..7435a9fdfce 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/NumberConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/NumberConfigurator.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.gui.resources.TextTexture; import gregtech.api.gui.widgets.ImageWidget; import gregtech.api.gui.widgets.SimpleTextWidget; @@ -9,7 +7,10 @@ import gregtech.api.terminal.gui.widgets.RectButtonWidget; import gregtech.api.terminal.os.TerminalTheme; -public class NumberConfigurator extends ConfiguratorWidget{ +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +public class NumberConfigurator extends ConfiguratorWidget { public NumberConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name) { super(group, config, name); @@ -19,7 +20,7 @@ public NumberConfigurator(DraggableScrollableWidgetGroup group, JsonObject confi super(group, config, name, defaultValue); } - protected void init(){ + protected void init() { int y = 15; this.addWidget(new RectButtonWidget(0, y, 20, 20) .setColors(TerminalTheme.COLOR_B_1.getColor(), diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/SelectorConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/SelectorConfigurator.java index ec5e57a6f16..e529beb7f32 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/SelectorConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/SelectorConfigurator.java @@ -1,26 +1,30 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.JsonObject; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.terminal.gui.widgets.SelectorWidget; import gregtech.api.terminal.os.TerminalTheme; +import com.google.gson.JsonObject; + import java.util.List; -public class SelectorConfigurator extends ConfiguratorWidget{ - public SelectorConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, List candidates, String defaultValue) { +public class SelectorConfigurator extends ConfiguratorWidget { + + public SelectorConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, + List candidates, String defaultValue) { super(group, config, name, defaultValue); init(candidates); } - public SelectorConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, List candidates) { + public SelectorConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, + List candidates) { super(group, config, name); init(candidates); } - protected void init(List candidates){ - this.addWidget(new SelectorWidget(0, 15, 80, 20, candidates, -1, ()->{ - if(config.get(name).isJsonNull()) { + protected void init(List candidates) { + this.addWidget(new SelectorWidget(0, 15, 80, 20, candidates, -1, () -> { + if (config.get(name).isJsonNull()) { return defaultValue; } return config.get(name).getAsString(); @@ -31,5 +35,4 @@ protected void init(List candidates){ .setIsUp(true) .setOnChanged(this::updateValue)); } - } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/StringConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/StringConfigurator.java index ca45ce8dbd6..a838e3952aa 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/StringConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/StringConfigurator.java @@ -1,20 +1,23 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.JsonObject; import gregtech.api.gui.resources.TextTexture; import gregtech.api.gui.widgets.TextFieldWidget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.terminal.gui.widgets.RectButtonWidget; import gregtech.api.terminal.os.TerminalTheme; -public class StringConfigurator extends ConfiguratorWidget{ +import com.google.gson.JsonObject; + +public class StringConfigurator extends ConfiguratorWidget { + private TextFieldWidget textFieldWidget; public StringConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name) { super(group, config, name); } - public StringConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, String defaultValue) { + public StringConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, + String defaultValue) { super(group, config, name, defaultValue); } @@ -27,7 +30,7 @@ protected void init() { .setIcon(new TextTexture("terminal.guide_editor.update", -1))); textFieldWidget = new TextFieldWidget(0, 15, 76, 20, TerminalTheme.COLOR_B_2, null, null) .setMaxStringLength(Integer.MAX_VALUE) - .setValidator(s->true); + .setValidator(s -> true); if (config.has(name) && config.get(name).isJsonPrimitive()) { textFieldWidget.setCurrentString(config.get(name).getAsString()); } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/TextListConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/TextListConfigurator.java index 1d41381a464..f40ed1f8255 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/TextListConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/TextListConfigurator.java @@ -1,14 +1,16 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.*; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.terminal.gui.widgets.TextEditorWidget; +import com.google.gson.*; + import java.util.Collections; import java.util.List; -public class TextListConfigurator extends ConfiguratorWidget>{ +public class TextListConfigurator extends ConfiguratorWidget> { + private TextEditorWidget editor; public TextListConfigurator(DraggableScrollableWidgetGroup group, int height, JsonObject config, String name) { @@ -16,7 +18,8 @@ public TextListConfigurator(DraggableScrollableWidgetGroup group, int height, Js init(height); } - public TextListConfigurator(DraggableScrollableWidgetGroup group, int height, JsonObject config, String name, String defaultValue) { + public TextListConfigurator(DraggableScrollableWidgetGroup group, int height, JsonObject config, String name, + String defaultValue) { super(group, config, name, Collections.singletonList(defaultValue)); init(height); } @@ -29,7 +32,8 @@ protected void init(int height) { initValue = String.join("\n", init); } - editor = new TextEditorWidget(0, 15, 116, height, this::updateTextList, true).setContent(initValue).setBackground(new ColorRectTexture(0xA3FFFFFF)); + editor = new TextEditorWidget(0, 15, 116, height, this::updateTextList, true).setContent(initValue) + .setBackground(new ColorRectTexture(0xA3FFFFFF)); this.addWidget(editor); } diff --git a/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareManagerApp.java b/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareManagerApp.java index 07cbf4e6d97..21554ada83b 100644 --- a/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareManagerApp.java +++ b/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareManagerApp.java @@ -3,13 +3,14 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.resources.*; import gregtech.api.gui.widgets.WidgetGroup; -import gregtech.client.shader.Shaders; import gregtech.api.terminal.TerminalRegistry; import gregtech.api.terminal.app.AbstractApplication; import gregtech.api.terminal.gui.widgets.RectButtonWidget; import gregtech.api.terminal.hardware.Hardware; import gregtech.api.terminal.os.TerminalTheme; +import gregtech.client.shader.Shaders; import gregtech.common.items.MetaItems; + import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -17,7 +18,9 @@ import java.util.concurrent.atomic.AtomicInteger; public class HardwareManagerApp extends AbstractApplication { - private static final TextureArea CIRCUIT_LINE = TextureArea.fullImage("textures/gui/terminal/hardware_manager/circuit.png"); + + private static final TextureArea CIRCUIT_LINE = TextureArea + .fullImage("textures/gui/terminal/hardware_manager/circuit.png"); @SideOnly(Side.CLIENT) private ShaderTexture circuit; private HardwareSlotWidget selected; @@ -46,13 +49,17 @@ public AbstractApplication initApp() { apps.clearAllWidgets(); AtomicInteger index = new AtomicInteger(0); for (AbstractApplication installed : getOs().installedApps) { - TerminalRegistry.getAppHardwareDemand(installed.getRegistryName(), getOs().tabletNBT.getCompoundTag(installed.getRegistryName()).getInteger("_tier")).stream() + TerminalRegistry + .getAppHardwareDemand(installed.getRegistryName(), + getOs().tabletNBT.getCompoundTag(installed.getRegistryName()).getInteger("_tier")) + .stream() .filter(hardware::isHardwareAdequate).findFirst() .ifPresent(X -> { - apps.addWidget(new RectButtonWidget(162 + (index.get() % 4) * 25, 122 + (index.get() / 4) * 30, 20, 20, 2) - .setIcon(installed.getIcon()) - .setHoverText(installed.getUnlocalizedName()) - .setColors(0, TerminalTheme.COLOR_7.getColor(), 0)); + apps.addWidget(new RectButtonWidget(162 + (index.get() % 4) * 25, + 122 + (index.get() / 4) * 30, 20, 20, 2) + .setIcon(installed.getIcon()) + .setHoverText(installed.getUnlocalizedName()) + .setColors(0, TerminalTheme.COLOR_7.getColor(), 0)); index.getAndIncrement(); }); } diff --git a/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareSlotWidget.java b/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareSlotWidget.java index 216495054f5..25c0e795dd3 100644 --- a/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareSlotWidget.java +++ b/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareSlotWidget.java @@ -5,6 +5,7 @@ import gregtech.api.terminal.hardware.Hardware; import gregtech.api.terminal.os.TerminalDialogWidget; import gregtech.api.terminal.os.TerminalOSWidget; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -14,6 +15,7 @@ import java.util.Collections; public class HardwareSlotWidget extends WidgetGroup { + private final Hardware hardware; private final TerminalOSWidget os; private Runnable onSelected; @@ -39,7 +41,8 @@ private void showDialog(int button) { NBTTagCompound tag = hardware.acceptItemStack(itemStack); if (tag != null) { tag.setTag("item", itemStack.serializeNBT()); - os.hardwareProvider.getOrCreateHardwareCompound().setTag(hardware.getRegistryName(), tag); + os.hardwareProvider.getOrCreateHardwareCompound().setTag(hardware.getRegistryName(), + tag); os.hardwareProvider.cleanCache(hardware.getRegistryName()); } }).open(); @@ -54,22 +57,26 @@ private void showDialog(int button) { } } if (emptySlot) { - TerminalDialogWidget.showConfirmDialog(os, "terminal.hardware.remove", "terminal.component.confirm", result -> { - if (result) { - NBTTagCompound tag = os.hardwareProvider.getOrCreateHardwareCompound().getCompoundTag(hardware.getRegistryName()); - if (!tag.isEmpty() && tag.hasKey("item")) { - gui.entityPlayer.inventory.addItemStackToInventory(hardware.onHardwareRemoved(new ItemStack(tag.getCompoundTag("item")))); - } - os.hardwareProvider.getOrCreateHardwareCompound().removeTag(hardware.getRegistryName()); - os.hardwareProvider.cleanCache(hardware.getRegistryName()); - } - }).open(); + TerminalDialogWidget + .showConfirmDialog(os, "terminal.hardware.remove", "terminal.component.confirm", result -> { + if (result) { + NBTTagCompound tag = os.hardwareProvider.getOrCreateHardwareCompound() + .getCompoundTag(hardware.getRegistryName()); + if (!tag.isEmpty() && tag.hasKey("item")) { + gui.entityPlayer.inventory.addItemStackToInventory( + hardware.onHardwareRemoved(new ItemStack(tag.getCompoundTag("item")))); + } + os.hardwareProvider.getOrCreateHardwareCompound() + .removeTag(hardware.getRegistryName()); + os.hardwareProvider.cleanCache(hardware.getRegistryName()); + } + }).open(); } else { - TerminalDialogWidget.showInfoDialog(os, "terminal.component.warning", "terminal.hardware.remove.full").open(); + TerminalDialogWidget + .showInfoDialog(os, "terminal.component.warning", "terminal.hardware.remove.full").open(); } } } - } @Override @@ -93,13 +100,19 @@ public void handleClientAction(int id, PacketBuffer buffer) { public void drawInForeground(int mouseX, int mouseY) { if (hardware != null && isMouseOverElement(mouseX, mouseY)) { if (!hardware.hasHW()) { - drawHoveringText(ItemStack.EMPTY, Collections.singletonList(hardware.getLocalizedName()), 300, mouseX, mouseY); + drawHoveringText(ItemStack.EMPTY, Collections.singletonList(hardware.getLocalizedName()), 300, mouseX, + mouseY); } else { String info = hardware.addInformation(); if (info == null) { - drawHoveringText(ItemStack.EMPTY, Arrays.asList(hardware.getLocalizedName(), I18n.format("terminal.hardware.tip.remove")), 300, mouseX, mouseY); + drawHoveringText(ItemStack.EMPTY, + Arrays.asList(hardware.getLocalizedName(), I18n.format("terminal.hardware.tip.remove")), + 300, mouseX, mouseY); } else { - drawHoveringText(ItemStack.EMPTY, Arrays.asList(String.format("%s (%s)", hardware.getLocalizedName(), info), I18n.format("terminal.hardware.tip.remove")), 300, mouseX, mouseY); + drawHoveringText(ItemStack.EMPTY, + Arrays.asList(String.format("%s (%s)", hardware.getLocalizedName(), info), + I18n.format("terminal.hardware.tip.remove")), + 300, mouseX, mouseY); } } } diff --git a/src/main/java/gregtech/common/terminal/app/multiblockhelper/MachineBuilderWidget.java b/src/main/java/gregtech/common/terminal/app/multiblockhelper/MachineBuilderWidget.java index 406dfca18ab..899e1dc9d37 100644 --- a/src/main/java/gregtech/common/terminal/app/multiblockhelper/MachineBuilderWidget.java +++ b/src/main/java/gregtech/common/terminal/app/multiblockhelper/MachineBuilderWidget.java @@ -18,6 +18,7 @@ import gregtech.api.util.BlockInfo; import gregtech.client.utils.RenderBufferHelper; import gregtech.common.inventory.handlers.CycleItemStackHandler; + import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.state.IBlockState; @@ -37,6 +38,7 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; import java.util.ArrayList; @@ -52,6 +54,7 @@ * @Description: */ public class MachineBuilderWidget extends WidgetGroup { + private BlockPos pos; private EnumFacing facing; private SlotWidget[] slotWidgets; @@ -67,22 +70,26 @@ public class MachineBuilderWidget extends WidgetGroup { @SideOnly(Side.CLIENT) private List handlers; - public MachineBuilderWidget(int x, int y, int width, int height, MultiblockControllerBase controllerBase, TerminalOSWidget os) { + public MachineBuilderWidget(int x, int y, int width, int height, MultiblockControllerBase controllerBase, + TerminalOSWidget os) { super(x, y, width, height); this.os = os; this.controllerBase = controllerBase; addWidget(new ImageWidget(0, 0, width, height, GuiTextures.BACKGROUND)); addWidget(new RectButtonWidget(12, 125, width - 24, 20, 1) .setClickListener(this::autoBuildButton) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.multiblock_ar.builder.auto", -1))); addWidget(new RectButtonWidget(12, 125 + 25, width - 24, 20, 1) .setClickListener(this::placeButton) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.multiblock_ar.builder.place", -1))); addWidget(new RectButtonWidget(12, 125 + 50, width - 24, 20, 1) .setClickListener(this::debugButton) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.multiblock_ar.builder.debug", -1))); if (os.isRemote()) { candidates = new DraggableScrollableWidgetGroup(-20, 0, 20, 180); @@ -94,7 +101,7 @@ public MachineBuilderWidget(int x, int y, int width, int height, MultiblockContr public void handleClientAction(int id, PacketBuffer buffer) { if (id == -2) { // select this.selected = buffer.readVarInt(); - } else if (id == -3) { // update pos facing + } else if (id == -3) { // update pos facing this.pos = buffer.readBlockPos(); this.facing = EnumFacing.VALUES[buffer.readByte()]; } else { @@ -103,7 +110,8 @@ public void handleClientAction(int id, PacketBuffer buffer) { } /** - * I had to add slotWidget after parent widget be added, because of gtce's {@link gregtech.api.gui.INativeWidget} interface. + * I had to add slotWidget after parent widget be added, because of gtce's {@link gregtech.api.gui.INativeWidget} + * interface. * Hopefully one day I can remove this worse interface. */ public void addPlayerInventory() { @@ -113,24 +121,26 @@ public void addPlayerInventory() { for (int col = 0; col < 6; col++) { int index = col + row * 6; boolean isActive = inventoryPlayer.getStackInSlot(index).getItem() instanceof ItemBlock; - slotWidgets[index] = new SlotWidget(inventoryPlayer, index, 12 + col * 18, 12 + row * 18, false, false) { + slotWidgets[index] = new SlotWidget(inventoryPlayer, index, 12 + col * 18, 12 + row * 18, false, + false) { + @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { if (isMouseOverElement(mouseX, mouseY) && isActive()) { if (selected != index) { selected = index; - MachineBuilderWidget.this.writeClientAction(-2, buf->buf.writeVarInt(index)); + MachineBuilderWidget.this.writeClientAction(-2, buf -> buf.writeVarInt(index)); } } return super.mouseClicked(mouseX, mouseY, button); } - @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { super.drawInBackground(mouseX, mouseY, partialTicks, context); if (selected == index) { - drawSolidRect(getPosition().x, getPosition().y, getSize().width, getSize().height, 0x4f00ff00); + drawSolidRect(getPosition().x, getPosition().y, getSize().width, getSize().height, + 0x4f00ff00); } } }.setBackgroundTexture(GuiTextures.SLOT); @@ -166,12 +176,11 @@ public void setSceneWidget(MachineSceneWidget sceneWidget) { } } - @SideOnly(Side.CLIENT) private void setFocus(BlockPos pos, EnumFacing facing) { this.pos = new BlockPos(pos); this.facing = facing; - writeClientAction(-3, buf->{ + writeClientAction(-3, buf -> { buf.writeBlockPos(pos); buf.writeByte(facing.getIndex()); }); @@ -190,11 +199,12 @@ private void placeButton(ClickData clickData) { float hitZ = pos.getZ() + 0.5f; Block block = itemBlock.getBlock(); IBlockState state = block.getStateFromMeta(itemBlock.getMetadata(itemStack.getMetadata())); - if(block instanceof BlockBush) { + if (block instanceof BlockBush) { // Prevent placing lilypads, grass, etc where they should not be - if(!((BlockBush) block).canBlockStay(world, offset, state)) { - if(clickData.isClient) { - TerminalDialogWidget.showInfoDialog(os, "terminal.component.error", "This Block cannot be placed here").setClientSide().open(); + if (!((BlockBush) block).canBlockStay(world, offset, state)) { + if (clickData.isClient) { + TerminalDialogWidget.showInfoDialog(os, "terminal.component.error", + "This Block cannot be placed here").setClientSide().open(); } return; } @@ -222,7 +232,7 @@ private void highLightRender(boolean isTESR, int pass, BlockRenderLayer layer) { for (BlockPos pos : highLightBlocks) { RenderBufferHelper.renderCubeFrame(buffer, - pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1,pos.getY() + 1, pos.getZ() + 1, + pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1, 1, 0, 0, 1); } @@ -237,7 +247,8 @@ private void debugButton(ClickData clickData) { if (clickData.isClient && controllerBase != null) { highLightBlocks.clear(); if (controllerBase.structurePattern.checkPatternFastAt( - controllerBase.getWorld(), controllerBase.getPos(), controllerBase.getFrontFacing().getOpposite(), controllerBase.getUpwardsFacing(), controllerBase.allowsFlip()) == null) { + controllerBase.getWorld(), controllerBase.getPos(), controllerBase.getFrontFacing().getOpposite(), + controllerBase.getUpwardsFacing(), controllerBase.allowsFlip()) == null) { PatternError error = controllerBase.structurePattern.getError(); highLightBlocks.add(new BlockPos(error.getPos())); List> candidatesItemStack = error.getCandidates(); @@ -245,12 +256,15 @@ private void debugButton(ClickData clickData) { int y = 1; handlers = new ArrayList<>(); for (List candidate : candidatesItemStack) { - CycleItemStackHandler handler = new CycleItemStackHandler(NonNullList.from(ItemStack.EMPTY, candidate.toArray(new ItemStack[0]))); + CycleItemStackHandler handler = new CycleItemStackHandler( + NonNullList.from(ItemStack.EMPTY, candidate.toArray(new ItemStack[0]))); handlers.add(handler); - candidates.addWidget(new SlotWidget(handler, 0, 1, y, false, false).setBackgroundTexture(TerminalTheme.COLOR_B_2)); + candidates.addWidget(new SlotWidget(handler, 0, 1, y, false, false) + .setBackgroundTexture(TerminalTheme.COLOR_B_2)); y += 20; } - TerminalDialogWidget.showInfoDialog(os, "terminal.component.error", error.getErrorInfo()).setClientSide().open(); + TerminalDialogWidget.showInfoDialog(os, "terminal.component.error", error.getErrorInfo()) + .setClientSide().open(); } } } @@ -262,5 +276,4 @@ private void autoBuildButton(ClickData clickData) { } } } - } diff --git a/src/main/java/gregtech/common/terminal/app/multiblockhelper/MultiBlockPreviewARApp.java b/src/main/java/gregtech/common/terminal/app/multiblockhelper/MultiBlockPreviewARApp.java index 8c1b63da68b..6e9d04b4705 100644 --- a/src/main/java/gregtech/common/terminal/app/multiblockhelper/MultiBlockPreviewARApp.java +++ b/src/main/java/gregtech/common/terminal/app/multiblockhelper/MultiBlockPreviewARApp.java @@ -21,6 +21,7 @@ import gregtech.client.shader.Shaders; import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GlStateManager; @@ -33,12 +34,14 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL13; import java.util.*; public class MultiBlockPreviewARApp extends ARApplication { + @SideOnly(Side.CLIENT) int lastMouseX; @SideOnly(Side.CLIENT) @@ -58,18 +61,21 @@ public AbstractApplication initApp() { // 232 333 addWidget(new ImageWidget(10, 10, 313, 212, new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()))); addWidget(new ImageWidget(333 / 2, 20, 1, 222 - 40, new ColorRectTexture(-1))); - addWidget(new LabelWidget(10 + 313 / 4, 35, "terminal.multiblock_ar.tier.0", -1).setXCentered(true).setYCentered(true)); + addWidget(new LabelWidget(10 + 313 / 4, 35, "terminal.multiblock_ar.tier.0", -1).setXCentered(true) + .setYCentered(true)); addWidget(new RectButtonWidget(10 + (313 / 2 - bW) / 2, 50, bW, bH) .setIcon(TextureArea.fullImage("textures/gui/terminal/multiblock_ar/profile.png")) .setColors(-1, 0xff00ff00, 0) .setHoverText("terminal.ar.open") .setClickListener(clickData -> openAR())); - addWidget(new LabelWidget(333 / 2 + 313 / 4, 35, "terminal.multiblock_ar.tier.1", getAppTier() == 0 ? 0xffff0000 : -1).setXCentered(true).setYCentered(true)); + addWidget(new LabelWidget(333 / 2 + 313 / 4, 35, "terminal.multiblock_ar.tier.1", + getAppTier() == 0 ? 0xffff0000 : -1).setXCentered(true).setYCentered(true)); addWidget(new RectButtonWidget(333 / 2 + (313 / 2 - bW) / 2, 50, bW, bH) .setIcon(this::drawBuilderButton) .setColors(getAppTier() == 0 ? 0xffff0000 : -1, getAppTier() == 0 ? 0xffff0000 : 0xff00ff00, 0) - .setHoverText(getAppTier() > 0 ? "terminal.multiblock_ar.builder.hover" : "terminal.multiblock_ar.unlock") + .setHoverText( + getAppTier() > 0 ? "terminal.multiblock_ar.builder.hover" : "terminal.multiblock_ar.unlock") .setClickListener(clickData -> buildMode())); return this; } @@ -93,11 +99,12 @@ private void drawBuilderButton(double x, double y, int width, int height) { uniformCache.glUniform1I("faceTexture", 0); uniformCache.glUniform1I("baseTexture", 1); uniformCache.glUniform1F("u_time", time); - uniformCache.glUniform3F("f_color", (color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, (color & 255) / 255.0F); + uniformCache.glUniform3F("f_color", (color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, + (color & 255) / 255.0F); uniformCache.glUniformBoolean("block", controllerBase != null); - if (isMouseOver((int)x, (int)y, width, height, lastMouseX, lastMouseY)) { + if (isMouseOver((int) x, (int) y, width, height, lastMouseX, lastMouseY)) { uniformCache.glUniform2F("u_mouse", - (float) (((lastMouseX - x) / 2 + width / 3) * ConfigHolder.client.resolution), + (float) (((lastMouseX - x) / 2 + width / 3) * ConfigHolder.client.resolution), (float) (height / 2 * ConfigHolder.client.resolution)); } }); @@ -121,7 +128,8 @@ public int getMaxTier() { private MultiblockControllerBase getController() { if (os.clickPos != null) { TileEntity te = gui.entityPlayer.world.getTileEntity(os.clickPos); - if (te instanceof IGregTechTileEntity && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MultiblockControllerBase) { + if (te instanceof IGregTechTileEntity && + ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MultiblockControllerBase) { return (MultiblockControllerBase) ((IGregTechTileEntity) te).getMetaTileEntity(); } } @@ -130,7 +138,8 @@ private MultiblockControllerBase getController() { private void buildMode() { if (getAppTier() == 0) { - TerminalDialogWidget.showInfoDialog(getOs(), "terminal.dialog.notice", "terminal.multiblock_ar.unlock").open(); + TerminalDialogWidget.showInfoDialog(getOs(), "terminal.dialog.notice", "terminal.multiblock_ar.unlock") + .open(); } else if (getController() != null) { widgets.forEach(this::waitToRemoved); MultiblockControllerBase controllerBase = getController(); @@ -138,7 +147,7 @@ private void buildMode() { this.addWidget(builderWidget); builderWidget.addPlayerInventory(); if (isClient) { - MachineSceneWidget sceneWidget = new MachineSceneWidget(0, 16, 200, 200, controllerBase); + MachineSceneWidget sceneWidget = new MachineSceneWidget(0, 16, 200, 200, controllerBase); builderWidget.setSceneWidget(sceneWidget); this.addWidget(0, sceneWidget); this.addWidget(new ImageWidget(0, 0, 333, 16, GuiTextures.UI_FRAME_SIDE_UP)); @@ -157,11 +166,9 @@ protected void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, lastMouseY = mouseY; this.partialTicks = partialTicks; super.hookDrawInBackground(mouseX, mouseY, partialTicks, context); - } - - //////////////////////////////////////AR///////////////////////////////////////// + ////////////////////////////////////// AR///////////////////////////////////////// @SideOnly(Side.CLIENT) private static Map controllerList; @@ -194,7 +201,8 @@ public void tickAR(EntityPlayer player) { Iterator iterator = controllerList.keySet().iterator(); if (iterator.hasNext()) { MultiblockControllerBase controller = iterator.next(); - if (!controller.isValid() || controller.isStructureFormed() || !inRange(player.getPosition(), controller.getPos())) { + if (!controller.isValid() || controller.isStructureFormed() || + !inRange(player.getPosition(), controller.getPos())) { iterator.remove(); reRender = true; } @@ -213,7 +221,8 @@ public void tickAR(EntityPlayer player) { if (reRender) { opList = GLAllocation.generateDisplayLists(1); // allocate op list GlStateManager.glNewList(opList, GL11.GL_COMPILE); - controllerList.forEach((controller, shapes) -> MultiblockPreviewRenderer.renderControllerInList(controller, shapes, 0)); + controllerList.forEach((controller, shapes) -> MultiblockPreviewRenderer + .renderControllerInList(controller, shapes, 0)); GlStateManager.glEndList(); } } @@ -261,5 +270,4 @@ public void drawARScreen(RenderWorldLastEvent event) { GlStateManager.color(1F, 1F, 1F, 0F); } } - } diff --git a/src/main/java/gregtech/common/terminal/app/prospector/ProspectingTexture.java b/src/main/java/gregtech/common/terminal/app/prospector/ProspectingTexture.java index c13ca5dfa70..86fe9c217cc 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/ProspectingTexture.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/ProspectingTexture.java @@ -4,6 +4,7 @@ import gregtech.api.unification.stack.MaterialStack; import gregtech.client.utils.RenderUtil; import gregtech.core.network.packets.PacketProspecting; + import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.AbstractTexture; @@ -13,12 +14,12 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; import java.awt.*; import java.awt.image.BufferedImage; import java.awt.image.WritableRaster; import java.util.HashMap; +import javax.annotation.Nullable; public class ProspectingTexture extends AbstractTexture { @@ -40,10 +41,10 @@ public ProspectingTexture(ProspectorMode mode, int radius, boolean darkMode) { this.radius = radius; this.mode = mode; if (this.mode == ProspectorMode.FLUID) { - //noinspection unchecked + // noinspection unchecked map = new HashMap[(radius * 2 - 1)][(radius * 2 - 1)]; } else { - //noinspection unchecked + // noinspection unchecked map = new HashMap[(radius * 2 - 1) * 16][(radius * 2 - 1) * 16]; } } @@ -101,15 +102,17 @@ private BufferedImage getImage() { for (int i = 0; i < wh; i++) { for (int j = 0; j < wh; j++) { - HashMap data = this.map[this.mode == ProspectorMode.ORE ? i : i / 16][this.mode == ProspectorMode.ORE ? j : j / 16]; + HashMap data = this.map[this.mode == ProspectorMode.ORE ? i : i / 16][this.mode == + ProspectorMode.ORE ? j : j / 16]; // draw bg image.setRGB(i, j, ((data == null) ^ darkMode) ? Color.darkGray.getRGB() : Color.WHITE.getRGB()); - //draw ore + // draw ore if (this.mode == ProspectorMode.ORE && data != null) { for (String orePrefix : data.values()) { if (!selected.equals(SELECTED_ALL) && !selected.equals(orePrefix)) continue; MaterialStack mterialStack = OreDictUnifier.getMaterial(OreDictUnifier.get(orePrefix)); - image.setRGB(i, j, mterialStack == null ? orePrefix.hashCode() : mterialStack.material.getMaterialRGB() | 0XFF000000); + image.setRGB(i, j, mterialStack == null ? orePrefix.hashCode() : + mterialStack.material.getMaterialRGB() | 0XFF000000); break; } } @@ -158,24 +161,24 @@ public void draw(int x, int y) { if (this.map[cx][cz] != null && !this.map[cx][cz].isEmpty()) { Fluid fluid = FluidRegistry.getFluid(this.map[cx][cz].get((byte) 1)); if (selected.equals(SELECTED_ALL) || selected.equals(fluid.getName())) { - RenderUtil.drawFluidForGui(new FluidStack(fluid, 1), 1, x + cx * 16 + 1, y + cz * 16 + 1, 16, 16); + RenderUtil.drawFluidForGui(new FluidStack(fluid, 1), 1, x + cx * 16 + 1, y + cz * 16 + 1, + 16, 16); } } } } } - //draw red vertical line + // draw red vertical line if (playerXGui % 16 > 7 || playerXGui % 16 == 0) { Gui.drawRect(x + playerXGui - 1, y, x + playerXGui, y + imageHeight, Color.RED.getRGB()); } else { Gui.drawRect(x + playerXGui, y, x + playerXGui + 1, y + imageHeight, Color.RED.getRGB()); } - //draw red horizontal line + // draw red horizontal line if (playerYGui % 16 > 7 || playerYGui % 16 == 0) { Gui.drawRect(x, y + playerYGui - 1, x + imageWidth, y + playerYGui, Color.RED.getRGB()); } else { Gui.drawRect(x, y + playerYGui, x + imageWidth, y + playerYGui + 1, Color.RED.getRGB()); } } - } diff --git a/src/main/java/gregtech/common/terminal/app/prospector/ProspectorApp.java b/src/main/java/gregtech/common/terminal/app/prospector/ProspectorApp.java index 8ee1f2cb73b..72acb2a302f 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/ProspectorApp.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/ProspectorApp.java @@ -1,8 +1,5 @@ package gregtech.common.terminal.app.prospector; -import com.google.common.collect.Maps; -import com.google.common.collect.Table; -import com.google.common.collect.Tables; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.gui.widgets.ImageWidget; @@ -17,12 +14,16 @@ import gregtech.common.terminal.component.ClickComponent; import gregtech.common.terminal.component.SearchComponent; import gregtech.core.network.packets.PacketProspecting; + import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import com.google.common.collect.Maps; +import com.google.common.collect.Table; +import com.google.common.collect.Tables; + import java.io.File; import java.io.IOException; import java.util.Arrays; @@ -30,7 +31,10 @@ import java.util.Map; import java.util.function.Consumer; +import javax.annotation.Nonnull; + public class ProspectorApp extends AbstractApplication implements SearchComponent.IWidgetSearch { + private WidgetOreList widgetOreList; private WidgetProspectingMap widgetProspectingMap; private ColorRectTexture background; @@ -60,10 +64,12 @@ public AbstractApplication initApp() { if (isClient) { this.addWidget(new ImageWidget(0, 0, 333, offset, GuiTextures.UI_FRAME_SIDE_UP)); this.addWidget(new ImageWidget(0, 232 - offset, 333, offset, GuiTextures.UI_FRAME_SIDE_DOWN)); - this.widgetOreList = new WidgetOreList(32 * chunkRadius - 16, offset, 333 - 32 * chunkRadius + 16, 232 - 2 * offset); + this.widgetOreList = new WidgetOreList(32 * chunkRadius - 16, offset, 333 - 32 * chunkRadius + 16, + 232 - 2 * offset); this.addWidget(this.widgetOreList); } - this.widgetProspectingMap = new WidgetProspectingMap(0, offset + (7 - chunkRadius) * 16, chunkRadius, this.widgetOreList, mode, 1); + this.widgetProspectingMap = new WidgetProspectingMap(0, offset + (7 - chunkRadius) * 16, chunkRadius, + this.widgetOreList, mode, 1); if (isClient) { persist = Tables.newCustomTable(Maps.newHashMap(), Maps::newHashMap); widgetProspectingMap.setOnPacketReceived(packet -> persist.put(packet.chunkX, packet.chunkZ, packet)); @@ -76,11 +82,15 @@ public AbstractApplication initApp() { }); if (isClient) { loadPacketLocalConfig(); - //Cardinal directions - this.addWidget(new LabelWidget(-2 + (16 * (chunkRadius * 2 - 1)) / 2, offset, "N", this::labelColor).setShadow(true)); - this.addWidget(new LabelWidget(-2 + (16 * (chunkRadius * 2 - 1)) / 2, offset - 6 + 16 * (chunkRadius * 2 - 1), "S", this::labelColor).setShadow(true)); - this.addWidget(new LabelWidget(0, offset - 3 + (16 * (chunkRadius * 2 - 1)) / 2, "W", this::labelColor).setShadow(true)); - this.addWidget(new LabelWidget(-6 + 16 * (chunkRadius * 2 - 1), offset - 3 + (16 * (chunkRadius * 2 - 1)) / 2, "E", this::labelColor).setShadow(true)); + // Cardinal directions + this.addWidget(new LabelWidget(-2 + (16 * (chunkRadius * 2 - 1)) / 2, offset, "N", this::labelColor) + .setShadow(true)); + this.addWidget(new LabelWidget(-2 + (16 * (chunkRadius * 2 - 1)) / 2, + offset - 6 + 16 * (chunkRadius * 2 - 1), "S", this::labelColor).setShadow(true)); + this.addWidget(new LabelWidget(0, offset - 3 + (16 * (chunkRadius * 2 - 1)) / 2, "W", this::labelColor) + .setShadow(true)); + this.addWidget(new LabelWidget(-6 + 16 * (chunkRadius * 2 - 1), + offset - 3 + (16 * (chunkRadius * 2 - 1)) / 2, "E", this::labelColor).setShadow(true)); } return this; } @@ -100,7 +110,7 @@ protected void loadPacketLocalConfig() { } else { posX += 1; } - //draw red horizontal line + // draw red horizontal line if (posZ % 16 > 7 || posZ % 16 == 0) { posZ -= 1; } else { @@ -114,7 +124,8 @@ protected void loadPacketLocalConfig() { for (int j = playerChunkZ - chunkRadius; j <= playerChunkZ + chunkRadius; j++) { NBTTagCompound nbt = null; try { - nbt = CompressedStreamTools.read(new File(TerminalRegistry.TERMINAL_PATH, String.format("%s/%d/%d_%d.nbt", getRegistryName(), mode.ordinal(), i, j))); + nbt = CompressedStreamTools.read(new File(TerminalRegistry.TERMINAL_PATH, + String.format("%s/%d/%d_%d.nbt", getRegistryName(), mode.ordinal(), i, j))); } catch (IOException e) { GTLog.logger.error("error while loading local nbt for {}", getRegistryName(), e); } @@ -135,7 +146,8 @@ protected void loadPacketLocalConfig() { @SideOnly(Side.CLIENT) protected void savePacketLocalConfig() { new Thread(() -> { // thread for better QoL - File folder = new File(TerminalRegistry.TERMINAL_PATH, String.format("%s/%d", getRegistryName(), mode.ordinal())); + File folder = new File(TerminalRegistry.TERMINAL_PATH, + String.format("%s/%d", getRegistryName(), mode.ordinal())); if (!folder.exists()) { if (!folder.mkdirs()) return; } @@ -144,7 +156,8 @@ protected void savePacketLocalConfig() { NBTTagCompound nbt = cell.getValue().writePacketData(); try { if (!nbt.isEmpty()) { - CompressedStreamTools.safeWrite(nbt, new File(folder, String.format("%d_%d.nbt", cell.getRowKey(), cell.getColumnKey()))); + CompressedStreamTools.safeWrite(nbt, new File(folder, + String.format("%d_%d.nbt", cell.getRowKey(), cell.getColumnKey()))); } } catch (IOException e) { GTLog.logger.error("error while saving local nbt for {}", getRegistryName(), e); @@ -170,12 +183,13 @@ public int getMaxTier() { @Override public List getMenuComponents() { - ClickComponent darkMode = new ClickComponent().setIcon(GuiTextures.ICON_VISIBLE).setHoverText("terminal.prospector.vis_mode").setClickConsumer(cd -> { - if (cd.isClient) { - widgetProspectingMap.setDarkMode(!widgetProspectingMap.getDarkMode()); - background.setColor(this.widgetProspectingMap.getDarkMode() ? 0xA0000000 : 0xA0ffffff); - } - }); + ClickComponent darkMode = new ClickComponent().setIcon(GuiTextures.ICON_VISIBLE) + .setHoverText("terminal.prospector.vis_mode").setClickConsumer(cd -> { + if (cd.isClient) { + widgetProspectingMap.setDarkMode(!widgetProspectingMap.getDarkMode()); + background.setColor(this.widgetProspectingMap.getDarkMode() ? 0xA0000000 : 0xA0ffffff); + } + }); return Arrays.asList(darkMode, new SearchComponent<>(this)); } diff --git a/src/main/java/gregtech/common/terminal/app/prospector/ProspectorMode.java b/src/main/java/gregtech/common/terminal/app/prospector/ProspectorMode.java index 3b5fb04da0c..cf5cbcae306 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/ProspectorMode.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/ProspectorMode.java @@ -3,6 +3,7 @@ import javax.annotation.Nonnull; public enum ProspectorMode { + ORE("ore_prospector", "metaitem.prospector.mode.ores"), FLUID("fluid_prospector", "metaitem.prospector.mode.fluid"); diff --git a/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetOreList.java b/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetOreList.java index c43fc5db363..40435e51b5e 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetOreList.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetOreList.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.prospector.widget; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; @@ -12,6 +10,7 @@ import gregtech.api.unification.stack.MaterialStack; import gregtech.api.util.Position; import gregtech.common.terminal.app.prospector.ProspectorMode; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; @@ -21,10 +20,14 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.items.ItemStackHandler; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; + import java.util.*; import java.util.function.Consumer; public class WidgetOreList extends DraggableScrollableWidgetGroup { + protected WidgetGroup selected; protected final BiMap widgetMap; protected Consumer onSelected = null; @@ -75,7 +78,8 @@ private void addOre(String orePrefix) { itemStackHandler.insertItem(0, itemStack, false); WidgetGroup widgetGroup = new WidgetGroup(0, 0, getSize().width - 5, 18); widgetGroup.addWidget(new SlotWidget(itemStackHandler, 0, 0, 0, false, false)); - widgetGroup.addWidget(new LabelWidget(20, 5, itemStack.getDisplayName(), materialStack==null? orePrefix.hashCode():materialStack.material.getMaterialRGB() | 0XFF000000)); + widgetGroup.addWidget(new LabelWidget(20, 5, itemStack.getDisplayName(), + materialStack == null ? orePrefix.hashCode() : materialStack.material.getMaterialRGB() | 0XFF000000)); addOrePrefix(orePrefix, widgetGroup); } @@ -107,7 +111,8 @@ private void addOil(String orePrefix) { .setClient() .setHideTooltip(true) .setContainerClicking(false, false)); - widgetGroup.addWidget(new LabelWidget(20, 5, fluidStack.getLocalizedName(), getFluidColor(fluidStack.getFluid()))); + widgetGroup + .addWidget(new LabelWidget(20, 5, fluidStack.getLocalizedName(), getFluidColor(fluidStack.getFluid()))); addOrePrefix(orePrefix, widgetGroup); } @@ -131,7 +136,8 @@ protected boolean hookDrawInBackground(int mouseX, int mouseY, float partialTick if (widget.isVisible()) { widget.drawInBackground(mouseX, mouseY, partialTicks, context); - GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), 1.0F); + GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), + 1.0F); } } return true; @@ -142,8 +148,8 @@ protected boolean checkClickedDragged(int mouseX, int mouseY, int button) { draggedWidget = null; for (int i = widgets.size() - 1; i >= 0; i--) { Widget widget = widgets.get(i); - if(widget.isVisible() && widget instanceof WidgetGroup) { - if(widget.isMouseOverElement(mouseX, mouseY)) { + if (widget.isVisible() && widget instanceof WidgetGroup) { + if (widget.isMouseOverElement(mouseX, mouseY)) { if (isMouseOverElement(mouseX, mouseY) && this.selected != widget) { this.setSelected(widgetMap.get(widget)); } @@ -162,10 +168,10 @@ public void updateScreen() { widgets.forEach(widget -> { if (widget instanceof WidgetGroup) { Widget widget1 = ((WidgetGroup) widget).getContainedWidgets(true).get(0); - if (widget1 instanceof SlotWidget){ + if (widget1 instanceof SlotWidget) { SlotWidget slotWidget = (SlotWidget) widget1; List list = OreDictUnifier.getAllWithOreDictionaryName(widgetMap.get(widget)); - if (list.size() > 0 ) { + if (list.size() > 0) { slotWidget.getHandle().decrStackSize(64); slotWidget.getHandle().putStack(list.get(Math.floorMod(tickCounter / 20, list.size()))); } @@ -185,7 +191,5 @@ public static int getFluidColor(Fluid fluid) { } @Override - protected void writeClientAction(int id, Consumer packetBufferWriter) { - - } + protected void writeClientAction(int id, Consumer packetBufferWriter) {} } diff --git a/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java b/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java index 5fa4256668b..60a18f58247 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java @@ -16,6 +16,7 @@ import gregtech.common.terminal.app.prospector.ProspectorMode; import gregtech.core.network.packets.PacketProspecting; import gregtech.integration.xaero.ColorUtility; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; @@ -37,15 +38,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.awt.*; import java.io.IOException; +import java.util.*; import java.util.List; import java.util.Queue; -import java.util.*; import java.util.concurrent.LinkedBlockingQueue; import java.util.function.Consumer; +import javax.annotation.Nonnull; + public class WidgetProspectingMap extends Widget { private final int chunkRadius; @@ -66,7 +68,8 @@ public class WidgetProspectingMap extends Widget { private final List hoveredNames = new ArrayList<>(); private int color; - public WidgetProspectingMap(int xPosition, int yPosition, int chunkRadius, WidgetOreList widgetOreList, @Nonnull ProspectorMode mode, int scanTick) { + public WidgetProspectingMap(int xPosition, int yPosition, int chunkRadius, WidgetOreList widgetOreList, + @Nonnull ProspectorMode mode, int scanTick) { super(new Position(xPosition, yPosition), new Size(16 * (chunkRadius * 2 - 1), 16 * (chunkRadius * 2 - 1))); this.chunkRadius = chunkRadius; this.mode = mode; @@ -105,7 +108,8 @@ public boolean getDarkMode() { public void detectAndSendChanges() { EntityPlayer player = gui.entityPlayer; World world = player.world; - if (FMLCommonHandler.instance().getMinecraftServerInstance().getTickCounter() % scanTick == 0 && chunkIndex < (chunkRadius * 2 - 1) * (chunkRadius * 2 - 1)) { + if (FMLCommonHandler.instance().getMinecraftServerInstance().getTickCounter() % scanTick == 0 && + chunkIndex < (chunkRadius * 2 - 1) * (chunkRadius * 2 - 1)) { int playerChunkX = player.chunkCoordX; int playerChunkZ = player.chunkCoordZ; @@ -117,7 +121,8 @@ public void detectAndSendChanges() { int oz = row - chunkRadius + 1; Chunk chunk = world.getChunk(playerChunkX + ox, playerChunkZ + oz); - PacketProspecting packet = new PacketProspecting(playerChunkX + ox, playerChunkZ + oz, playerChunkX, playerChunkZ, (int) player.posX, (int) player.posZ, this.mode); + PacketProspecting packet = new PacketProspecting(playerChunkX + ox, playerChunkZ + oz, playerChunkX, + playerChunkZ, (int) player.posX, (int) player.posZ, this.mode); switch (mode) { case ORE: @@ -144,7 +149,8 @@ public void detectAndSendChanges() { } else if (type.processingPrefix == prefix) { MaterialStack materialStack = OreDictUnifier.getMaterial(itemBlock); if (materialStack != null) { - String oreDict = "ore" + oreDictString.replaceFirst(prefix.name(), ""); + String oreDict = "ore" + + oreDictString.replaceFirst(prefix.name(), ""); packet.addBlock(x, y, z, oreDict); added = true; break; @@ -163,11 +169,15 @@ public void detectAndSendChanges() { } break; case FLUID: - BedrockFluidVeinHandler.FluidVeinWorldEntry fStack = BedrockFluidVeinHandler.getFluidVeinWorldEntry(world, chunk.x, chunk.z); + BedrockFluidVeinHandler.FluidVeinWorldEntry fStack = BedrockFluidVeinHandler + .getFluidVeinWorldEntry(world, chunk.x, chunk.z); if (fStack != null && fStack.getDefinition() != null) { - packet.addBlock(0, 3, 0, TextFormattingUtil.formatNumbers(100.0 * BedrockFluidVeinHandler.getOperationsRemaining(world, chunk.x, chunk.z) - / BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS)); - packet.addBlock(0, 2, 0, String.valueOf(BedrockFluidVeinHandler.getFluidYield(world, chunk.x, chunk.z))); + packet.addBlock(0, 3, 0, + TextFormattingUtil.formatNumbers(100.0 * + BedrockFluidVeinHandler.getOperationsRemaining(world, chunk.x, chunk.z) / + BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS)); + packet.addBlock(0, 2, 0, + String.valueOf(BedrockFluidVeinHandler.getFluidYield(world, chunk.x, chunk.z))); Fluid fluid = BedrockFluidVeinHandler.getFluidInChunk(world, chunk.x, chunk.z); if (fluid != null) { packet.addBlock(0, 1, 0, fluid.getName()); @@ -246,8 +256,8 @@ public void drawInForeground(int mouseX, int mouseY) { (cZ + 1) * 16 + this.getPosition().y, new Color(0x4B6C6C6C, true).getRGB()); - //pick the color of the highest element for the waypoint color - final int[] maxAmount = {0}; + // pick the color of the highest element for the waypoint color + final int[] maxAmount = { 0 }; if (this.mode == ProspectorMode.ORE) { // draw ore tooltips.add(I18n.format("terminal.prospector.ore")); @@ -257,7 +267,8 @@ public void drawInForeground(int mouseX, int mouseY) { if (texture.map[cX * 16 + i][cZ * 16 + j] != null) { texture.map[cX * 16 + i][cZ * 16 + j].values().forEach(dict -> { String name = OreDictUnifier.get(dict).getDisplayName(); - if (ProspectingTexture.SELECTED_ALL.equals(texture.getSelected()) || texture.getSelected().equals(dict)) { + if (ProspectingTexture.SELECTED_ALL.equals(texture.getSelected()) || + texture.getSelected().equals(dict)) { oreInfo.put(name, oreInfo.getOrDefault(name, 0) + 1); if (oreInfo.get(name) > maxAmount[0]) { maxAmount[0] = oreInfo.get(name); @@ -278,7 +289,8 @@ public void drawInForeground(int mouseX, int mouseY) { } else if (this.mode == ProspectorMode.FLUID) { tooltips.add(I18n.format("terminal.prospector.fluid")); if (texture.map[cX][cZ] != null && !texture.map[cX][cZ].isEmpty()) { - if (ProspectingTexture.SELECTED_ALL.equals(texture.getSelected()) || texture.getSelected().equals(texture.map[cX][cZ].get((byte) 1))) { + if (ProspectingTexture.SELECTED_ALL.equals(texture.getSelected()) || + texture.getSelected().equals(texture.map[cX][cZ].get((byte) 1))) { FluidStack fluidStack = FluidRegistry.getFluidStack(texture.map[cX][cZ].get((byte) 1), 1); if (fluidStack != null) { tooltips.add(I18n.format("terminal.prospector.fluid.info", @@ -332,7 +344,8 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { added = addXaeroMapWaypoint(b); } if (added) { - Minecraft.getMinecraft().player.sendStatusMessage(new TextComponentTranslation("behavior.prospector.added_waypoint"), true); + Minecraft.getMinecraft().player + .sendStatusMessage(new TextComponentTranslation("behavior.prospector.added_waypoint"), true); } } this.lastClicked = System.currentTimeMillis(); @@ -389,8 +402,10 @@ private boolean addVoxelMapWaypoint(@Nonnull BlockPos b) { TreeSet world = new TreeSet<>(); world.add(Minecraft.getMinecraft().world.provider.getDimension()); - com.mamiyaotaru.voxelmap.interfaces.IWaypointManager waypointManager = com.mamiyaotaru.voxelmap.interfaces.AbstractVoxelMap.getInstance().getWaypointManager(); - com.mamiyaotaru.voxelmap.util.Waypoint voxelMapWaypoint = new com.mamiyaotaru.voxelmap.util.Waypoint(createVeinName(), + com.mamiyaotaru.voxelmap.interfaces.IWaypointManager waypointManager = com.mamiyaotaru.voxelmap.interfaces.AbstractVoxelMap + .getInstance().getWaypointManager(); + com.mamiyaotaru.voxelmap.util.Waypoint voxelMapWaypoint = new com.mamiyaotaru.voxelmap.util.Waypoint( + createVeinName(), b.getX(), b.getZ(), Minecraft.getMinecraft().world.getHeight(b.getX(), b.getZ()), diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/FluidStackHelper.java b/src/main/java/gregtech/common/terminal/app/recipechart/FluidStackHelper.java index 6fac10c4fd4..e55f040f585 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/FluidStackHelper.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/FluidStackHelper.java @@ -3,6 +3,7 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.TankWidget; import gregtech.api.terminal.os.TerminalTheme; + import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; @@ -44,7 +45,8 @@ public String getDisplayName(FluidStack fluidStack) { @Override public Widget createWidget(FluidStack fluidStack) { FluidTank tank = new FluidTank(fluidStack, Integer.MAX_VALUE); - return new TankWidget(tank, 0, 0, 18, 18).setAlwaysShowFull(true).setBackgroundTexture(TerminalTheme.COLOR_B_2).setClient(); + return new TankWidget(tank, 0, 0, 18, 18).setAlwaysShowFull(true).setBackgroundTexture(TerminalTheme.COLOR_B_2) + .setClient(); } @Override diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/IngredientHelper.java b/src/main/java/gregtech/common/terminal/app/recipechart/IngredientHelper.java index dfdec218ef3..74d5fcbf5a1 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/IngredientHelper.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/IngredientHelper.java @@ -1,6 +1,7 @@ package gregtech.common.terminal.app.recipechart; import gregtech.api.gui.Widget; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/ItemStackHelper.java b/src/main/java/gregtech/common/terminal/app/recipechart/ItemStackHelper.java index 43a2cc03a0f..268f6799226 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/ItemStackHelper.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/ItemStackHelper.java @@ -3,6 +3,7 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.terminal.os.TerminalTheme; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.items.ItemHandlerHelper; diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/RecipeChartApp.java b/src/main/java/gregtech/common/terminal/app/recipechart/RecipeChartApp.java index 3ece66a8a42..e4abbcd2497 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/RecipeChartApp.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/RecipeChartApp.java @@ -18,7 +18,7 @@ import gregtech.common.terminal.app.recipechart.widget.RGContainer; import gregtech.common.terminal.app.recipechart.widget.RGNode; import gregtech.common.terminal.component.ClickComponent; -import mezz.jei.api.gui.IRecipeLayout; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTBase; @@ -26,12 +26,15 @@ import net.minecraft.nbt.NBTTagList; import net.minecraftforge.common.util.Constants; +import mezz.jei.api.gui.IRecipeLayout; + import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.List; public class RecipeChartApp extends AbstractApplication implements IRecipeTransferHandlerWidget { + private TabGroup tabGroup; public RecipeChartApp() { @@ -46,7 +49,8 @@ public int getThemeColor() { @Override public AbstractApplication initApp() { if (isClient) { - this.tabGroup = new TabGroup<>(0, 10, new CustomTabListRenderer(TerminalTheme.COLOR_F_2, TerminalTheme.COLOR_B_3, 333 / getMaxPages(), 10)); + this.tabGroup = new TabGroup<>(0, 10, new CustomTabListRenderer(TerminalTheme.COLOR_F_2, + TerminalTheme.COLOR_B_3, 333 / getMaxPages(), 10)); this.tabGroup.setOnTabChanged(this::onPagesChanged); this.addWidget(this.tabGroup); loadLocalConfig(nbt -> { @@ -80,7 +84,8 @@ private RGContainer addTab(String name) { RGContainer container = new RGContainer(0, 0, 333, 222, getOs()); container.setBackground(TerminalTheme.COLOR_B_3); tabGroup.addTab(new IGuiTextureTabInfo(new TextTexture(name, -1).setWidth(333 / getMaxPages() - 5) - .setType(tabGroup.getAllTag().isEmpty() ? TextTexture.TextType.ROLL : TextTexture.TextType.HIDE), name), container); + .setType(tabGroup.getAllTag().isEmpty() ? TextTexture.TextType.ROLL : TextTexture.TextType.HIDE), name), + container); return container; } @@ -90,74 +95,96 @@ public int getMaxPages() { @Override public List getMenuComponents() { - ClickComponent newPage = new ClickComponent().setIcon(GuiTextures.ICON_NEW_PAGE).setHoverText("terminal.component.new_page").setClickConsumer(cd -> { - if (tabGroup == null) return; - if (tabGroup.getAllTag().size() < getMaxPages()) { - TerminalDialogWidget.showTextFieldDialog(getOs(), "terminal.component.page_name", s -> true, s -> { - if (s != null) { - addTab(s); + ClickComponent newPage = new ClickComponent().setIcon(GuiTextures.ICON_NEW_PAGE) + .setHoverText("terminal.component.new_page").setClickConsumer(cd -> { + if (tabGroup == null) return; + if (tabGroup.getAllTag().size() < getMaxPages()) { + TerminalDialogWidget + .showTextFieldDialog(getOs(), "terminal.component.page_name", s -> true, s -> { + if (s != null) { + addTab(s); + } + }).setClientSide().open(); + } else { + TerminalDialogWidget + .showInfoDialog(getOs(), "terminal.component.warning", "terminal.recipe_chart.limit") + .setClientSide().open(); } - }).setClientSide().open(); - } else { - TerminalDialogWidget.showInfoDialog(getOs(), "terminal.component.warning", "terminal.recipe_chart.limit").setClientSide().open(); - } - }); - ClickComponent deletePage = new ClickComponent().setIcon(GuiTextures.ICON_REMOVE).setHoverText("terminal.recipe_chart.delete").setClickConsumer(cd -> { - if (tabGroup == null) return; - if (tabGroup.getAllTag().size() > 1) { - TerminalDialogWidget.showConfirmDialog(getOs(), "terminal.recipe_chart.delete", "terminal.component.confirm", r -> { - if (r) { - tabGroup.removeTab(tabGroup.getAllTag().indexOf(tabGroup.getCurrentTag())); + }); + ClickComponent deletePage = new ClickComponent().setIcon(GuiTextures.ICON_REMOVE) + .setHoverText("terminal.recipe_chart.delete").setClickConsumer(cd -> { + if (tabGroup == null) return; + if (tabGroup.getAllTag().size() > 1) { + TerminalDialogWidget.showConfirmDialog(getOs(), "terminal.recipe_chart.delete", + "terminal.component.confirm", r -> { + if (r) { + tabGroup.removeTab(tabGroup.getAllTag().indexOf(tabGroup.getCurrentTag())); + } + }).setClientSide().open(); + } else { + TerminalDialogWidget + .showInfoDialog(getOs(), "terminal.component.warning", "terminal.recipe_chart.limit") + .setClientSide().open(); } - }).setClientSide().open(); - } else { - TerminalDialogWidget.showInfoDialog(getOs(), "terminal.component.warning", "terminal.recipe_chart.limit").setClientSide().open(); - } - }); - ClickComponent addSlot = new ClickComponent().setIcon(GuiTextures.ICON_ADD).setHoverText("terminal.recipe_chart.add_slot").setClickConsumer(cd -> { - if (tabGroup == null) return; - if (tabGroup.getCurrentTag() != null) { - tabGroup.getCurrentTag().addNode(50, 100); - } - }); - ClickComponent importPage = new ClickComponent().setIcon(GuiTextures.ICON_LOAD).setHoverText("terminal.component.load_file").setClickConsumer(cd -> { - if (tabGroup == null) return; - if (tabGroup.getAllTag().size() < getMaxPages()) { - File file = new File(TerminalRegistry.TERMINAL_PATH, "recipe_chart"); - TerminalDialogWidget.showFileDialog(getOs(), "terminal.component.load_file", file, true, result -> { - if (result != null && result.isFile()) { - try { - NBTTagCompound nbt = CompressedStreamTools.read(result); - addTab(result.getName()).loadFromNBT(nbt); - } catch (IOException e) { - TerminalDialogWidget.showInfoDialog(getOs(), "terminal.component.error", "terminal.component.load_file.error").setClientSide().open(); - } + }); + ClickComponent addSlot = new ClickComponent().setIcon(GuiTextures.ICON_ADD) + .setHoverText("terminal.recipe_chart.add_slot").setClickConsumer(cd -> { + if (tabGroup == null) return; + if (tabGroup.getCurrentTag() != null) { + tabGroup.getCurrentTag().addNode(50, 100); } - }).setClientSide().open(); - } else { - TerminalDialogWidget.showInfoDialog(getOs(), "terminal.component.warning", "terminal.recipe_chart.limit").setClientSide().open(); - } - }); - ClickComponent exportPage = new ClickComponent().setIcon(GuiTextures.ICON_SAVE).setHoverText("terminal.component.save_file").setClickConsumer(cd -> { - if (tabGroup == null) return; - if (tabGroup.getCurrentTag() != null) { - File file = new File(TerminalRegistry.TERMINAL_PATH, "recipe_chart"); - TerminalDialogWidget.showFileDialog(getOs(), "terminal.component.save_file", file, false, result -> { - if (result != null) { - try { - CompressedStreamTools.safeWrite(tabGroup.getCurrentTag().saveAsNBT(), result); - } catch (IOException e) { - TerminalDialogWidget.showInfoDialog(getOs(), "terminal.component.error", "terminal.component.save_file.error").setClientSide().open(); - } + }); + ClickComponent importPage = new ClickComponent().setIcon(GuiTextures.ICON_LOAD) + .setHoverText("terminal.component.load_file").setClickConsumer(cd -> { + if (tabGroup == null) return; + if (tabGroup.getAllTag().size() < getMaxPages()) { + File file = new File(TerminalRegistry.TERMINAL_PATH, "recipe_chart"); + TerminalDialogWidget + .showFileDialog(getOs(), "terminal.component.load_file", file, true, result -> { + if (result != null && result.isFile()) { + try { + NBTTagCompound nbt = CompressedStreamTools.read(result); + addTab(result.getName()).loadFromNBT(nbt); + } catch (IOException e) { + TerminalDialogWidget + .showInfoDialog(getOs(), "terminal.component.error", + "terminal.component.load_file.error") + .setClientSide().open(); + } + } + }).setClientSide().open(); + } else { + TerminalDialogWidget + .showInfoDialog(getOs(), "terminal.component.warning", "terminal.recipe_chart.limit") + .setClientSide().open(); } - }).setClientSide().open(); - } - }); + }); + ClickComponent exportPage = new ClickComponent().setIcon(GuiTextures.ICON_SAVE) + .setHoverText("terminal.component.save_file").setClickConsumer(cd -> { + if (tabGroup == null) return; + if (tabGroup.getCurrentTag() != null) { + File file = new File(TerminalRegistry.TERMINAL_PATH, "recipe_chart"); + TerminalDialogWidget + .showFileDialog(getOs(), "terminal.component.save_file", file, false, result -> { + if (result != null) { + try { + CompressedStreamTools.safeWrite(tabGroup.getCurrentTag().saveAsNBT(), + result); + } catch (IOException e) { + TerminalDialogWidget + .showInfoDialog(getOs(), "terminal.component.error", + "terminal.component.save_file.error") + .setClientSide().open(); + } + } + }).setClientSide().open(); + } + }); return Arrays.asList(newPage, deletePage, addSlot, importPage, exportPage); } @Override - public NBTTagCompound closeApp() { //synced data to server side. + public NBTTagCompound closeApp() { // synced data to server side. saveLocalConfig(nbt -> { NBTTagList list = new NBTTagList(); for (int i = 0; i < tabGroup.getAllTag().size(); i++) { @@ -179,9 +206,11 @@ public boolean isClientSideApp() { } @Override - public String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { + public String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, + boolean maxTransfer, boolean doTransfer) { for (Widget widget : getContainedWidgets(false)) { - if (widget instanceof RGNode && ((RGNode) widget).transferRecipe(container, recipeLayout, player, maxTransfer, doTransfer)) { + if (widget instanceof RGNode && + ((RGNode) widget).transferRecipe(container, recipeLayout, player, maxTransfer, doTransfer)) { return null; } } diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/widget/PhantomWidget.java b/src/main/java/gregtech/common/terminal/app/recipechart/widget/PhantomWidget.java index 1e8b574a842..280722e7dbc 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/widget/PhantomWidget.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/widget/PhantomWidget.java @@ -7,19 +7,22 @@ import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.terminal.os.TerminalTheme; import gregtech.common.inventory.handlers.SingleItemStackHandler; -import mezz.jei.api.gui.IGhostIngredientHandler; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; +import mezz.jei.api.gui.IGhostIngredientHandler; + import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.Consumer; public class PhantomWidget extends WidgetGroup implements IGhostIngredientTarget { + private final IItemHandlerModifiable itemHandler; private FluidStack fluidStack; private PhantomFluidWidget fluidWidget; @@ -31,25 +34,26 @@ public PhantomWidget(int x, int y, Object defaultObj) { itemHandler = new SingleItemStackHandler(1); fluidStack = null; fluidWidget = new PhantomFluidWidget(0, 0, 18, 18, null, null) - .setFluidStackUpdater(fluid -> { - fluidStack = fluid.copy(); - if (fluidStack != null && fluidStack.amount > 0) { - itemHandler.setStackInSlot(0, ItemStack.EMPTY); - slotWidget.setVisible(false); - fluidWidget.setVisible(true); - if (onChanged != null) { - onChanged.accept(fluidStack); - } - } - }, true).setBackgroundTexture(TerminalTheme.COLOR_B_2).showTip(true) - .setFluidStackSupplier(() -> fluidStack,true); + .setFluidStackUpdater(fluid -> { + fluidStack = fluid.copy(); + if (fluidStack != null && fluidStack.amount > 0) { + itemHandler.setStackInSlot(0, ItemStack.EMPTY); + slotWidget.setVisible(false); + fluidWidget.setVisible(true); + if (onChanged != null) { + onChanged.accept(fluidStack); + } + } + }, true).setBackgroundTexture(TerminalTheme.COLOR_B_2).showTip(true) + .setFluidStackSupplier(() -> fluidStack, true); slotWidget = new PhantomSlotWidget(itemHandler, 0, 0, 0) { + @Override public boolean isEnabled() { return isActive(); } }; - slotWidget.setChangeListener(()-> { + slotWidget.setChangeListener(() -> { if (!itemHandler.getStackInSlot(0).isEmpty()) { fluidStack = null; fluidWidget.setVisible(false); @@ -125,7 +129,8 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { if (isMouseOverElement(mouseX, mouseY)) { ItemStack itemStack = gui.entityPlayer.inventory.getItemStack(); if (!itemStack.isEmpty()) { - IFluidHandler handlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandler handlerItem = itemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (handlerItem != null && handlerItem.getTankProperties().length > 0) { FluidStack fluidStack = handlerItem.getTankProperties()[0].getContents(); if (fluidStack != null) { diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGContainer.java b/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGContainer.java index a3d925daf4d..b6988b8e0a6 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGContainer.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGContainer.java @@ -6,6 +6,7 @@ import gregtech.api.terminal.os.TerminalDialogWidget; import gregtech.api.terminal.os.TerminalOSWidget; import gregtech.api.terminal.os.TerminalTheme; + import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -17,6 +18,7 @@ import java.util.Optional; public class RGContainer extends DraggableScrollableWidgetGroup { + protected TerminalOSWidget os; private RGNode selectedNode; private RGLine selectedLine; @@ -83,7 +85,8 @@ public void removeNode(RGNode node) { } public void addOrUpdateLine(RGNode parent, RGNode child) { - Optional optional = lines.stream().filter(line -> line.getParent() == parent && line.getChild() == child).findFirst(); + Optional optional = lines.stream() + .filter(line -> line.getParent() == parent && line.getChild() == child).findFirst(); if (!optional.isPresent()) { RGLine line = new RGLine(parent, child, this); lines.add(line); @@ -94,7 +97,8 @@ public void addOrUpdateLine(RGNode parent, RGNode child) { } public RGLine getLine(RGNode parent, RGNode child) { - Optional optional = lines.stream().filter(line -> line.getParent() == parent && line.getChild() == child).findFirst(); + Optional optional = lines.stream() + .filter(line -> line.getParent() == parent && line.getChild() == child).findFirst(); return optional.orElse(null); } @@ -115,11 +119,11 @@ public void loadFromNBT(NBTTagCompound nbt) { this.lines.clear(); NBTTagList nodesList = nbt.getTagList("nodes", Constants.NBT.TAG_COMPOUND); for (NBTBase node : nodesList) { // build nodes - nodes.add(RGNode.deserializeNodeNBT((NBTTagCompound)node, this)); + nodes.add(RGNode.deserializeNodeNBT((NBTTagCompound) node, this)); } Iterator iterator = nodesList.iterator(); // build relations for (RGNode node : nodes) { - NBTTagCompound nodeTag = (NBTTagCompound)iterator.next(); + NBTTagCompound nodeTag = (NBTTagCompound) iterator.next(); node.deserializeRelationNBT(nodeTag.getTagList("parents", Constants.NBT.TAG_INT_ARRAY), nodeTag.getTagList("children", Constants.NBT.TAG_INT_ARRAY)); this.addWidget(node); @@ -130,7 +134,7 @@ public void loadFromNBT(NBTTagCompound nbt) { lines.clear(); NBTTagList linesList = nbt.getTagList("lines", Constants.NBT.TAG_COMPOUND); for (NBTBase node : linesList) { // build nodes - RGLine line = RGLine.deserializeLineNBT((NBTTagCompound)node, this); + RGLine line = RGLine.deserializeLineNBT((NBTTagCompound) node, this); lines.add(line); this.addWidget(0, line); } @@ -200,5 +204,4 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { } return false; } - } diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGLine.java b/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGLine.java index ea5f0a99754..4fca6a6ea70 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGLine.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGLine.java @@ -16,6 +16,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -26,6 +27,7 @@ import java.util.List; public class RGLine extends WidgetGroup { + protected final RGNode parent; protected final RGNode child; protected final ItemStack catalyst; @@ -48,10 +50,14 @@ public RGLine(RGNode parent, RGNode child, RGContainer container) { if (catalyst != null) { ItemStackHandler handler = new ItemStackHandler(); handler.setStackInSlot(0, catalyst); - infoGroup.addWidget(new SlotWidget(handler, 0, 0, 0, false, false).setBackgroundTexture(new ColorRectTexture(0))); + infoGroup.addWidget( + new SlotWidget(handler, 0, 0, 0, false, false).setBackgroundTexture(new ColorRectTexture(0))); MetaTileEntity mte = GTUtility.getMetaTileEntity(catalyst); if (mte instanceof SimpleMachineMetaTileEntity) { - infoGroup.addWidget(new LabelWidget(9, -10, I18n.format("terminal.recipe_chart.tier") + GTValues.VN[((SimpleMachineMetaTileEntity) mte).getTier()], -1).setXCentered(true).setShadow(true)); + infoGroup.addWidget(new LabelWidget(9, -10, + I18n.format("terminal.recipe_chart.tier") + + GTValues.VN[((SimpleMachineMetaTileEntity) mte).getTier()], + -1).setXCentered(true).setShadow(true)); } } @@ -72,18 +78,19 @@ public RGLine(RGNode parent, RGNode child, RGContainer container) { .setColors(0, TerminalTheme.COLOR_7.getColor(), 0) .setIcon(GuiTextures.ICON_CALCULATOR) .setHoverText("terminal.recipe_chart.ratio") - .setClickListener(cd -> TerminalDialogWidget.showTextFieldDialog(container.os, "terminal.recipe_chart.ratio", s->{ - try { - return Integer.parseInt(s) > 0; - } catch (Exception ignored){ - return false; - } - }, s -> { - if (s != null) { - ratio = Integer.parseInt(s); - parent.updateDemand(parent.getHeadDemand()); - } - }).setClientSide().open())); + .setClickListener(cd -> TerminalDialogWidget + .showTextFieldDialog(container.os, "terminal.recipe_chart.ratio", s -> { + try { + return Integer.parseInt(s) > 0; + } catch (Exception ignored) { + return false; + } + }, s -> { + if (s != null) { + ratio = Integer.parseInt(s); + parent.updateDemand(parent.getHeadDemand()); + } + }).setClientSide().open())); toolGroup.addWidget(new SimpleTextWidget(0, -18, "", -1, () -> Integer.toString(ratio), true).setShadow(true)); toolGroup.setVisible(false); this.addWidget(toolGroup); @@ -92,7 +99,8 @@ public RGLine(RGNode parent, RGNode child, RGContainer container) { } public static RGLine deserializeLineNBT(NBTTagCompound nbt, RGContainer container) { - RGLine line = new RGLine(container.nodes.get(nbt.getInteger("parent")), container.nodes.get(nbt.getInteger("child")), container); + RGLine line = new RGLine(container.nodes.get(nbt.getInteger("parent")), + container.nodes.get(nbt.getInteger("child")), container); line.ratio = nbt.getInteger("ratio"); boolean visible = nbt.getBoolean("visible"); line.infoGroup.setVisible(visible); @@ -177,7 +185,8 @@ public boolean isMouseOver(int mouseX, int mouseY) { float y = points.get(0).y; float x2 = points.get(points.size() - 1).x; float y2 = points.get(points.size() - 1).y; - if (mouseX >= Math.min(x, x2) && mouseY >= Math.min(y, y2) && Math.max(x, x2) > mouseX && Math.max(y, y2) > mouseY) { + if (mouseX >= Math.min(x, x2) && mouseY >= Math.min(y, y2) && Math.max(x, x2) > mouseX && + Math.max(y, y2) > mouseY) { for (Vec2f point : points) { if ((mouseX - point.x) * (mouseX - point.x) + (mouseY - point.y) * (mouseY - point.y) < 4) { return true; @@ -196,13 +205,13 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender drawLines(points, 0x2fffff00, 0xff00ff00, 2); } Vec2f point = points.get(points.size() - 1); - drawSolidRect((int)(point.x - 1.5), (int)(point.y - 1.5), 3, 3, 0XFF00FF00); + drawSolidRect((int) (point.x - 1.5), (int) (point.y - 1.5), 3, 3, 0XFF00FF00); super.drawInBackground(mouseX, mouseY, partialTicks, context); } @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { - if (super.mouseClicked(mouseX, mouseY, button)){ + if (super.mouseClicked(mouseX, mouseY, button)) { return true; } else if (isMouseOver(mouseX, mouseY)) { if (!isSelected) { diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGNode.java b/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGNode.java index e9f1d8e3344..b8b466fb311 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGNode.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGNode.java @@ -20,12 +20,7 @@ import gregtech.common.terminal.app.recipechart.IngredientHelper; import gregtech.integration.jei.JustEnoughItemsModule; import gregtech.integration.jei.recipe.GTRecipeWrapper; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.recipe.IFocus; -import mezz.jei.api.recipe.IRecipeCategory; -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.gui.Focus; -import mezz.jei.gui.recipes.RecipeLayout; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; @@ -41,6 +36,13 @@ import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.items.ItemStackHandler; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.recipe.IFocus; +import mezz.jei.api.recipe.IRecipeCategory; +import mezz.jei.api.recipe.IRecipeWrapper; +import mezz.jei.gui.Focus; +import mezz.jei.gui.recipes.RecipeLayout; + import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -87,46 +89,51 @@ public RGNode(int x, int y, RGContainer container, Object head, boolean isPhanto .setColors(0, TerminalTheme.COLOR_7.getColor(), 0) .setIcon(GuiTextures.ICON_CALCULATOR) .setHoverText("terminal.recipe_chart.calculator") - .setClickListener(cd -> TerminalDialogWidget.showTextFieldDialog(container.os, "terminal.recipe_chart.demand", s -> { - try { - return Integer.parseInt(s) > 0; - } catch (Exception ignored) { - return false; - } - }, s -> { - if (s != null && !s.isEmpty()) { - updateDemand(Integer.parseInt(s)); - } - }).setClientSide().open())); + .setClickListener(cd -> TerminalDialogWidget + .showTextFieldDialog(container.os, "terminal.recipe_chart.demand", s -> { + try { + return Integer.parseInt(s) > 0; + } catch (Exception ignored) { + return false; + } + }, s -> { + if (s != null && !s.isEmpty()) { + updateDemand(Integer.parseInt(s)); + } + }).setClientSide().open())); toolGroup.addWidget(new CircleButtonWidget(9, 49, 8, 1, 12) .setColors(0, TerminalTheme.COLOR_7.getColor(), 0) .setIcon(GuiTextures.ICON_ADD) .setHoverText("terminal.recipe_chart.add") - .setClickListener(cd -> TerminalDialogWidget.showItemSelector(container.os, "terminal.recipe_chart.demand", false, itemStack -> true, - itemStack -> { - if (itemStack != null && !itemStack.isEmpty()) { - IFluidHandler handlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); - if (handlerItem != null && handlerItem.getTankProperties().length > 0) { - FluidStack fluidStack = handlerItem.getTankProperties()[0].getContents(); - if (fluidStack != null) { - phantom.setObject(fluidStack); - return; + .setClickListener(cd -> TerminalDialogWidget + .showItemSelector(container.os, "terminal.recipe_chart.demand", false, itemStack -> true, + itemStack -> { + if (itemStack != null && !itemStack.isEmpty()) { + IFluidHandler handlerItem = itemStack.getCapability( + CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + if (handlerItem != null && handlerItem.getTankProperties().length > 0) { + FluidStack fluidStack = handlerItem.getTankProperties()[0] + .getContents(); + if (fluidStack != null) { + phantom.setObject(fluidStack); + return; + } + } + phantom.setObject(itemStack); + + // Reset any children nodes, now that the parent has changed + for (Set childs : children.values()) { + for (RGNode child : childs) { + child.removeParent(this); + } + } + children.clear(); + + // Clear the Inputs for the replaced parent + this.inputsGroup.widgets.clear(); } - } - phantom.setObject(itemStack); - - // Reset any children nodes, now that the parent has changed - for (Set childs : children.values()) { - for (RGNode child : childs) { - child.removeParent(this); - } - } - children.clear(); - - // Clear the Inputs for the replaced parent - this.inputsGroup.widgets.clear(); - } - }).setClientSide().open())); + }) + .setClientSide().open())); } else { addWidget(this.headHelper.createWidget(head)); } @@ -134,7 +141,9 @@ public RGNode(int x, int y, RGContainer container, Object head, boolean isPhanto private void init(RGContainer container) { this.container = container; - textWidget = new SimpleTextWidget(9, -5, "", -1, () -> this.head != null ? this.headHelper.getDisplayName(this.head) : "terminal.recipe_chart.drag", true).setShadow(true); + textWidget = new SimpleTextWidget(9, -5, "", -1, + () -> this.head != null ? this.headHelper.getDisplayName(this.head) : "terminal.recipe_chart.drag", + true).setShadow(true); textWidget.setVisible(false); textWidget.setActive(false); this.addWidget(textWidget); @@ -186,7 +195,8 @@ public int getChildDemand(RGNode child) { perC = ((TankWidget) entry.getKey()).fluidTank.getFluidAmount(); } int ratioSum = entry.getValue().stream().mapToInt(it -> container.getLine(RGNode.this, it).ratio).sum(); - return MathHelper.ceil(perC * MathHelper.ceil(getHeadDemand() / (float) recipePer) * container.getLine(RGNode.this, child).ratio / (float) ratioSum); + return MathHelper.ceil(perC * MathHelper.ceil(getHeadDemand() / (float) recipePer) * + container.getLine(RGNode.this, child).ratio / (float) ratioSum); } } return 0; @@ -322,7 +332,8 @@ protected void onPositionUpdate() { } } - public boolean transferRecipe(ModularUIContainer x, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { + public boolean transferRecipe(ModularUIContainer x, IRecipeLayout recipeLayout, EntityPlayer player, + boolean maxTransfer, boolean doTransfer) { if (isSelected) { Object obj = recipeLayout.getFocus() == null ? null : recipeLayout.getFocus().getValue(); IngredientHelper otherHelper = IngredientHelper.getFor(obj); @@ -378,7 +389,8 @@ public boolean transferRecipe(ModularUIContainer x, IRecipeLayout recipeLayout, // CHECK GTCE RECIPES Recipe recipe = null; if (recipeLayout instanceof RecipeLayout) { - IRecipeWrapper recipeWrapper = ObfuscationReflectionHelper.getPrivateValue(RecipeLayout.class, (RecipeLayout) recipeLayout, "recipeWrapper"); + IRecipeWrapper recipeWrapper = ObfuscationReflectionHelper.getPrivateValue(RecipeLayout.class, + (RecipeLayout) recipeLayout, "recipeWrapper"); if (recipeWrapper instanceof GTRecipeWrapper) { recipe = ((GTRecipeWrapper) recipeWrapper).getRecipe(); } @@ -424,7 +436,8 @@ public void deserializeRelationNBT(NBTTagList parentsTag, NBTTagList childrenTag Iterator iterator = children.keySet().iterator(); for (NBTBase nbtBase : childrenTag) { int[] nbt = ((NBTTagIntArray) nbtBase).getIntArray(); - children.get(iterator.next()).addAll(Arrays.stream(nbt).mapToObj(it -> container.nodes.get(it)).collect(Collectors.toList())); + children.get(iterator.next()) + .addAll(Arrays.stream(nbt).mapToObj(it -> container.nodes.get(it)).collect(Collectors.toList())); } } @@ -436,7 +449,8 @@ public static RGNode deserializeNodeNBT(NBTTagCompound nodeTag, RGContainer cont head = headHelper.deserialize(nodeTag.getCompoundTag("nbt")); headHelper.setAmount(head, nodeTag.getInteger("count")); } - RGNode node = new RGNode(nodeTag.getInteger("x"), nodeTag.getInteger("y"), container, head, nodeTag.getBoolean("phantom")); + RGNode node = new RGNode(nodeTag.getInteger("x"), nodeTag.getInteger("y"), container, head, + nodeTag.getBoolean("phantom")); NBTTagList itemsList = nodeTag.getTagList("items", Constants.NBT.TAG_COMPOUND); NBTTagList fluidsList = nodeTag.getTagList("fluids", Constants.NBT.TAG_COMPOUND); List itemInputs = new LinkedList<>(); @@ -461,7 +475,7 @@ public static RGNode deserializeNodeNBT(NBTTagCompound nodeTag, RGContainer cont } public NBTTagCompound serializeNodeNBT() { - //head + // head NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("x", getSelfPosition().x + container.getScrollXOffset()); nbt.setInteger("y", getSelfPosition().y + container.getScrollYOffset()); @@ -484,7 +498,8 @@ public NBTTagCompound serializeNodeNBT() { } else { continue; } - NBTTagIntArray childList = new NBTTagIntArray(entry.getValue().stream().mapToInt(it -> container.nodes.indexOf(it)).toArray()); + NBTTagIntArray childList = new NBTTagIntArray( + entry.getValue().stream().mapToInt(it -> container.nodes.indexOf(it)).toArray()); childrenList.appendTag(childList); } nbt.setTag("items", itemsList); @@ -497,14 +512,16 @@ public NBTTagCompound serializeNodeNBT() { // parent NBTTagList parentsList = new NBTTagList(); for (Map.Entry entry : parentNodes.entrySet()) { - parentsList.appendTag(new NBTTagIntArray(new int[]{container.nodes.indexOf(entry.getKey()), entry.getValue()})); + parentsList.appendTag( + new NBTTagIntArray(new int[] { container.nodes.indexOf(entry.getKey()), entry.getValue() })); } nbt.setTag("parents", parentsList); nbt.setBoolean("visible", textWidget.isVisible()); return nbt; } - private void setRecipe(List itemInputs, List fluidInputs, ItemStack catalyst, int recipePer) { + private void setRecipe(List itemInputs, List fluidInputs, ItemStack catalyst, + int recipePer) { this.recipePer = recipePer; this.catalyst = catalyst; inputsGroup.clearAllWidgets(); @@ -519,6 +536,7 @@ private void setRecipe(List itemInputs, List fluidInputs, ItemStackHandler handler = new ItemStackHandler(1); handler.setStackInSlot(0, itemInput); Widget widget = new SlotWidget(handler, 0, 0, y.addAndGet(20), false, false) { + @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { return RGNode.this.handleTipsSlotClick(mouseX, mouseY, this, handler.getStackInSlot(0).copy()); @@ -530,6 +548,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { for (FluidStack fluidInput : fluidInputs) { FluidTank tank = new FluidTank(fluidInput, Integer.MAX_VALUE); Widget widget = new TankWidget(tank, 0, y.addAndGet(20), 18, 18) { + @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { return RGNode.this.handleTipsSlotClick(mouseX, mouseY, this, tank.getFluid().copy()); @@ -544,7 +563,8 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { private boolean handleTipsSlotClick(int mouseX, int mouseY, Widget slot, Object object) { if (slot.isMouseOverElement(mouseX, mouseY)) { Position position = inputsGroup.getSelfPosition(); - RGNode child = container.addNode(RGNode.this.getSelfPosition().x + 50, RGNode.this.getSelfPosition().y + position.y + slot.getSelfPosition().y, object); + RGNode child = container.addNode(RGNode.this.getSelfPosition().x + 50, + RGNode.this.getSelfPosition().y + position.y + slot.getSelfPosition().y, object); Set childs = RGNode.this.children.get(slot); childs.add(child); diff --git a/src/main/java/gregtech/common/terminal/app/settings/SettingsApp.java b/src/main/java/gregtech/common/terminal/app/settings/SettingsApp.java index 9e750afc318..a04035afc07 100644 --- a/src/main/java/gregtech/common/terminal/app/settings/SettingsApp.java +++ b/src/main/java/gregtech/common/terminal/app/settings/SettingsApp.java @@ -15,6 +15,7 @@ import gregtech.common.terminal.app.settings.widgets.ThemeSettings; public class SettingsApp extends AbstractApplication { + private TabGroup tabGroup; public SettingsApp() { @@ -25,7 +26,8 @@ public SettingsApp() { public AbstractApplication initApp() { if (isClient) { this.addWidget(new ImageWidget(5, 15, 323, 212, new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()))); - this.tabGroup = new TabGroup<>(5, 15, new CustomTabListRenderer(TerminalTheme.COLOR_B_2, TerminalTheme.COLOR_F_2, 323 / 3, 10)); + this.tabGroup = new TabGroup<>(5, 15, + new CustomTabListRenderer(TerminalTheme.COLOR_B_2, TerminalTheme.COLOR_F_2, 323 / 3, 10)); this.addWidget(this.tabGroup); this.tabGroup.setOnTabChanged(this::onPagesChanged); addTab("terminal.settings.theme", new ThemeSettings(getOs())); @@ -47,7 +49,12 @@ private void onPagesChanged(int oldPage, int newPage) { } private void addTab(String name, AbstractWidgetGroup widget) { - tabGroup.addTab(new IGuiTextureTabInfo(new TextTexture(name, -1).setWidth(323 / 3 - 5).setType(tabGroup.getAllTag().isEmpty() ? TextTexture.TextType.ROLL : TextTexture.TextType.HIDE), name), widget); + tabGroup.addTab( + new IGuiTextureTabInfo( + new TextTexture(name, -1).setWidth(323 / 3 - 5).setType( + tabGroup.getAllTag().isEmpty() ? TextTexture.TextType.ROLL : TextTexture.TextType.HIDE), + name), + widget); } @Override diff --git a/src/main/java/gregtech/common/terminal/app/settings/widgets/HomeButtonSettings.java b/src/main/java/gregtech/common/terminal/app/settings/widgets/HomeButtonSettings.java index ccc8c740d5e..48ab589601f 100644 --- a/src/main/java/gregtech/common/terminal/app/settings/widgets/HomeButtonSettings.java +++ b/src/main/java/gregtech/common/terminal/app/settings/widgets/HomeButtonSettings.java @@ -13,7 +13,9 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.client.resources.I18n; + import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; @@ -22,19 +24,23 @@ import java.util.stream.Collectors; public class HomeButtonSettings extends AbstractWidgetGroup { + final TerminalOSWidget os; public HomeButtonSettings(TerminalOSWidget os) { super(Position.ORIGIN, new Size(323, 212)); this.os = os; - List candidates = Arrays.stream(SystemCall.values()).map(SystemCall::getTranslateKey).collect(Collectors.toList()); + List candidates = Arrays.stream(SystemCall.values()).map(SystemCall::getTranslateKey) + .collect(Collectors.toList()); candidates.add(0, "terminal.system_call.null"); TerminalHomeButtonWidget home = this.os.home; this.addWidget(new LabelWidget(10, 15, "terminal.settings.home.double", -1).setYCentered(true)); this.addWidget(new LabelWidget(50, 15, "+Ctrl", -1).setYCentered(true)); this.addWidget(new LabelWidget(85, 15, "+Shift", -1).setYCentered(true)); - this.addWidget(new LabelWidget(170, 15, "terminal.settings.home.action", -1).setXCentered(true).setYCentered(true)); - this.addWidget(new LabelWidget(270, 15, "terminal.settings.home.args", -1).setXCentered(true).setYCentered(true)); + this.addWidget( + new LabelWidget(170, 15, "terminal.settings.home.action", -1).setXCentered(true).setYCentered(true)); + this.addWidget( + new LabelWidget(270, 15, "terminal.settings.home.args", -1).setXCentered(true).setYCentered(true)); for (int shift = 0; shift < 2; shift++) { for (int ctrl = 0; ctrl < 2; ctrl++) { @@ -51,15 +57,16 @@ public HomeButtonSettings(TerminalOSWidget os) { if (shift == 1) { this.addWidget(new ImageWidget(90, y + 5, 10, 10, GuiTextures.ICON_VISIBLE)); } - TextFieldWidget textFieldWidget = new TextFieldWidget(230, y, 80, 20, TerminalTheme.COLOR_B_3, null, null) - .setMaxStringLength(Integer.MAX_VALUE) - .setTextResponder(arg -> { - if (arg != null && home.getActions()[i] != null) { - home.getActions()[i].setValue(arg); - } - home.saveConfig(); - }, true) - .setValidator(s -> true); + TextFieldWidget textFieldWidget = new TextFieldWidget(230, y, 80, 20, TerminalTheme.COLOR_B_3, null, + null) + .setMaxStringLength(Integer.MAX_VALUE) + .setTextResponder(arg -> { + if (arg != null && home.getActions()[i] != null) { + home.getActions()[i].setValue(arg); + } + home.saveConfig(); + }, true) + .setValidator(s -> true); if (pair != null && pair.getValue() != null) { textFieldWidget.setCurrentString(pair.getValue()); } else { @@ -74,32 +81,37 @@ public HomeButtonSettings(TerminalOSWidget os) { } return "terminal.system_call.null"; }, true) - .setIsUp(i > 3) - .setHoverText(I18n.format(doubleClick == 1 ? "terminal.settings.home.double_click" : "terminal.settings.home.click") + (ctrl == 1 ? "+Ctrl" : "") + (shift == 1 ? "+Shift" : "")) - .setOnChanged(selected -> { - SystemCall action = SystemCall.getFromName(selected); - if (action != null) { - if (home.getActions()[i] == null) { - home.getActions()[i] = new MutablePair<>(action, null); - } else { - home.getActions()[i] = new MutablePair<>(action, home.getActions()[i].getValue()); - } - } else { - home.getActions()[i] = null; - } - home.saveConfig(); - }) - .setOnShowChange(isShow -> { - if (isShow) { - for (Widget widget : widgets) { - if (widget instanceof SelectorWidget) { - ((SelectorWidget) widget).hide(); + .setIsUp(i > 3) + .setHoverText(I18n + .format(doubleClick == 1 ? "terminal.settings.home.double_click" : + "terminal.settings.home.click") + + (ctrl == 1 ? "+Ctrl" : "") + (shift == 1 ? "+Shift" : "")) + .setOnChanged(selected -> { + SystemCall action = SystemCall.getFromName(selected); + if (action != null) { + if (home.getActions()[i] == null) { + home.getActions()[i] = new MutablePair<>(action, null); + } else { + home.getActions()[i] = new MutablePair<>(action, + home.getActions()[i].getValue()); + } + } else { + home.getActions()[i] = null; } - } - } - }) - .setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), TerminalTheme.COLOR_B_2.getColor()) - .setBackground(TerminalTheme.COLOR_6)); + home.saveConfig(); + }) + .setOnShowChange(isShow -> { + if (isShow) { + for (Widget widget : widgets) { + if (widget instanceof SelectorWidget) { + ((SelectorWidget) widget).hide(); + } + } + } + }) + .setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), + TerminalTheme.COLOR_B_2.getColor()) + .setBackground(TerminalTheme.COLOR_6)); this.addWidget(textFieldWidget); } diff --git a/src/main/java/gregtech/common/terminal/app/settings/widgets/OsSettings.java b/src/main/java/gregtech/common/terminal/app/settings/widgets/OsSettings.java index 51c0ad80043..1ed390a5352 100644 --- a/src/main/java/gregtech/common/terminal/app/settings/widgets/OsSettings.java +++ b/src/main/java/gregtech/common/terminal/app/settings/widgets/OsSettings.java @@ -10,6 +10,7 @@ import gregtech.api.util.GTLog; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -18,6 +19,7 @@ import java.io.IOException; public class OsSettings extends AbstractWidgetGroup { + public static boolean DOUBLE_CHECK; static { if (FMLCommonHandler.instance().getSide().isClient()) { @@ -42,7 +44,8 @@ public static void saveConfig() { nbt.setBoolean("double_check", DOUBLE_CHECK); try { if (!nbt.isEmpty()) { - CompressedStreamTools.safeWrite(nbt, new File(TerminalRegistry.TERMINAL_PATH, "config/os_settings.nbt")); + CompressedStreamTools.safeWrite(nbt, + new File(TerminalRegistry.TERMINAL_PATH, "config/os_settings.nbt")); } } catch (IOException e) { GTLog.logger.error("error while saving local nbt for the os settings", e); @@ -55,11 +58,11 @@ public OsSettings(TerminalOSWidget os) { this.os = os; this.addWidget(new LabelWidget(25, 15, "terminal.settings.os.double_check", -1).setYCentered(true)); this.addWidget(new RectButtonWidget(10, 10, 10, 10, 2) - .setToggleButton(new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()), (c, p)->{ - DOUBLE_CHECK=!p; + .setToggleButton(new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()), (c, p) -> { + DOUBLE_CHECK = !p; saveConfig(); }) - .setValueSupplier(true, ()->!DOUBLE_CHECK) + .setValueSupplier(true, () -> !DOUBLE_CHECK) .setColors(TerminalTheme.COLOR_B_3.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_3.getColor()) diff --git a/src/main/java/gregtech/common/terminal/app/settings/widgets/ThemeSettings.java b/src/main/java/gregtech/common/terminal/app/settings/widgets/ThemeSettings.java index 829a8fa6db4..d0894a487c1 100644 --- a/src/main/java/gregtech/common/terminal/app/settings/widgets/ThemeSettings.java +++ b/src/main/java/gregtech/common/terminal/app/settings/widgets/ThemeSettings.java @@ -12,12 +12,14 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.util.ResourceLocation; import java.util.Arrays; import java.util.function.Consumer; public class ThemeSettings extends AbstractWidgetGroup { + private final WidgetGroup textureGroup; final TerminalOSWidget os; @@ -48,32 +50,40 @@ public ThemeSettings(TerminalOSWidget os) { "terminal.settings.theme.wallpaper.color", "terminal.settings.theme.wallpaper.file"), -1, this::getLocalizedWallpaperTypeName, true) - .setIsUp(true) - .setOnChanged(this::onModifyTextureChanged) - .setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), TerminalTheme.COLOR_B_2.getColor()) - .setBackground(TerminalTheme.COLOR_6)); + .setIsUp(true) + .setOnChanged(this::onModifyTextureChanged) + .setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), + TerminalTheme.COLOR_B_2.getColor()) + .setBackground(TerminalTheme.COLOR_6)); textureGroup = new WidgetGroup((int) (x + 170), 122, (int) (x * 11 - 170), 65); this.addWidget(textureGroup); } - private String getLocalizedWallpaperTypeName(){ - switch(TerminalTheme.WALL_PAPER.getTypeName()){ - case "resource": return "terminal.settings.theme.wallpaper.resource"; - case "url": return "terminal.settings.theme.wallpaper.url"; - case "color": return "terminal.settings.theme.wallpaper.color"; - case "file": return "terminal.settings.theme.wallpaper.file"; + private String getLocalizedWallpaperTypeName() { + switch (TerminalTheme.WALL_PAPER.getTypeName()) { + case "resource": + return "terminal.settings.theme.wallpaper.resource"; + case "url": + return "terminal.settings.theme.wallpaper.url"; + case "color": + return "terminal.settings.theme.wallpaper.color"; + case "file": + return "terminal.settings.theme.wallpaper.file"; } return null; } private void addColorButton(ColorRectTexture texture, String name, int x, int y) { - CircleButtonWidget buttonWidget = new CircleButtonWidget(x, y, 8, 1, 0).setFill(texture.getColor()).setStrokeAnima(-1).setHoverText(name); + CircleButtonWidget buttonWidget = new CircleButtonWidget(x, y, 8, 1, 0).setFill(texture.getColor()) + .setStrokeAnima(-1).setHoverText(name); buttonWidget.setClickListener(cd -> TerminalDialogWidget.showColorDialog(os, name, color -> { if (color != null) { buttonWidget.setFill(color); texture.setColor(color); if (!TerminalTheme.saveConfig()) { - TerminalDialogWidget.showInfoDialog(os, "terminal.component.error", "terminal.component.save_file.error").setClientSide().open(); + TerminalDialogWidget + .showInfoDialog(os, "terminal.component.error", "terminal.component.save_file.error") + .setClientSide().open(); } } }, texture.color).setClientSide().open()); @@ -85,12 +95,15 @@ private void onModifyTextureChanged(String type) { switch (type) { case "terminal.settings.theme.wallpaper.resource": if (!(TerminalTheme.WALL_PAPER.getTexture() instanceof TextureArea)) { - TerminalTheme.WALL_PAPER.setTexture(new TextureArea(new ResourceLocation("gregtech:textures/gui/terminal/terminal_background.png"), 0.0, 0.0, 1.0, 1.0)); + TerminalTheme.WALL_PAPER.setTexture(new TextureArea( + new ResourceLocation("gregtech:textures/gui/terminal/terminal_background.png"), 0.0, 0.0, + 1.0, 1.0)); TerminalTheme.saveConfig(); } - addStringSetting(((TextureArea)TerminalTheme.WALL_PAPER.getTexture()).imageLocation.toString(), + addStringSetting(((TextureArea) TerminalTheme.WALL_PAPER.getTexture()).imageLocation.toString(), s -> { - TerminalTheme.WALL_PAPER.setTexture(new TextureArea(new ResourceLocation(s), 0.0, 0.0, 1.0, 1.0)); + TerminalTheme.WALL_PAPER + .setTexture(new TextureArea(new ResourceLocation(s), 0.0, 0.0, 1.0, 1.0)); TerminalTheme.saveConfig(); }); break; @@ -99,7 +112,7 @@ private void onModifyTextureChanged(String type) { TerminalTheme.WALL_PAPER.setTexture(new URLTexture(null)); TerminalTheme.saveConfig(); } - addStringSetting(((URLTexture)TerminalTheme.WALL_PAPER.getTexture()).url, s -> { + addStringSetting(((URLTexture) TerminalTheme.WALL_PAPER.getTexture()).url, s -> { TerminalTheme.WALL_PAPER.setTexture(new URLTexture(s)); TerminalTheme.saveConfig(); }); @@ -126,12 +139,13 @@ private void onModifyTextureChanged(String type) { .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()) - .setClickListener(cd-> TerminalDialogWidget.showFileDialog(os, "terminal.settings.theme.image", TerminalRegistry.TERMINAL_PATH, true, file->{ - if (file != null && file.isFile()) { - TerminalTheme.WALL_PAPER.setTexture(new FileTexture(file)); - TerminalTheme.saveConfig(); - } - }).setClientSide().open()) + .setClickListener(cd -> TerminalDialogWidget.showFileDialog(os, "terminal.settings.theme.image", + TerminalRegistry.TERMINAL_PATH, true, file -> { + if (file != null && file.isFile()) { + TerminalTheme.WALL_PAPER.setTexture(new FileTexture(file)); + TerminalTheme.saveConfig(); + } + }).setClientSide().open()) .setIcon(new TextTexture("terminal.settings.theme.select", -1))); break; } @@ -147,7 +161,7 @@ private void addStringSetting(String init, Consumer callback) { .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()) - .setClickListener(cd->callback.accept(textFieldWidget.getCurrentString())) + .setClickListener(cd -> callback.accept(textFieldWidget.getCurrentString())) .setIcon(new TextTexture("terminal.guide_editor.update", -1))); } } diff --git a/src/main/java/gregtech/common/terminal/app/teleport/TeleportApp.java b/src/main/java/gregtech/common/terminal/app/teleport/TeleportApp.java index a7a5d5a0b8b..288f5f39bd2 100644 --- a/src/main/java/gregtech/common/terminal/app/teleport/TeleportApp.java +++ b/src/main/java/gregtech/common/terminal/app/teleport/TeleportApp.java @@ -7,6 +7,7 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.api.util.TeleportHandler; import gregtech.common.entities.PortalEntity; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; @@ -48,7 +49,8 @@ public AbstractApplication initApp() { this.addWidget(new LabelWidget(10, 15, "X: ", 0xFFFFFF)); this.addWidget(new LabelWidget(10, 35, "Y: ", 0xFFFFFF)); this.addWidget(new LabelWidget(10, 55, "Z: ", 0xFFFFFF)); - this.addWidget(new SimpleTextWidget(10, 95, "terminal.teleporter.dimension", 0xFFFFFF, () -> "").setCenter(false)); + this.addWidget( + new SimpleTextWidget(10, 95, "terminal.teleporter.dimension", 0xFFFFFF, () -> "").setCenter(false)); this.addWidget(new TextFieldWidget2(10, 105, 75, 16, () -> String.valueOf(dimension), value -> { if (!value.isEmpty()) { @@ -71,7 +73,8 @@ public AbstractApplication initApp() { } }).setMaxLength(9).setNumbersOnly(-30000000, 30000000)); - this.addWidget(new ClickButtonWidget(15, 140, 65, 20, "terminal.teleporter.spawn_portal", data -> this.spawnPortals())); + this.addWidget(new ClickButtonWidget(15, 140, 65, 20, "terminal.teleporter.spawn_portal", + data -> this.spawnPortals())); return this; } @@ -85,26 +88,28 @@ public NBTTagCompound closeApp() { } /** - * Creates two portals, one 5 blocks in front of the player targeting the other portal, the other at the destination targeting the first portal + * Creates two portals, one 5 blocks in front of the player targeting the other portal, the other at the destination + * targeting the first portal */ public void spawnPortals() { Vec3d position = new Vec3d( gui.entityPlayer.getPosition().getX() + gui.entityPlayer.getLookVec().x * 5, gui.entityPlayer.getPosition().getY(), - gui.entityPlayer.getPosition().getZ() + gui.entityPlayer.getLookVec().z * 5 - ); + gui.entityPlayer.getPosition().getZ() + gui.entityPlayer.getLookVec().z * 5); PortalEntity portal1 = new PortalEntity(gui.entityPlayer.getEntityWorld(), position.x, position.y, position.z); portal1.setRotation(gui.entityPlayer.rotationYaw, 0.F); - PortalEntity portal2 = new PortalEntity(gui.entityPlayer.getEntityWorld(), coordinateX, coordinateY, coordinateZ); + PortalEntity portal2 = new PortalEntity(gui.entityPlayer.getEntityWorld(), coordinateX, coordinateY, + coordinateZ); portal2.setRotation(gui.entityPlayer.rotationYaw, 0.F); portal1.setTargetCoordinates(dimension, coordinateX, coordinateY, coordinateZ); portal2.setTargetCoordinates(gui.entityPlayer.dimension, position.x, position.y, position.z); gui.entityPlayer.getEntityWorld().spawnEntity(portal1); - Chunk destination = TeleportHandler.getWorldByDimensionID(dimension).getChunkProvider().provideChunk(coordinateX >> 4, coordinateZ >> 4); + Chunk destination = TeleportHandler.getWorldByDimensionID(dimension).getChunkProvider() + .provideChunk(coordinateX >> 4, coordinateZ >> 4); TeleportHandler.getWorldByDimensionID(dimension).spawnEntity(portal2); TeleportHandler.getWorldByDimensionID(dimension).getChunkProvider().queueUnload(destination); diff --git a/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java b/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java index 31f5c82d9ea..abb454892e7 100644 --- a/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java +++ b/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java @@ -1,6 +1,5 @@ package gregtech.common.terminal.app.worldprospector; -import com.google.common.collect.Lists; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.gui.resources.ItemStackTexture; @@ -26,7 +25,7 @@ import gregtech.common.items.MetaItems; import gregtech.common.terminal.app.worldprospector.matcher.BlockStateMatcher; import gregtech.common.terminal.app.worldprospector.matcher.IMatcher; -import mezz.jei.api.gui.IGhostIngredientHandler; + import net.minecraft.block.Block; import net.minecraft.block.BlockFalling; import net.minecraft.client.Minecraft; @@ -52,15 +51,18 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import mezz.jei.api.gui.IGhostIngredientHandler; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; -import javax.annotation.Nonnull; import java.awt.*; import java.io.IOException; import java.util.*; import java.util.List; +import javax.annotation.Nonnull; + public class WorldProspectorARApp extends ARApplication { private SingleItemStackHandler[] handlers; @@ -73,10 +75,11 @@ public WorldProspectorARApp() { @Override public AbstractApplication initApp() { addWidget(new ImageWidget(10, 10, 313, 212, new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()))); - addWidget(new LabelWidget(15 + 150 / 2, 232 / 2, "terminal.world_prospector.radius", -1, new Object[]{getMaxRadius()}) - .setShadow(true) - .setYCentered(true) - .setXCentered(true)); + addWidget(new LabelWidget(15 + 150 / 2, 232 / 2, "terminal.world_prospector.radius", -1, + new Object[] { getMaxRadius() }) + .setShadow(true) + .setYCentered(true) + .setXCentered(true)); int slotSize = (int) Math.pow(2, getAppTier()); int x = 250 - slotSize * 12; int y = 232 / 2 - 18; @@ -102,6 +105,7 @@ public List> getPhantomTargets(Object ingredie } Rectangle rectangle = toRectangleBox(); return Collections.singletonList(new IGhostIngredientHandler.Target() { + @Nonnull @Override public Rectangle getArea() { @@ -114,7 +118,8 @@ public void accept(@Nonnull Object ingredient) { int mouseButton = Mouse.getEventButton(); boolean shiftDown = TooltipHelper.isShiftDown(); ClickType clickType = shiftDown ? ClickType.QUICK_MOVE : ClickType.PICKUP; - PhantomSlotUtil.slotClickPhantom(slotReference, mouseButton, clickType, (ItemStack) ingredient); + PhantomSlotUtil.slotClickPhantom(slotReference, mouseButton, clickType, + (ItemStack) ingredient); updateBlockSelectionAndColor((ItemStack) ingredient, index, buttonWidget); writeClientAction(1, buffer -> { buffer.writeItemStack((ItemStack) ingredient); @@ -126,7 +131,6 @@ public void accept(@Nonnull Object ingredient) { }); } - @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { if (handlers[index].getStackInSlot(0).isEmpty() && isMouseOverElement(mouseX, mouseY)) { @@ -144,11 +148,9 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { public void handleClientAction(int id, PacketBuffer buffer) { if (id == -1) { selectReference(index, buttonWidget); - } - else if (id == 0) { + } else if (id == 0) { updateBlockSelectionAndColor(ItemStack.EMPTY, index, buttonWidget); - } - else if (id == 1) { + } else if (id == 1) { try { buffer.markReaderIndex(); // just want to reset reader index, not both with .clear ItemStack stack = buffer.readItemStack(); @@ -166,16 +168,16 @@ else if (id == 1) { addWidget(buttonWidget .setHoverText("terminal.world_prospector.color") .setColors(0x4fffffff, -1, colors[i]) - .setClickListener(cd -> TerminalDialogWidget.showColorDialog(getOs(), "terminal.world_prospector.color", res->{ - if (res != null) { - buttonWidget.setFill(res | 0xff000000); - colors[index] = res | 0xff000000; - } - }, colors[index]).open()) - ); + .setClickListener(cd -> TerminalDialogWidget + .showColorDialog(getOs(), "terminal.world_prospector.color", res -> { + if (res != null) { + buttonWidget.setFill(res | 0xff000000); + colors[index] = res | 0xff000000; + } + }, colors[index]).open())); } addWidget(new CircleButtonWidget(333 / 2, 200) - .setClickListener(cd->openAR()) + .setClickListener(cd -> openAR()) .setHoverText("terminal.ar.open") .setColors(0, -1, TerminalTheme.COLOR_B_3.getColor()) .setIcon(new ItemStackTexture(MetaItems.CAMERA.getStackForm()))); @@ -195,7 +197,8 @@ private void updateBlockSelectionAndColor(ItemStack stack, int index, RectButton } else if (ms != null) { colors[index] = ms.material.getMaterialRGB(); } else { - colors[index] = block.getStateFromMeta(copy.getMetadata()).getMaterial().getMaterialMapColor().colorValue; + colors[index] = block.getStateFromMeta(copy.getMetadata()).getMaterial() + .getMaterialMapColor().colorValue; } if (colors[index] == 0) { colors[index] = block.hashCode(); @@ -237,7 +240,8 @@ protected void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); if (Shaders.allowedShader()) { - ShaderTexture.createShader("lightring.frag").draw(getPosition().x + 15, getPosition().y + (232 - 150) / 2f, 150, 150, uniformCache -> uniformCache.glUniform1F("u_time", time)); + ShaderTexture.createShader("lightring.frag").draw(getPosition().x + 15, getPosition().y + (232 - 150) / 2f, + 150, 150, uniformCache -> uniformCache.glUniform1F("u_time", time)); } GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); } @@ -245,8 +249,7 @@ protected void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, private void selectReference(int index, RectButtonWidget buttonWidget) { TerminalDialogWidget.showItemSelector(getOs(), "terminal.world_prospector.reference", false, stack -> stack.getItem() instanceof ItemBlock, - stack -> updateBlockSelectionAndColor(stack, index, buttonWidget) - ).open(); + stack -> updateBlockSelectionAndColor(stack, index, buttonWidget)).open(); } private int getMaxRadius() { @@ -276,7 +279,7 @@ private List> getAllSlotStack() { return stacks; } - //////////////////////////////////////AR///////////////////////////////////////// + ////////////////////////////////////// AR///////////////////////////////////////// @SideOnly(Side.CLIENT) private static Set matchers; @@ -302,11 +305,12 @@ public void onAROpened() { Block block = ((ItemBlock) stack.getFirst().getItem()).getBlock(); if (block != Blocks.AIR) { - matchers.add(new BlockStateMatcher(block.getStateFromMeta(stack.getFirst().getMetadata()), stack.getSecond())); + matchers.add(new BlockStateMatcher(block.getStateFromMeta(stack.getFirst().getMetadata()), + stack.getSecond())); } } } - matchers.forEach(matcher->founds.put(matcher, new HashMap<>())); + matchers.forEach(matcher -> founds.put(matcher, new HashMap<>())); } @SideOnly(Side.CLIENT) @@ -317,17 +321,17 @@ private static List bresenhamCircle(int xc, int zc, int r) { z = r; d = 3 - 2 * r; circlePlot(blockPos, xc, zc, x, z); - while(x < z) { - if(d < 0) { + while (x < z) { + if (d < 0) { d = d + 4 * x + 6; } else { - d = d + 4 * ( x - z ) + 10; + d = d + 4 * (x - z) + 10; z--; } x++; circlePlot(blockPos, xc, zc, x, z); } - return blockPos; + return blockPos; } @SideOnly(Side.CLIENT) @@ -403,7 +407,7 @@ public void tickAR(EntityPlayer player) { for (BlockPos pos : bresenhamCircle(lastPos.getX(), lastPos.getZ(), radius)) { for (int y = minY; y <= maxY; y++) { for (IMatcher matcher : matchers) { - BlockPos blockPos =new BlockPos(pos.getX(), y, pos.getZ()); + BlockPos blockPos = new BlockPos(pos.getX(), y, pos.getZ()); if (matcher.match(world.getBlockState(blockPos))) { addCluster(blockPos, founds.get(matcher)); } @@ -466,7 +470,8 @@ private static void renderAxisAlignedBB(float partialTicks) { final float b = (color & 0xFF) / 255f; final float a = 1; for (AxisAlignedBB bound : founds.get(matcher).keySet()) { - RenderBufferHelper.renderCubeFace(buffer, bound.minX, bound.minY, bound.minZ, bound.maxX, bound.maxY, bound.maxZ, r, g, b, a); + RenderBufferHelper.renderCubeFace(buffer, bound.minX, bound.minY, bound.minZ, bound.maxX, bound.maxY, + bound.maxZ, r, g, b, a); } } diff --git a/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/BlockStateMatcher.java b/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/BlockStateMatcher.java index a0f64ef8a0b..1848972b122 100644 --- a/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/BlockStateMatcher.java +++ b/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/BlockStateMatcher.java @@ -7,7 +7,8 @@ import java.util.List; import java.util.Objects; -public class BlockStateMatcher implements IMatcher{ +public class BlockStateMatcher implements IMatcher { + private final IBlockState reference; private final List> properties = new ArrayList<>(); private final int meta; @@ -17,7 +18,8 @@ public BlockStateMatcher(IBlockState state, int color) { this.reference = state; for (final IProperty property : state.getPropertyKeys()) { if (Objects.equals(property.getName(), "variant") || // Vanilla Minecraft. - Objects.equals(property.getName(), "type") || // E.g. ThermalFoundation, TiCon, IC2, Immersive Engineering. + Objects.equals(property.getName(), "type") || // E.g. ThermalFoundation, TiCon, IC2, Immersive + // Engineering. Objects.equals(property.getName(), "ore") || // E.g. BigReactors. Objects.equals(property.getName(), "oretype") || // E.g. DeepResonance. Objects.equals(property.getName(), "stone_type") || // E.g. gtce. @@ -27,7 +29,6 @@ public BlockStateMatcher(IBlockState state, int color) { } this.meta = reference.getBlock().getMetaFromState(reference); this.color = color; - } public boolean match(final IBlockState state) { @@ -56,7 +57,7 @@ public boolean match(final IBlockState state) { } @Override - public int getColor() { + public int getColor() { return color; } diff --git a/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/IMatcher.java b/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/IMatcher.java index 0d23e42e1ef..c96a6c22c36 100644 --- a/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/IMatcher.java +++ b/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/IMatcher.java @@ -10,6 +10,8 @@ * @Description: */ public interface IMatcher { + boolean match(final IBlockState state); + int getColor(); } diff --git a/src/main/java/gregtech/common/terminal/component/ClickComponent.java b/src/main/java/gregtech/common/terminal/component/ClickComponent.java index 4e41ac96637..24031ee4c73 100644 --- a/src/main/java/gregtech/common/terminal/component/ClickComponent.java +++ b/src/main/java/gregtech/common/terminal/component/ClickComponent.java @@ -7,6 +7,7 @@ import java.util.function.Consumer; public class ClickComponent implements IMenuComponent { + private IGuiTexture icon; private String hoverText; private Consumer consumer; diff --git a/src/main/java/gregtech/common/terminal/component/SearchComponent.java b/src/main/java/gregtech/common/terminal/component/SearchComponent.java index 22d7ef70386..b0b99d8f154 100644 --- a/src/main/java/gregtech/common/terminal/component/SearchComponent.java +++ b/src/main/java/gregtech/common/terminal/component/SearchComponent.java @@ -9,6 +9,7 @@ import gregtech.api.terminal.os.menu.IMenuComponent; import gregtech.api.terminal.util.ISearch; import gregtech.api.terminal.util.SearchEngine; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.util.Tuple; @@ -18,6 +19,7 @@ import java.util.List; public class SearchComponent extends WidgetGroup implements IMenuComponent { + private final static TextureArea SEARCHING = TextureArea.fullImage("textures/gui/terminal/icon/search_hover.png"); private final static int SIZE = 10; private final SearchEngine engine; @@ -26,14 +28,14 @@ public class SearchComponent extends WidgetGroup implements IMenuComponent { private boolean isUp; private int offset; - public SearchComponent(IWidgetSearch search){ - super(0,0,280,20); + public SearchComponent(IWidgetSearch search) { + super(0, 0, 280, 20); this.search = search; results = new ArrayList<>(); engine = new SearchEngine<>(search, r -> results.add(new Tuple<>(r, search.resultDisplay(r)))); this.addWidget(new TextFieldWidget(0, 5, 280, 20, new ColorRectTexture(0xcf000000), null, null) - .setValidator(s->true) - .setTextResponder(s->{ + .setValidator(s -> true) + .setTextResponder(s -> { results.clear(); engine.searchWord(s); offset = 0; @@ -107,8 +109,10 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { return super.mouseWheelMove(mouseX, mouseY, wheelDelta); } - public interface IWidgetSearch extends ISearch{ + public interface IWidgetSearch extends ISearch { + String resultDisplay(T result); + void selectResult(T result); } } diff --git a/src/main/java/gregtech/common/terminal/component/setting/GuiTextureSetter.java b/src/main/java/gregtech/common/terminal/component/setting/GuiTextureSetter.java index bd0618ccf28..add78dfa301 100644 --- a/src/main/java/gregtech/common/terminal/component/setting/GuiTextureSetter.java +++ b/src/main/java/gregtech/common/terminal/component/setting/GuiTextureSetter.java @@ -6,7 +6,8 @@ import java.util.function.Consumer; -public class GuiTextureSetter extends WidgetGroup implements ISetting{ +public class GuiTextureSetter extends WidgetGroup implements ISetting { + private final String name; private Consumer updated; diff --git a/src/main/java/gregtech/common/terminal/component/setting/ISetting.java b/src/main/java/gregtech/common/terminal/component/setting/ISetting.java index db0649d75b0..2b3f2fa05d2 100644 --- a/src/main/java/gregtech/common/terminal/component/setting/ISetting.java +++ b/src/main/java/gregtech/common/terminal/component/setting/ISetting.java @@ -4,7 +4,10 @@ import gregtech.api.gui.resources.IGuiTexture; public interface ISetting { + String getName(); + IGuiTexture getIcon(); + Widget getWidget(); } diff --git a/src/main/java/gregtech/common/terminal/component/setting/IWidgetSettings.java b/src/main/java/gregtech/common/terminal/component/setting/IWidgetSettings.java index 94a2f13db4a..e3affc80eb1 100644 --- a/src/main/java/gregtech/common/terminal/component/setting/IWidgetSettings.java +++ b/src/main/java/gregtech/common/terminal/component/setting/IWidgetSettings.java @@ -3,5 +3,6 @@ import gregtech.api.terminal.util.TreeNode; public interface IWidgetSettings { + TreeNode getSettings(); } diff --git a/src/main/java/gregtech/common/terminal/component/setting/SettingComponent.java b/src/main/java/gregtech/common/terminal/component/setting/SettingComponent.java index 74397632eae..1f011df5a03 100644 --- a/src/main/java/gregtech/common/terminal/component/setting/SettingComponent.java +++ b/src/main/java/gregtech/common/terminal/component/setting/SettingComponent.java @@ -7,6 +7,7 @@ import gregtech.api.terminal.os.menu.IMenuComponent; public class SettingComponent extends WidgetGroup implements IMenuComponent { + private Widget settingWidget; public SettingComponent(IWidgetSettings settings) { @@ -25,5 +26,4 @@ public SettingComponent(IWidgetSettings settings) { .setNodeTexture(GuiTextures.BORDERED_BACKGROUND) .setLeafTexture(GuiTextures.SLOT_DARKENED)); } - } diff --git a/src/main/java/gregtech/common/terminal/hardware/BatteryHardware.java b/src/main/java/gregtech/common/terminal/hardware/BatteryHardware.java index 5f93d46de0a..141baa80c02 100644 --- a/src/main/java/gregtech/common/terminal/hardware/BatteryHardware.java +++ b/src/main/java/gregtech/common/terminal/hardware/BatteryHardware.java @@ -9,16 +9,18 @@ import gregtech.api.terminal.hardware.Hardware; import gregtech.api.terminal.hardware.IHardwareCapability; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.capabilities.Capability; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.function.BiConsumer; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Created with IntelliJ IDEA. * @@ -27,14 +29,15 @@ * @Description: */ public class BatteryHardware extends Hardware implements IElectricItem, IHardwareCapability { + protected final List> listeners = new ArrayList<>(); - public BatteryHardware() { - } + public BatteryHardware() {} @Override public boolean isHardwareAdequate(Hardware demand) { - return demand instanceof BatteryHardware && ((BatteryHardware) demand).getTier() <= this.getTier() && this.getCharge() > 0; + return demand instanceof BatteryHardware && ((BatteryHardware) demand).getTier() <= this.getTier() && + this.getCharge() > 0; } @Override @@ -127,7 +130,8 @@ public long charge(long amount, int chargerTier, boolean ignoreTransferLimit, bo } @Override - public long discharge(long amount, int chargerTier, boolean ignoreTransferLimit, boolean externally, boolean simulate) { + public long discharge(long amount, int chargerTier, boolean ignoreTransferLimit, boolean externally, + boolean simulate) { if (provider.getItemStack().getCount() != 1) { return 0L; } @@ -158,7 +162,8 @@ public boolean hasCapability(@Nonnull Capability capability) { @Nullable @Override public T getCapability(@Nonnull Capability capability) { - return capability == GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM ? GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM.cast(this) : null; + return capability == GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM ? + GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM.cast(this) : null; } @Override diff --git a/src/main/java/gregtech/common/terminal/hardware/DeviceHardware.java b/src/main/java/gregtech/common/terminal/hardware/DeviceHardware.java index 43bfe52072f..ccfa77d077d 100644 --- a/src/main/java/gregtech/common/terminal/hardware/DeviceHardware.java +++ b/src/main/java/gregtech/common/terminal/hardware/DeviceHardware.java @@ -5,6 +5,7 @@ import gregtech.api.items.metaitem.MetaItem; import gregtech.api.terminal.hardware.Hardware; import gregtech.common.items.MetaItems; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -12,6 +13,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class DeviceHardware extends Hardware { + private final int slot; public DeviceHardware(int slot) { @@ -77,7 +79,8 @@ public DEVICE getDevice() { return DEVICE.values()[getNBT().getInteger("d") % DEVICE.values().length]; } - public enum DEVICE{ + public enum DEVICE { + PROSPECTOR_LV(MetaItems.PROSPECTOR_LV, "prospector"), PROSPECTOR_HV(MetaItems.PROSPECTOR_HV, "advanced_prospector"), WIRELESS(MetaItems.WIRELESS, "wireless"), @@ -92,14 +95,16 @@ public enum DEVICE{ ItemStack itemStack; String name; - DEVICE(ItemStack itemStack, String name){ + DEVICE(ItemStack itemStack, String name) { this.itemStack = itemStack; this.name = name; } - DEVICE(MetaItem.MetaValueItem metaItem, String name){ + + DEVICE(MetaItem.MetaValueItem metaItem, String name) { this.itemStack = metaItem.getStackForm(); this.name = name; } + public static DEVICE fromString(String name) { for (DEVICE device : values()) { if (device.name.equals(name.toLowerCase())) { @@ -110,7 +115,8 @@ public static DEVICE fromString(String name) { } } - public static class DeviceDemand extends DeviceHardware{ + public static class DeviceDemand extends DeviceHardware { + private final DEVICE device; public DeviceDemand(DEVICE device) { diff --git a/src/main/java/gregtech/common/worldgen/AbstractItemLootEntry.java b/src/main/java/gregtech/common/worldgen/AbstractItemLootEntry.java index ce71d0cb941..4b578cc3a74 100644 --- a/src/main/java/gregtech/common/worldgen/AbstractItemLootEntry.java +++ b/src/main/java/gregtech/common/worldgen/AbstractItemLootEntry.java @@ -1,7 +1,5 @@ package gregtech.common.worldgen; -import com.google.gson.JsonObject; -import com.google.gson.JsonSerializationContext; import net.minecraft.item.ItemStack; import net.minecraft.world.storage.loot.LootContext; import net.minecraft.world.storage.loot.LootEntry; @@ -9,15 +7,20 @@ import net.minecraft.world.storage.loot.conditions.LootConditionManager; import net.minecraft.world.storage.loot.functions.LootFunction; -import javax.annotation.Nonnull; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; + import java.util.Collection; import java.util.Random; +import javax.annotation.Nonnull; + public abstract class AbstractItemLootEntry extends LootEntry { private final LootFunction[] functions; - protected AbstractItemLootEntry(int weightIn, int qualityIn, LootFunction[] functionsIn, LootCondition[] conditionsIn, String entryName) { + protected AbstractItemLootEntry(int weightIn, int qualityIn, LootFunction[] functionsIn, + LootCondition[] conditionsIn, String entryName) { super(weightIn, qualityIn, conditionsIn, entryName); this.functions = functionsIn; } diff --git a/src/main/java/gregtech/common/worldgen/LootEntryMetaItem.java b/src/main/java/gregtech/common/worldgen/LootEntryMetaItem.java index 55e77227bfa..016d2a71def 100644 --- a/src/main/java/gregtech/common/worldgen/LootEntryMetaItem.java +++ b/src/main/java/gregtech/common/worldgen/LootEntryMetaItem.java @@ -1,19 +1,22 @@ package gregtech.common.worldgen; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonObject; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.MetaItem.MetaValueItem; + import net.minecraft.item.ItemStack; import net.minecraft.util.JsonUtils; import net.minecraft.world.storage.loot.conditions.LootCondition; import net.minecraft.world.storage.loot.functions.LootFunction; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; + public class LootEntryMetaItem extends AbstractItemLootEntry { private final MetaValueItem metaValueItem; - protected LootEntryMetaItem(MetaValueItem metaValueItem, int weightIn, int qualityIn, LootFunction[] functionsIn, LootCondition[] conditionsIn, String entryName) { + protected LootEntryMetaItem(MetaValueItem metaValueItem, int weightIn, int qualityIn, LootFunction[] functionsIn, + LootCondition[] conditionsIn, String entryName) { super(weightIn, qualityIn, functionsIn, conditionsIn, entryName); this.metaValueItem = metaValueItem; } @@ -31,7 +34,8 @@ public static MetaValueItem getMetaItem(String name) { .findFirst().orElse(null); } - public static LootEntryMetaItem deserialize(JsonObject object, JsonDeserializationContext context, int weight, int quality, LootCondition[] conditions) { + public static LootEntryMetaItem deserialize(JsonObject object, JsonDeserializationContext context, int weight, + int quality, LootCondition[] conditions) { String entryName = net.minecraftforge.common.ForgeHooks.readLootEntryName(object, "item"); LootFunction[] lootFunctions; if (object.has("functions")) { diff --git a/src/main/java/gregtech/common/worldgen/LootEntryOreDict.java b/src/main/java/gregtech/common/worldgen/LootEntryOreDict.java index 377a02d8169..991fa19d883 100644 --- a/src/main/java/gregtech/common/worldgen/LootEntryOreDict.java +++ b/src/main/java/gregtech/common/worldgen/LootEntryOreDict.java @@ -1,18 +1,21 @@ package gregtech.common.worldgen; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonObject; import gregtech.api.unification.OreDictUnifier; + import net.minecraft.item.ItemStack; import net.minecraft.util.JsonUtils; import net.minecraft.world.storage.loot.conditions.LootCondition; import net.minecraft.world.storage.loot.functions.LootFunction; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; + public class LootEntryOreDict extends AbstractItemLootEntry { private final String oreDictName; - protected LootEntryOreDict(String oreDictName, int weightIn, int qualityIn, LootFunction[] functionsIn, LootCondition[] conditionsIn, String entryName) { + protected LootEntryOreDict(String oreDictName, int weightIn, int qualityIn, LootFunction[] functionsIn, + LootCondition[] conditionsIn, String entryName) { super(weightIn, qualityIn, functionsIn, conditionsIn, entryName); this.oreDictName = oreDictName; } @@ -22,8 +25,8 @@ protected ItemStack createItemStack() { return OreDictUnifier.get(oreDictName); } - public static LootEntryOreDict deserialize(JsonObject object, JsonDeserializationContext context, int weight, int quality, LootCondition[] conditions) { - + public static LootEntryOreDict deserialize(JsonObject object, JsonDeserializationContext context, int weight, + int quality, LootCondition[] conditions) { String entryName = net.minecraftforge.common.ForgeHooks.readLootEntryName(object, "item"); LootFunction[] lootFunctions; if (object.has("functions")) { diff --git a/src/main/java/gregtech/common/worldgen/LootTableHelper.java b/src/main/java/gregtech/common/worldgen/LootTableHelper.java index 6df40234524..0f288beece1 100644 --- a/src/main/java/gregtech/common/worldgen/LootTableHelper.java +++ b/src/main/java/gregtech/common/worldgen/LootTableHelper.java @@ -1,8 +1,7 @@ package gregtech.common.worldgen; -import com.google.common.collect.Lists; -import com.google.gson.*; import gregtech.api.util.GTLog; + import net.minecraft.item.ItemStack; import net.minecraft.util.JsonUtils; import net.minecraft.util.math.MathHelper; @@ -12,6 +11,9 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; +import com.google.common.collect.Lists; +import com.google.gson.*; + import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.lang.reflect.Type; @@ -23,10 +25,13 @@ public class LootTableHelper { private static final Map> serializerMap = new HashMap<>(); public interface LootTableEntrySerializer { - T deserialize(JsonObject object, JsonDeserializationContext deserializationContext, int weightIn, int qualityIn, LootCondition[] conditionsIn); + + T deserialize(JsonObject object, JsonDeserializationContext deserializationContext, int weightIn, int qualityIn, + LootCondition[] conditionsIn); } public interface SerializableLootEntry { + String getType(); int getWeight(); @@ -58,20 +63,22 @@ public static void initialize() { registerLootEntry("gregtech:ore_dict", LootEntryOreDict::deserialize); } - private static class LootTableEntrySerializerDelegate implements JsonSerializer, JsonDeserializer { + private static class LootTableEntrySerializerDelegate implements JsonSerializer, + JsonDeserializer { private final JsonSerializer delegatedSerializer; private final JsonDeserializer delegatedDeserializer; - @SuppressWarnings("unchecked") - public LootTableEntrySerializerDelegate(JsonSerializer delegatedSerializer, JsonDeserializer delegatedDeserializer) { + public LootTableEntrySerializerDelegate(JsonSerializer delegatedSerializer, + JsonDeserializer delegatedDeserializer) { this.delegatedSerializer = (JsonSerializer) delegatedSerializer; this.delegatedDeserializer = (JsonDeserializer) delegatedDeserializer; } @Override - public LootEntry deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + public LootEntry deserialize(JsonElement json, Type typeOfT, + JsonDeserializationContext context) throws JsonParseException { JsonObject jsonobject = JsonUtils.getJsonObject(json, "loot item"); String type = JsonUtils.getString(jsonobject, "type"); if (serializerMap.containsKey(type)) { @@ -79,7 +86,8 @@ public LootEntry deserialize(JsonElement json, Type typeOfT, JsonDeserialization int quality = JsonUtils.getInt(jsonobject, "quality", 0); LootCondition[] lootConditions; if (jsonobject.has("conditions")) { - lootConditions = JsonUtils.deserializeClass(jsonobject, "conditions", context, LootCondition[].class); + lootConditions = JsonUtils.deserializeClass(jsonobject, "conditions", context, + LootCondition[].class); } else { lootConditions = new LootCondition[0]; } @@ -108,13 +116,14 @@ public JsonElement serialize(LootEntry src, Type typeOfSrc, JsonSerializationCon } } - @SuppressWarnings("unchecked") - private static void replaceGsonTypeHierarchySerializer(Gson gson, Class type, BiFunction, JsonDeserializer, Object> replacer) { + private static void replaceGsonTypeHierarchySerializer(Gson gson, Class type, + BiFunction, JsonDeserializer, Object> replacer) { try { Field field = Gson.class.getDeclaredField("factories"); field.setAccessible(true); - Class singleTypeFactoryClass = Class.forName("com.google.gson.internal.bind.TreeTypeAdapter$SingleTypeFactory"); + Class singleTypeFactoryClass = Class + .forName("com.google.gson.internal.bind.TreeTypeAdapter$SingleTypeFactory"); Field hierarchyTypeField = singleTypeFactoryClass.getDeclaredField("hierarchyType"); hierarchyTypeField.setAccessible(true); List factories = (List) field.get(gson); diff --git a/src/main/java/gregtech/common/worldgen/WorldGenRubberTree.java b/src/main/java/gregtech/common/worldgen/WorldGenRubberTree.java index 2eacfd8c395..b39f31569cf 100644 --- a/src/main/java/gregtech/common/worldgen/WorldGenRubberTree.java +++ b/src/main/java/gregtech/common/worldgen/WorldGenRubberTree.java @@ -1,6 +1,7 @@ package gregtech.common.worldgen; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; @@ -11,9 +12,10 @@ import net.minecraftforge.event.terraingen.SaplingGrowTreeEvent; import net.minecraftforge.fml.common.eventhandler.Event; -import javax.annotation.Nonnull; import java.util.Random; +import javax.annotation.Nonnull; + import static gregtech.common.blocks.wood.BlockRubberLog.NATURAL; public class WorldGenRubberTree extends WorldGenerator { @@ -66,8 +68,9 @@ public boolean grow(World world, BlockPos pos, Random random) { int dx = Math.abs(cx - pos.getX()); int dz = Math.abs(cz - pos.getZ()); if ((dx <= 1 && dz <= 1) || (dx <= 1 && random - .nextInt(chance) == 0) || (dz <= 1 && random - .nextInt(chance) == 0)) { + .nextInt(chance) == 0) || (dz <= 1 && + random + .nextInt(chance) == 0)) { tmpPos.setPos(cx, pos.getY() + cHeight, cz); if (world.isAirBlock(tmpPos)) { setBlockAndNotifyAdequately(world, new BlockPos(tmpPos), leaves); @@ -90,8 +93,8 @@ public int getGrowHeight(@Nonnull World world, @Nonnull BlockPos pos) { IBlockState baseState = world.getBlockState(below); Block baseBlock = baseState.getBlock(); if (baseBlock.isAir(baseState, world, below) || - !baseBlock.canSustainPlant(baseState, world, below, EnumFacing.UP, MetaBlocks.RUBBER_SAPLING) || ( - !world.isAirBlock(pos.up()) && world.getBlockState(pos.up()).getBlock() != MetaBlocks.RUBBER_SAPLING)) + !baseBlock.canSustainPlant(baseState, world, below, EnumFacing.UP, MetaBlocks.RUBBER_SAPLING) || + (!world.isAirBlock(pos.up()) && world.getBlockState(pos.up()).getBlock() != MetaBlocks.RUBBER_SAPLING)) return 0; int height = 1; pos = pos.up(); diff --git a/src/main/java/gregtech/core/CoreModule.java b/src/main/java/gregtech/core/CoreModule.java index 88ca4b65d0c..4899ce55371 100644 --- a/src/main/java/gregtech/core/CoreModule.java +++ b/src/main/java/gregtech/core/CoreModule.java @@ -54,6 +54,7 @@ import gregtech.core.unification.material.internal.MaterialRegistryManager; import gregtech.loaders.dungeon.DungeonLootLoader; import gregtech.modules.GregTechModules; + import net.minecraft.block.state.IBlockState; import net.minecraft.world.World; import net.minecraftforge.classloading.FMLForgePlugin; @@ -63,26 +64,29 @@ import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.*; import net.minecraftforge.fml.relauncher.Side; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import javax.annotation.Nonnull; import java.util.Map; +import javax.annotation.Nonnull; + import static gregtech.api.GregTechAPI.*; @GregTechModule( - moduleID = GregTechModules.MODULE_CORE, - containerID = GTValues.MODID, - name = "GregTech Core", - description = "Core GregTech content. Disabling this disables the entire mod and all its addons.", - coreModule = true -) + moduleID = GregTechModules.MODULE_CORE, + containerID = GTValues.MODID, + name = "GregTech Core", + description = "Core GregTech content. Disabling this disables the entire mod and all its addons.", + coreModule = true) public class CoreModule implements IGregTechModule { public static final Logger logger = LogManager.getLogger("GregTech Core"); - @SidedProxy(modId = GTValues.MODID, clientSide = "gregtech.client.ClientProxy", serverSide = "gregtech.common.CommonProxy") + @SidedProxy(modId = GTValues.MODID, + clientSide = "gregtech.client.ClientProxy", + serverSide = "gregtech.common.CommonProxy") public static CommonProxy proxy; public CoreModule() { @@ -204,10 +208,12 @@ public void init(FMLInitializationEvent event) { proxy.onLoad(); if (RecipeMap.isFoundInvalidRecipe()) { logger.fatal("Seems like invalid recipe was found."); - //crash if config setting is set to false, or we are in deobfuscated environment + // crash if config setting is set to false, or we are in deobfuscated environment if (!ConfigHolder.misc.ignoreErrorOrInvalidRecipes || !FMLForgePlugin.RUNTIME_DEOBF) { - logger.fatal("Loading cannot continue. Either fix or report invalid recipes, or enable ignoreErrorOrInvalidRecipes in the config as a temporary solution"); - throw new LoaderException("Found at least one invalid recipe. Please read the log above for more details."); + logger.fatal( + "Loading cannot continue. Either fix or report invalid recipes, or enable ignoreErrorOrInvalidRecipes in the config as a temporary solution"); + throw new LoaderException( + "Found at least one invalid recipe. Please read the log above for more details."); } else { logger.fatal("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); logger.fatal("Ignoring invalid recipes and continuing loading"); @@ -273,7 +279,8 @@ public void serverStarted(FMLServerStartedEvent event) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { World world = FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld(); if (!world.isRemote) { - BedrockFluidVeinSaveData saveData = (BedrockFluidVeinSaveData) world.loadData(BedrockFluidVeinSaveData.class, BedrockFluidVeinSaveData.dataName); + BedrockFluidVeinSaveData saveData = (BedrockFluidVeinSaveData) world + .loadData(BedrockFluidVeinSaveData.class, BedrockFluidVeinSaveData.dataName); if (saveData == null) { saveData = new BedrockFluidVeinSaveData(BedrockFluidVeinSaveData.dataName); world.setData(BedrockFluidVeinSaveData.dataName, saveData); diff --git a/src/main/java/gregtech/core/advancement/criterion/AbstractCriterion.java b/src/main/java/gregtech/core/advancement/criterion/AbstractCriterion.java index 4bd7057c501..46737ccab59 100644 --- a/src/main/java/gregtech/core/advancement/criterion/AbstractCriterion.java +++ b/src/main/java/gregtech/core/advancement/criterion/AbstractCriterion.java @@ -1,6 +1,7 @@ package gregtech.core.advancement.criterion; import gregtech.api.advancement.IAdvancementCriterion; + import net.minecraft.util.ResourceLocation; import javax.annotation.Nonnull; diff --git a/src/main/java/gregtech/core/advancement/internal/AdvancementListeners.java b/src/main/java/gregtech/core/advancement/internal/AdvancementListeners.java index a5a44060c3d..d5ad2bba555 100644 --- a/src/main/java/gregtech/core/advancement/internal/AdvancementListeners.java +++ b/src/main/java/gregtech/core/advancement/internal/AdvancementListeners.java @@ -1,12 +1,14 @@ package gregtech.core.advancement.internal; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; import gregtech.api.advancement.IAdvancementCriterion; + import net.minecraft.advancements.ICriterionTrigger.Listener; import net.minecraft.advancements.PlayerAdvancements; import net.minecraft.entity.player.EntityPlayerMP; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; + import java.util.List; import java.util.Set; diff --git a/src/main/java/gregtech/core/advancement/internal/AdvancementManager.java b/src/main/java/gregtech/core/advancement/internal/AdvancementManager.java index ed5167ca768..d1cde600d6b 100644 --- a/src/main/java/gregtech/core/advancement/internal/AdvancementManager.java +++ b/src/main/java/gregtech/core/advancement/internal/AdvancementManager.java @@ -6,14 +6,14 @@ import gregtech.api.advancement.IAdvancementTrigger; import gregtech.api.modules.ModuleStage; import gregtech.core.CoreModule; + import net.minecraft.advancements.CriteriaTriggers; public class AdvancementManager implements IAdvancementManager { private static final AdvancementManager INSTANCE = new AdvancementManager(); - private AdvancementManager() { - } + private AdvancementManager() {} public static AdvancementManager getInstance() { return INSTANCE; @@ -22,7 +22,8 @@ public static AdvancementManager getInstance() { @Override public IAdvancementTrigger registerTrigger(String id, T criterion) { if (GregTechAPI.moduleManager.hasPassedStage(ModuleStage.PRE_INIT)) { - CoreModule.logger.error("Could not register advancement trigger {}, as trigger registration has ended!", id); + CoreModule.logger.error("Could not register advancement trigger {}, as trigger registration has ended!", + id); return null; } IAdvancementTrigger trigger = new AdvancementTrigger<>(id, criterion); diff --git a/src/main/java/gregtech/core/advancement/internal/AdvancementTrigger.java b/src/main/java/gregtech/core/advancement/internal/AdvancementTrigger.java index b480b47b8ab..8117511b7b9 100644 --- a/src/main/java/gregtech/core/advancement/internal/AdvancementTrigger.java +++ b/src/main/java/gregtech/core/advancement/internal/AdvancementTrigger.java @@ -1,18 +1,21 @@ package gregtech.core.advancement.internal; -import com.google.common.collect.Maps; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonObject; import gregtech.api.advancement.IAdvancementCriterion; import gregtech.api.advancement.IAdvancementTrigger; import gregtech.api.util.GTUtility; + import net.minecraft.advancements.PlayerAdvancements; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.ResourceLocation; -import javax.annotation.Nonnull; +import com.google.common.collect.Maps; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; + import java.util.Map; +import javax.annotation.Nonnull; + public class AdvancementTrigger implements IAdvancementTrigger { private final ResourceLocation id; diff --git a/src/main/java/gregtech/core/command/internal/CommandManager.java b/src/main/java/gregtech/core/command/internal/CommandManager.java index 8f1169477af..39b489939ac 100644 --- a/src/main/java/gregtech/core/command/internal/CommandManager.java +++ b/src/main/java/gregtech/core/command/internal/CommandManager.java @@ -1,6 +1,7 @@ package gregtech.core.command.internal; import gregtech.api.command.ICommandManager; + import net.minecraft.command.ICommand; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.server.command.CommandTreeBase; diff --git a/src/main/java/gregtech/core/command/internal/GregTechCommand.java b/src/main/java/gregtech/core/command/internal/GregTechCommand.java index 733dc8a8a5e..f0f18a7e3f0 100644 --- a/src/main/java/gregtech/core/command/internal/GregTechCommand.java +++ b/src/main/java/gregtech/core/command/internal/GregTechCommand.java @@ -1,7 +1,7 @@ package gregtech.core.command.internal; -import com.google.common.collect.Lists; import gregtech.api.util.ClipboardUtil; + import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; @@ -12,9 +12,12 @@ import net.minecraft.util.text.TextFormatting; import net.minecraftforge.server.command.CommandTreeBase; -import javax.annotation.Nonnull; +import com.google.common.collect.Lists; + import java.util.List; +import javax.annotation.Nonnull; + class GregTechCommand extends CommandTreeBase { @Nonnull @@ -36,7 +39,8 @@ public String getUsage(@Nonnull ICommandSender sender) { } @Override - public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, String[] args) throws CommandException { + public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, + String[] args) throws CommandException { if (args.length > 0) { if (args[0].equals("copy")) { StringBuilder message = new StringBuilder(); @@ -50,14 +54,16 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen if (sender.getCommandSenderEntity() instanceof EntityPlayerMP) { ClipboardUtil.copyToClipboard((EntityPlayerMP) sender.getCommandSenderEntity(), message.toString()); sender.sendMessage(new TextComponentTranslation("gregtech.command.copy.copied_start") - .appendSibling(new TextComponentString(message.toString()).setStyle(new Style().setColor(TextFormatting.GOLD))) + .appendSibling(new TextComponentString(message.toString()) + .setStyle(new Style().setColor(TextFormatting.GOLD))) .appendSibling(new TextComponentTranslation("gregtech.command.copy.copied_end"))); } return; } if (args[0].equals("util")) { if (sender.getCommandSenderEntity() instanceof EntityPlayerMP) { - sender.sendMessage(new TextComponentString("\u00A76/gt util hand\u00A7r was yeeted. The new command is \u00A76/gt hand\u00A7r")); + sender.sendMessage(new TextComponentString( + "\u00A76/gt util hand\u00A7r was yeeted. The new command is \u00A76/gt hand\u00A7r")); } return; } diff --git a/src/main/java/gregtech/core/network/NetworkUtils.java b/src/main/java/gregtech/core/network/NetworkUtils.java index 13194fd359c..1b690192c17 100644 --- a/src/main/java/gregtech/core/network/NetworkUtils.java +++ b/src/main/java/gregtech/core/network/NetworkUtils.java @@ -1,7 +1,5 @@ package gregtech.core.network; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import net.minecraft.block.state.IBlockState; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; @@ -10,6 +8,9 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + public class NetworkUtils { public static void writePacketBuffer(PacketBuffer writeTo, PacketBuffer writeFrom) { @@ -33,6 +34,7 @@ public static IBlockState getIBlockStateServer(int dimension, BlockPos pos) { } public static NetworkRegistry.TargetPoint blockPoint(World world, BlockPos blockPos) { - return new NetworkRegistry.TargetPoint(world.provider.getDimension(), blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5, 128.0); + return new NetworkRegistry.TargetPoint(world.provider.getDimension(), blockPos.getX() + 0.5, + blockPos.getY() + 0.5, blockPos.getZ() + 0.5, 128.0); } } diff --git a/src/main/java/gregtech/core/network/internal/NetworkHandler.java b/src/main/java/gregtech/core/network/internal/NetworkHandler.java index 5ef87737917..60849c35415 100644 --- a/src/main/java/gregtech/core/network/internal/NetworkHandler.java +++ b/src/main/java/gregtech/core/network/internal/NetworkHandler.java @@ -1,14 +1,14 @@ package gregtech.core.network.internal; import gregtech.api.GTValues; +import gregtech.api.GregTechAPI; +import gregtech.api.modules.ModuleStage; import gregtech.api.network.IClientExecutor; import gregtech.api.network.INetworkHandler; import gregtech.api.network.IPacket; import gregtech.api.network.IServerExecutor; -import gregtech.api.GregTechAPI; -import gregtech.api.modules.ModuleStage; import gregtech.core.CoreModule; -import io.netty.buffer.Unpooled; + import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; @@ -25,6 +25,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import io.netty.buffer.Unpooled; + public class NetworkHandler implements INetworkHandler { private static final NetworkHandler INSTANCE = new NetworkHandler(); @@ -44,7 +46,8 @@ public static INetworkHandler getInstance() { public void registerPacket(Class packetClass) { if (GregTechAPI.moduleManager.hasPassedStage(ModuleStage.PRE_INIT)) { - CoreModule.logger.error("Could not register packet {}, as packet registration has ended!", packetClass.getName()); + CoreModule.logger.error("Could not register packet {}, as packet registration has ended!", + packetClass.getName()); return; } @@ -52,11 +55,15 @@ public void registerPacket(Class packetClass) { boolean hasClientExecutor = IClientExecutor.class.isAssignableFrom(packetClass); if (hasServerExecutor && hasClientExecutor) { - CoreModule.logger.error("Could not register packet {}, as it is both a Server and Client executor! Only one allowed. Skipping...", packetClass.getName()); + CoreModule.logger.error( + "Could not register packet {}, as it is both a Server and Client executor! Only one allowed. Skipping...", + packetClass.getName()); return; } if (!hasServerExecutor && !hasClientExecutor) { - CoreModule.logger.error("Could not register packet {}, as it does not have an executor! Must have either IServerExecutor OR IClientExecutor. Skipping...", packetClass.getName()); + CoreModule.logger.error( + "Could not register packet {}, as it does not have an executor! Must have either IServerExecutor OR IClientExecutor. Skipping...", + packetClass.getName()); return; } packetHandler.registerPacket(packetClass); diff --git a/src/main/java/gregtech/core/network/internal/PacketHandler.java b/src/main/java/gregtech/core/network/internal/PacketHandler.java index ed299d511d2..975f46c7f82 100644 --- a/src/main/java/gregtech/core/network/internal/PacketHandler.java +++ b/src/main/java/gregtech/core/network/internal/PacketHandler.java @@ -1,6 +1,7 @@ package gregtech.core.network.internal; import gregtech.api.network.IPacket; + import net.minecraft.util.IntIdentityHashBiMap; public class PacketHandler { @@ -31,4 +32,3 @@ public Class getPacketClass(int packetId) { return packetMap.get(packetId); } } - diff --git a/src/main/java/gregtech/core/network/packets/PacketBlockParticle.java b/src/main/java/gregtech/core/network/packets/PacketBlockParticle.java index d77f466371a..91b017465e2 100644 --- a/src/main/java/gregtech/core/network/packets/PacketBlockParticle.java +++ b/src/main/java/gregtech/core/network/packets/PacketBlockParticle.java @@ -1,9 +1,9 @@ package gregtech.core.network.packets; -import codechicken.lib.vec.Vector3; import gregtech.api.block.ICustomParticleBlock; import gregtech.api.network.IClientExecutor; import gregtech.api.network.IPacket; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetHandlerPlayClient; @@ -14,6 +14,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.vec.Vector3; + public class PacketBlockParticle implements IPacket, IClientExecutor { private BlockPos blockPos; @@ -51,6 +53,7 @@ public void executeClient(NetHandlerPlayClient handler) { World world = Minecraft.getMinecraft().world; IBlockState blockState = world.getBlockState(blockPos); ParticleManager particleManager = Minecraft.getMinecraft().effectRenderer; - ((ICustomParticleBlock) blockState.getBlock()).handleCustomParticle(world, blockPos, particleManager, entityPos, particlesAmount); + ((ICustomParticleBlock) blockState.getBlock()).handleCustomParticle(world, blockPos, particleManager, entityPos, + particlesAmount); } } diff --git a/src/main/java/gregtech/core/network/packets/PacketClipboard.java b/src/main/java/gregtech/core/network/packets/PacketClipboard.java index 26fe1f3312d..04bee1cb681 100644 --- a/src/main/java/gregtech/core/network/packets/PacketClipboard.java +++ b/src/main/java/gregtech/core/network/packets/PacketClipboard.java @@ -3,6 +3,7 @@ import gregtech.api.network.IClientExecutor; import gregtech.api.network.IPacket; import gregtech.api.util.ClipboardUtil; + import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/gregtech/core/network/packets/PacketClipboardNBTUpdate.java b/src/main/java/gregtech/core/network/packets/PacketClipboardNBTUpdate.java index c01c8eaf4b0..6a9479cc34d 100644 --- a/src/main/java/gregtech/core/network/packets/PacketClipboardNBTUpdate.java +++ b/src/main/java/gregtech/core/network/packets/PacketClipboardNBTUpdate.java @@ -5,12 +5,14 @@ import gregtech.api.network.IServerExecutor; import gregtech.common.metatileentities.MetaTileEntityClipboard; import gregtech.core.network.NetworkUtils; + import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; public class PacketClipboardNBTUpdate implements IPacket, IServerExecutor { + private int dimension; private BlockPos pos; private int id; @@ -46,11 +48,12 @@ public void decode(PacketBuffer buf) { @Override public void executeServer(NetHandlerPlayServer handler) { TileEntity te = NetworkUtils.getTileEntityServer(dimension, pos); - if (te instanceof IGregTechTileEntity && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MetaTileEntityClipboard) { + if (te instanceof IGregTechTileEntity && + ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MetaTileEntityClipboard) { try { - ((MetaTileEntityClipboard) ((IGregTechTileEntity) te).getMetaTileEntity()).setClipboardNBT(updateData.readCompoundTag()); - } catch (Exception ignored) { - } + ((MetaTileEntityClipboard) ((IGregTechTileEntity) te).getMetaTileEntity()) + .setClipboardNBT(updateData.readCompoundTag()); + } catch (Exception ignored) {} } } } diff --git a/src/main/java/gregtech/core/network/packets/PacketClipboardUIWidgetUpdate.java b/src/main/java/gregtech/core/network/packets/PacketClipboardUIWidgetUpdate.java index d24ee9942a8..eee14f2340d 100644 --- a/src/main/java/gregtech/core/network/packets/PacketClipboardUIWidgetUpdate.java +++ b/src/main/java/gregtech/core/network/packets/PacketClipboardUIWidgetUpdate.java @@ -5,6 +5,7 @@ import gregtech.api.network.IServerExecutor; import gregtech.common.metatileentities.MetaTileEntityClipboard; import gregtech.core.network.NetworkUtils; + import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; @@ -47,8 +48,10 @@ public void decode(PacketBuffer buf) { @Override public void executeServer(NetHandlerPlayServer handler) { TileEntity te = NetworkUtils.getTileEntityServer(dimension, pos); - if (te instanceof IGregTechTileEntity && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MetaTileEntityClipboard) { - ((MetaTileEntityClipboard) ((IGregTechTileEntity) te).getMetaTileEntity()).readUIAction(handler.player, id, updateData); + if (te instanceof IGregTechTileEntity && + ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MetaTileEntityClipboard) { + ((MetaTileEntityClipboard) ((IGregTechTileEntity) te).getMetaTileEntity()).readUIAction(handler.player, id, + updateData); } } } diff --git a/src/main/java/gregtech/core/network/packets/PacketFluidVeinList.java b/src/main/java/gregtech/core/network/packets/PacketFluidVeinList.java index ff649a185d3..34dade2e3f0 100644 --- a/src/main/java/gregtech/core/network/packets/PacketFluidVeinList.java +++ b/src/main/java/gregtech/core/network/packets/PacketFluidVeinList.java @@ -3,6 +3,7 @@ import gregtech.api.network.IClientExecutor; import gregtech.api.network.IPacket; import gregtech.api.worldgen.bedrockFluids.BedrockFluidVeinHandler; + import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -42,7 +43,8 @@ public void decode(PacketBuffer buf) { NBTTagCompound tag = ByteBufUtils.readTag(buf); if (tag == null || tag.isEmpty()) continue; - BedrockFluidVeinHandler.FluidVeinWorldEntry entry = BedrockFluidVeinHandler.FluidVeinWorldEntry.readFromNBT(tag); + BedrockFluidVeinHandler.FluidVeinWorldEntry entry = BedrockFluidVeinHandler.FluidVeinWorldEntry + .readFromNBT(tag); this.map.put(entry, tag.getInteger("weight")); } } diff --git a/src/main/java/gregtech/core/network/packets/PacketKeysPressed.java b/src/main/java/gregtech/core/network/packets/PacketKeysPressed.java index d7f4f222491..8b5d4198f91 100644 --- a/src/main/java/gregtech/core/network/packets/PacketKeysPressed.java +++ b/src/main/java/gregtech/core/network/packets/PacketKeysPressed.java @@ -3,8 +3,10 @@ import gregtech.api.network.IPacket; import gregtech.api.network.IServerExecutor; import gregtech.api.util.input.KeyBind; + import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; + import org.apache.commons.lang3.tuple.Pair; import java.util.List; diff --git a/src/main/java/gregtech/core/network/packets/PacketNotifyCapeChange.java b/src/main/java/gregtech/core/network/packets/PacketNotifyCapeChange.java index c1b2d8d54f8..530d81b55af 100644 --- a/src/main/java/gregtech/core/network/packets/PacketNotifyCapeChange.java +++ b/src/main/java/gregtech/core/network/packets/PacketNotifyCapeChange.java @@ -3,6 +3,7 @@ import gregtech.api.network.IClientExecutor; import gregtech.api.network.IPacket; import gregtech.api.util.CapesRegistry; + import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; @@ -41,5 +42,4 @@ public void decode(PacketBuffer buf) { public void executeClient(NetHandlerPlayClient handler) { CapesRegistry.giveRawCape(uuid, cape); } - } diff --git a/src/main/java/gregtech/core/network/packets/PacketPluginSynced.java b/src/main/java/gregtech/core/network/packets/PacketPluginSynced.java index 16c8cf3ec70..a2dd163919b 100644 --- a/src/main/java/gregtech/core/network/packets/PacketPluginSynced.java +++ b/src/main/java/gregtech/core/network/packets/PacketPluginSynced.java @@ -6,6 +6,7 @@ import gregtech.api.network.IServerExecutor; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen; import gregtech.core.network.NetworkUtils; + import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; @@ -48,8 +49,10 @@ public void decode(PacketBuffer buf) { @Override public void executeServer(NetHandlerPlayServer handler) { TileEntity te = NetworkUtils.getTileEntityServer(dimension, pos); - if (te instanceof IGregTechTileEntity && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { - MonitorPluginBaseBehavior plugin = ((MetaTileEntityMonitorScreen) ((IGregTechTileEntity) te).getMetaTileEntity()).plugin; + if (te instanceof IGregTechTileEntity && + ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { + MonitorPluginBaseBehavior plugin = ((MetaTileEntityMonitorScreen) ((IGregTechTileEntity) te) + .getMetaTileEntity()).plugin; if (plugin != null) { plugin.readPluginAction(handler.player, id, updateData); } diff --git a/src/main/java/gregtech/core/network/packets/PacketProspecting.java b/src/main/java/gregtech/core/network/packets/PacketProspecting.java index 6f89142cf4c..47a1780f930 100644 --- a/src/main/java/gregtech/core/network/packets/PacketProspecting.java +++ b/src/main/java/gregtech/core/network/packets/PacketProspecting.java @@ -1,15 +1,18 @@ package gregtech.core.network.packets; import gregtech.common.terminal.app.prospector.ProspectorMode; -import io.netty.buffer.Unpooled; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; +import io.netty.buffer.Unpooled; + import java.util.HashMap; import java.util.HashSet; import java.util.Set; public class PacketProspecting { + public int chunkX; public int chunkZ; public int playerChunkX; @@ -23,7 +26,8 @@ public class PacketProspecting { @SuppressWarnings("unused") public PacketProspecting() {} - public PacketProspecting(int chunkX, int chunkZ, int playerChunkX, int playerChunkZ, int posX, int posZ, ProspectorMode mode) { + public PacketProspecting(int chunkX, int chunkZ, int playerChunkX, int playerChunkZ, int posX, int posZ, + ProspectorMode mode) { this.chunkX = chunkX; this.chunkZ = chunkZ; this.playerChunkX = playerChunkX; @@ -32,10 +36,10 @@ public PacketProspecting(int chunkX, int chunkZ, int playerChunkX, int playerChu this.posZ = posZ; this.mode = mode; if (mode == ProspectorMode.FLUID) { - //noinspection unchecked + // noinspection unchecked map = new HashMap[1][1]; } else { - //noinspection unchecked + // noinspection unchecked map = new HashMap[16][16]; } @@ -43,7 +47,8 @@ public PacketProspecting(int chunkX, int chunkZ, int playerChunkX, int playerChu } public static PacketProspecting readPacketData(PacketBuffer buffer) { - PacketProspecting packet = new PacketProspecting(buffer.readInt(), buffer.readInt(), buffer.readInt(), buffer.readInt(), buffer.readInt(), buffer.readInt(), ProspectorMode.VALUES[buffer.readInt()]); + PacketProspecting packet = new PacketProspecting(buffer.readInt(), buffer.readInt(), buffer.readInt(), + buffer.readInt(), buffer.readInt(), buffer.readInt(), ProspectorMode.VALUES[buffer.readInt()]); int aSize = 0; if (packet.mode == ProspectorMode.ORE) aSize = 16; @@ -71,10 +76,10 @@ else if (packet.mode == ProspectorMode.FLUID) return packet; } - public static PacketProspecting readPacketData(NBTTagCompound nbt) { if (nbt.hasKey("buffer")) { - return PacketProspecting.readPacketData(new PacketBuffer(Unpooled.wrappedBuffer(nbt.getByteArray("buffer")))); + return PacketProspecting + .readPacketData(new PacketBuffer(Unpooled.wrappedBuffer(nbt.getByteArray("buffer")))); } return null; } @@ -133,5 +138,4 @@ public void addBlock(int x, int y, int z, String orePrefix) { } } } - } diff --git a/src/main/java/gregtech/core/network/packets/PacketRecoverMTE.java b/src/main/java/gregtech/core/network/packets/PacketRecoverMTE.java index a39c1d1397e..f90fb9af678 100644 --- a/src/main/java/gregtech/core/network/packets/PacketRecoverMTE.java +++ b/src/main/java/gregtech/core/network/packets/PacketRecoverMTE.java @@ -5,6 +5,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.network.IPacket; import gregtech.api.network.IServerExecutor; + import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.server.SPacketBlockChange; @@ -47,7 +48,8 @@ public void executeServer(NetHandlerPlayServer handler) { if (te instanceof IGregTechTileEntity && ((IGregTechTileEntity) te).isValid()) { IGregTechTileEntity holder = (IGregTechTileEntity) te; holder.writeCustomData(INITIALIZE_MTE, buffer -> { - buffer.writeVarInt(GregTechAPI.MTE_REGISTRY.getIdByObjectName(holder.getMetaTileEntity().metaTileEntityId)); + buffer.writeVarInt( + GregTechAPI.MTE_REGISTRY.getIdByObjectName(holder.getMetaTileEntity().metaTileEntityId)); holder.getMetaTileEntity().writeInitialSyncData(buffer); }); } else if (!(world.getBlockState(pos).getBlock() instanceof BlockMachine)) { diff --git a/src/main/java/gregtech/core/network/packets/PacketReloadShaders.java b/src/main/java/gregtech/core/network/packets/PacketReloadShaders.java index 06e9ade138c..69296cc69bd 100644 --- a/src/main/java/gregtech/core/network/packets/PacketReloadShaders.java +++ b/src/main/java/gregtech/core/network/packets/PacketReloadShaders.java @@ -4,6 +4,7 @@ import gregtech.api.network.IClientExecutor; import gregtech.api.network.IPacket; import gregtech.client.shader.Shaders; + import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.network.PacketBuffer; @@ -13,12 +14,10 @@ public class PacketReloadShaders implements IPacket, IClientExecutor { public PacketReloadShaders() {} @Override - public void encode(PacketBuffer buf) { - } + public void encode(PacketBuffer buf) {} @Override - public void decode(PacketBuffer buf) { - } + public void decode(PacketBuffer buf) {} @Override public void executeClient(NetHandlerPlayClient handler) { diff --git a/src/main/java/gregtech/core/network/packets/PacketUIClientAction.java b/src/main/java/gregtech/core/network/packets/PacketUIClientAction.java index 182b569d369..f8a5c0721ae 100644 --- a/src/main/java/gregtech/core/network/packets/PacketUIClientAction.java +++ b/src/main/java/gregtech/core/network/packets/PacketUIClientAction.java @@ -5,6 +5,7 @@ import gregtech.api.network.IPacket; import gregtech.api.network.IServerExecutor; import gregtech.core.network.NetworkUtils; + import net.minecraft.inventory.Container; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; diff --git a/src/main/java/gregtech/core/network/packets/PacketUIOpen.java b/src/main/java/gregtech/core/network/packets/PacketUIOpen.java index 2155dc73e7e..7edd515cae5 100644 --- a/src/main/java/gregtech/core/network/packets/PacketUIOpen.java +++ b/src/main/java/gregtech/core/network/packets/PacketUIOpen.java @@ -6,6 +6,7 @@ import gregtech.api.network.IPacket; import gregtech.api.util.GTLog; import gregtech.core.network.NetworkUtils; + import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.relauncher.Side; @@ -24,7 +25,8 @@ public class PacketUIOpen implements IPacket, IClientExecutor { @SuppressWarnings("unused") public PacketUIOpen() {} - public PacketUIOpen(int uiFactoryId, PacketBuffer serializedHolder, int windowId, List initialWidgetUpdates) { + public PacketUIOpen(int uiFactoryId, PacketBuffer serializedHolder, int windowId, + List initialWidgetUpdates) { this.uiFactoryId = uiFactoryId; this.serializedHolder = serializedHolder; this.windowId = windowId; diff --git a/src/main/java/gregtech/core/network/packets/PacketUIWidgetUpdate.java b/src/main/java/gregtech/core/network/packets/PacketUIWidgetUpdate.java index 1369ea2f6f2..c896c5adedd 100644 --- a/src/main/java/gregtech/core/network/packets/PacketUIWidgetUpdate.java +++ b/src/main/java/gregtech/core/network/packets/PacketUIWidgetUpdate.java @@ -4,6 +4,7 @@ import gregtech.api.network.IClientExecutor; import gregtech.api.network.IPacket; import gregtech.core.network.NetworkUtils; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.network.NetHandlerPlayClient; diff --git a/src/main/java/gregtech/core/sound/internal/SoundManager.java b/src/main/java/gregtech/core/sound/internal/SoundManager.java index 6e7b23e2368..ded6917c296 100644 --- a/src/main/java/gregtech/core/sound/internal/SoundManager.java +++ b/src/main/java/gregtech/core/sound/internal/SoundManager.java @@ -3,8 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.sound.ISoundManager; -import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.audio.ISound; import net.minecraft.client.audio.PositionedSoundRecord; @@ -16,6 +15,9 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + public class SoundManager implements ISoundManager { private static final SoundManager INSTANCE = new SoundManager(); diff --git a/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryImpl.java b/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryImpl.java index aef7595b68a..c35ac9e7a8b 100644 --- a/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryImpl.java +++ b/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryImpl.java @@ -4,10 +4,11 @@ import gregtech.api.unification.material.registry.MaterialRegistry; import gregtech.core.CoreModule; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; +import javax.annotation.Nonnull; + public class MaterialRegistryImpl extends MaterialRegistry { private static int networkIdCounter; @@ -31,7 +32,9 @@ public void register(Material material) { @Override public void register(int id, @Nonnull String key, @Nonnull Material value) { if (isRegistryClosed) { - CoreModule.logger.error("Materials cannot be registered in the PostMaterialEvent (or after)! Must be added in the MaterialEvent. Skipping material {}...", key); + CoreModule.logger.error( + "Materials cannot be registered in the PostMaterialEvent (or after)! Must be added in the MaterialEvent. Skipping material {}...", + key); return; } super.register(id, key, value); diff --git a/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryManager.java b/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryManager.java index 8b4664196d8..4f812a8f0f8 100644 --- a/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryManager.java +++ b/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryManager.java @@ -1,21 +1,23 @@ package gregtech.core.unification.material.internal; -import com.google.common.base.Preconditions; import gregtech.api.GTValues; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.registry.IMaterialRegistryManager; import gregtech.api.unification.material.registry.MaterialRegistry; + +import com.google.common.base.Preconditions; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public final class MaterialRegistryManager implements IMaterialRegistryManager { private static MaterialRegistryManager INSTANCE; diff --git a/src/main/java/gregtech/integration/IntegrationModule.java b/src/main/java/gregtech/integration/IntegrationModule.java index 0245d051f57..5dfb77b2d0f 100644 --- a/src/main/java/gregtech/integration/IntegrationModule.java +++ b/src/main/java/gregtech/integration/IntegrationModule.java @@ -1,31 +1,33 @@ package gregtech.integration; -import blusunrize.immersiveengineering.api.tool.BelljarHandler; -import crazypants.enderio.api.farm.IFertilizer; -import crazypants.enderio.base.farming.fertilizer.Bonemeal; import gregtech.api.GTValues; import gregtech.api.modules.GregTechModule; import gregtech.common.items.MetaItems; import gregtech.modules.BaseGregTechModule; import gregtech.modules.GregTechModules; + import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import blusunrize.immersiveengineering.api.tool.BelljarHandler; +import crazypants.enderio.api.farm.IFertilizer; +import crazypants.enderio.base.farming.fertilizer.Bonemeal; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + @GregTechModule( - moduleID = GregTechModules.MODULE_INTEGRATION, - containerID = GTValues.MODID, - name = "GregTech Mod Integration", - description = "General GregTech Integration Module. Disabling this disables all integration modules." -) + moduleID = GregTechModules.MODULE_INTEGRATION, + containerID = GTValues.MODID, + name = "GregTech Mod Integration", + description = "General GregTech Integration Module. Disabling this disables all integration modules.") public class IntegrationModule extends BaseGregTechModule { public static final Logger logger = LogManager.getLogger("GregTech Mod Integration"); diff --git a/src/main/java/gregtech/integration/IntegrationSubmodule.java b/src/main/java/gregtech/integration/IntegrationSubmodule.java index e445bb53c96..3f66d8bd5e9 100644 --- a/src/main/java/gregtech/integration/IntegrationSubmodule.java +++ b/src/main/java/gregtech/integration/IntegrationSubmodule.java @@ -3,13 +3,16 @@ import gregtech.api.util.GTUtility; import gregtech.modules.BaseGregTechModule; import gregtech.modules.GregTechModules; + import net.minecraft.util.ResourceLocation; + import org.apache.logging.log4j.Logger; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.Set; +import javax.annotation.Nonnull; + /** * Abstract class meant to be used by mod-specific compatibility modules. * Implements some shared skeleton code that should be shared by other modules. diff --git a/src/main/java/gregtech/integration/IntegrationUtil.java b/src/main/java/gregtech/integration/IntegrationUtil.java index ed4a015b218..88cfe6ec990 100644 --- a/src/main/java/gregtech/integration/IntegrationUtil.java +++ b/src/main/java/gregtech/integration/IntegrationUtil.java @@ -10,6 +10,7 @@ import net.minecraftforge.fml.relauncher.FMLLaunchHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -50,7 +51,8 @@ public static ItemStack getModItem(@NotNull String modid, @NotNull String name, } @NotNull - public static ItemStack getModItem(@NotNull String modid, @NotNull String name, int meta, int amount, @Nullable String nbt) { + public static ItemStack getModItem(@NotNull String modid, @NotNull String name, int meta, int amount, + @Nullable String nbt) { if (!Loader.isModLoaded(modid)) { return ItemStack.EMPTY; } @@ -74,11 +76,11 @@ public ModIncompatibilityException(List messages) { } @Override - public void initGui(GuiErrorScreen guiErrorScreen, FontRenderer fontRenderer) { - } + public void initGui(GuiErrorScreen guiErrorScreen, FontRenderer fontRenderer) {} @Override - public void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseX, int mouseY, float time) { + public void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseX, int mouseY, + float time) { int x = errorScreen.width / 2; int y = 75; for (String message : messages) { diff --git a/src/main/java/gregtech/integration/RecipeCompatUtil.java b/src/main/java/gregtech/integration/RecipeCompatUtil.java index 4d2c537b2ed..67f7b788e22 100644 --- a/src/main/java/gregtech/integration/RecipeCompatUtil.java +++ b/src/main/java/gregtech/integration/RecipeCompatUtil.java @@ -16,10 +16,12 @@ import gregtech.integration.crafttweaker.CTRecipeHelper; import gregtech.integration.groovy.GrSRecipeHelper; import gregtech.modules.GregTechModules; + import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.ApiStatus; import javax.annotation.Nonnull; @@ -60,7 +62,8 @@ public static String getMetaItemId(ItemStack item) { if (item.getItem() instanceof MachineItemBlock) { MetaTileEntity mte = GTUtility.getMetaTileEntity(item); if (mte != null) { - return (mte.metaTileEntityId.getNamespace().equals(GTValues.MODID) ? mte.metaTileEntityId.getPath() : mte.metaTileEntityId.toString()); + return (mte.metaTileEntityId.getNamespace().equals(GTValues.MODID) ? + mte.metaTileEntityId.getPath() : mte.metaTileEntityId.toString()); } } if (block instanceof BlockCompressed) { @@ -119,6 +122,7 @@ public static String getTweakerName() { } public enum TweakerType { + CRAFTTWEAKER("CraftTweaker"), GROOVYSCRIPT("GroovyScript"), NONE(""); diff --git a/src/main/java/gregtech/integration/baubles/BaubleBehavior.java b/src/main/java/gregtech/integration/baubles/BaubleBehavior.java index 3b64bdf981a..9eb8b186bdb 100644 --- a/src/main/java/gregtech/integration/baubles/BaubleBehavior.java +++ b/src/main/java/gregtech/integration/baubles/BaubleBehavior.java @@ -1,14 +1,16 @@ package gregtech.integration.baubles; -import baubles.api.BaubleType; -import baubles.api.IBauble; -import baubles.api.cap.BaublesCapabilities; import gregtech.api.items.metaitem.stats.IItemCapabilityProvider; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import baubles.api.cap.BaublesCapabilities; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/integration/baubles/BaublesModule.java b/src/main/java/gregtech/integration/baubles/BaublesModule.java index 4d73036565c..4371d5a032d 100644 --- a/src/main/java/gregtech/integration/baubles/BaublesModule.java +++ b/src/main/java/gregtech/integration/baubles/BaublesModule.java @@ -1,31 +1,32 @@ package gregtech.integration.baubles; -import baubles.api.BaubleType; -import baubles.api.BaublesApi; -import baubles.api.cap.IBaublesItemHandler; import gregtech.api.GTValues; import gregtech.api.modules.GregTechModule; import gregtech.common.items.MetaItems; import gregtech.integration.IntegrationSubmodule; import gregtech.modules.GregTechModules; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import baubles.api.BaubleType; +import baubles.api.BaublesApi; +import baubles.api.cap.IBaublesItemHandler; import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; @GregTechModule( - moduleID = GregTechModules.MODULE_BAUBLES, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_BAUBLES, - name = "GregTech Baubles Integration", - description = "Baubles Integration Module" -) + moduleID = GregTechModules.MODULE_BAUBLES, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_BAUBLES, + name = "GregTech Baubles Integration", + description = "Baubles Integration Module") public class BaublesModule extends IntegrationSubmodule { @NotNull diff --git a/src/main/java/gregtech/integration/baubles/BaublesWrappedInventory.java b/src/main/java/gregtech/integration/baubles/BaublesWrappedInventory.java index 5cf7d823892..6cda484f2d3 100644 --- a/src/main/java/gregtech/integration/baubles/BaublesWrappedInventory.java +++ b/src/main/java/gregtech/integration/baubles/BaublesWrappedInventory.java @@ -1,11 +1,12 @@ package gregtech.integration.baubles; -import baubles.api.cap.IBaublesItemHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; + +import baubles.api.cap.IBaublesItemHandler; import org.jetbrains.annotations.NotNull; /** Wrapped player inventory and Baubles inventory. */ @@ -82,8 +83,7 @@ public boolean isEmpty() { } @Override - public void markDirty() { - } + public void markDirty() {} @Override public boolean isUsableByPlayer(@NotNull EntityPlayer player) { @@ -91,12 +91,10 @@ public boolean isUsableByPlayer(@NotNull EntityPlayer player) { } @Override - public void openInventory(@NotNull EntityPlayer player) { - } + public void openInventory(@NotNull EntityPlayer player) {} @Override - public void closeInventory(@NotNull EntityPlayer player) { - } + public void closeInventory(@NotNull EntityPlayer player) {} @Override public int getField(int id) { @@ -104,8 +102,7 @@ public int getField(int id) { } @Override - public void setField(int id, int value) { - } + public void setField(int id, int value) {} @Override public int getFieldCount() { @@ -113,8 +110,7 @@ public int getFieldCount() { } @Override - public void clear() { - } + public void clear() {} @Override public @NotNull String getName() { diff --git a/src/main/java/gregtech/integration/crafttweaker/CTRecipeHelper.java b/src/main/java/gregtech/integration/crafttweaker/CTRecipeHelper.java index 6d0dc4bf5f7..6b48f790b86 100644 --- a/src/main/java/gregtech/integration/crafttweaker/CTRecipeHelper.java +++ b/src/main/java/gregtech/integration/crafttweaker/CTRecipeHelper.java @@ -1,15 +1,17 @@ package gregtech.integration.crafttweaker; -import crafttweaker.mc1120.data.NBTConverter; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.ingredients.GTRecipeInput; import gregtech.integration.IntegrationModule; import gregtech.integration.RecipeCompatUtil; + import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidStack; +import crafttweaker.mc1120.data.NBTConverter; + public class CTRecipeHelper { public static String getRecipeRemoveLine(RecipeMap recipeMap, Recipe recipe) { @@ -53,7 +55,6 @@ public static String getRecipeRemoveLine(RecipeMap recipeMap, Recipe recipe) builder.append("null"); } - builder.append(").remove();"); return builder.toString(); } diff --git a/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java b/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java index 3ac8c77ddda..195eec12b72 100644 --- a/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java +++ b/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java @@ -1,6 +1,5 @@ package gregtech.integration.crafttweaker; -import crafttweaker.CraftTweakerAPI; import gregtech.api.GTValues; import gregtech.api.items.metaitem.MetaOreDictItem; import gregtech.api.modules.GregTechModule; @@ -10,6 +9,7 @@ import gregtech.integration.crafttweaker.recipe.MetaItemBracketHandler; import gregtech.integration.crafttweaker.terminal.CTTerminalRegistry; import gregtech.modules.GregTechModules; + import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; @@ -18,17 +18,19 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import javax.annotation.Nonnull; +import crafttweaker.CraftTweakerAPI; + import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + @GregTechModule( - moduleID = GregTechModules.MODULE_CT, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_CT, - name = "GregTech CraftTweaker Integration", - description = "CraftTweaker Integration Module" -) + moduleID = GregTechModules.MODULE_CT, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_CT, + name = "GregTech CraftTweaker Integration", + description = "CraftTweaker Integration Module") public class CraftTweakerModule extends IntegrationSubmodule { public static MetaOreDictItem CT_OREDICT_ITEM; diff --git a/src/main/java/gregtech/integration/crafttweaker/block/CTHeatingCoilBlockStats.java b/src/main/java/gregtech/integration/crafttweaker/block/CTHeatingCoilBlockStats.java index c9a72ddf1a6..926621f180e 100644 --- a/src/main/java/gregtech/integration/crafttweaker/block/CTHeatingCoilBlockStats.java +++ b/src/main/java/gregtech/integration/crafttweaker/block/CTHeatingCoilBlockStats.java @@ -1,11 +1,12 @@ package gregtech.integration.crafttweaker.block; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.block.IBlockState; -import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.GregTechAPI; import gregtech.api.block.IHeatingCoilBlockStats; import gregtech.api.unification.material.Material; + +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.block.IBlockState; +import crafttweaker.api.minecraft.CraftTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -32,7 +33,8 @@ public class CTHeatingCoilBlockStats implements IHeatingCoilBlockStats { * @param tier the tier of the Heating Coil - used for cracker pyrolyse discounts * @param material the {@link Material} of the Heating Coil, use null for no specific material */ - public CTHeatingCoilBlockStats(String name, int coilTemperature, int level, int energyDiscount, int tier, @Nullable Material material) { + public CTHeatingCoilBlockStats(String name, int coilTemperature, int level, int energyDiscount, int tier, + @Nullable Material material) { this.name = name; this.coilTemperature = coilTemperature; this.level = level; @@ -74,8 +76,10 @@ public Material getMaterial() { } @ZenMethod - public static void add(@Nonnull IBlockState state, @Nonnull String name, int coilTemperature, int level, int energyDiscount, int tier, @Nullable Material material) { - GregTechAPI.HEATING_COILS.put(CraftTweakerMC.getBlockState(state), new CTHeatingCoilBlockStats(name, coilTemperature, level, energyDiscount, tier, material)); + public static void add(@Nonnull IBlockState state, @Nonnull String name, int coilTemperature, int level, + int energyDiscount, int tier, @Nullable Material material) { + GregTechAPI.HEATING_COILS.put(CraftTweakerMC.getBlockState(state), + new CTHeatingCoilBlockStats(name, coilTemperature, level, energyDiscount, tier, material)); } @ZenMethod diff --git a/src/main/java/gregtech/integration/crafttweaker/item/CTItemRegistry.java b/src/main/java/gregtech/integration/crafttweaker/item/CTItemRegistry.java index 07b29fb9f8f..cfd4b5a4d54 100644 --- a/src/main/java/gregtech/integration/crafttweaker/item/CTItemRegistry.java +++ b/src/main/java/gregtech/integration/crafttweaker/item/CTItemRegistry.java @@ -1,8 +1,9 @@ package gregtech.integration.crafttweaker.item; -import crafttweaker.annotations.ZenRegister; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.ore.OrePrefix; + +import crafttweaker.annotations.ZenRegister; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -15,9 +16,10 @@ public class CTItemRegistry { @ZenMethod("registerItem") - public static void registerItem(String name, short id, int rgb, String materialIconSet, String orePrefix, @Optional String chemicalFormula) { + public static void registerItem(String name, short id, int rgb, String materialIconSet, String orePrefix, + @Optional String chemicalFormula) { CT_OREDICT_ITEM.addOreDictItem( - id, name, rgb, MaterialIconSet.ICON_SETS.get(materialIconSet), OrePrefix.getPrefix(orePrefix), chemicalFormula.isEmpty() ? null : chemicalFormula); + id, name, rgb, MaterialIconSet.ICON_SETS.get(materialIconSet), OrePrefix.getPrefix(orePrefix), + chemicalFormula.isEmpty() ? null : chemicalFormula); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialBuilder.java b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialBuilder.java index afbca2e0c2c..b8dc8e77a9b 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialBuilder.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialBuilder.java @@ -1,7 +1,5 @@ package gregtech.integration.crafttweaker.material; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.enchantments.IEnchantment; import gregtech.api.GTValues; import gregtech.api.fluids.FluidBuilder; import gregtech.api.fluids.FluidState; @@ -16,7 +14,11 @@ import gregtech.api.unification.material.properties.ToolProperty; import gregtech.api.unification.stack.MaterialStack; import gregtech.api.util.GTUtility; + import net.minecraft.enchantment.Enchantment; + +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.enchantments.IEnchantment; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenConstructor; @@ -53,7 +55,8 @@ public CTMaterialBuilder fluid() { @ZenMethod public CTMaterialBuilder fluid(@Optional String type, @Optional boolean hasBlock) { FluidState state = validateFluidState(type); - FluidStorageKey key = state == FluidState.GAS ? FluidStorageKeys.GAS : state == FluidState.PLASMA ? FluidStorageKeys.PLASMA : FluidStorageKeys.LIQUID; + FluidStorageKey key = state == FluidState.GAS ? FluidStorageKeys.GAS : + state == FluidState.PLASMA ? FluidStorageKeys.PLASMA : FluidStorageKeys.LIQUID; FluidBuilder builder = new FluidBuilder().state(state); if (hasBlock) builder.block(); backingBuilder.fluid(key, builder); @@ -80,7 +83,6 @@ public CTMaterialBuilder ingot(@Optional int harvestLevel, @Optional int burnTim return this; } - @ZenMethod public CTMaterialBuilder gem(@Optional int harvestLevel, @Optional int burnTime) { if (harvestLevel == 0) harvestLevel = 2; @@ -148,11 +150,14 @@ public CTMaterialBuilder element(Element element) { } @ZenMethod - public CTMaterialBuilder toolStats(float speed, float damage, int durability, int harvestLevel, @Optional int enchantability) { + public CTMaterialBuilder toolStats(float speed, float damage, int durability, int harvestLevel, + @Optional int enchantability) { if (enchantability == 0) enchantability = 10; - backingBuilder.toolStats(ToolProperty.Builder.of(speed, damage, durability, harvestLevel).enchantability(enchantability).build()); + backingBuilder.toolStats(ToolProperty.Builder.of(speed, damage, durability, harvestLevel) + .enchantability(enchantability).build()); return this; } + @ZenMethod public CTMaterialBuilder rotorStats(float speed, float damage, int durability) { backingBuilder.rotorStats(speed, damage, durability); @@ -160,7 +165,9 @@ public CTMaterialBuilder rotorStats(float speed, float damage, int durability) { } @ZenMethod - public CTMaterialBuilder blastTemp(int temp, @Optional String gasTier, @Optional int eutOverride, @Optional int durationOverride, @Optional int vacuumEUtOverride, @Optional int vacuumDurationOverride) { + public CTMaterialBuilder blastTemp(int temp, @Optional String gasTier, @Optional int eutOverride, + @Optional int durationOverride, @Optional int vacuumEUtOverride, + @Optional int vacuumDurationOverride) { BlastProperty.GasTier tier = BlastProperty.validateGasTier(gasTier); final int blastEUt = eutOverride != 0 ? eutOverride : -1; final int blastDuration = durationOverride != 0 ? durationOverride : -1; @@ -174,7 +181,8 @@ public CTMaterialBuilder blastTemp(int temp, @Optional String gasTier, @Optional } @ZenMethod - public CTMaterialBuilder ore(@Optional int oreMultiplier, @Optional int byproductMultiplier, @Optional boolean emissive) { + public CTMaterialBuilder ore(@Optional int oreMultiplier, @Optional int byproductMultiplier, + @Optional boolean emissive) { if (oreMultiplier == 0) oreMultiplier = 1; if (byproductMultiplier == 0) byproductMultiplier = 1; backingBuilder.ore(oreMultiplier, byproductMultiplier, emissive); @@ -243,7 +251,8 @@ public CTMaterialBuilder fluidPipeProperties(int maxTemp, int throughput, boolea } @ZenMethod - public CTMaterialBuilder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { + public CTMaterialBuilder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof) { backingBuilder.fluidPipeProperties(maxTemp, throughput, gasProof, acidProof, cryoProof, plasmaProof); return this; } diff --git a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialHelpers.java b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialHelpers.java index ede8ce57ffc..751be8aa3ef 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialHelpers.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialHelpers.java @@ -1,12 +1,13 @@ package gregtech.integration.crafttweaker.material; -import com.google.common.collect.ImmutableList; -import crafttweaker.CraftTweakerAPI; import gregtech.api.GregTechAPI; import gregtech.api.fluids.FluidState; import gregtech.api.unification.material.Material; import gregtech.api.unification.stack.MaterialStack; +import com.google.common.collect.ImmutableList; +import crafttweaker.CraftTweakerAPI; + public class CTMaterialHelpers { protected static ImmutableList validateComponentList(MaterialStack[] components) { @@ -28,13 +29,16 @@ protected static FluidState validateFluidState(String fluidTypeName) { protected static boolean checkFrozen(String description) { if (!GregTechAPI.materialManager.canModifyMaterials()) { - CraftTweakerAPI.logError("Cannot " + description + " now, must be done in a file labeled with \"#loader gregtech\""); + CraftTweakerAPI.logError( + "Cannot " + description + " now, must be done in a file labeled with \"#loader gregtech\""); return true; - } return false; + } + return false; } protected static void logError(Material m, String cause, String type) { - CraftTweakerAPI.logError("Cannot " + cause + " of a Material with no " + type + "! Try calling \"add" + type + "\" in your \"#loader gregtech\" file first if this is intentional. Material: " + m.getUnlocalizedName()); + CraftTweakerAPI.logError("Cannot " + cause + " of a Material with no " + type + "! Try calling \"add" + type + + "\" in your \"#loader gregtech\" file first if this is intentional. Material: " + + m.getUnlocalizedName()); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialRegistry.java b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialRegistry.java index def2a327199..6a368df6128 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialRegistry.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialRegistry.java @@ -1,9 +1,10 @@ package gregtech.integration.crafttweaker.material; -import crafttweaker.annotations.ZenRegister; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.unification.material.Material; + +import crafttweaker.annotations.ZenRegister; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; diff --git a/src/main/java/gregtech/integration/crafttweaker/material/MaterialBracketHandler.java b/src/main/java/gregtech/integration/crafttweaker/material/MaterialBracketHandler.java index 01f48ead6a9..1a0481d4a81 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/MaterialBracketHandler.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/MaterialBracketHandler.java @@ -1,11 +1,12 @@ package gregtech.integration.crafttweaker.material; +import gregtech.api.GregTechAPI; +import gregtech.api.unification.material.Material; + import crafttweaker.CraftTweakerAPI; import crafttweaker.annotations.BracketHandler; import crafttweaker.annotations.ZenRegister; import crafttweaker.zenscript.IBracketHandler; -import gregtech.api.GregTechAPI; -import gregtech.api.unification.material.Material; import stanhebben.zenscript.compiler.IEnvironmentGlobal; import stanhebben.zenscript.expression.ExpressionCallStatic; import stanhebben.zenscript.expression.ExpressionString; @@ -46,5 +47,4 @@ public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { return position -> new ExpressionCallStatic(position, environment, method, new ExpressionString(position, nameBuilder.toString())); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/material/MaterialExpansion.java b/src/main/java/gregtech/integration/crafttweaker/material/MaterialExpansion.java index 755d4926878..3f8e854cb29 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/MaterialExpansion.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/MaterialExpansion.java @@ -1,17 +1,19 @@ package gregtech.integration.crafttweaker.material; -import crafttweaker.CraftTweakerAPI; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.enchantments.IEnchantment; -import crafttweaker.api.liquid.ILiquidDefinition; -import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.GTValues; import gregtech.api.fluids.store.FluidStorageKeys; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.info.MaterialFlag; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.properties.*; + import net.minecraft.enchantment.Enchantment; + +import crafttweaker.CraftTweakerAPI; +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.enchantments.IEnchantment; +import crafttweaker.api.liquid.ILiquidDefinition; +import crafttweaker.api.minecraft.CraftTweakerMC; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenExpansion; import stanhebben.zenscript.annotations.ZenGetter; @@ -26,7 +28,7 @@ public class MaterialExpansion { //////////////////////////////////// - // Material Methods // + // Material Methods // //////////////////////////////////// @ZenMethod @@ -52,7 +54,7 @@ public static String getIconSet(Material m) { } //////////////////////////////////// - // Fluid Property // + // Fluid Property // //////////////////////////////////// @ZenGetter @@ -73,7 +75,7 @@ public static ILiquidDefinition getFluid(Material m) { } /////////////////////////////////// - // Dust Property // + // Dust Property // /////////////////////////////////// @ZenGetter("harvestLevel") @@ -113,7 +115,7 @@ public static void setBurnTime(Material m, int burnTime) { } /////////////////////////////////// - // Tool Property // + // Tool Property // /////////////////////////////////// @ZenGetter("toolSpeed") @@ -203,14 +205,15 @@ public static void setToolStats(Material m, float toolSpeed, float toolAttackDam // Wire/Item Pipe/Fluid Pipe stuff? //////////////////////////////////// - // Blast Property // + // Blast Property // //////////////////////////////////// @ZenMethod public static void setBlastTemp(Material m, int blastTemp) { if (checkFrozen("set blast temperature")) return; if (blastTemp <= 0) { - CraftTweakerAPI.logError("Blast Temperature must be greater than zero! Material: " + m.getUnlocalizedName()); + CraftTweakerAPI + .logError("Blast Temperature must be greater than zero! Material: " + m.getUnlocalizedName()); return; } BlastProperty prop = m.getProperty(PropertyKey.BLAST); @@ -228,7 +231,7 @@ public static int blastTemp(Material m) { } //////////////////////////////////// - // Ore Property // + // Ore Property // //////////////////////////////////// @ZenGetter diff --git a/src/main/java/gregtech/integration/crafttweaker/material/MaterialPropertyExpansion.java b/src/main/java/gregtech/integration/crafttweaker/material/MaterialPropertyExpansion.java index 82fa2fed3b5..0f2c7a3d882 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/MaterialPropertyExpansion.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/MaterialPropertyExpansion.java @@ -1,6 +1,5 @@ package gregtech.integration.crafttweaker.material; -import crafttweaker.annotations.ZenRegister; import gregtech.api.fluids.FluidBuilder; import gregtech.api.fluids.FluidState; import gregtech.api.fluids.attribute.FluidAttributes; @@ -8,6 +7,8 @@ import gregtech.api.fluids.store.FluidStorageKeys; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.*; + +import crafttweaker.annotations.ZenRegister; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenExpansion; import stanhebben.zenscript.annotations.ZenMethod; @@ -21,7 +22,7 @@ public class MaterialPropertyExpansion { ///////////////////////////////////// - // Property Checkers // + // Property Checkers // ///////////////////////////////////// @ZenMethod @@ -75,7 +76,7 @@ public static boolean hasWires(Material m) { } //////////////////////////////////// - // Property Setters // + // Property Setters // //////////////////////////////////// @ZenMethod @@ -86,7 +87,9 @@ public static void addBlastTemp(Material m, int blastTemp) { } @ZenMethod - public static void addBlastProperty(Material m, int blastTemp, @Optional String gasTier, @Optional int durationOverride, @Optional int eutOverride, @Optional int vacuumDurationOverride, @Optional int vacuumEUtOverride) { + public static void addBlastProperty(Material m, int blastTemp, @Optional String gasTier, + @Optional int durationOverride, @Optional int eutOverride, + @Optional int vacuumDurationOverride, @Optional int vacuumEUtOverride) { if (checkFrozen("add blast property")) return; if (m.hasProperty(PropertyKey.BLAST)) { BlastProperty property = m.getProperty(PropertyKey.BLAST); @@ -98,9 +101,11 @@ public static void addBlastProperty(Material m, int blastTemp, @Optional String if (vacuumEUtOverride != 0) property.setVacuumEutOverride(vacuumEUtOverride); } else { BlastProperty.Builder builder = new BlastProperty.Builder(); - builder.temp(blastTemp, gasTier == null ? BlastProperty.GasTier.LOW : BlastProperty.validateGasTier(gasTier)); + builder.temp(blastTemp, + gasTier == null ? BlastProperty.GasTier.LOW : BlastProperty.validateGasTier(gasTier)); builder.blastStats(durationOverride == 0 ? -1 : durationOverride, eutOverride == 0 ? -1 : eutOverride); - builder.vacuumStats(vacuumEUtOverride == 0 ? -1 : vacuumEUtOverride, vacuumDurationOverride == 0 ? -1 : vacuumDurationOverride); + builder.vacuumStats(vacuumEUtOverride == 0 ? -1 : vacuumEUtOverride, + vacuumDurationOverride == 0 ? -1 : vacuumDurationOverride); m.setProperty(PropertyKey.BLAST, builder.build()); } } @@ -121,7 +126,8 @@ public static void addFluidPipes(Material m, int maxFluidTemperature, int throug } @ZenMethod - public static void addFluidPipes(Material m, int maxFluidTemperature, int throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { + public static void addFluidPipes(Material m, int maxFluidTemperature, int throughput, boolean gasProof, + boolean acidProof, boolean cryoProof, boolean plasmaProof) { if (checkFrozen("add fluid pipes to a material")) return; if (m.hasProperty(PropertyKey.FLUID_PIPE)) { m.getProperty(PropertyKey.FLUID_PIPE).setMaxFluidTemperature(maxFluidTemperature); @@ -131,7 +137,8 @@ public static void addFluidPipes(Material m, int maxFluidTemperature, int throug m.getProperty(PropertyKey.FLUID_PIPE).setCryoProof(cryoProof); m.getProperty(PropertyKey.FLUID_PIPE).setPlasmaProof(plasmaProof); } else { - m.setProperty(PropertyKey.FLUID_PIPE, new FluidPipeProperties(maxFluidTemperature, throughput, gasProof, acidProof, cryoProof, plasmaProof)); + m.setProperty(PropertyKey.FLUID_PIPE, new FluidPipeProperties(maxFluidTemperature, throughput, gasProof, + acidProof, cryoProof, plasmaProof)); } } @@ -178,7 +185,8 @@ public static void addIngot(Material m) { } @ZenMethod - public static void addOre(Material m, @Optional int oreMultiplier, @Optional int byproductMultiplier, @Optional boolean emissive) { + public static void addOre(Material m, @Optional int oreMultiplier, @Optional int byproductMultiplier, + @Optional boolean emissive) { if (checkFrozen("add an Ore to a material")) return; oreMultiplier = oreMultiplier == 0 ? 1 : oreMultiplier; byproductMultiplier = byproductMultiplier == 0 ? 1 : byproductMultiplier; @@ -186,8 +194,7 @@ public static void addOre(Material m, @Optional int oreMultiplier, @Optional int m.getProperty(PropertyKey.ORE).setOreMultiplier(oreMultiplier); m.getProperty(PropertyKey.ORE).setByProductMultiplier(byproductMultiplier); m.getProperty(PropertyKey.ORE).setEmissive(emissive); - } - else m.setProperty(PropertyKey.ORE, new OreProperty(oreMultiplier, byproductMultiplier, emissive)); + } else m.setProperty(PropertyKey.ORE, new OreProperty(oreMultiplier, byproductMultiplier, emissive)); } @ZenMethod @@ -204,13 +211,16 @@ public static void addPlasma(Material m) { if (checkFrozen("add a Plasma to a material")) return; if (!m.hasProperty(PropertyKey.FLUID)) { FluidProperty property = new FluidProperty(); - property.getStorage().enqueueRegistration(FluidStorageKeys.PLASMA, new FluidBuilder().state(FluidState.PLASMA)); + property.getStorage().enqueueRegistration(FluidStorageKeys.PLASMA, + new FluidBuilder().state(FluidState.PLASMA)); m.setProperty(PropertyKey.FLUID, property); } } @ZenMethod - public static void addTools(Material m, float toolSpeed, float toolAttackDamage, float toolAttackSpeed, int toolDurability, @Optional int toolHarvestLevel, @Optional int toolEnchantability, @Optional int durabilityMultiplier) { + public static void addTools(Material m, float toolSpeed, float toolAttackDamage, float toolAttackSpeed, + int toolDurability, @Optional int toolHarvestLevel, @Optional int toolEnchantability, + @Optional int durabilityMultiplier) { if (checkFrozen("add Tools to a material")) return; if (toolEnchantability == 0) toolEnchantability = 10; if (durabilityMultiplier <= 0) durabilityMultiplier = 1; @@ -222,12 +232,15 @@ public static void addTools(Material m, float toolSpeed, float toolAttackDamage, m.getProperty(PropertyKey.TOOL).setToolHarvestLevel(toolHarvestLevel); m.getProperty(PropertyKey.TOOL).setToolEnchantability(toolEnchantability); m.getProperty(PropertyKey.TOOL).setDurabilityMultiplier(durabilityMultiplier); - } else m.setProperty(PropertyKey.TOOL, ToolProperty.Builder.of(toolSpeed, toolAttackDamage, toolDurability, toolHarvestLevel) - .attackSpeed(toolAttackSpeed).enchantability(toolEnchantability).durabilityMultiplier(durabilityMultiplier).build()); + } else m.setProperty(PropertyKey.TOOL, + ToolProperty.Builder.of(toolSpeed, toolAttackDamage, toolDurability, toolHarvestLevel) + .attackSpeed(toolAttackSpeed).enchantability(toolEnchantability) + .durabilityMultiplier(durabilityMultiplier).build()); } @ZenMethod - public static void addWires(Material m, int voltage, int baseAmperage, int lossPerBlock, @Optional boolean isSuperCon, @Optional int criticalTemp) { + public static void addWires(Material m, int voltage, int baseAmperage, int lossPerBlock, + @Optional boolean isSuperCon, @Optional int criticalTemp) { if (checkFrozen("add Wires to a material")) return; if (m.hasProperty(PropertyKey.WIRE)) { m.getProperty(PropertyKey.WIRE).setVoltage(voltage); @@ -235,6 +248,7 @@ public static void addWires(Material m, int voltage, int baseAmperage, int lossP m.getProperty(PropertyKey.WIRE).setLossPerBlock(lossPerBlock); m.getProperty(PropertyKey.WIRE).setSuperconductor(isSuperCon); m.getProperty(PropertyKey.WIRE).setSuperconductorCriticalTemperature(criticalTemp); - } else m.setProperty(PropertyKey.WIRE, new WireProperties(voltage, baseAmperage, lossPerBlock, isSuperCon, criticalTemp)); + } else m.setProperty(PropertyKey.WIRE, + new WireProperties(voltage, baseAmperage, lossPerBlock, isSuperCon, criticalTemp)); } } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMatcher.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMatcher.java index 126c6cca723..d099b499df2 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMatcher.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMatcher.java @@ -2,14 +2,16 @@ import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; + import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Map; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class CTNBTMatcher implements NBTMatcher { private final Set> requiredNBT; diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMultiItemMatcher.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMultiItemMatcher.java index a43d82a0d0b..ef8ebfff5d8 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMultiItemMatcher.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMultiItemMatcher.java @@ -1,19 +1,22 @@ package gregtech.integration.crafttweaker.recipe; -import com.google.common.base.Preconditions; import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; import gregtech.api.util.GTLog; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.base.Preconditions; + import java.util.List; import java.util.Map; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class CTNBTMultiItemMatcher implements NBTMatcher { private final Map> map; @@ -31,7 +34,8 @@ public CTNBTMultiItemMatcher(@Nonnull Map> map) @Override public boolean evaluate(@Nullable NBTTagCompound nbtTagCompound, @Nullable NBTCondition nbtCondition) { // should never get called - GTLog.logger.warn("CTNBTMultiItemMatcher#evaluate(NBTTagCompound, NBTCondition) was called. This should not happen."); + GTLog.logger.warn( + "CTNBTMultiItemMatcher#evaluate(NBTTagCompound, NBTCondition) was called. This should not happen."); return false; } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipe.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipe.java index 0decd789653..40db5cdb817 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipe.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipe.java @@ -1,14 +1,15 @@ package gregtech.integration.crafttweaker.recipe; +import gregtech.api.recipes.Recipe; +import gregtech.api.recipes.RecipeMap; +import gregtech.api.util.GTUtility; + import crafttweaker.annotations.ZenRegister; import crafttweaker.api.item.IItemStack; import crafttweaker.api.liquid.ILiquidStack; import crafttweaker.api.minecraft.CraftTweakerMC; import crafttweaker.mc1120.item.MCItemStack; import crafttweaker.mc1120.liquid.MCLiquidStack; -import gregtech.api.recipes.Recipe; -import gregtech.api.recipes.RecipeMap; -import gregtech.api.util.GTUtility; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenGetter; @@ -103,5 +104,4 @@ public Object getProperty(String key) { public boolean remove() { return this.recipeMap.removeRecipe(this.backingRecipe); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeBuilder.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeBuilder.java index d947900092c..f523f3c5c8c 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeBuilder.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeBuilder.java @@ -1,13 +1,5 @@ package gregtech.integration.crafttweaker.recipe; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.data.DataMap; -import crafttweaker.api.data.IData; -import crafttweaker.api.item.IIngredient; -import crafttweaker.api.item.IItemStack; -import crafttweaker.api.liquid.ILiquidStack; -import crafttweaker.api.minecraft.CraftTweakerMC; -import crafttweaker.api.oredict.IOreDictEntry; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.ingredients.GTRecipeFluidInput; import gregtech.api.recipes.ingredients.GTRecipeInput; @@ -16,20 +8,31 @@ import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; import gregtech.api.util.ItemStackHashStrategy; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; + +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.data.DataMap; +import crafttweaker.api.data.IData; +import crafttweaker.api.item.IIngredient; +import crafttweaker.api.item.IItemStack; +import crafttweaker.api.liquid.ILiquidStack; +import crafttweaker.api.minecraft.CraftTweakerMC; +import crafttweaker.api.oredict.IOreDictEntry; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @ZenClass("mods.gregtech.recipe.RecipeBuilder") @ZenRegister public class CTRecipeBuilder { @@ -113,7 +116,8 @@ private static GTRecipeInput getInputFromCTIngredient(@Nullable IIngredient ingr return tryConstructNBTInput(new GTRecipeItemInput(stack, ingredient.getAmount()), tagCompound); } else { // multiple inputs for a single input entry - final Map> map = new Object2ObjectOpenCustomHashMap<>(ItemStackHashStrategy.comparingItemDamageCount()); + final Map> map = new Object2ObjectOpenCustomHashMap<>( + ItemStackHashStrategy.comparingItemDamageCount()); ItemStack[] stacks = new ItemStack[items.size()]; for (int i = 0; i < stacks.length; i++) { @@ -165,7 +169,8 @@ private static GTRecipeInput tryConstructNBTInput(@Nonnull GTRecipeInput input, * @return the nbt matching input if successful, otherwise the original recipe input */ @Nonnull - private static GTRecipeInput tryConstructNBTInput(@Nonnull GTRecipeInput input, @Nonnull Map> map) { + private static GTRecipeInput tryConstructNBTInput(@Nonnull GTRecipeInput input, + @Nonnull Map> map) { if (map.isEmpty()) return input; // do not use nbt matching, if there are no tags to check return input.setNBTMatchingCondition(new CTNBTMultiItemMatcher(map), null); } @@ -182,7 +187,7 @@ public CTRecipeBuilder circuit(int num) { return this; } - //note that fluid input predicates are not supported + // note that fluid input predicates are not supported @ZenMethod public CTRecipeBuilder fluidInputs(ILiquidStack... ingredients) { this.backingBuilder.fluidInputs(Arrays.stream(ingredients) @@ -275,7 +280,8 @@ public CTRecipeBuilder property(String key, IItemStack item) { if (!applied) { throw new IllegalArgumentException("Property " + key + " cannot be applied to recipe type " + - backingBuilder.getClass().getSimpleName() + " for Item " + CraftTweakerMC.getItemStack(item).getDisplayName()); + backingBuilder.getClass().getSimpleName() + " for Item " + + CraftTweakerMC.getItemStack(item).getDisplayName()); } return this; } @@ -290,5 +296,4 @@ public void buildAndRegister() { public String toString() { return this.backingBuilder.toString(); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeUtils.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeUtils.java index 217316e1710..0aefcd1e778 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeUtils.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeUtils.java @@ -1,15 +1,17 @@ package gregtech.integration.crafttweaker.recipe; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.item.IItemStack; -import crafttweaker.api.liquid.ILiquidStack; -import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.recipes.GTRecipeHandler; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.util.GTLog; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; + +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.item.IItemStack; +import crafttweaker.api.liquid.ILiquidStack; +import crafttweaker.api.minecraft.CraftTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -27,7 +29,8 @@ public class CTRecipeUtils { // TODO YEET @ZenMethod("removeRecipeByOutput") - public static void removeRecipeByOutput(RecipeMap recipeMap, IItemStack[] outputs, ILiquidStack[] fluidOutputs, boolean useAmounts) { + public static void removeRecipeByOutput(RecipeMap recipeMap, IItemStack[] outputs, ILiquidStack[] fluidOutputs, + boolean useAmounts) { List recipesToRemove = new ArrayList<>(); List mcItemOutputs = outputs == null ? Collections.emptyList() : Arrays.stream(outputs) diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/InputIngredient.java b/src/main/java/gregtech/integration/crafttweaker/recipe/InputIngredient.java index fd0c0778336..d8c94cc683b 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/InputIngredient.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/InputIngredient.java @@ -1,11 +1,12 @@ package gregtech.integration.crafttweaker.recipe; +import gregtech.api.recipes.ingredients.GTRecipeInput; + import crafttweaker.annotations.ZenRegister; import crafttweaker.api.item.*; import crafttweaker.api.liquid.ILiquidStack; import crafttweaker.api.minecraft.CraftTweakerMC; import crafttweaker.api.player.IPlayer; -import gregtech.api.recipes.ingredients.GTRecipeInput; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenGetter; diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/MetaItemBracketHandler.java b/src/main/java/gregtech/integration/crafttweaker/recipe/MetaItemBracketHandler.java index 3c5ce8ff422..c47733d6a0c 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/MetaItemBracketHandler.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/MetaItemBracketHandler.java @@ -1,12 +1,5 @@ package gregtech.integration.crafttweaker.recipe; -import com.cleanroommc.groovyscript.api.GroovyLog; -import crafttweaker.CraftTweakerAPI; -import crafttweaker.annotations.BracketHandler; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.item.IItemStack; -import crafttweaker.mc1120.item.MCItemStack; -import crafttweaker.zenscript.IBracketHandler; import gregtech.api.GregTechAPI; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.MetaItem.MetaValueItem; @@ -19,8 +12,17 @@ import gregtech.common.pipelike.fluidpipe.BlockFluidPipe; import gregtech.common.pipelike.itempipe.BlockItemPipe; import gregtech.integration.groovy.GroovyScriptModule; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.item.ItemStack; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import crafttweaker.CraftTweakerAPI; +import crafttweaker.annotations.BracketHandler; +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.item.IItemStack; +import crafttweaker.mc1120.item.MCItemStack; +import crafttweaker.zenscript.IBracketHandler; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import stanhebben.zenscript.compiler.IEnvironmentGlobal; import stanhebben.zenscript.expression.ExpressionCallStatic; import stanhebben.zenscript.expression.ExpressionString; @@ -35,6 +37,7 @@ @BracketHandler @ZenRegister public class MetaItemBracketHandler implements IBracketHandler { + private static final Map> metaItemNames = new Object2ObjectOpenHashMap<>(); private static final Map> metaBlockNames = new Object2ObjectOpenHashMap<>(); @@ -48,7 +51,8 @@ public static void rebuildComponentRegistry() { metaItemNames.clear(); for (MetaItem item : MetaItem.getMetaItems()) { String namespace = Objects.requireNonNull(item.getRegistryName()).getNamespace(); - Map map = metaItemNames.computeIfAbsent(namespace, k -> new Object2ObjectOpenHashMap<>()); + Map map = metaItemNames.computeIfAbsent(namespace, + k -> new Object2ObjectOpenHashMap<>()); for (MetaValueItem entry : item.getAllItems()) { if (!"meta_item".equals(entry.unlocalizedName)) { @@ -150,5 +154,4 @@ public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { return position -> new ExpressionCallStatic(position, environment, method, new ExpressionString(position, nameBuilder.toString())); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/MetaTileEntityBracketHandler.java b/src/main/java/gregtech/integration/crafttweaker/recipe/MetaTileEntityBracketHandler.java index b6b99fd5946..018e2acf251 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/MetaTileEntityBracketHandler.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/MetaTileEntityBracketHandler.java @@ -1,16 +1,18 @@ package gregtech.integration.crafttweaker.recipe; +import gregtech.api.GTValues; +import gregtech.api.GregTechAPI; +import gregtech.api.metatileentity.MetaTileEntity; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + import crafttweaker.CraftTweakerAPI; import crafttweaker.annotations.BracketHandler; import crafttweaker.annotations.ZenRegister; import crafttweaker.api.item.IItemStack; import crafttweaker.mc1120.item.MCItemStack; import crafttweaker.zenscript.IBracketHandler; -import gregtech.api.GTValues; -import gregtech.api.GregTechAPI; -import gregtech.api.metatileentity.MetaTileEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; import stanhebben.zenscript.compiler.IEnvironmentGlobal; import stanhebben.zenscript.expression.ExpressionCallStatic; import stanhebben.zenscript.expression.ExpressionString; @@ -18,9 +20,10 @@ import stanhebben.zenscript.symbols.IZenSymbol; import stanhebben.zenscript.type.natives.IJavaMethod; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + @BracketHandler @ZenRegister @SuppressWarnings("unused") @@ -31,7 +34,8 @@ public class MetaTileEntityBracketHandler implements IBracketHandler { private final IJavaMethod method; public MetaTileEntityBracketHandler() { - this.method = CraftTweakerAPI.getJavaMethod(MetaTileEntityBracketHandler.class, "getCtMetaTileEntityItem", String.class); + this.method = CraftTweakerAPI.getJavaMethod(MetaTileEntityBracketHandler.class, "getCtMetaTileEntityItem", + String.class); } @Nullable @@ -46,7 +50,7 @@ public static IItemStack getCtMetaTileEntityItem(String name) { } public static String[] splitObjectName(String toSplit) { - String[] resultSplit = new String[]{GTValues.MODID, toSplit}; + String[] resultSplit = new String[] { GTValues.MODID, toSplit }; int i = toSplit.indexOf(':'); if (i >= 0) { resultSplit[1] = toSplit.substring(i + 1); @@ -69,5 +73,4 @@ public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { return position -> new ExpressionCallStatic(position, environment, method, new ExpressionString(position, nameBuilder.toString())); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/RecipeMapBracketHandler.java b/src/main/java/gregtech/integration/crafttweaker/recipe/RecipeMapBracketHandler.java index bc33c3c22b1..cd3907ccbec 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/RecipeMapBracketHandler.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/RecipeMapBracketHandler.java @@ -1,10 +1,11 @@ package gregtech.integration.crafttweaker.recipe; +import gregtech.api.recipes.RecipeMap; + import crafttweaker.CraftTweakerAPI; import crafttweaker.annotations.BracketHandler; import crafttweaker.annotations.ZenRegister; import crafttweaker.zenscript.IBracketHandler; -import gregtech.api.recipes.RecipeMap; import stanhebben.zenscript.compiler.IEnvironmentGlobal; import stanhebben.zenscript.expression.ExpressionCallStatic; import stanhebben.zenscript.expression.ExpressionString; diff --git a/src/main/java/gregtech/integration/crafttweaker/terminal/CTTerminalRegistry.java b/src/main/java/gregtech/integration/crafttweaker/terminal/CTTerminalRegistry.java index ae91b4a0e16..6b3989d8447 100644 --- a/src/main/java/gregtech/integration/crafttweaker/terminal/CTTerminalRegistry.java +++ b/src/main/java/gregtech/integration/crafttweaker/terminal/CTTerminalRegistry.java @@ -1,15 +1,17 @@ package gregtech.integration.crafttweaker.terminal; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.item.IItemStack; -import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.terminal.TerminalRegistry; import gregtech.api.terminal.hardware.Hardware; import gregtech.api.util.GTLog; import gregtech.common.terminal.hardware.BatteryHardware; import gregtech.common.terminal.hardware.DeviceHardware; + import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; + +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.item.IItemStack; +import crafttweaker.api.minecraft.CraftTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -36,7 +38,8 @@ public static void registerDevice(IItemStack device, String name) { ItemStack itemStack = CraftTweakerMC.getItemStack(device).copy(); if (!itemStack.isEmpty()) { itemStack.setCount(1); - EnumHelper.addEnum(DeviceHardware.DEVICE.class, name.toUpperCase(), new Class[]{ItemStack.class, String.class}, itemStack, name.toLowerCase()); + EnumHelper.addEnum(DeviceHardware.DEVICE.class, name.toUpperCase(), + new Class[] { ItemStack.class, String.class }, itemStack, name.toLowerCase()); } } @@ -95,6 +98,7 @@ public static void register() { @ZenClass("mods.gregtech.AppRegistryBuilder") @ZenRegister public static class CTAppRegistryBuilder { + final String appName; Boolean isDefaultApp; Map battery; @@ -128,14 +132,16 @@ public CTAppRegistryBuilder battery(int tier, int batteryTier, long cost) { @ZenMethod public CTAppRegistryBuilder device(String... device) { - Hardware[] hw = Arrays.stream(device).map(DeviceHardware.DeviceDemand::new).filter(deviceDemand -> deviceDemand.getDevice() != null).toArray(Hardware[]::new); + Hardware[] hw = Arrays.stream(device).map(DeviceHardware.DeviceDemand::new) + .filter(deviceDemand -> deviceDemand.getDevice() != null).toArray(Hardware[]::new); hardware(hw); return this; } @ZenMethod public CTAppRegistryBuilder device(int tier, String... device) { - this.hardware(tier, Arrays.stream(device).map(DeviceHardware.DeviceDemand::new).filter(deviceDemand -> deviceDemand.getDevice() != null).toArray(Hardware[]::new)); + this.hardware(tier, Arrays.stream(device).map(DeviceHardware.DeviceDemand::new) + .filter(deviceDemand -> deviceDemand.getDevice() != null).toArray(Hardware[]::new)); return this; } @@ -159,7 +165,8 @@ public CTAppRegistryBuilder upgrade(IItemStack... upgrades) { @ZenMethod public CTAppRegistryBuilder upgrade(int tier, IItemStack... upgrades) { this.upgrade.put(tier, new LinkedList<>()); - for (ItemStack up : Arrays.stream(upgrades).map(CraftTweakerMC::getItemStack).filter(itemStack -> !itemStack.isEmpty()).toArray(ItemStack[]::new)) { + for (ItemStack up : Arrays.stream(upgrades).map(CraftTweakerMC::getItemStack) + .filter(itemStack -> !itemStack.isEmpty()).toArray(ItemStack[]::new)) { this.upgrade.get(tier).add(up); } return this; diff --git a/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java b/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java index 9fb4871153a..98bb74f60df 100644 --- a/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java +++ b/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java @@ -1,11 +1,13 @@ package gregtech.integration.ctm; import gregtech.api.GTValues; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.common.Optional; + import team.chisel.ctm.api.IFacade; import javax.annotation.Nonnull; @@ -19,5 +21,6 @@ public interface IFacadeWrapper extends IFacade { @Nonnull @Override - IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side, @Nonnull BlockPos connection); + IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side, + @Nonnull BlockPos connection); } diff --git a/src/main/java/gregtech/integration/forestry/ForestryConfig.java b/src/main/java/gregtech/integration/forestry/ForestryConfig.java index f148d6aa49d..c360e66194a 100644 --- a/src/main/java/gregtech/integration/forestry/ForestryConfig.java +++ b/src/main/java/gregtech/integration/forestry/ForestryConfig.java @@ -1,6 +1,7 @@ package gregtech.integration.forestry; import gregtech.api.GTValues; + import net.minecraftforge.common.config.Config; import net.minecraftforge.common.config.Config.*; @@ -8,11 +9,11 @@ @Config(modid = GTValues.MODID, name = GTValues.MODID + "/forestry_integration", category = "Forestry") public class ForestryConfig { - @Comment({"Enable GregTech Electron Tubes.", "Default: true"}) + @Comment({ "Enable GregTech Electron Tubes.", "Default: true" }) @RequiresMcRestart public static boolean enableGTElectronTubes = true; - @Comment({"Enable the GregTech Scoop.", "Default: true"}) + @Comment({ "Enable the GregTech Scoop.", "Default: true" }) @RequiresMcRestart public static boolean enableGTScoop = true; diff --git a/src/main/java/gregtech/integration/forestry/ForestryModule.java b/src/main/java/gregtech/integration/forestry/ForestryModule.java index d7b1233f091..edd4080c33b 100644 --- a/src/main/java/gregtech/integration/forestry/ForestryModule.java +++ b/src/main/java/gregtech/integration/forestry/ForestryModule.java @@ -1,7 +1,5 @@ package gregtech.integration.forestry; -import forestry.api.core.ForestryAPI; -import forestry.core.items.IColoredItem; import gregtech.api.GTValues; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.StandardMetaItem; @@ -24,6 +22,7 @@ import gregtech.integration.forestry.recipes.*; import gregtech.integration.forestry.tools.ScoopBehavior; import gregtech.modules.GregTechModules; + import net.minecraft.client.Minecraft; import net.minecraft.item.Item; import net.minecraft.item.crafting.IRecipe; @@ -37,17 +36,20 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.registries.IForgeRegistry; + +import forestry.api.core.ForestryAPI; +import forestry.core.items.IColoredItem; import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; @GregTechModule( - moduleID = GregTechModules.MODULE_FR, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_FR, - name = "GregTech Forestry Integration", - description = "Forestry Integration Module") + moduleID = GregTechModules.MODULE_FR, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_FR, + name = "GregTech Forestry Integration", + description = "Forestry Integration Module") public class ForestryModule extends IntegrationSubmodule { private static MetaItem forestryMetaItem; @@ -102,7 +104,8 @@ public void preInit(FMLPreInitializationEvent event) { FRAME_STABILIZING = new GTItemFrame(GTFrameType.STABILIZING); FRAME_ARBORIST = new GTItemFrame(GTFrameType.ARBORIST); } else { - getLogger().warn("GregTech Frames are enabled, but Forestry Apiculture module is disabled. Skipping..."); + getLogger() + .warn("GregTech Frames are enabled, but Forestry Apiculture module is disabled. Skipping..."); } } @@ -216,7 +219,8 @@ public static void registerItems(RegistryEvent.Register event) { if (Loader.isModLoaded(GTValues.MODID_XU2)) { ELECTRODE_ORCHID = forestryMetaItem.addItem(13, "electrode.orchid"); } - if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_TR) || Loader.isModLoaded(GTValues.MODID_BINNIE)) { + if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_TR) || + Loader.isModLoaded(GTValues.MODID_BINNIE)) { ELECTRODE_RUBBER = forestryMetaItem.addItem(14, "electrode.rubber"); } } diff --git a/src/main/java/gregtech/integration/forestry/ForestryUtil.java b/src/main/java/gregtech/integration/forestry/ForestryUtil.java index 4ea464f3a9b..32fff8e1e19 100644 --- a/src/main/java/gregtech/integration/forestry/ForestryUtil.java +++ b/src/main/java/gregtech/integration/forestry/ForestryUtil.java @@ -1,15 +1,17 @@ package gregtech.integration.forestry; -import forestry.api.apiculture.IAlleleBeeEffect; -import forestry.api.apiculture.IAlleleBeeSpecies; -import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.IAlleleFlowers; -import forestry.modules.ModuleHelper; import gregtech.api.GTValues; import gregtech.integration.IntegrationModule; import gregtech.integration.forestry.bees.GTCombType; import gregtech.integration.forestry.bees.GTDropType; + import net.minecraft.item.ItemStack; + +import forestry.api.apiculture.IAlleleBeeEffect; +import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IAlleleFlowers; +import forestry.modules.ModuleHelper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -68,7 +70,8 @@ public static ItemStack getCombStack(@NotNull GTCombType type) { @NotNull public static ItemStack getCombStack(@NotNull GTCombType type, int amount) { if (!ForestryConfig.enableGTBees) { - IntegrationModule.logger.error("Tried to get GregTech Comb stack, but GregTech Bees config is not enabled!"); + IntegrationModule.logger + .error("Tried to get GregTech Comb stack, but GregTech Bees config is not enabled!"); return ItemStack.EMPTY; } if (!apicultureEnabled()) { @@ -86,7 +89,8 @@ public static ItemStack getDropStack(@NotNull GTDropType type) { @NotNull public static ItemStack getDropStack(@NotNull GTDropType type, int amount) { if (!ForestryConfig.enableGTBees) { - IntegrationModule.logger.error("Tried to get GregTech Drop stack, but GregTech Bees config is not enabled!"); + IntegrationModule.logger + .error("Tried to get GregTech Drop stack, but GregTech Bees config is not enabled!"); return ItemStack.EMPTY; } if (!apicultureEnabled()) { diff --git a/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java b/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java index 9bc4fca61f7..65546dfe020 100644 --- a/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java +++ b/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java @@ -2,6 +2,7 @@ import gregtech.api.GTValues; import gregtech.integration.IntegrationModule; + import net.minecraftforge.fml.common.Loader; import java.lang.reflect.Field; @@ -51,7 +52,7 @@ private static void removeMagicBees() { enabledField.setAccessible(true); for (var o : mbBeeDefinition.getEnumConstants()) { - if (o instanceof Enum bee) { + if (o instanceof Enumbee) { String name = bee.name(); if (MB_REMOVALS.contains(name)) { try { @@ -110,7 +111,7 @@ private static void removeExtraBees() { modifiersField.setInt(speciesBuilderField, speciesBuilderField.getModifiers() & ~Modifier.FINAL); for (var o : ebBeeDefinition.getEnumConstants()) { - if (o instanceof Enum bee) { + if (o instanceof Enumbee) { String name = bee.name(); if (EB_REMOVALS.contains(name)) { branchField.set(bee, null); diff --git a/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java b/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java index d9719821d2d..891a8277bc9 100644 --- a/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java +++ b/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java @@ -1,5 +1,14 @@ package gregtech.integration.forestry.bees; +import gregtech.api.recipes.Recipe; +import gregtech.api.recipes.RecipeMaps; +import gregtech.api.recipes.machines.IScannerRecipeMap; +import gregtech.integration.forestry.ForestryUtil; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IIndividual; import forestry.apiculture.ModuleApiculture; @@ -9,13 +18,6 @@ import forestry.core.fluids.Fluids; import forestry.lepidopterology.ModuleLepidopterology; import forestry.lepidopterology.genetics.ButterflyDefinition; -import gregtech.api.recipes.Recipe; -import gregtech.api.recipes.RecipeMaps; -import gregtech.api.recipes.machines.IScannerRecipeMap; -import gregtech.integration.forestry.ForestryUtil; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -28,7 +30,8 @@ public class ForestryScannerLogic implements IScannerRecipeMap.ICustomScannerLog private static final int HONEY_AMOUNT = 100; @Override - public Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage) { + public Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, + boolean exactVoltage) { FluidStack fluidStack = fluidInputs.get(0); if (fluidStack != null && fluidStack.containsFluid(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT))) { for (ItemStack stack : inputs) { @@ -117,7 +120,8 @@ public List getRepresentativeRecipes() { if (ForestryUtil.lepidopterologyEnabled()) { outputStack = ModuleLepidopterology.getItems().butterflyGE.getItemStack(); - outputStack.setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack + .setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); outputStack.setTranslatableName("gregtech.scanner.forestry.butterfly"); recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() .inputs(ModuleLepidopterology.getItems().butterflyGE.getWildcard()) @@ -126,7 +130,8 @@ public List getRepresentativeRecipes() { .duration(DURATION).EUt(EUT).build().getResult()); outputStack = ModuleLepidopterology.getItems().serumGE.getItemStack(); - outputStack.setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack + .setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); outputStack.setTranslatableName("gregtech.scanner.forestry.serum"); recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() .inputs(ModuleLepidopterology.getItems().serumGE.getWildcard()) @@ -135,7 +140,8 @@ public List getRepresentativeRecipes() { .duration(DURATION).EUt(EUT).build().getResult()); outputStack = ModuleLepidopterology.getItems().caterpillarGE.getItemStack(); - outputStack.setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack + .setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); outputStack.setTranslatableName("gregtech.scanner.forestry.caterpillar"); recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() .inputs(ModuleLepidopterology.getItems().caterpillarGE.getWildcard()) diff --git a/src/main/java/gregtech/integration/forestry/bees/GTAlleleBeeSpecies.java b/src/main/java/gregtech/integration/forestry/bees/GTAlleleBeeSpecies.java index 32824fd7242..b8b53f36e3d 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTAlleleBeeSpecies.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTAlleleBeeSpecies.java @@ -1,5 +1,11 @@ package gregtech.integration.forestry.bees; +import gregtech.api.GTValues; +import gregtech.integration.IntegrationModule; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + import forestry.api.apiculture.EnumBeeChromosome; import forestry.api.apiculture.IAlleleBeeSpeciesBuilder; import forestry.api.genetics.AlleleManager; @@ -7,10 +13,6 @@ import forestry.api.genetics.IClassification; import forestry.apiculture.genetics.alleles.AlleleBeeSpecies; import forestry.core.genetics.alleles.AlleleFloat; -import gregtech.api.GTValues; -import gregtech.integration.IntegrationModule; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; import org.jetbrains.annotations.NotNull; public class GTAlleleBeeSpecies extends AlleleBeeSpecies { @@ -20,7 +22,8 @@ public class GTAlleleBeeSpecies extends AlleleBeeSpecies { public GTAlleleBeeSpecies(String modId, String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, int primaryColor, int secondaryColor) { - super(modId, uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, secondaryColor); + super(modId, uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, + secondaryColor); AlleleManager.alleleRegistry.registerAllele(this, EnumBeeChromosome.SPECIES); } @@ -28,11 +31,15 @@ public GTAlleleBeeSpecies(String modId, String uid, String unlocalizedName, Stri @Override public IAlleleBeeSpeciesBuilder addProduct(@NotNull ItemStack product, @NotNull Float chance) { if (product == ItemStack.EMPTY) { - IntegrationModule.logger.warn("GTAlleleBeeSpecies#addProduct() passed an empty ItemStack for allele {}! Setting default", getUID()); + IntegrationModule.logger.warn( + "GTAlleleBeeSpecies#addProduct() passed an empty ItemStack for allele {}! Setting default", + getUID()); product = new ItemStack(Items.BOAT); } if (chance <= 0.0f || chance > 1.0f) { - IntegrationModule.logger.warn("GTAlleleBeeSpecies#addProduct() passed a chance value out of bounds for allele {}! Setting to 0.1", getUID()); + IntegrationModule.logger.warn( + "GTAlleleBeeSpecies#addProduct() passed a chance value out of bounds for allele {}! Setting to 0.1", + getUID()); chance = 0.1f; } return super.addProduct(product, chance); @@ -42,11 +49,15 @@ public IAlleleBeeSpeciesBuilder addProduct(@NotNull ItemStack product, @NotNull @Override public IAlleleBeeSpeciesBuilder addSpecialty(@NotNull ItemStack specialty, @NotNull Float chance) { if (specialty == ItemStack.EMPTY) { - IntegrationModule.logger.warn("GTAlleleBeeSpecies#addProduct() passed an empty ItemStack for allele {}! Setting default", getUID()); + IntegrationModule.logger.warn( + "GTAlleleBeeSpecies#addProduct() passed an empty ItemStack for allele {}! Setting default", + getUID()); specialty = new ItemStack(Items.BOAT); } if (chance <= 0.0f || chance > 1.0f) { - IntegrationModule.logger.warn("GTAlleleBeeSpecies#addSpecialty() passed a chance value out of bounds for allele {}! Setting to 0.1", getUID()); + IntegrationModule.logger.warn( + "GTAlleleBeeSpecies#addSpecialty() passed a chance value out of bounds for allele {}! Setting to 0.1", + getUID()); chance = 0.1f; } return super.addSpecialty(specialty, chance); diff --git a/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java b/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java index 08a962fc646..827eb307c28 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java @@ -1,20 +1,5 @@ package gregtech.integration.forestry.bees; -import appeng.core.Api; -import forestry.api.apiculture.*; -import forestry.api.core.EnumHumidity; -import forestry.api.core.EnumTemperature; -import forestry.api.genetics.IAllele; -import forestry.api.genetics.IMutationBuilder; -import forestry.apiculture.ModuleApiculture; -import forestry.apiculture.genetics.Bee; -import forestry.apiculture.genetics.BeeDefinition; -import forestry.apiculture.genetics.IBeeDefinition; -import forestry.apiculture.genetics.alleles.AlleleEffects; -import forestry.apiculture.items.EnumHoneyComb; -import forestry.core.ModuleCore; -import forestry.core.genetics.alleles.AlleleHelper; -import forestry.core.genetics.alleles.EnumAllele; import gregtech.api.GTValues; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Materials; @@ -24,12 +9,29 @@ import gregtech.integration.IntegrationUtil; import gregtech.integration.forestry.ForestryModule; import gregtech.integration.forestry.ForestryUtil; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional; + +import appeng.core.Api; +import forestry.api.apiculture.*; +import forestry.api.core.EnumHumidity; +import forestry.api.core.EnumTemperature; +import forestry.api.genetics.IAllele; +import forestry.api.genetics.IMutationBuilder; +import forestry.apiculture.ModuleApiculture; +import forestry.apiculture.genetics.Bee; +import forestry.apiculture.genetics.BeeDefinition; +import forestry.apiculture.genetics.IBeeDefinition; +import forestry.apiculture.genetics.alleles.AlleleEffects; +import forestry.apiculture.items.EnumHoneyComb; +import forestry.core.ModuleCore; +import forestry.core.genetics.alleles.AlleleHelper; +import forestry.core.genetics.alleles.EnumAllele; import org.apache.commons.lang3.text.WordUtils; import org.jetbrains.annotations.NotNull; @@ -63,10 +65,10 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.VANILLA); }, dis -> { - IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.DILIGENT, 10); + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.DILIGENT, + 10); mutation.requireResource(Blocks.HARDENED_CLAY.getDefaultState()); - } - ), + }), SLIMEBALL(GTBranchDefinition.GT_ORGANIC, "Bituminipila", true, 0x4E9E55, 0x00FF15, beeSpecies -> { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.MOSSY), 0.30f); @@ -76,7 +78,8 @@ public enum GTBeeDefinition implements IBeeDefinition { beeSpecies.setTemperature(EnumTemperature.NORMAL); if (Loader.isModLoaded(GTValues.MODID_TCON)) { beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_TCON, "edible", 1), 0.10f); - beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_TCON, "slime_congealed", 2), 0.01f); + beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_TCON, "slime_congealed", 2), + 0.01f); } else { beeSpecies.addSpecialty(new ItemStack(Blocks.SLIME_BLOCK), 0.01f); } @@ -87,14 +90,14 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1); AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1); if (Loader.isModLoaded(GTValues.MODID_EB)) { - AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, ForestryUtil.getFlowers(GTValues.MODID_EB, "water")); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, + ForestryUtil.getFlowers(GTValues.MODID_EB, "water")); } }, dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.MARSHY, CLAY, 7); mutation.requireResource(Blocks.SLIME_BLOCK.getDefaultState()); - } - ), + }), PEAT(GTBranchDefinition.GT_ORGANIC, "Limus", true, 0x906237, 0x58300B, beeSpecies -> { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.15f); @@ -111,8 +114,7 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE); }, - dis -> dis.registerMutation(BeeDefinition.RURAL, CLAY, 10) - ), + dis -> dis.registerMutation(BeeDefinition.RURAL, CLAY, 10)), STICKYRESIN(GTBranchDefinition.GT_ORGANIC, "Lenturesinae", true, 0x2E8F5B, 0xDCC289, beeSpecies -> { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.30f); @@ -128,8 +130,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(SLIMEBALL, PEAT, 15); mutation.requireResource("logRubber"); - } - ), + }), COAL(GTBranchDefinition.GT_ORGANIC, "Carbo", true, 0x666666, 0x525252, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.COAL), 0.30f); @@ -149,8 +150,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, PEAT, 9); mutation.requireResource("blockCoal"); - } - ), + }), OIL(GTBranchDefinition.GT_ORGANIC, "Oleum", true, 0x4C4C4C, 0x333333, beeSpecies -> { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.30f); @@ -167,11 +167,11 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE); AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE); if (Loader.isModLoaded(GTValues.MODID_EB)) { - AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, ForestryUtil.getFlowers(GTValues.MODID_EB, "water")); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, + ForestryUtil.getFlowers(GTValues.MODID_EB, "water")); } }, - dis -> dis.registerMutation(COAL, STICKYRESIN, 4) - ), + dis -> dis.registerMutation(COAL, STICKYRESIN, 4)), ASH(GTBranchDefinition.GT_ORGANIC, "Cinis", true, 0x1E1A18, 0xC6C6C6, beeSpecies -> { if (Loader.isModLoaded(GTValues.MODID_EB)) { @@ -193,8 +193,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(COAL, CLAY, 10); mutation.restrictTemperature(EnumTemperature.HELLISH); - } - ), + }), APATITE(GTBranchDefinition.GT_ORGANIC, "Stercorat", true, 0x7FCEF5, 0x654525, beeSpecies -> { if (Loader.isModLoaded(GTValues.MODID_EB)) { @@ -212,14 +211,14 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT); AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); if (Loader.isModLoaded(GTValues.MODID_EB)) { - AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, ForestryUtil.getFlowers(GTValues.MODID_EB, "rock")); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, + ForestryUtil.getFlowers(GTValues.MODID_EB, "rock")); } }, dis -> { IBeeMutationBuilder mutation = dis.registerMutation(ASH, COAL, 10); mutation.requireResource("blockApatite"); - } - ), + }), BIOMASS(GTBranchDefinition.GT_ORGANIC, "Taeda", true, 0x21E118, 0x17AF0E, beeSpecies -> { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.MOSSY), 0.30f); @@ -236,8 +235,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.RURAL, 10); mutation.restrictBiomeType(BiomeDictionary.Type.FOREST); - } - ), + }), FERTILIZER(GTBranchDefinition.GT_ORGANIC, "Stercorat", true, 0x7FCEF5, 0x654525, beeSpecies -> { if (Loader.isModLoaded(GTValues.MODID_EB)) { @@ -258,8 +256,7 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT); AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); }, - dis -> dis.registerMutation(ASH, APATITE, 8) - ), + dis -> dis.registerMutation(ASH, APATITE, 8)), PHOSPHORUS(GTBranchDefinition.GT_ORGANIC, "Phosphorus", false, 0xFFC826, 0xC1C1F6, beeSpecies -> { beeSpecies.addSpecialty(getGTComb(GTCombType.PHOSPHORUS), 0.35f); @@ -272,16 +269,19 @@ public enum GTBeeDefinition implements IBeeDefinition { IBeeMutationBuilder mutation = dis.registerMutation(APATITE, ASH, 12); mutation.restrictTemperature(EnumTemperature.HOT); mutation.requireResource("blockTricalciumPhosphate"); - } - ), + }), SANDWICH(GTBranchDefinition.GT_ORGANIC, "Sandwico", true, 0x32CD32, 0xDAA520, beeSpecies -> { - beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 81), 0.05f); // Cucumber Slice - beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 80), 0.05f); // Onion Slice - beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 79), 0.05f); // Tomato Slice + beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 81), 0.05f); // Cucumber + // Slice + beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 80), 0.05f); // Onion + // Slice + beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 79), 0.05f); // Tomato + // Slice beeSpecies.addSpecialty(new ItemStack(Items.COOKED_PORKCHOP), 0.05f); beeSpecies.addSpecialty(new ItemStack(Items.COOKED_BEEF), 0.15f); - beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 97), 0.05f); // Cheddar Slice + beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 97), 0.05f); // Cheddar + // Slice beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); }, @@ -296,13 +296,13 @@ public enum GTBeeDefinition implements IBeeDefinition { }, dis -> { if (Loader.isModLoaded(GTValues.MODID_MB)) { - dis.registerMutation(BeeDefinition.AGRARIAN, ForestryUtil.getSpecies(GTValues.MODID_MB, "Batty"), 10); + dis.registerMutation(BeeDefinition.AGRARIAN, ForestryUtil.getSpecies(GTValues.MODID_MB, "Batty"), + 10); } else { dis.registerMutation(BeeDefinition.AGRARIAN, BeeDefinition.IMPERIAL, 10); } }, - () -> Loader.isModLoaded(GTValues.MODID_GTFO) - ), + () -> Loader.isModLoaded(GTValues.MODID_GTFO)), // Gems REDSTONE(GTBranchDefinition.GT_GEM, "Rubrumlapis", true, 0x7D0F0F, 0xD11919, @@ -315,10 +315,10 @@ public enum GTBeeDefinition implements IBeeDefinition { }, template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), dis -> { - IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.DEMONIC, 10); + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.DEMONIC, + 10); mutation.requireResource("blockRedstone"); - } - ), + }), LAPIS(GTBranchDefinition.GT_GEM, "Lapidi", true, 0x1947D1, 0x476CDA, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -330,8 +330,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.DEMONIC, BeeDefinition.IMPERIAL, 10); mutation.requireResource("blockLapis"); - } - ), + }), CERTUS(GTBranchDefinition.GT_GEM, "Quarzeus", true, 0x57CFFB, 0xBBEEFF, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -343,8 +342,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.HERMITIC, LAPIS, 10); mutation.requireResource("blockCertusQuartz"); - } - ), + }), FLUIX(GTBranchDefinition.GT_GEM, "", true, 0xA375FF, 0xB591FF, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -355,11 +353,10 @@ public enum GTBeeDefinition implements IBeeDefinition { template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), dis -> { IBeeMutationBuilder mutation = dis.registerMutation(REDSTONE, LAPIS, 7); - Api.INSTANCE.definitions().blocks().fluixBlock().maybeBlock().ifPresent(block -> - mutation.requireResource(block.getDefaultState())); + Api.INSTANCE.definitions().blocks().fluixBlock().maybeBlock() + .ifPresent(block -> mutation.requireResource(block.getDefaultState())); }, - () -> Loader.isModLoaded(GTValues.MODID_APPENG) - ), + () -> Loader.isModLoaded(GTValues.MODID_APPENG)), DIAMOND(GTBranchDefinition.GT_GEM, "Adamas", false, 0xCCFFFF, 0xA3CCCC, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -372,8 +369,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(CERTUS, COAL, 3); mutation.requireResource("blockDiamond"); - } - ), + }), RUBY(GTBranchDefinition.GT_GEM, "Rubinus", false, 0xE6005C, 0xCC0052, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -386,8 +382,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(REDSTONE, DIAMOND, 5); mutation.requireResource("blockRuby"); - } - ), + }), SAPPHIRE(GTBranchDefinition.GT_GEM, "Sapphirus", true, 0x0033CC, 0x00248F, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -399,8 +394,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(CERTUS, LAPIS, 5); mutation.requireResource("blockSapphire"); - } - ), + }), OLIVINE(GTBranchDefinition.GT_GEM, "Olivinum", true, 0x248F24, 0xCCFFCC, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -410,8 +404,7 @@ public enum GTBeeDefinition implements IBeeDefinition { beeSpecies.setTemperature(EnumTemperature.NORMAL); }, template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), - dis -> dis.registerMutation(CERTUS, BeeDefinition.ENDED, 5) - ), + dis -> dis.registerMutation(CERTUS, BeeDefinition.ENDED, 5)), EMERALD(GTBranchDefinition.GT_GEM, "Smaragdus", false, 0x248F24, 0x2EB82E, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -425,8 +418,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(OLIVINE, DIAMOND, 4); mutation.requireResource("blockEmerald"); - } - ), + }), SPARKLING(GTBranchDefinition.GT_GEM, "Vesperstella", true, 0x7A007A, 0xFFFFFF, beeSpecies -> { beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_MB, "resource", 3), 0.20f); @@ -444,12 +436,13 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.AVERAGE); }, dis -> { - IBeeMutationBuilder mutation = dis.registerMutation(ForestryUtil.getSpecies(GTValues.MODID_MB, "Withering"), ForestryUtil.getSpecies(GTValues.MODID_MB, "Draconic"), 1); + IBeeMutationBuilder mutation = dis.registerMutation( + ForestryUtil.getSpecies(GTValues.MODID_MB, "Withering"), + ForestryUtil.getSpecies(GTValues.MODID_MB, "Draconic"), 1); mutation.requireResource("blockNetherStar"); mutation.restrictBiomeType(BiomeDictionary.Type.END); }, - () -> Loader.isModLoaded(GTValues.MODID_MB) - ), + () -> Loader.isModLoaded(GTValues.MODID_MB)), // Metals COPPER(GTBranchDefinition.GT_METAL, "Cuprum", true, 0xFF6600, 0xE65C00, @@ -464,8 +457,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.MAJESTIC, CLAY, 13); mutation.requireResource("blockCopper"); - } - ), + }), TIN(GTBranchDefinition.GT_METAL, "Stannum", true, 0xD4D4D4, 0xDDDDDD, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -478,8 +470,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(CLAY, BeeDefinition.DILIGENT, 13); mutation.requireResource("blockTin"); - } - ), + }), LEAD(GTBranchDefinition.GT_METAL, "Plumbum", true, 0x666699, 0xA3A3CC, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -492,8 +483,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(COAL, COPPER, 13); mutation.requireResource("blockLead"); - } - ), + }), IRON(GTBranchDefinition.GT_METAL, "Ferrum", true, 0xDA9147, 0xDE9C59, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -506,8 +496,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(TIN, COPPER, 13); mutation.requireResource("blockIron"); - } - ), + }), STEEL(GTBranchDefinition.GT_METAL, "Chalybe", true, 0x808080, 0x999999, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -521,8 +510,7 @@ public enum GTBeeDefinition implements IBeeDefinition { IBeeMutationBuilder mutation = dis.registerMutation(IRON, COAL, 10); mutation.requireResource("blockSteel"); mutation.restrictTemperature(EnumTemperature.HOT); - } - ), + }), NICKEL(GTBranchDefinition.GT_METAL, "Nichelium", true, 0x8585AD, 0x8585AD, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -535,8 +523,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(IRON, COPPER, 13); mutation.requireResource("blockNickel"); - } - ), + }), ZINC(GTBranchDefinition.GT_METAL, "Cadmiae", true, 0xF0DEF0, 0xF2E1F2, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -549,8 +536,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(IRON, TIN, 13); mutation.requireResource("blockZinc"); - } - ), + }), SILVER(GTBranchDefinition.GT_METAL, "Argenti", true, 0xC2C2D6, 0xCECEDE, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -563,8 +549,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(LEAD, TIN, 10); mutation.requireResource("blockSilver"); - } - ), + }), GOLD(GTBranchDefinition.GT_METAL, "Aurum", true, 0xEBC633, 0xEDCC47, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -578,8 +563,7 @@ public enum GTBeeDefinition implements IBeeDefinition { IBeeMutationBuilder mutation = dis.registerMutation(LEAD, COPPER, 13); mutation.requireResource("blockGold"); mutation.restrictTemperature(EnumTemperature.HOT); - } - ), + }), ARSENIC(GTBranchDefinition.GT_METAL, "Arsenicum", true, 0x736C52, 0x292412, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -591,8 +575,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(ZINC, SILVER, 10); mutation.requireResource("blockArsenic"); - } - ), + }), SILICON(GTBranchDefinition.GT_ORGANIC, "Silex", false, 0xADA2A7, 0x736675, beeSpecies -> { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.10f); @@ -609,8 +592,7 @@ public enum GTBeeDefinition implements IBeeDefinition { } else { dis.registerMutation(IRON, BeeDefinition.IMPERIAL, 17); } - } - ), + }), // Rare Metals ALUMINIUM(GTBranchDefinition.GT_RAREMETAL, "Alumen", true, 0xB8B8FF, 0xD6D6FF, @@ -625,8 +607,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(NICKEL, ZINC, 9); mutation.requireResource("blockAluminium"); - } - ), + }), TITANIUM(GTBranchDefinition.GT_RAREMETAL, "Titanus", true, 0xCC99FF, 0xDBB8FF, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -639,8 +620,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(REDSTONE, ALUMINIUM, 5); mutation.requireResource("blockTitanium"); - } - ), + }), // todo glowstone? CHROME(GTBranchDefinition.GT_RAREMETAL, "Chroma", true, 0xEBA1EB, 0xF2C3F2, beeSpecies -> { @@ -654,8 +634,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(TITANIUM, RUBY, 5); mutation.requireResource("blockChrome"); - } - ), + }), MANGANESE(GTBranchDefinition.GT_RAREMETAL, "Manganum", true, 0xD5D5D5, 0xAAAAAA, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -668,8 +647,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(TITANIUM, ALUMINIUM, 5); mutation.requireResource("blockManganese"); - } - ), + }), TUNGSTEN(GTBranchDefinition.GT_RAREMETAL, "Wolframium", false, 0x5C5C8A, 0x7D7DA1, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -682,8 +660,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.HEROIC, MANGANESE, 5); mutation.requireResource("blockTungsten"); - } - ), + }), PLATINUM(GTBranchDefinition.GT_RAREMETAL, "Platina", false, 0xE6E6E6, 0xFFFFCC, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -696,8 +673,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(DIAMOND, CHROME, 5); mutation.requireResource("blockPlatinum"); - } - ), + }), IRIDIUM(GTBranchDefinition.GT_RAREMETAL, "Iris", false, 0xDADADA, 0xD1D1E0, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -711,8 +687,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(TUNGSTEN, PLATINUM, 5); mutation.requireResource("blockIridium"); - } - ), + }), OSMIUM(GTBranchDefinition.GT_RAREMETAL, "Osmia", false, 0x2B2BDA, 0x8B8B8B, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -726,8 +701,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(TUNGSTEN, PLATINUM, 5); mutation.requireResource("blockOsmium"); - } - ), + }), SALTY(GTBranchDefinition.GT_RAREMETAL, "Sal", true, 0xF0C8C8, 0xFAFAFA, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -740,8 +714,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(CLAY, ALUMINIUM, 5); mutation.requireResource("blockSalt"); - } - ), + }), LITHIUM(GTBranchDefinition.GT_RAREMETAL, "Lithos", false, 0xF0328C, 0xE1DCFF, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -754,8 +727,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(SALTY, ALUMINIUM, 5); mutation.requireResource("blockLithium"); - } - ), + }), ELECTROTINE(GTBranchDefinition.GT_RAREMETAL, "Electrum", false, 0x1E90FF, 0x3CB4C8, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -768,8 +740,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(REDSTONE, GOLD, 5); mutation.requireResource("blockElectrotine"); - } - ), + }), SULFUR(GTBranchDefinition.GT_RAREMETAL, "Sulphur", false, 0x1E90FF, 0x3CB4C8, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SULFUR), 0.70f); @@ -777,8 +748,7 @@ public enum GTBeeDefinition implements IBeeDefinition { beeSpecies.setTemperature(EnumTemperature.HOT); }, template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.NORMAL), - dis -> dis.registerMutation(ASH, PEAT, 15) - ), + dis -> dis.registerMutation(ASH, PEAT, 15)), INDIUM(GTBranchDefinition.GT_RAREMETAL, "Indicium", false, 0xFFA9FF, 0x8F5D99, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.INDIUM), 0.05f); @@ -791,8 +761,7 @@ public enum GTBeeDefinition implements IBeeDefinition { IBeeMutationBuilder mutation = dis.registerMutation(LEAD, OSMIUM, 1); mutation.requireResource("blockIndium"); mutation.restrictBiomeType(BiomeDictionary.Type.END); - } - ), + }), // Industrial ENERGY(GTBranchDefinition.GT_INDUSTRIAL, "Industria", false, 0xC11F1F, 0xEBB9B9, @@ -819,13 +788,13 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation; if (Loader.isModLoaded(GTValues.MODID_EB)) { - mutation = dis.registerMutation(BeeDefinition.DEMONIC, ForestryUtil.getSpecies(GTValues.MODID_EB, "volcanic"), 10); + mutation = dis.registerMutation(BeeDefinition.DEMONIC, + ForestryUtil.getSpecies(GTValues.MODID_EB, "volcanic"), 10); } else { mutation = dis.registerMutation(BeeDefinition.DEMONIC, BeeDefinition.FIENDISH, 10); } mutation.requireResource("blockRedstone"); - } - ), + }), LAPOTRON(GTBranchDefinition.GT_INDUSTRIAL, "Azureus", false, 0xFFEBC4, 0xE36400, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.LAPIS), 0.20f); @@ -848,8 +817,7 @@ public enum GTBeeDefinition implements IBeeDefinition { IBeeMutationBuilder mutation = dis.registerMutation(LAPIS, ENERGY, 6); mutation.requireResource("blockLapis"); mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), EXPLOSIVE(GTBranchDefinition.GT_INDUSTRIAL, "Explosionis", false, 0x7E270F, 0x747474, beeSpecies -> { beeSpecies.addProduct(new ItemStack(Blocks.TNT), 0.2f); @@ -870,8 +838,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.AUSTERE, COAL, 4); mutation.requireResource(Blocks.TNT.getDefaultState()); - } - ), + }), // Alloys REDALLOY(GTBranchDefinition.GT_ALLOY, "Rubrum", false, 0xE60000, 0xB80000, @@ -888,8 +855,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(COPPER, REDSTONE, 10); mutation.requireResource("blockRedAlloy"); - } - ), + }), STAINLESSSTEEL(GTBranchDefinition.GT_ALLOY, "Nonferrugo", false, 0xC8C8DC, 0x778899, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -907,8 +873,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(CHROME, STEEL, 9); mutation.requireResource("blockStainlessSteel"); - } - ), + }), // Radioactive URANIUM(GTBranchDefinition.GT_RADIOACTIVE, "Ouranos", true, 0x19AF19, 0x169E16, @@ -926,8 +891,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.AVENGING, PLATINUM, 2); mutation.requireResource("blockUranium"); - } - ), + }), PLUTONIUM(GTBranchDefinition.GT_RADIOACTIVE, "Plutos", true, 0x570000, 0x240000, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -944,8 +908,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(URANIUM, EMERALD, 2); mutation.requireResource("blockPlutonium"); - } - ), + }), NAQUADAH(GTBranchDefinition.GT_RADIOACTIVE, "Nasquis", false, 0x003300, 0x002400, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -962,8 +925,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(PLUTONIUM, IRIDIUM, 1); mutation.requireResource("blockNaquadah"); - } - ), + }), NAQUADRIA(GTBranchDefinition.GT_RADIOACTIVE, "Nasquidrius", false, 0x000000, 0x002400, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -981,8 +943,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(PLUTONIUM, IRIDIUM, 1); mutation.requireResource("blockNaquadria"); - } - ), + }), TRINIUM(GTBranchDefinition.GT_RADIOACTIVE, "Trinium", false, 0xB0E0E6, 0xC8C8D2, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.TRINIUM), 0.75f); @@ -996,8 +957,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(IRIDIUM, NAQUADAH, 4); mutation.requireResource("blockTrinium"); - } - ), + }), THORIUM(GTBranchDefinition.GT_RADIOACTIVE, "Thorax", false, 0x005000, 0x001E00, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.THORIUM), 0.75f); @@ -1012,8 +972,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IMutationBuilder mutation = dis.registerMutation(COAL, URANIUM, 2).setIsSecret(); mutation.requireResource("blockThorium"); - } - ), + }), LUTETIUM(GTBranchDefinition.GT_RADIOACTIVE, "Lutetia", false, 0x00AAFF, 0x0059FF, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.LUTETIUM), 0.15f); @@ -1035,8 +994,7 @@ public enum GTBeeDefinition implements IBeeDefinition { } mutation.setIsSecret(); mutation.requireResource("blockLutetium"); - } - ), + }), AMERICIUM(GTBranchDefinition.GT_RADIOACTIVE, "Libertas", false, 0x287869, 0x0C453A, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.AMERICIUM), 0.05f); @@ -1052,8 +1010,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IMutationBuilder mutation = dis.registerMutation(LUTETIUM, CHROME, 1).setIsSecret(); mutation.requireResource("blockAmericium"); - } - ), + }), NEUTRONIUM(GTBranchDefinition.GT_RADIOACTIVE, "Media", false, 0xFFF0F0, 0xFAFAFA, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.NEUTRONIUM), 0.0001f); @@ -1069,8 +1026,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IMutationBuilder mutation = dis.registerMutation(NAQUADRIA, AMERICIUM, 1).setIsSecret(); mutation.requireResource(new UnificationEntry(OrePrefix.block, Materials.Neutronium).toString()); - } - ), + }), // Noble Gases HELIUM(GTBranchDefinition.GT_NOBLEGAS, "Helium", false, 0xFFA9FF, 0xC8B8B4, @@ -1085,13 +1041,13 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation; if (Loader.isModLoaded(GTValues.MODID_MB)) { - mutation = dis.registerMutation(STAINLESSSTEEL, ForestryUtil.getSpecies(GTValues.MODID_MB, "Watery"), 10); + mutation = dis.registerMutation(STAINLESSSTEEL, + ForestryUtil.getSpecies(GTValues.MODID_MB, "Watery"), 10); } else { mutation = dis.registerMutation(STAINLESSSTEEL, BeeDefinition.INDUSTRIOUS, 10); } mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), ARGON(GTBranchDefinition.GT_NOBLEGAS, "Argon", false, 0x89D9E1, 0xBDA5C2, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.ARGON), 0.35f); @@ -1104,13 +1060,13 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation; if (Loader.isModLoaded(GTValues.MODID_MB)) { - mutation = dis.registerMutation(HELIUM, ForestryUtil.getSpecies(GTValues.MODID_MB, "Supernatural"), 8); + mutation = dis.registerMutation(HELIUM, ForestryUtil.getSpecies(GTValues.MODID_MB, "Supernatural"), + 8); } else { mutation = dis.registerMutation(HELIUM, BeeDefinition.IMPERIAL, 8); } mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), NEON(GTBranchDefinition.GT_NOBLEGAS, "Novum", false, 0xFFC826, 0xFF7200, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.NEON), 0.35f); @@ -1123,8 +1079,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(ARGON, IRON, 6); mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), KRYPTON(GTBranchDefinition.GT_NOBLEGAS, "Kryptos", false, 0x8A97B0, 0x160822, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.KRYPTON), 0.35f); @@ -1137,13 +1092,13 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation; if (Loader.isModLoaded(GTValues.MODID_MB)) { - mutation = dis.registerMutation(NEON, ForestryUtil.getSpecies(GTValues.MODID_MB, "Supernatural"), 4); + mutation = dis.registerMutation(NEON, ForestryUtil.getSpecies(GTValues.MODID_MB, "Supernatural"), + 4); } else { mutation = dis.registerMutation(NEON, BeeDefinition.AVENGING, 4); } mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), XENON(GTBranchDefinition.GT_NOBLEGAS, "Hostis", false, 0x8A97B0, 0x160822, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.XENON), 0.525f); @@ -1156,8 +1111,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(KRYPTON, BeeDefinition.EDENIC, 2); mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), OXYGEN(GTBranchDefinition.GT_NOBLEGAS, "Oxygeni", false, 0xFFFFFF, 0x8F8FFF, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.OXYGEN), 0.45f); @@ -1171,8 +1125,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(HELIUM, BeeDefinition.ENDED, 15); mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), HYDROGEN(GTBranchDefinition.GT_NOBLEGAS, "Hydrogenium", false, 0xFFFFFF, 0xFF1493, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.HYDROGEN), 0.45f); @@ -1191,8 +1144,7 @@ public enum GTBeeDefinition implements IBeeDefinition { mutation = dis.registerMutation(OXYGEN, BeeDefinition.INDUSTRIOUS, 15); } mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), NITROGEN(GTBranchDefinition.GT_NOBLEGAS, "Nitrogenium", false, 0xFFC832, 0xA52A2A, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.NITROGEN), 0.45f); @@ -1206,8 +1158,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(OXYGEN, HYDROGEN, 15); mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), FLUORINE(GTBranchDefinition.GT_NOBLEGAS, "Fluens", false, 0x86AFF0, 0xFF6D00, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.FLUORINE), 0.45f); @@ -1221,8 +1172,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(NITROGEN, HYDROGEN, 15); mutation.restrictTemperature(EnumTemperature.ICY); - } - ); + }); private final GTBranchDefinition branch; private final GTAlleleBeeSpecies species; @@ -1264,7 +1214,8 @@ public enum GTBeeDefinition implements IBeeDefinition { String name = "for.bees.species." + lowercaseName; this.branch = branch; - this.species = new GTAlleleBeeSpecies(GTValues.MODID, uid, name, "GregTech", description, dominant, branch.getBranch(), binomial, primary, secondary); + this.species = new GTAlleleBeeSpecies(GTValues.MODID, uid, name, "GregTech", description, dominant, + branch.getBranch(), binomial, primary, secondary); this.generationCondition = generationCondition; } @@ -1317,7 +1268,7 @@ private void init() { AlleleHelper.getInstance().set(template, SPECIES, species); setAlleles(template); - //noinspection ConstantConditions + // noinspection ConstantConditions genome = BeeManager.beeRoot.templateAsGenome(template); BeeManager.beeRoot.registerTemplate(template); @@ -1337,7 +1288,7 @@ private IBeeMutationBuilder registerMutation(IBeeDefinition parent1, IAlleleBeeS } private IBeeMutationBuilder registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance) { - //noinspection ConstantConditions + // noinspection ConstantConditions return BeeManager.beeMutationFactory.createMutation(parent1, parent2, getTemplate(), chance); } @@ -1361,7 +1312,7 @@ public final IBee getIndividual() { @NotNull @Override public final ItemStack getMemberStack(@NotNull EnumBeeType beeType) { - //noinspection ConstantConditions + // noinspection ConstantConditions return BeeManager.beeRoot.getMemberStack(getIndividual(), beeType); } } diff --git a/src/main/java/gregtech/integration/forestry/bees/GTBranchDefinition.java b/src/main/java/gregtech/integration/forestry/bees/GTBranchDefinition.java index ce2c094e770..b65b77cc754 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTBranchDefinition.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTBranchDefinition.java @@ -91,7 +91,7 @@ public enum GTBranchDefinition { private final Consumer branchProperties; GTBranchDefinition(String scientific, Consumer branchProperties) { - //noinspection ConstantConditions + // noinspection ConstantConditions this.branch = BeeManager.beeFactory.createBranch(this.name().toLowerCase(), scientific); AlleleManager.alleleRegistry.getClassification("family.apidae").addMemberGroup(this.branch); this.branchProperties = branchProperties; diff --git a/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java b/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java index ba1593ce53d..0769ad034bf 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java @@ -1,11 +1,7 @@ package gregtech.integration.forestry.bees; -import forestry.api.core.IItemModelRegister; -import forestry.api.core.IModelManager; -import forestry.api.core.Tabs; -import forestry.core.items.IColoredItem; -import forestry.core.utils.ItemTooltipUtil; import gregtech.api.GTValues; + import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -14,6 +10,12 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import forestry.api.core.IItemModelRegister; +import forestry.api.core.IModelManager; +import forestry.api.core.Tabs; +import forestry.core.items.IColoredItem; +import forestry.core.utils.ItemTooltipUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -63,7 +65,8 @@ public int getColorFromItemstack(ItemStack stack, int tintIndex) { } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); ItemTooltipUtil.addInformation(stack, worldIn, tooltip, flagIn); } diff --git a/src/main/java/gregtech/integration/forestry/bees/GTCombType.java b/src/main/java/gregtech/integration/forestry/bees/GTCombType.java index ec773f29c8e..f774e6f68d0 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTCombType.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTCombType.java @@ -1,6 +1,7 @@ package gregtech.integration.forestry.bees; import gregtech.api.GTValues; + import net.minecraftforge.fml.common.Loader; public enum GTCombType { @@ -106,7 +107,7 @@ public enum GTCombType { GTCombType(String name, int primary, int secondary, boolean show) { this.name = name; - this.color = new int[]{primary, secondary}; + this.color = new int[] { primary, secondary }; this.showInList = show; } diff --git a/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java b/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java index 27df7cf87b4..45a67068b2a 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java @@ -1,5 +1,12 @@ package gregtech.integration.forestry.bees; +import gregtech.api.GTValues; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; + import forestry.api.apiculture.BeeManager; import forestry.api.arboriculture.TreeManager; import forestry.api.core.IItemModelRegister; @@ -9,11 +16,6 @@ import forestry.api.genetics.ISpeciesRoot; import forestry.api.lepidopterology.ButterflyManager; import forestry.core.items.IColoredItem; -import gregtech.api.GTValues; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/integration/forestry/bees/GTDropType.java b/src/main/java/gregtech/integration/forestry/bees/GTDropType.java index f8781c4aafa..9625ee7d8e3 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTDropType.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTDropType.java @@ -14,7 +14,7 @@ public enum GTDropType { GTDropType(String name, int primary, int secondary) { this.name = name; - this.color = new int[]{primary, secondary}; + this.color = new int[] { primary, secondary }; } public static GTDropType getDrop(int meta) { diff --git a/src/main/java/gregtech/integration/forestry/frames/GTFrameType.java b/src/main/java/gregtech/integration/forestry/frames/GTFrameType.java index a6d6e80d1bc..f16df9d6539 100644 --- a/src/main/java/gregtech/integration/forestry/frames/GTFrameType.java +++ b/src/main/java/gregtech/integration/forestry/frames/GTFrameType.java @@ -36,7 +36,8 @@ public enum GTFrameType implements IBeeModifier { private final float floweringMod; private final float geneticDecayMod; - GTFrameType(String name, int maxDamage, float territory, float mutation, float lifespan, float production, float flowering, float geneticDecay) { + GTFrameType(String name, int maxDamage, float territory, float mutation, float lifespan, float production, + float flowering, float geneticDecay) { this.frameName = name; this.maxDamage = maxDamage; this.territoryMod = territory; diff --git a/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java b/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java index 2bf1b1d4638..088c5ed7e73 100644 --- a/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java +++ b/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java @@ -1,19 +1,21 @@ package gregtech.integration.forestry.frames; -import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeHousing; -import forestry.api.apiculture.IBeeModifier; -import forestry.api.apiculture.IHiveFrame; -import forestry.api.core.IItemModelRegister; -import forestry.api.core.IModelManager; -import forestry.api.core.Tabs; import gregtech.api.GTValues; + import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import forestry.api.apiculture.IBee; +import forestry.api.apiculture.IBeeHousing; +import forestry.api.apiculture.IBeeModifier; +import forestry.api.apiculture.IHiveFrame; +import forestry.api.core.IItemModelRegister; +import forestry.api.core.IModelManager; +import forestry.api.core.Tabs; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,7 +37,8 @@ public GTItemFrame(GTFrameType type) { @SideOnly(Side.CLIENT) @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { // TODO super.addInformation(stack, worldIn, tooltip, flagIn); } diff --git a/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java index f78f52ff6ca..66df87dc408 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java @@ -1,12 +1,5 @@ package gregtech.integration.forestry.recipes; -import appeng.core.Api; -import com.google.common.collect.ImmutableMap; -import forestry.api.recipes.ICentrifugeRecipe; -import forestry.api.recipes.RecipeManagers; -import forestry.core.ModuleCore; -import forestry.factory.MachineUIDs; -import forestry.factory.ModuleFactory; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.CleanroomType; import gregtech.api.recipes.RecipeBuilder; @@ -25,10 +18,19 @@ import gregtech.integration.forestry.bees.GTCombItem; import gregtech.integration.forestry.bees.GTCombType; import gregtech.integration.forestry.bees.GTDropType; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Loader; +import appeng.core.Api; +import com.google.common.collect.ImmutableMap; +import forestry.api.recipes.ICentrifugeRecipe; +import forestry.api.recipes.RecipeManagers; +import forestry.core.ModuleCore; +import forestry.factory.MachineUIDs; +import forestry.factory.ModuleFactory; + import java.util.Arrays; import java.util.Map; @@ -61,82 +63,156 @@ public static void initForestryCombs() { // forgive me for the code i am about to write public static void initGTCombs() { // Organic - addProcessGT(GTCombType.COAL, new Material[]{Materials.Coal}, Voltage.LV); - addProcessGT(GTCombType.COKE, new Material[]{Materials.Coke}, Voltage.LV); - addCentrifugeToItemStack(GTCombType.STICKY, new ItemStack[]{MetaItems.STICKY_RESIN.getStackForm(), MetaItems.PLANT_BALL.getStackForm(), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{50 * 100, 15 * 100, 50 * 100}, Voltage.ULV); - addProcessGT(GTCombType.OIL, new Material[]{Materials.Oilsands}, Voltage.LV); - addProcessGT(GTCombType.APATITE, new Material[]{Materials.Apatite, Materials.TricalciumPhosphate}, Voltage.LV); - addCentrifugeToMaterial(GTCombType.ASH, new Material[]{Materials.DarkAsh, Materials.Ash}, new int[]{50 * 100, 50 * 100}, new int[]{9, 9}, Voltage.ULV, ItemStack.EMPTY, 50 * 100); - addCentrifugeToItemStack(GTCombType.BIOMASS, new ItemStack[]{ForestryUtil.getDropStack(GTDropType.BIOMASS), ForestryUtil.getDropStack(GTDropType.ETHANOL), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{70 * 100, 30 * 100, 50 * 100}, Voltage.ULV); - addCentrifugeToItemStack(GTCombType.PHOSPHORUS, new ItemStack[]{OreDictUnifier.get(OrePrefix.dust, Materials.Phosphorus), OreDictUnifier.get(OrePrefix.dust, Materials.TricalciumPhosphate), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{100 * 100, 100 * 100, 100 * 100}, Voltage.HV); - addCentrifugeToItemStack(GTCombType.COAL, new ItemStack[]{OreDictUnifier.get(OrePrefix.gem, Materials.Coal), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{5 * 100, 50 * 100}, Voltage.ULV); - addCentrifugeToItemStack(GTCombType.COKE, new ItemStack[]{OreDictUnifier.get(OrePrefix.gem, Materials.Coke), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{5 * 100, 50 * 100}, Voltage.ULV); - addCentrifugeToItemStack(GTCombType.OIL, new ItemStack[]{OreDictUnifier.get(OrePrefix.dustTiny, Materials.Oilsands), ForestryUtil.getDropStack(GTDropType.OIL), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{70 * 100, 100 * 100, 50 * 100}, Voltage.ULV); + addProcessGT(GTCombType.COAL, new Material[] { Materials.Coal }, Voltage.LV); + addProcessGT(GTCombType.COKE, new Material[] { Materials.Coke }, Voltage.LV); + addCentrifugeToItemStack(GTCombType.STICKY, + new ItemStack[] { MetaItems.STICKY_RESIN.getStackForm(), MetaItems.PLANT_BALL.getStackForm(), + ModuleCore.getItems().beeswax.getItemStack() }, + new int[] { 50 * 100, 15 * 100, 50 * 100 }, Voltage.ULV); + addProcessGT(GTCombType.OIL, new Material[] { Materials.Oilsands }, Voltage.LV); + addProcessGT(GTCombType.APATITE, new Material[] { Materials.Apatite, Materials.TricalciumPhosphate }, + Voltage.LV); + addCentrifugeToMaterial(GTCombType.ASH, new Material[] { Materials.DarkAsh, Materials.Ash }, + new int[] { 50 * 100, 50 * 100 }, new int[] { 9, 9 }, Voltage.ULV, ItemStack.EMPTY, 50 * 100); + addCentrifugeToItemStack(GTCombType.BIOMASS, + new ItemStack[] { ForestryUtil.getDropStack(GTDropType.BIOMASS), + ForestryUtil.getDropStack(GTDropType.ETHANOL), ModuleCore.getItems().beeswax.getItemStack() }, + new int[] { 70 * 100, 30 * 100, 50 * 100 }, Voltage.ULV); + addCentrifugeToItemStack(GTCombType.PHOSPHORUS, + new ItemStack[] { OreDictUnifier.get(OrePrefix.dust, Materials.Phosphorus), + OreDictUnifier.get(OrePrefix.dust, Materials.TricalciumPhosphate), + ModuleCore.getItems().beeswax.getItemStack() }, + new int[] { 100 * 100, 100 * 100, 100 * 100 }, Voltage.HV); + addCentrifugeToItemStack(GTCombType.COAL, new ItemStack[] { OreDictUnifier.get(OrePrefix.gem, Materials.Coal), + ModuleCore.getItems().beeswax.getItemStack() }, new int[] { 5 * 100, 50 * 100 }, Voltage.ULV); + addCentrifugeToItemStack(GTCombType.COKE, new ItemStack[] { OreDictUnifier.get(OrePrefix.gem, Materials.Coke), + ModuleCore.getItems().beeswax.getItemStack() }, new int[] { 5 * 100, 50 * 100 }, Voltage.ULV); + addCentrifugeToItemStack(GTCombType.OIL, + new ItemStack[] { OreDictUnifier.get(OrePrefix.dustTiny, Materials.Oilsands), + ForestryUtil.getDropStack(GTDropType.OIL), ModuleCore.getItems().beeswax.getItemStack() }, + new int[] { 70 * 100, 100 * 100, 50 * 100 }, Voltage.ULV); // Industrial - addCentrifugeToItemStack(GTCombType.ENERGY, new ItemStack[]{MetaItems.ENERGIUM_DUST.getStackForm(), ModuleCore.getItems().refractoryWax.getItemStack()}, new int[]{20 * 100, 50 * 100}, Voltage.HV, 196); + addCentrifugeToItemStack(GTCombType.ENERGY, + new ItemStack[] { MetaItems.ENERGIUM_DUST.getStackForm(), + ModuleCore.getItems().refractoryWax.getItemStack() }, + new int[] { 20 * 100, 50 * 100 }, Voltage.HV, 196); ItemStack wax = ModuleCore.getItems().beeswax.getItemStack(); if (Loader.isModLoaded(GTValues.MODID_MB)) { wax = IntegrationUtil.getModItem(GTValues.MODID_MB, "wax", 2); } - addCentrifugeToItemStack(GTCombType.LAPOTRON, new ItemStack[]{OreDictUnifier.get(OrePrefix.dust, Materials.Lapotron), wax}, new int[]{100 * 100, 40 * 100}, Voltage.HV, 196); + addCentrifugeToItemStack(GTCombType.LAPOTRON, + new ItemStack[] { OreDictUnifier.get(OrePrefix.dust, Materials.Lapotron), wax }, + new int[] { 100 * 100, 40 * 100 }, Voltage.HV, 196); // Alloy - addProcessGT(GTCombType.REDALLOY, new Material[]{Materials.RedAlloy, Materials.Redstone, Materials.Copper}, Voltage.LV); - addProcessGT(GTCombType.STAINLESSSTEEL, new Material[]{Materials.StainlessSteel, Materials.Iron, Materials.Chrome, Materials.Manganese, Materials.Nickel}, Voltage.HV); - addCentrifugeToMaterial(GTCombType.REDALLOY, new Material[]{Materials.RedAlloy}, new int[]{100 * 100}, new int[]{9}, Voltage.ULV, ModuleCore.getItems().refractoryWax.getItemStack(), 50 * 100); - addCentrifugeToMaterial(GTCombType.STAINLESSSTEEL, new Material[]{Materials.StainlessSteel}, new int[]{50 * 100}, new int[]{9}, Voltage.HV, ModuleCore.getItems().refractoryWax.getItemStack(), 50 * 100); + addProcessGT(GTCombType.REDALLOY, new Material[] { Materials.RedAlloy, Materials.Redstone, Materials.Copper }, + Voltage.LV); + addProcessGT(GTCombType.STAINLESSSTEEL, new Material[] { Materials.StainlessSteel, Materials.Iron, + Materials.Chrome, Materials.Manganese, Materials.Nickel }, Voltage.HV); + addCentrifugeToMaterial(GTCombType.REDALLOY, new Material[] { Materials.RedAlloy }, new int[] { 100 * 100 }, + new int[] { 9 }, Voltage.ULV, ModuleCore.getItems().refractoryWax.getItemStack(), 50 * 100); + addCentrifugeToMaterial(GTCombType.STAINLESSSTEEL, new Material[] { Materials.StainlessSteel }, + new int[] { 50 * 100 }, new int[] { 9 }, Voltage.HV, ModuleCore.getItems().refractoryWax.getItemStack(), + 50 * 100); // Gem - addProcessGT(GTCombType.STONE, new Material[]{Materials.Soapstone, Materials.Talc, Materials.Apatite, Materials.Phosphate, Materials.TricalciumPhosphate}, Voltage.LV); - addProcessGT(GTCombType.CERTUS, new Material[]{Materials.CertusQuartz, Materials.Quartzite, Materials.Barite}, Voltage.LV); - addProcessGT(GTCombType.REDSTONE, new Material[]{Materials.Redstone, Materials.Cinnabar}, Voltage.LV); - addCentrifugeToMaterial(GTCombType.RAREEARTH, new Material[]{Materials.RareEarth}, new int[]{100 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addProcessGT(GTCombType.LAPIS, new Material[]{Materials.Lapis, Materials.Sodalite, Materials.Lazurite, Materials.Calcite}, Voltage.LV); - addProcessGT(GTCombType.RUBY, new Material[]{Materials.Ruby, Materials.Redstone}, Voltage.LV); - addProcessGT(GTCombType.SAPPHIRE, new Material[]{Materials.Sapphire, Materials.GreenSapphire, Materials.Almandine, Materials.Pyrope}, Voltage.LV); - addProcessGT(GTCombType.DIAMOND, new Material[]{Materials.Diamond, Materials.Graphite}, Voltage.LV); - addProcessGT(GTCombType.OLIVINE, new Material[]{Materials.Olivine, Materials.Bentonite, Materials.Magnesite, Materials.GlauconiteSand}, Voltage.LV); - addProcessGT(GTCombType.EMERALD, new Material[]{Materials.Emerald, Materials.Beryllium, Materials.Thorium}, Voltage.LV); - addProcessGT(GTCombType.PYROPE, new Material[]{Materials.Pyrope, Materials.Aluminium, Materials.Magnesium, Materials.Silicon}, Voltage.LV); - addProcessGT(GTCombType.GROSSULAR, new Material[]{Materials.Grossular, Materials.Aluminium, Materials.Silicon}, Voltage.LV); - addCentrifugeToMaterial(GTCombType.STONE, new Material[]{Materials.Stone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Basalt, Materials.Marble}, new int[]{70 * 100, 50 * 100, 50 * 100, 50 * 100, 50 * 100}, new int[]{9, 9, 9, 9, 9}, Voltage.ULV, ItemStack.EMPTY, 50 * 100); + addProcessGT(GTCombType.STONE, new Material[] { Materials.Soapstone, Materials.Talc, Materials.Apatite, + Materials.Phosphate, Materials.TricalciumPhosphate }, Voltage.LV); + addProcessGT(GTCombType.CERTUS, + new Material[] { Materials.CertusQuartz, Materials.Quartzite, Materials.Barite }, Voltage.LV); + addProcessGT(GTCombType.REDSTONE, new Material[] { Materials.Redstone, Materials.Cinnabar }, Voltage.LV); + addCentrifugeToMaterial(GTCombType.RAREEARTH, new Material[] { Materials.RareEarth }, new int[] { 100 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addProcessGT(GTCombType.LAPIS, + new Material[] { Materials.Lapis, Materials.Sodalite, Materials.Lazurite, Materials.Calcite }, + Voltage.LV); + addProcessGT(GTCombType.RUBY, new Material[] { Materials.Ruby, Materials.Redstone }, Voltage.LV); + addProcessGT(GTCombType.SAPPHIRE, + new Material[] { Materials.Sapphire, Materials.GreenSapphire, Materials.Almandine, Materials.Pyrope }, + Voltage.LV); + addProcessGT(GTCombType.DIAMOND, new Material[] { Materials.Diamond, Materials.Graphite }, Voltage.LV); + addProcessGT(GTCombType.OLIVINE, new Material[] { Materials.Olivine, Materials.Bentonite, Materials.Magnesite, + Materials.GlauconiteSand }, Voltage.LV); + addProcessGT(GTCombType.EMERALD, new Material[] { Materials.Emerald, Materials.Beryllium, Materials.Thorium }, + Voltage.LV); + addProcessGT(GTCombType.PYROPE, + new Material[] { Materials.Pyrope, Materials.Aluminium, Materials.Magnesium, Materials.Silicon }, + Voltage.LV); + addProcessGT(GTCombType.GROSSULAR, + new Material[] { Materials.Grossular, Materials.Aluminium, Materials.Silicon }, Voltage.LV); + addCentrifugeToMaterial(GTCombType.STONE, + new Material[] { Materials.Stone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Basalt, + Materials.Marble }, + new int[] { 70 * 100, 50 * 100, 50 * 100, 50 * 100, 50 * 100 }, new int[] { 9, 9, 9, 9, 9 }, + Voltage.ULV, ItemStack.EMPTY, 50 * 100); // Metals - addProcessGT(GTCombType.COPPER, new Material[]{Materials.Copper, Materials.Tetrahedrite, Materials.Chalcopyrite, Materials.Malachite, Materials.Pyrite, Materials.Stibnite}, Voltage.LV); - addProcessGT(GTCombType.TIN, new Material[]{Materials.Tin, Materials.Cassiterite, Materials.CassiteriteSand}, Voltage.LV); - addProcessGT(GTCombType.LEAD, new Material[]{Materials.Lead, Materials.Galena}, Voltage.LV); - addProcessGT(GTCombType.NICKEL, new Material[]{Materials.Nickel, Materials.Garnierite, Materials.Pentlandite, Materials.Cobaltite, Materials.Wulfenite, Materials.Powellite}, Voltage.LV); - addProcessGT(GTCombType.ZINC, new Material[]{Materials.Sphalerite, Materials.Sulfur}, Voltage.LV); - addProcessGT(GTCombType.SILVER, new Material[]{Materials.Silver, Materials.Galena}, Voltage.LV); - addProcessGT(GTCombType.GOLD, new Material[]{Materials.Gold, Materials.Magnetite}, Voltage.LV); - addProcessGT(GTCombType.SULFUR, new Material[]{Materials.Sulfur, Materials.Pyrite, Materials.Sphalerite}, Voltage.LV); - addProcessGT(GTCombType.GALLIUM, new Material[]{Materials.Gallium, Materials.Niobium}, Voltage.LV); - addProcessGT(GTCombType.ARSENIC, new Material[]{Materials.Realgar, Materials.Cassiterite, Materials.Zeolite}, Voltage.LV); - addProcessGT(GTCombType.IRON, new Material[]{Materials.Iron, Materials.Magnetite, Materials.BrownLimonite, Materials.YellowLimonite, Materials.VanadiumMagnetite, Materials.BandedIron, Materials.Pyrite}, Voltage.LV); - - addCentrifugeToMaterial(GTCombType.SLAG, new Material[]{Materials.Stone, Materials.GraniteBlack, Materials.GraniteRed}, new int[]{50 * 100, 20 * 100, 20 * 100}, new int[]{9, 9, 9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addCentrifugeToMaterial(GTCombType.COPPER, new Material[]{Materials.Copper}, new int[]{70 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addCentrifugeToMaterial(GTCombType.TIN, new Material[]{Materials.Tin}, new int[]{60 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addCentrifugeToMaterial(GTCombType.LEAD, new Material[]{Materials.Lead}, new int[]{45 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addCentrifugeToMaterial(GTCombType.IRON, new Material[]{Materials.Iron}, new int[]{30 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addCentrifugeToMaterial(GTCombType.STEEL, new Material[]{Materials.Steel}, new int[]{40 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addCentrifugeToMaterial(GTCombType.SILVER, new Material[]{Materials.Silver}, new int[]{80 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addProcessGT(GTCombType.COPPER, new Material[] { Materials.Copper, Materials.Tetrahedrite, + Materials.Chalcopyrite, Materials.Malachite, Materials.Pyrite, Materials.Stibnite }, Voltage.LV); + addProcessGT(GTCombType.TIN, new Material[] { Materials.Tin, Materials.Cassiterite, Materials.CassiteriteSand }, + Voltage.LV); + addProcessGT(GTCombType.LEAD, new Material[] { Materials.Lead, Materials.Galena }, Voltage.LV); + addProcessGT(GTCombType.NICKEL, new Material[] { Materials.Nickel, Materials.Garnierite, Materials.Pentlandite, + Materials.Cobaltite, Materials.Wulfenite, Materials.Powellite }, Voltage.LV); + addProcessGT(GTCombType.ZINC, new Material[] { Materials.Sphalerite, Materials.Sulfur }, Voltage.LV); + addProcessGT(GTCombType.SILVER, new Material[] { Materials.Silver, Materials.Galena }, Voltage.LV); + addProcessGT(GTCombType.GOLD, new Material[] { Materials.Gold, Materials.Magnetite }, Voltage.LV); + addProcessGT(GTCombType.SULFUR, new Material[] { Materials.Sulfur, Materials.Pyrite, Materials.Sphalerite }, + Voltage.LV); + addProcessGT(GTCombType.GALLIUM, new Material[] { Materials.Gallium, Materials.Niobium }, Voltage.LV); + addProcessGT(GTCombType.ARSENIC, new Material[] { Materials.Realgar, Materials.Cassiterite, Materials.Zeolite }, + Voltage.LV); + addProcessGT( + GTCombType.IRON, new Material[] { Materials.Iron, Materials.Magnetite, Materials.BrownLimonite, + Materials.YellowLimonite, Materials.VanadiumMagnetite, Materials.BandedIron, Materials.Pyrite }, + Voltage.LV); + + addCentrifugeToMaterial(GTCombType.SLAG, + new Material[] { Materials.Stone, Materials.GraniteBlack, Materials.GraniteRed }, + new int[] { 50 * 100, 20 * 100, 20 * 100 }, new int[] { 9, 9, 9 }, Voltage.ULV, ItemStack.EMPTY, + 30 * 100); + addCentrifugeToMaterial(GTCombType.COPPER, new Material[] { Materials.Copper }, new int[] { 70 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.TIN, new Material[] { Materials.Tin }, new int[] { 60 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.LEAD, new Material[] { Materials.Lead }, new int[] { 45 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.IRON, new Material[] { Materials.Iron }, new int[] { 30 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.STEEL, new Material[] { Materials.Steel }, new int[] { 40 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.SILVER, new Material[] { Materials.Silver }, new int[] { 80 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); // Rare Metals - addProcessGT(GTCombType.BAUXITE, new Material[]{Materials.Bauxite, Materials.Aluminium}, Voltage.LV); - addProcessGT(GTCombType.ALUMINIUM, new Material[]{Materials.Aluminium, Materials.Bauxite}, Voltage.LV); - addProcessGT(GTCombType.MANGANESE, new Material[]{Materials.Manganese, Materials.Grossular, Materials.Spessartine, Materials.Pyrolusite, Materials.Tantalite}, Voltage.LV); - addProcessGT(GTCombType.TITANIUM, new Material[]{Materials.Titanium, Materials.Ilmenite, Materials.Bauxite, Materials.Rutile}, Voltage.EV); - addProcessGT(GTCombType.MAGNESIUM, new Material[]{Materials.Magnesium, Materials.Magnesite}, Voltage.LV); - addProcessGT(GTCombType.CHROME, new Material[]{Materials.Chrome, Materials.Ruby, Materials.Chromite, Materials.Redstone, Materials.Neodymium, Materials.Bastnasite}, Voltage.HV); - addProcessGT(GTCombType.TUNGSTEN, new Material[]{Materials.Tungsten, Materials.Tungstate, Materials.Scheelite, Materials.Lithium}, Voltage.IV); - addProcessGT(GTCombType.PLATINUM, new Material[]{Materials.Platinum, Materials.Cooperite, Materials.Palladium}, Voltage.HV); - addProcessGT(GTCombType.MOLYBDENUM, new Material[]{Materials.Molybdenum, Materials.Molybdenite, Materials.Powellite, Materials.Wulfenite}, Voltage.LV); - addProcessGT(GTCombType.LITHIUM, new Material[]{Materials.Lithium, Materials.Lepidolite, Materials.Spodumene}, Voltage.MV); - addProcessGT(GTCombType.SALT, new Material[]{Materials.Salt, Materials.RockSalt, Materials.Saltpeter}, Voltage.MV); - addProcessGT(GTCombType.ELECTROTINE, new Material[]{Materials.Electrotine, Materials.Electrum, Materials.Redstone}, Voltage.MV); - addCentrifugeToMaterial(GTCombType.SALT, new Material[]{Materials.Salt, Materials.RockSalt, Materials.Saltpeter}, new int[]{100 * 100, 100 * 100, 25 * 100}, new int[]{9 * 6, 9 * 6, 9 * 6}, Voltage.MV, 160, ItemStack.EMPTY, 50 * 100); + addProcessGT(GTCombType.BAUXITE, new Material[] { Materials.Bauxite, Materials.Aluminium }, Voltage.LV); + addProcessGT(GTCombType.ALUMINIUM, new Material[] { Materials.Aluminium, Materials.Bauxite }, Voltage.LV); + addProcessGT(GTCombType.MANGANESE, new Material[] { Materials.Manganese, Materials.Grossular, + Materials.Spessartine, Materials.Pyrolusite, Materials.Tantalite }, Voltage.LV); + addProcessGT(GTCombType.TITANIUM, + new Material[] { Materials.Titanium, Materials.Ilmenite, Materials.Bauxite, Materials.Rutile }, + Voltage.EV); + addProcessGT(GTCombType.MAGNESIUM, new Material[] { Materials.Magnesium, Materials.Magnesite }, Voltage.LV); + addProcessGT(GTCombType.CHROME, new Material[] { Materials.Chrome, Materials.Ruby, Materials.Chromite, + Materials.Redstone, Materials.Neodymium, Materials.Bastnasite }, Voltage.HV); + addProcessGT(GTCombType.TUNGSTEN, + new Material[] { Materials.Tungsten, Materials.Tungstate, Materials.Scheelite, Materials.Lithium }, + Voltage.IV); + addProcessGT(GTCombType.PLATINUM, + new Material[] { Materials.Platinum, Materials.Cooperite, Materials.Palladium }, Voltage.HV); + addProcessGT(GTCombType.MOLYBDENUM, new Material[] { Materials.Molybdenum, Materials.Molybdenite, + Materials.Powellite, Materials.Wulfenite }, Voltage.LV); + addProcessGT(GTCombType.LITHIUM, + new Material[] { Materials.Lithium, Materials.Lepidolite, Materials.Spodumene }, Voltage.MV); + addProcessGT(GTCombType.SALT, new Material[] { Materials.Salt, Materials.RockSalt, Materials.Saltpeter }, + Voltage.MV); + addProcessGT(GTCombType.ELECTROTINE, + new Material[] { Materials.Electrotine, Materials.Electrum, Materials.Redstone }, Voltage.MV); + addCentrifugeToMaterial(GTCombType.SALT, + new Material[] { Materials.Salt, Materials.RockSalt, Materials.Saltpeter }, + new int[] { 100 * 100, 100 * 100, 25 * 100 }, new int[] { 9 * 6, 9 * 6, 9 * 6 }, Voltage.MV, 160, + ItemStack.EMPTY, 50 * 100); // Special Iridium Recipe RecipeMaps.CHEMICAL_RECIPES.recipeBuilder() @@ -169,15 +245,22 @@ public static void initGTCombs() { .duration(50).EUt(600).buildAndRegister(); // Radioactive - addProcessGT(GTCombType.ALMANDINE, new Material[]{Materials.Almandine, Materials.Pyrope, Materials.Sapphire, Materials.GreenSapphire}, Voltage.LV); - addProcessGT(GTCombType.URANIUM, new Material[]{Materials.Uranium238, Materials.Pitchblende, Materials.Uraninite, Materials.Uranium235}, Voltage.EV); - addProcessGT(GTCombType.PLUTONIUM, new Material[]{Materials.Plutonium239, Materials.Uranium235}, Voltage.EV); - addProcessGT(GTCombType.NAQUADAH, new Material[]{Materials.Naquadah, Materials.NaquadahEnriched, Materials.Naquadria}, Voltage.IV); - addProcessGT(GTCombType.NAQUADRIA, new Material[]{Materials.Naquadria, Materials.NaquadahEnriched, Materials.Naquadah}, Voltage.LUV); - addProcessGT(GTCombType.THORIUM, new Material[]{Materials.Thorium, Materials.Uranium238, Materials.Coal}, Voltage.EV); - addProcessGT(GTCombType.LUTETIUM, new Material[]{Materials.Lutetium, Materials.Thorium}, Voltage.IV); - addProcessGT(GTCombType.AMERICIUM, new Material[]{Materials.Americium, Materials.Lutetium}, Voltage.LUV); - addProcessGT(GTCombType.TRINIUM, new Material[]{Materials.Trinium, Materials.Naquadah, Materials.Naquadria}, Voltage.ZPM); + addProcessGT(GTCombType.ALMANDINE, + new Material[] { Materials.Almandine, Materials.Pyrope, Materials.Sapphire, Materials.GreenSapphire }, + Voltage.LV); + addProcessGT(GTCombType.URANIUM, new Material[] { Materials.Uranium238, Materials.Pitchblende, + Materials.Uraninite, Materials.Uranium235 }, Voltage.EV); + addProcessGT(GTCombType.PLUTONIUM, new Material[] { Materials.Plutonium239, Materials.Uranium235 }, Voltage.EV); + addProcessGT(GTCombType.NAQUADAH, + new Material[] { Materials.Naquadah, Materials.NaquadahEnriched, Materials.Naquadria }, Voltage.IV); + addProcessGT(GTCombType.NAQUADRIA, + new Material[] { Materials.Naquadria, Materials.NaquadahEnriched, Materials.Naquadah }, Voltage.LUV); + addProcessGT(GTCombType.THORIUM, new Material[] { Materials.Thorium, Materials.Uranium238, Materials.Coal }, + Voltage.EV); + addProcessGT(GTCombType.LUTETIUM, new Material[] { Materials.Lutetium, Materials.Thorium }, Voltage.IV); + addProcessGT(GTCombType.AMERICIUM, new Material[] { Materials.Americium, Materials.Lutetium }, Voltage.LUV); + addProcessGT(GTCombType.TRINIUM, new Material[] { Materials.Trinium, Materials.Naquadah, Materials.Naquadria }, + Voltage.ZPM); // Special Neutronium Recipe RecipeMaps.CHEMICAL_RECIPES.recipeBuilder() @@ -189,8 +272,12 @@ public static void initGTCombs() { .duration(3000).EUt(Voltage.UV.getChemicalEnergy()).buildAndRegister(); if (Loader.isModLoaded(GTValues.MODID_MB)) { - addProcessGT(GTCombType.SPARKLING, new Material[]{Materials.NetherStar}, Voltage.EV); - addCentrifugeToItemStack(GTCombType.SPARKLING, new ItemStack[]{IntegrationUtil.getModItem(GTValues.MODID_MB, "wax", 0), IntegrationUtil.getModItem(GTValues.MODID_MB, "resource", 5), OreDictUnifier.get(OrePrefix.dustTiny, Materials.NetherStar)}, new int[]{50 * 100, 10 * 100, 10 * 100}, Voltage.EV); + addProcessGT(GTCombType.SPARKLING, new Material[] { Materials.NetherStar }, Voltage.EV); + addCentrifugeToItemStack(GTCombType.SPARKLING, + new ItemStack[] { IntegrationUtil.getModItem(GTValues.MODID_MB, "wax", 0), + IntegrationUtil.getModItem(GTValues.MODID_MB, "resource", 5), + OreDictUnifier.get(OrePrefix.dustTiny, Materials.NetherStar) }, + new int[] { 50 * 100, 10 * 100, 10 * 100 }, Voltage.EV); } addExtractorProcess(GTCombType.HELIUM, Materials.Helium.getFluid(250), Voltage.HV, 100); @@ -209,13 +296,17 @@ public static void initGTCombs() { fluixDust = Api.INSTANCE.definitions().materials().fluixDust().maybeStack(1).orElse(ItemStack.EMPTY); } if (fluixDust != ItemStack.EMPTY) { - addCentrifugeToItemStack(GTCombType.FLUIX, new ItemStack[]{fluixDust, ModuleCore.getItems().beeswax.getItemStack()}, new int[]{25 * 100, 30 * 100}, Voltage.ULV); + addCentrifugeToItemStack(GTCombType.FLUIX, + new ItemStack[] { fluixDust, ModuleCore.getItems().beeswax.getItemStack() }, + new int[] { 25 * 100, 30 * 100 }, Voltage.ULV); } } } private static void addChemicalProcess(GTCombType comb, Material inMaterial, Material outMaterial, Voltage volt) { - if (OreDictUnifier.get(OrePrefix.crushedPurified, outMaterial, 4).isEmpty() || OreDictUnifier.get(OrePrefix.crushed, inMaterial).isEmpty() || inMaterial.hasFlag(MaterialFlags.DISABLE_ORE_BLOCK)) + if (OreDictUnifier.get(OrePrefix.crushedPurified, outMaterial, 4).isEmpty() || + OreDictUnifier.get(OrePrefix.crushed, inMaterial).isEmpty() || + inMaterial.hasFlag(MaterialFlags.DISABLE_ORE_BLOCK)) return; RecipeBuilder builder = RecipeMaps.CHEMICAL_RECIPES.recipeBuilder() @@ -253,7 +344,8 @@ private static void addAutoclaveProcess(GTCombType comb, Material material, Volt RecipeBuilder builder = RecipeMaps.AUTOCLAVE_RECIPES.recipeBuilder() .inputs(GTUtility.copy(9, ForestryUtil.getCombStack(comb))) .circuitMeta(circuitNumber) - .fluidInputs(Materials.Mutagen.getFluid((int) Math.max(1, material.getMass() + volt.getMutagenAmount()))) + .fluidInputs( + Materials.Mutagen.getFluid((int) Math.max(1, material.getMass() + volt.getMutagenAmount()))) .output(OrePrefix.crushedPurified, material, 4) .duration((int) (material.getMass() * 128)) .EUt(volt.getAutoclaveEnergy()); @@ -275,9 +367,11 @@ private static void addExtractorProcess(GTCombType comb, FluidStack fluidStack, /** * this only adds Chemical and AutoClave process. - * If you need Centrifuge recipe. use addCentrifugeToMaterial or addCentrifugeToItemStack + * If you need Centrifuge recipe. use addCentrifugeToMaterial or addCentrifugeToItemStack * - * @param volt This determines the required Tier of process for these recipes. This decides the required aEU/t, progress time, required additional Mutagen, requirement of cleanRoom, needed fluid stack for Chemical. + * @param volt This determines the required Tier of process for these recipes. This decides the required aEU/t, + * progress time, required additional Mutagen, requirement of cleanRoom, needed fluid stack for + * Chemical. * @param material result of Material that should be generated by this process. **/ private static void addProcessGT(GTCombType comb, Material[] material, Voltage volt) { @@ -288,21 +382,29 @@ private static void addProcessGT(GTCombType comb, Material[] material, Voltage v } /** - * this method only adds Centrifuge based on Material. If volt is lower than MV than it will also add forestry centrifuge recipe. + * this method only adds Centrifuge based on Material. If volt is lower than MV than it will also add forestry + * centrifuge recipe. * * @param comb BeeComb * @param material resulting Material of processing. must be less than or equal to 9. * @param chance chance to get result, 10000 == 100% - * @param volt required Voltage Tier for this recipe, this also affect the duration, amount of Mutagen, and needed liquid type and amount for chemical reactor - * @param stackSize This parameter can be null, in that case stack size will be just 1. This handle the stackSize of the resulting Item, and Also the Type of Item. if this value is multiple of 9, than related Material output will be dust, if this value is multiple of 4 than output will be Small dust, else the output will be Tiny dust - * @param beeWax if this is null, then the comb will product default Bee wax. But if material is more than 5, beeWax will be ignored in Gregtech Centrifuge. + * @param volt required Voltage Tier for this recipe, this also affect the duration, amount of Mutagen, and + * needed liquid type and amount for chemical reactor + * @param stackSize This parameter can be null, in that case stack size will be just 1. This handle the stackSize of + * the resulting Item, and Also the Type of Item. if this value is multiple of 9, than related + * Material output will be dust, if this value is multiple of 4 than output will be Small dust, + * else the output will be Tiny dust + * @param beeWax if this is null, then the comb will product default Bee wax. But if material is more than 5, + * beeWax will be ignored in Gregtech Centrifuge. * @param waxChance have same format like "chance" **/ - private static void addCentrifugeToMaterial(GTCombType comb, Material[] material, int[] chance, int[] stackSize, Voltage volt, ItemStack beeWax, int waxChance) { + private static void addCentrifugeToMaterial(GTCombType comb, Material[] material, int[] chance, int[] stackSize, + Voltage volt, ItemStack beeWax, int waxChance) { addCentrifugeToMaterial(comb, material, chance, stackSize, volt, volt.getCentrifugeTime(), beeWax, waxChance); } - private static void addCentrifugeToMaterial(GTCombType comb, Material[] material, int[] chance, int[] stackSize, Voltage volt, int duration, ItemStack beeWax, int waxChance) { + private static void addCentrifugeToMaterial(GTCombType comb, Material[] material, int[] chance, int[] stackSize, + Voltage volt, int duration, ItemStack beeWax, int waxChance) { ItemStack[] output = new ItemStack[material.length + 1]; stackSize = Arrays.copyOf(stackSize, material.length); chance = Arrays.copyOf(chance, output.length); @@ -335,7 +437,8 @@ private static void addCentrifugeToItemStack(GTCombType comb, ItemStack[] item, addCentrifugeToItemStack(comb, item, chance, volt, volt.getCentrifugeTime()); } - private static void addCentrifugeToItemStack(GTCombType comb, ItemStack[] item, int[] chance, Voltage volt, int duration) { + private static void addCentrifugeToItemStack(GTCombType comb, ItemStack[] item, int[] chance, Voltage volt, + int duration) { ItemStack combStack = ForestryUtil.getCombStack(comb); // Start of the Forestry Map @@ -373,7 +476,22 @@ private static void addCentrifugeToItemStack(GTCombType comb, ItemStack[] item, } private enum Voltage { - ULV, LV, MV, HV, EV, IV, LUV, ZPM, UV, UHV, UEV, UIV, UXV, OPV, MAX; + + ULV, + LV, + MV, + HV, + EV, + IV, + LUV, + ZPM, + UV, + UHV, + UEV, + UIV, + UXV, + OPV, + MAX; public int getVoltage() { return (int) GTValues.V[ordinal()]; diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java index 40be7c4dc01..171f575bc32 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java @@ -1,22 +1,24 @@ package gregtech.integration.forestry.recipes; -import forestry.api.recipes.RecipeManagers; -import forestry.core.ModuleCore; -import forestry.core.fluids.Fluids; -import forestry.core.items.EnumElectronTube; -import forestry.core.items.ItemElectronTube; -import forestry.factory.MachineUIDs; -import forestry.factory.ModuleFactory; -import forestry.factory.recipes.FabricatorRecipeManager; import gregtech.api.GTValues; import gregtech.api.unification.stack.UnificationEntry; import gregtech.integration.forestry.ForestryModule; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Loader; +import forestry.api.recipes.RecipeManagers; +import forestry.core.ModuleCore; +import forestry.core.fluids.Fluids; +import forestry.core.items.EnumElectronTube; +import forestry.core.items.ItemElectronTube; +import forestry.factory.MachineUIDs; +import forestry.factory.ModuleFactory; +import forestry.factory.recipes.FabricatorRecipeManager; + import static gregtech.api.recipes.RecipeMaps.CIRCUIT_ASSEMBLER_RECIPES; import static gregtech.api.recipes.RecipeMaps.FORMING_PRESS_RECIPES; import static gregtech.api.unification.material.Materials.*; @@ -189,7 +191,8 @@ public static void addGregTechMachineRecipes() { } // todo mixin forestry to allow this tube always, since we have rubber (once mixin port is done) - if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_TR) || Loader.isModLoaded(GTValues.MODID_BINNIE)) { + if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_TR) || + Loader.isModLoaded(GTValues.MODID_BINNIE)) { CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) .input(ForestryModule.ELECTRODE_RUBBER) .fluidInputs(Glass.getFluid(100)) diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java index 148be3f207b..5a57da584cc 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java @@ -1,21 +1,22 @@ package gregtech.integration.forestry.recipes; -import forestry.core.fluids.Fluids; import gregtech.api.GTValues; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMaps; import gregtech.api.unification.material.Materials; import gregtech.api.util.GTUtility; import gregtech.integration.IntegrationUtil; + import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Loader; +import forestry.core.fluids.Fluids; + public class ForestryExtractorRecipes { public static void init() { - // Commonly used items ItemStack mulch = IntegrationUtil.getModItem(GTValues.MODID_FR, "mulch", 0); ItemStack propolis = IntegrationUtil.getModItem(GTValues.MODID_FR, "propolis", 0); @@ -28,96 +29,160 @@ public static void init() { addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 0), 50, GTUtility.copy(mulch), 500); addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 1), 180, GTUtility.copy(mulch), 500); addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 2), 220, GTUtility.copy(mulch), 200); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 3), 400, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 4), 100, GTUtility.copy(mulch), 6000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 5), 50, GTUtility.copy(mulch), 2000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 6), 600, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 3), 400, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 4), 100, GTUtility.copy(mulch), + 6000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 5), 50, GTUtility.copy(mulch), + 2000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 6), 600, GTUtility.copy(mulch), + 1000); // Honey, Honeydew - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "honey_drop", 0), 100, GTUtility.copy(propolis), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "honey_drop", 0), 100, GTUtility.copy(propolis), + 0); addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "honeydew", 0), 100); if (Loader.isModLoaded(GTValues.MODID_EB)) { // Propolis - addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 0), Materials.Water.getFluid(500)); - addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 1), Materials.Oil.getFluid(500)); - addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 2), Materials.Creosote.getFluid(500)); + addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 0), + Materials.Water.getFluid(500)); + addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 1), + Materials.Oil.getFluid(500)); + addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 2), + Materials.Creosote.getFluid(500)); // Drops addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 3), 200); - addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 6), Fluids.MILK.getFluid(200)); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 13), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 19), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 14), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 20), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 15), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 21), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 16), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 22), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 17), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 24), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 18), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 23), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 19), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 25), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 20), 200, new ItemStack(Items.DYE, 1, 14), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 21), 200, new ItemStack(Items.DYE, 1, 6), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 22), 200, new ItemStack(Items.DYE, 1, 5), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 23), 200, new ItemStack(Items.DYE, 1, 8), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 24), 200, new ItemStack(Items.DYE, 1, 12), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 25), 200, new ItemStack(Items.DYE, 1, 9), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 26), 200, new ItemStack(Items.DYE, 1, 10), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 27), 200, new ItemStack(Items.DYE, 1, 13), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 28), 200, new ItemStack(Items.DYE, 1, 7), 0); + addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 6), + Fluids.MILK.getFluid(200)); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 13), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 19), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 14), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 20), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 15), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 21), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 16), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 22), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 17), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 24), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 18), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 23), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 19), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 25), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 20), 200, + new ItemStack(Items.DYE, 1, 14), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 21), 200, + new ItemStack(Items.DYE, 1, 6), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 22), 200, + new ItemStack(Items.DYE, 1, 5), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 23), 200, + new ItemStack(Items.DYE, 1, 8), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 24), 200, + new ItemStack(Items.DYE, 1, 12), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 25), 200, + new ItemStack(Items.DYE, 1, 9), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 26), 200, + new ItemStack(Items.DYE, 1, 10), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 27), 200, + new ItemStack(Items.DYE, 1, 13), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 28), 200, + new ItemStack(Items.DYE, 1, 7), 0); } if (Loader.isModLoaded(GTValues.MODID_ET)) { // Fruits - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 0), 150, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 1), 400, GTUtility.copy(mulch), 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 2), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 3), 300, GTUtility.copy(mulch), 1000); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 4), 50, GTUtility.copy(mulch), 500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 5), 50, GTUtility.copy(mulch), 300); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 6), 50, GTUtility.copy(mulch), 500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 7), 50, GTUtility.copy(mulch), 500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 8), 100, GTUtility.copy(mulch), 6000); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 9), 80, GTUtility.copy(mulch), 500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 10), 150, GTUtility.copy(mulch), 4000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 11), 500, GTUtility.copy(mulch), 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 12), 150, GTUtility.copy(mulch), 4000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 13), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 14), 400, GTUtility.copy(mulch), 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 15), 400, GTUtility.copy(mulch), 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 16), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 17), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 18), 400, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 19), 150, GTUtility.copy(mulch), 4000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 20), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 21), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 22), 300, GTUtility.copy(mulch), 2000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 23), 200, GTUtility.copy(mulch), 1000); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 24), 150, GTUtility.copy(mulch), 500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 25), 180, GTUtility.copy(mulch), 500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 26), 100, GTUtility.copy(mulch), 400); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 27), 50, GTUtility.copy(mulch), 200); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 28), 100, GTUtility.copy(mulch), 3000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 29), 100, GTUtility.copy(mulch), 3000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 30), 100, GTUtility.copy(mulch), 4000); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 31), 20, GTUtility.copy(mulch), 200); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 32), 50, GTUtility.copy(mulch), 300); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 33), 50, GTUtility.copy(mulch), 300); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 34), 100, GTUtility.copy(mulch), 500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 35), 50, GTUtility.copy(mulch), 300); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 36), 50, GTUtility.copy(mulch), 500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 37), 20, GTUtility.copy(mulch), 200); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 38), 300, GTUtility.copy(mulch), 1500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 39), 25, GTUtility.copy(mulch), 200); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 46), 50, GTUtility.copy(mulch), 500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 50), 300, GTUtility.copy(mulch), 2500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 51), 150, GTUtility.copy(mulch), 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 52), 300, GTUtility.copy(mulch), 1500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 53), 50, GTUtility.copy(mulch), 1000); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 54), 50, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 55), 100, GTUtility.copy(mulch), 1000); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 56), 100, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 57), 400, GTUtility.copy(mulch), 2000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 58), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 59), 50, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 0), 150, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 1), 400, GTUtility.copy(mulch), + 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 2), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 3), 300, GTUtility.copy(mulch), + 1000); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 4), 50, GTUtility.copy(mulch), 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 5), 50, GTUtility.copy(mulch), 300); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 6), 50, GTUtility.copy(mulch), 500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 7), 50, GTUtility.copy(mulch), + 500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 8), 100, GTUtility.copy(mulch), + 6000); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 9), 80, GTUtility.copy(mulch), 500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 10), 150, GTUtility.copy(mulch), + 4000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 11), 500, GTUtility.copy(mulch), + 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 12), 150, GTUtility.copy(mulch), + 4000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 13), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 14), 400, GTUtility.copy(mulch), + 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 15), 400, GTUtility.copy(mulch), + 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 16), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 17), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 18), 400, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 19), 150, GTUtility.copy(mulch), + 4000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 20), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 21), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 22), 300, GTUtility.copy(mulch), + 2000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 23), 200, GTUtility.copy(mulch), + 1000); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 24), 150, GTUtility.copy(mulch), + 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 25), 180, GTUtility.copy(mulch), + 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 26), 100, GTUtility.copy(mulch), + 400); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 27), 50, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 28), 100, GTUtility.copy(mulch), + 3000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 29), 100, GTUtility.copy(mulch), + 3000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 30), 100, GTUtility.copy(mulch), + 4000); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 31), 20, GTUtility.copy(mulch), 200); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 32), 50, GTUtility.copy(mulch), 300); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 33), 50, GTUtility.copy(mulch), 300); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 34), 100, GTUtility.copy(mulch), + 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 35), 50, GTUtility.copy(mulch), 300); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 36), 50, GTUtility.copy(mulch), 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 37), 20, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 38), 300, GTUtility.copy(mulch), + 1500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 39), 25, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 46), 50, GTUtility.copy(mulch), + 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 50), 300, GTUtility.copy(mulch), + 2500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 51), 150, GTUtility.copy(mulch), + 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 52), 300, GTUtility.copy(mulch), + 1500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 53), 50, GTUtility.copy(mulch), + 1000); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 54), 50, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 55), 100, GTUtility.copy(mulch), + 1000); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 56), 100, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 57), 400, GTUtility.copy(mulch), + 2000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 58), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 59), 50, GTUtility.copy(mulch), + 1000); } } @@ -149,7 +214,8 @@ private static void addExtractorRecipe(ItemStack inputStack, FluidStack outputFl addExtractorRecipe(inputStack, outputFluid, ItemStack.EMPTY, 0); } - private static void addExtractorRecipe(ItemStack inputStack, FluidStack outputFluid, ItemStack extraOutput, int chance) { + private static void addExtractorRecipe(ItemStack inputStack, FluidStack outputFluid, ItemStack extraOutput, + int chance) { RecipeBuilder builder = RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() .inputs(inputStack) .fluidOutputs(outputFluid); diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryFrameRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryFrameRecipes.java index b9fffb8c773..fd78b9ad8ee 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryFrameRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryFrameRecipes.java @@ -1,18 +1,20 @@ package gregtech.integration.forestry.recipes; -import forestry.api.recipes.RecipeManagers; -import forestry.apiculture.ModuleApiculture; -import forestry.factory.MachineUIDs; -import forestry.factory.ModuleFactory; import gregtech.api.GTValues; import gregtech.api.recipes.RecipeMaps; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTUtility; import gregtech.integration.forestry.ForestryModule; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import forestry.api.recipes.RecipeManagers; +import forestry.apiculture.ModuleApiculture; +import forestry.factory.MachineUIDs; +import forestry.factory.ModuleFactory; + import static gregtech.api.unification.material.Materials.*; import static gregtech.api.unification.ore.OrePrefix.*; @@ -76,7 +78,8 @@ public static void init() { ModuleApiculture.getItems().frameImpregnated.getItemStack()); } - private static void registerRecipe(UnificationEntry cornerItem, UnificationEntry edgeItem, UnificationEntry centerItem, + private static void registerRecipe(UnificationEntry cornerItem, UnificationEntry edgeItem, + UnificationEntry centerItem, FluidStack fluid, ItemStack output, ItemStack frame) { RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .inputs(GTUtility.copy(4, OreDictUnifier.get(cornerItem))) diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java index ca7dcfa44e2..5f4f214c294 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java @@ -1,12 +1,5 @@ package gregtech.integration.forestry.recipes; -import forestry.api.recipes.RecipeManagers; -import forestry.apiculture.ModuleApiculture; -import forestry.apiculture.items.EnumPropolis; -import forestry.core.config.Config; -import forestry.core.fluids.Fluids; -import forestry.factory.MachineUIDs; -import forestry.factory.ModuleFactory; import gregtech.api.GTValues; import gregtech.api.recipes.ModHandler; import gregtech.api.recipes.RecipeMaps; @@ -18,15 +11,23 @@ import gregtech.integration.forestry.ForestryConfig; import gregtech.integration.forestry.ForestryUtil; import gregtech.integration.forestry.bees.GTDropType; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Loader; +import forestry.api.recipes.RecipeManagers; +import forestry.apiculture.ModuleApiculture; +import forestry.apiculture.items.EnumPropolis; +import forestry.core.config.Config; +import forestry.core.fluids.Fluids; +import forestry.factory.MachineUIDs; +import forestry.factory.ModuleFactory; + public class ForestryMiscRecipes { public static void init() { - if (ForestryConfig.enableGTBees) { // Oil Drop ItemStack dropStack = ForestryUtil.getDropStack(GTDropType.OIL); @@ -37,7 +38,8 @@ public static void init() { .duration(32).EUt(8).buildAndRegister(); if (ModuleFactory.machineEnabled(MachineUIDs.SQUEEZER)) { - RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.OilHeavy.getFluid(100), ModuleApiculture.getItems().propolis.get(EnumPropolis.NORMAL, 1), 30); + RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.OilHeavy.getFluid(100), + ModuleApiculture.getItems().propolis.get(EnumPropolis.NORMAL, 1), 30); } // Biomass Drop @@ -53,7 +55,8 @@ public static void init() { .duration(32).EUt(8).buildAndRegister(); if (ModuleFactory.machineEnabled(MachineUIDs.SQUEEZER)) { - RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Biomass.getFluid(100), propolisStack, 30); + RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Biomass.getFluid(100), propolisStack, + 30); } // Ethanol Drop @@ -65,7 +68,8 @@ public static void init() { .duration(32).EUt(8).buildAndRegister(); if (ModuleFactory.machineEnabled(MachineUIDs.SQUEEZER)) { - RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Ethanol.getFluid(100), propolisStack, 30); + RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Ethanol.getFluid(100), propolisStack, + 30); } // Mutagen Drop @@ -77,7 +81,8 @@ public static void init() { .duration(32).EUt(8).buildAndRegister(); if (ModuleFactory.machineEnabled(MachineUIDs.SQUEEZER)) { - RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Mutagen.getFluid(100), propolisStack, 30); + RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Mutagen.getFluid(100), propolisStack, + 30); } } diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryToolRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryToolRecipes.java index 17977a86d2f..11213c4310c 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryToolRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryToolRecipes.java @@ -8,6 +8,7 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.integration.forestry.ForestryModule; import gregtech.loaders.recipe.handlers.ToolRecipeHandler; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java b/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java index b1be87d366e..221fadaa6f6 100644 --- a/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java +++ b/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java @@ -1,11 +1,9 @@ package gregtech.integration.forestry.tools; -import forestry.api.lepidopterology.EnumFlutterType; -import forestry.api.lepidopterology.IAlleleButterflySpecies; -import forestry.api.lepidopterology.IEntityButterfly; import gregtech.api.GTValues; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLivingBase; @@ -16,6 +14,10 @@ import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.fml.common.Loader; + +import forestry.api.lepidopterology.EnumFlutterType; +import forestry.api.lepidopterology.IAlleleButterflySpecies; +import forestry.api.lepidopterology.IEntityButterfly; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -28,16 +30,19 @@ public class ScoopBehavior implements IToolBehavior { private ScoopBehavior() {/**/} @Override - public void hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target, @NotNull EntityLivingBase attacker) { + public void hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target, + @NotNull EntityLivingBase attacker) { if (!Loader.isModLoaded(GTValues.MODID_FR)) return; if (!(target instanceof IEntityButterfly butterfly)) return; if (!(attacker instanceof EntityPlayer player)) return; if (attacker.world == null || attacker.world.isRemote) return; IAlleleButterflySpecies species = butterfly.getButterfly().getGenome().getPrimary(); - species.getRoot().getBreedingTracker(target.world, player.getGameProfile()).registerCatch(butterfly.getButterfly()); + species.getRoot().getBreedingTracker(target.world, player.getGameProfile()) + .registerCatch(butterfly.getButterfly()); - ItemStack memberStack = species.getRoot().getMemberStack(butterfly.getButterfly().copy(), EnumFlutterType.BUTTERFLY); + ItemStack memberStack = species.getRoot().getMemberStack(butterfly.getButterfly().copy(), + EnumFlutterType.BUTTERFLY); EntityItem entityItem = new EntityItem(player.world, target.posX, target.posY, target.posZ, memberStack); target.setDead(); NBTTagCompound behaviorTag = ToolHelper.getBehaviorsTag(stack); @@ -49,7 +54,8 @@ public void hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, @NotNull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.scoop")); } } diff --git a/src/main/java/gregtech/integration/groovy/GrSRecipeHelper.java b/src/main/java/gregtech/integration/groovy/GrSRecipeHelper.java index bf6107ba5a9..9c686f88946 100644 --- a/src/main/java/gregtech/integration/groovy/GrSRecipeHelper.java +++ b/src/main/java/gregtech/integration/groovy/GrSRecipeHelper.java @@ -1,13 +1,15 @@ package gregtech.integration.groovy; -import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; -import com.cleanroommc.groovyscript.helper.ingredient.NbtHelper; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.ingredients.GTRecipeInput; import gregtech.integration.RecipeCompatUtil; + import net.minecraft.item.ItemStack; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.helper.ingredient.NbtHelper; + public class GrSRecipeHelper { public static String getRecipeRemoveLine(RecipeMap recipeMap, Recipe recipe) { @@ -48,7 +50,6 @@ public static String getRecipeRemoveLine(RecipeMap recipeMap, Recipe recipe) builder.append("null"); } - builder.append(")"); return builder.toString(); } diff --git a/src/main/java/gregtech/integration/groovy/GroovyHandCommand.java b/src/main/java/gregtech/integration/groovy/GroovyHandCommand.java index 0fe10e6c3dd..a7b7f812b42 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyHandCommand.java +++ b/src/main/java/gregtech/integration/groovy/GroovyHandCommand.java @@ -1,13 +1,12 @@ package gregtech.integration.groovy; -import com.cleanroommc.groovyscript.command.TextCopyable; -import com.cleanroommc.groovyscript.event.GsHandEvent; import gregtech.api.items.toolitem.IGTTool; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.MaterialStack; import gregtech.api.util.ClipboardUtil; import gregtech.integration.RecipeCompatUtil; + import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.util.text.*; @@ -15,6 +14,9 @@ import net.minecraft.util.text.event.HoverEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import com.cleanroommc.groovyscript.command.TextCopyable; +import com.cleanroommc.groovyscript.event.GsHandEvent; + public class GroovyHandCommand { @SubscribeEvent @@ -25,26 +27,33 @@ public static void onHandCommand(GsHandEvent event) { if (id != null) { String copyText = "metaitem('" + id + "')"; ClipboardUtil.copyToClipboard((EntityPlayerMP) event.player, copyText); - event.messages.add(TextCopyable.translation(copyText, "gregtech.command.hand.meta_item").build().appendSibling(new TextComponentString(" " + id).setStyle(new Style().setColor(TextFormatting.GREEN)))); + event.messages + .add(TextCopyable.translation(copyText, "gregtech.command.hand.meta_item").build().appendSibling( + new TextComponentString(" " + id).setStyle(new Style().setColor(TextFormatting.GREEN)))); } // tool info if (stackInHand.getItem() instanceof IGTTool) { IGTTool tool = (IGTTool) stackInHand.getItem(); - event.messages.add(new TextComponentTranslation("gregtech.command.hand.tool_stats", tool.getToolClasses(stackInHand))); + event.messages.add( + new TextComponentTranslation("gregtech.command.hand.tool_stats", tool.getToolClasses(stackInHand))); } // material info MaterialStack material = OreDictUnifier.getMaterial(stackInHand); if (material != null) { String copyText = "material('" + material.material + "')"; - event.messages.add(TextCopyable.translation(copyText, "gregtech.command.hand.material").build().appendSibling(new TextComponentString(" " + material.material).setStyle(new Style().setColor(TextFormatting.GREEN)))); + event.messages.add(TextCopyable.translation(copyText, "gregtech.command.hand.material").build() + .appendSibling(new TextComponentString(" " + material.material) + .setStyle(new Style().setColor(TextFormatting.GREEN)))); } // ore prefix info OrePrefix orePrefix = OreDictUnifier.getPrefix(stackInHand); if (orePrefix != null) { String copyText = "oreprefix('" + orePrefix.name + "')"; - event.messages.add(TextCopyable.translation(copyText, "gregtech.command.hand.ore_prefix", id).build().appendSibling(new TextComponentString(" " + orePrefix.name).setStyle(new Style().setColor(TextFormatting.GREEN)))); + event.messages.add(TextCopyable.translation(copyText, "gregtech.command.hand.ore_prefix", id).build() + .appendSibling(new TextComponentString(" " + orePrefix.name) + .setStyle(new Style().setColor(TextFormatting.GREEN)))); } } @@ -54,10 +63,13 @@ public static Style getCopyStyle(String copyMessage, boolean alreadyCopied) { style.setClickEvent(click); ITextComponent text = alreadyCopied ? - new TextComponentString("").appendSibling(new TextComponentString(copyMessage + " ").setStyle(new Style().setColor(TextFormatting.GOLD))) + new TextComponentString("") + .appendSibling(new TextComponentString(copyMessage + " ") + .setStyle(new Style().setColor(TextFormatting.GOLD))) .appendSibling(new TextComponentTranslation("gregtech.command.copy.copied_and_click")) : new TextComponentTranslation("gregtech.command.copy.click_to_copy") - .appendSibling(new TextComponentString(" " + copyMessage).setStyle(new Style().setColor(TextFormatting.GOLD))); + .appendSibling(new TextComponentString(" " + copyMessage) + .setStyle(new Style().setColor(TextFormatting.GOLD))); style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, text)); return style; diff --git a/src/main/java/gregtech/integration/groovy/GroovyMaterialBuilderExpansion.java b/src/main/java/gregtech/integration/groovy/GroovyMaterialBuilderExpansion.java index ab7063bc39f..515a8261f6e 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyMaterialBuilderExpansion.java +++ b/src/main/java/gregtech/integration/groovy/GroovyMaterialBuilderExpansion.java @@ -8,6 +8,7 @@ import gregtech.api.unification.material.info.MaterialFlag; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.properties.BlastProperty; + import net.minecraft.util.ResourceLocation; import java.util.ArrayList; @@ -20,7 +21,8 @@ public class GroovyMaterialBuilderExpansion { public static Material.Builder fluid(Material.Builder builder, String raw, FluidBuilder fluidBuilder) { FluidStorageKey key = FluidStorageKey.getByName(new ResourceLocation(raw)); if (key == null) key = FluidStorageKey.getByName(gregtechId(raw)); - if (GroovyScriptModule.validateNonNull(key, () -> "Can't find fluid type for " + raw + " in material builder")) { + if (GroovyScriptModule.validateNonNull(key, + () -> "Can't find fluid type for " + raw + " in material builder")) { return builder.fluid(key, fluidBuilder); } return builder; @@ -28,7 +30,8 @@ public static Material.Builder fluid(Material.Builder builder, String raw, Fluid public static Material.Builder element(Material.Builder builder, String raw) { Element element = Elements.get(raw); - if (GroovyScriptModule.validateNonNull(element, () -> "Can't find element for " + raw + " in material builder")) { + if (GroovyScriptModule.validateNonNull(element, + () -> "Can't find element for " + raw + " in material builder")) { return builder.element(element); } return builder; @@ -38,7 +41,8 @@ public static Material.Builder flags(Material.Builder builder, String... rawFlag List flags = new ArrayList<>(); for (String rawFlag : rawFlags) { MaterialFlag flag = MaterialFlag.getByName(rawFlag); - if (GroovyScriptModule.validateNonNull(flag, () -> "Can't find material flag for '" + rawFlag + "' in material builder")) { + if (GroovyScriptModule.validateNonNull(flag, + () -> "Can't find material flag for '" + rawFlag + "' in material builder")) { flags.add(flag); } } @@ -47,7 +51,8 @@ public static Material.Builder flags(Material.Builder builder, String... rawFlag public static Material.Builder iconSet(Material.Builder builder, String raw) { MaterialIconSet iconSet = MaterialIconSet.getByName(raw); - if (GroovyScriptModule.validateNonNull(iconSet, () -> "Can't find material icon set for " + raw + " in material builder")) { + if (GroovyScriptModule.validateNonNull(iconSet, + () -> "Can't find material icon set for " + raw + " in material builder")) { return builder.iconSet(iconSet); } return builder; @@ -61,11 +66,13 @@ public static Material.Builder blastTemp(Material.Builder builder, int temp, Str return blastTemp(builder, temp, raw, eutOverride, -1); } - public static Material.Builder blastTemp(Material.Builder builder, int temp, String raw, int eutOverride, int durationOverride) { + public static Material.Builder blastTemp(Material.Builder builder, int temp, String raw, int eutOverride, + int durationOverride) { return blastTemp(builder, temp, raw, eutOverride, durationOverride, -1, -1); } - public static Material.Builder blastTemp(Material.Builder builder, int temp, String raw, int eutOverride, int durationOverride, int vacuumEUtOverride, int vacuumDurationOverride) { + public static Material.Builder blastTemp(Material.Builder builder, int temp, String raw, int eutOverride, + int durationOverride, int vacuumEUtOverride, int vacuumDurationOverride) { BlastProperty.GasTier gasTier = null; String name = raw.toUpperCase(); for (BlastProperty.GasTier gasTier1 : BlastProperty.GasTier.VALUES) { @@ -75,7 +82,8 @@ public static Material.Builder blastTemp(Material.Builder builder, int temp, Str } } final BlastProperty.GasTier finalGasTier = gasTier; - if (GroovyScriptModule.validateNonNull(gasTier, () -> "Can't find gas tier for " + name + " in material builder. Valid values are 'low', 'mid', 'high', 'higher', 'highest'!")) { + if (GroovyScriptModule.validateNonNull(gasTier, () -> "Can't find gas tier for " + name + + " in material builder. Valid values are 'low', 'mid', 'high', 'higher', 'highest'!")) { return builder.blast(b -> b .temp(temp, finalGasTier) .blastStats(eutOverride, durationOverride) diff --git a/src/main/java/gregtech/integration/groovy/GroovyRecipeBuilderExpansion.java b/src/main/java/gregtech/integration/groovy/GroovyRecipeBuilderExpansion.java index c91e9fff27d..90a0dc3753b 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyRecipeBuilderExpansion.java +++ b/src/main/java/gregtech/integration/groovy/GroovyRecipeBuilderExpansion.java @@ -1,11 +1,13 @@ package gregtech.integration.groovy; -import com.cleanroommc.groovyscript.api.GroovyLog; import gregtech.api.recipes.RecipeBuilder; +import com.cleanroommc.groovyscript.api.GroovyLog; + public class GroovyRecipeBuilderExpansion { - public static > RecipeBuilder property(RecipeBuilder builder, String key, Object value) { + public static > RecipeBuilder property(RecipeBuilder builder, String key, + Object value) { if (!builder.applyProperty(key, value)) { GroovyLog.get().error("Failed to add property '{}' with '{}' to recipe", key, value); } diff --git a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java index 7259ba0d9b4..9e064eb43b2 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java +++ b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java @@ -1,13 +1,5 @@ package gregtech.integration.groovy; -import com.cleanroommc.groovyscript.GroovyScript; -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.brackets.BracketHandlerManager; -import com.cleanroommc.groovyscript.compat.mods.ModPropertyContainer; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import com.cleanroommc.groovyscript.sandbox.expand.ExpansionHelper; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.items.metaitem.MetaItem; @@ -28,7 +20,7 @@ import gregtech.integration.crafttweaker.material.MaterialExpansion; import gregtech.integration.crafttweaker.material.MaterialPropertyExpansion; import gregtech.modules.GregTechModules; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; @@ -37,20 +29,30 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.cleanroommc.groovyscript.GroovyScript; +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.brackets.BracketHandlerManager; +import com.cleanroommc.groovyscript.compat.mods.ModPropertyContainer; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import com.cleanroommc.groovyscript.sandbox.expand.ExpansionHelper; +import com.google.common.collect.ImmutableList; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @GregTechModule( - moduleID = GregTechModules.MODULE_GRS, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_GROOVYSCRIPT, - name = "GregTech GroovyScript Integration", - description = "GroovyScript Integration Module" -) + moduleID = GregTechModules.MODULE_GRS, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_GROOVYSCRIPT, + name = "GregTech GroovyScript Integration", + description = "GroovyScript Integration Module") public class GroovyScriptModule extends IntegrationSubmodule { private static ModSupport.Container modSupportContainer; @@ -73,8 +75,8 @@ public void construction(FMLConstructionEvent event) { } public static boolean isCurrentlyRunning() { - return GregTechAPI.moduleManager.isModuleEnabled(GregTechModules.MODULE_GRS) - && GroovyScript.getSandbox().isRunning(); + return GregTechAPI.moduleManager.isModuleEnabled(GregTechModules.MODULE_GRS) && + GroovyScript.getSandbox().isRunning(); } public static Container getInstance() { @@ -116,7 +118,7 @@ public static ItemStack getMetaTileEntityItem(String[] split) { } public static String[] splitObjectName(String toSplit) { - String[] resultSplit = {GTValues.MODID, toSplit}; + String[] resultSplit = { GTValues.MODID, toSplit }; int i = toSplit.indexOf(':'); if (i >= 0) { resultSplit[1] = toSplit.substring(i + 1); @@ -174,7 +176,8 @@ public static void loadMetaItemBracketHandler() { } for (MetaItem item : MetaItem.getMetaItems()) { - Map map = metaItems.computeIfAbsent(Objects.requireNonNull(item.getRegistryName()).getNamespace(), + Map map = metaItems.computeIfAbsent( + Objects.requireNonNull(item.getRegistryName()).getNamespace(), (k) -> new Object2ObjectOpenHashMap<>()); for (MetaItem.MetaValueItem entry : item.getAllItems()) { if (!entry.unlocalizedName.equals("meta_item")) { @@ -189,8 +192,7 @@ public static void loadMetaItemBracketHandler() { */ public static class Container extends ModPropertyContainer { - private Container() { - } + private Container() {} @Override protected void addRegistry(VirtualizedRegistry registry) { @@ -200,9 +202,11 @@ protected void addRegistry(VirtualizedRegistry registry) { @Override public void initialize() { BracketHandlerManager.registerBracketHandler(GTValues.MODID, "recipemap", RecipeMap::getByName); - BracketHandlerManager.registerBracketHandler(GTValues.MODID, "material", GregTechAPI.materialManager::getMaterial); + BracketHandlerManager.registerBracketHandler(GTValues.MODID, "material", + GregTechAPI.materialManager::getMaterial); BracketHandlerManager.registerBracketHandler(GTValues.MODID, "oreprefix", OrePrefix::getPrefix); - BracketHandlerManager.registerBracketHandler(GTValues.MODID, "metaitem", GroovyScriptModule::getMetaItem, ItemStack.EMPTY); + BracketHandlerManager.registerBracketHandler(GTValues.MODID, "metaitem", GroovyScriptModule::getMetaItem, + ItemStack.EMPTY); ExpansionHelper.mixinClass(Material.class, MaterialExpansion.class); ExpansionHelper.mixinClass(Material.class, MaterialPropertyExpansion.class); diff --git a/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java b/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java index 06696ed85c1..a1a6d1f6151 100644 --- a/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java +++ b/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java @@ -1,15 +1,17 @@ package gregtech.integration.groovy; -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.helper.SimpleObjectStream; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import com.google.common.base.CaseFormat; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import com.google.common.base.CaseFormat; + import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/src/main/java/gregtech/integration/hwyla/HWYLAClient.java b/src/main/java/gregtech/integration/hwyla/HWYLAClient.java index ad916398f9f..b1c8ae282f6 100644 --- a/src/main/java/gregtech/integration/hwyla/HWYLAClient.java +++ b/src/main/java/gregtech/integration/hwyla/HWYLAClient.java @@ -1,11 +1,13 @@ package gregtech.integration.hwyla; import gregtech.integration.hwyla.renderer.RendererOffsetString; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + import mcp.mobius.waila.api.IWailaPlugin; import mcp.mobius.waila.api.IWailaRegistrar; import mcp.mobius.waila.api.WailaPlugin; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) @WailaPlugin diff --git a/src/main/java/gregtech/integration/hwyla/HWYLAModule.java b/src/main/java/gregtech/integration/hwyla/HWYLAModule.java index 9287220af66..bce36365fc0 100644 --- a/src/main/java/gregtech/integration/hwyla/HWYLAModule.java +++ b/src/main/java/gregtech/integration/hwyla/HWYLAModule.java @@ -5,20 +5,21 @@ import gregtech.integration.IntegrationSubmodule; import gregtech.integration.hwyla.provider.*; import gregtech.modules.GregTechModules; + +import net.minecraft.item.ItemStack; + import mcp.mobius.waila.api.IWailaPlugin; import mcp.mobius.waila.api.IWailaRegistrar; import mcp.mobius.waila.api.SpecialChars; import mcp.mobius.waila.api.WailaPlugin; -import net.minecraft.item.ItemStack; @WailaPlugin @GregTechModule( - moduleID = GregTechModules.MODULE_HWYLA, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_HWYLA, - name = "GregTech HWYLA Integration", - description = "HWYLA (WAILA) Integration Module" -) + moduleID = GregTechModules.MODULE_HWYLA, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_HWYLA, + name = "GregTech HWYLA Integration", + description = "HWYLA (WAILA) Integration Module") public class HWYLAModule extends IntegrationSubmodule implements IWailaPlugin { @Override diff --git a/src/main/java/gregtech/integration/hwyla/provider/BlockOreDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/BlockOreDataProvider.java index 9a15bef0fdb..b8d6512742b 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/BlockOreDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/BlockOreDataProvider.java @@ -4,9 +4,11 @@ import gregtech.api.unification.ore.StoneType; import gregtech.common.blocks.BlockOre; import gregtech.integration.hwyla.HWYLAModule; -import mcp.mobius.waila.api.*; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; + +import mcp.mobius.waila.api.*; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -22,7 +24,8 @@ public void register(@NotNull IWailaRegistrar registrar) { @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.block_ore")) { return tooltip; } @@ -31,7 +34,8 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai StoneType type = accessor.getBlockState().getValue(ore.STONE_TYPE); if (accessor.getPlayer().isSneaking() && !type.shouldBeDroppedAsItem) { tooltip.add(I18n.format("gregtech.top.block_drops") + ":"); - ItemStack itemDropped = ore.getItem(accessor.getWorld(), accessor.getPosition(), accessor.getBlockState()); + ItemStack itemDropped = ore.getItem(accessor.getWorld(), accessor.getPosition(), + accessor.getBlockState()); tooltip.add(HWYLAModule.wailaStackWithName(itemDropped)); } } diff --git a/src/main/java/gregtech/integration/hwyla/provider/CapabilityDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/CapabilityDataProvider.java index aeecd67a5f3..33e9d605b54 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/CapabilityDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/CapabilityDataProvider.java @@ -1,13 +1,14 @@ package gregtech.integration.hwyla.provider; -import mcp.mobius.waila.api.IWailaDataProvider; -import mcp.mobius.waila.api.IWailaRegistrar; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaDataProvider; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; public abstract class CapabilityDataProvider implements IWailaDataProvider { @@ -24,7 +25,8 @@ protected boolean allowDisplaying(@NotNull T capability) { protected abstract NBTTagCompound getNBTData(T capability, NBTTagCompound tag); @Override - public @NotNull NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { + public @NotNull NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, + BlockPos pos) { if (te != null) { T capability = te.getCapability(getCapability(), null); if (capability != null && allowDisplaying(capability)) { diff --git a/src/main/java/gregtech/integration/hwyla/provider/ControllableDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/ControllableDataProvider.java index 4e7138bdc91..20791ab3e34 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/ControllableDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/ControllableDataProvider.java @@ -3,15 +3,17 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -42,7 +44,8 @@ protected NBTTagCompound getNBTData(IControllable capability, NBTTagCompound tag @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.controllable") || accessor.getTileEntity() == null) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/ConverterDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/ConverterDataProvider.java index f75d871a0c0..341334681c7 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/ConverterDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/ConverterDataProvider.java @@ -5,9 +5,7 @@ import gregtech.api.capability.GregtechCapabilities; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.converter.ConverterTrait; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -15,6 +13,10 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -47,7 +49,8 @@ protected NBTTagCompound getNBTData(ConverterTrait capability, NBTTagCompound ta } @Override - public @NotNull List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public @NotNull List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.converter") || accessor.getTileEntity() == null) { return tooltip; } @@ -63,16 +66,20 @@ protected NBTTagCompound getNBTData(ConverterTrait capability, NBTTagCompound ta if (isFeToEu) { tooltip.add(I18n.format("gregtech.top.convert_fe")); if (accessor.getSide() == frontFacing) { - tooltip.add(I18n.format("gregtech.top.transform_output") + " " + voltageName + TextFormatting.RESET + " (" + amperage + "A)"); + tooltip.add(I18n.format("gregtech.top.transform_output") + " " + voltageName + + TextFormatting.RESET + " (" + amperage + "A)"); } else { - tooltip.add(I18n.format("gregtech.top.transform_input") + " " + FeCompat.toFe(voltage * amperage, FeCompat.ratio(true)) + " FE"); + tooltip.add(I18n.format("gregtech.top.transform_input") + " " + + FeCompat.toFe(voltage * amperage, FeCompat.ratio(true)) + " FE"); } } else { tooltip.add(I18n.format("gregtech.top.convert_eu")); if (accessor.getSide() == frontFacing) { - tooltip.add(I18n.format("gregtech.top.transform_output") + " " + FeCompat.toFe(voltage * amperage, FeCompat.ratio(false)) + " FE"); + tooltip.add(I18n.format("gregtech.top.transform_output") + " " + + FeCompat.toFe(voltage * amperage, FeCompat.ratio(false)) + " FE"); } else { - tooltip.add(I18n.format("gregtech.top.transform_input") + " " + voltageName + TextFormatting.RESET + " (" + amperage + "A)"); + tooltip.add(I18n.format("gregtech.top.transform_input") + " " + voltageName + TextFormatting.RESET + + " (" + amperage + "A)"); } } } diff --git a/src/main/java/gregtech/integration/hwyla/provider/DiodeDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/DiodeDataProvider.java index 1e8ea29b56d..1000a11ff55 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/DiodeDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/DiodeDataProvider.java @@ -4,14 +4,16 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.metatileentities.electric.MetaTileEntityDiode; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -43,10 +45,10 @@ protected NBTTagCompound getNBTData(IEnergyContainer capability, NBTTagCompound } @Override - public @NotNull List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - if (!config.getConfig("gregtech.diode") - || !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) - || !(gtte.getMetaTileEntity() instanceof MetaTileEntityDiode)) { + public @NotNull List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + if (!config.getConfig("gregtech.diode") || !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) || + !(gtte.getMetaTileEntity() instanceof MetaTileEntityDiode)) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/ElectricContainerDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/ElectricContainerDataProvider.java index 04e80eb81ab..32eece51eeb 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/ElectricContainerDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/ElectricContainerDataProvider.java @@ -3,14 +3,16 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IEnergyContainer; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -47,7 +49,8 @@ protected NBTTagCompound getNBTData(IEnergyContainer capability, NBTTagCompound @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.energy") || accessor.getTileEntity() == null) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/LampDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/LampDataProvider.java index 66cd6d6a2ca..a4473efa17a 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/LampDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/LampDataProvider.java @@ -2,13 +2,15 @@ import gregtech.api.GTValues; import gregtech.common.blocks.BlockLamp; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; + import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import mcp.mobius.waila.api.IWailaDataProvider; import mcp.mobius.waila.api.IWailaRegistrar; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -24,7 +26,8 @@ public void register(@NotNull IWailaRegistrar registrar) { @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.block_lamp")) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/MaintenanceDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/MaintenanceDataProvider.java index e37d626be54..c776176fc2d 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/MaintenanceDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/MaintenanceDataProvider.java @@ -8,14 +8,16 @@ import gregtech.api.unification.material.Materials; import gregtech.common.items.ToolItems; import gregtech.integration.hwyla.HWYLAModule; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -54,7 +56,8 @@ protected NBTTagCompound getNBTData(IMaintenance capability, NBTTagCompound tag) @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.maintenance") || accessor.getTileEntity() == null) { return tooltip; } @@ -62,7 +65,8 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai if (accessor.getNBTData().hasKey("gregtech.IMaintenance")) { NBTTagCompound tag = accessor.getNBTData().getCompoundTag("gregtech.IMaintenance"); - IMultiblockController controller = accessor.getTileEntity().getCapability(GregtechCapabilities.CAPABILITY_MULTIBLOCK_CONTROLLER, null); + IMultiblockController controller = accessor.getTileEntity() + .getCapability(GregtechCapabilities.CAPABILITY_MULTIBLOCK_CONTROLLER, null); if (controller == null || !controller.isStructureFormed()) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/MultiRecipeMapDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/MultiRecipeMapDataProvider.java index 2bd098950f3..bc2e55e3a3f 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/MultiRecipeMapDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/MultiRecipeMapDataProvider.java @@ -3,14 +3,16 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IMultipleRecipeMaps; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -38,7 +40,8 @@ protected NBTTagCompound getNBTData(IMultipleRecipeMaps capability, NBTTagCompou @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.multi_recipemap") || accessor.getTileEntity() == null) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/MultiblockDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/MultiblockDataProvider.java index 46c2b00e81a..8714631cf1b 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/MultiblockDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/MultiblockDataProvider.java @@ -3,15 +3,17 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IMultiblockController; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; diff --git a/src/main/java/gregtech/integration/hwyla/provider/PrimitivePumpDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/PrimitivePumpDataProvider.java index 72bdcaed793..4af2e2f8915 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/PrimitivePumpDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/PrimitivePumpDataProvider.java @@ -3,10 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IPrimitivePump; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaDataProvider; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -15,6 +12,11 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaDataProvider; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -31,7 +33,8 @@ public void register(@NotNull IWailaRegistrar registrar) { @NotNull @Override - public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { + public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, + BlockPos pos) { if (te instanceof IGregTechTileEntity gtte) { if (gtte.getMetaTileEntity() instanceof IPrimitivePump pump) { NBTTagCompound subTag = new NBTTagCompound(); @@ -44,17 +47,19 @@ public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCom @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - if (!config.getConfig("gregtech.primitive_pump") - || !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) - || !(gtte.getMetaTileEntity() instanceof IPrimitivePump)) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + if (!config.getConfig("gregtech.primitive_pump") || + !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) || + !(gtte.getMetaTileEntity() instanceof IPrimitivePump)) { return tooltip; } if (accessor.getNBTData().hasKey("gregtech.IPrimitivePump")) { NBTTagCompound tag = accessor.getNBTData().getCompoundTag("gregtech.IPrimitivePump"); int production = tag.getInteger("Production"); - tooltip.add(I18n.format("gregtech.top.primitive_pump_production") + " " + TextFormatting.AQUA + production + TextFormatting.RESET + " L/s"); + tooltip.add(I18n.format("gregtech.top.primitive_pump_production") + " " + TextFormatting.AQUA + production + + TextFormatting.RESET + " L/s"); } return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java index 70ab53b5c9a..f1a2a6b5a4c 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java @@ -10,15 +10,17 @@ import gregtech.api.unification.material.Materials; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.multi.MetaTileEntityLargeBoiler; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -52,7 +54,8 @@ protected NBTTagCompound getNBTData(AbstractRecipeLogic capability, NBTTagCompou @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.recipe_logic") || accessor.getTileEntity() == null) { return tooltip; } @@ -67,8 +70,10 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai if (accessor.getTileEntity() instanceof IGregTechTileEntity gtte) { MetaTileEntity mte = gtte.getMetaTileEntity(); - if (mte instanceof SteamMetaTileEntity || mte instanceof MetaTileEntityLargeBoiler || mte instanceof RecipeMapSteamMultiblockController) { - endText = ": " + absEUt + TextFormatting.RESET + " L/t " + I18n.format(Materials.Steam.getUnlocalizedName()); + if (mte instanceof SteamMetaTileEntity || mte instanceof MetaTileEntityLargeBoiler || + mte instanceof RecipeMapSteamMultiblockController) { + endText = ": " + absEUt + TextFormatting.RESET + " L/t " + + I18n.format(Materials.Steam.getUnlocalizedName()); } AbstractRecipeLogic arl = mte.getRecipeLogic(); if (arl != null) { @@ -76,7 +81,8 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai } } if (endText == null) { - endText = ": " + absEUt + TextFormatting.RESET + " EU/t (" + GTValues.VNF[GTUtility.getTierByVoltage(absEUt)] + TextFormatting.RESET + ")"; + endText = ": " + absEUt + TextFormatting.RESET + " EU/t (" + + GTValues.VNF[GTUtility.getTierByVoltage(absEUt)] + TextFormatting.RESET + ")"; } if (EUt == 0) return tooltip; diff --git a/src/main/java/gregtech/integration/hwyla/provider/SteamBoilerDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/SteamBoilerDataProvider.java index a4443d710e8..85a3f738ca0 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/SteamBoilerDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/SteamBoilerDataProvider.java @@ -4,10 +4,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.unification.material.Materials; import gregtech.common.metatileentities.steam.boiler.SteamBoiler; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaDataProvider; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -15,6 +12,11 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaDataProvider; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -31,7 +33,8 @@ public void register(@NotNull IWailaRegistrar registrar) { @NotNull @Override - public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { + public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, + BlockPos pos) { if (te instanceof IGregTechTileEntity gtte) { if (gtte.getMetaTileEntity() instanceof SteamBoiler boiler) { NBTTagCompound subTag = new NBTTagCompound(); @@ -46,10 +49,11 @@ public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCom @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - if (!config.getConfig("gregtech.steam_boiler") - || !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) - || !(gtte.getMetaTileEntity() instanceof SteamBoiler)) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + if (!config.getConfig("gregtech.steam_boiler") || + !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) || + !(gtte.getMetaTileEntity() instanceof SteamBoiler)) { return tooltip; } @@ -61,7 +65,8 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai // Creating steam if (steamRate > 0 && hasWater) { - tooltip.add(I18n.format("gregtech.top.energy_production") + ": " + (steamRate / 10) + " L/t " + I18n.format(Materials.Steam.getUnlocalizedName())); + tooltip.add(I18n.format("gregtech.top.energy_production") + ": " + (steamRate / 10) + " L/t " + + I18n.format(Materials.Steam.getUnlocalizedName())); } // Initial heat-up diff --git a/src/main/java/gregtech/integration/hwyla/provider/TransformerDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/TransformerDataProvider.java index acf86dc6ef4..49da30bf2da 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/TransformerDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/TransformerDataProvider.java @@ -5,15 +5,17 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.electric.MetaTileEntityTransformer; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.TextFormatting; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -59,10 +61,11 @@ protected NBTTagCompound getNBTData(IEnergyContainer capability, NBTTagCompound @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - if (!config.getConfig("gregtech.transformer") - || !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) - || !(gtte.getMetaTileEntity() instanceof MetaTileEntityTransformer)) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + if (!config.getConfig("gregtech.transformer") || + !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) || + !(gtte.getMetaTileEntity() instanceof MetaTileEntityTransformer)) { return tooltip; } if (accessor.getNBTData().hasKey("gregtech.MetaTileEntityTransformer")) { @@ -91,10 +94,8 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai .append("A)"); // Step Up/Step Down line - tooltip.add((isTransformUp - ? I18n.format("gregtech.top.transform_up") - : I18n.format("gregtech.top.transform_down")) - + input + " -> " + output); + tooltip.add((isTransformUp ? I18n.format("gregtech.top.transform_up") : + I18n.format("gregtech.top.transform_down")) + input + " -> " + output); // Input/Output side line EnumFacing hitFace = accessor.getSide(); diff --git a/src/main/java/gregtech/integration/hwyla/provider/WorkableDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/WorkableDataProvider.java index 40b468cf6ff..febcc67b9f0 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/WorkableDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/WorkableDataProvider.java @@ -4,14 +4,16 @@ import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IWorkable; import gregtech.api.capability.impl.ComputationRecipeLogic; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -37,7 +39,8 @@ protected NBTTagCompound getNBTData(IWorkable capability, NBTTagCompound tag) { NBTTagCompound subTag = new NBTTagCompound(); subTag.setBoolean("Active", capability.isActive()); if (capability.isActive()) { - subTag.setBoolean("ShowAsComputation", capability instanceof ComputationRecipeLogic logic && !logic.shouldShowDuration()); + subTag.setBoolean("ShowAsComputation", + capability instanceof ComputationRecipeLogic logic && !logic.shouldShowDuration()); subTag.setInteger("Progress", capability.getProgress()); subTag.setInteger("MaxProgress", capability.getMaxProgress()); } @@ -47,7 +50,8 @@ protected NBTTagCompound getNBTData(IWorkable capability, NBTTagCompound tag) { @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.workable") || accessor.getTileEntity() == null) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/renderer/RendererOffsetString.java b/src/main/java/gregtech/integration/hwyla/renderer/RendererOffsetString.java index fed7f16fade..7be3a9f822c 100644 --- a/src/main/java/gregtech/integration/hwyla/renderer/RendererOffsetString.java +++ b/src/main/java/gregtech/integration/hwyla/renderer/RendererOffsetString.java @@ -6,9 +6,10 @@ import mcp.mobius.waila.overlay.DisplayUtil; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.awt.*; +import javax.annotation.ParametersAreNonnullByDefault; + /** Adapted from Jade 1.12.2, a HWYLA addon mod. */ @ParametersAreNonnullByDefault public class RendererOffsetString implements IWailaTooltipRenderer { diff --git a/src/main/java/gregtech/integration/jei/JEIOptional.java b/src/main/java/gregtech/integration/jei/JEIOptional.java index 8065676e9d8..1ef357a65c4 100644 --- a/src/main/java/gregtech/integration/jei/JEIOptional.java +++ b/src/main/java/gregtech/integration/jei/JEIOptional.java @@ -3,18 +3,21 @@ import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.client.renderer.scene.WorldSceneRenderer; import gregtech.integration.jei.multiblock.MultiblockInfoRecipeWrapper; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.Optional; + import mezz.jei.api.IRecipeRegistry; import mezz.jei.api.recipe.IFocus; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.Optional; import java.util.List; public class JEIOptional { + @Optional.Method(modid = "jei") - public static WorldSceneRenderer getWorldSceneRenderer(MultiblockControllerBase controllerBase){ + public static WorldSceneRenderer getWorldSceneRenderer(MultiblockControllerBase controllerBase) { IRecipeRegistry rr = JustEnoughItemsModule.jeiRuntime.getRecipeRegistry(); IFocus focus = rr.createFocus(IFocus.Mode.INPUT, controllerBase.getStackForm()); return rr.getRecipeCategories(focus) diff --git a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java index 1af01b4533a..545d2e56b41 100644 --- a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java +++ b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java @@ -36,6 +36,15 @@ import gregtech.integration.jei.utils.ModularUIGuiHandler; import gregtech.integration.jei.utils.MultiblockInfoRecipeFocusShower; import gregtech.modules.GregTechModules; + +import net.minecraft.client.resources.I18n; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.ObfuscationReflectionHelper; +import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; +import net.minecraftforge.fml.relauncher.Side; + import mezz.jei.Internal; import mezz.jei.api.*; import mezz.jei.api.ingredients.IIngredientRegistry; @@ -45,15 +54,7 @@ import mezz.jei.config.Constants; import mezz.jei.input.IShowsRecipeFocuses; import mezz.jei.input.InputHandler; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.ObfuscationReflectionHelper; -import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; -import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nonnull; import java.lang.reflect.Field; import java.util.Collection; import java.util.List; @@ -62,14 +63,15 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.Nonnull; + @JEIPlugin @GregTechModule( - moduleID = GregTechModules.MODULE_JEI, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_JEI, - name = "GregTech JEI Integration", - description = "JustEnoughItems Integration Module" -) + moduleID = GregTechModules.MODULE_JEI, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_JEI, + name = "GregTech JEI Integration", + description = "JustEnoughItems Integration Module") public class JustEnoughItemsModule extends IntegrationSubmodule implements IModPlugin { public static IIngredientRegistry ingredientRegistry; @@ -94,7 +96,8 @@ public void registerItemSubtypes(@Nonnull ISubtypeRegistry subtypeRegistry) { for (MetaItem metaItem : MetaItems.ITEMS) { subtypeRegistry.registerSubtypeInterpreter(metaItem, subtype); } - subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(MetaBlocks.MACHINE), new MachineSubtypeHandler()); + subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(MetaBlocks.MACHINE), + new MachineSubtypeHandler()); } @Override @@ -105,7 +108,8 @@ public void registerCategories(@Nonnull IRecipeCategoryRegistration registry) { for (RecipeMap recipeMap : RecipeMap.getRecipeMaps()) { if (!recipeMap.isHidden) { for (GTRecipeCategory category : recipeMap.getRecipesByCategory().keySet()) { - registry.addRecipeCategories(new RecipeMapCategory(recipeMap, category, registry.getJeiHelpers().getGuiHelper())); + registry.addRecipeCategories( + new RecipeMapCategory(recipeMap, category, registry.getJeiHelpers().getGuiHelper())); } } } @@ -131,13 +135,16 @@ public void register(IModRegistry registry) { GTValues.MODID + ":material_tree", VanillaRecipeCategoryUid.INFORMATION, VanillaRecipeCategoryUid.FUEL); - registry.getRecipeTransferRegistry().addRecipeTransferHandler(modularUIGuiHandler, Constants.UNIVERSAL_RECIPE_TRANSFER_UID); + registry.getRecipeTransferRegistry().addRecipeTransferHandler(modularUIGuiHandler, + Constants.UNIVERSAL_RECIPE_TRANSFER_UID); registry.addAdvancedGuiHandlers(modularUIGuiHandler); registry.addGhostIngredientHandler(modularUIGuiHandler.getGuiContainerClass(), modularUIGuiHandler); // register transfer handler for crafting recipes - ModularUIGuiHandler craftingStationGuiHandler = new ModularUIGuiHandler(jeiHelpers.recipeTransferHandlerHelper()); - registry.getRecipeTransferRegistry().addRecipeTransferHandler(craftingStationGuiHandler, VanillaRecipeCategoryUid.CRAFTING); + ModularUIGuiHandler craftingStationGuiHandler = new ModularUIGuiHandler( + jeiHelpers.recipeTransferHandlerHelper()); + registry.getRecipeTransferRegistry().addRecipeTransferHandler(craftingStationGuiHandler, + VanillaRecipeCategoryUid.CRAFTING); for (RecipeMap recipeMap : RecipeMap.getRecipeMaps()) { if (!recipeMap.isHidden) { @@ -160,9 +167,8 @@ public void register(IModRegistry registry) { } registry.addRecipes(recipeStream.map(r -> new GTRecipeWrapper(recipeMap, r)) - .collect(Collectors.toList()), - entry.getKey().getUniqueID() - ); + .collect(Collectors.toList()), + entry.getKey().getUniqueID()); } } } @@ -171,7 +177,8 @@ public void register(IModRegistry registry) { MetaTileEntity metaTileEntity = GregTechAPI.MTE_REGISTRY.getObject(metaTileEntityId); assert metaTileEntity != null; if (metaTileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, null) != null) { - IControllable workableCapability = metaTileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, null); + IControllable workableCapability = metaTileEntity + .getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, null); if (workableCapability instanceof AbstractRecipeLogic logic) { if (metaTileEntity instanceof IMultipleRecipeMaps) { @@ -199,7 +206,7 @@ public void register(IModRegistry registry) { } String oreByProductId = GTValues.MODID + ":" + "ore_by_product"; registry.addRecipes(oreByproductList, oreByProductId); - MetaTileEntity[][] machineLists = new MetaTileEntity[][]{ + MetaTileEntity[][] machineLists = new MetaTileEntity[][] { MetaTileEntities.MACERATOR, MetaTileEntities.ORE_WASHER, MetaTileEntities.CENTRIFUGE, @@ -213,7 +220,7 @@ public void register(IModRegistry registry) { registry.addRecipeCatalyst(machine[GTValues.LV].getStackForm(), oreByProductId); } - //Material Tree + // Material Tree List materialTreeList = new CopyOnWriteArrayList<>(); for (Material material : GregTechAPI.materialManager.getRegisteredMaterials()) { if (material.hasProperty(PropertyKey.DUST)) { @@ -222,7 +229,7 @@ public void register(IModRegistry registry) { } registry.addRecipes(materialTreeList, GTValues.MODID + ":" + "material_tree"); - //Ore Veins + // Ore Veins List oreVeins = WorldGenRegistry.getOreDeposits(); List oreInfoList = new CopyOnWriteArrayList<>(); for (OreDepositDefinition vein : oreVeins) { @@ -234,7 +241,7 @@ public void register(IModRegistry registry) { registry.addRecipeCatalyst(MetaItems.PROSPECTOR_LV.getStackForm(), oreSpawnID); registry.addRecipeCatalyst(MetaItems.PROSPECTOR_HV.getStackForm(), oreSpawnID); registry.addRecipeCatalyst(MetaItems.PROSPECTOR_LUV.getStackForm(), oreSpawnID); - //Ore Veins End + // Ore Veins End // Fluid Veins List fluidVeins = WorldGenRegistry.getBedrockVeinDeposits(); @@ -263,14 +270,15 @@ public void register(IModRegistry registry) { "gregtech.machine.canner.jei_description"); } - //Multiblock info page registration + // Multiblock info page registration MultiblockInfoCategory.REGISTER.forEach(mte -> { String[] desc = mte.getDescription(); if (desc.length > 0) { registry.addIngredientInfo(mte.getStackForm(), VanillaTypes.ITEM, mte.getDescription()); } }); - registry.addIngredientInfo(new ItemStack(MetaBlocks.BRITTLE_CHARCOAL), VanillaTypes.ITEM, I18n.format("tile.brittle_charcoal.tooltip.1", I18n.format("tile.brittle_charcoal.tooltip.2"))); + registry.addIngredientInfo(new ItemStack(MetaBlocks.BRITTLE_CHARCOAL), VanillaTypes.ITEM, + I18n.format("tile.brittle_charcoal.tooltip.1", I18n.format("tile.brittle_charcoal.tooltip.2"))); } private void setupInputHandler() { @@ -278,7 +286,8 @@ private void setupInputHandler() { Field inputHandlerField = Internal.class.getDeclaredField("inputHandler"); inputHandlerField.setAccessible(true); InputHandler inputHandler = (InputHandler) inputHandlerField.get(null); - List showsRecipeFocuses = ObfuscationReflectionHelper.getPrivateValue(InputHandler.class, inputHandler, "showsRecipeFocuses"); + List showsRecipeFocuses = ObfuscationReflectionHelper + .getPrivateValue(InputHandler.class, inputHandler, "showsRecipeFocuses"); showsRecipeFocuses.add(new MultiblockInfoRecipeFocusShower()); @@ -287,7 +296,8 @@ private void setupInputHandler() { } } - private void registerRecipeMapCatalyst(IModRegistry registry, RecipeMap recipeMap, MetaTileEntity metaTileEntity) { + private void registerRecipeMapCatalyst(IModRegistry registry, RecipeMap recipeMap, + MetaTileEntity metaTileEntity) { for (GTRecipeCategory category : recipeMap.getRecipesByCategory().keySet()) { RecipeMapCategory jeiCategory = RecipeMapCategory.getCategoryFor(category); if (jeiCategory != null) { @@ -300,7 +310,8 @@ private void registerRecipeMapCatalyst(IModRegistry registry, RecipeMap recip return; } if (recipeMap.getSmallRecipeMap() != null) { - registry.addRecipeCatalyst(metaTileEntity.getStackForm(), GTValues.MODID + ":" + recipeMap.getSmallRecipeMap().unlocalizedName); + registry.addRecipeCatalyst(metaTileEntity.getStackForm(), + GTValues.MODID + ":" + recipeMap.getSmallRecipeMap().unlocalizedName); return; } diff --git a/src/main/java/gregtech/integration/jei/basic/BasicRecipeCategory.java b/src/main/java/gregtech/integration/jei/basic/BasicRecipeCategory.java index 427562551d4..0ecd821d697 100644 --- a/src/main/java/gregtech/integration/jei/basic/BasicRecipeCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/BasicRecipeCategory.java @@ -1,20 +1,24 @@ package gregtech.integration.jei.basic; import gregtech.api.GTValues; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; + import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapperFactory; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; -public abstract class BasicRecipeCategory implements IRecipeCategory, IRecipeWrapperFactory { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class BasicRecipeCategory + implements IRecipeCategory, IRecipeWrapperFactory { public final String uniqueName; public final String localizedName; @@ -52,8 +56,7 @@ public IDrawable getBackground() { } @Override - public void drawExtras(@Nonnull Minecraft minecraft) { - } + public void drawExtras(@Nonnull Minecraft minecraft) {} @Nonnull @Override diff --git a/src/main/java/gregtech/integration/jei/basic/GTFluidVeinCategory.java b/src/main/java/gregtech/integration/jei/basic/GTFluidVeinCategory.java index 1bd0ad0fbb0..6f53f16de6c 100644 --- a/src/main/java/gregtech/integration/jei/basic/GTFluidVeinCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/GTFluidVeinCategory.java @@ -4,19 +4,22 @@ import gregtech.api.util.GTStringUtils; import gregtech.api.worldgen.config.WorldGenRegistry; import gregtech.integration.jei.utils.JEIResourceDepositCategoryUtils; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; + import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiFluidStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + public class GTFluidVeinCategory extends BasicRecipeCategory { private static final int SLOT_CENTER = 79; @@ -44,11 +47,13 @@ public GTFluidVeinCategory(IGuiHelper guiHelper) { guiHelper.createBlankDrawable(176, 166), guiHelper); - this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18) + .build(); } @Override - public void setRecipe(@Nonnull IRecipeLayout recipeLayout, GTFluidVeinInfo gtFluidVeinInfo, @Nonnull IIngredients ingredients) { + public void setRecipe(@Nonnull IRecipeLayout recipeLayout, GTFluidVeinInfo gtFluidVeinInfo, + @Nonnull IIngredients ingredients) { IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks(); fluidStackGroup.init(0, true, SLOT_CENTER, 19, 16, 16, 1, false, null); @@ -97,12 +102,14 @@ public void drawExtras(@Nonnull Minecraft minecraft) { // Vein Depletion Chance information String veinDepletionChance = I18n.format("gregtech.jei.fluid.depletion_chance", depletionChance); depletionChanceLength = minecraft.fontRenderer.getStringWidth(veinDepletionChance); - minecraft.fontRenderer.drawString(veinDepletionChance, TEXT_START_X, START_POS_Y + 3 * FONT_HEIGHT + 1, 0x111111); + minecraft.fontRenderer.drawString(veinDepletionChance, TEXT_START_X, START_POS_Y + 3 * FONT_HEIGHT + 1, + 0x111111); // Vein Depletion Amount information String veinDepletionAmount = I18n.format("gregtech.jei.fluid.depletion_amount", depletionAmount); depletionAmountLength = minecraft.fontRenderer.getStringWidth(veinDepletionAmount); - minecraft.fontRenderer.drawString(veinDepletionAmount, TEXT_START_X, START_POS_Y + 4 * FONT_HEIGHT + 1, 0x111111); + minecraft.fontRenderer.drawString(veinDepletionAmount, TEXT_START_X, START_POS_Y + 4 * FONT_HEIGHT + 1, + 0x111111); // Vein Depleted Yield information String veinDepletedYield = I18n.format("gregtech.jei.fluid.depleted_rate", depletedYield); @@ -127,17 +134,26 @@ public void drawExtras(@Nonnull Minecraft minecraft) { public List getTooltipStrings(int mouseX, int mouseY) { if (isPointWithinRange(TEXT_START_X, START_POS_Y, weightLength, FONT_HEIGHT, mouseX, mouseY)) { return Collections.singletonList(I18n.format("gregtech.jei.fluid.weight_hover")); - } else if (isPointWithinRange(TEXT_START_X, START_POS_Y + FONT_HEIGHT + 1, minYieldLength, FONT_HEIGHT + 1, mouseX, mouseY)) { - return Collections.singletonList(I18n.format("gregtech.jei.fluid.min_hover")); - } else if (isPointWithinRange(TEXT_START_X, START_POS_Y + 2 * FONT_HEIGHT + 1, maxYieldLength, FONT_HEIGHT + 1, mouseX, mouseY)) { - return Collections.singletonList(I18n.format("gregtech.jei.fluid.max_hover")); - } else if (isPointWithinRange(TEXT_START_X, START_POS_Y + 3 * FONT_HEIGHT + 1, depletionChanceLength, FONT_HEIGHT + 1, mouseX, mouseY)) { - return Collections.singletonList(I18n.format("gregtech.jei.fluid.dep_chance_hover")); - } else if (isPointWithinRange(TEXT_START_X, START_POS_Y + 4 * FONT_HEIGHT + 1, depletionAmountLength, FONT_HEIGHT + 1, mouseX, mouseY)) { - return Collections.singletonList(I18n.format("gregtech.jei.fluid.dep_amount_hover")); - } else if (isPointWithinRange(TEXT_START_X, START_POS_Y + 5 * FONT_HEIGHT + 1, depletedYieldLength, FONT_HEIGHT + 1, mouseX, mouseY)) { - return Collections.singletonList(I18n.format("gregtech.jei.fluid.dep_yield_hover")); - } + } else if (isPointWithinRange(TEXT_START_X, START_POS_Y + FONT_HEIGHT + 1, minYieldLength, FONT_HEIGHT + 1, + mouseX, mouseY)) { + return Collections.singletonList(I18n.format("gregtech.jei.fluid.min_hover")); + } else + if (isPointWithinRange(TEXT_START_X, START_POS_Y + 2 * FONT_HEIGHT + 1, maxYieldLength, FONT_HEIGHT + 1, + mouseX, mouseY)) { + return Collections.singletonList(I18n.format("gregtech.jei.fluid.max_hover")); + } else + if (isPointWithinRange(TEXT_START_X, START_POS_Y + 3 * FONT_HEIGHT + 1, depletionChanceLength, + FONT_HEIGHT + 1, mouseX, mouseY)) { + return Collections.singletonList(I18n.format("gregtech.jei.fluid.dep_chance_hover")); + } else + if (isPointWithinRange(TEXT_START_X, START_POS_Y + 4 * FONT_HEIGHT + 1, depletionAmountLength, + FONT_HEIGHT + 1, mouseX, mouseY)) { + return Collections.singletonList(I18n.format("gregtech.jei.fluid.dep_amount_hover")); + } else + if (isPointWithinRange(TEXT_START_X, START_POS_Y + 5 * FONT_HEIGHT + 1, depletedYieldLength, + FONT_HEIGHT + 1, mouseX, mouseY)) { + return Collections.singletonList(I18n.format("gregtech.jei.fluid.dep_yield_hover")); + } return Collections.emptyList(); } @@ -153,7 +169,8 @@ public List getTooltipStrings(int mouseX, int mouseY) { * @param pointY The Y value of the point to check * @return True if the provided (X,Y) point is within the described box, else false */ - private static boolean isPointWithinRange(int initialX, int initialY, int width, int height, int pointX, int pointY) { + private static boolean isPointWithinRange(int initialX, int initialY, int width, int height, int pointX, + int pointY) { return initialX <= pointX && pointX <= initialX + width && initialY <= pointY && pointY <= initialY + height; } } diff --git a/src/main/java/gregtech/integration/jei/basic/GTFluidVeinInfo.java b/src/main/java/gregtech/integration/jei/basic/GTFluidVeinInfo.java index 695e72fc014..1e130453824 100644 --- a/src/main/java/gregtech/integration/jei/basic/GTFluidVeinInfo.java +++ b/src/main/java/gregtech/integration/jei/basic/GTFluidVeinInfo.java @@ -3,14 +3,16 @@ import gregtech.api.util.FileUtility; import gregtech.api.worldgen.config.BedrockFluidDepositDefinition; import gregtech.integration.jei.utils.JEIResourceDepositCategoryUtils; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; -import mezz.jei.api.recipe.IRecipeWrapper; + import net.minecraft.item.ItemStack; import net.minecraft.world.biome.Biome; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeWrapper; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -33,10 +35,9 @@ public class GTFluidVeinInfo implements IRecipeWrapper { private final List> bucketList = new ArrayList<>(); public GTFluidVeinInfo(BedrockFluidDepositDefinition definition) { - this.definition = definition; - //Get the Name and trim unneeded information + // Get the Name and trim unneeded information this.name = definition.getAssignedName(); if (this.name == null) { this.name = FileUtility.trimFileName(definition.getDepositName()); @@ -61,7 +62,6 @@ public GTFluidVeinInfo(BedrockFluidDepositDefinition definition) { fluidList.add(fluidList2); this.biomeFunction = definition.getBiomeWeightModifier(); - } @Override @@ -119,5 +119,4 @@ public int getDepletedYield() { public FluidStack getFluid() { return fluid; } - } diff --git a/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java b/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java index 29e91bca4a5..6e6b14b8d1c 100644 --- a/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java @@ -6,14 +6,16 @@ import gregtech.api.worldgen.config.WorldGenRegistry; import gregtech.integration.jei.utils.JEIResourceDepositCategoryUtils; import gregtech.integration.jei.utils.render.ItemStackTextRenderer; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; + import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; import javax.annotation.Nonnull; @@ -38,7 +40,8 @@ public GTOreCategory(IGuiHelper guiHelper) { guiHelper.createBlankDrawable(176, 166), guiHelper); - this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18) + .build(); } @Override @@ -46,12 +49,11 @@ public void setRecipe(IRecipeLayout recipeLayout, GTOreInfo recipeWrapper, @Nonn IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); int baseYPos = 19; - //The ore selected from JEI + // The ore selected from JEI itemStackGroup.init(0, true, 22, baseYPos); - //The Surface Identifier + // The Surface Identifier itemStackGroup.init(1, true, 22, 73); - for (int i = 0; i < recipeWrapper.getOutputCount(); i++) { int yPos = baseYPos + (i / NUM_OF_SLOTS) * SLOT_HEIGHT; int xPos = 70 + (i % NUM_OF_SLOTS) * SLOT_WIDTH; @@ -85,9 +87,9 @@ public void drawExtras(@Nonnull Minecraft minecraft) { int baseYPos = 19; int dimDisplayPos = 70; - //Selected Ore + // Selected Ore this.slot.draw(minecraft, 22, baseYPos); - //Surface Identifier + // Surface Identifier this.slot.draw(minecraft, 22, SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1); int yPos = 0; @@ -98,28 +100,32 @@ public void drawExtras(@Nonnull Minecraft minecraft) { this.slot.draw(minecraft, xPos, yPos); } - //base positions set to position of last rendered slot for later use. - //Must account for the fact that yPos is the top corner of the slot, so add in another slot height + // base positions set to position of last rendered slot for later use. + // Must account for the fact that yPos is the top corner of the slot, so add in another slot height baseYPos = yPos + SLOT_HEIGHT; GTStringUtils.drawCenteredStringWithCutoff(veinName, minecraft.fontRenderer, 176); - //Begin Drawing information, depending on how many rows of ore outputs were created - //Give room for 5 lines of 5 ores each, so 25 unique ores in the vein - //73 is SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1 + // Begin Drawing information, depending on how many rows of ore outputs were created + // Give room for 5 lines of 5 ores each, so 25 unique ores in the vein + // 73 is SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1 if (baseYPos >= SLOT_HEIGHT * NUM_OF_SLOTS) { - minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.spawn_range", minHeight, maxHeight), baseXPos, baseYPos + 1, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.spawn_range", minHeight, maxHeight), + baseXPos, baseYPos + 1, 0x111111); } else { - minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.spawn_range", minHeight, maxHeight), baseXPos, SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1, 0x111111); - //Update the position at which the spawn information ends + minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.spawn_range", minHeight, maxHeight), + baseXPos, SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1, 0x111111); + // Update the position at which the spawn information ends baseYPos = 73; } - //Create the Weight - minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.vein_weight", weight), baseXPos, baseYPos + FONT_HEIGHT, 0x111111); + // Create the Weight + minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.vein_weight", weight), baseXPos, + baseYPos + FONT_HEIGHT, 0x111111); - //Create the Dimensions - minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.dimension"), baseXPos, baseYPos + (2 * FONT_HEIGHT), 0x111111); + // Create the Dimensions + minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.dimension"), baseXPos, + baseYPos + (2 * FONT_HEIGHT), 0x111111); JEIResourceDepositCategoryUtils.drawMultiLineCommaSeparatedDimensionList(WorldGenRegistry.getNamedDimensions(), dimension, @@ -128,7 +134,8 @@ public void drawExtras(@Nonnull Minecraft minecraft) { baseYPos + 3 * FONT_HEIGHT, dimDisplayPos); - //Label the Surface Identifier - minecraft.fontRenderer.drawSplitString(I18n.format("gregtech.jei.ore.surfacematerial"), 15, 92, baseXPos - 20, 0x111111); + // Label the Surface Identifier + minecraft.fontRenderer.drawSplitString(I18n.format("gregtech.jei.ore.surfacematerial"), 15, 92, baseXPos - 20, + 0x111111); } } diff --git a/src/main/java/gregtech/integration/jei/basic/GTOreInfo.java b/src/main/java/gregtech/integration/jei/basic/GTOreInfo.java index e91ab8815fd..0f5bd90bf9f 100644 --- a/src/main/java/gregtech/integration/jei/basic/GTOreInfo.java +++ b/src/main/java/gregtech/integration/jei/basic/GTOreInfo.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.basic; -import com.google.common.collect.ImmutableList; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; import gregtech.api.util.FileUtility; @@ -16,9 +15,7 @@ import gregtech.api.worldgen.populator.SurfaceRockPopulator; import gregtech.common.blocks.BlockOre; import gregtech.integration.jei.utils.JEIResourceDepositCategoryUtils; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; -import mezz.jei.api.recipe.IRecipeWrapper; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; @@ -30,6 +27,11 @@ import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fml.common.Loader; + +import com.google.common.collect.ImmutableList; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeWrapper; import org.apache.commons.lang3.tuple.Pair; import java.util.ArrayList; @@ -60,19 +62,21 @@ public class GTOreInfo implements IRecipeWrapper { public GTOreInfo(OreDepositDefinition definition) { this.definition = definition; - //Don't default to vanilla Maximums and minimums if the values are not defined and Cubic Chunks is loaded - //This could be improved to use the actual minimum and maximum heights, at the cost of including the CC Api + // Don't default to vanilla Maximums and minimums if the values are not defined and Cubic Chunks is loaded + // This could be improved to use the actual minimum and maximum heights, at the cost of including the CC Api if (Loader.isModLoaded(MODID_CC)) { - this.maxHeight = definition.getMaximumHeight() == Integer.MAX_VALUE ? Integer.MAX_VALUE : definition.getMaximumHeight(); - this.minHeight = definition.getMinimumHeight() == Integer.MIN_VALUE ? Integer.MIN_VALUE : definition.getMinimumHeight(); + this.maxHeight = definition.getMaximumHeight() == Integer.MAX_VALUE ? Integer.MAX_VALUE : + definition.getMaximumHeight(); + this.minHeight = definition.getMinimumHeight() == Integer.MIN_VALUE ? Integer.MIN_VALUE : + definition.getMinimumHeight(); } else { - //Some veins don't have a maximum height, so set it to the maximum world height? + // Some veins don't have a maximum height, so set it to the maximum world height? this.maxHeight = definition.getMaximumHeight() == Integer.MAX_VALUE ? 255 : definition.getMaximumHeight(); - //Some veins don't have a minimum height, so set it to 0 in that case + // Some veins don't have a minimum height, so set it to 0 in that case this.minHeight = definition.getMinimumHeight() == Integer.MIN_VALUE ? 0 : definition.getMinimumHeight(); } - //Get the Name and trim unneeded information + // Get the Name and trim unneeded information if (definition.getAssignedName() == null) { this.name = FileUtility.trimFileName(definition.getDepositName()); } else { @@ -83,7 +87,7 @@ public GTOreInfo(OreDepositDefinition definition) { this.weight = definition.getWeight(); - //Find the Vein Populator and use it to define the Surface Indicator + // Find the Vein Populator and use it to define the Surface Indicator veinPopulator = definition.getVeinPopulator(); ItemStack identifierStack = findSurfaceBlock(veinPopulator); @@ -100,7 +104,7 @@ public GTOreInfo(OreDepositDefinition definition) { if (blockFiller instanceof LayeredBlockFiller) { groupedOutputsAsItemStacks = getLayeredVeinOutputStacks(); } else { - //Group the output Ores + // Group the output Ores groupedOutputsAsItemStacks = findUniqueBlocksAsItemStack(generatedBlocksAsItemStacks); } @@ -182,8 +186,7 @@ private List> getLayeredVeinOutputStacks() { getStacksFromStates(getPossibleStates(filler.getPrimary(), new ArrayList<>()), new ArrayList<>()), getStacksFromStates(getPossibleStates(filler.getSecondary(), new ArrayList<>()), new ArrayList<>()), getStacksFromStates(getPossibleStates(filler.getBetween(), new ArrayList<>()), new ArrayList<>()), - getStacksFromStates(getPossibleStates(filler.getSporadic(), new ArrayList<>()), new ArrayList<>()) - ); + getStacksFromStates(getPossibleStates(filler.getSporadic(), new ArrayList<>()), new ArrayList<>())); } // Condenses the List of ores down to group together ores that share the same material but only vary in stone type. @@ -221,7 +224,6 @@ public List> findUniqueBlocksAsItemStack(List itemLis // Finds the generated surface block or material. In the case of Fluid generation, finds a bucket of the fluid. public static ItemStack findSurfaceBlock(IVeinPopulator veinPopulator) { - Material mat; IBlockState state; ItemStack stack = new ItemStack(Items.AIR); @@ -240,7 +242,7 @@ else if (veinPopulator instanceof SurfaceBlockPopulator) { stack = GTUtility.toItem(state); return stack; } - //Fluid generation support + // Fluid generation support else if (veinPopulator instanceof FluidSpringPopulator) { state = ((FluidSpringPopulator) veinPopulator).getFluidState(); Block temp = state.getBlock(); @@ -255,19 +257,18 @@ else if (veinPopulator instanceof FluidSpringPopulator) { return stack; } - //Creates a tooltip based on the specific slots + // Creates a tooltip based on the specific slots public void addTooltip(int slotIndex, boolean input, Object ingredient, List tooltip) { - - //Only add the Biome Information to the selected Ore + // Only add the Biome Information to the selected Ore if (slotIndex == 0) { tooltip.addAll(JEIResourceDepositCategoryUtils.createSpawnPageBiomeTooltip(biomeFunction, weight)); if (description != null) { tooltip.add(description); } } - //Surface Indicator slot + // Surface Indicator slot else if (slotIndex == 1) { - //Only add the special tooltip to the Material rock piles + // Only add the special tooltip to the Material rock piles if (veinPopulator instanceof SurfaceRockPopulator) { tooltip.add(I18n.format("gregtech.jei.ore.surface_rock_1")); tooltip.add(I18n.format("gregtech.jei.ore.surface_rock_2")); @@ -281,9 +282,8 @@ else if (slotIndex == 1) { } } - //Creates a tooltip show the weighting of the individual ores in the ore vein + // Creates a tooltip show the weighting of the individual ores in the ore vein public List createOreWeightingTooltip(int slotIndex) { - List tooltip = new ArrayList<>(); double weight; @@ -302,7 +302,8 @@ public List createOreWeightingTooltip(int slotIndex) { private List createOreLayeringTooltip(int slotIndex) { List tooltip = new ArrayList<>(); - FillerConfigUtils.LayeredFillerEntry filler = (FillerConfigUtils.LayeredFillerEntry) blockFiller.getAllPossibleStates().get(0); + FillerConfigUtils.LayeredFillerEntry filler = (FillerConfigUtils.LayeredFillerEntry) blockFiller + .getAllPossibleStates().get(0); switch (slotIndex) { // cases are offset by 2, being the "Ore Input" and the Surface Indicator case 2: { diff --git a/src/main/java/gregtech/integration/jei/basic/MaterialTree.java b/src/main/java/gregtech/integration/jei/basic/MaterialTree.java index 44dfafa4327..3babd634779 100644 --- a/src/main/java/gregtech/integration/jei/basic/MaterialTree.java +++ b/src/main/java/gregtech/integration/jei/basic/MaterialTree.java @@ -1,20 +1,23 @@ package gregtech.integration.jei.basic; -import com.google.common.collect.ImmutableList; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import com.google.common.collect.ImmutableList; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.List; public class MaterialTree implements IRecipeWrapper { + private final static ImmutableList PREFIXES = ImmutableList.of( OrePrefix.dustTiny, OrePrefix.dust, @@ -45,8 +48,7 @@ public class MaterialTree implements IRecipeWrapper { OrePrefix.ring, // fluid, OrePrefix.lens, - OrePrefix.foil - ); + OrePrefix.foil); private final List> itemInputs = new ArrayList<>(); private final List> fluidInputs = new ArrayList<>(); diff --git a/src/main/java/gregtech/integration/jei/basic/MaterialTreeCategory.java b/src/main/java/gregtech/integration/jei/basic/MaterialTreeCategory.java index 625cfefb8ec..fc6ce4ff27c 100644 --- a/src/main/java/gregtech/integration/jei/basic/MaterialTreeCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/MaterialTreeCategory.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.basic; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.recipes.recipeproperties.TemperatureProperty; @@ -8,6 +7,13 @@ import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; import gregtech.integration.jei.utils.render.DrawableRegistry; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import com.google.common.collect.ImmutableList; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiFluidStackGroup; @@ -16,16 +22,13 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MaterialTreeCategory extends BasicRecipeCategory { protected String materialName; @@ -43,32 +46,32 @@ public class MaterialTreeCategory extends BasicRecipeCategory ITEM_LOCATIONS = ImmutableList.of( // corresponds pair-to-one with PREFIXES in MaterialTree.java - 4, 67, // dustTiny 0 + 4, 67, // dustTiny 0 4, 101, // dust 4, 135, // dustSmall 29, 55, // cableGtSingle 29, 85, // ingotHot - 29, 117, // ingot 5 + 29, 117, // ingot 5 29, 117, // gem 29, 147, // block 54, 55, // wireGtSingle 54, 85, // stick - 54, 117, // nugget 10 + 54, 117, // nugget 10 54, 147, // plate 79, 55, // wireFine 79, 85, // frameGt 79, 117, // round - 79, 147, // pipeNormalFluid 15 + 79, 147, // pipeNormalFluid 15 79, 147, // pipeNormalItem 104, 55, // screw 104, 85, // bolt 104, 117, // gear - 104, 147, // plateDouble 20 + 104, 147, // plateDouble 20 129, 55, // spring 129, 85, // stickLong 129, 117, // gearSmall 129, 147, // plateDense - 154, 55, // springSmall 25 + 154, 55, // springSmall 25 154, 78, // ring 154, 124, // lens 154, 147 // foil @@ -83,16 +86,18 @@ public MaterialTreeCategory(IGuiHelper guiHelper) { guiHelper.createBlankDrawable(176, 166), guiHelper); - this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18) + .build(); this.icon = guiHelper.createDrawableIngredient(OreDictUnifier.get(OrePrefix.ingot, Materials.Aluminium)); - /* couldn't think of a better way to register all these - generated with bash, requires imagemagick and sed - for file in ./*.png; do - dimstring=$(identify -ping -format '%w, %h' "$file") - basename "$file" .png | sed "s/\(.*\)/registerArrow(guiHelper, \"\1\", $dimstring);/" - done - */ + /* + * couldn't think of a better way to register all these + * generated with bash, requires imagemagick and sed + * for file in ./*.png; do + * dimstring=$(identify -ping -format '%w, %h' "$file") + * basename "$file" .png | sed "s/\(.*\)/registerArrow(guiHelper, \"\1\", $dimstring);/" + * done + */ registerArrow(guiHelper, "2d12", 5, 12); registerArrow(guiHelper, "2d16", 5, 16); registerArrow(guiHelper, "2r16d37", 18, 40); @@ -186,12 +191,12 @@ public void drawExtras(@Nonnull Minecraft minecraft) { drawArrow(minecraft, "2d16", 10, 85, itemExists.get(0) && itemExists.get(1)); // dust <-> dustSmall drawArrow(minecraft, "2d16", 10, 119, itemExists.get(1) && itemExists.get(2)); - // dust <-> block (if no ingot or gem) + // dust <-> block (if no ingot or gem) drawArrow(minecraft, "2r16d37", 22, 107, !itemExists.get(5) && !itemExists.get(6) && itemExists.get(1) && itemExists.get(7)); // dust -> ingotHot drawArrow(minecraft, "r3u15r4", 22, 92, itemExists.get(1) && itemExists.get(4)); - // dust -> ingot/gem (if no ingotHot) + // dust -> ingot/gem (if no ingotHot) drawArrow(minecraft, "r3d16r4", 22, 109, !itemExists.get(4) && itemExists.get(1) && (itemExists.get(5) || itemExists.get(6))); // ingotHot -> ingot @@ -273,7 +278,8 @@ public void drawExtras(@Nonnull Minecraft minecraft) { } // don't think theres a good way to get the coil tier other than this if (materialBFTemp != 0) { - TemperatureProperty.getInstance().drawInfo(minecraft, 0, FONT_HEIGHT * linesDrawn, 0x111111, materialBFTemp); + TemperatureProperty.getInstance().drawInfo(minecraft, 0, FONT_HEIGHT * linesDrawn, 0x111111, + materialBFTemp); linesDrawn++; } minecraft.fontRenderer.drawString(materialAvgM, 0, FONT_HEIGHT * linesDrawn, 0x111111); @@ -285,7 +291,8 @@ public void drawExtras(@Nonnull Minecraft minecraft) { // a couple wrappers to make the code look less terrible private static void registerArrow(IGuiHelper guiHelper, String name, int width, int height) { - DrawableRegistry.initDrawable(guiHelper, GTValues.MODID + ":textures/gui/arrows/" + name + ".png", width, height, name); + DrawableRegistry.initDrawable(guiHelper, GTValues.MODID + ":textures/gui/arrows/" + name + ".png", width, + height, name); } private static void drawArrow(Minecraft minecraft, String name, int x, int y, boolean shown) { diff --git a/src/main/java/gregtech/integration/jei/basic/OreByProduct.java b/src/main/java/gregtech/integration/jei/basic/OreByProduct.java index 27252a551f8..825747c51e6 100755 --- a/src/main/java/gregtech/integration/jei/basic/OreByProduct.java +++ b/src/main/java/gregtech/integration/jei/basic/OreByProduct.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.basic; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.recipes.chance.output.impl.ChancedItemOutput; import gregtech.api.unification.OreDictUnifier; @@ -11,17 +10,20 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; import gregtech.common.metatileentities.MetaTileEntities; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; -import mezz.jei.api.recipe.IRecipeWrapper; + import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; + +import com.google.common.collect.ImmutableList; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeWrapper; import org.apache.commons.lang3.tuple.Pair; import java.util.ArrayList; @@ -42,8 +44,7 @@ public static void addOreByProductPrefix(OrePrefix orePrefix) { OrePrefix.crushedPurified, OrePrefix.dustImpure, OrePrefix.dustPure, - OrePrefix.crushedCentrifuged - ); + OrePrefix.crushedCentrifuged); private static ImmutableList ALWAYS_MACHINES; @@ -67,14 +68,13 @@ public OreByProduct(Material material) { MetaTileEntities.THERMAL_CENTRIFUGE[GTValues.LV].getStackForm(), MetaTileEntities.MACERATOR[GTValues.LV].getStackForm(), MetaTileEntities.MACERATOR[GTValues.LV].getStackForm(), - MetaTileEntities.CENTRIFUGE[GTValues.LV].getStackForm() - ); + MetaTileEntities.CENTRIFUGE[GTValues.LV].getStackForm()); } OreProperty property = material.getProperty(PropertyKey.ORE); int oreMultiplier = property.getOreMultiplier(); int byproductMultiplier = property.getByProductMultiplier(); currentSlot = 0; - Material[] byproducts = new Material[]{ + Material[] byproducts = new Material[] { property.getOreByProduct(0, material), property.getOreByProduct(1, material), property.getOreByProduct(2, material), @@ -148,7 +148,8 @@ public OreByProduct(Material material) { // direct smelt if (hasDirectSmelt) { ItemStack smeltingResult; - Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : property.getDirectSmeltResult(); + Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : + property.getDirectSmeltResult(); if (smeltingMaterial.hasProperty(PropertyKey.INGOT)) { smeltingResult = OreDictUnifier.get(OrePrefix.ingot, smeltingMaterial); } else if (smeltingMaterial.hasProperty(PropertyKey.GEM)) { @@ -236,9 +237,11 @@ public OreByProduct(Material material) { // electromagnetic separator if (hasSeparator) { - OrePrefix prefix = (separatedInto.get(separatedInto.size() - 1).getBlastTemperature() == 0 && separatedInto.get(separatedInto.size() - 1).hasProperty(PropertyKey.INGOT)) - ? OrePrefix.nugget : OrePrefix.dust; - ItemStack separatedStack2 = OreDictUnifier.get(prefix, separatedInto.get(separatedInto.size() - 1), prefix == OrePrefix.nugget ? 2 : 1); + OrePrefix prefix = (separatedInto.get(separatedInto.size() - 1).getBlastTemperature() == 0 && + separatedInto.get(separatedInto.size() - 1).hasProperty(PropertyKey.INGOT)) ? OrePrefix.nugget : + OrePrefix.dust; + ItemStack separatedStack2 = OreDictUnifier.get(prefix, separatedInto.get(separatedInto.size() - 1), + prefix == OrePrefix.nugget ? 2 : 1); addToOutputs(material, OrePrefix.dust, 1); addToOutputs(separatedInto.get(0), OrePrefix.dust, 1); diff --git a/src/main/java/gregtech/integration/jei/basic/OreByProductCategory.java b/src/main/java/gregtech/integration/jei/basic/OreByProductCategory.java index eba115817cb..55daea56cbf 100644 --- a/src/main/java/gregtech/integration/jei/basic/OreByProductCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/OreByProductCategory.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.basic; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.unification.OreDictUnifier; @@ -8,6 +7,13 @@ import gregtech.api.unification.ore.OrePrefix; import gregtech.integration.jei.utils.render.FluidStackTextRenderer; import gregtech.integration.jei.utils.render.ItemStackTextRenderer; + +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; + +import com.google.common.collect.ImmutableList; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiFluidStackGroup; @@ -16,16 +22,13 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.client.Minecraft; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class OreByProductCategory extends BasicRecipeCategory { protected final IDrawable slot; @@ -97,8 +100,7 @@ public class OreByProductCategory extends BasicRecipeCategory FLUID_LOCATIONS = ImmutableList.of( 42, 25, // washer in @@ -111,17 +113,22 @@ public OreByProductCategory(IGuiHelper guiHelper) { guiHelper.createBlankDrawable(176, 166), guiHelper); - this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); - this.fluidSlot = guiHelper.drawableBuilder(GuiTextures.FLUID_SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18) + .build(); + this.fluidSlot = guiHelper.drawableBuilder(GuiTextures.FLUID_SLOT.imageLocation, 0, 0, 18, 18) + .setTextureSize(18, 18).build(); String baseloc = GTValues.MODID + ":textures/gui/arrows/"; this.arrowsBase = guiHelper.drawableBuilder(new ResourceLocation(baseloc + "oreby-base.png"), 0, 0, 176, 166) .setTextureSize(176, 166).build(); - this.arrowsDirectSmelt = guiHelper.drawableBuilder(new ResourceLocation(baseloc + "oreby-smelt.png"), 0, 0, 176, 166) + this.arrowsDirectSmelt = guiHelper + .drawableBuilder(new ResourceLocation(baseloc + "oreby-smelt.png"), 0, 0, 176, 166) .setTextureSize(176, 166).build(); - this.arrowsChemBath = guiHelper.drawableBuilder(new ResourceLocation(baseloc + "oreby-chem.png"), 0, 0, 176, 166) + this.arrowsChemBath = guiHelper + .drawableBuilder(new ResourceLocation(baseloc + "oreby-chem.png"), 0, 0, 176, 166) .setTextureSize(176, 166).build(); - this.arrowsSeparator = guiHelper.drawableBuilder(new ResourceLocation(baseloc + "oreby-sep.png"), 0, 0, 176, 166) + this.arrowsSeparator = guiHelper + .drawableBuilder(new ResourceLocation(baseloc + "oreby-sep.png"), 0, 0, 176, 166) .setTextureSize(176, 166).build(); this.arrowsSifter = guiHelper.drawableBuilder(new ResourceLocation(baseloc + "oreby-sift.png"), 0, 0, 176, 166) .setTextureSize(176, 166).build(); @@ -130,7 +137,8 @@ public OreByProductCategory(IGuiHelper guiHelper) { } @Override - public void setRecipe(IRecipeLayout recipeLayout, @Nonnull OreByProduct recipeWrapper, @Nonnull IIngredients ingredients) { + public void setRecipe(IRecipeLayout recipeLayout, @Nonnull OreByProduct recipeWrapper, + @Nonnull IIngredients ingredients) { IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks(); @@ -142,7 +150,8 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull OreByProduct recipeWr List> itemOutputs = ingredients.getOutputs(VanillaTypes.ITEM); itemOutputExists.clear(); for (int i = 0; i < ITEM_OUTPUT_LOCATIONS.size(); i += 2) { - itemStackGroup.init(i / 2 + itemInputs.size(), false, new ItemStackTextRenderer(recipeWrapper.getChance(i / 2 + itemInputs.size()), null), + itemStackGroup.init(i / 2 + itemInputs.size(), false, + new ItemStackTextRenderer(recipeWrapper.getChance(i / 2 + itemInputs.size()), null), ITEM_OUTPUT_LOCATIONS.get(i) + 1, ITEM_OUTPUT_LOCATIONS.get(i + 1) + 1, 16, 16, 0, 0); itemOutputExists.add(itemOutputs.get(i / 2).size() > 0); } @@ -189,7 +198,7 @@ public void drawExtras(@Nonnull Minecraft minecraft) { if (hasSeparator) { arrowsSeparator.draw(minecraft, 0, 0); } - if(hasSifter) { + if (hasSifter) { arrowsSifter.draw(minecraft, 0, 0); } @@ -209,5 +218,4 @@ public void drawExtras(@Nonnull Minecraft minecraft) { } } } - } diff --git a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java index 0a9c78030b0..17b6a86bd73 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java +++ b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java @@ -3,6 +3,9 @@ import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; + +import net.minecraft.client.resources.I18n; + import mezz.jei.api.IGuiHelper; import mezz.jei.api.IJeiHelpers; import mezz.jei.api.IModRegistry; @@ -11,13 +14,13 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.gui.recipes.RecipeLayout; -import net.minecraft.client.resources.I18n; -import javax.annotation.Nonnull; import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class MultiblockInfoCategory implements IRecipeCategory { private final IDrawable background; @@ -27,7 +30,8 @@ public class MultiblockInfoCategory implements IRecipeCategory REGISTER = new LinkedList<>(); @@ -37,7 +41,8 @@ public static void registerMultiblock(MultiblockControllerBase controllerBase) { } public static void registerRecipes(IModRegistry registry) { - registry.addRecipes(REGISTER.stream().map(MultiblockInfoRecipeWrapper::new).collect(Collectors.toList()), "gregtech:multiblock_info"); + registry.addRecipes(REGISTER.stream().map(MultiblockInfoRecipeWrapper::new).collect(Collectors.toList()), + "gregtech:multiblock_info"); } @Nonnull @@ -70,7 +75,8 @@ public IDrawable getIcon() { } @Override - public void setRecipe(@Nonnull IRecipeLayout recipeLayout, MultiblockInfoRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) { + public void setRecipe(@Nonnull IRecipeLayout recipeLayout, MultiblockInfoRecipeWrapper recipeWrapper, + @Nonnull IIngredients ingredients) { recipeWrapper.setRecipeLayout((RecipeLayout) recipeLayout, this.guiHelper); } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java index 5c4d692e4ef..ba9bcd92230 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java @@ -1,10 +1,5 @@ package gregtech.integration.jei.multiblock; -import codechicken.lib.render.BlockRenderer; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Translation; import gregtech.api.gui.GuiTextures; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; @@ -22,15 +17,7 @@ import gregtech.client.utils.RenderUtil; import gregtech.client.utils.TrackedDummyWorld; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiItemStackGroup; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.gui.recipes.RecipeLayout; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -56,15 +43,31 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.BlockRenderer; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Translation; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IGuiItemStackGroup; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeWrapper; +import mezz.jei.gui.recipes.RecipeLayout; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; -import javax.annotation.Nonnull; -import javax.vecmath.Vector3f; import java.util.*; import java.util.Map.Entry; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.vecmath.Vector3f; + public class MultiblockInfoRecipeWrapper implements IRecipeWrapper { private static final int MAX_PARTS = 18; @@ -75,11 +78,13 @@ public class MultiblockInfoRecipeWrapper implements IRecipeWrapper { private static final int RIGHT_PADDING = 5; private static class MBPattern { + final WorldSceneRenderer sceneRenderer; final List parts; final Map predicateMap; - public MBPattern(final WorldSceneRenderer sceneRenderer, final List parts, Map predicateMap) { + public MBPattern(final WorldSceneRenderer sceneRenderer, final List parts, + Map predicateMap) { this.sceneRenderer = sceneRenderer; this.parts = parts; this.predicateMap = predicateMap; @@ -125,7 +130,8 @@ public MultiblockInfoRecipeWrapper(@Nonnull MultiblockControllerBase controller) .toArray(MBPattern[]::new); allItemStackInputs.addAll(drops); this.nextLayerButton = new GuiButton(0, 176 - (ICON_SIZE + RIGHT_PADDING), 70, ICON_SIZE, ICON_SIZE, ""); - this.buttonPreviousPattern = new GuiButton(0, 176 - ((2 * ICON_SIZE) + RIGHT_PADDING + 1), 90, ICON_SIZE, ICON_SIZE, "<"); + this.buttonPreviousPattern = new GuiButton(0, 176 - ((2 * ICON_SIZE) + RIGHT_PADDING + 1), 90, ICON_SIZE, + ICON_SIZE, "<"); this.buttonNextPattern = new GuiButton(0, 176 - (ICON_SIZE + RIGHT_PADDING), 90, ICON_SIZE, ICON_SIZE, ">"); this.buttons.put(nextLayerButton, this::toggleNextLayer); this.buttons.put(buttonPreviousPattern, () -> switchRenderPage(-1)); @@ -147,8 +153,10 @@ public void getIngredients(IIngredients ingredients) { public void setRecipeLayout(RecipeLayout layout, IGuiHelper guiHelper) { this.recipeLayout = layout; - this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, SLOT_SIZE, SLOT_SIZE).setTextureSize(SLOT_SIZE, SLOT_SIZE).build(); - this.infoIcon = guiHelper.drawableBuilder(GuiTextures.INFO_ICON.imageLocation, 0, 0, ICON_SIZE, ICON_SIZE).setTextureSize(ICON_SIZE, ICON_SIZE).build(); + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, SLOT_SIZE, SLOT_SIZE) + .setTextureSize(SLOT_SIZE, SLOT_SIZE).build(); + this.infoIcon = guiHelper.drawableBuilder(GuiTextures.INFO_ICON.imageLocation, 0, 0, ICON_SIZE, ICON_SIZE) + .setTextureSize(ICON_SIZE, ICON_SIZE).build(); IDrawable border = layout.getRecipeCategory().getBackground(); preparePlaceForParts(border.getHeight()); @@ -195,8 +203,8 @@ private void toggleNextLayer() { WorldSceneRenderer renderer = getCurrentRenderer(); int height = (int) ((TrackedDummyWorld) renderer.world).getSize().getY() - 1; if (++this.layerIndex > height) { - //if current layer index is more than max height, reset it - //to display all layers + // if current layer index is more than max height, reset it + // to display all layers this.layerIndex = -1; } setNextLayer(layerIndex); @@ -215,7 +223,8 @@ private void setNextLayer(int newLayer) { if (newLayer == -1) { renderBlocks = world.renderedBlocks; } else { - renderBlocks = world.renderedBlocks.stream().filter(pos -> pos.getY() - minY == newLayer).collect(Collectors.toSet()); + renderBlocks = world.renderedBlocks.stream().filter(pos -> pos.getY() - minY == newLayer) + .collect(Collectors.toSet()); } renderer.addRenderedBlocks(renderBlocks, null); } @@ -237,7 +246,8 @@ private void switchRenderPage(int amount) { this.buttonPreviousPattern.enabled = newIndex > 0; setNextLayer(-1); updateParts(); - getCurrentRenderer().setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + getCurrentRenderer().setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); if (this.selected != null) { this.selected = null; for (int i = 0; i < predicates.size(); i++) { @@ -252,7 +262,9 @@ private void switchRenderPage(int amount) { private void preparePlaceForParts(int recipeHeight) { IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); for (int i = 0; i < MAX_PARTS; ++i) - itemStackGroup.init(i, true, SLOT_SIZE * i - (SLOT_SIZE * SLOTS_PER_ROW) * (i / SLOTS_PER_ROW) + (SLOT_SIZE / 2) - 2, recipeHeight - PARTS_HEIGHT + SLOT_SIZE * (i / SLOTS_PER_ROW)); + itemStackGroup.init(i, true, + SLOT_SIZE * i - (SLOT_SIZE * SLOTS_PER_ROW) * (i / SLOTS_PER_ROW) + (SLOT_SIZE / 2) - 2, + recipeHeight - PARTS_HEIGHT + SLOT_SIZE * (i / SLOTS_PER_ROW)); } private void updateParts() { @@ -272,22 +284,25 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe WorldSceneRenderer renderer = getCurrentRenderer(); int sceneHeight = recipeHeight - PARTS_HEIGHT; - renderer.render(recipeLayout.getPosX(), recipeLayout.getPosY(), recipeWidth, sceneHeight, mouseX + recipeLayout.getPosX(), mouseY + recipeLayout.getPosY()); + renderer.render(recipeLayout.getPosX(), recipeLayout.getPosY(), recipeWidth, sceneHeight, + mouseX + recipeLayout.getPosX(), mouseY + recipeLayout.getPosY()); drawMultiblockName(recipeWidth); - //reset colors (so any elements render after this point are not dark) + // reset colors (so any elements render after this point are not dark) GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - int iconX = recipeWidth - (ICON_SIZE + RIGHT_PADDING); int iconY = 49; this.infoIcon.draw(minecraft, iconX, iconY); - this.drawInfoIcon = iconX <= mouseX && mouseX <= iconX + ICON_SIZE && iconY <= mouseY && mouseY <= iconY + ICON_SIZE; + this.drawInfoIcon = iconX <= mouseX && mouseX <= iconX + ICON_SIZE && iconY <= mouseY && + mouseY <= iconY + ICON_SIZE; // draw parts slots for (int i = 0; i < MAX_PARTS; ++i) { - this.slot.draw(minecraft, SLOT_SIZE * i - (SLOTS_PER_ROW * SLOT_SIZE) * (i / SLOTS_PER_ROW) + (SLOT_SIZE / 2) - 2, sceneHeight + SLOT_SIZE * (i / SLOTS_PER_ROW)); + this.slot.draw(minecraft, + SLOT_SIZE * i - (SLOTS_PER_ROW * SLOT_SIZE) * (i / SLOTS_PER_ROW) + (SLOT_SIZE / 2) - 2, + sceneHeight + SLOT_SIZE * (i / SLOTS_PER_ROW)); } // draw candidates slots @@ -329,13 +344,17 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe renderer.setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); } - if (!(leftClickHeld || rightClickHeld) && rayTraceResult != null && !renderer.world.isAirBlock(rayTraceResult.getBlockPos())) { + if (!(leftClickHeld || rightClickHeld) && rayTraceResult != null && + !renderer.world.isAirBlock(rayTraceResult.getBlockPos())) { IBlockState blockState = renderer.world.getBlockState(rayTraceResult.getBlockPos()); - ItemStack itemStack = blockState.getBlock().getPickBlock(blockState, rayTraceResult, renderer.world, rayTraceResult.getBlockPos(), minecraft.player); - TraceabilityPredicate predicates = patterns[currentRendererPage].predicateMap.get(rayTraceResult.getBlockPos()); + ItemStack itemStack = blockState.getBlock().getPickBlock(blockState, rayTraceResult, renderer.world, + rayTraceResult.getBlockPos(), minecraft.player); + TraceabilityPredicate predicates = patterns[currentRendererPage].predicateMap + .get(rayTraceResult.getBlockPos()); if (predicates != null) { BlockWorldState worldState = new BlockWorldState(); - worldState.update(renderer.world, rayTraceResult.getBlockPos(), new PatternMatchContext(), new HashMap<>(), new HashMap<>(), predicates); + worldState.update(renderer.world, rayTraceResult.getBlockPos(), new PatternMatchContext(), + new HashMap<>(), new HashMap<>(), predicates); for (TraceabilityPredicate.SimplePredicate common : predicates.common) { if (common.test(worldState)) { predicateTips = common.getToolTips(predicates); @@ -370,7 +389,8 @@ private void drawMultiblockName(int recipeWidth) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; List lines = fontRenderer.listFormattedStringToWidth(localizedName, recipeWidth - 10); for (int i = 0; i < lines.size(); i++) { - fontRenderer.drawString(lines.get(i), (recipeWidth - fontRenderer.getStringWidth(lines.get(i))) / 2, fontRenderer.FONT_HEIGHT * i, ConfigHolder.client.multiblockPreviewFontColor); + fontRenderer.drawString(lines.get(i), (recipeWidth - fontRenderer.getStringWidth(lines.get(i))) / 2, + fontRenderer.FONT_HEIGHT * i, ConfigHolder.client.multiblockPreviewFontColor); } } @@ -418,7 +438,6 @@ public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, return false; } - private void setItemStackGroup() { IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); for (int i = 0; i < predicates.size(); i++) { @@ -437,10 +456,13 @@ private void setItemStackGroup() { @Override public List getTooltipStrings(int mouseX, int mouseY) { if (drawInfoIcon) { - return Arrays.asList(I18n.format("gregtech.multiblock.preview.zoom"), I18n.format("gregtech.multiblock.preview.rotate"), I18n.format("gregtech.multiblock.preview.select")); + return Arrays.asList(I18n.format("gregtech.multiblock.preview.zoom"), + I18n.format("gregtech.multiblock.preview.rotate"), + I18n.format("gregtech.multiblock.preview.select")); } else if (tooltipBlockStack != null && !tooltipBlockStack.isEmpty() && !Mouse.isButtonDown(0)) { Minecraft minecraft = Minecraft.getMinecraft(); - ITooltipFlag flag = minecraft.gameSettings.advancedItemTooltips ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL; + ITooltipFlag flag = minecraft.gameSettings.advancedItemTooltips ? TooltipFlags.ADVANCED : + TooltipFlags.NORMAL; List tooltip = tooltipBlockStack.getTooltip(minecraft.player, flag); EnumRarity rarity = tooltipBlockStack.getRarity(); for (int k = 0; k < tooltip.size(); ++k) { @@ -459,6 +481,7 @@ public List getTooltipStrings(int mouseX, int mouseY) { } private static class PartInfo { + final ItemStack itemStack; boolean isController = false; boolean isTile = false; @@ -487,8 +510,10 @@ ItemStack getItemStack() { } @Nonnull - private static Collection gatherStructureBlocks(World world, @Nonnull Map blocks, Set parts) { - Map partsMap = new Object2ObjectOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + private static Collection gatherStructureBlocks(World world, @Nonnull Map blocks, + Set parts) { + Map partsMap = new Object2ObjectOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); for (Entry entry : blocks.entrySet()) { BlockPos pos = entry.getKey(); IBlockState state = world.getBlockState(pos); @@ -518,7 +543,8 @@ private static Collection gatherStructureBlocks(World world, @Nonnull } if (stack.isEmpty()) { // if everything else doesn't work, try the not great getPickBlock() with some dummy values - stack = block.getPickBlock(state, new RayTraceResult(Vec3d.ZERO, EnumFacing.UP, pos), world, pos, new GregFakePlayer(world)); + stack = block.getPickBlock(state, new RayTraceResult(Vec3d.ZERO, EnumFacing.UP, pos), world, pos, + new GregFakePlayer(world)); } // if we got a stack, add it to the set and map @@ -547,8 +573,11 @@ private MBPattern initializePattern(@Nonnull MultiblockShapeInfo shapeInfo, @Non for (int y = 0; y < aisle.length; y++) { BlockInfo[] column = aisle[y]; for (int z = 0; z < column.length; z++) { - if (column[z].getTileEntity() instanceof IGregTechTileEntity && ((IGregTechTileEntity) column[z].getTileEntity()).getMetaTileEntity() instanceof MultiblockControllerBase) { - controllerBase = (MultiblockControllerBase) ((IGregTechTileEntity) column[z].getTileEntity()).getMetaTileEntity(); + if (column[z].getTileEntity() instanceof IGregTechTileEntity && + ((IGregTechTileEntity) column[z].getTileEntity()) + .getMetaTileEntity() instanceof MultiblockControllerBase) { + controllerBase = (MultiblockControllerBase) ((IGregTechTileEntity) column[z].getTileEntity()) + .getMetaTileEntity(); } blockMap.put(new BlockPos(x, y, z), column[z]); } @@ -568,7 +597,8 @@ private MBPattern initializePattern(@Nonnull MultiblockShapeInfo shapeInfo, @Non worldSceneRenderer.setOnLookingAt(ray -> {}); worldSceneRenderer.setAfterWorldRender(renderer -> { - BlockPos look = worldSceneRenderer.getLastTraceResult() == null ? null : worldSceneRenderer.getLastTraceResult().getBlockPos(); + BlockPos look = worldSceneRenderer.getLastTraceResult() == null ? null : + worldSceneRenderer.getLastTraceResult().getBlockPos(); if (look != null && look.equals(selected)) { renderBlockOverLay(selected, 200, 75, 75); return; @@ -577,7 +607,8 @@ private MBPattern initializePattern(@Nonnull MultiblockShapeInfo shapeInfo, @Non renderBlockOverLay(selected, 255, 0, 0); }); world.updateEntities(); - world.setRenderFilter(pos -> worldSceneRenderer.renderedBlocksMap.keySet().stream().anyMatch(c -> c.contains(pos))); + world.setRenderFilter( + pos -> worldSceneRenderer.renderedBlocksMap.keySet().stream().anyMatch(c -> c.contains(pos))); Map predicateMap = new HashMap<>(); if (controllerBase != null) { @@ -585,18 +616,20 @@ private MBPattern initializePattern(@Nonnull MultiblockShapeInfo shapeInfo, @Non controllerBase.reinitializeStructurePattern(); } if (controllerBase.structurePattern != null) { - controllerBase.structurePattern.cache.forEach((pos, blockInfo) -> predicateMap.put(BlockPos.fromLong(pos), (TraceabilityPredicate) blockInfo.getInfo())); + controllerBase.structurePattern.cache.forEach((pos, blockInfo) -> predicateMap + .put(BlockPos.fromLong(pos), (TraceabilityPredicate) blockInfo.getInfo())); } } - List sortedParts = gatherStructureBlocks(worldSceneRenderer.world, blockMap, parts).stream().sorted((one, two) -> { - if (one.isController) return -1; - if (two.isController) return +1; - if (one.isTile && !two.isTile) return -1; - if (two.isTile && !one.isTile) return +1; - if (one.blockId != two.blockId) return two.blockId - one.blockId; - return two.amount - one.amount; - }).map(PartInfo::getItemStack).collect(Collectors.toList()); + List sortedParts = gatherStructureBlocks(worldSceneRenderer.world, blockMap, parts).stream() + .sorted((one, two) -> { + if (one.isController) return -1; + if (two.isController) return +1; + if (one.isTile && !two.isTile) return -1; + if (two.isTile && !one.isTile) return +1; + if (one.blockId != two.blockId) return two.blockId - one.blockId; + return two.amount - one.amount; + }).map(PartInfo::getItemStack).collect(Collectors.toList()); return new MBPattern(worldSceneRenderer, sortedParts, predicateMap); } diff --git a/src/main/java/gregtech/integration/jei/recipe/FacadeRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/FacadeRecipeWrapper.java index e8fb73c5ff6..5f7ddbf7525 100644 --- a/src/main/java/gregtech/integration/jei/recipe/FacadeRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/FacadeRecipeWrapper.java @@ -1,12 +1,14 @@ package gregtech.integration.jei.recipe; -import com.google.common.collect.Lists; import gregtech.common.items.behaviors.FacadeItem; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +import com.google.common.collect.Lists; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; import javax.annotation.Nullable; diff --git a/src/main/java/gregtech/integration/jei/recipe/FacadeRegistryPlugin.java b/src/main/java/gregtech/integration/jei/recipe/FacadeRegistryPlugin.java index 52766ac5f74..93b160a1db0 100644 --- a/src/main/java/gregtech/integration/jei/recipe/FacadeRegistryPlugin.java +++ b/src/main/java/gregtech/integration/jei/recipe/FacadeRegistryPlugin.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.recipe; -import com.google.common.collect.Lists; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; @@ -9,14 +8,18 @@ import gregtech.common.covers.facade.FacadeHelper; import gregtech.common.items.MetaItems; import gregtech.common.items.behaviors.FacadeItem; + +import net.minecraft.item.ItemStack; + +import com.google.common.collect.Lists; import mezz.jei.api.recipe.*; import mezz.jei.api.recipe.IFocus.Mode; -import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + public class FacadeRegistryPlugin implements IRecipeRegistryPlugin { @Nonnull @@ -26,12 +29,12 @@ public List getRecipeCategoryUids(IFocus focus) { ItemStack itemStack = (ItemStack) focus.getValue(); if (focus.getMode() == Mode.OUTPUT) { if (MetaItems.COVER_FACADE.isItemEqual(itemStack)) { - //looking up recipes of facade cover + // looking up recipes of facade cover return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING); } } else if (focus.getMode() == Mode.INPUT) { if (FacadeHelper.isValidFacade(itemStack)) { - //looking up usage of block to make a facade cover + // looking up usage of block to make a facade cover return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING); } } @@ -41,7 +44,8 @@ public List getRecipeCategoryUids(IFocus focus) { @Nonnull @Override - public List getRecipeWrappers(IRecipeCategory recipeCategory, @Nonnull IFocus focus) { + public List getRecipeWrappers(IRecipeCategory recipeCategory, + @Nonnull IFocus focus) { if (!VanillaRecipeCategoryUid.CRAFTING.equals(recipeCategory.getUid())) { return Collections.emptyList(); } @@ -49,12 +53,12 @@ public List getRecipeWrappers(IRecipeCategory) createFacadeRecipes(itemStack); } } else if (focus.getMode() == Mode.INPUT) { if (FacadeHelper.isValidFacade(itemStack)) { - //looking up usage of block to make a facade cover + // looking up usage of block to make a facade cover ItemStack coverStack = MetaItems.COVER_FACADE.getStackForm(); FacadeItem.setFacadeStack(coverStack, itemStack); return (List) createFacadeRecipes(coverStack); diff --git a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java index 130d4e76176..01334a9651f 100644 --- a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java @@ -28,20 +28,23 @@ import gregtech.integration.RecipeCompatUtil; import gregtech.integration.jei.utils.AdvancedRecipeWrapper; import gregtech.integration.jei.utils.JeiButton; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; + import java.util.*; import java.util.function.BooleanSupplier; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class GTRecipeWrapper extends AdvancedRecipeWrapper { private static final int LINE_HEIGHT = 10; @@ -68,7 +71,6 @@ public Recipe getRecipe() { @Override public void getIngredients(@Nonnull IIngredients ingredients) { - // Inputs if (!sortedInputs.isEmpty()) { List> list = new ArrayList<>(); @@ -107,7 +109,8 @@ public void getIngredients(@Nonnull IIngredients ingredients) { if (researchId != null) break; } if (researchId != null) { - Collection possibleRecipes = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES).getDataStickEntry(researchId); + Collection possibleRecipes = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES) + .getDataStickEntry(researchId); if (possibleRecipes != null) { for (Recipe r : possibleRecipes) { ItemStack researchItem = r.getOutputs().get(0); @@ -145,7 +148,8 @@ public void getIngredients(@Nonnull IIngredients ingredients) { .map(FluidStack::copy) .collect(Collectors.toList()); - List chancedOutputs = new ArrayList<>(recipe.getChancedFluidOutputs().getChancedEntries()); + List chancedOutputs = new ArrayList<>( + recipe.getChancedFluidOutputs().getChancedEntries()); for (ChancedFluidOutput chancedEntry : chancedOutputs) { recipeOutputs.add(chancedEntry.getIngredient()); } @@ -162,7 +166,8 @@ public void addItemTooltip(int slotIndex, boolean input, Object ingredient, List if (!recipe.getChancedOutputs().getChancedEntries().isEmpty()) { int outputIndex = slotIndex - recipeMap.getMaxInputs(); if (outputIndex >= recipe.getOutputs().size()) { - entry = recipe.getChancedOutputs().getChancedEntries().get(outputIndex - recipe.getOutputs().size()); + entry = recipe.getChancedOutputs().getChancedEntries() + .get(outputIndex - recipe.getOutputs().size()); } } } @@ -181,17 +186,20 @@ public void addFluidTooltip(int slotIndex, boolean input, Object ingredient, Lis if (!recipe.getChancedFluidOutputs().getChancedEntries().isEmpty()) { int outputIndex = slotIndex - recipeMap.getMaxFluidInputs(); if (outputIndex >= recipe.getFluidOutputs().size()) { - entry = recipe.getChancedFluidOutputs().getChancedEntries().get(outputIndex - recipe.getFluidOutputs().size()); + entry = recipe.getChancedFluidOutputs().getChancedEntries() + .get(outputIndex - recipe.getFluidOutputs().size()); } } - addIngredientTooltips(tooltip, notConsumed, input, entry, recipe.getChancedFluidOutputs().getChancedOutputLogic()); + addIngredientTooltips(tooltip, notConsumed, input, entry, + recipe.getChancedFluidOutputs().getChancedOutputLogic()); addIngredientTooltips(tooltip, notConsumed, input, ingredient, null); } - public void addIngredientTooltips(@Nonnull Collection tooltip, boolean notConsumed, boolean input, @Nullable Object ingredient, @Nullable Object ingredient2) { + public void addIngredientTooltips(@Nonnull Collection tooltip, boolean notConsumed, boolean input, + @Nullable Object ingredient, @Nullable Object ingredient2) { if (ingredient2 instanceof ChancedOutputLogic logic) { - if (ingredient instanceof BoostableChanceEntry entry) { + if (ingredient instanceof BoostableChanceEntryentry) { double chance = entry.getChance() / 100.0; double boost = entry.getChanceBoost() / 100.0; if (logic != ChancedOutputLogic.NONE && logic != ChancedOutputLogic.OR) { @@ -206,11 +214,12 @@ public void addIngredientTooltips(@Nonnull Collection tooltip, boolean n tooltip.add(TooltipHelper.BLINKING_CYAN + I18n.format("gregtech.recipe.not_consumed")); } - if (!input && this.recipeMap instanceof IScannerRecipeMap && ingredient instanceof ItemStack stack && !stack.isEmpty()) { + if (!input && this.recipeMap instanceof IScannerRecipeMap && ingredient instanceof ItemStack stack && + !stack.isEmpty()) { // check for "normal" data items if (stack.getItem() instanceof IDataItem) return; // check for metaitem data items - if (stack.getItem() instanceof MetaItem metaItem) { + if (stack.getItem() instanceof MetaItemmetaItem) { for (IItemBehaviour behaviour : metaItem.getBehaviours(stack)) { if (behaviour instanceof IDataItem) { return; @@ -243,18 +252,26 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe if (drawTotalEU) { long eu = Math.abs((long) recipe.getEUt()) * recipe.getDuration(); // sadly we still need a custom override here, since computation uses duration and EU/t very differently - if (recipe.hasProperty(TotalComputationProperty.getInstance()) && recipe.hasProperty(ComputationProperty.getInstance())) { + if (recipe.hasProperty(TotalComputationProperty.getInstance()) && + recipe.hasProperty(ComputationProperty.getInstance())) { int minimumCWUt = recipe.getProperty(ComputationProperty.getInstance(), 1); - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.max_eu", eu / minimumCWUt), 0, yPosition, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.max_eu", eu / minimumCWUt), 0, yPosition, + 0x111111); } else { minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.total", eu), 0, yPosition, 0x111111); } } if (drawEUt) { - minecraft.fontRenderer.drawString(I18n.format(recipe.getEUt() >= 0 ? "gregtech.recipe.eu" : "gregtech.recipe.eu_inverted", Math.abs(recipe.getEUt()), GTValues.VN[GTUtility.getTierByVoltage(recipe.getEUt())]), 0, yPosition += LINE_HEIGHT, 0x111111); + minecraft.fontRenderer.drawString( + I18n.format(recipe.getEUt() >= 0 ? "gregtech.recipe.eu" : "gregtech.recipe.eu_inverted", + Math.abs(recipe.getEUt()), GTValues.VN[GTUtility.getTierByVoltage(recipe.getEUt())]), + 0, yPosition += LINE_HEIGHT, 0x111111); } if (drawDuration) { - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.duration", TextFormattingUtil.formatNumbers(recipe.getDuration() / 20d)), 0, yPosition += LINE_HEIGHT, 0x111111); + minecraft.fontRenderer.drawString( + I18n.format("gregtech.recipe.duration", + TextFormattingUtil.formatNumbers(recipe.getDuration() / 20d)), + 0, yPosition += LINE_HEIGHT, 0x111111); } // Property custom entries @@ -262,7 +279,8 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe if (!propertyEntry.getKey().isHidden()) { RecipeProperty property = propertyEntry.getKey(); Object value = propertyEntry.getValue(); - property.drawInfo(minecraft, 0, yPosition += property.getInfoHeight(value), 0x111111, value, mouseX, mouseY); + property.drawInfo(minecraft, 0, yPosition += property.getInfoHeight(value), 0x111111, value, mouseX, + mouseY); } } } @@ -286,10 +304,12 @@ public void initExtras() { // do not add the X button if no tweaker mod is present if (!RecipeCompatUtil.isTweakerLoaded()) return; - BooleanSupplier creativePlayerCtPredicate = () -> Minecraft.getMinecraft().player != null && Minecraft.getMinecraft().player.isCreative(); + BooleanSupplier creativePlayerCtPredicate = () -> Minecraft.getMinecraft().player != null && + Minecraft.getMinecraft().player.isCreative(); buttons.add(new JeiButton(166, 2, 10, 10) .setTextures(GuiTextures.BUTTON_CLEAR_GRID) - .setTooltipBuilder(lines -> lines.add("Copies a " + RecipeCompatUtil.getTweakerName() + " script, to remove this recipe, to the clipboard")) + .setTooltipBuilder(lines -> lines.add("Copies a " + RecipeCompatUtil.getTweakerName() + + " script, to remove this recipe, to the clipboard")) .setClickAction((minecraft, mouseX, mouseY, mouseButton) -> { String recipeLine = RecipeCompatUtil.getRecipeRemoveLine(recipeMap, recipe); String output = RecipeCompatUtil.getFirstOutputString(recipe); @@ -298,7 +318,8 @@ public void initExtras() { } String copyString = output + recipeLine + "\n"; ClipboardUtil.copyToClipboard(copyString); - Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Copied [\u00A76" + recipeLine + "\u00A7r] to the clipboard")); + Minecraft.getMinecraft().player.sendMessage( + new TextComponentString("Copied [\u00A76" + recipeLine + "\u00A7r] to the clipboard")); return true; }) .setActiveSupplier(creativePlayerCtPredicate)); diff --git a/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java b/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java index a27546c7cb2..db33a9801ec 100644 --- a/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java +++ b/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java @@ -1,7 +1,5 @@ package gregtech.integration.jei.recipe; -import com.google.common.base.Suppliers; -import com.google.common.collect.Iterators; import gregtech.api.GTValues; import gregtech.api.recipes.ingredients.IntCircuitIngredient; import gregtech.api.util.GTUtility; @@ -9,15 +7,7 @@ import gregtech.integration.jei.JustEnoughItemsModule; import gregtech.integration.jei.utils.render.CompositeDrawable; import gregtech.integration.jei.utils.render.CompositeRenderer; -import mcp.MethodsReturnNonnullByDefault; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiItemStackGroup; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.ingredients.IIngredientRenderer; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; -import mezz.jei.api.recipe.IRecipeCategory; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.BufferBuilder; @@ -27,16 +17,29 @@ import net.minecraft.client.resources.I18n; import net.minecraft.client.shader.Framebuffer; import net.minecraft.item.ItemStack; + +import com.google.common.base.Suppliers; +import com.google.common.collect.Iterators; +import mcp.MethodsReturnNonnullByDefault; +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IGuiItemStackGroup; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.ingredients.IIngredientRenderer; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeCategory; import org.lwjgl.opengl.GL11; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Iterator; import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.Stream; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class IntCircuitCategory implements IRecipeCategory { @@ -51,18 +54,18 @@ public class IntCircuitCategory implements IRecipeCategory> otherItemRenderer = - Suppliers.memoize(() -> { - IIngredientRenderer defaultRenderer = JustEnoughItemsModule.ingredientRegistry.getIngredientRenderer(VanillaTypes.ITEM); - return CompositeRenderer.startBuilder(defaultRenderer) - .then(IntCircuitCategory::slice) - .then(defaultRenderer::render) - .then(() -> GL11.glDisable(GL11.GL_STENCIL_TEST)) - .build(); - }); - - private final Supplier> firstItemRenderer = - Suppliers.memoize(() -> CompositeRenderer.startBuilder(otherItemRenderer.get()) + private final Supplier> otherItemRenderer = Suppliers.memoize(() -> { + IIngredientRenderer defaultRenderer = JustEnoughItemsModule.ingredientRegistry + .getIngredientRenderer(VanillaTypes.ITEM); + return CompositeRenderer.startBuilder(defaultRenderer) + .then(IntCircuitCategory::slice) + .then(defaultRenderer::render) + .then(() -> GL11.glDisable(GL11.GL_STENCIL_TEST)) + .build(); + }); + + private final Supplier> firstItemRenderer = Suppliers + .memoize(() -> CompositeRenderer.startBuilder(otherItemRenderer.get()) .then(GlStateManager::pushMatrix) .then((minecraft, xPosition, yPosition, ingredient) -> { if (xPosition * yPosition != 0) @@ -84,11 +87,12 @@ public IntCircuitCategory(IGuiHelper guiHelper) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; slotBase = CompositeDrawable.startBuilder(SLOT_SIZE, SLOT_SIZE) - .then(guiHelper.drawableBuilder(GTUtility.gregtechId("textures/gui/base/slot.png"), 0, 0, SLOT_SIZE, SLOT_SIZE) + .then(guiHelper + .drawableBuilder(GTUtility.gregtechId("textures/gui/base/slot.png"), 0, 0, SLOT_SIZE, SLOT_SIZE) .setTextureSize(SLOT_SIZE, SLOT_SIZE) .build()::draw) - .then((minecraft, xOffset, yOffset) -> - fontRenderer.drawString(counter.next().toString(), xOffset + 1, yOffset + 1, 0x555555)) + .then((minecraft, xOffset, yOffset) -> fontRenderer.drawString(counter.next().toString(), xOffset + 1, + yOffset + 1, 0x555555)) .build(); scaledSlot = CompositeDrawable.startBuilder(SLOT_SIZE * FIRST_SLOT_SCALE, SLOT_SIZE * FIRST_SLOT_SCALE) @@ -130,25 +134,24 @@ public IDrawable getIcon() { } private static final int shortenedRowLength = ROW_LENGTH - FIRST_SLOT_SCALE; - private static final int[][] positions = - Stream.concat( - IntStream.range(0, shortenedRowLength * FIRST_SLOT_SCALE) - .mapToObj(i -> new int[]{ - SLOT_SIZE * FIRST_SLOT_SCALE + SLOT_SIZE * (i % shortenedRowLength), - SLOT_SIZE * (i / shortenedRowLength) - }), - IntStream.range(0, IntCircuitIngredient.CIRCUIT_MAX - (shortenedRowLength * FIRST_SLOT_SCALE)) - .mapToObj(i -> new int[]{ - SLOT_SIZE * (i % ROW_LENGTH), - SLOT_SIZE * FIRST_SLOT_SCALE + SLOT_SIZE * (i / ROW_LENGTH) - }) - ) - .toArray(int[][]::new); + private static final int[][] positions = Stream.concat( + IntStream.range(0, shortenedRowLength * FIRST_SLOT_SCALE) + .mapToObj(i -> new int[] { + SLOT_SIZE * FIRST_SLOT_SCALE + SLOT_SIZE * (i % shortenedRowLength), + SLOT_SIZE * (i / shortenedRowLength) + }), + IntStream.range(0, IntCircuitIngredient.CIRCUIT_MAX - (shortenedRowLength * FIRST_SLOT_SCALE)) + .mapToObj(i -> new int[] { + SLOT_SIZE * (i % ROW_LENGTH), + SLOT_SIZE * FIRST_SLOT_SCALE + SLOT_SIZE * (i / ROW_LENGTH) + })) + .toArray(int[][]::new); @Override public void setRecipe(IRecipeLayout recipeLayout, IntCircuitRecipeWrapper recipeWrapper, IIngredients ingredients) { IGuiItemStackGroup stacks = recipeLayout.getItemStacks(); - stacks.init(0, recipeWrapper.input, firstItemRenderer.get(), 0, 0, SLOT_SIZE * FIRST_SLOT_SCALE, SLOT_SIZE * FIRST_SLOT_SCALE, FIRST_SLOT_SCALE, FIRST_SLOT_SCALE); + stacks.init(0, recipeWrapper.input, firstItemRenderer.get(), 0, 0, SLOT_SIZE * FIRST_SLOT_SCALE, + SLOT_SIZE * FIRST_SLOT_SCALE, FIRST_SLOT_SCALE, FIRST_SLOT_SCALE); stacks.setBackground(0, scaledSlot); for (int i = 0; i < positions.length; i++) { stacks.init(i + 1, @@ -159,8 +162,7 @@ public void setRecipe(IRecipeLayout recipeLayout, IntCircuitRecipeWrapper recipe SLOT_SIZE, SLOT_SIZE, 1, - 1 - ); + 1); stacks.setBackground(i + 1, slotBase); } stacks.set(ingredients); @@ -205,5 +207,4 @@ private static void slice(Minecraft minecraft, int xPosition, int yPosition, @Nu GL11.glStencilFunc(GL11.GL_EQUAL, val, mask); } - } diff --git a/src/main/java/gregtech/integration/jei/recipe/IntCircuitRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/IntCircuitRecipeWrapper.java index 7a5cb39df3d..ef2a02685ea 100644 --- a/src/main/java/gregtech/integration/jei/recipe/IntCircuitRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/IntCircuitRecipeWrapper.java @@ -1,18 +1,21 @@ package gregtech.integration.jei.recipe; -import com.google.common.collect.ImmutableList; import gregtech.api.recipes.ingredients.IntCircuitIngredient; + +import net.minecraft.item.ItemStack; + +import com.google.common.collect.ImmutableList; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.item.ItemStack; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault public class IntCircuitRecipeWrapper implements IRecipeWrapper { @@ -25,8 +28,7 @@ private IntCircuitRecipeWrapper(boolean input) { public static Collection create() { return ImmutableList.of( new IntCircuitRecipeWrapper(true), - new IntCircuitRecipeWrapper(false) - ); + new IntCircuitRecipeWrapper(false)); } @Override diff --git a/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java b/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java index 11657044667..2104bf474aa 100644 --- a/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java +++ b/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java @@ -21,6 +21,14 @@ import gregtech.integration.jei.JustEnoughItemsModule; import gregtech.integration.jei.utils.render.FluidStackTextRenderer; import gregtech.integration.jei.utils.render.ItemStackTextRenderer; + +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTank; +import net.minecraftforge.items.ItemStackHandler; +import net.minecraftforge.items.SlotItemHandler; + import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; @@ -30,20 +38,15 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeCategory; -import net.minecraft.client.Minecraft; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.items.ItemStackHandler; -import net.minecraftforge.items.SlotItemHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class RecipeMapCategory implements IRecipeCategory { private final RecipeMap recipeMap; @@ -58,7 +61,8 @@ public class RecipeMapCategory implements IRecipeCategory { private static final Map gtCategories = new Object2ObjectOpenHashMap<>(); private static final Map, List> recipeMapCategories = new Object2ObjectOpenHashMap<>(); - public RecipeMapCategory(@Nonnull RecipeMap recipeMap, @Nonnull GTRecipeCategory category, IGuiHelper guiHelper) { + public RecipeMapCategory(@Nonnull RecipeMap recipeMap, @Nonnull GTRecipeCategory category, + IGuiHelper guiHelper) { this.recipeMap = recipeMap; this.category = category; FluidTank[] importFluidTanks = new FluidTank[recipeMap.getMaxFluidInputs()]; @@ -68,13 +72,15 @@ public RecipeMapCategory(@Nonnull RecipeMap recipeMap, @Nonnull GTRecipeCateg for (int i = 0; i < exportFluidTanks.length; i++) exportFluidTanks[i] = new FluidTank(16000); this.modularUI = recipeMap.createJeiUITemplate( - (importItems = new ItemStackHandler(recipeMap.getMaxInputs() + (recipeMap == RecipeMaps.ASSEMBLY_LINE_RECIPES ? 1 : 0))), + (importItems = new ItemStackHandler( + recipeMap.getMaxInputs() + (recipeMap == RecipeMaps.ASSEMBLY_LINE_RECIPES ? 1 : 0))), (exportItems = new ItemStackHandler(recipeMap.getMaxOutputs())), (importFluids = new FluidTankList(false, importFluidTanks)), - (exportFluids = new FluidTankList(false, exportFluidTanks)), 0 - ).build(new BlankUIHolder(), Minecraft.getMinecraft().player); + (exportFluids = new FluidTankList(false, exportFluidTanks)), 0) + .build(new BlankUIHolder(), Minecraft.getMinecraft().player); this.modularUI.initWidgets(); - this.backgroundDrawable = guiHelper.createBlankDrawable(modularUI.getWidth(), modularUI.getHeight() * 2 / 3 + recipeMap.getPropertyHeightShift()); + this.backgroundDrawable = guiHelper.createBlankDrawable(modularUI.getWidth(), + modularUI.getHeight() * 2 / 3 + recipeMap.getPropertyHeightShift()); gtCategories.put(category, this); recipeMapCategories.compute(recipeMap, (k, v) -> { if (v == null) v = new ArrayList<>(); @@ -129,7 +135,8 @@ public IDrawable getBackground() { } @Override - public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) { + public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recipeWrapper, + @Nonnull IIngredients ingredients) { IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks(); for (Widget uiWidget : modularUI.guiWidgets.values()) { @@ -141,7 +148,7 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip } SlotItemHandler handle = (SlotItemHandler) slotWidget.getHandle(); if (handle.getItemHandler() == importItems) { - //this is input item stack slot widget, so add it to item group + // this is input item stack slot widget, so add it to item group itemStackGroup.init(handle.getSlotIndex(), true, new ItemStackTextRenderer(recipeWrapper.isNotConsumedItem(handle.getSlotIndex())), slotWidget.getPosition().x + 1, @@ -149,9 +156,11 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip slotWidget.getSize().width - 2, slotWidget.getSize().height - 2, 0, 0); } else if (handle.getItemHandler() == exportItems) { - //this is output item stack slot widget, so add it to item group + // this is output item stack slot widget, so add it to item group itemStackGroup.init(importItems.getSlots() + handle.getSlotIndex(), false, - new ItemStackTextRenderer(recipeWrapper.getOutputChance(handle.getSlotIndex() - recipeWrapper.getRecipe().getOutputs().size()), + new ItemStackTextRenderer( + recipeWrapper.getOutputChance( + handle.getSlotIndex() - recipeWrapper.getRecipe().getOutputs().size()), recipeWrapper.getChancedOutputLogic()), slotWidget.getPosition().x + 1, slotWidget.getPosition().y + 1, @@ -166,12 +175,12 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip int fluidAmount = 0; if (inputsList.size() > importIndex && !inputsList.get(importIndex).isEmpty()) fluidAmount = inputsList.get(importIndex).get(0).amount; - //this is input tank widget, so add it to fluid group + // this is input tank widget, so add it to fluid group fluidStackGroup.init(importIndex, true, new FluidStackTextRenderer(fluidAmount, false, tankWidget.getSize().width - (2 * tankWidget.fluidRenderOffset), tankWidget.getSize().height - (2 * tankWidget.fluidRenderOffset), null) - .setNotConsumed(recipeWrapper.isNotConsumedFluid(importIndex)), + .setNotConsumed(recipeWrapper.isNotConsumedFluid(importIndex)), tankWidget.getPosition().x + tankWidget.fluidRenderOffset, tankWidget.getPosition().y + tankWidget.fluidRenderOffset, tankWidget.getSize().width - (2 * tankWidget.fluidRenderOffset), @@ -183,12 +192,13 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip int fluidAmount = 0; if (inputsList.size() > exportIndex && !inputsList.get(exportIndex).isEmpty()) fluidAmount = inputsList.get(exportIndex).get(0).amount; - //this is output tank widget, so add it to fluid group + // this is output tank widget, so add it to fluid group fluidStackGroup.init(importFluids.getFluidTanks().size() + exportIndex, false, new FluidStackTextRenderer(fluidAmount, false, tankWidget.getSize().width - (2 * tankWidget.fluidRenderOffset), tankWidget.getSize().height - (2 * tankWidget.fluidRenderOffset), null, - recipeWrapper.getFluidOutputChance(exportIndex - recipeWrapper.getRecipe().getFluidOutputs().size()), + recipeWrapper.getFluidOutputChance( + exportIndex - recipeWrapper.getRecipe().getFluidOutputs().size()), recipeWrapper.getChancedFluidOutputLogic()), tankWidget.getPosition().x + tankWidget.fluidRenderOffset, tankWidget.getPosition().y + tankWidget.fluidRenderOffset, @@ -205,7 +215,8 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip List dataItems = new ArrayList<>(); for (ResearchPropertyData.ResearchEntry entry : data) { ItemStack dataStick = entry.getDataItem().copy(); - AssemblyLineManager.writeResearchToNBT(GTUtility.getOrCreateNbtCompound(dataStick), entry.getResearchId()); + AssemblyLineManager.writeResearchToNBT(GTUtility.getOrCreateNbtCompound(dataStick), + entry.getResearchId()); dataItems.add(dataStick); } itemStackGroup.set(16, dataItems); @@ -222,8 +233,7 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip public void drawExtras(@Nonnull Minecraft minecraft) { for (Widget widget : modularUI.guiWidgets.values()) { if (widget instanceof ProgressWidget) widget.detectAndSendChanges(); - widget.drawInBackground(0, 0, minecraft.getRenderPartialTicks(), new IRenderContext() { - }); + widget.drawInBackground(0, 0, minecraft.getRenderPartialTicks(), new IRenderContext() {}); widget.drawInForeground(0, 0); } } diff --git a/src/main/java/gregtech/integration/jei/utils/AdvancedRecipeWrapper.java b/src/main/java/gregtech/integration/jei/utils/AdvancedRecipeWrapper.java index b0252407f05..9b8b15b3068 100644 --- a/src/main/java/gregtech/integration/jei/utils/AdvancedRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/utils/AdvancedRecipeWrapper.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.utils; -import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.renderer.GlStateManager; @@ -8,10 +7,13 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; -import javax.annotation.Nonnull; +import mezz.jei.api.recipe.IRecipeWrapper; + import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + public abstract class AdvancedRecipeWrapper implements IRecipeWrapper { protected final List buttons = new ArrayList<>(); @@ -45,8 +47,10 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe @Override public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) { for (JeiButton button : buttons) { - if (button.isHovering(mouseX, mouseY) && button.getClickAction().click(minecraft, mouseX, mouseY, mouseButton)) { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + if (button.isHovering(mouseX, mouseY) && + button.getClickAction().click(minecraft, mouseX, mouseY, mouseButton)) { + Minecraft.getMinecraft().getSoundHandler() + .playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); return true; } } diff --git a/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java b/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java index 986ff5bc6b5..7778af062bb 100644 --- a/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java +++ b/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java @@ -2,12 +2,7 @@ import gregtech.api.util.GTLog; import gregtech.api.worldgen.config.OreDepositDefinition; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import it.unimi.dsi.fastutil.ints.IntSortedSet; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.resources.I18n; @@ -17,7 +12,13 @@ import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.common.Loader; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.ints.IntSortedSet; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -25,6 +26,8 @@ import java.util.function.Function; import java.util.function.Predicate; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.MODID_AR; /** @@ -34,7 +37,8 @@ public class JEIResourceDepositCategoryUtils { /** - * Creates a list of biomes whose weight, as described by the passed Function, differs from the passed original weight + * Creates a list of biomes whose weight, as described by the passed Function, differs from the passed original + * weight * For use in the JEI Ore Spawn Page and JEI Fluid Spawn Page * * @param biomeFunction A Function describing the modified weights of biomes @@ -117,7 +121,7 @@ public static void drawMultiLineCommaSeparatedDimensionList(Int2ObjectMap lines) { } public boolean isHovering(int mouseX, int mouseY) { - return mouseX >= x && mouseY >= y && mouseX <= x + width && mouseY <= y + height && activeSupplier.getAsBoolean(); + return mouseX >= x && mouseY >= y && mouseX <= x + width && mouseY <= y + height && + activeSupplier.getAsBoolean(); } public void render(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { @@ -69,6 +71,7 @@ public ClickAction getClickAction() { @FunctionalInterface public interface ClickAction { + boolean click(Minecraft minecraft, int mouseX, int mouseY, int mouseButton); } } diff --git a/src/main/java/gregtech/integration/jei/utils/MachineSubtypeHandler.java b/src/main/java/gregtech/integration/jei/utils/MachineSubtypeHandler.java index 65ddc845d22..1ed37c488d0 100644 --- a/src/main/java/gregtech/integration/jei/utils/MachineSubtypeHandler.java +++ b/src/main/java/gregtech/integration/jei/utils/MachineSubtypeHandler.java @@ -2,12 +2,15 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GTUtility; -import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter; + import net.minecraft.item.ItemStack; +import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter; + import javax.annotation.Nonnull; public class MachineSubtypeHandler implements ISubtypeInterpreter { + @Nonnull @Override public String apply(@Nonnull ItemStack itemStack) { diff --git a/src/main/java/gregtech/integration/jei/utils/MetaItemSubtypeHandler.java b/src/main/java/gregtech/integration/jei/utils/MetaItemSubtypeHandler.java index c683566ffd1..4d453ed6c48 100644 --- a/src/main/java/gregtech/integration/jei/utils/MetaItemSubtypeHandler.java +++ b/src/main/java/gregtech/integration/jei/utils/MetaItemSubtypeHandler.java @@ -2,12 +2,15 @@ import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.MetaItem.MetaValueItem; -import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter; + import net.minecraft.item.ItemStack; +import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter; + import javax.annotation.Nonnull; public class MetaItemSubtypeHandler implements ISubtypeInterpreter { + @Nonnull @Override public String apply(ItemStack itemStack) { diff --git a/src/main/java/gregtech/integration/jei/utils/ModularUIGuiHandler.java b/src/main/java/gregtech/integration/jei/utils/ModularUIGuiHandler.java index 92529b57052..cd6af9d2d17 100644 --- a/src/main/java/gregtech/integration/jei/utils/ModularUIGuiHandler.java +++ b/src/main/java/gregtech/integration/jei/utils/ModularUIGuiHandler.java @@ -6,6 +6,9 @@ import gregtech.api.gui.ingredient.IGhostIngredientTarget; import gregtech.api.gui.ingredient.IIngredientSlot; import gregtech.api.gui.ingredient.IRecipeTransferHandlerWidget; + +import net.minecraft.entity.player.EntityPlayer; + import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import mezz.jei.api.gui.IAdvancedGuiHandler; import mezz.jei.api.gui.IGhostIngredientHandler; @@ -13,16 +16,17 @@ import mezz.jei.api.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; import mezz.jei.api.recipe.transfer.IRecipeTransferHandlerHelper; -import net.minecraft.entity.player.EntityPlayer; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.awt.*; -import java.util.List; import java.util.*; +import java.util.List; import java.util.function.Predicate; -public class ModularUIGuiHandler implements IAdvancedGuiHandler, IGhostIngredientHandler, IRecipeTransferHandler { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class ModularUIGuiHandler implements IAdvancedGuiHandler, IGhostIngredientHandler, + IRecipeTransferHandler { private final IRecipeTransferHandlerHelper transferHelper; private Predicate validHandlers = widget -> true; @@ -50,7 +54,9 @@ public Class getContainerClass() { @Nullable @Override - public IRecipeTransferError transferRecipe(@Nonnull ModularUIContainer container, @Nonnull IRecipeLayout recipeLayout, @Nonnull EntityPlayer player, boolean maxTransfer, boolean doTransfer) { + public IRecipeTransferError transferRecipe(@Nonnull ModularUIContainer container, + @Nonnull IRecipeLayout recipeLayout, @Nonnull EntityPlayer player, + boolean maxTransfer, boolean doTransfer) { if (this.recipeTransferCategoryBlacklist.contains(recipeLayout.getRecipeCategory().getUid())) { return this.transferHelper.createInternalError(); } @@ -63,7 +69,8 @@ public IRecipeTransferError transferRecipe(@Nonnull ModularUIContainer container if (!transferHandler.isPresent()) { return transferHelper.createInternalError(); } - String errorTooltip = transferHandler.get().transferRecipe(container, recipeLayout, player, maxTransfer, doTransfer); + String errorTooltip = transferHandler.get().transferRecipe(container, recipeLayout, player, maxTransfer, + doTransfer); if (errorTooltip == null) { return null; } @@ -97,7 +104,7 @@ public List> getTargets(ModularUIGui gui, @Nonnull I ingredient, b for (Widget widget : widgets) { if (widget instanceof IGhostIngredientTarget ghostTarget) { List> widgetTargets = ghostTarget.getPhantomTargets(ingredient); - //noinspection unchecked + // noinspection unchecked targets.addAll((List>) (Object) widgetTargets); } } @@ -111,6 +118,5 @@ public List getGuiExtraAreas(@Nonnull ModularUIGui guiContainer) { } @Override - public void onComplete() { - } + public void onComplete() {} } diff --git a/src/main/java/gregtech/integration/jei/utils/MultiblockInfoRecipeFocusShower.java b/src/main/java/gregtech/integration/jei/utils/MultiblockInfoRecipeFocusShower.java index c0915cc5685..6918306eee9 100644 --- a/src/main/java/gregtech/integration/jei/utils/MultiblockInfoRecipeFocusShower.java +++ b/src/main/java/gregtech/integration/jei/utils/MultiblockInfoRecipeFocusShower.java @@ -1,12 +1,13 @@ package gregtech.integration.jei.utils; import gregtech.integration.jei.multiblock.MultiblockInfoRecipeWrapper; -import mezz.jei.input.ClickedIngredient; +import mezz.jei.input.ClickedIngredient; import mezz.jei.input.IClickedIngredient; import mezz.jei.input.IShowsRecipeFocuses; public class MultiblockInfoRecipeFocusShower implements IShowsRecipeFocuses { + @Override public IClickedIngredient getIngredientUnderMouse(int mouseX, int mouseY) { if (MultiblockInfoRecipeWrapper.getHoveredItemStack() != null) diff --git a/src/main/java/gregtech/integration/jei/utils/render/CompositeDrawable.java b/src/main/java/gregtech/integration/jei/utils/render/CompositeDrawable.java index 9d7e136efa0..65aa59fb0fe 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/CompositeDrawable.java +++ b/src/main/java/gregtech/integration/jei/utils/render/CompositeDrawable.java @@ -1,13 +1,16 @@ package gregtech.integration.jei.utils.render; -import mezz.jei.api.gui.IDrawable; import net.minecraft.client.Minecraft; -import javax.annotation.Nonnull; +import mezz.jei.api.gui.IDrawable; + import java.util.LinkedList; import java.util.List; +import javax.annotation.Nonnull; + public class CompositeDrawable implements IDrawable { + private final int width; private final int height; private final List steps; @@ -40,6 +43,7 @@ public static Builder startBuilder(int height, int width) { } public static class Builder { + private final int height; private final int width; private final List steps = new LinkedList<>(); @@ -65,6 +69,7 @@ public CompositeDrawable build() { @FunctionalInterface public interface RenderNode { + void draw(@Nonnull Minecraft minecraft, int xOffset, int yOffset); } } diff --git a/src/main/java/gregtech/integration/jei/utils/render/CompositeRenderer.java b/src/main/java/gregtech/integration/jei/utils/render/CompositeRenderer.java index 1b927a1d2b2..daac90efc7c 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/CompositeRenderer.java +++ b/src/main/java/gregtech/integration/jei/utils/render/CompositeRenderer.java @@ -1,19 +1,22 @@ package gregtech.integration.jei.utils.render; -import mcp.MethodsReturnNonnullByDefault; -import mezz.jei.api.ingredients.IIngredientRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.util.ITooltipFlag; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; +import mezz.jei.api.ingredients.IIngredientRenderer; + import java.util.LinkedList; import java.util.List; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class CompositeRenderer implements IIngredientRenderer { + private final TooltipSupplier tooltipSupplier; private final FontRendererSupplier fontRendererSupplier; private final List> steps; @@ -54,6 +57,7 @@ public FontRenderer getFontRenderer(Minecraft minecraft, T ingredient) { } public static class Builder { + private final TooltipSupplier tooltipSupplier; private final FontRendererSupplier fontRendererSupplier; private final List> steps = new LinkedList<>(); @@ -80,16 +84,19 @@ public CompositeRenderer build() { @FunctionalInterface public interface RenderNode { + void render(Minecraft minecraft, int xPosition, int yPosition, @Nullable T ingredient); } @FunctionalInterface public interface TooltipSupplier { + List getTooltip(Minecraft minecraft, T ingredient, ITooltipFlag tooltipFlag); } @FunctionalInterface public interface FontRendererSupplier { + FontRenderer getFontRenderer(Minecraft minecraft, T ingredient); } } diff --git a/src/main/java/gregtech/integration/jei/utils/render/DrawableRegistry.java b/src/main/java/gregtech/integration/jei/utils/render/DrawableRegistry.java index 8d5cf5d12c2..d2e093dd13c 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/DrawableRegistry.java +++ b/src/main/java/gregtech/integration/jei/utils/render/DrawableRegistry.java @@ -1,21 +1,24 @@ package gregtech.integration.jei.utils.render; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; -import java.util.Map; +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; + import java.util.HashMap; +import java.util.Map; /** * HashMap of IDrawables for JEI rendering */ public class DrawableRegistry { + private static final Map drawableMap = new HashMap<>(); public static void initDrawable(IGuiHelper guiHelper, String textureLocation, int width, int height, String key) { - drawableMap.put(key, guiHelper.drawableBuilder(new ResourceLocation(textureLocation), 0, 0, width, height).setTextureSize(width, height).build()); + drawableMap.put(key, guiHelper.drawableBuilder(new ResourceLocation(textureLocation), 0, 0, width, height) + .setTextureSize(width, height).build()); } public static void drawDrawable(Minecraft minecraft, String key, int x, int y) { diff --git a/src/main/java/gregtech/integration/jei/utils/render/FluidStackTextRenderer.java b/src/main/java/gregtech/integration/jei/utils/render/FluidStackTextRenderer.java index 5a0aaec0be9..0260601a9f3 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/FluidStackTextRenderer.java +++ b/src/main/java/gregtech/integration/jei/utils/render/FluidStackTextRenderer.java @@ -4,23 +4,27 @@ import gregtech.api.recipes.chance.output.ChancedOutputLogic; import gregtech.api.util.TextFormattingUtil; import gregtech.client.utils.RenderUtil; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.plugins.vanilla.ingredients.fluid.FluidStackRenderer; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.fluids.FluidStack; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.plugins.vanilla.ingredients.fluid.FluidStackRenderer; + import javax.annotation.Nonnull; import javax.annotation.Nullable; public class FluidStackTextRenderer extends FluidStackRenderer { + private boolean notConsumed; private int chanceBase = -1; private int chanceBoost = -1; private ChancedOutputLogic chanceLogic; - public FluidStackTextRenderer(int capacityMb, boolean showCapacity, int width, int height, @Nullable IDrawable overlay) { + public FluidStackTextRenderer(int capacityMb, boolean showCapacity, int width, int height, + @Nullable IDrawable overlay) { super(capacityMb, showCapacity, width, height, overlay); this.notConsumed = false; } @@ -30,7 +34,8 @@ public FluidStackTextRenderer setNotConsumed(boolean notConsumed) { return this; } - public FluidStackTextRenderer(int capacityMb, boolean showCapacity, int width, int height, @Nullable IDrawable overlay, + public FluidStackTextRenderer(int capacityMb, boolean showCapacity, int width, int height, + @Nullable IDrawable overlay, BoostableChanceEntry chance, ChancedOutputLogic chanceLogic) { if (chance != null) { this.chanceBase = chance.getChance(); @@ -41,7 +46,8 @@ public FluidStackTextRenderer(int capacityMb, boolean showCapacity, int width, i } @Override - public void render(@Nonnull Minecraft minecraft, final int xPosition, final int yPosition, @Nullable FluidStack fluidStack) { + public void render(@Nonnull Minecraft minecraft, final int xPosition, final int yPosition, + @Nullable FluidStack fluidStack) { if (fluidStack == null) return; @@ -55,7 +61,8 @@ public void render(@Nonnull Minecraft minecraft, final int xPosition, final int String s = TextFormattingUtil.formatLongToCompactString(fluidStack.amount, 4) + "L"; FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - fontRenderer.drawStringWithShadow(s, (xPosition + 6) * 2 - fontRenderer.getStringWidth(s) + 19, (yPosition + 11) * 2, 0xFFFFFF); + fontRenderer.drawStringWithShadow(s, (xPosition + 6) * 2 - fontRenderer.getStringWidth(s) + 19, + (yPosition + 11) * 2, 0xFFFFFF); GlStateManager.popMatrix(); @@ -66,20 +73,23 @@ public void render(@Nonnull Minecraft minecraft, final int xPosition, final int GlStateManager.translate(0, 0, 160); String s2 = (this.chanceBase / 100) + "%"; - if (this.chanceLogic != null && this.chanceLogic != ChancedOutputLogic.NONE && this.chanceLogic != ChancedOutputLogic.OR) { + if (this.chanceLogic != null && this.chanceLogic != ChancedOutputLogic.NONE && + this.chanceLogic != ChancedOutputLogic.OR) { s2 += "*"; } else if (this.chanceBoost > 0) { s2 += "+"; } - fontRenderer.drawStringWithShadow(s2, (xPosition + 6) * 2 - fontRenderer.getStringWidth(s2) + 19, (yPosition + 1) * 2, 0xFFFF00); + fontRenderer.drawStringWithShadow(s2, (xPosition + 6) * 2 - fontRenderer.getStringWidth(s2) + 19, + (yPosition + 1) * 2, 0xFFFF00); GlStateManager.popMatrix(); } else if (notConsumed) { GlStateManager.pushMatrix(); GlStateManager.scale(0.5, 0.5, 1); - fontRenderer.drawStringWithShadow("NC", (xPosition + 6) * 2 - fontRenderer.getStringWidth("NC") + 19, (yPosition + 1) * 2, 0xFFFF00); + fontRenderer.drawStringWithShadow("NC", (xPosition + 6) * 2 - fontRenderer.getStringWidth("NC") + 19, + (yPosition + 1) * 2, 0xFFFF00); GlStateManager.popMatrix(); } diff --git a/src/main/java/gregtech/integration/jei/utils/render/ItemStackTextRenderer.java b/src/main/java/gregtech/integration/jei/utils/render/ItemStackTextRenderer.java index e0d1c2fa0df..e2c642df694 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/ItemStackTextRenderer.java +++ b/src/main/java/gregtech/integration/jei/utils/render/ItemStackTextRenderer.java @@ -2,16 +2,19 @@ import gregtech.api.recipes.chance.boost.BoostableChanceEntry; import gregtech.api.recipes.chance.output.ChancedOutputLogic; -import mezz.jei.plugins.vanilla.ingredients.item.ItemStackRenderer; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; +import mezz.jei.plugins.vanilla.ingredients.item.ItemStackRenderer; + import javax.annotation.Nonnull; import javax.annotation.Nullable; public class ItemStackTextRenderer extends ItemStackRenderer { + private final int chanceBase; private final int chanceBoost; private final ChancedOutputLogic chanceLogic; @@ -56,14 +59,16 @@ public void render(@Nonnull Minecraft minecraft, int xPosition, int yPosition, @ GlStateManager.translate(0, 0, 160); String s = (this.chanceBase / 100) + "%"; - if (this.chanceLogic != null && this.chanceLogic != ChancedOutputLogic.NONE && this.chanceLogic != ChancedOutputLogic.OR) { + if (this.chanceLogic != null && this.chanceLogic != ChancedOutputLogic.NONE && + this.chanceLogic != ChancedOutputLogic.OR) { s += "*"; } else if (this.chanceBoost > 0) { s += "+"; } FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - fontRenderer.drawStringWithShadow(s, (xPosition + 6) * 2 - fontRenderer.getStringWidth(s) + 19, (yPosition + 1) * 2, 0xFFFF00); + fontRenderer.drawStringWithShadow(s, (xPosition + 6) * 2 - fontRenderer.getStringWidth(s) + 19, + (yPosition + 1) * 2, 0xFFFF00); GlStateManager.popMatrix(); GlStateManager.enableBlend(); @@ -75,7 +80,8 @@ public void render(@Nonnull Minecraft minecraft, int xPosition, int yPosition, @ GlStateManager.translate(0, 0, 160); FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - fontRenderer.drawStringWithShadow("NC", (xPosition + 6) * 2 - fontRenderer.getStringWidth("NC") + 19, (yPosition + 1) * 2, 0xFFFF00); + fontRenderer.drawStringWithShadow("NC", (xPosition + 6) * 2 - fontRenderer.getStringWidth("NC") + 19, + (yPosition + 1) * 2, 0xFFFF00); GlStateManager.popMatrix(); GlStateManager.enableBlend(); diff --git a/src/main/java/gregtech/integration/opencomputers/InputValidator.java b/src/main/java/gregtech/integration/opencomputers/InputValidator.java index e60c766c697..799e4699a0c 100644 --- a/src/main/java/gregtech/integration/opencomputers/InputValidator.java +++ b/src/main/java/gregtech/integration/opencomputers/InputValidator.java @@ -52,12 +52,14 @@ public static String getColorString(Arguments args, int index) { colorString = colorString.substring(2); } if (colorString.length() != 8) { - throw new IllegalArgumentException("String " + colorString + " is not valid, must be 8 characters long beyond \"0x\"."); + throw new IllegalArgumentException( + "String " + colorString + " is not valid, must be 8 characters long beyond \"0x\"."); } try { Long.parseLong(colorString, 16); } catch (NumberFormatException e) { - throw new IllegalArgumentException("String " + colorString + " is not a valid code, must be only numbers (0-9) and letters (A-F)."); + throw new IllegalArgumentException( + "String " + colorString + " is not a valid code, must be only numbers (0-9) and letters (A-F)."); } return colorString; } diff --git a/src/main/java/gregtech/integration/opencomputers/OpenComputersModule.java b/src/main/java/gregtech/integration/opencomputers/OpenComputersModule.java index 08a216991c7..344dee2667e 100644 --- a/src/main/java/gregtech/integration/opencomputers/OpenComputersModule.java +++ b/src/main/java/gregtech/integration/opencomputers/OpenComputersModule.java @@ -11,18 +11,19 @@ import gregtech.integration.opencomputers.drivers.specific.DriverPowerSubstation; import gregtech.integration.opencomputers.drivers.specific.DriverWorldAccelerator; import gregtech.modules.GregTechModules; -import li.cil.oc.api.Driver; -import li.cil.oc.api.driver.DriverBlock; + import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import li.cil.oc.api.Driver; +import li.cil.oc.api.driver.DriverBlock; + @GregTechModule( - moduleID = GregTechModules.MODULE_OC, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_OC, - name = "GregTech OpenComputers Integration", - description = "OpenComputers Integration Module" -) + moduleID = GregTechModules.MODULE_OC, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_OC, + name = "GregTech OpenComputers Integration", + description = "OpenComputers Integration Module") public class OpenComputersModule extends IntegrationSubmodule { private static final String MODID_GTCE2OC = "gtce2oc"; diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverAbstractRecipeLogic.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverAbstractRecipeLogic.java index a1a3e2aded5..6f6eeed9f97 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverAbstractRecipeLogic.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverAbstractRecipeLogic.java @@ -8,12 +8,7 @@ import gregtech.api.recipes.chance.output.impl.ChancedFluidOutput; import gregtech.api.recipes.chance.output.impl.ChancedItemOutput; import gregtech.api.recipes.ingredients.GTRecipeInput; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import li.cil.oc.api.network.ManagedEnvironment; -import li.cil.oc.api.prefab.DriverSidedTileEntity; + import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -21,6 +16,13 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; +import li.cil.oc.api.network.ManagedEnvironment; +import li.cil.oc.api.prefab.DriverSidedTileEntity; + import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -132,7 +134,8 @@ public Object[] getCurrentRecipe(final Context context, final Arguments args) { } List> chancedFluidOutput = new ArrayList<>(); - List chancedFluidOutputs = previousRecipe.getChancedFluidOutputs().getChancedEntries(); + List chancedFluidOutputs = previousRecipe.getChancedFluidOutputs() + .getChancedEntries(); chancedFluidOutputs.forEach(iR -> { Map output = new Object2ObjectOpenHashMap<>(); output.put("chance", iR.getChance()); @@ -144,9 +147,9 @@ public Object[] getCurrentRecipe(final Context context, final Arguments args) { if (!chancedFluidOutput.isEmpty()) { recipe.put("chancedFluidOutput", chancedFluidOutput); } - return new Object[]{recipe}; + return new Object[] { recipe }; } - return new Object[]{null}; + return new Object[] { null }; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverCoverHolder.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverCoverHolder.java index 25ed615d1f4..be85082485c 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverCoverHolder.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverCoverHolder.java @@ -7,15 +7,17 @@ import gregtech.common.covers.*; import gregtech.integration.opencomputers.InputValidator; import gregtech.integration.opencomputers.values.*; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverCoverHolder extends DriverSidedTileEntity { @@ -55,22 +57,22 @@ public Object[] getCover(final Context context, final Arguments args) { EnumFacing side = EnumFacing.VALUES[index]; Cover cover = tileEntity.getCoverAtSide(side); if (cover instanceof CoverRoboticArm robotArm) - return new Object[]{new ValueCoverRoboticArm(robotArm, side)}; + return new Object[] { new ValueCoverRoboticArm(robotArm, side) }; if (cover instanceof CoverConveyor conveyor) - return new Object[]{new ValueCoverConveyor(conveyor, side)}; + return new Object[] { new ValueCoverConveyor(conveyor, side) }; if (cover instanceof CoverFluidRegulator regulator) - return new Object[]{new ValueCoverFluidRegulator(regulator, side)}; + return new Object[] { new ValueCoverFluidRegulator(regulator, side) }; if (cover instanceof CoverPump pump) - return new Object[]{new ValueCoverPump(pump, side)}; + return new Object[] { new ValueCoverPump(pump, side) }; if (cover instanceof CoverFluidFilter filter) - return new Object[]{new ValueCoverFluidFilter(filter, side)}; + return new Object[] { new ValueCoverFluidFilter(filter, side) }; if (cover instanceof CoverItemFilter filter) - return new Object[]{new ValueCoverItemFilter(filter, side)}; + return new Object[] { new ValueCoverItemFilter(filter, side) }; if (cover instanceof CoverEnderFluidLink efl) - return new Object[]{new ValueCoverEnderFluidLink(efl, side)}; + return new Object[] { new ValueCoverEnderFluidLink(efl, side) }; if (cover != null) - return new Object[]{new ValueCoverBehavior(cover, side)}; - return new Object[]{null}; + return new Object[] { new ValueCoverBehavior(cover, side) }; + return new Object[] { null }; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverEnergyContainer.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverEnergyContainer.java index e4a73c28d7b..c8ecbaf4dba 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverEnergyContainer.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverEnergyContainer.java @@ -3,15 +3,17 @@ import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IEnergyContainer; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverEnergyContainer extends DriverSidedTileEntity { @@ -34,8 +36,7 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof IGregTechTileEntity) { return new EnvironmentIEnergyContainer((IGregTechTileEntity) tileEntity, - tileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, side) - ); + tileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, side)); } return null; } @@ -48,43 +49,43 @@ public EnvironmentIEnergyContainer(IGregTechTileEntity holder, IEnergyContainer @Callback(doc = "function():number -- Returns the amount of electricity contained in this Block, in EU units!") public Object[] getEnergyStored(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyStored()}; + return new Object[] { tileEntity.getEnergyStored() }; } - @Callback(doc = "function():number -- " - + "Returns the amount of electricity containable in this Block, in EU units!") + @Callback(doc = "function():number -- " + + "Returns the amount of electricity containable in this Block, in EU units!") public Object[] getEnergyCapacity(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyCapacity()}; + return new Object[] { tileEntity.getEnergyCapacity() }; } @Callback(doc = "function():number -- Gets the Output in EU/p.") public Object[] getOutputVoltage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getOutputVoltage()}; + return new Object[] { tileEntity.getOutputVoltage() }; } @Callback(doc = "function():number -- Gets the amount of Energy Packets per tick.") public Object[] getOutputAmperage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getOutputAmperage()}; + return new Object[] { tileEntity.getOutputAmperage() }; } @Callback(doc = "function():number -- Gets the maximum Input in EU/p.") public Object[] getInputVoltage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getInputVoltage()}; + return new Object[] { tileEntity.getInputVoltage() }; } @Callback(doc = "function():number -- Gets the amount of Energy Packets per tick.") public Object[] getInputAmperage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getInputAmperage()}; + return new Object[] { tileEntity.getInputAmperage() }; } @Callback(doc = "function():number -- Gets the energy input per second.") public Object[] getInputPerSec(final Context context, final Arguments args) { - return new Object[]{tileEntity.getInputPerSec()}; + return new Object[] { tileEntity.getInputPerSec() }; } @Callback(doc = "function():number -- Gets the energy output per second.") public Object[] getOutputPerSec(final Context context, final Arguments args) { - return new Object[]{tileEntity.getOutputPerSec()}; + return new Object[] { tileEntity.getOutputPerSec() }; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverRecipeMapMultiblockController.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverRecipeMapMultiblockController.java index 086245b3b6f..ee6941cfd48 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverRecipeMapMultiblockController.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverRecipeMapMultiblockController.java @@ -5,12 +5,7 @@ import gregtech.api.capability.impl.MultiblockRecipeLogic; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import li.cil.oc.api.network.ManagedEnvironment; -import li.cil.oc.api.prefab.DriverSidedTileEntity; + import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -19,11 +14,19 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; +import li.cil.oc.api.network.ManagedEnvironment; +import li.cil.oc.api.prefab.DriverSidedTileEntity; + import java.util.ArrayList; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; + public class DriverRecipeMapMultiblockController extends DriverSidedTileEntity { @Override @@ -51,7 +54,8 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin return null; } - public final static class EnvironmentMultiblockRecipeLogic extends EnvironmentMetaTileEntity { + public final static class EnvironmentMultiblockRecipeLogic extends + EnvironmentMetaTileEntity { public EnvironmentMultiblockRecipeLogic(IGregTechTileEntity holder, RecipeMapMultiblockController capability) { super(holder, capability, "gt_multiblockRecipeLogic"); @@ -59,43 +63,43 @@ public EnvironmentMultiblockRecipeLogic(IGregTechTileEntity holder, RecipeMapMul @Callback(doc = "function():number -- Returns the amount of electricity contained in this Block, in EU units!") public Object[] getEnergyStored(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getEnergyStored()}; + return new Object[] { tileEntity.getEnergyContainer().getEnergyStored() }; } - @Callback(doc = "function():number -- " - + "Returns the amount of electricity containable in this Block, in EU units!") + @Callback(doc = "function():number -- " + + "Returns the amount of electricity containable in this Block, in EU units!") public Object[] getEnergyCapacity(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getEnergyCapacity()}; + return new Object[] { tileEntity.getEnergyContainer().getEnergyCapacity() }; } @Callback(doc = "function():number -- Gets the Output in EU/p.") public Object[] getOutputVoltage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getOutputVoltage()}; + return new Object[] { tileEntity.getEnergyContainer().getOutputVoltage() }; } @Callback(doc = "function():number -- Gets the amount of Energy Packets per tick.") public Object[] getOutputAmperage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getOutputAmperage()}; + return new Object[] { tileEntity.getEnergyContainer().getOutputAmperage() }; } @Callback(doc = "function():number -- Gets the maximum Input in EU/p.") public Object[] getInputVoltage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getInputVoltage()}; + return new Object[] { tileEntity.getEnergyContainer().getInputVoltage() }; } @Callback(doc = "function():number -- Gets the amount of Energy Packets per tick.") public Object[] getInputAmperage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getInputAmperage()}; + return new Object[] { tileEntity.getEnergyContainer().getInputAmperage() }; } @Callback(doc = "function():number -- Gets the energy input per second.") public Object[] getInputPerSec(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getInputPerSec()}; + return new Object[] { tileEntity.getEnergyContainer().getInputPerSec() }; } @Callback(doc = "function():number -- Gets the energy output per second.") public Object[] getOutputPerSec(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getOutputPerSec()}; + return new Object[] { tileEntity.getEnergyContainer().getOutputPerSec() }; } @Nonnull @@ -109,7 +113,7 @@ private Object[] getInventory(IItemHandlerModifiable handler) { map.put("name", itemStack.getDisplayName()); result.add(map); } - return new Object[]{result}; + return new Object[] { result }; } @Callback(doc = "function():table -- Gets the Input Inventory.") @@ -137,7 +141,7 @@ private Object[] getTank(IMultipleTankHandler handler) { } result.add(map); }); - return new Object[]{result}; + return new Object[] { result }; } @Callback(doc = "function():table -- Gets the Input Tank.") diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverSimpleMachine.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverSimpleMachine.java index a4dd4fb6fd6..e9047958c6e 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverSimpleMachine.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverSimpleMachine.java @@ -2,15 +2,17 @@ import gregtech.api.metatileentity.SimpleMachineMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverSimpleMachine extends DriverSidedTileEntity { @@ -33,8 +35,7 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof IGregTechTileEntity) { return new EnvironmentSimpleMachine((IGregTechTileEntity) tileEntity, - (SimpleMachineMetaTileEntity) ((IGregTechTileEntity) tileEntity).getMetaTileEntity() - ); + (SimpleMachineMetaTileEntity) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()); } return null; } @@ -47,74 +48,77 @@ public EnvironmentSimpleMachine(IGregTechTileEntity holder, SimpleMachineMetaTil @Callback(doc = "function():number -- Returns the tier of machine.") public Object[] getTier(final Context context, final Arguments args) { - return new Object[]{tileEntity.getTier()}; + return new Object[] { tileEntity.getTier() }; } @Callback(doc = "function():boolean -- Returns is autoOutputItems enabled.") public Object[] isAutoOutputItems(final Context context, final Arguments args) { - return new Object[]{tileEntity.isAutoOutputItems()}; + return new Object[] { tileEntity.isAutoOutputItems() }; } @Callback(doc = "function(autoOutputItems:boolean):boolean -- Sets autoOutputItems enabled.") public Object[] setAutoOutputItems(final Context context, final Arguments args) { tileEntity.setAutoOutputItems(args.checkBoolean(0)); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():boolean -- Returns is autoOutputFluids enabled.") public Object[] isAutoOutputFluids(final Context context, final Arguments args) { - return new Object[]{tileEntity.isAutoOutputFluids()}; + return new Object[] { tileEntity.isAutoOutputFluids() }; } @Callback(doc = "function(autoOutputFluids:boolean):boolean -- Sets autoOutputFluids enabled.") public Object[] setAutoOutputFluids(final Context context, final Arguments args) { tileEntity.setAutoOutputFluids(args.checkBoolean(0)); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():boolean -- Returns is allowInputFromOutputSide enabled for BOTH items and fluids.") public Object[] isAllowInputFromOutputSide(final Context context, final Arguments args) { - return new Object[]{tileEntity.isAllowInputFromOutputSideItems() && tileEntity.isAllowInputFromOutputSideFluids()}; + return new Object[] { + tileEntity.isAllowInputFromOutputSideItems() && tileEntity.isAllowInputFromOutputSideFluids() }; } @Callback(doc = "function():boolean -- Returns is allowInputFromOutputSide enabled for items.") public Object[] isAllowInputFromOutputSideItems(final Context context, final Arguments args) { - return new Object[]{tileEntity.isAllowInputFromOutputSideItems() && tileEntity.isAllowInputFromOutputSideFluids()}; + return new Object[] { + tileEntity.isAllowInputFromOutputSideItems() && tileEntity.isAllowInputFromOutputSideFluids() }; } @Callback(doc = "function():boolean -- Returns is allowInputFromOutputSide enabled for fluids.") public Object[] isAllowInputFromOutputSideFluids(final Context context, final Arguments args) { - return new Object[]{tileEntity.isAllowInputFromOutputSideItems() && tileEntity.isAllowInputFromOutputSideFluids()}; + return new Object[] { + tileEntity.isAllowInputFromOutputSideItems() && tileEntity.isAllowInputFromOutputSideFluids() }; } @Callback(doc = "function(allowInputFromOutputSide:boolean):boolean -- Sets allowInputFromOutputSide enabled for BOTH items and fluids.") public Object[] setAllowInputFromOutputSide(final Context context, final Arguments args) { tileEntity.setAllowInputFromOutputSideItems(args.checkBoolean(0)); tileEntity.setAllowInputFromOutputSideFluids(args.checkBoolean(0)); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function(allowInputFromOutputSide:boolean):boolean -- Sets allowInputFromOutputSide enabled for items.") public Object[] setAllowInputFromOutputSideItems(final Context context, final Arguments args) { tileEntity.setAllowInputFromOutputSideItems(args.checkBoolean(0)); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function(allowInputFromOutputSide:boolean):boolean -- Sets allowInputFromOutputSide enabled for fluids.") public Object[] setAllowInputFromOutputSideFluids(final Context context, final Arguments args) { tileEntity.setAllowInputFromOutputSideFluids(args.checkBoolean(0)); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Returns is outputFacing.") public Object[] getOutputFacing(final Context context, final Arguments args) { - return new Object[]{tileEntity.getOutputFacing().ordinal()}; + return new Object[] { tileEntity.getOutputFacing().ordinal() }; } @Callback(doc = "function(side:number) -- Sets outputFacing.") public Object[] setOutputFacing(final Context context, final Arguments args) { tileEntity.setOutputFacing(EnumFacing.values()[args.checkInteger(0)]); - return new Object[]{}; + return new Object[] {}; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverWorkable.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverWorkable.java index 43508abda61..e5c5b075bef 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverWorkable.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverWorkable.java @@ -3,15 +3,17 @@ import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IWorkable; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverWorkable extends DriverSidedTileEntity { @@ -34,8 +36,7 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof IGregTechTileEntity) { return new EnvironmentIWorkable((IGregTechTileEntity) tileEntity, - tileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_WORKABLE, side) - ); + tileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_WORKABLE, side)); } return null; } @@ -48,30 +49,30 @@ public EnvironmentIWorkable(IGregTechTileEntity holder, IWorkable capability) { @Callback(doc = "function():number -- Returns the MaxProgress!") public Object[] getMaxProgress(final Context context, final Arguments args) { - return new Object[]{tileEntity.getMaxProgress()}; + return new Object[] { tileEntity.getMaxProgress() }; } @Callback(doc = "function():number -- Returns the Progress!") public Object[] getProgress(final Context context, final Arguments args) { - return new Object[]{tileEntity.getProgress()}; + return new Object[] { tileEntity.getProgress() }; } @Callback(doc = "function():boolean -- Returns is active or not.") public Object[] isActive(final Context context, final Arguments args) { - return new Object[]{tileEntity.isActive()}; + return new Object[] { tileEntity.isActive() }; } @Callback(doc = "function():boolean -- Returns is working enabled.") public Object[] isWorkingEnabled(final Context context, final Arguments args) { - return new Object[]{tileEntity.isWorkingEnabled()}; + return new Object[] { tileEntity.isWorkingEnabled() }; } - @Callback(doc = "function(workingEnabled:boolean):boolean -- " - + "Sets working enabled, return last working enabled.") + @Callback(doc = "function(workingEnabled:boolean):boolean -- " + + "Sets working enabled, return last working enabled.") public Object[] setWorkingEnabled(final Context context, final Arguments args) { boolean lsatState = tileEntity.isWorkingEnabled(); tileEntity.setWorkingEnabled(args.checkBoolean(0)); - return new Object[]{lsatState}; + return new Object[] { lsatState }; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/EnvironmentMetaTileEntity.java b/src/main/java/gregtech/integration/opencomputers/drivers/EnvironmentMetaTileEntity.java index f5427805067..20d67a34fd3 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/EnvironmentMetaTileEntity.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/EnvironmentMetaTileEntity.java @@ -1,6 +1,7 @@ package gregtech.integration.opencomputers.drivers; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; + import li.cil.oc.api.driver.NamedBlock; import li.cil.oc.integration.ManagedTileEntityEnvironment; diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverConverter.java b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverConverter.java index 69a68aaab81..5d53ad3742e 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverConverter.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverConverter.java @@ -4,15 +4,17 @@ import gregtech.common.metatileentities.converter.MetaTileEntityConverter; import gregtech.integration.opencomputers.InputValidator; import gregtech.integration.opencomputers.drivers.EnvironmentMetaTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverConverter extends DriverSidedTileEntity { @@ -40,7 +42,8 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin return null; } - public final static class EnvironmentTileEntityConverter extends EnvironmentMetaTileEntity { + public final static class EnvironmentTileEntityConverter extends + EnvironmentMetaTileEntity { public EnvironmentTileEntityConverter(IGregTechTileEntity holder, MetaTileEntityConverter tileEntity) { super(holder, tileEntity, "gt_converter"); @@ -48,14 +51,14 @@ public EnvironmentTileEntityConverter(IGregTechTileEntity holder, MetaTileEntity @Callback(doc = "function():number -- Gets the Converter Mode. (0:FE->EU, 1:EU->FE)") public Object[] getConverterMode(final Context context, final Arguments args) { - return new Object[]{tileEntity.isFeToEu() ? 0 : 1}; + return new Object[] { tileEntity.isFeToEu() ? 0 : 1 }; } @Callback(doc = "function(mode:number) -- Sets the Converter Mode. (0:FE->EU, 1:EU->FE)") public Object[] setConverterMode(final Context context, final Arguments args) { boolean mode = InputValidator.getInteger(args, 0, 0, 1) == 0; tileEntity.setFeToEu(mode); - return new Object[]{}; + return new Object[] {}; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverFusionReactor.java b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverFusionReactor.java index f29e9b993a2..91ab2537635 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverFusionReactor.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverFusionReactor.java @@ -3,15 +3,17 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.metatileentities.multi.electric.MetaTileEntityFusionReactor; import gregtech.integration.opencomputers.drivers.EnvironmentMetaTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverFusionReactor extends DriverSidedTileEntity { @@ -34,14 +36,13 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof IGregTechTileEntity) { return new EnvironmentFusionReactor((IGregTechTileEntity) tileEntity, - (MetaTileEntityFusionReactor) ((IGregTechTileEntity) tileEntity).getMetaTileEntity() - ); + (MetaTileEntityFusionReactor) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()); } return null; } public final static class EnvironmentFusionReactor extends - EnvironmentMetaTileEntity { + EnvironmentMetaTileEntity { public EnvironmentFusionReactor(IGregTechTileEntity holder, MetaTileEntityFusionReactor tileEntity) { super(holder, tileEntity, "gt_fusionReactor"); @@ -49,7 +50,7 @@ public EnvironmentFusionReactor(IGregTechTileEntity holder, MetaTileEntityFusion @Callback(doc = "function():number -- Returns the heat of machine.") public Object[] getHeat(final Context context, final Arguments args) { - return new Object[]{tileEntity.getHeat()}; + return new Object[] { tileEntity.getHeat() }; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverPowerSubstation.java b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverPowerSubstation.java index 9058ffded46..509de932b1b 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverPowerSubstation.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverPowerSubstation.java @@ -3,15 +3,17 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.metatileentities.multi.electric.MetaTileEntityPowerSubstation; import gregtech.integration.opencomputers.drivers.EnvironmentMetaTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverPowerSubstation extends DriverSidedTileEntity { @@ -32,13 +34,15 @@ public boolean worksWith(World world, BlockPos pos, EnumFacing side) { @Override public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacing side) { TileEntity tileEntity = world.getTileEntity(pos); - if (tileEntity instanceof IGregTechTileEntity gtte && gtte.getMetaTileEntity() instanceof MetaTileEntityPowerSubstation pss) { + if (tileEntity instanceof IGregTechTileEntity gtte && + gtte.getMetaTileEntity() instanceof MetaTileEntityPowerSubstation pss) { return new EnvironmentPowerSubstation(gtte, pss); } return null; } - public final static class EnvironmentPowerSubstation extends EnvironmentMetaTileEntity { + public final static class EnvironmentPowerSubstation extends + EnvironmentMetaTileEntity { public EnvironmentPowerSubstation(IGregTechTileEntity holder, MetaTileEntityPowerSubstation mte) { super(holder, mte, "gt_powerSubstation"); @@ -46,22 +50,22 @@ public EnvironmentPowerSubstation(IGregTechTileEntity holder, MetaTileEntityPowe @Callback(doc = "function():string -- Returns the stored energy of the machine.") public Object[] getStored(final Context context, final Arguments args) { - return new Object[]{tileEntity.getStored()}; + return new Object[] { tileEntity.getStored() }; } @Callback(doc = "function():string -- Returns the total energy capacity of the machine.") public Object[] getCapacity(final Context context, final Arguments args) { - return new Object[]{tileEntity.getCapacity()}; + return new Object[] { tileEntity.getCapacity() }; } @Callback(doc = "function():number -- Returns the passive drain of the machine, in EU/t.") public Object[] getPassiveDrain(final Context context, final Arguments args) { - return new Object[]{tileEntity.getPassiveDrain()}; + return new Object[] { tileEntity.getPassiveDrain() }; } @Callback(doc = "function():number -- Returns the average net EU/t in or out over the last second.") public Object[] getAverageIOLastSec(final Context context, final Arguments args) { - return new Object[]{tileEntity.getAverageIOLastSec()}; + return new Object[] { tileEntity.getAverageIOLastSec() }; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverWorldAccelerator.java b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverWorldAccelerator.java index e8f56345cd7..6d1c9b9844f 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverWorldAccelerator.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverWorldAccelerator.java @@ -3,15 +3,17 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.metatileentities.electric.MetaTileEntityWorldAccelerator; import gregtech.integration.opencomputers.drivers.EnvironmentMetaTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverWorldAccelerator extends DriverSidedTileEntity { @@ -34,42 +36,41 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof IGregTechTileEntity) { return new EnvironmentTileEntityWorldAccelerator((IGregTechTileEntity) tileEntity, - (MetaTileEntityWorldAccelerator) ((IGregTechTileEntity) tileEntity).getMetaTileEntity() - ); + (MetaTileEntityWorldAccelerator) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()); } return null; } public final static class EnvironmentTileEntityWorldAccelerator extends - EnvironmentMetaTileEntity { + EnvironmentMetaTileEntity { - public EnvironmentTileEntityWorldAccelerator(IGregTechTileEntity holder, MetaTileEntityWorldAccelerator tileEntity) { + public EnvironmentTileEntityWorldAccelerator(IGregTechTileEntity holder, + MetaTileEntityWorldAccelerator tileEntity) { super(holder, tileEntity, "gt_worldAccelerator"); } @Callback(doc = "function():boolean -- Returns the mode of machine.") public Object[] isTileMode(final Context context, final Arguments args) { - return new Object[]{tileEntity.isTEMode()}; + return new Object[] { tileEntity.isTEMode() }; } @Callback(doc = "function(isTile:boolean) -- Sets the mode of machine.") public Object[] setTileMode(final Context context, final Arguments args) { tileEntity.setTEMode(args.checkBoolean(0)); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():boolean -- Returns is working enabled.") public Object[] isWorkingEnabled(final Context context, final Arguments args) { - return new Object[]{tileEntity.isWorkingEnabled()}; + return new Object[] { tileEntity.isWorkingEnabled() }; } - @Callback(doc = "function(workingEnabled:boolean):boolean -- " - + "Sets working enabled, return last working enabled.") + @Callback(doc = "function(workingEnabled:boolean):boolean -- " + + "Sets working enabled, return last working enabled.") public Object[] setWorkingEnabled(final Context context, final Arguments args) { boolean lsatState = tileEntity.isWorkingEnabled(); tileEntity.setWorkingEnabled(args.checkBoolean(0)); - return new Object[]{lsatState}; + return new Object[] { lsatState }; } - } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverBehavior.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverBehavior.java index 53ee3974d00..110fbdf9d5b 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverBehavior.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverBehavior.java @@ -4,10 +4,7 @@ import gregtech.api.cover.Cover; import gregtech.api.cover.CoverableView; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import li.cil.oc.api.prefab.AbstractValue; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTUtil; import net.minecraft.tileentity.TileEntity; @@ -16,6 +13,11 @@ import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; +import li.cil.oc.api.prefab.AbstractValue; + import java.util.Objects; public class ValueCoverBehavior extends AbstractValue { @@ -25,7 +27,7 @@ public class ValueCoverBehavior extends AbstractValue { private int dim; private String coverName; - public final Object[] NULL_COVER = new Object[]{null, "Found no cover, this is an invalid object."}; + public final Object[] NULL_COVER = new Object[] { null, "Found no cover, this is an invalid object." }; protected ValueCoverBehavior(Cover cover, EnumFacing side, String coverName) { this.pos = cover.getPos(); @@ -52,12 +54,12 @@ protected Cover getCover() { @Callback(doc = "function():number -- Returns the side of the cover.") public Object[] getSide(final Context context, final Arguments args) { - return new Object[]{side.ordinal()}; + return new Object[] { side.ordinal() }; } @Callback(doc = "function():string -- Returns the type name of the cover.") public Object[] getTypeName(final Context context, final Arguments args) { - return new Object[]{coverName}; + return new Object[] { coverName }; } @Callback(doc = "function():number -- Gets redstone signal output.") @@ -67,7 +69,7 @@ public final Object[] getRedstoneSignalOutput(final Context context, final Argum return NULL_COVER; } - return new Object[]{cover.getRedstoneSignalOutput()}; + return new Object[] { cover.getRedstoneSignalOutput() }; } @Callback(doc = "function():number -- Gets redstone signal input.") @@ -77,7 +79,7 @@ public final Object[] getRedstoneSignalInput(final Context context, final Argume return NULL_COVER; } - return new Object[]{cover.getCoverableView().getInputRedstoneSignal(cover.getAttachedSide(), true)}; + return new Object[] { cover.getCoverableView().getInputRedstoneSignal(cover.getAttachedSide(), true) }; } @Override diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverConveyor.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverConveyor.java index 2a93f1ef8d9..1694dcff6fc 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverConveyor.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverConveyor.java @@ -4,10 +4,12 @@ import gregtech.common.covers.CoverConveyor; import gregtech.common.covers.CoverConveyor.ConveyorMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverConveyor extends ValueCoverBehavior { @@ -32,7 +34,7 @@ public Object[] getTier(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.tier}; + return new Object[] { cover.tier }; } @Callback(doc = "function():number -- Returns transfer rate.") @@ -42,7 +44,7 @@ public Object[] getTransferRate(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getTransferRate()}; + return new Object[] { cover.getTransferRate() }; } @Callback(doc = "function(number) -- Sets transfer rate.") @@ -54,7 +56,7 @@ public Object[] setTransferRate(final Context context, final Arguments args) { int transferRate = InputValidator.getInteger(args, 0, 0, cover.maxItemTransferRate); cover.setTransferRate(transferRate); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function(mode:number) -- Sets conveyor mode. (0:IMPORT, 1:EXPORT)") @@ -66,7 +68,7 @@ public Object[] setConveyorMode(final Context context, final Arguments args) { ConveyorMode mode = InputValidator.getEnumArrayIndex(args, 0, ConveyorMode.values()); cover.setConveyorMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets conveyor mode. (0:IMPORT, 1:EXPORT)") @@ -76,6 +78,6 @@ public Object[] getConveyorMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getConveyorMode().ordinal()}; + return new Object[] { cover.getConveyorMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverEnderFluidLink.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverEnderFluidLink.java index 1a87f4d6ea4..8f919385959 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverEnderFluidLink.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverEnderFluidLink.java @@ -4,10 +4,12 @@ import gregtech.common.covers.CoverEnderFluidLink; import gregtech.common.covers.CoverPump.PumpMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverEnderFluidLink extends ValueCoverBehavior { @@ -30,7 +32,7 @@ public Object[] setColorChannel(final Context context, final Arguments args) { String colorString = InputValidator.getColorString(args, 0); cover.updateColor(colorString); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():string -- Gets the color channel.") @@ -40,7 +42,7 @@ public Object[] getColorChannel(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getColorStr()}; + return new Object[] { cover.getColorStr() }; } @Callback(doc = "function(mode:number) -- Sets pump mode. (0:IMPORT, 1:EXPORT)") @@ -52,7 +54,7 @@ public Object[] setPumpMode(final Context context, final Arguments args) { PumpMode mode = InputValidator.getEnumArrayIndex(args, 0, PumpMode.values()); cover.setPumpMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets pump mode. (0:IMPORT, 1:EXPORT)") @@ -62,6 +64,6 @@ public Object[] getPumpMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getPumpMode().ordinal()}; + return new Object[] { cover.getPumpMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidFilter.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidFilter.java index e5434f63ae3..c5d30e10fc2 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidFilter.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidFilter.java @@ -4,10 +4,12 @@ import gregtech.common.covers.CoverFluidFilter; import gregtech.common.covers.FluidFilterMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverFluidFilter extends ValueCoverBehavior { @@ -30,7 +32,7 @@ public Object[] setFilterMode(final Context context, final Arguments args) { FluidFilterMode mode = InputValidator.getEnumArrayIndex(args, 0, FluidFilterMode.values()); cover.setFilterMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets filter mode. (0:FILTER_FILL, 1:FILTER_DRAIN, 2:FILTER_BOTH)") @@ -40,6 +42,6 @@ public Object[] getFilterMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getFilterMode().ordinal()}; + return new Object[] { cover.getFilterMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidRegulator.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidRegulator.java index dba40e29624..d4da4ca7e10 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidRegulator.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidRegulator.java @@ -4,10 +4,12 @@ import gregtech.common.covers.CoverFluidRegulator; import gregtech.common.covers.TransferMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverFluidRegulator extends ValueCoverPump { @@ -30,7 +32,7 @@ public Object[] setTransferMode(final Context context, final Arguments args) { TransferMode mode = InputValidator.getEnumArrayIndex(args, 0, TransferMode.values()); cover.setTransferMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets transfer mode. (0:TRANSFER_ANY, 1:TRANSFER_EXACT, 2:KEEP_EXACT)") @@ -40,6 +42,6 @@ public Object[] getTransferMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getTransferMode().ordinal()}; + return new Object[] { cover.getTransferMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverItemFilter.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverItemFilter.java index 6a3c316e6de..dc0a9255641 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverItemFilter.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverItemFilter.java @@ -4,10 +4,12 @@ import gregtech.common.covers.CoverItemFilter; import gregtech.common.covers.ItemFilterMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverItemFilter extends ValueCoverBehavior { @@ -30,7 +32,7 @@ public Object[] setFilterMode(final Context context, final Arguments args) { ItemFilterMode mode = InputValidator.getEnumArrayIndex(args, 0, ItemFilterMode.values()); cover.setFilterMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets filter mode. (0:FILTER_INSERT, 1:FILTER_EXTRACT, 2:FILTER_BOTH)") @@ -40,6 +42,6 @@ public Object[] getFilterMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getFilterMode().ordinal()}; + return new Object[] { cover.getFilterMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverPump.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverPump.java index bb828702466..87c9d6457fa 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverPump.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverPump.java @@ -4,10 +4,12 @@ import gregtech.common.covers.CoverPump; import gregtech.common.covers.CoverPump.PumpMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverPump extends ValueCoverBehavior { @@ -32,7 +34,7 @@ public Object[] getTier(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.tier}; + return new Object[] { cover.tier }; } @Callback(doc = "function():number -- Returns transfer rate.") @@ -42,7 +44,7 @@ public Object[] getTransferRate(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getTransferRate()}; + return new Object[] { cover.getTransferRate() }; } @Callback(doc = "function(number) -- Sets transfer rate.") @@ -54,7 +56,7 @@ public Object[] setTransferRate(final Context context, final Arguments args) { int transferRate = InputValidator.getInteger(args, 0, 0, cover.maxFluidTransferRate); cover.setTransferRate(transferRate); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function(mode:number) -- Sets pump mode. (0:IMPORT, 1:EXPORT)") @@ -66,7 +68,7 @@ public Object[] setPumpMode(final Context context, final Arguments args) { PumpMode mode = InputValidator.getEnumArrayIndex(args, 0, PumpMode.values()); cover.setPumpMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets pump mode. (0:IMPORT, 1:EXPORT)") @@ -76,6 +78,6 @@ public Object[] getPumpMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getPumpMode().ordinal()}; + return new Object[] { cover.getPumpMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverRoboticArm.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverRoboticArm.java index 9099f7535ca..a77408d05ca 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverRoboticArm.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverRoboticArm.java @@ -3,10 +3,12 @@ import gregtech.common.covers.CoverRoboticArm; import gregtech.common.covers.TransferMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverRoboticArm extends ValueCoverConveyor { @@ -28,7 +30,7 @@ public Object[] setTransferMode(final Context context, final Arguments args) { TransferMode mode = InputValidator.getEnumArrayIndex(args, 0, TransferMode.values()); cover.setTransferMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets transfer mode. (0:TRANSFER_ANY, 1:TRANSFER_EXACT, 2:KEEP_EXACT)") @@ -38,6 +40,6 @@ public Object[] getTransferMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getTransferMode().ordinal()}; + return new Object[] { cover.getTransferMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/theoneprobe/TheOneProbeModule.java b/src/main/java/gregtech/integration/theoneprobe/TheOneProbeModule.java index 9afdb46c5d5..943448ce2ce 100644 --- a/src/main/java/gregtech/integration/theoneprobe/TheOneProbeModule.java +++ b/src/main/java/gregtech/integration/theoneprobe/TheOneProbeModule.java @@ -7,17 +7,18 @@ import gregtech.integration.theoneprobe.provider.debug.DebugPipeNetInfoProvider; import gregtech.integration.theoneprobe.provider.debug.DebugTickTimeProvider; import gregtech.modules.GregTechModules; + +import net.minecraftforge.fml.common.event.FMLInitializationEvent; + import mcjty.theoneprobe.TheOneProbe; import mcjty.theoneprobe.api.ITheOneProbe; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; @GregTechModule( - moduleID = GregTechModules.MODULE_TOP, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_TOP, - name = "GregTech TheOneProbe Integration", - description = "TheOneProbe Integration Module" -) + moduleID = GregTechModules.MODULE_TOP, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_TOP, + name = "GregTech TheOneProbe Integration", + description = "TheOneProbe Integration Module") public class TheOneProbeModule extends IntegrationSubmodule { @Override diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/BlockOreInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/BlockOreInfoProvider.java index d6a4e7ef8fb..e4a0747660a 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/BlockOreInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/BlockOreInfoProvider.java @@ -3,12 +3,14 @@ import gregtech.api.GTValues; import gregtech.api.unification.ore.StoneType; import gregtech.common.blocks.BlockOre; -import mcjty.theoneprobe.api.*; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import mcjty.theoneprobe.api.*; + public class BlockOreInfoProvider implements IProbeInfoProvider { @Override @@ -17,13 +19,15 @@ public String getID() { } @Override - public void addProbeInfo(ProbeMode probeMode, IProbeInfo probeInfo, EntityPlayer entityPlayer, World world, IBlockState blockState, IProbeHitData probeHitData) { + public void addProbeInfo(ProbeMode probeMode, IProbeInfo probeInfo, EntityPlayer entityPlayer, World world, + IBlockState blockState, IProbeHitData probeHitData) { if (blockState.getBlock() instanceof BlockOre) { StoneType stoneType = blockState.getValue(((BlockOre) blockState.getBlock()).STONE_TYPE); if (entityPlayer.isSneaking() && !stoneType.shouldBeDroppedAsItem) { probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.block_drops*}:"); ItemStack itemDropped = blockState.getBlock().getItem(world, probeHitData.getPos(), blockState); - IProbeInfo horizontalInfo = probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)); + IProbeInfo horizontalInfo = probeInfo + .horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)); horizontalInfo.item(itemDropped); horizontalInfo.itemLabel(itemDropped); } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/CapabilityInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/CapabilityInfoProvider.java index 76448c16368..511f5187dfa 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/CapabilityInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/CapabilityInfoProvider.java @@ -1,15 +1,16 @@ package gregtech.integration.theoneprobe.provider; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.IProbeInfoProvider; -import mcjty.theoneprobe.api.ProbeMode; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.IProbeInfoProvider; +import mcjty.theoneprobe.api.ProbeMode; + import javax.annotation.Nonnull; public abstract class CapabilityInfoProvider implements IProbeInfoProvider { @@ -17,14 +18,16 @@ public abstract class CapabilityInfoProvider implements IProbeInfoProvider { @Nonnull protected abstract Capability getCapability(); - protected abstract void addProbeInfo(T capability, IProbeInfo probeInfo, EntityPlayer player, TileEntity tileEntity, IProbeHitData data); + protected abstract void addProbeInfo(T capability, IProbeInfo probeInfo, EntityPlayer player, TileEntity tileEntity, + IProbeHitData data); protected boolean allowDisplaying(T capability) { return true; } @Override - public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { + public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, + @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { if (blockState.getBlock().hasTileEntity(blockState)) { TileEntity tileEntity = world.getTileEntity(data.getPos()); if (tileEntity == null) return; diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/ControllableInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/ControllableInfoProvider.java index f9456324654..58bcc90d46c 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/ControllableInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/ControllableInfoProvider.java @@ -3,13 +3,15 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class ControllableInfoProvider extends CapabilityInfoProvider { @@ -26,7 +28,9 @@ public String getID() { } @Override - protected void addProbeInfo(@Nonnull IControllable capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { - if (!capability.isWorkingEnabled()) probeInfo.text(TextStyleClass.WARNING + "{*gregtech.top.working_disabled*}"); + protected void addProbeInfo(@Nonnull IControllable capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, + @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + if (!capability.isWorkingEnabled()) + probeInfo.text(TextStyleClass.WARNING + "{*gregtech.top.working_disabled*}"); } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/ConverterInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/ConverterInfoProvider.java index 4f83cf4ec4a..fb205454caf 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/ConverterInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/ConverterInfoProvider.java @@ -6,15 +6,17 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.converter.ConverterTrait; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class ConverterInfoProvider extends CapabilityInfoProvider { @@ -31,9 +33,11 @@ protected Capability getCapability() { } @Override - protected void addProbeInfo(@Nonnull ConverterTrait capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull ConverterTrait capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, + @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { // Info on current converter mode - probeInfo.text(TextStyleClass.INFO + ((capability.isFeToEu()) ? "{*gregtech.top.convert_fe*}" : "{*gregtech.top.convert_eu*}")); + probeInfo.text(TextStyleClass.INFO + + ((capability.isFeToEu()) ? "{*gregtech.top.convert_fe*}" : "{*gregtech.top.convert_eu*}")); // Info on the current side of the converter EnumFacing facing = ((IGregTechTileEntity) tileEntity).getMetaTileEntity().getFrontFacing(); @@ -41,15 +45,19 @@ protected void addProbeInfo(@Nonnull ConverterTrait capability, @Nonnull IProbeI long amperage = capability.getBaseAmps(); if (capability.isFeToEu()) { if (data.getSideHit() == facing) { - probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_output*} " + voltageN + TextFormatting.GREEN + " (" + amperage + "A)"); + probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_output*} " + voltageN + + TextFormatting.GREEN + " (" + amperage + "A)"); } else { - probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_input*} " + TextFormatting.RED + FeCompat.toFe(capability.getVoltage() * amperage, FeCompat.ratio(true)) + " FE"); + probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_input*} " + TextFormatting.RED + + FeCompat.toFe(capability.getVoltage() * amperage, FeCompat.ratio(true)) + " FE"); } } else { if (data.getSideHit() == facing) { - probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_output*} " + TextFormatting.RED + FeCompat.toFe(capability.getVoltage() * amperage, FeCompat.ratio(false)) + " FE"); + probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_output*} " + TextFormatting.RED + + FeCompat.toFe(capability.getVoltage() * amperage, FeCompat.ratio(false)) + " FE"); } else { - probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_input*} " + voltageN + TextFormatting.GREEN + " (" + amperage + "A)"); + probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_input*} " + voltageN + + TextFormatting.GREEN + " (" + amperage + "A)"); } } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/CoverInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/CoverInfoProvider.java index 72080f1e00d..e1f9bc47594 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/CoverInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/CoverInfoProvider.java @@ -7,14 +7,16 @@ import gregtech.api.util.TextFormattingUtil; import gregtech.common.covers.*; import gregtech.common.covers.filter.*; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -32,7 +34,9 @@ public String getID() { } @Override - protected void addProbeInfo(@Nonnull CoverHolder capability, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull CoverHolder capability, @Nonnull IProbeInfo probeInfo, + @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, + @Nonnull IProbeHitData data) { Cover cover = capability.getCoverAtSide(data.getSideHit()); if (cover instanceof CoverConveyor conveyor) { conveyorInfo(probeInfo, conveyor); @@ -58,14 +62,16 @@ private static void conveyorInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverCo if (conveyor instanceof CoverItemVoiding) { itemVoidingInfo(probeInfo, (CoverItemVoiding) conveyor); - } else if (!(conveyor instanceof CoverRoboticArm) || ((CoverRoboticArm) conveyor).getTransferMode() == TransferMode.TRANSFER_ANY) { - // only display the regular rate if the cover does not have a specialized rate - transferRateText(probeInfo, conveyor.getConveyorMode(), rateUnit, conveyor.getTransferRate()); - } + } else if (!(conveyor instanceof CoverRoboticArm) || + ((CoverRoboticArm) conveyor).getTransferMode() == TransferMode.TRANSFER_ANY) { + // only display the regular rate if the cover does not have a specialized rate + transferRateText(probeInfo, conveyor.getConveyorMode(), rateUnit, conveyor.getTransferRate()); + } ItemFilterContainer filter = conveyor.getItemFilterContainer(); if (conveyor instanceof CoverRoboticArm roboticArm) { - transferModeText(probeInfo, roboticArm.getTransferMode(), rateUnit, filter.getTransferStackSize(), filter.getFilterWrapper().getItemFilter() != null); + transferModeText(probeInfo, roboticArm.getTransferMode(), rateUnit, filter.getTransferStackSize(), + filter.getFilterWrapper().getItemFilter() != null); } itemFilterText(probeInfo, filter.getFilterWrapper().getItemFilter()); } @@ -82,7 +88,8 @@ private static void itemVoidingInfo(@Nonnull IProbeInfo probeInfo, @Nonnull Cove ItemFilterContainer container = voiding.getItemFilterContainer(); if (voiding instanceof CoverItemVoidingAdvanced advanced) { VoidingMode mode = advanced.getVoidingMode(); - voidingText(probeInfo, mode, unit, container.getTransferStackSize(), container.getFilterWrapper().getItemFilter() != null); + voidingText(probeInfo, mode, unit, container.getTransferStackSize(), + container.getFilterWrapper().getItemFilter() != null); } } @@ -97,14 +104,18 @@ private static void pumpInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverPump p if (pump instanceof CoverFluidVoiding) { fluidVoidingInfo(probeInfo, (CoverFluidVoiding) pump); - } else if (!(pump instanceof CoverFluidRegulator) || ((CoverFluidRegulator) pump).getTransferMode() == TransferMode.TRANSFER_ANY) { - // do not display the regular rate if the cover has a specialized rate - transferRateText(probeInfo, pump.getPumpMode(), " " + rateUnit, pump.getBucketMode() == CoverPump.BucketMode.BUCKET ? pump.getTransferRate() / 1000 : pump.getTransferRate()); - } + } else if (!(pump instanceof CoverFluidRegulator) || + ((CoverFluidRegulator) pump).getTransferMode() == TransferMode.TRANSFER_ANY) { + // do not display the regular rate if the cover has a specialized rate + transferRateText(probeInfo, pump.getPumpMode(), " " + rateUnit, + pump.getBucketMode() == CoverPump.BucketMode.BUCKET ? pump.getTransferRate() / 1000 : + pump.getTransferRate()); + } FluidFilterContainer filter = pump.getFluidFilterContainer(); if (pump instanceof CoverFluidRegulator regulator) { - transferModeText(probeInfo, regulator.getTransferMode(), rateUnit, regulator.getTransferAmount(), filter.getFilterWrapper().getFluidFilter() != null); + transferModeText(probeInfo, regulator.getTransferMode(), rateUnit, regulator.getTransferAmount(), + filter.getFilterWrapper().getFluidFilter() != null); } fluidFilterText(probeInfo, filter.getFilterWrapper().getFluidFilter()); } @@ -116,12 +127,16 @@ private static void pumpInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverPump p * @param voiding the voiding cover to get data from */ private static void fluidVoidingInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverFluidVoiding voiding) { - String unit = voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? " {*gregtech.top.unit.fluid_buckets*}" : " {*gregtech.top.unit.fluid_milibuckets*}"; + String unit = voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? " {*gregtech.top.unit.fluid_buckets*}" : + " {*gregtech.top.unit.fluid_milibuckets*}"; if (voiding instanceof CoverFluidVoidingAdvanced advanced) { VoidingMode mode = advanced.getVoidingMode(); // do not display amount in overflow when a filter is present - voidingText(probeInfo, mode, unit, voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? advanced.getTransferAmount() / 1000 : advanced.getTransferAmount(), voiding.getFluidFilterContainer().getFilterWrapper().getFluidFilter() != null); + voidingText(probeInfo, mode, unit, + voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? advanced.getTransferAmount() / 1000 : + advanced.getTransferAmount(), + voiding.getFluidFilterContainer().getFilterWrapper().getFluidFilter() != null); } } @@ -154,7 +169,8 @@ private static void fluidFilterInfo(@Nonnull IProbeInfo probeInfo, @Nonnull Cove * @param enderFluidLink the ender fluid link cover to get data from */ private static void enderFluidLinkInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverEnderFluidLink enderFluidLink) { - transferRateText(probeInfo, enderFluidLink.getPumpMode(), " {*cover.bucket.mode.milli_bucket*}", enderFluidLink.isIOEnabled() ? CoverEnderFluidLink.TRANSFER_RATE : 0); + transferRateText(probeInfo, enderFluidLink.getPumpMode(), " {*cover.bucket.mode.milli_bucket*}", + enderFluidLink.isIOEnabled() ? CoverEnderFluidLink.TRANSFER_RATE : 0); fluidFilterText(probeInfo, enderFluidLink.getFluidFilterContainer().getFilterWrapper().getFluidFilter()); if (!enderFluidLink.getColorStr().isEmpty()) { @@ -162,7 +178,6 @@ private static void enderFluidLinkInfo(@Nonnull IProbeInfo probeInfo, @Nonnull C } } - /** * Displays text for {@link IIOMode} covers * @@ -171,9 +186,11 @@ private static void enderFluidLinkInfo(@Nonnull IProbeInfo probeInfo, @Nonnull C * @param rateUnit the unit of what is transferred * @param rate the transfer rate of the mode */ - private static void transferRateText(@Nonnull IProbeInfo probeInfo, @Nonnull IIOMode mode, @Nonnull String rateUnit, int rate) { + private static void transferRateText(@Nonnull IProbeInfo probeInfo, @Nonnull IIOMode mode, @Nonnull String rateUnit, + int rate) { String modeText = mode.isImport() ? "{*gregtech.top.mode.import*} " : "{*gregtech.top.mode.export*} "; - probeInfo.text(TextStyleClass.OK + modeText + TextStyleClass.LABEL + TextFormattingUtil.formatNumbers(rate) + rateUnit); + probeInfo.text(TextStyleClass.OK + modeText + TextStyleClass.LABEL + TextFormattingUtil.formatNumbers(rate) + + rateUnit); } /** @@ -185,7 +202,8 @@ private static void transferRateText(@Nonnull IProbeInfo probeInfo, @Nonnull IIO * @param rate the transfer rate of the mode * @param hasFilter whether the cover has a filter installed */ - private static void transferModeText(@Nonnull IProbeInfo probeInfo, @Nonnull TransferMode mode, @Nonnull String rateUnit, int rate, boolean hasFilter) { + private static void transferModeText(@Nonnull IProbeInfo probeInfo, @Nonnull TransferMode mode, + @Nonnull String rateUnit, int rate, boolean hasFilter) { String text = TextStyleClass.OK + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC; if (!hasFilter && mode != TransferMode.TRANSFER_ANY) text += TextStyleClass.LABEL + " " + rate + rateUnit; probeInfo.text(text); @@ -200,7 +218,8 @@ private static void transferModeText(@Nonnull IProbeInfo probeInfo, @Nonnull Tra * @param amount the transfer rate of the mode * @param hasFilter whether the cover has a filter in it or not */ - private static void voidingText(@Nonnull IProbeInfo probeInfo, @Nonnull VoidingMode mode, @Nonnull String unit, int amount, boolean hasFilter) { + private static void voidingText(@Nonnull IProbeInfo probeInfo, @Nonnull VoidingMode mode, @Nonnull String unit, + int amount, boolean hasFilter) { String text = TextFormatting.RED + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC; if (mode != VoidingMode.VOID_ANY && !hasFilter) text += " " + amount + unit; probeInfo.text(text); @@ -228,7 +247,8 @@ private static void itemFilterText(@Nonnull IProbeInfo probeInfo, @Nullable Item String expression = ((OreDictionaryItemFilter) filter).getExpression(); if (!expression.isEmpty()) probeInfo.text(label + expression); } else if (filter instanceof SmartItemFilter) { - probeInfo.text(label + IProbeInfo.STARTLOC + ((SmartItemFilter) filter).getFilteringMode().getName() + IProbeInfo.ENDLOC); + probeInfo.text(label + IProbeInfo.STARTLOC + ((SmartItemFilter) filter).getFilteringMode().getName() + + IProbeInfo.ENDLOC); } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/DiodeInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/DiodeInfoProvider.java index a5a09fb7a9b..3896aff8dc5 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/DiodeInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/DiodeInfoProvider.java @@ -4,13 +4,15 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.metatileentities.electric.MetaTileEntityDiode; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class DiodeInfoProvider extends ElectricContainerInfoProvider { @@ -21,16 +23,19 @@ public String getID() { } @Override - protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, + EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { if (tileEntity instanceof IGregTechTileEntity) { MetaTileEntity metaTileEntity = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); if (metaTileEntity instanceof MetaTileEntityDiode) { if (capability.inputsEnergy(data.getSideHit())) { - probeInfo.text(TextStyleClass.INFO + TextFormatting.GOLD.toString() - + "{*gregtech.top.transform_input*} " + TextFormatting.RESET + capability.getInputAmperage() + " A"); + probeInfo.text( + TextStyleClass.INFO + TextFormatting.GOLD.toString() + "{*gregtech.top.transform_input*} " + + TextFormatting.RESET + capability.getInputAmperage() + " A"); } else if (capability.outputsEnergy(data.getSideHit())) { - probeInfo.text(TextStyleClass.INFO + TextFormatting.BLUE.toString() - + "{*gregtech.top.transform_output*} " + TextFormatting.RESET + capability.getOutputAmperage() + " A"); + probeInfo.text(TextStyleClass.INFO + TextFormatting.BLUE.toString() + + "{*gregtech.top.transform_output*} " + TextFormatting.RESET + + capability.getOutputAmperage() + " A"); } } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/ElectricContainerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/ElectricContainerInfoProvider.java index 0367553191e..40e4e96cab9 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/ElectricContainerInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/ElectricContainerInfoProvider.java @@ -3,12 +3,14 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IEnergyContainer; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; + import javax.annotation.Nonnull; public class ElectricContainerInfoProvider extends CapabilityInfoProvider { @@ -30,7 +32,8 @@ protected boolean allowDisplaying(@Nonnull IEnergyContainer capability) { } @Override - protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, + EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { long maxStorage = capability.getEnergyCapacity(); if (maxStorage == 0) return; // do not add empty max storage progress bar probeInfo.progress(capability.getEnergyStored(), maxStorage, probeInfo.defaultProgressStyle() @@ -39,5 +42,4 @@ protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProb .alternateFilledColor(0xFFEEE600) .borderColor(0xFF555555)); } - } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java index d6340587d22..d6170974374 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java @@ -5,13 +5,15 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.pipenet.longdist.ILDEndpoint; import gregtech.api.pipenet.longdist.LongDistanceNetwork; -import mcjty.theoneprobe.api.*; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import mcjty.theoneprobe.api.*; + import javax.annotation.Nonnull; public class LDPipeProvider implements IProbeInfoProvider { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/LampInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/LampInfoProvider.java index 4bf6dc3a01a..5c6e9571ca7 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/LampInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/LampInfoProvider.java @@ -2,13 +2,15 @@ import gregtech.api.GTValues; import gregtech.common.blocks.BlockLamp; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.IProbeInfoProvider; import mcjty.theoneprobe.api.ProbeMode; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; public class LampInfoProvider implements IProbeInfoProvider { @@ -18,7 +20,8 @@ public String getID() { } @Override - public void addProbeInfo(ProbeMode mode, IProbeInfo info, EntityPlayer player, World world, IBlockState state, IProbeHitData hitData) { + public void addProbeInfo(ProbeMode mode, IProbeInfo info, EntityPlayer player, World world, IBlockState state, + IProbeHitData hitData) { if (state.getBlock() instanceof BlockLamp) { BlockLamp lamp = (BlockLamp) state.getBlock(); boolean inverted = lamp.isInverted(state); diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/LaserContainerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/LaserContainerInfoProvider.java index 4125fafec59..922bee89460 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/LaserContainerInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/LaserContainerInfoProvider.java @@ -3,16 +3,19 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.ILaserContainer; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; + +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; public class LaserContainerInfoProvider extends CapabilityInfoProvider { + @NotNull @Override protected Capability getCapability() { @@ -25,7 +28,8 @@ protected boolean allowDisplaying(@Nonnull ILaserContainer capability) { } @Override - protected void addProbeInfo(ILaserContainer capability, IProbeInfo probeInfo, EntityPlayer player, TileEntity tileEntity, IProbeHitData data) { + protected void addProbeInfo(ILaserContainer capability, IProbeInfo probeInfo, EntityPlayer player, + TileEntity tileEntity, IProbeHitData data) { long maxStorage = capability.getEnergyCapacity(); if (maxStorage == 0) return; // do not add empty max storage progress bar probeInfo.progress(capability.getEnergyStored(), maxStorage, probeInfo.defaultProgressStyle() diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/MaintenanceInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/MaintenanceInfoProvider.java index c6bc9ed0ddb..09a95a16bc1 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/MaintenanceInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/MaintenanceInfoProvider.java @@ -7,16 +7,18 @@ import gregtech.api.unification.material.Materials; import gregtech.common.ConfigHolder; import gregtech.common.items.ToolItems; -import mcjty.theoneprobe.api.ElementAlignment; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.ElementAlignment; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class MaintenanceInfoProvider extends CapabilityInfoProvider { @@ -40,17 +42,20 @@ protected Capability getCapability() { } @Override - protected void addProbeInfo(IMaintenance capability, IProbeInfo probeInfo, EntityPlayer player, TileEntity tileEntity, IProbeHitData data) { + protected void addProbeInfo(IMaintenance capability, IProbeInfo probeInfo, EntityPlayer player, + TileEntity tileEntity, IProbeHitData data) { if (ConfigHolder.machines.enableMaintenance && capability.hasMaintenanceMechanics()) { if (tileEntity.hasCapability(GregtechCapabilities.CAPABILITY_MULTIBLOCK_CONTROLLER, null)) { - //noinspection ConstantConditions - if (tileEntity.getCapability(GregtechCapabilities.CAPABILITY_MULTIBLOCK_CONTROLLER, null).isStructureFormed()) { + // noinspection ConstantConditions + if (tileEntity.getCapability(GregtechCapabilities.CAPABILITY_MULTIBLOCK_CONTROLLER, null) + .isStructureFormed()) { if (capability.hasMaintenanceProblems()) { if (player.isSneaking()) { int problems = capability.getMaintenanceProblems(); for (byte i = 0; i < 6; i++) { if (((problems >> i) & 1) == 0) { - IProbeInfo horizontal = probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)); + IProbeInfo horizontal = probeInfo.horizontal( + probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)); ItemStack stack = ItemStack.EMPTY; String text = ""; switch (i) { @@ -85,7 +90,8 @@ protected void addProbeInfo(IMaintenance capability, IProbeInfo probeInfo, Entit break; } } - horizontal.item(stack).text(TextFormatting.RED + IProbeInfo.STARTLOC + text + IProbeInfo.ENDLOC); + horizontal.item(stack) + .text(TextFormatting.RED + IProbeInfo.STARTLOC + text + IProbeInfo.ENDLOC); } } } else { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/MultiRecipeMapInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/MultiRecipeMapInfoProvider.java index 081a395039e..a26817af470 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/MultiRecipeMapInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/MultiRecipeMapInfoProvider.java @@ -4,13 +4,15 @@ import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IMultipleRecipeMaps; import gregtech.api.recipes.RecipeMap; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class MultiRecipeMapInfoProvider extends CapabilityInfoProvider { @@ -27,10 +29,13 @@ protected Capability getCapability() { } @Override - protected void addProbeInfo(@Nonnull IMultipleRecipeMaps iMultipleRecipeMaps, @Nonnull IProbeInfo iProbeInfo, @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull IMultipleRecipeMaps iMultipleRecipeMaps, @Nonnull IProbeInfo iProbeInfo, + @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, + @Nonnull IProbeHitData data) { if (iMultipleRecipeMaps.getAvailableRecipeMaps().length == 1) return; - iProbeInfo.text(TextStyleClass.INFO + IProbeInfo.STARTLOC + "gregtech.multiblock.multiple_recipemaps.header" + IProbeInfo.ENDLOC); + iProbeInfo.text(TextStyleClass.INFO + IProbeInfo.STARTLOC + "gregtech.multiblock.multiple_recipemaps.header" + + IProbeInfo.ENDLOC); for (RecipeMap recipeMap : iMultipleRecipeMaps.getAvailableRecipeMaps()) { if (recipeMap.equals(iMultipleRecipeMaps.getCurrentRecipeMap())) { iProbeInfo.text(" " + TextStyleClass.INFOIMP + "{*" + recipeMap.getTranslationKey() + "*} {*<*}"); diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/MultiblockInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/MultiblockInfoProvider.java index 5c44a447411..82e36f8ce2a 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/MultiblockInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/MultiblockInfoProvider.java @@ -3,14 +3,16 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IMultiblockController; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class MultiblockInfoProvider extends CapabilityInfoProvider { @@ -27,7 +29,9 @@ protected Capability getCapability() { } @Override - protected void addProbeInfo(@Nonnull IMultiblockController capability, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull IMultiblockController capability, @Nonnull IProbeInfo probeInfo, + @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, + @Nonnull IProbeHitData data) { if (capability.isStructureFormed()) { probeInfo.text(TextStyleClass.OK + "{*gregtech.top.valid_structure*}"); if (capability.isStructureObstructed()) { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/PrimitivePumpInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/PrimitivePumpInfoProvider.java index 8201544092c..94d253c514b 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/PrimitivePumpInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/PrimitivePumpInfoProvider.java @@ -4,13 +4,15 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IPrimitivePump; -import mcjty.theoneprobe.api.*; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; +import mcjty.theoneprobe.api.*; + import javax.annotation.Nonnull; public class PrimitivePumpInfoProvider implements IProbeInfoProvider { @@ -21,14 +23,17 @@ public String getID() { } @Override - public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { + public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, + @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { if (blockState.getBlock().hasTileEntity(blockState)) { TileEntity tileEntity = world.getTileEntity(data.getPos()); if (!(tileEntity instanceof IGregTechTileEntity)) return; MetaTileEntity metaTileEntity = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); if (metaTileEntity instanceof IPrimitivePump) { - probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.primitive_pump_production*} " + TextFormatting.AQUA + ((IPrimitivePump) metaTileEntity).getFluidProduction() + TextFormatting.RESET + " L/s"); + probeInfo.text( + TextStyleClass.INFO + "{*gregtech.top.primitive_pump_production*} " + TextFormatting.AQUA + + ((IPrimitivePump) metaTileEntity).getFluidProduction() + TextFormatting.RESET + " L/s"); } } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java index b999a84cbeb..7bee7e657bc 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java @@ -11,14 +11,16 @@ import gregtech.api.unification.material.Materials; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.multi.MetaTileEntityLargeBoiler; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class RecipeLogicInfoProvider extends CapabilityInfoProvider { @@ -35,7 +37,9 @@ protected Capability getCapability() { } @Override - protected void addProbeInfo(@Nonnull AbstractRecipeLogic capability, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull AbstractRecipeLogic capability, @Nonnull IProbeInfo probeInfo, + @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, + @Nonnull IProbeHitData data) { // do not show energy usage on machines that do not use energy if (capability.isWorking()) { if (capability instanceof PrimitiveRecipeLogic) { @@ -48,13 +52,17 @@ protected void addProbeInfo(@Nonnull AbstractRecipeLogic capability, @Nonnull IP if (tileEntity instanceof IGregTechTileEntity) { IGregTechTileEntity gtTileEntity = (IGregTechTileEntity) tileEntity; MetaTileEntity mte = gtTileEntity.getMetaTileEntity(); - if (mte instanceof SteamMetaTileEntity || mte instanceof MetaTileEntityLargeBoiler || mte instanceof RecipeMapSteamMultiblockController) { - text = TextFormatting.AQUA.toString() + absEUt + TextStyleClass.INFO + " L/t {*" + Materials.Steam.getUnlocalizedName() + "*}"; + if (mte instanceof SteamMetaTileEntity || mte instanceof MetaTileEntityLargeBoiler || + mte instanceof RecipeMapSteamMultiblockController) { + text = TextFormatting.AQUA.toString() + absEUt + TextStyleClass.INFO + " L/t {*" + + Materials.Steam.getUnlocalizedName() + "*}"; } } if (text == null) { - // Default behavior, if this TE is not a steam machine (or somehow not instanceof IGregTechTileEntity...) - text = TextFormatting.RED.toString() + absEUt + TextStyleClass.INFO + " EU/t" + TextFormatting.GREEN + " (" + GTValues.VNF[GTUtility.getTierByVoltage(absEUt)] + TextFormatting.GREEN + ")"; + // Default behavior, if this TE is not a steam machine (or somehow not instanceof + // IGregTechTileEntity...) + text = TextFormatting.RED.toString() + absEUt + TextStyleClass.INFO + " EU/t" + TextFormatting.GREEN + + " (" + GTValues.VNF[GTUtility.getTierByVoltage(absEUt)] + TextFormatting.GREEN + ")"; } if (EUt == 0) return; // idk what to do for 0 eut diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/SteamBoilerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/SteamBoilerInfoProvider.java index 2ee863d7d82..4ccdc7125d0 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/SteamBoilerInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/SteamBoilerInfoProvider.java @@ -5,13 +5,15 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.unification.material.Materials; import gregtech.common.metatileentities.steam.boiler.SteamBoiler; -import mcjty.theoneprobe.api.*; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; +import mcjty.theoneprobe.api.*; + public class SteamBoilerInfoProvider implements IProbeInfoProvider { @Override @@ -20,7 +22,8 @@ public String getID() { } @Override - public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState state, IProbeHitData data) { + public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState state, + IProbeHitData data) { if (state.getBlock().hasTileEntity(state)) { TileEntity te = world.getTileEntity(data.getPos()); if (te instanceof IGregTechTileEntity igtte) { @@ -32,16 +35,15 @@ public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer play // Creating steam if (steamOutput > 0 && boiler.hasWater()) { - probeInfo.text(TextStyleClass.INFO - + "{*gregtech.top.energy_production*} " - + TextFormatting.AQUA + (steamOutput / 10) - + TextStyleClass.INFO + " L/t" - + " {*" + Materials.Steam.getUnlocalizedName() + "*}"); + probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.energy_production*} " + + TextFormatting.AQUA + (steamOutput / 10) + TextStyleClass.INFO + " L/t" + " {*" + + Materials.Steam.getUnlocalizedName() + "*}"); } // Initial heat-up if (steamOutput <= 0) { - probeInfo.text(TextStyleClass.INFO.toString() + TextFormatting.RED + "{*gregtech.top.steam_heating_up*}"); + probeInfo.text(TextStyleClass.INFO.toString() + TextFormatting.RED + + "{*gregtech.top.steam_heating_up*}"); } // No water diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java index 55881670f62..774de2cb1d0 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java @@ -6,13 +6,15 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.electric.MetaTileEntityTransformer; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class TransformerInfoProvider extends ElectricContainerInfoProvider { @@ -23,7 +25,8 @@ public String getID() { } @Override - protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, + EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { if (tileEntity instanceof IGregTechTileEntity) { MetaTileEntity metaTileEntity = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); if (metaTileEntity instanceof MetaTileEntityTransformer) { @@ -42,18 +45,19 @@ protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProb .append("A)"); // Step Up/Step Down line - probeInfo.text(TextStyleClass.INFO + (((MetaTileEntityTransformer) metaTileEntity).isInverted() - ? TextFormatting.RED + "{*gregtech.top.transform_up*} " + TextFormatting.RESET - : TextFormatting.GREEN + "{*gregtech.top.transform_down*} " + TextFormatting.RESET) - + input + " -> " + output); + probeInfo.text(TextStyleClass.INFO + + (((MetaTileEntityTransformer) metaTileEntity).isInverted() ? + TextFormatting.RED + "{*gregtech.top.transform_up*} " + TextFormatting.RESET : + TextFormatting.GREEN + "{*gregtech.top.transform_down*} " + TextFormatting.RESET) + + input + " -> " + output); // Input/Output side line if (capability.inputsEnergy(data.getSideHit())) { - probeInfo.text(TextStyleClass.INFO - + TextFormatting.GOLD.toString() + "{*gregtech.top.transform_input*} " + TextFormatting.RESET + input); + probeInfo.text(TextStyleClass.INFO + TextFormatting.GOLD.toString() + + "{*gregtech.top.transform_input*} " + TextFormatting.RESET + input); } else if (capability.outputsEnergy(data.getSideHit())) { - probeInfo.text(TextStyleClass.INFO - + TextFormatting.BLUE.toString() + "{*gregtech.top.transform_output*} " + TextFormatting.RESET + output); + probeInfo.text(TextStyleClass.INFO + TextFormatting.BLUE.toString() + + "{*gregtech.top.transform_output*} " + TextFormatting.RESET + output); } } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/WorkableInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/WorkableInfoProvider.java index c7bd37ca686..966498a355d 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/WorkableInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/WorkableInfoProvider.java @@ -4,12 +4,14 @@ import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IWorkable; import gregtech.api.capability.impl.ComputationRecipeLogic; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; + import javax.annotation.Nonnull; public class WorkableInfoProvider extends CapabilityInfoProvider { @@ -26,7 +28,9 @@ protected Capability getCapability() { } @Override - protected void addProbeInfo(@Nonnull IWorkable capability, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull IWorkable capability, @Nonnull IProbeInfo probeInfo, + @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, + @Nonnull IProbeHitData data) { if (!capability.isActive()) return; int currentProgress = capability.getProgress(); diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugPipeNetInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugPipeNetInfoProvider.java index 2817069299c..79146b737db 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugPipeNetInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugPipeNetInfoProvider.java @@ -8,27 +8,32 @@ import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.pipenet.tile.TileEntityPipeBase; import gregtech.common.ConfigHolder; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.IProbeInfoProvider; -import mcjty.theoneprobe.api.ProbeMode; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import javax.annotation.Nonnull; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.IProbeInfoProvider; +import mcjty.theoneprobe.api.ProbeMode; + import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + public class DebugPipeNetInfoProvider implements IProbeInfoProvider { + @Override public String getID() { return "gregtech:debug_pipe_net_provider"; } @Override - public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { + public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, + @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { if (ConfigHolder.misc.debug) { TileEntity tileEntity = world.getTileEntity(data.getPos()); if (tileEntity instanceof IGregTechTileEntity) { @@ -57,11 +62,11 @@ public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, probeInfo.text(builder.toString()); } probeInfo.text("tile open: " + pipeTile.getConnections()); -// if (blockPipe instanceof BlockFluidPipe) { -// if (pipeTile instanceof TileEntityFluidPipeTickable) { -// probeInfo.text("tile active: " + ((TileEntityFluidPipeTickable) pipeTile).isActive()); -// } -// } + // if (blockPipe instanceof BlockFluidPipe) { + // if (pipeTile instanceof TileEntityFluidPipeTickable) { + // probeInfo.text("tile active: " + ((TileEntityFluidPipeTickable) pipeTile).isActive()); + // } + // } } } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugTickTimeProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugTickTimeProvider.java index b9bcf38846b..2cab557888c 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugTickTimeProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugTickTimeProvider.java @@ -3,15 +3,17 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.util.TextFormattingUtil; import gregtech.common.ConfigHolder; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.IProbeInfoProvider; -import mcjty.theoneprobe.api.ProbeMode; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.IProbeInfoProvider; +import mcjty.theoneprobe.api.ProbeMode; + public class DebugTickTimeProvider implements IProbeInfoProvider { @Override @@ -20,7 +22,8 @@ public String getID() { } @Override - public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) { + public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, + IBlockState blockState, IProbeHitData data) { if (ConfigHolder.misc.debug) { TileEntity tile = world.getTileEntity(data.getPos()); if (tile instanceof MetaTileEntityHolder holder) { @@ -30,7 +33,9 @@ public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer play double worstTickTime = timeStatistics[1]; // this is for dev environment debug, so don't worry about translating - probeInfo.text("Average: " + TextFormattingUtil.formatNumbers(averageTickTime / MetaTileEntityHolder.TRACKED_TICKS) + "ns"); + probeInfo.text("Average: " + + TextFormattingUtil.formatNumbers(averageTickTime / MetaTileEntityHolder.TRACKED_TICKS) + + "ns"); probeInfo.text("Worst: " + TextFormattingUtil.formatNumbers(worstTickTime) + "ns"); } } diff --git a/src/main/java/gregtech/integration/xaero/ColorUtility.java b/src/main/java/gregtech/integration/xaero/ColorUtility.java index 043ffc1423f..5b365c20b6b 100644 --- a/src/main/java/gregtech/integration/xaero/ColorUtility.java +++ b/src/main/java/gregtech/integration/xaero/ColorUtility.java @@ -2,17 +2,20 @@ import java.awt.*; -// **************************************************************************************** -/** Utilities for converting between various colour spaces. Note that the default scaling - * for RGB is 0-1 and hue is expressed as degrees (0-360). For other values, see - * documentation for each conversion routine. - * @author Jo Wood,giCentre, City University London. Includes modified code from Duane - * Schwartzwald and Harry Parker. - * @version 3.4, 5th February, 2016. +// **************************************************************************************** +/** + * Utilities for converting between various colour spaces. Note that the default scaling + * for RGB is 0-1 and hue is expressed as degrees (0-360). For other values, see + * documentation for each conversion routine. + * + * @author Jo Wood,giCentre, City University London. Includes modified code from Duane + * Schwartzwald and Harry Parker. + * @version 3.4, 5th February, 2016. */ // ***************************************************************************************** -/* This file is part of giCentre utilities library. gicentre.utils is free software: you can +/* + * This file is part of giCentre utilities library. gicentre.utils 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. @@ -27,6 +30,7 @@ */ public class ColorUtility { + public enum WhitePoint { // Tristimulus values taken from Schanda, J. (19xx) Colorimetry, p.74 @@ -54,7 +58,7 @@ public enum WhitePoint { private double[] params; private WhitePoint(double X, double Y, double Z) { - params = new double[]{X, Y, Z}; + params = new double[] { X, Y, Z }; } /** @@ -67,13 +71,12 @@ private WhitePoint(double X, double Y, double Z) { } } - /** * sRGB to XYZ conversion matrix (3x3) */ - static final double[][] M = {{0.4124, 0.3576, 0.1805}, // RX, GX, BX - {0.2126, 0.7152, 0.0722}, // RY, GY, BY - {0.0193, 0.1192, 0.9505}}; // RZ, GZ, BZ + static final double[][] M = { { 0.4124, 0.3576, 0.1805 }, // RX, GX, BX + { 0.2126, 0.7152, 0.0722 }, // RY, GY, BY + { 0.0193, 0.1192, 0.9505 } }; // RZ, GZ, BZ /** * Finds the CIELab triplet representing the given colour. CIELab L value scaled between 0-100, @@ -98,7 +101,7 @@ static double[] RGBtoXYZ(Color colour) { double r = colour.getRed() / 255.0; double g = colour.getGreen() / 255.0; double b = colour.getBlue() / 255.0; - return RGBtoXYZ(new double[]{r, g, b}); + return RGBtoXYZ(new double[] { r, g, b }); } /** @@ -163,7 +166,6 @@ static double[] XYZtoLAB(double[] XYZ, WhitePoint wp) { z = (7.787 * z) + (16.0 / 116.0); } - return new double[]{116 * y - 16, 500 * (x - y), 200 * (y - z)}; + return new double[] { 116 * y - 16, 500 * (x - y), 200 * (y - z) }; } - } diff --git a/src/main/java/gregtech/loaders/MaterialInfoLoader.java b/src/main/java/gregtech/loaders/MaterialInfoLoader.java index b890c2e731e..7808074a400 100644 --- a/src/main/java/gregtech/loaders/MaterialInfoLoader.java +++ b/src/main/java/gregtech/loaders/MaterialInfoLoader.java @@ -9,6 +9,7 @@ import gregtech.common.blocks.BlockWireCoil.CoilType; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.loaders.recipe.WoodRecipeLoader; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -113,7 +114,6 @@ public static void init() { new MaterialStack(Materials.Europium, M), // single cable new MaterialStack(Materials.Rubber, M * 2))); // plate - OreDictUnifier.registerOre(MetaTileEntities.ENERGY_INPUT_HATCH[3].getStackForm(), new ItemMaterialInfo( new MaterialStack(Materials.StainlessSteel, M * 8), // plate new MaterialStack(Materials.Gold, M * 2), // single cable @@ -162,32 +162,60 @@ public static void init() { new MaterialStack(Materials.NeodymiumMagnetic, M / 2) // rod )); - OreDictUnifier.registerOre(MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.PLASCRETE), new ItemMaterialInfo( - new MaterialStack(Materials.Steel, (M * 2) / ConfigHolder.recipes.casingsPerCraft), // frame / config - new MaterialStack(Materials.Polyethylene, (M * 6) / ConfigHolder.recipes.casingsPerCraft), // 6 sheets / config - new MaterialStack(Materials.Concrete, M / ConfigHolder.recipes.casingsPerCraft) // 1 block / config - )); - - OreDictUnifier.registerOre(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.CLEANROOM_GLASS), new ItemMaterialInfo( - new MaterialStack(Materials.Steel, (M * 2) / ConfigHolder.recipes.casingsPerCraft), // frame / config - new MaterialStack(Materials.Polyethylene, (M * 6) / ConfigHolder.recipes.casingsPerCraft), // 6 sheets / config - new MaterialStack(Materials.Glass, M / ConfigHolder.recipes.casingsPerCraft) // 1 block / config - )); - - OreDictUnifier.registerOre(MetaBlocks.METAL_CASING.getItemVariant(BlockMetalCasing.MetalCasingType.PTFE_INERT_CASING), new ItemMaterialInfo( - new MaterialStack(Materials.Steel, (M * 8) / ConfigHolder.recipes.casingsPerCraft), // casing / config - new MaterialStack(Materials.Polytetrafluoroethylene, M * 3 / 2) // 1.5 ingots PTFE (fluid in recipe) - )); - - OreDictUnifier.registerOre(MetaBlocks.METAL_CASING.getItemVariant(BlockMetalCasing.MetalCasingType.PRIMITIVE_BRICKS), new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M * 4))); + OreDictUnifier.registerOre( + MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.PLASCRETE), + new ItemMaterialInfo( + new MaterialStack(Materials.Steel, (M * 2) / ConfigHolder.recipes.casingsPerCraft), // frame / + // config + new MaterialStack(Materials.Polyethylene, (M * 6) / ConfigHolder.recipes.casingsPerCraft), // 6 + // sheets + // / + // config + new MaterialStack(Materials.Concrete, M / ConfigHolder.recipes.casingsPerCraft) // 1 block / + // config + )); + + OreDictUnifier.registerOre( + MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.CLEANROOM_GLASS), + new ItemMaterialInfo( + new MaterialStack(Materials.Steel, (M * 2) / ConfigHolder.recipes.casingsPerCraft), // frame / + // config + new MaterialStack(Materials.Polyethylene, (M * 6) / ConfigHolder.recipes.casingsPerCraft), // 6 + // sheets + // / + // config + new MaterialStack(Materials.Glass, M / ConfigHolder.recipes.casingsPerCraft) // 1 block / config + )); + + OreDictUnifier.registerOre( + MetaBlocks.METAL_CASING.getItemVariant(BlockMetalCasing.MetalCasingType.PTFE_INERT_CASING), + new ItemMaterialInfo( + new MaterialStack(Materials.Steel, (M * 8) / ConfigHolder.recipes.casingsPerCraft), // casing / + // config + new MaterialStack(Materials.Polytetrafluoroethylene, M * 3 / 2) // 1.5 ingots PTFE (fluid in + // recipe) + )); + + OreDictUnifier.registerOre( + MetaBlocks.METAL_CASING.getItemVariant(BlockMetalCasing.MetalCasingType.PRIMITIVE_BRICKS), + new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M * 4))); + + OreDictUnifier.registerOre( + MetaBlocks.BATTERY_BLOCK.getItemVariant(BlockBatteryPart.BatteryPartType.EMPTY_TIER_I), + new ItemMaterialInfo( + new MaterialStack(Materials.Ultimet, M * 2 + M * 6 + (M / 9 * 24)))); // frame + 6 plates + 24 + // screws + OreDictUnifier.registerOre( + MetaBlocks.BATTERY_BLOCK.getItemVariant(BlockBatteryPart.BatteryPartType.EMPTY_TIER_II), + new ItemMaterialInfo( + new MaterialStack(Materials.Ruridit, M * 2 + M * 6 + (M / 9 * 24)))); // frame + 6 plates + 24 + // screws + OreDictUnifier.registerOre( + MetaBlocks.BATTERY_BLOCK.getItemVariant(BlockBatteryPart.BatteryPartType.EMPTY_TIER_III), + new ItemMaterialInfo( + new MaterialStack(Materials.Neutronium, M * 2 + M * 6 + (M / 9 * 24)))); // frame + 6 plates + + // 24 screws - OreDictUnifier.registerOre(MetaBlocks.BATTERY_BLOCK.getItemVariant(BlockBatteryPart.BatteryPartType.EMPTY_TIER_I), new ItemMaterialInfo( - new MaterialStack(Materials.Ultimet, M * 2 + M * 6 + (M / 9 * 24)))); // frame + 6 plates + 24 screws - OreDictUnifier.registerOre(MetaBlocks.BATTERY_BLOCK.getItemVariant(BlockBatteryPart.BatteryPartType.EMPTY_TIER_II), new ItemMaterialInfo( - new MaterialStack(Materials.Ruridit, M * 2 + M * 6 + (M / 9 * 24)))); // frame + 6 plates + 24 screws - OreDictUnifier.registerOre(MetaBlocks.BATTERY_BLOCK.getItemVariant(BlockBatteryPart.BatteryPartType.EMPTY_TIER_III), new ItemMaterialInfo( - new MaterialStack(Materials.Neutronium, M * 2 + M * 6 + (M / 9 * 24)))); // frame + 6 plates + 24 screws - OreDictUnifier.registerOre(LONG_DIST_ITEM_ENDPOINT.getStackForm(), new ItemMaterialInfo(new MaterialStack(Tin, M * 6), // large pipe new MaterialStack(Steel, M * 8))); // 4 plates + 1 gear @@ -209,94 +237,160 @@ public static void init() { new MaterialStack(Materials.Iron, M * 4 + (M * 3 / 16)), // 4 iron plates + 1 iron bars new MaterialStack(Materials.Steel, M / 9))); // tiny steel dust } else { - OreDictUnifier.registerOre(new ItemStack(Items.IRON_DOOR, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_DOOR, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2))); } - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small - OreDictUnifier.registerOre(new ItemStack(Blocks.SANDSTONE_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small - OreDictUnifier.registerOre(new ItemStack(Blocks.RED_SANDSTONE_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_BRICK_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small - OreDictUnifier.registerOre(new ItemStack(Blocks.QUARTZ_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.NetherQuartz, M * 6))); // dust - OreDictUnifier.registerOre(new ItemStack(Blocks.BRICK_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Brick, M * 6))); // dust - OreDictUnifier.registerOre(new ItemStack(Blocks.NETHER_BRICK_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Netherrack, M * 6))); // dust - - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 0), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 2), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 3), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 4), new ItemMaterialInfo(new MaterialStack(Materials.Brick, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 5), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 6), new ItemMaterialInfo(new MaterialStack(Materials.Netherrack, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 7), new ItemMaterialInfo(new MaterialStack(Materials.NetherQuartz, M * 2))); - - OreDictUnifier.registerOre(new ItemStack(Blocks.LEVER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 9), new MaterialStack(Materials.Wood, 1814400L))); - OreDictUnifier.registerOre(new ItemStack(Blocks.WOODEN_BUTTON, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M / 9))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_BUTTON, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 9))); - OreDictUnifier.registerOre(new ItemStack(Blocks.REDSTONE_TORCH, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M / 2), new MaterialStack(Materials.Redstone, M))); - - OreDictUnifier.registerOre(new ItemStack(Blocks.RAIL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3 / 16))); - OreDictUnifier.registerOre(new ItemStack(Blocks.GOLDEN_RAIL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.DETECTOR_RAIL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.ACTIVATOR_RAIL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small + OreDictUnifier.registerOre(new ItemStack(Blocks.SANDSTONE_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small + OreDictUnifier.registerOre(new ItemStack(Blocks.RED_SANDSTONE_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_BRICK_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small + OreDictUnifier.registerOre(new ItemStack(Blocks.QUARTZ_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.NetherQuartz, M * 6))); // dust + OreDictUnifier.registerOre(new ItemStack(Blocks.BRICK_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Brick, M * 6))); // dust + OreDictUnifier.registerOre(new ItemStack(Blocks.NETHER_BRICK_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Netherrack, M * 6))); // dust + + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 0), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 2), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 3), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 4), + new ItemMaterialInfo(new MaterialStack(Materials.Brick, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 5), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 6), + new ItemMaterialInfo(new MaterialStack(Materials.Netherrack, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 7), + new ItemMaterialInfo(new MaterialStack(Materials.NetherQuartz, M * 2))); + + OreDictUnifier.registerOre(new ItemStack(Blocks.LEVER, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M / 9), new MaterialStack(Materials.Wood, 1814400L))); + OreDictUnifier.registerOre(new ItemStack(Blocks.WOODEN_BUTTON, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M / 9))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_BUTTON, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 9))); + OreDictUnifier.registerOre(new ItemStack(Blocks.REDSTONE_TORCH, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M / 2), new MaterialStack(Materials.Redstone, M))); + + OreDictUnifier.registerOre(new ItemStack(Blocks.RAIL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3 / 16))); + OreDictUnifier.registerOre(new ItemStack(Blocks.GOLDEN_RAIL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.DETECTOR_RAIL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.ACTIVATOR_RAIL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M / 2))); if (ConfigHolder.recipes.hardRedstoneRecipes) { - OreDictUnifier.registerOre(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M), new MaterialStack(Materials.Iron, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M), new MaterialStack(Materials.Iron, M * 6 / 8))); - OreDictUnifier.registerOre(new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M), new MaterialStack(Materials.Steel, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M), new MaterialStack(Materials.Steel, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M), new MaterialStack(Materials.Iron, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_PRESSURE_PLATE, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M), new MaterialStack(Materials.Iron, M * 6 / 8))); + OreDictUnifier.registerOre(new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M), new MaterialStack(Materials.Steel, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M), new MaterialStack(Materials.Steel, M))); } else { - OreDictUnifier.registerOre(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_PRESSURE_PLATE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2))); } - OreDictUnifier.registerOre(new ItemStack(Items.WHEAT, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wheat, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.HAY_BLOCK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wheat, M * 9))); - - OreDictUnifier.registerOre(new ItemStack(Items.SNOWBALL, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Water, M / 4))); - OreDictUnifier.registerOre(new ItemStack(Blocks.SNOW, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Water, M))); - - OreDictUnifier.registerOre(new ItemStack(Blocks.PACKED_ICE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Ice, M * 2))); - - OreDictUnifier.registerOre(new ItemStack(Items.BOOK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 3))); - OreDictUnifier.registerOre(new ItemStack(Items.WRITABLE_BOOK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 3))); - OreDictUnifier.registerOre(new ItemStack(Items.ENCHANTED_BOOK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 3))); - OreDictUnifier.registerOre(new ItemStack(Blocks.BOOKSHELF, 1), new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 9), new MaterialStack(Materials.Wood, M * 6))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_APPLE, 1, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 72))); // block - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_APPLE, 1, 0), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 8))); // ingot - - OreDictUnifier.registerOre(new ItemStack(Items.MINECART, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5))); - OreDictUnifier.registerOre(new ItemStack(Items.CHEST_MINECART, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5), new MaterialStack(Materials.Wood, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.FURNACE_MINECART, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5), new MaterialStack(Materials.Stone, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.TNT_MINECART, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5))); - OreDictUnifier.registerOre(new ItemStack(Items.HOPPER_MINECART, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 10), new MaterialStack(Materials.Wood, M * 8))); - - OreDictUnifier.registerOre(new ItemStack(Items.CAULDRON, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 7))); - OreDictUnifier.registerOre(new ItemStack(Blocks.IRON_BARS, 8, W), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3 / 16))); - OreDictUnifier.registerOre(new ItemStack(Blocks.IRON_TRAPDOOR, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 4))); - OreDictUnifier.registerOre(new ItemStack(Items.BUCKET, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3))); - - OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1, 0), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 31))); - OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 22))); - OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1, 2), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 13))); - OreDictUnifier.registerOre(new ItemStack(Blocks.HOPPER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5), new MaterialStack(Materials.Wood, M * 8))); - - OreDictUnifier.registerOre(new ItemStack(Items.GLASS_BOTTLE), new ItemMaterialInfo(new MaterialStack(Materials.Glass, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STAINED_GLASS, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Glass, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.GLASS, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Glass, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STAINED_GLASS_PANE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Glass, M / 3))); // dust tiny - OreDictUnifier.registerOre(new ItemStack(Blocks.GLASS_PANE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Glass, M / 3))); // dust tiny - - OreDictUnifier.registerOre(new ItemStack(Items.FLOWER_POT, 1), new ItemMaterialInfo(new MaterialStack(Materials.Brick, M * 3))); - OreDictUnifier.registerOre(new ItemStack(Items.PAINTING, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Items.ITEM_FRAME, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.COBBLESTONE_WALL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); - OreDictUnifier.registerOre(new ItemStack(Items.END_CRYSTAL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Glass, M * 7), new MaterialStack(Materials.EnderEye, M))); + OreDictUnifier.registerOre(new ItemStack(Items.WHEAT, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wheat, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.HAY_BLOCK, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wheat, M * 9))); + + OreDictUnifier.registerOre(new ItemStack(Items.SNOWBALL, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Water, M / 4))); + OreDictUnifier.registerOre(new ItemStack(Blocks.SNOW, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Water, M))); + + OreDictUnifier.registerOre(new ItemStack(Blocks.PACKED_ICE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Ice, M * 2))); + + OreDictUnifier.registerOre(new ItemStack(Items.BOOK, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Items.WRITABLE_BOOK, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Items.ENCHANTED_BOOK, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Blocks.BOOKSHELF, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Paper, M * 9), new MaterialStack(Materials.Wood, M * 6))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_APPLE, 1, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 72))); // block + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_APPLE, 1, 0), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 8))); // ingot + + OreDictUnifier.registerOre(new ItemStack(Items.MINECART, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5))); + OreDictUnifier.registerOre(new ItemStack(Items.CHEST_MINECART, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 5), new MaterialStack(Materials.Wood, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.FURNACE_MINECART, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 5), new MaterialStack(Materials.Stone, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.TNT_MINECART, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5))); + OreDictUnifier.registerOre(new ItemStack(Items.HOPPER_MINECART, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 10), new MaterialStack(Materials.Wood, M * 8))); + + OreDictUnifier.registerOre(new ItemStack(Items.CAULDRON, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 7))); + OreDictUnifier.registerOre(new ItemStack(Blocks.IRON_BARS, 8, W), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3 / 16))); + OreDictUnifier.registerOre(new ItemStack(Blocks.IRON_TRAPDOOR, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 4))); + OreDictUnifier.registerOre(new ItemStack(Items.BUCKET, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3))); + + OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1, 0), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 31))); + OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 22))); + OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1, 2), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 13))); + OreDictUnifier.registerOre(new ItemStack(Blocks.HOPPER, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 5), new MaterialStack(Materials.Wood, M * 8))); + + OreDictUnifier.registerOre(new ItemStack(Items.GLASS_BOTTLE), + new ItemMaterialInfo(new MaterialStack(Materials.Glass, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STAINED_GLASS, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Glass, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.GLASS, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Glass, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STAINED_GLASS_PANE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Glass, M / 3))); // dust tiny + OreDictUnifier.registerOre(new ItemStack(Blocks.GLASS_PANE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Glass, M / 3))); // dust tiny + + OreDictUnifier.registerOre(new ItemStack(Items.FLOWER_POT, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Brick, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Items.PAINTING, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Items.ITEM_FRAME, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.COBBLESTONE_WALL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); + OreDictUnifier.registerOre(new ItemStack(Items.END_CRYSTAL, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Glass, M * 7), new MaterialStack(Materials.EnderEye, M))); if (ConfigHolder.recipes.hardToolArmorRecipes) { - OreDictUnifier.registerOre(new ItemStack(Items.CLOCK, 1, W), new ItemMaterialInfo - (new MaterialStack(Materials.Gold, (13 * M) / 8), // M + ring + 3 * bolt + OreDictUnifier.registerOre(new ItemStack(Items.CLOCK, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, (13 * M) / 8), // M + ring + 3 * bolt new MaterialStack(Materials.Redstone, M))); OreDictUnifier.registerOre(new ItemStack(Items.COMPASS, 1, W), new ItemMaterialInfo( @@ -304,8 +398,10 @@ public static void init() { new MaterialStack(Materials.RedAlloy, M / 8), // bolt new MaterialStack(Materials.Zinc, M / 4))); // ring } else { - OreDictUnifier.registerOre(new ItemStack(Items.CLOCK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 4), new MaterialStack(Materials.Redstone, M))); - OreDictUnifier.registerOre(new ItemStack(Items.COMPASS, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 4), new MaterialStack(Materials.Redstone, M))); + OreDictUnifier.registerOre(new ItemStack(Items.CLOCK, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Gold, M * 4), new MaterialStack(Materials.Redstone, M))); + OreDictUnifier.registerOre(new ItemStack(Items.COMPASS, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 4), new MaterialStack(Materials.Redstone, M))); } if (ConfigHolder.recipes.hardMiscRecipes) { @@ -324,93 +420,166 @@ public static void init() { new MaterialStack(Materials.Obsidian, M * 9 * 6), // 6 dense plates new MaterialStack(Materials.EnderEye, M))); } else { - OreDictUnifier.registerOre(new ItemStack(Blocks.BEACON, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.NetherStar, M), new MaterialStack(Materials.Obsidian, M * 3), new MaterialStack(Materials.Glass, M * 5))); - OreDictUnifier.registerOre(new ItemStack(Blocks.ENCHANTING_TABLE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 2), new MaterialStack(Materials.Obsidian, M * 4), new MaterialStack(Materials.Paper, M * 3))); - OreDictUnifier.registerOre(new ItemStack(Blocks.ENDER_CHEST, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.EnderEye, M), new MaterialStack(Materials.Obsidian, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Blocks.BEACON, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.NetherStar, M), + new MaterialStack(Materials.Obsidian, M * 3), new MaterialStack(Materials.Glass, M * 5))); + OreDictUnifier.registerOre(new ItemStack(Blocks.ENCHANTING_TABLE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 2), + new MaterialStack(Materials.Obsidian, M * 4), new MaterialStack(Materials.Paper, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Blocks.ENDER_CHEST, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.EnderEye, M), new MaterialStack(Materials.Obsidian, M * 8))); } - OreDictUnifier.registerOre(new ItemStack(Blocks.FURNACE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONEBRICK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.COBBLESTONE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.MOSSY_COBBLESTONE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.LADDER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M))); - - OreDictUnifier.registerOre(new ItemStack(Items.BOWL, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M / 4))); - OreDictUnifier.registerOre(new ItemStack(Items.SIGN, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.CHEST, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Blocks.TRAPPED_CHEST, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.Iron, M / 2))); // ring + OreDictUnifier.registerOre(new ItemStack(Blocks.FURNACE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONEBRICK, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.COBBLESTONE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.MOSSY_COBBLESTONE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.LADDER, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M))); + + OreDictUnifier.registerOre(new ItemStack(Items.BOWL, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M / 4))); + OreDictUnifier.registerOre(new ItemStack(Items.SIGN, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.CHEST, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Blocks.TRAPPED_CHEST, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.Iron, M / 2))); // ring if (ConfigHolder.recipes.hardMiscRecipes) { - OreDictUnifier.registerOre(new ItemStack(Blocks.NOTEBLOCK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.RedAlloy, M / 2))); // rod + OreDictUnifier.registerOre(new ItemStack(Blocks.NOTEBLOCK, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.RedAlloy, M / 2))); // rod OreDictUnifier.registerOre(new ItemStack(Blocks.JUKEBOX, 1, W), new ItemMaterialInfo( new MaterialStack(Materials.Diamond, M / 8), // bolt new MaterialStack(Materials.Iron, (17 * M) / 4), // gear + ring new MaterialStack(Materials.RedAlloy, M))); } else { - OreDictUnifier.registerOre(new ItemStack(Blocks.NOTEBLOCK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.Redstone, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.JUKEBOX, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.Diamond, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.NOTEBLOCK, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.Redstone, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.JUKEBOX, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.Diamond, M))); } - OreDictUnifier.registerOre(new ItemStack(Blocks.REDSTONE_LAMP, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Glowstone, M * 4), new MaterialStack(Materials.Redstone, M * 4))); // dust - OreDictUnifier.registerOre(new ItemStack(Blocks.CRAFTING_TABLE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.PISTON, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 4), new MaterialStack(Materials.Wood, M * 3))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STICKY_PISTON, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 4), new MaterialStack(Materials.Wood, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Blocks.REDSTONE_LAMP, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Glowstone, M * 4), new MaterialStack(Materials.Redstone, M * 4))); // dust + OreDictUnifier.registerOre(new ItemStack(Blocks.CRAFTING_TABLE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.PISTON, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 4), new MaterialStack(Materials.Wood, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STICKY_PISTON, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 4), new MaterialStack(Materials.Wood, M * 3))); if (ConfigHolder.recipes.hardRedstoneRecipes) { - OreDictUnifier.registerOre(new ItemStack(Blocks.DISPENSER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.RedAlloy, M / 2), new MaterialStack(Materials.Iron, M * 4 + M / 4))); - OreDictUnifier.registerOre(new ItemStack(Blocks.DROPPER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.RedAlloy, M / 2), new MaterialStack(Materials.Iron, M * 2 + M * 3 / 4))); + OreDictUnifier.registerOre(new ItemStack(Blocks.DISPENSER, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), + new MaterialStack(Materials.RedAlloy, M / 2), + new MaterialStack(Materials.Iron, M * 4 + M / 4))); + OreDictUnifier.registerOre(new ItemStack(Blocks.DROPPER, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), + new MaterialStack(Materials.RedAlloy, M / 2), + new MaterialStack(Materials.Iron, M * 2 + M * 3 / 4))); } else { - OreDictUnifier.registerOre(new ItemStack(Blocks.DISPENSER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Redstone, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.DROPPER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Redstone, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.DISPENSER, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Redstone, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.DROPPER, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Redstone, M))); } - OreDictUnifier.registerOre(new ItemStack(Items.IRON_HELMET, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_CHESTPLATE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_LEGGINGS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 7))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_BOOTS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 4))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_HORSE_ARMOR, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_SHOVEL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_PICKAXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_AXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_SWORD, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_HOE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2), new MaterialStack(Materials.Wood, M / 2))); - - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_HELMET, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 5))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_CHESTPLATE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_LEGGINGS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 7))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_BOOTS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 4))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_HORSE_ARMOR, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_SHOVEL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_PICKAXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_AXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_SWORD, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 2), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_HOE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 2), new MaterialStack(Materials.Wood, M / 2))); - - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_HELMET, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 5))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_CHESTPLATE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_LEGGINGS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 7))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_BOOTS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 4))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_HORSE_ARMOR, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_SHOVEL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_PICKAXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_AXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_SWORD, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 2), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_HOE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 2), new MaterialStack(Materials.Wood, M / 2))); - - OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_HELMET, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5 / 4))); - OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_CHESTPLATE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_LEGGINGS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 7 / 4))); - OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_BOOTS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M))); - - OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_SHOVEL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M + M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_PICKAXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 3 + M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_AXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 3 + M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_HOE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2 + M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_SWORD, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2 + M / 4))); - - OreDictUnifier.registerOre(new ItemStack(Items.STONE_SHOVEL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.STONE_PICKAXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.STONE_AXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.STONE_HOE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.STONE_SWORD, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Wood, M / 4))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_HELMET, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_CHESTPLATE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_LEGGINGS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 7))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_BOOTS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 4))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_HORSE_ARMOR, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_SHOVEL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_PICKAXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_AXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_SWORD, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 2), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_HOE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 2), new MaterialStack(Materials.Wood, M / 2))); + + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_HELMET, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 5))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_CHESTPLATE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_LEGGINGS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 7))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_BOOTS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 4))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_HORSE_ARMOR, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_SHOVEL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_PICKAXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Gold, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_AXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Gold, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_SWORD, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Gold, M * 2), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_HOE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Gold, M * 2), new MaterialStack(Materials.Wood, M / 2))); + + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_HELMET, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 5))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_CHESTPLATE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_LEGGINGS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 7))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_BOOTS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 4))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_HORSE_ARMOR, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_SHOVEL, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Diamond, M), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_PICKAXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Diamond, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_AXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Diamond, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_SWORD, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Diamond, M * 2), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_HOE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Diamond, M * 2), new MaterialStack(Materials.Wood, M / 2))); + + OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_HELMET, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5 / 4))); + OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_CHESTPLATE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_LEGGINGS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 7 / 4))); + OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_BOOTS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M))); + + OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_SHOVEL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M + M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_PICKAXE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 3 + M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_AXE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 3 + M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_HOE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2 + M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_SWORD, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2 + M / 4))); + + OreDictUnifier.registerOre(new ItemStack(Items.STONE_SHOVEL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.STONE_PICKAXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.STONE_AXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.STONE_HOE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.STONE_SWORD, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Wood, M / 4))); WoodRecipeLoader.registerUnificationInfo(); } diff --git a/src/main/java/gregtech/loaders/OreDictionaryLoader.java b/src/main/java/gregtech/loaders/OreDictionaryLoader.java index 2ae31b7f12c..b05fba4609b 100644 --- a/src/main/java/gregtech/loaders/OreDictionaryLoader.java +++ b/src/main/java/gregtech/loaders/OreDictionaryLoader.java @@ -12,6 +12,7 @@ import gregtech.api.util.GTLog; import gregtech.common.blocks.MetaBlocks; import gregtech.common.blocks.StoneVariantBlock; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -36,23 +37,27 @@ public static void init() { OreDictUnifier.registerOre(new ItemStack(Blocks.BRICK_BLOCK), OrePrefix.block, Materials.Brick); OreDictUnifier.registerOre(new ItemStack(Items.CLAY_BALL), OrePrefix.ingot, Materials.Clay); OreDictUnifier.registerOre(new ItemStack(Items.FLINT), OrePrefix.gem, Materials.Flint); - OreDictUnifier.registerOre(new ItemStack(Blocks.HARDENED_CLAY, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Clay, M * 4))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Clay, M * 4))); + OreDictUnifier.registerOre(new ItemStack(Blocks.HARDENED_CLAY, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Clay, M * 4))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Clay, M * 4))); - for (Material material : new Material[]{Materials.Wood, Materials.TreatedWood}) { + for (Material material : new Material[] { Materials.Wood, Materials.TreatedWood }) { for (ItemStack woodPlateStack : OreDictUnifier.getAll(new UnificationEntry(OrePrefix.plate, material))) { OreDictUnifier.registerOre(woodPlateStack, OrePrefix.plank, material); } } - for (Material material : new Material[]{Materials.Lapis, Materials.Lazurite, Materials.Sodalite}) { + for (Material material : new Material[] { Materials.Lapis, Materials.Lazurite, Materials.Sodalite }) { OreDictUnifier.registerOre(OreDictUnifier.get(OrePrefix.gem, material), OrePrefix.dye, Color.Blue); OreDictUnifier.registerOre(OreDictUnifier.get(OrePrefix.dust, material), OrePrefix.dye, Color.Blue); } - OreDictUnifier.registerOre(OreDictUnifier.get(OrePrefix.dust, Materials.MetalMixture), OrePrefix.dye, Color.Brown); + OreDictUnifier.registerOre(OreDictUnifier.get(OrePrefix.dust, Materials.MetalMixture), OrePrefix.dye, + Color.Brown); - OreDictUnifier.registerOre(OreDictUnifier.get(OrePrefix.lens, Materials.Glass), OrePrefix.craftingLens, MarkerMaterials.Color.White); + OreDictUnifier.registerOre(OreDictUnifier.get(OrePrefix.lens, Materials.Glass), OrePrefix.craftingLens, + MarkerMaterials.Color.White); OreDictUnifier.registerOre(new ItemStack(Blocks.COAL_ORE), OrePrefix.ore, Materials.Coal); OreDictUnifier.registerOre(new ItemStack(Blocks.IRON_ORE), OrePrefix.ore, Materials.Iron); diff --git a/src/main/java/gregtech/loaders/WoodTypeEntry.java b/src/main/java/gregtech/loaders/WoodTypeEntry.java index 03a293da5ec..5ff9f964344 100644 --- a/src/main/java/gregtech/loaders/WoodTypeEntry.java +++ b/src/main/java/gregtech/loaders/WoodTypeEntry.java @@ -1,12 +1,14 @@ package gregtech.loaders; -import com.google.common.base.Preconditions; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.UnificationEntry; + import net.minecraft.item.ItemStack; +import com.google.common.base.Preconditions; + import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -408,7 +410,8 @@ public Builder registerUnificationInfo(boolean planks, boolean door, boolean sla public WoodTypeEntry build() { Preconditions.checkArgument(!planks.isEmpty(), "Planks cannot be empty."); return new WoodTypeEntry(modid, woodName, log, removeCharcoalRecipe, addCharcoalRecipe, planks, - planksRecipeName, door, doorRecipeName, slab, slabRecipeName, addSlabsCraftingRecipe, fence, fenceRecipeName, + planksRecipeName, door, doorRecipeName, slab, slabRecipeName, addSlabsCraftingRecipe, fence, + fenceRecipeName, fenceGate, fenceGateRecipeName, stairs, addStairsCraftingRecipe, boat, boatRecipeName, material, addLogOreDict, addPlanksOreDict, addDoorsOreDict, addSlabsOreDict, addFencesOreDict, addFenceGatesOreDict, addStairsOreDict, addPlanksUnificationInfo, addDoorsUnificationInfo, diff --git a/src/main/java/gregtech/loaders/dungeon/ChestGenHooks.java b/src/main/java/gregtech/loaders/dungeon/ChestGenHooks.java index 197cfc54710..a4355e70973 100644 --- a/src/main/java/gregtech/loaders/dungeon/ChestGenHooks.java +++ b/src/main/java/gregtech/loaders/dungeon/ChestGenHooks.java @@ -1,12 +1,10 @@ package gregtech.loaders.dungeon; -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; import gregtech.api.util.GTLog; import gregtech.api.util.GTStringUtils; import gregtech.api.util.ItemStackHashStrategy; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; @@ -19,6 +17,10 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -42,7 +44,7 @@ public static void init() { @SubscribeEvent public static void onWorldLoad(@NotNull LootTableLoadEvent event) { LootPool mainPool = event.getTable().getPool("main"); - //noinspection ConstantValue + // noinspection ConstantValue if (mainPool == null) return; ResourceLocation name = event.getName(); @@ -64,11 +66,13 @@ public static void onWorldLoad(@NotNull LootTableLoadEvent event) { if (rollValues.containsKey(event.getName())) { RandomValueRange rangeAdd = rollValues.get(event.getName()); RandomValueRange range = mainPool.getRolls(); - mainPool.setRolls(new RandomValueRange(range.getMin() + rangeAdd.getMin(), range.getMax() + rangeAdd.getMax())); + mainPool.setRolls( + new RandomValueRange(range.getMin() + rangeAdd.getMin(), range.getMax() + rangeAdd.getMax())); } } - public static void addItem(@NotNull ResourceLocation lootTable, @NotNull ItemStack stack, int minAmount, int maxAmount, int weight) { + public static void addItem(@NotNull ResourceLocation lootTable, @NotNull ItemStack stack, int minAmount, + int maxAmount, int weight) { RandomWeightLootFunction lootFunction = new RandomWeightLootFunction(stack, minAmount, maxAmount); String modid = Objects.requireNonNull(stack.getItem().getRegistryName()).getNamespace(); String entryName = createEntryName(stack, modid, weight, lootFunction); @@ -88,7 +92,8 @@ public static void addRolls(ResourceLocation tableLocation, int minAdd, int maxA private static @NotNull String createEntryName(@NotNull ItemStack stack, @NotNull String modid, int weight, @NotNull RandomWeightLootFunction function) { - int hashCode = Objects.hash(HASH_STRATEGY.hashCode(stack), modid, weight, function.getMinAmount(), function.getMaxAmount()); + int hashCode = Objects.hash(HASH_STRATEGY.hashCode(stack), modid, weight, function.getMinAmount(), + function.getMaxAmount()); return String.format("#%s:loot_%s", modid, hashCode); } @@ -96,8 +101,9 @@ private static class GTLootEntryItem extends LootEntryItem { private final ItemStack stack; - public GTLootEntryItem(@NotNull ItemStack stack, int weight, LootFunction lootFunction, @NotNull String entryName) { - super(stack.getItem(), weight, 1, new LootFunction[]{lootFunction}, NO_CONDITIONS, entryName); + public GTLootEntryItem(@NotNull ItemStack stack, int weight, LootFunction lootFunction, + @NotNull String entryName) { + super(stack.getItem(), weight, 1, new LootFunction[] { lootFunction }, NO_CONDITIONS, entryName); this.stack = stack; } @@ -130,7 +136,8 @@ public int getMaxAmount() { } @Override - public @NotNull ItemStack apply(@NotNull ItemStack itemStack, @NotNull Random rand, @NotNull LootContext context) { + public @NotNull ItemStack apply(@NotNull ItemStack itemStack, @NotNull Random rand, + @NotNull LootContext context) { itemStack.setItemDamage(stack.getItemDamage()); NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound != null) { diff --git a/src/main/java/gregtech/loaders/dungeon/DungeonLootLoader.java b/src/main/java/gregtech/loaders/dungeon/DungeonLootLoader.java index c54fe2ba4bb..5d41b705fb0 100644 --- a/src/main/java/gregtech/loaders/dungeon/DungeonLootLoader.java +++ b/src/main/java/gregtech/loaders/dungeon/DungeonLootLoader.java @@ -6,6 +6,7 @@ import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; + import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.storage.loot.LootTableList; @@ -18,77 +19,140 @@ public static void init() { ChestGenHooks.init(); } if (ConfigHolder.worldgen.addLoot) { - ChestGenHooks.addItem(LootTableList.CHESTS_SPAWN_BONUS_CHEST, MetaItems.BOTTLE_PURPLE_DRINK.getStackForm(), 8, 16, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_SPAWN_BONUS_CHEST, MetaItems.BOTTLE_PURPLE_DRINK.getStackForm(), + 8, 16, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, MetaItems.BOTTLE_PURPLE_DRINK.getStackForm(), 4, 8, 80); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.ingot, Materials.Silver), 1, 6, 120); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.ingot, Materials.Lead), 1, 6, 30); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 1, 6, 60); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 1, 6, 60); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.ingot, Materials.Manganese), 1, 6, 60); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 1, 6, 10); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.Emerald), 1, 6, 20); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 1, 6, 20); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 1, 6, 20); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 1, 6, 20); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 1, 6, 20); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 1, 6, 40); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 1, 6, 40); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.dust, Materials.Neodymium), 1, 6, 40); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.dust, Materials.Chrome), 1, 3, 40); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, MetaItems.BOTTLE_PURPLE_DRINK.getStackForm(), 4, + 8, 80); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.ingot, Materials.Silver), 1, 6, 120); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.ingot, Materials.Lead), 1, 6, 30); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 1, 6, 60); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 1, 6, 60); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.ingot, Materials.Manganese), 1, 6, 60); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 1, 6, 10); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.Emerald), 1, 6, 20); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 1, 6, 20); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 1, 6, 20); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 1, 6, 20); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 1, 6, 20); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 1, 6, 40); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 1, 6, 40); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.dust, Materials.Neodymium), 1, 6, 40); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.dust, Materials.Chrome), 1, 3, 40); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.ingot, Materials.Silver), 4, 16, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.ingot, Materials.Platinum), 2, 8, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 2, 8, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 2, 8, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.ingot, Materials.Silver), 4, 16, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.ingot, Materials.Platinum), 2, 8, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 2, 8, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 2, 8, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, MetaItems.COIN_GOLD_ANCIENT.getStackForm(), 16, 64, 10); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, MetaItems.ZERO_POINT_MODULE.getChargedStack(Long.MAX_VALUE), 1, 1, 1); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 4, 16, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 2, 8, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 2, 8, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, MetaItems.COIN_GOLD_ANCIENT.getStackForm(), 16, + 64, 10); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + MetaItems.ZERO_POINT_MODULE.getChargedStack(Long.MAX_VALUE), 1, 1, 1); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 4, 16, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), + 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 2, 8, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 2, 8, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE_DISPENSER, new ItemStack(Items.FIRE_CHARGE, 1), 2, 8, 30); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE_DISPENSER, new ItemStack(Items.FIRE_CHARGE, 1), 2, + 8, 30); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.ingot, Materials.Silver), 1, 4, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.ingot, Materials.Lead), 1, 4, 3); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 1, 4, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 1, 4, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 1, 4, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 1, 4, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 1, 4, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 1, 4, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 1, 4, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 1, 4, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.Emerald), 1, 4, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 3, 12, 1); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 1, 4, 1); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.ingot, Materials.Silver), 1, 4, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.ingot, Materials.Lead), 1, 4, 3); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 1, 4, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 1, 4, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 1, 4, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 1, 4, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 1, 4, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 1, 4, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 1, 4, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 1, 4, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.Emerald), 1, 4, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 3, 12, 1); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 1, 4, 1); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.dust, Materials.Chrome), 1, 4, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.dust, Materials.Neodymium), 2, 8, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.ingot, Materials.Manganese), 2, 8, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 4, 12, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 4, 12, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.ingot, Materials.Brass), 4, 12, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 4, 12, 1); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.dust, Materials.Chrome), 1, 4, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.dust, Materials.Neodymium), 2, 8, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.ingot, Materials.Manganese), 2, 8, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 4, 12, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 4, 12, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.ingot, Materials.Brass), 4, 12, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 4, 12, 1); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 4, 8, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 8, 16, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 8, 16, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, OreDictUnifier.get(OrePrefix.ingot, Materials.Manganese), 4, 8, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, OreDictUnifier.get(OrePrefix.dust, Materials.Neodymium), 4, 8, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, OreDictUnifier.get(OrePrefix.dust, Materials.Chrome), 2, 4, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 4, 8, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, + OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 8, 16, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, + OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 8, 16, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, + OreDictUnifier.get(OrePrefix.ingot, Materials.Manganese), 4, 8, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, + OreDictUnifier.get(OrePrefix.dust, Materials.Neodymium), 4, 8, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, + OreDictUnifier.get(OrePrefix.dust, Materials.Chrome), 2, 4, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CORRIDOR, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 2, 8, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CORRIDOR, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 3, 12, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CORRIDOR, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 2, 8, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CORRIDOR, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 3, 12, 6); } if (ConfigHolder.worldgen.increaseDungeonLoot) { ChestGenHooks.addRolls(LootTableList.CHESTS_SPAWN_BONUS_CHEST, 2, 4); @@ -103,5 +167,4 @@ public static void init() { ChestGenHooks.addRolls(LootTableList.CHESTS_STRONGHOLD_LIBRARY, 4, 8); } } - } diff --git a/src/main/java/gregtech/loaders/recipe/AssemblyLineLoader.java b/src/main/java/gregtech/loaders/recipe/AssemblyLineLoader.java index f4dc7dd182b..29252f0d561 100644 --- a/src/main/java/gregtech/loaders/recipe/AssemblyLineLoader.java +++ b/src/main/java/gregtech/loaders/recipe/AssemblyLineLoader.java @@ -16,7 +16,6 @@ public class AssemblyLineLoader { public static void init() { - ASSEMBLY_LINE_RECIPES.recipeBuilder() .inputs(FUSION_CASING.getItemVariant(SUPERCONDUCTOR_COIL)) .input(circuit, Tier.ZPM, 4) diff --git a/src/main/java/gregtech/loaders/recipe/BatteryRecipes.java b/src/main/java/gregtech/loaders/recipe/BatteryRecipes.java index 61a806c141f..c23ec372712 100644 --- a/src/main/java/gregtech/loaders/recipe/BatteryRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/BatteryRecipes.java @@ -25,7 +25,6 @@ public static void init() { } private static void standardBatteries() { - // Tantalum Battery (since it doesn't fit elsewhere) ASSEMBLER_RECIPES.recipeBuilder() .input(dust, Tantalum) @@ -218,30 +217,42 @@ private static void standardBatteries() { .output(BATTERY_UV_NAQUADRIA) .buildAndRegister(); - // Battery Recycling Recipes - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LV_CADMIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_LV).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LV_LITHIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_LV).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LV_SODIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_LV).buildAndRegister(); - - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_MV_CADMIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_MV).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_MV_LITHIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_MV).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_MV_SODIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_MV).buildAndRegister(); - - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_HV_CADMIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_HV).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_HV_LITHIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_HV).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_HV_SODIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_HV).buildAndRegister(); - - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_EV_VANADIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_SMALL_VANADIUM).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_IV_VANADIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_MEDIUM_VANADIUM).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LUV_VANADIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_LARGE_VANADIUM).buildAndRegister(); - - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_ZPM_NAQUADRIA, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_MEDIUM_NAQUADRIA).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_UV_NAQUADRIA, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_LARGE_NAQUADRIA).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LV_CADMIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_LV).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LV_LITHIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_LV).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LV_SODIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_LV).buildAndRegister(); + + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_MV_CADMIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_MV).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_MV_LITHIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_MV).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_MV_SODIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_MV).buildAndRegister(); + + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_HV_CADMIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_HV).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_HV_LITHIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_HV).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_HV_SODIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_HV).buildAndRegister(); + + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_EV_VANADIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_SMALL_VANADIUM).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_IV_VANADIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_MEDIUM_VANADIUM).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LUV_VANADIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_LARGE_VANADIUM).buildAndRegister(); + + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_ZPM_NAQUADRIA, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_MEDIUM_NAQUADRIA).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_UV_NAQUADRIA, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_LARGE_NAQUADRIA).buildAndRegister(); } private static void gemBatteries() { - // Energy Crystal MIXER_RECIPES.recipeBuilder().duration(600).EUt(VA[MV]) .input(dust, Redstone, 5) @@ -425,7 +436,6 @@ private static void gemBatteries() { } private static void batteryBlocks() { - // Empty Tier I ASSEMBLER_RECIPES.recipeBuilder() .input(frameGt, Ultimet) diff --git a/src/main/java/gregtech/loaders/recipe/CircuitRecipes.java b/src/main/java/gregtech/loaders/recipe/CircuitRecipes.java index f8e3a9bd1a6..0d62958b37c 100644 --- a/src/main/java/gregtech/loaders/recipe/CircuitRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/CircuitRecipes.java @@ -8,6 +8,7 @@ import gregtech.api.unification.material.MarkerMaterials.Tier; import gregtech.api.unification.stack.UnificationEntry; import gregtech.common.ConfigHolder; + import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -27,7 +28,6 @@ public static void init() { } private static void waferRecipes() { - // Boules BLAST_RECIPES.recipeBuilder() .input(dust, Silicon, 32) @@ -90,57 +90,131 @@ private static void waferRecipes() { .duration(2400).EUt(VA[IV]).buildAndRegister(); // Wafer engraving - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER).notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER).notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER).notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER).notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER).notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER).notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Gray).output(NAND_MEMORY_CHIP_WAFER).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Gray).output(NAND_MEMORY_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Gray).output(NAND_MEMORY_CHIP_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Pink).output(NOR_MEMORY_CHIP_WAFER).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Pink).output(NOR_MEMORY_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Pink).output(NOR_MEMORY_CHIP_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Brown).output(POWER_INTEGRATED_CIRCUIT_WAFER).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Brown).output(POWER_INTEGRATED_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Brown).output(POWER_INTEGRATED_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Yellow).output(SYSTEM_ON_CHIP_WAFER).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Yellow).output(SYSTEM_ON_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Yellow).output(SYSTEM_ON_CHIP_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Purple).output(ADVANCED_SYSTEM_ON_CHIP_WAFER).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Purple).output(ADVANCED_SYSTEM_ON_CHIP_WAFER, 2).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER) + .notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER) + .notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER) + .notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER) + .notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER) + .buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER) + .notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER) + .buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER) + .notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Gray).output(NAND_MEMORY_CHIP_WAFER) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Gray).output(NAND_MEMORY_CHIP_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Gray).output(NAND_MEMORY_CHIP_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Pink).output(NOR_MEMORY_CHIP_WAFER) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Pink).output(NOR_MEMORY_CHIP_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Pink).output(NOR_MEMORY_CHIP_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Brown).output(POWER_INTEGRATED_CIRCUIT_WAFER) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Brown).output(POWER_INTEGRATED_CIRCUIT_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Brown).output(POWER_INTEGRATED_CIRCUIT_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Yellow).output(SYSTEM_ON_CHIP_WAFER) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Yellow).output(SYSTEM_ON_CHIP_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Yellow).output(SYSTEM_ON_CHIP_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Purple).output(ADVANCED_SYSTEM_ON_CHIP_WAFER) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Purple).output(ADVANCED_SYSTEM_ON_CHIP_WAFER, 2) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); // Can replace this with a Quantum Star/Eye Lens if desired - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Black).output(HIGHLY_ADVANCED_SOC_WAFER).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Black).output(HIGHLY_ADVANCED_SOC_WAFER) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); // Wafer chemical refining recipes CHEMICAL_RECIPES.recipeBuilder() @@ -184,26 +258,41 @@ private static void waferRecipes() { .duration(1200).EUt(VA[EV]).buildAndRegister(); // Wafer cutting - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[IV]).input(HIGHLY_ADVANCED_SOC_WAFER).output(HIGHLY_ADVANCED_SOC, 6).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(ADVANCED_SYSTEM_ON_CHIP_WAFER).output(ADVANCED_SYSTEM_ON_CHIP, 6).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(SYSTEM_ON_CHIP_WAFER).output(SYSTEM_ON_CHIP, 6).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(64).input(SIMPLE_SYSTEM_ON_CHIP_WAFER).output(SIMPLE_SYSTEM_ON_CHIP, 6).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(96).input(RANDOM_ACCESS_MEMORY_WAFER).output(RANDOM_ACCESS_MEMORY, 32).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(QUBIT_CENTRAL_PROCESSING_UNIT_WAFER).output(QUBIT_CENTRAL_PROCESSING_UNIT, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT, 6).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(LOW_POWER_INTEGRATED_CIRCUIT_WAFER).output(LOW_POWER_INTEGRATED_CIRCUIT, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(POWER_INTEGRATED_CIRCUIT_WAFER).output(POWER_INTEGRATED_CIRCUIT, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[IV]).input(HIGH_POWER_INTEGRATED_CIRCUIT_WAFER).output(HIGH_POWER_INTEGRATED_CIRCUIT, 2).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[LuV]).input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT_WAFER).output(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(192).input(NOR_MEMORY_CHIP_WAFER).output(NOR_MEMORY_CHIP, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(192).input(NAND_MEMORY_CHIP_WAFER).output(NAND_MEMORY_CHIP, 32).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(CENTRAL_PROCESSING_UNIT_WAFER).output(CENTRAL_PROCESSING_UNIT, 8).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(64).input(INTEGRATED_LOGIC_CIRCUIT_WAFER).output(INTEGRATED_LOGIC_CIRCUIT, 8).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(NANO_CENTRAL_PROCESSING_UNIT_WAFER).output(NANO_CENTRAL_PROCESSING_UNIT, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[IV]).input(HIGHLY_ADVANCED_SOC_WAFER) + .output(HIGHLY_ADVANCED_SOC, 6).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(ADVANCED_SYSTEM_ON_CHIP_WAFER) + .output(ADVANCED_SYSTEM_ON_CHIP, 6).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(SYSTEM_ON_CHIP_WAFER).output(SYSTEM_ON_CHIP, 6) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(64).input(SIMPLE_SYSTEM_ON_CHIP_WAFER) + .output(SIMPLE_SYSTEM_ON_CHIP, 6).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(96).input(RANDOM_ACCESS_MEMORY_WAFER) + .output(RANDOM_ACCESS_MEMORY, 32).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(QUBIT_CENTRAL_PROCESSING_UNIT_WAFER) + .output(QUBIT_CENTRAL_PROCESSING_UNIT, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER) + .output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT, 6).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(LOW_POWER_INTEGRATED_CIRCUIT_WAFER) + .output(LOW_POWER_INTEGRATED_CIRCUIT, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(POWER_INTEGRATED_CIRCUIT_WAFER) + .output(POWER_INTEGRATED_CIRCUIT, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[IV]).input(HIGH_POWER_INTEGRATED_CIRCUIT_WAFER) + .output(HIGH_POWER_INTEGRATED_CIRCUIT, 2).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[LuV]).input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT_WAFER) + .output(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(192).input(NOR_MEMORY_CHIP_WAFER).output(NOR_MEMORY_CHIP, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(192).input(NAND_MEMORY_CHIP_WAFER).output(NAND_MEMORY_CHIP, 32) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(CENTRAL_PROCESSING_UNIT_WAFER) + .output(CENTRAL_PROCESSING_UNIT, 8).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(64).input(INTEGRATED_LOGIC_CIRCUIT_WAFER) + .output(INTEGRATED_LOGIC_CIRCUIT, 8).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(NANO_CENTRAL_PROCESSING_UNIT_WAFER) + .output(NANO_CENTRAL_PROCESSING_UNIT, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); } private static void componentRecipes() { - // Vacuum Tube ModHandler.addShapedRecipe("vacuum_tube", VACUUM_TUBE.getStackForm(), "PTP", "WWW", @@ -665,7 +754,6 @@ private static void componentRecipes() { } private static void boardRecipes() { - // Coated Board ModHandler.addShapedRecipe("coated_board", COATED_BOARD.getStackForm(3), "RRR", "PPP", "RRR", @@ -899,7 +987,6 @@ private static void boardRecipes() { } private static void circuitRecipes() { - int outputAmount = ConfigHolder.recipes.harderCircuitRecipes ? 1 : 2; // T1: Electronic ============================================================================================== @@ -964,7 +1051,8 @@ private static void circuitRecipes() { // HV CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).duration(800) - .input(INTEGRATED_CIRCUIT_MV, outputAmount) // a little generous for this first HV if harder recipes enabled + .input(INTEGRATED_CIRCUIT_MV, outputAmount) // a little generous for this first HV if harder recipes + // enabled .input(INTEGRATED_LOGIC_CIRCUIT, 2) .input(RANDOM_ACCESS_MEMORY, 2) .input(component, Component.Transistor, 4) diff --git a/src/main/java/gregtech/loaders/recipe/ComponentRecipes.java b/src/main/java/gregtech/loaders/recipe/ComponentRecipes.java index 005026c3d18..cb0828ab239 100644 --- a/src/main/java/gregtech/loaders/recipe/ComponentRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/ComponentRecipes.java @@ -4,9 +4,11 @@ import gregtech.api.unification.material.MarkerMaterials.Tier; import gregtech.api.unification.material.Material; import gregtech.api.unification.stack.UnificationEntry; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.init.Items; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; import static gregtech.api.GTValues.*; @@ -19,14 +21,26 @@ public class ComponentRecipes { public static void register() { - - //Motors Start-------------------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe("electric_motor_lv_steel", ELECTRIC_MOTOR_LV.getStackForm(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtSingle, Tin), 'W', new UnificationEntry(wireGtSingle, Copper), 'R', new UnificationEntry(stick, Steel), 'M', new UnificationEntry(stick, SteelMagnetic)); - ModHandler.addShapedRecipe(true, "electric_motor_lv_iron", ELECTRIC_MOTOR_LV.getStackForm(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtSingle, Tin), 'W', new UnificationEntry(wireGtSingle, Copper), 'R', new UnificationEntry(stick, Iron), 'M', new UnificationEntry(stick, IronMagnetic)); - ModHandler.addShapedRecipe(true, "electric_motor_mv", ELECTRIC_MOTOR_MV.getStackForm(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtSingle, Copper), 'W', new UnificationEntry(wireGtDouble, Cupronickel), 'R', new UnificationEntry(stick, Aluminium), 'M', new UnificationEntry(stick, SteelMagnetic)); - ModHandler.addShapedRecipe(true, "electric_motor_hv", ELECTRIC_MOTOR_HV.getStackForm(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtDouble, Silver), 'W', new UnificationEntry(wireGtDouble, Electrum), 'R', new UnificationEntry(stick, StainlessSteel), 'M', new UnificationEntry(stick, SteelMagnetic)); - ModHandler.addShapedRecipe(true, "electric_motor_ev", ELECTRIC_MOTOR_EV.getStackForm(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtDouble, Aluminium), 'W', new UnificationEntry(wireGtDouble, Kanthal), 'R', new UnificationEntry(stick, Titanium), 'M', new UnificationEntry(stick, NeodymiumMagnetic)); - ModHandler.addShapedRecipe(true, "electric_motor_iv", ELECTRIC_MOTOR_IV.getStackForm(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtDouble, Tungsten), 'W', new UnificationEntry(wireGtDouble, Graphene), 'R', new UnificationEntry(stick, TungstenSteel), 'M', new UnificationEntry(stick, NeodymiumMagnetic)); + // Motors + // Start-------------------------------------------------------------------------------------------------- + ModHandler.addShapedRecipe("electric_motor_lv_steel", ELECTRIC_MOTOR_LV.getStackForm(), "CWR", "WMW", "RWC", + 'C', new UnificationEntry(cableGtSingle, Tin), 'W', new UnificationEntry(wireGtSingle, Copper), 'R', + new UnificationEntry(stick, Steel), 'M', new UnificationEntry(stick, SteelMagnetic)); + ModHandler.addShapedRecipe(true, "electric_motor_lv_iron", ELECTRIC_MOTOR_LV.getStackForm(), "CWR", "WMW", + "RWC", 'C', new UnificationEntry(cableGtSingle, Tin), 'W', new UnificationEntry(wireGtSingle, Copper), + 'R', new UnificationEntry(stick, Iron), 'M', new UnificationEntry(stick, IronMagnetic)); + ModHandler.addShapedRecipe(true, "electric_motor_mv", ELECTRIC_MOTOR_MV.getStackForm(), "CWR", "WMW", "RWC", + 'C', new UnificationEntry(cableGtSingle, Copper), 'W', new UnificationEntry(wireGtDouble, Cupronickel), + 'R', new UnificationEntry(stick, Aluminium), 'M', new UnificationEntry(stick, SteelMagnetic)); + ModHandler.addShapedRecipe(true, "electric_motor_hv", ELECTRIC_MOTOR_HV.getStackForm(), "CWR", "WMW", "RWC", + 'C', new UnificationEntry(cableGtDouble, Silver), 'W', new UnificationEntry(wireGtDouble, Electrum), + 'R', new UnificationEntry(stick, StainlessSteel), 'M', new UnificationEntry(stick, SteelMagnetic)); + ModHandler.addShapedRecipe(true, "electric_motor_ev", ELECTRIC_MOTOR_EV.getStackForm(), "CWR", "WMW", "RWC", + 'C', new UnificationEntry(cableGtDouble, Aluminium), 'W', new UnificationEntry(wireGtDouble, Kanthal), + 'R', new UnificationEntry(stick, Titanium), 'M', new UnificationEntry(stick, NeodymiumMagnetic)); + ModHandler.addShapedRecipe(true, "electric_motor_iv", ELECTRIC_MOTOR_IV.getStackForm(), "CWR", "WMW", "RWC", + 'C', new UnificationEntry(cableGtDouble, Tungsten), 'W', new UnificationEntry(wireGtDouble, Graphene), + 'R', new UnificationEntry(stick, TungstenSteel), 'M', new UnificationEntry(stick, NeodymiumMagnetic)); ASSEMBLER_RECIPES.recipeBuilder() .input(cableGtSingle, Tin, 2) @@ -124,9 +138,8 @@ public static void register() { .EUt(VA[ZPM])) .duration(600).EUt(100000).buildAndRegister(); - - - //Conveyors Start----------------------------------------------------------------------------------------------- + // Conveyors + // Start----------------------------------------------------------------------------------------------- final Map rubberMaterials = new Object2ObjectOpenHashMap<>(); rubberMaterials.put("rubber", Rubber); rubberMaterials.put("silicone_rubber", SiliconeRubber); @@ -136,12 +149,24 @@ public static void register() { Material material = materialEntry.getValue(); String name = materialEntry.getKey(); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_lv_%s", name), CONVEYOR_MODULE_LV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Tin), 'M', ELECTRIC_MOTOR_LV.getStackForm()); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_mv_%s", name), CONVEYOR_MODULE_MV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Copper), 'M', ELECTRIC_MOTOR_MV.getStackForm()); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_hv_%s", name), CONVEYOR_MODULE_HV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Gold), 'M', ELECTRIC_MOTOR_HV.getStackForm()); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_ev_%s", name), CONVEYOR_MODULE_EV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'M', ELECTRIC_MOTOR_EV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_lv_%s", name), + CONVEYOR_MODULE_LV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), + 'C', new UnificationEntry(cableGtSingle, Tin), 'M', ELECTRIC_MOTOR_LV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_mv_%s", name), + CONVEYOR_MODULE_MV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), + 'C', new UnificationEntry(cableGtSingle, Copper), 'M', ELECTRIC_MOTOR_MV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_hv_%s", name), + CONVEYOR_MODULE_HV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), + 'C', new UnificationEntry(cableGtSingle, Gold), 'M', ELECTRIC_MOTOR_HV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_ev_%s", name), + CONVEYOR_MODULE_EV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), + 'C', new UnificationEntry(cableGtSingle, Aluminium), 'M', ELECTRIC_MOTOR_EV.getStackForm()); if (!materialEntry.getValue().equals(Rubber)) - ModHandler.addShapedRecipe(material.equals(SiliconeRubber), String.format("conveyor_module_iv_%s", materialEntry.getKey()), CONVEYOR_MODULE_IV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'M', ELECTRIC_MOTOR_IV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(SiliconeRubber), + String.format("conveyor_module_iv_%s", materialEntry.getKey()), + CONVEYOR_MODULE_IV.getStackForm(), "RRR", "MCM", "RRR", 'R', + new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'M', + ELECTRIC_MOTOR_IV.getStackForm()); ASSEMBLER_RECIPES.recipeBuilder() .input(cableGtSingle, Tin) @@ -184,14 +209,35 @@ public static void register() { .outputs(CONVEYOR_MODULE_IV.getStackForm()) .duration(100).EUt(VA[LV]).buildAndRegister(); - - //Pumps Start--------------------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_lv_%s", name), ELECTRIC_PUMP_LV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Tin), 'X', new UnificationEntry(rotor, Tin), 'P', new UnificationEntry(pipeNormalFluid, Bronze), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Tin), 'M', ELECTRIC_MOTOR_LV.getStackForm()); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_mv_%s", name), ELECTRIC_PUMP_MV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Bronze), 'X', new UnificationEntry(rotor, Bronze), 'P', new UnificationEntry(pipeNormalFluid, Steel), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Copper), 'M', ELECTRIC_MOTOR_MV.getStackForm()); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_hv_%s", name), ELECTRIC_PUMP_HV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Steel), 'X', new UnificationEntry(rotor, Steel), 'P', new UnificationEntry(pipeNormalFluid, StainlessSteel), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Gold), 'M', ELECTRIC_MOTOR_HV.getStackForm()); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_ev_%s", name), ELECTRIC_PUMP_EV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, StainlessSteel), 'X', new UnificationEntry(rotor, StainlessSteel), 'P', new UnificationEntry(pipeNormalFluid, Titanium), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'M', ELECTRIC_MOTOR_EV.getStackForm()); + // Pumps + // Start--------------------------------------------------------------------------------------------------- + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_lv_%s", name), + ELECTRIC_PUMP_LV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Tin), 'X', + new UnificationEntry(rotor, Tin), 'P', new UnificationEntry(pipeNormalFluid, Bronze), 'R', + new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Tin), 'M', + ELECTRIC_MOTOR_LV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_mv_%s", name), + ELECTRIC_PUMP_MV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Bronze), 'X', + new UnificationEntry(rotor, Bronze), 'P', new UnificationEntry(pipeNormalFluid, Steel), 'R', + new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Copper), 'M', + ELECTRIC_MOTOR_MV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_hv_%s", name), + ELECTRIC_PUMP_HV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Steel), 'X', + new UnificationEntry(rotor, Steel), 'P', new UnificationEntry(pipeNormalFluid, StainlessSteel), 'R', + new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Gold), 'M', + ELECTRIC_MOTOR_HV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_ev_%s", name), + ELECTRIC_PUMP_EV.getStackForm(), "SXR", "dPw", "RMC", 'S', + new UnificationEntry(screw, StainlessSteel), 'X', new UnificationEntry(rotor, StainlessSteel), 'P', + new UnificationEntry(pipeNormalFluid, Titanium), 'R', new UnificationEntry(ring, material), 'C', + new UnificationEntry(cableGtSingle, Aluminium), 'M', ELECTRIC_MOTOR_EV.getStackForm()); if (!material.equals(Rubber)) - ModHandler.addShapedRecipe(material.equals(SiliconeRubber), String.format("electric_pump_iv_%s", name), ELECTRIC_PUMP_IV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, TungstenSteel), 'X', new UnificationEntry(rotor, TungstenSteel), 'P', new UnificationEntry(pipeNormalFluid, TungstenSteel), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'M', ELECTRIC_MOTOR_IV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(SiliconeRubber), String.format("electric_pump_iv_%s", name), + ELECTRIC_PUMP_IV.getStackForm(), "SXR", "dPw", "RMC", 'S', + new UnificationEntry(screw, TungstenSteel), 'X', new UnificationEntry(rotor, TungstenSteel), + 'P', new UnificationEntry(pipeNormalFluid, TungstenSteel), 'R', + new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'M', + ELECTRIC_MOTOR_IV.getStackForm()); ASSEMBLER_RECIPES.recipeBuilder() .input(cableGtSingle, Tin) @@ -343,7 +389,8 @@ public static void register() { .EUt(VA[ZPM])) .duration(600).EUt(100000).buildAndRegister(); - //Fluid Regulators---------------------------------------------------------------------------------------------- + // Fluid + // Regulators---------------------------------------------------------------------------------------------- ASSEMBLER_RECIPES.recipeBuilder() .inputs(ELECTRIC_PUMP_LV.getStackForm()) @@ -422,9 +469,11 @@ public static void register() { .duration(50) .buildAndRegister(); - //Voiding Covers Start----------------------------------------------------------------------------------------- + // Voiding Covers Start----------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe(true, "cover_item_voiding", COVER_ITEM_VOIDING.getStackForm(), "SDS", "dPw", " E ", 'S', new UnificationEntry(screw, Steel), 'D', COVER_ITEM_DETECTOR.getStackForm(), 'P', new UnificationEntry(pipeNormalItem, Brass), 'E', Items.ENDER_PEARL); + ModHandler.addShapedRecipe(true, "cover_item_voiding", COVER_ITEM_VOIDING.getStackForm(), "SDS", "dPw", " E ", + 'S', new UnificationEntry(screw, Steel), 'D', COVER_ITEM_DETECTOR.getStackForm(), 'P', + new UnificationEntry(pipeNormalItem, Brass), 'E', Items.ENDER_PEARL); ASSEMBLER_RECIPES.recipeBuilder() .input(screw, Steel, 2) @@ -440,7 +489,9 @@ public static void register() { .outputs(COVER_ITEM_VOIDING_ADVANCED.getStackForm()) .duration(100).EUt(VA[LV]).buildAndRegister(); - ModHandler.addShapedRecipe(true, "cover_fluid_voiding", COVER_FLUID_VOIDING.getStackForm(), "SDS", "dPw", " E ", 'S', new UnificationEntry(screw, Steel), 'D', COVER_FLUID_DETECTOR.getStackForm(), 'P', new UnificationEntry(pipeNormalFluid, Bronze), 'E', Items.ENDER_PEARL); + ModHandler.addShapedRecipe(true, "cover_fluid_voiding", COVER_FLUID_VOIDING.getStackForm(), "SDS", "dPw", " E ", + 'S', new UnificationEntry(screw, Steel), 'D', COVER_FLUID_DETECTOR.getStackForm(), 'P', + new UnificationEntry(pipeNormalFluid, Bronze), 'E', Items.ENDER_PEARL); ASSEMBLER_RECIPES.recipeBuilder() .input(screw, Steel, 2) @@ -456,12 +507,28 @@ public static void register() { .outputs(COVER_FLUID_VOIDING_ADVANCED.getStackForm()) .duration(100).EUt(VA[LV]).buildAndRegister(); - //Pistons Start------------------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe(true, "electric_piston_lv", ELECTRIC_PISTON_LV.getStackForm(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, Steel), 'C', new UnificationEntry(cableGtSingle, Tin), 'R', new UnificationEntry(stick, Steel), 'G', new UnificationEntry(gearSmall, Steel), 'M', ELECTRIC_MOTOR_LV.getStackForm()); - ModHandler.addShapedRecipe(true, "electric_piston_mv", ELECTRIC_PISTON_MV.getStackForm(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, Aluminium), 'C', new UnificationEntry(cableGtSingle, Copper), 'R', new UnificationEntry(stick, Aluminium), 'G', new UnificationEntry(gearSmall, Aluminium), 'M', ELECTRIC_MOTOR_MV.getStackForm()); - ModHandler.addShapedRecipe(true, "electric_piston_hv", ELECTRIC_PISTON_HV.getStackForm(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, StainlessSteel), 'C', new UnificationEntry(cableGtSingle, Gold), 'R', new UnificationEntry(stick, StainlessSteel), 'G', new UnificationEntry(gearSmall, StainlessSteel), 'M', ELECTRIC_MOTOR_HV.getStackForm()); - ModHandler.addShapedRecipe(true, "electric_piston_ev", ELECTRIC_PISTON_EV.getStackForm(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, Titanium), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'R', new UnificationEntry(stick, Titanium), 'G', new UnificationEntry(gearSmall, Titanium), 'M', ELECTRIC_MOTOR_EV.getStackForm()); - ModHandler.addShapedRecipe(true, "electric_piston_iv", ELECTRIC_PISTON_IV.getStackForm(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, TungstenSteel), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'R', new UnificationEntry(stick, TungstenSteel), 'G', new UnificationEntry(gearSmall, TungstenSteel), 'M', ELECTRIC_MOTOR_IV.getStackForm()); + // Pistons + // Start------------------------------------------------------------------------------------------------- + ModHandler.addShapedRecipe(true, "electric_piston_lv", ELECTRIC_PISTON_LV.getStackForm(), "PPP", "CRR", "CMG", + 'P', new UnificationEntry(plate, Steel), 'C', new UnificationEntry(cableGtSingle, Tin), 'R', + new UnificationEntry(stick, Steel), 'G', new UnificationEntry(gearSmall, Steel), 'M', + ELECTRIC_MOTOR_LV.getStackForm()); + ModHandler.addShapedRecipe(true, "electric_piston_mv", ELECTRIC_PISTON_MV.getStackForm(), "PPP", "CRR", "CMG", + 'P', new UnificationEntry(plate, Aluminium), 'C', new UnificationEntry(cableGtSingle, Copper), 'R', + new UnificationEntry(stick, Aluminium), 'G', new UnificationEntry(gearSmall, Aluminium), 'M', + ELECTRIC_MOTOR_MV.getStackForm()); + ModHandler.addShapedRecipe(true, "electric_piston_hv", ELECTRIC_PISTON_HV.getStackForm(), "PPP", "CRR", "CMG", + 'P', new UnificationEntry(plate, StainlessSteel), 'C', new UnificationEntry(cableGtSingle, Gold), 'R', + new UnificationEntry(stick, StainlessSteel), 'G', new UnificationEntry(gearSmall, StainlessSteel), 'M', + ELECTRIC_MOTOR_HV.getStackForm()); + ModHandler.addShapedRecipe(true, "electric_piston_ev", ELECTRIC_PISTON_EV.getStackForm(), "PPP", "CRR", "CMG", + 'P', new UnificationEntry(plate, Titanium), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'R', + new UnificationEntry(stick, Titanium), 'G', new UnificationEntry(gearSmall, Titanium), 'M', + ELECTRIC_MOTOR_EV.getStackForm()); + ModHandler.addShapedRecipe(true, "electric_piston_iv", ELECTRIC_PISTON_IV.getStackForm(), "PPP", "CRR", "CMG", + 'P', new UnificationEntry(plate, TungstenSteel), 'C', new UnificationEntry(cableGtSingle, Tungsten), + 'R', new UnificationEntry(stick, TungstenSteel), 'G', new UnificationEntry(gearSmall, TungstenSteel), + 'M', ELECTRIC_MOTOR_IV.getStackForm()); ASSEMBLER_RECIPES.recipeBuilder() .input(stick, Steel, 2) @@ -508,7 +575,6 @@ public static void register() { .outputs(ELECTRIC_PISTON_IV.getStackForm()) .duration(100).EUt(VA[LV]).buildAndRegister(); - ASSEMBLY_LINE_RECIPES.recipeBuilder() .input(ELECTRIC_MOTOR_LuV) .input(plate, HSSS, 4) @@ -561,14 +627,28 @@ public static void register() { .EUt(VA[ZPM])) .duration(600).EUt(100000).buildAndRegister(); - - - //Robot Arms Start --------------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe(true, "robot_arm_lv", ROBOT_ARM_LV.getStackForm(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Tin), 'R', new UnificationEntry(stick, Steel), 'M', ELECTRIC_MOTOR_LV.getStackForm(), 'P', ELECTRIC_PISTON_LV.getStackForm(), 'X', new UnificationEntry(circuit, Tier.LV)); - ModHandler.addShapedRecipe(true, "robot_arm_mv", ROBOT_ARM_MV.getStackForm(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Copper), 'R', new UnificationEntry(stick, Aluminium), 'M', ELECTRIC_MOTOR_MV.getStackForm(), 'P', ELECTRIC_PISTON_MV.getStackForm(), 'X', new UnificationEntry(circuit, Tier.MV)); - ModHandler.addShapedRecipe(true, "robot_arm_hv", ROBOT_ARM_HV.getStackForm(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Gold), 'R', new UnificationEntry(stick, StainlessSteel), 'M', ELECTRIC_MOTOR_HV.getStackForm(), 'P', ELECTRIC_PISTON_HV.getStackForm(), 'X', new UnificationEntry(circuit, Tier.HV)); - ModHandler.addShapedRecipe(true, "robot_arm_ev", ROBOT_ARM_EV.getStackForm(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Aluminium), 'R', new UnificationEntry(stick, Titanium), 'M', ELECTRIC_MOTOR_EV.getStackForm(), 'P', ELECTRIC_PISTON_EV.getStackForm(), 'X', new UnificationEntry(circuit, Tier.EV)); - ModHandler.addShapedRecipe(true, "robot_arm_iv", ROBOT_ARM_IV.getStackForm(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Tungsten), 'R', new UnificationEntry(stick, TungstenSteel), 'M', ELECTRIC_MOTOR_IV.getStackForm(), 'P', ELECTRIC_PISTON_IV.getStackForm(), 'X', new UnificationEntry(circuit, Tier.IV)); + // Robot Arms Start + // --------------------------------------------------------------------------------------------- + ModHandler.addShapedRecipe(true, "robot_arm_lv", ROBOT_ARM_LV.getStackForm(), "CCC", "MRM", "PXR", 'C', + new UnificationEntry(cableGtSingle, Tin), 'R', new UnificationEntry(stick, Steel), 'M', + ELECTRIC_MOTOR_LV.getStackForm(), 'P', ELECTRIC_PISTON_LV.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.LV)); + ModHandler.addShapedRecipe(true, "robot_arm_mv", ROBOT_ARM_MV.getStackForm(), "CCC", "MRM", "PXR", 'C', + new UnificationEntry(cableGtSingle, Copper), 'R', new UnificationEntry(stick, Aluminium), 'M', + ELECTRIC_MOTOR_MV.getStackForm(), 'P', ELECTRIC_PISTON_MV.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.MV)); + ModHandler.addShapedRecipe(true, "robot_arm_hv", ROBOT_ARM_HV.getStackForm(), "CCC", "MRM", "PXR", 'C', + new UnificationEntry(cableGtSingle, Gold), 'R', new UnificationEntry(stick, StainlessSteel), 'M', + ELECTRIC_MOTOR_HV.getStackForm(), 'P', ELECTRIC_PISTON_HV.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.HV)); + ModHandler.addShapedRecipe(true, "robot_arm_ev", ROBOT_ARM_EV.getStackForm(), "CCC", "MRM", "PXR", 'C', + new UnificationEntry(cableGtSingle, Aluminium), 'R', new UnificationEntry(stick, Titanium), 'M', + ELECTRIC_MOTOR_EV.getStackForm(), 'P', ELECTRIC_PISTON_EV.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.EV)); + ModHandler.addShapedRecipe(true, "robot_arm_iv", ROBOT_ARM_IV.getStackForm(), "CCC", "MRM", "PXR", 'C', + new UnificationEntry(cableGtSingle, Tungsten), 'R', new UnificationEntry(stick, TungstenSteel), 'M', + ELECTRIC_MOTOR_IV.getStackForm(), 'P', ELECTRIC_PISTON_IV.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.IV)); ASSEMBLER_RECIPES.recipeBuilder() .input(cableGtSingle, Tin, 3) @@ -670,14 +750,27 @@ public static void register() { .EUt(VA[ZPM])) .duration(600).EUt(100000).buildAndRegister(); - - - //Field Generators Start --------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe(true, "field_generator_lv", FIELD_GENERATOR_LV.getStackForm(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, ManganesePhosphide), 'P', new UnificationEntry(plate, Steel), 'G', new UnificationEntry(gem, EnderPearl), 'X', new UnificationEntry(circuit, Tier.LV)); - ModHandler.addShapedRecipe(true, "field_generator_mv", FIELD_GENERATOR_MV.getStackForm(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, MagnesiumDiboride), 'P', new UnificationEntry(plate, Aluminium), 'G', new UnificationEntry(gem, EnderEye), 'X', new UnificationEntry(circuit, Tier.MV)); - ModHandler.addShapedRecipe(true, "field_generator_hv", FIELD_GENERATOR_HV.getStackForm(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, MercuryBariumCalciumCuprate), 'P', new UnificationEntry(plate, StainlessSteel), 'G', QUANTUM_EYE.getStackForm(), 'X', new UnificationEntry(circuit, Tier.HV)); - ModHandler.addShapedRecipe(true, "field_generator_ev", FIELD_GENERATOR_EV.getStackForm(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, UraniumTriplatinum), 'P', new UnificationEntry(plateDouble, Titanium), 'G', new UnificationEntry(gem, NetherStar), 'X', new UnificationEntry(circuit, Tier.EV)); - ModHandler.addShapedRecipe(true, "field_generator_iv", FIELD_GENERATOR_IV.getStackForm(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, SamariumIronArsenicOxide), 'P', new UnificationEntry(plateDouble, TungstenSteel), 'G', QUANTUM_STAR.getStackForm(), 'X', new UnificationEntry(circuit, Tier.IV)); + // Field Generators Start + // --------------------------------------------------------------------------------------- + ModHandler.addShapedRecipe(true, "field_generator_lv", FIELD_GENERATOR_LV.getStackForm(), "WPW", "XGX", "WPW", + 'W', new UnificationEntry(wireGtQuadruple, ManganesePhosphide), 'P', new UnificationEntry(plate, Steel), + 'G', new UnificationEntry(gem, EnderPearl), 'X', new UnificationEntry(circuit, Tier.LV)); + ModHandler.addShapedRecipe(true, "field_generator_mv", FIELD_GENERATOR_MV.getStackForm(), "WPW", "XGX", "WPW", + 'W', new UnificationEntry(wireGtQuadruple, MagnesiumDiboride), 'P', + new UnificationEntry(plate, Aluminium), 'G', new UnificationEntry(gem, EnderEye), 'X', + new UnificationEntry(circuit, Tier.MV)); + ModHandler.addShapedRecipe(true, "field_generator_hv", FIELD_GENERATOR_HV.getStackForm(), "WPW", "XGX", "WPW", + 'W', new UnificationEntry(wireGtQuadruple, MercuryBariumCalciumCuprate), 'P', + new UnificationEntry(plate, StainlessSteel), 'G', QUANTUM_EYE.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.HV)); + ModHandler.addShapedRecipe(true, "field_generator_ev", FIELD_GENERATOR_EV.getStackForm(), "WPW", "XGX", "WPW", + 'W', new UnificationEntry(wireGtQuadruple, UraniumTriplatinum), 'P', + new UnificationEntry(plateDouble, Titanium), 'G', new UnificationEntry(gem, NetherStar), 'X', + new UnificationEntry(circuit, Tier.EV)); + ModHandler.addShapedRecipe(true, "field_generator_iv", FIELD_GENERATOR_IV.getStackForm(), "WPW", "XGX", "WPW", + 'W', new UnificationEntry(wireGtQuadruple, SamariumIronArsenicOxide), 'P', + new UnificationEntry(plateDouble, TungstenSteel), 'G', QUANTUM_STAR.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.IV)); ASSEMBLER_RECIPES.recipeBuilder() .input(gem, EnderPearl) @@ -769,14 +862,23 @@ public static void register() { .EUt(VA[ZPM])) .duration(600).EUt(100000).buildAndRegister(); - - - //Sensors Start------------------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe(true, "sensor_lv", SENSOR_LV.getStackForm(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, Steel), 'R', new UnificationEntry(stick, Brass), 'G', new UnificationEntry(gem, Quartzite), 'X', new UnificationEntry(circuit, Tier.LV)); - ModHandler.addShapedRecipe(true, "sensor_mv", SENSOR_MV.getStackForm(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, Aluminium), 'R', new UnificationEntry(stick, Electrum), 'G', new UnificationEntry(gemFlawless, Emerald), 'X', new UnificationEntry(circuit, Tier.MV)); - ModHandler.addShapedRecipe(true, "sensor_hv", SENSOR_HV.getStackForm(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, StainlessSteel), 'R', new UnificationEntry(stick, Chrome), 'G', new UnificationEntry(gem, EnderEye), 'X', new UnificationEntry(circuit, Tier.HV)); - ModHandler.addShapedRecipe(true, "sensor_ev", SENSOR_EV.getStackForm(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, Titanium), 'R', new UnificationEntry(stick, Platinum), 'G', QUANTUM_EYE.getStackForm(), 'X', new UnificationEntry(circuit, Tier.EV)); - ModHandler.addShapedRecipe(true, "sensor_iv", SENSOR_IV.getStackForm(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, TungstenSteel), 'R', new UnificationEntry(stick, Iridium), 'G', QUANTUM_STAR.getStackForm(), 'X', new UnificationEntry(circuit, Tier.IV)); + // Sensors + // Start------------------------------------------------------------------------------------------------- + ModHandler.addShapedRecipe(true, "sensor_lv", SENSOR_LV.getStackForm(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, Steel), 'R', new UnificationEntry(stick, Brass), 'G', + new UnificationEntry(gem, Quartzite), 'X', new UnificationEntry(circuit, Tier.LV)); + ModHandler.addShapedRecipe(true, "sensor_mv", SENSOR_MV.getStackForm(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, Aluminium), 'R', new UnificationEntry(stick, Electrum), 'G', + new UnificationEntry(gemFlawless, Emerald), 'X', new UnificationEntry(circuit, Tier.MV)); + ModHandler.addShapedRecipe(true, "sensor_hv", SENSOR_HV.getStackForm(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, StainlessSteel), 'R', new UnificationEntry(stick, Chrome), 'G', + new UnificationEntry(gem, EnderEye), 'X', new UnificationEntry(circuit, Tier.HV)); + ModHandler.addShapedRecipe(true, "sensor_ev", SENSOR_EV.getStackForm(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, Titanium), 'R', new UnificationEntry(stick, Platinum), 'G', + QUANTUM_EYE.getStackForm(), 'X', new UnificationEntry(circuit, Tier.EV)); + ModHandler.addShapedRecipe(true, "sensor_iv", SENSOR_IV.getStackForm(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, TungstenSteel), 'R', new UnificationEntry(stick, Iridium), 'G', + QUANTUM_STAR.getStackForm(), 'X', new UnificationEntry(circuit, Tier.IV)); ASSEMBLER_RECIPES.recipeBuilder() .input(stick, Brass) @@ -868,13 +970,23 @@ public static void register() { .EUt(VA[ZPM])) .duration(600).EUt(100000).buildAndRegister(); - - //Emitters Start------------------------------------------------------------------------------------------------ - ModHandler.addShapedRecipe(true, "emitter_lv", EMITTER_LV.getStackForm(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(stick, Brass), 'C', new UnificationEntry(cableGtSingle, Tin), 'G', new UnificationEntry(gem, Quartzite), 'X', new UnificationEntry(circuit, Tier.LV)); - ModHandler.addShapedRecipe(true, "emitter_mv", EMITTER_MV.getStackForm(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(stick, Electrum), 'C', new UnificationEntry(cableGtSingle, Copper), 'G', new UnificationEntry(gemFlawless, Emerald), 'X', new UnificationEntry(circuit, Tier.MV)); - ModHandler.addShapedRecipe(true, "emitter_hv", EMITTER_HV.getStackForm(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(stick, Chrome), 'C', new UnificationEntry(cableGtSingle, Gold), 'G', new UnificationEntry(gem, EnderEye), 'X', new UnificationEntry(circuit, Tier.HV)); - ModHandler.addShapedRecipe(true, "emitter_ev", EMITTER_EV.getStackForm(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(stick, Platinum), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'G', QUANTUM_EYE.getStackForm(), 'X', new UnificationEntry(circuit, Tier.EV)); - ModHandler.addShapedRecipe(true, "emitter_iv", EMITTER_IV.getStackForm(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(stick, Iridium), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'G', QUANTUM_STAR.getStackForm(), 'X', new UnificationEntry(circuit, Tier.IV)); + // Emitters + // Start------------------------------------------------------------------------------------------------ + ModHandler.addShapedRecipe(true, "emitter_lv", EMITTER_LV.getStackForm(), "CRX", "RGR", "XRC", 'R', + new UnificationEntry(stick, Brass), 'C', new UnificationEntry(cableGtSingle, Tin), 'G', + new UnificationEntry(gem, Quartzite), 'X', new UnificationEntry(circuit, Tier.LV)); + ModHandler.addShapedRecipe(true, "emitter_mv", EMITTER_MV.getStackForm(), "CRX", "RGR", "XRC", 'R', + new UnificationEntry(stick, Electrum), 'C', new UnificationEntry(cableGtSingle, Copper), 'G', + new UnificationEntry(gemFlawless, Emerald), 'X', new UnificationEntry(circuit, Tier.MV)); + ModHandler.addShapedRecipe(true, "emitter_hv", EMITTER_HV.getStackForm(), "CRX", "RGR", "XRC", 'R', + new UnificationEntry(stick, Chrome), 'C', new UnificationEntry(cableGtSingle, Gold), 'G', + new UnificationEntry(gem, EnderEye), 'X', new UnificationEntry(circuit, Tier.HV)); + ModHandler.addShapedRecipe(true, "emitter_ev", EMITTER_EV.getStackForm(), "CRX", "RGR", "XRC", 'R', + new UnificationEntry(stick, Platinum), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'G', + QUANTUM_EYE.getStackForm(), 'X', new UnificationEntry(circuit, Tier.EV)); + ModHandler.addShapedRecipe(true, "emitter_iv", EMITTER_IV.getStackForm(), "CRX", "RGR", "XRC", 'R', + new UnificationEntry(stick, Iridium), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'G', + QUANTUM_STAR.getStackForm(), 'X', new UnificationEntry(circuit, Tier.IV)); ASSEMBLER_RECIPES.recipeBuilder() .input(stick, Brass, 4) diff --git a/src/main/java/gregtech/loaders/recipe/ComputerRecipes.java b/src/main/java/gregtech/loaders/recipe/ComputerRecipes.java index 00d33bc11d4..9b2fbca568d 100644 --- a/src/main/java/gregtech/loaders/recipe/ComputerRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/ComputerRecipes.java @@ -7,6 +7,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.blocks.BlockComputerCasing; import gregtech.common.blocks.BlockGlassCasing; + import net.minecraft.item.ItemStack; import static gregtech.api.GTValues.*; @@ -21,7 +22,6 @@ public class ComputerRecipes { public static void init() { - ASSEMBLER_RECIPES.recipeBuilder() .input(ITEM_IMPORT_BUS[EV]) .inputNBT(TOOL_DATA_STICK, 4, NBTMatcher.ANY, NBTCondition.ANY) @@ -48,7 +48,8 @@ public static void init() { .input(wireFine, Cobalt, 16) .input(wireFine, Copper, 16) .input(wireGtSingle, NiobiumTitanium, 2) - .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.HIGH_POWER_CASING, ConfigHolder.recipes.casingsPerCraft)) + .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.HIGH_POWER_CASING, + ConfigHolder.recipes.casingsPerCraft)) .duration(100).EUt(VA[IV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -58,7 +59,8 @@ public static void init() { .input(wireFine, Cobalt, 32) .input(wireFine, Copper, 32) .input(wireGtSingle, VanadiumGallium, 2) - .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_CASING, ConfigHolder.recipes.casingsPerCraft)) + .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_CASING, + ConfigHolder.recipes.casingsPerCraft)) .duration(200).EUt(VA[LuV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -77,7 +79,8 @@ public static void init() { .input(pipeTinyFluid, StainlessSteel, 16) .input(plate, Copper, 16) .input(wireGtSingle, SamariumIronArsenicOxide) - .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_HEAT_VENT, ConfigHolder.recipes.casingsPerCraft)) + .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_HEAT_VENT, + ConfigHolder.recipes.casingsPerCraft)) .duration(100).EUt(VA[EV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -281,24 +284,26 @@ public static void init() { .output(ACTIVE_TRANSFORMER) .duration(300).EUt(VA[LuV]).buildAndRegister(); -/* TODO UPSATUPDATE - ASSEMBLER_RECIPES.recipeBuilder() - .input(HULL[LuV]) - .input(lens, Diamond) - .input(EMITTER_LuV) - .input(wireGtSingle, IndiumTinBariumTitaniumCuprate, 2) - .output(LASER_OUTPUT_HATCH) - .circuitMeta(1) - .duration(300).EUt(VA[IV]).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder() - .input(HULL[LuV]) - .input(lens, Diamond) - .input(SENSOR_LuV) - .input(wireGtSingle, IndiumTinBariumTitaniumCuprate, 2) - .output(LASER_INPUT_HATCH) - .circuitMeta(2) - .duration(300).EUt(VA[IV]).buildAndRegister();*/ + /* + * TODO UPSATUPDATE + * ASSEMBLER_RECIPES.recipeBuilder() + * .input(HULL[LuV]) + * .input(lens, Diamond) + * .input(EMITTER_LuV) + * .input(wireGtSingle, IndiumTinBariumTitaniumCuprate, 2) + * .output(LASER_OUTPUT_HATCH) + * .circuitMeta(1) + * .duration(300).EUt(VA[IV]).buildAndRegister(); + * + * ASSEMBLER_RECIPES.recipeBuilder() + * .input(HULL[LuV]) + * .input(lens, Diamond) + * .input(SENSOR_LuV) + * .input(wireGtSingle, IndiumTinBariumTitaniumCuprate, 2) + * .output(LASER_INPUT_HATCH) + * .circuitMeta(2) + * .duration(300).EUt(VA[IV]).buildAndRegister(); + */ ASSEMBLER_RECIPES.recipeBuilder() .inputs(TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS)) diff --git a/src/main/java/gregtech/loaders/recipe/CraftingComponent.java b/src/main/java/gregtech/loaders/recipe/CraftingComponent.java index c7679d64fc7..f6c8898f9d9 100644 --- a/src/main/java/gregtech/loaders/recipe/CraftingComponent.java +++ b/src/main/java/gregtech/loaders/recipe/CraftingComponent.java @@ -12,6 +12,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -81,757 +82,753 @@ public class CraftingComponent { } public static void initializeComponents() { - /* * GTCEu must supply values for at least tiers 1 through 8 (through UV) */ - CIRCUIT = new Component(Stream.of(new Object[][]{ - - {0, new UnificationEntry(OrePrefix.circuit, Tier.ULV)}, - {1, new UnificationEntry(OrePrefix.circuit, Tier.LV)}, - {2, new UnificationEntry(OrePrefix.circuit, Tier.MV)}, - {3, new UnificationEntry(OrePrefix.circuit, Tier.HV)}, - {4, new UnificationEntry(OrePrefix.circuit, Tier.EV)}, - {5, new UnificationEntry(OrePrefix.circuit, Tier.IV)}, - {6, new UnificationEntry(OrePrefix.circuit, Tier.LuV)}, - {7, new UnificationEntry(OrePrefix.circuit, Tier.ZPM)}, - {8, new UnificationEntry(OrePrefix.circuit, Tier.UV)}, - {9, new UnificationEntry(OrePrefix.circuit, Tier.UHV)}, - {10, new UnificationEntry(OrePrefix.circuit, Tier.UEV)}, - {11, new UnificationEntry(OrePrefix.circuit, Tier.UIV)}, - {12, new UnificationEntry(OrePrefix.circuit, Tier.UXV)}, - {13, new UnificationEntry(OrePrefix.circuit, Tier.OpV)}, - {14, new UnificationEntry(OrePrefix.circuit, Tier.MAX)} - - }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - - BETTER_CIRCUIT = new Component(Stream.of(new Object[][]{ - - {0, new UnificationEntry(OrePrefix.circuit, Tier.LV)}, - {1, new UnificationEntry(OrePrefix.circuit, Tier.MV)}, - {2, new UnificationEntry(OrePrefix.circuit, Tier.HV)}, - {3, new UnificationEntry(OrePrefix.circuit, Tier.EV)}, - {4, new UnificationEntry(OrePrefix.circuit, Tier.IV)}, - {5, new UnificationEntry(OrePrefix.circuit, Tier.LuV)}, - {6, new UnificationEntry(OrePrefix.circuit, Tier.ZPM)}, - {7, new UnificationEntry(OrePrefix.circuit, Tier.UV)}, - {8, new UnificationEntry(OrePrefix.circuit, Tier.UHV)}, - {9, new UnificationEntry(OrePrefix.circuit, Tier.UEV)}, - {10, new UnificationEntry(OrePrefix.circuit, Tier.UIV)}, - {11, new UnificationEntry(OrePrefix.circuit, Tier.UXV)}, - {12, new UnificationEntry(OrePrefix.circuit, Tier.OpV)}, - {13, new UnificationEntry(OrePrefix.circuit, Tier.MAX)} - - }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - - PUMP = new Component(Stream.of(new Object[][]{ - - {1, MetaItems.ELECTRIC_PUMP_LV.getStackForm()}, - {2, MetaItems.ELECTRIC_PUMP_MV.getStackForm()}, - {3, MetaItems.ELECTRIC_PUMP_HV.getStackForm()}, - {4, MetaItems.ELECTRIC_PUMP_EV.getStackForm()}, - {5, MetaItems.ELECTRIC_PUMP_IV.getStackForm()}, - {6, MetaItems.ELECTRIC_PUMP_LuV.getStackForm()}, - {7, MetaItems.ELECTRIC_PUMP_ZPM.getStackForm()}, - {8, MetaItems.ELECTRIC_PUMP_UV.getStackForm()}, + CIRCUIT = new Component(Stream.of(new Object[][] { + + { 0, new UnificationEntry(OrePrefix.circuit, Tier.ULV) }, + { 1, new UnificationEntry(OrePrefix.circuit, Tier.LV) }, + { 2, new UnificationEntry(OrePrefix.circuit, Tier.MV) }, + { 3, new UnificationEntry(OrePrefix.circuit, Tier.HV) }, + { 4, new UnificationEntry(OrePrefix.circuit, Tier.EV) }, + { 5, new UnificationEntry(OrePrefix.circuit, Tier.IV) }, + { 6, new UnificationEntry(OrePrefix.circuit, Tier.LuV) }, + { 7, new UnificationEntry(OrePrefix.circuit, Tier.ZPM) }, + { 8, new UnificationEntry(OrePrefix.circuit, Tier.UV) }, + { 9, new UnificationEntry(OrePrefix.circuit, Tier.UHV) }, + { 10, new UnificationEntry(OrePrefix.circuit, Tier.UEV) }, + { 11, new UnificationEntry(OrePrefix.circuit, Tier.UIV) }, + { 12, new UnificationEntry(OrePrefix.circuit, Tier.UXV) }, + { 13, new UnificationEntry(OrePrefix.circuit, Tier.OpV) }, + { 14, new UnificationEntry(OrePrefix.circuit, Tier.MAX) } + + }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); + + BETTER_CIRCUIT = new Component(Stream.of(new Object[][] { + + { 0, new UnificationEntry(OrePrefix.circuit, Tier.LV) }, + { 1, new UnificationEntry(OrePrefix.circuit, Tier.MV) }, + { 2, new UnificationEntry(OrePrefix.circuit, Tier.HV) }, + { 3, new UnificationEntry(OrePrefix.circuit, Tier.EV) }, + { 4, new UnificationEntry(OrePrefix.circuit, Tier.IV) }, + { 5, new UnificationEntry(OrePrefix.circuit, Tier.LuV) }, + { 6, new UnificationEntry(OrePrefix.circuit, Tier.ZPM) }, + { 7, new UnificationEntry(OrePrefix.circuit, Tier.UV) }, + { 8, new UnificationEntry(OrePrefix.circuit, Tier.UHV) }, + { 9, new UnificationEntry(OrePrefix.circuit, Tier.UEV) }, + { 10, new UnificationEntry(OrePrefix.circuit, Tier.UIV) }, + { 11, new UnificationEntry(OrePrefix.circuit, Tier.UXV) }, + { 12, new UnificationEntry(OrePrefix.circuit, Tier.OpV) }, + { 13, new UnificationEntry(OrePrefix.circuit, Tier.MAX) } + + }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); + + PUMP = new Component(Stream.of(new Object[][] { + + { 1, MetaItems.ELECTRIC_PUMP_LV.getStackForm() }, + { 2, MetaItems.ELECTRIC_PUMP_MV.getStackForm() }, + { 3, MetaItems.ELECTRIC_PUMP_HV.getStackForm() }, + { 4, MetaItems.ELECTRIC_PUMP_EV.getStackForm() }, + { 5, MetaItems.ELECTRIC_PUMP_IV.getStackForm() }, + { 6, MetaItems.ELECTRIC_PUMP_LuV.getStackForm() }, + { 7, MetaItems.ELECTRIC_PUMP_ZPM.getStackForm() }, + { 8, MetaItems.ELECTRIC_PUMP_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - PUMP.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.ELECTRIC_PUMP_UHV.getStackForm()}, - {10, MetaItems.ELECTRIC_PUMP_UEV.getStackForm()}, - {11, MetaItems.ELECTRIC_PUMP_UIV.getStackForm()}, - {12, MetaItems.ELECTRIC_PUMP_UXV.getStackForm()}, - {13, MetaItems.ELECTRIC_PUMP_OpV.getStackForm()}, + PUMP.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.ELECTRIC_PUMP_UHV.getStackForm() }, + { 10, MetaItems.ELECTRIC_PUMP_UEV.getStackForm() }, + { 11, MetaItems.ELECTRIC_PUMP_UIV.getStackForm() }, + { 12, MetaItems.ELECTRIC_PUMP_UXV.getStackForm() }, + { 13, MetaItems.ELECTRIC_PUMP_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - WIRE_ELECTRIC = new Component(Stream.of(new Object[][]{ + WIRE_ELECTRIC = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Gold)}, - {1, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Gold)}, - {2, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Silver)}, - {3, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Electrum)}, - {4, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Platinum)}, - {5, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium)}, - {6, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium)}, - {7, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium)}, - {8, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium)}, + { 0, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Gold) }, + { 1, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Gold) }, + { 2, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Silver) }, + { 3, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Electrum) }, + { 4, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Platinum) }, + { 5, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium) }, + { 6, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium) }, + { 7, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium) }, + { 8, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - WIRE_QUAD = new Component(Stream.of(new Object[][]{ + WIRE_QUAD = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Lead)}, - {1, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Tungsten)}, - {6, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.YttriumBariumCuprate)}, + { 0, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Lead) }, + { 1, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Tungsten) }, + { 6, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.YttriumBariumCuprate) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - WIRE_OCT = new Component(Stream.of(new Object[][]{ + WIRE_OCT = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Lead)}, - {1, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Tungsten)}, - {6, new UnificationEntry(OrePrefix.wireGtOctal, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.wireGtOctal, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.wireGtOctal, Materials.YttriumBariumCuprate)}, + { 0, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Lead) }, + { 1, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Tungsten) }, + { 6, new UnificationEntry(OrePrefix.wireGtOctal, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.wireGtOctal, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.wireGtOctal, Materials.YttriumBariumCuprate) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - WIRE_HEX = new Component(Stream.of(new Object[][]{ + WIRE_HEX = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.wireGtHex, Materials.Lead)}, - {1, new UnificationEntry(OrePrefix.wireGtHex, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.wireGtHex, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.wireGtHex, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.wireGtHex, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.wireGtHex, Materials.Tungsten)}, - {6, new UnificationEntry(OrePrefix.wireGtHex, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.wireGtHex, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.wireGtHex, Materials.YttriumBariumCuprate)}, + { 0, new UnificationEntry(OrePrefix.wireGtHex, Materials.Lead) }, + { 1, new UnificationEntry(OrePrefix.wireGtHex, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.wireGtHex, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.wireGtHex, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.wireGtHex, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.wireGtHex, Materials.Tungsten) }, + { 6, new UnificationEntry(OrePrefix.wireGtHex, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.wireGtHex, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.wireGtHex, Materials.YttriumBariumCuprate) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE = new Component(Stream.of(new Object[][]{ + CABLE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.cableGtSingle, Materials.RedAlloy)}, - {1, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Platinum)}, - {6, new UnificationEntry(OrePrefix.cableGtSingle, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.cableGtSingle, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.cableGtSingle, Materials.YttriumBariumCuprate)}, - {9, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.cableGtSingle, Materials.RedAlloy) }, + { 1, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Platinum) }, + { 6, new UnificationEntry(OrePrefix.cableGtSingle, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.cableGtSingle, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.cableGtSingle, Materials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_QUAD = new Component(Stream.of(new Object[][]{ + CABLE_QUAD = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.RedAlloy)}, - {1, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Platinum)}, - {6, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.YttriumBariumCuprate)}, - {9, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.RedAlloy) }, + { 1, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Platinum) }, + { 6, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_OCT = new Component(Stream.of(new Object[][]{ + CABLE_OCT = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.cableGtOctal, Materials.RedAlloy)}, - {1, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Platinum)}, - {6, new UnificationEntry(OrePrefix.cableGtOctal, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.cableGtOctal, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.cableGtOctal, Materials.YttriumBariumCuprate)}, - {9, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.cableGtOctal, Materials.RedAlloy) }, + { 1, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Platinum) }, + { 6, new UnificationEntry(OrePrefix.cableGtOctal, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.cableGtOctal, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.cableGtOctal, Materials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_HEX = new Component(Stream.of(new Object[][]{ + CABLE_HEX = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.cableGtHex, Materials.RedAlloy)}, - {1, new UnificationEntry(OrePrefix.cableGtHex, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.cableGtHex, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.cableGtHex, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.cableGtHex, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.cableGtHex, Materials.Platinum)}, - {6, new UnificationEntry(OrePrefix.cableGtHex, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.cableGtHex, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.cableGtHex, Materials.YttriumBariumCuprate)}, - {9, new UnificationEntry(OrePrefix.cableGtHex, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.cableGtHex, Materials.RedAlloy) }, + { 1, new UnificationEntry(OrePrefix.cableGtHex, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.cableGtHex, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.cableGtHex, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.cableGtHex, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.cableGtHex, Materials.Platinum) }, + { 6, new UnificationEntry(OrePrefix.cableGtHex, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.cableGtHex, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.cableGtHex, Materials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(OrePrefix.cableGtHex, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_TIER_UP = new Component(Stream.of(new Object[][]{ + CABLE_TIER_UP = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Tin)}, - {1, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Copper)}, - {2, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Gold)}, - {3, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Aluminium)}, - {4, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Platinum)}, - {5, new UnificationEntry(OrePrefix.cableGtSingle, Materials.NiobiumTitanium)}, - {6, new UnificationEntry(OrePrefix.cableGtSingle, Materials.VanadiumGallium)}, - {7, new UnificationEntry(OrePrefix.cableGtSingle, Materials.YttriumBariumCuprate)}, - {8, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Europium)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Tin) }, + { 1, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Copper) }, + { 2, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Gold) }, + { 3, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Aluminium) }, + { 4, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Platinum) }, + { 5, new UnificationEntry(OrePrefix.cableGtSingle, Materials.NiobiumTitanium) }, + { 6, new UnificationEntry(OrePrefix.cableGtSingle, Materials.VanadiumGallium) }, + { 7, new UnificationEntry(OrePrefix.cableGtSingle, Materials.YttriumBariumCuprate) }, + { 8, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Europium) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_QUAD_TIER_UP = new Component(Stream.of(new Object[][]{ + CABLE_QUAD_TIER_UP = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Tin)}, - {1, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Copper)}, - {2, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Gold)}, - {3, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Aluminium)}, - {4, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Platinum)}, - {5, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.NiobiumTitanium)}, - {6, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.VanadiumGallium)}, - {7, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.YttriumBariumCuprate)}, - {8, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Europium)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Tin) }, + { 1, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Copper) }, + { 2, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Gold) }, + { 3, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Aluminium) }, + { 4, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Platinum) }, + { 5, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.NiobiumTitanium) }, + { 6, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.VanadiumGallium) }, + { 7, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.YttriumBariumCuprate) }, + { 8, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Europium) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - HULL = new Component(Stream.of(new Object[][]{ + HULL = new Component(Stream.of(new Object[][] { - {0, MetaTileEntities.HULL[0].getStackForm()}, - {1, MetaTileEntities.HULL[1].getStackForm()}, - {2, MetaTileEntities.HULL[2].getStackForm()}, - {3, MetaTileEntities.HULL[3].getStackForm()}, - {4, MetaTileEntities.HULL[4].getStackForm()}, - {5, MetaTileEntities.HULL[5].getStackForm()}, - {6, MetaTileEntities.HULL[6].getStackForm()}, - {7, MetaTileEntities.HULL[7].getStackForm()}, - {8, MetaTileEntities.HULL[8].getStackForm()}, - {9, MetaTileEntities.HULL[9].getStackForm()}, + { 0, MetaTileEntities.HULL[0].getStackForm() }, + { 1, MetaTileEntities.HULL[1].getStackForm() }, + { 2, MetaTileEntities.HULL[2].getStackForm() }, + { 3, MetaTileEntities.HULL[3].getStackForm() }, + { 4, MetaTileEntities.HULL[4].getStackForm() }, + { 5, MetaTileEntities.HULL[5].getStackForm() }, + { 6, MetaTileEntities.HULL[6].getStackForm() }, + { 7, MetaTileEntities.HULL[7].getStackForm() }, + { 8, MetaTileEntities.HULL[8].getStackForm() }, + { 9, MetaTileEntities.HULL[9].getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - HULL.appendIngredients(Stream.of(new Object[][]{ - {10, MetaTileEntities.HULL[10].getStackForm()}, - {11, MetaTileEntities.HULL[11].getStackForm()}, - {12, MetaTileEntities.HULL[12].getStackForm()}, - {13, MetaTileEntities.HULL[13].getStackForm()}, - {14, MetaTileEntities.HULL[14].getStackForm()}, + HULL.appendIngredients(Stream.of(new Object[][] { + { 10, MetaTileEntities.HULL[10].getStackForm() }, + { 11, MetaTileEntities.HULL[11].getStackForm() }, + { 12, MetaTileEntities.HULL[12].getStackForm() }, + { 13, MetaTileEntities.HULL[13].getStackForm() }, + { 14, MetaTileEntities.HULL[14].getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - TRANSFORMER = new Component(Stream.of(new Object[][]{ + TRANSFORMER = new Component(Stream.of(new Object[][] { - {0, MetaTileEntities.TRANSFORMER[0].getStackForm()}, - {1, MetaTileEntities.TRANSFORMER[1].getStackForm()}, - {2, MetaTileEntities.TRANSFORMER[2].getStackForm()}, - {3, MetaTileEntities.TRANSFORMER[3].getStackForm()}, - {4, MetaTileEntities.TRANSFORMER[4].getStackForm()}, - {5, MetaTileEntities.TRANSFORMER[5].getStackForm()}, - {6, MetaTileEntities.TRANSFORMER[6].getStackForm()}, - {7, MetaTileEntities.TRANSFORMER[7].getStackForm()}, - {8, MetaTileEntities.TRANSFORMER[8].getStackForm()}, + { 0, MetaTileEntities.TRANSFORMER[0].getStackForm() }, + { 1, MetaTileEntities.TRANSFORMER[1].getStackForm() }, + { 2, MetaTileEntities.TRANSFORMER[2].getStackForm() }, + { 3, MetaTileEntities.TRANSFORMER[3].getStackForm() }, + { 4, MetaTileEntities.TRANSFORMER[4].getStackForm() }, + { 5, MetaTileEntities.TRANSFORMER[5].getStackForm() }, + { 6, MetaTileEntities.TRANSFORMER[6].getStackForm() }, + { 7, MetaTileEntities.TRANSFORMER[7].getStackForm() }, + { 8, MetaTileEntities.TRANSFORMER[8].getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - TRANSFORMER.appendIngredients(Stream.of(new Object[][]{ - {9, MetaTileEntities.TRANSFORMER[9].getStackForm()}, - {10, MetaTileEntities.TRANSFORMER[10].getStackForm()}, - {11, MetaTileEntities.TRANSFORMER[11].getStackForm()}, - {12, MetaTileEntities.TRANSFORMER[12].getStackForm()}, - {13, MetaTileEntities.TRANSFORMER[13].getStackForm()}, + TRANSFORMER.appendIngredients(Stream.of(new Object[][] { + { 9, MetaTileEntities.TRANSFORMER[9].getStackForm() }, + { 10, MetaTileEntities.TRANSFORMER[10].getStackForm() }, + { 11, MetaTileEntities.TRANSFORMER[11].getStackForm() }, + { 12, MetaTileEntities.TRANSFORMER[12].getStackForm() }, + { 13, MetaTileEntities.TRANSFORMER[13].getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - CASING = new Component(Stream.of(new Object[][]{ + CASING = new Component(Stream.of(new Object[][] { - {0, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.ULV)}, - {1, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.LV)}, - {2, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.MV)}, - {3, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.HV)}, - {4, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.EV)}, - {5, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.IV)}, - {6, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.LuV)}, - {7, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.ZPM)}, - {8, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UV)}, - {9, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UHV)}, + { 0, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.ULV) }, + { 1, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.LV) }, + { 2, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.MV) }, + { 3, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.HV) }, + { 4, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.EV) }, + { 5, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.IV) }, + { 6, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.LuV) }, + { 7, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.ZPM) }, + { 8, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UV) }, + { 9, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UHV) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - CASING.appendIngredients(Stream.of(new Object[][]{ - {10, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UEV)}, - {11, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UIV)}, - {12, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UXV)}, - {13, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.OpV)}, - {14, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.MAX)}, + CASING.appendIngredients(Stream.of(new Object[][] { + { 10, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UEV) }, + { 11, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UIV) }, + { 12, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UXV) }, + { 13, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.OpV) }, + { 14, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.MAX) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - PIPE_NORMAL = new Component(Stream.of(new Object[][]{ + PIPE_NORMAL = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Bronze)}, - {1, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Bronze)}, - {2, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Steel)}, - {3, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.StainlessSteel)}, - {4, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Titanium)}, - {5, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.TungstenSteel)}, - {6, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Iridium)}, - {8, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Naquadah)}, + { 0, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Bronze) }, + { 1, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Bronze) }, + { 2, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Steel) }, + { 3, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.StainlessSteel) }, + { 4, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Titanium) }, + { 5, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.TungstenSteel) }, + { 6, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Iridium) }, + { 8, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Naquadah) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - PIPE_LARGE = new Component(Stream.of(new Object[][]{ + PIPE_LARGE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Bronze)}, - {1, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Bronze)}, - {2, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Steel)}, - {3, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.StainlessSteel)}, - {4, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Titanium)}, - {5, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.TungstenSteel)}, - {6, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Ultimet)}, - {8, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Naquadah)}, + { 0, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Bronze) }, + { 1, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Bronze) }, + { 2, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Steel) }, + { 3, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.StainlessSteel) }, + { 4, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Titanium) }, + { 5, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.TungstenSteel) }, + { 6, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Ultimet) }, + { 8, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Naquadah) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - - //TODO, Glass Tiers: + // TODO, Glass Tiers: /* - Glass: Steam-MV - Tempered: HV, EV - Laminated Glass: IV, LuV - Fusion: ZPM, UV - Some gregicality thing: UHV+ + * Glass: Steam-MV + * Tempered: HV, EV + * Laminated Glass: IV, LuV + * Fusion: ZPM, UV + * Some gregicality thing: UHV+ */ - GLASS = new Component(Stream.of(new Object[][]{ + GLASS = new Component(Stream.of(new Object[][] { - {GTValues.FALLBACK, new ItemStack(Blocks.GLASS, 1, GTValues.W)}, - {ULV, Blocks.GLASS}, - {LV, Blocks.GLASS}, - {MV, Blocks.GLASS}, - {HV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.TEMPERED_GLASS)}, - {EV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.TEMPERED_GLASS)}, - {IV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.LAMINATED_GLASS)}, - {LuV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.LAMINATED_GLASS)}, - {ZPM, MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.FUSION_GLASS)}, - {UV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.FUSION_GLASS)} + { GTValues.FALLBACK, new ItemStack(Blocks.GLASS, 1, GTValues.W) }, + { ULV, Blocks.GLASS }, + { LV, Blocks.GLASS }, + { MV, Blocks.GLASS }, + { HV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.TEMPERED_GLASS) }, + { EV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.TEMPERED_GLASS) }, + { IV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.LAMINATED_GLASS) }, + { LuV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.LAMINATED_GLASS) }, + { ZPM, MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.FUSION_GLASS) }, + { UV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.FUSION_GLASS) } }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - PLATE = new Component(Stream.of(new Object[][]{ + PLATE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.plate, Materials.WroughtIron)}, - {1, new UnificationEntry(OrePrefix.plate, Materials.Steel)}, - {2, new UnificationEntry(OrePrefix.plate, Materials.Aluminium)}, - {3, new UnificationEntry(OrePrefix.plate, Materials.StainlessSteel)}, - {4, new UnificationEntry(OrePrefix.plate, Materials.Titanium)}, - {5, new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel)}, - {6, new UnificationEntry(OrePrefix.plate, Materials.RhodiumPlatedPalladium)}, - {7, new UnificationEntry(OrePrefix.plate, Materials.NaquadahAlloy)}, - {8, new UnificationEntry(OrePrefix.plate, Materials.Darmstadtium)}, - {9, new UnificationEntry(OrePrefix.plate, Materials.Neutronium)}, + { 0, new UnificationEntry(OrePrefix.plate, Materials.WroughtIron) }, + { 1, new UnificationEntry(OrePrefix.plate, Materials.Steel) }, + { 2, new UnificationEntry(OrePrefix.plate, Materials.Aluminium) }, + { 3, new UnificationEntry(OrePrefix.plate, Materials.StainlessSteel) }, + { 4, new UnificationEntry(OrePrefix.plate, Materials.Titanium) }, + { 5, new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel) }, + { 6, new UnificationEntry(OrePrefix.plate, Materials.RhodiumPlatedPalladium) }, + { 7, new UnificationEntry(OrePrefix.plate, Materials.NaquadahAlloy) }, + { 8, new UnificationEntry(OrePrefix.plate, Materials.Darmstadtium) }, + { 9, new UnificationEntry(OrePrefix.plate, Materials.Neutronium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - DOUBLE_PLATE = new Component(Stream.of(new Object[][]{ + DOUBLE_PLATE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.plateDouble, Materials.WroughtIron)}, - {1, new UnificationEntry(OrePrefix.plateDouble, Materials.Steel)}, - {2, new UnificationEntry(OrePrefix.plateDouble, Materials.Aluminium)}, - {3, new UnificationEntry(OrePrefix.plateDouble, Materials.StainlessSteel)}, - {4, new UnificationEntry(OrePrefix.plateDouble, Materials.Titanium)}, - {5, new UnificationEntry(OrePrefix.plateDouble, Materials.TungstenSteel)}, - {6, new UnificationEntry(OrePrefix.plateDouble, Materials.RhodiumPlatedPalladium)}, - {7, new UnificationEntry(OrePrefix.plateDouble, Materials.NaquadahAlloy)}, - {8, new UnificationEntry(OrePrefix.plateDouble, Materials.Darmstadtium)}, - {9, new UnificationEntry(OrePrefix.plateDouble, Materials.Neutronium)}, + { 0, new UnificationEntry(OrePrefix.plateDouble, Materials.WroughtIron) }, + { 1, new UnificationEntry(OrePrefix.plateDouble, Materials.Steel) }, + { 2, new UnificationEntry(OrePrefix.plateDouble, Materials.Aluminium) }, + { 3, new UnificationEntry(OrePrefix.plateDouble, Materials.StainlessSteel) }, + { 4, new UnificationEntry(OrePrefix.plateDouble, Materials.Titanium) }, + { 5, new UnificationEntry(OrePrefix.plateDouble, Materials.TungstenSteel) }, + { 6, new UnificationEntry(OrePrefix.plateDouble, Materials.RhodiumPlatedPalladium) }, + { 7, new UnificationEntry(OrePrefix.plateDouble, Materials.NaquadahAlloy) }, + { 8, new UnificationEntry(OrePrefix.plateDouble, Materials.Darmstadtium) }, + { 9, new UnificationEntry(OrePrefix.plateDouble, Materials.Neutronium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - HULL_PLATE = new Component(Stream.of(new Object[][]{ + HULL_PLATE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.plate, Materials.Wood)}, - {1, new UnificationEntry(OrePrefix.plate, Materials.WroughtIron)}, - {2, new UnificationEntry(OrePrefix.plate, Materials.WroughtIron)}, - {3, new UnificationEntry(OrePrefix.plate, Materials.Polyethylene)}, - {4, new UnificationEntry(OrePrefix.plate, Materials.Polyethylene)}, - {5, new UnificationEntry(OrePrefix.plate, Materials.Polytetrafluoroethylene)}, - {6, new UnificationEntry(OrePrefix.plate, Materials.Polytetrafluoroethylene)}, - {7, new UnificationEntry(OrePrefix.plate, Materials.Polybenzimidazole)}, - {8, new UnificationEntry(OrePrefix.plate, Materials.Polybenzimidazole)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.plate, Materials.Polybenzimidazole)}, + { 0, new UnificationEntry(OrePrefix.plate, Materials.Wood) }, + { 1, new UnificationEntry(OrePrefix.plate, Materials.WroughtIron) }, + { 2, new UnificationEntry(OrePrefix.plate, Materials.WroughtIron) }, + { 3, new UnificationEntry(OrePrefix.plate, Materials.Polyethylene) }, + { 4, new UnificationEntry(OrePrefix.plate, Materials.Polyethylene) }, + { 5, new UnificationEntry(OrePrefix.plate, Materials.Polytetrafluoroethylene) }, + { 6, new UnificationEntry(OrePrefix.plate, Materials.Polytetrafluoroethylene) }, + { 7, new UnificationEntry(OrePrefix.plate, Materials.Polybenzimidazole) }, + { 8, new UnificationEntry(OrePrefix.plate, Materials.Polybenzimidazole) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.plate, Materials.Polybenzimidazole) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - MOTOR = new Component(Stream.of(new Object[][]{ + MOTOR = new Component(Stream.of(new Object[][] { - {1, MetaItems.ELECTRIC_MOTOR_LV.getStackForm()}, - {2, MetaItems.ELECTRIC_MOTOR_MV.getStackForm()}, - {3, MetaItems.ELECTRIC_MOTOR_HV.getStackForm()}, - {4, MetaItems.ELECTRIC_MOTOR_EV.getStackForm()}, - {5, MetaItems.ELECTRIC_MOTOR_IV.getStackForm()}, - {6, MetaItems.ELECTRIC_MOTOR_LuV.getStackForm()}, - {7, MetaItems.ELECTRIC_MOTOR_ZPM.getStackForm()}, - {8, MetaItems.ELECTRIC_MOTOR_UV.getStackForm()}, + { 1, MetaItems.ELECTRIC_MOTOR_LV.getStackForm() }, + { 2, MetaItems.ELECTRIC_MOTOR_MV.getStackForm() }, + { 3, MetaItems.ELECTRIC_MOTOR_HV.getStackForm() }, + { 4, MetaItems.ELECTRIC_MOTOR_EV.getStackForm() }, + { 5, MetaItems.ELECTRIC_MOTOR_IV.getStackForm() }, + { 6, MetaItems.ELECTRIC_MOTOR_LuV.getStackForm() }, + { 7, MetaItems.ELECTRIC_MOTOR_ZPM.getStackForm() }, + { 8, MetaItems.ELECTRIC_MOTOR_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - MOTOR.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.ELECTRIC_MOTOR_UHV.getStackForm()}, - {10, MetaItems.ELECTRIC_MOTOR_UEV.getStackForm()}, - {11, MetaItems.ELECTRIC_MOTOR_UIV.getStackForm()}, - {12, MetaItems.ELECTRIC_MOTOR_UXV.getStackForm()}, - {13, MetaItems.ELECTRIC_MOTOR_OpV.getStackForm()}, + MOTOR.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.ELECTRIC_MOTOR_UHV.getStackForm() }, + { 10, MetaItems.ELECTRIC_MOTOR_UEV.getStackForm() }, + { 11, MetaItems.ELECTRIC_MOTOR_UIV.getStackForm() }, + { 12, MetaItems.ELECTRIC_MOTOR_UXV.getStackForm() }, + { 13, MetaItems.ELECTRIC_MOTOR_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - ROTOR = new Component(Stream.of(new Object[][]{ + ROTOR = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.rotor, Materials.Tin)}, - {1, new UnificationEntry(OrePrefix.rotor, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.rotor, Materials.Bronze)}, - {3, new UnificationEntry(OrePrefix.rotor, Materials.Steel)}, - {4, new UnificationEntry(OrePrefix.rotor, Materials.StainlessSteel)}, - {5, new UnificationEntry(OrePrefix.rotor, Materials.TungstenSteel)}, - {6, new UnificationEntry(OrePrefix.rotor, Materials.RhodiumPlatedPalladium)}, - {7, new UnificationEntry(OrePrefix.rotor, Materials.NaquadahAlloy)}, - {8, new UnificationEntry(OrePrefix.rotor, Materials.Darmstadtium)}, + { 0, new UnificationEntry(OrePrefix.rotor, Materials.Tin) }, + { 1, new UnificationEntry(OrePrefix.rotor, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.rotor, Materials.Bronze) }, + { 3, new UnificationEntry(OrePrefix.rotor, Materials.Steel) }, + { 4, new UnificationEntry(OrePrefix.rotor, Materials.StainlessSteel) }, + { 5, new UnificationEntry(OrePrefix.rotor, Materials.TungstenSteel) }, + { 6, new UnificationEntry(OrePrefix.rotor, Materials.RhodiumPlatedPalladium) }, + { 7, new UnificationEntry(OrePrefix.rotor, Materials.NaquadahAlloy) }, + { 8, new UnificationEntry(OrePrefix.rotor, Materials.Darmstadtium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - SENSOR = new Component(Stream.of(new Object[][]{ + SENSOR = new Component(Stream.of(new Object[][] { - {1, MetaItems.SENSOR_LV.getStackForm()}, - {2, MetaItems.SENSOR_MV.getStackForm()}, - {3, MetaItems.SENSOR_HV.getStackForm()}, - {4, MetaItems.SENSOR_EV.getStackForm()}, - {5, MetaItems.SENSOR_IV.getStackForm()}, - {6, MetaItems.SENSOR_LuV.getStackForm()}, - {7, MetaItems.SENSOR_ZPM.getStackForm()}, - {8, MetaItems.SENSOR_UV.getStackForm()}, + { 1, MetaItems.SENSOR_LV.getStackForm() }, + { 2, MetaItems.SENSOR_MV.getStackForm() }, + { 3, MetaItems.SENSOR_HV.getStackForm() }, + { 4, MetaItems.SENSOR_EV.getStackForm() }, + { 5, MetaItems.SENSOR_IV.getStackForm() }, + { 6, MetaItems.SENSOR_LuV.getStackForm() }, + { 7, MetaItems.SENSOR_ZPM.getStackForm() }, + { 8, MetaItems.SENSOR_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - SENSOR.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.SENSOR_UHV.getStackForm()}, - {10, MetaItems.SENSOR_UEV.getStackForm()}, - {11, MetaItems.SENSOR_UIV.getStackForm()}, - {12, MetaItems.SENSOR_UXV.getStackForm()}, - {13, MetaItems.SENSOR_OpV.getStackForm()}, + SENSOR.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.SENSOR_UHV.getStackForm() }, + { 10, MetaItems.SENSOR_UEV.getStackForm() }, + { 11, MetaItems.SENSOR_UIV.getStackForm() }, + { 12, MetaItems.SENSOR_UXV.getStackForm() }, + { 13, MetaItems.SENSOR_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - GRINDER = new Component(Stream.of(new Object[][]{ + GRINDER = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.gem, Materials.Diamond)}, - {1, new UnificationEntry(OrePrefix.gem, Materials.Diamond)}, - {2, new UnificationEntry(OrePrefix.gem, Materials.Diamond)}, - {3, MetaItems.COMPONENT_GRINDER_DIAMOND.getStackForm()}, - {4, MetaItems.COMPONENT_GRINDER_DIAMOND.getStackForm()}, - {5, MetaItems.COMPONENT_GRINDER_TUNGSTEN.getStackForm()}, - {GTValues.FALLBACK, MetaItems.COMPONENT_GRINDER_TUNGSTEN.getStackForm()}, + { 0, new UnificationEntry(OrePrefix.gem, Materials.Diamond) }, + { 1, new UnificationEntry(OrePrefix.gem, Materials.Diamond) }, + { 2, new UnificationEntry(OrePrefix.gem, Materials.Diamond) }, + { 3, MetaItems.COMPONENT_GRINDER_DIAMOND.getStackForm() }, + { 4, MetaItems.COMPONENT_GRINDER_DIAMOND.getStackForm() }, + { 5, MetaItems.COMPONENT_GRINDER_TUNGSTEN.getStackForm() }, + { GTValues.FALLBACK, MetaItems.COMPONENT_GRINDER_TUNGSTEN.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - SAWBLADE = new Component(Stream.of(new Object[][]{ + SAWBLADE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Bronze)}, - {1, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.CobaltBrass)}, - {2, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.VanadiumSteel)}, - {3, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.BlueSteel)}, - {4, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Ultimet)}, - {5, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.TungstenCarbide)}, - {6, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.HSSE)}, - {7, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.NaquadahAlloy)}, - {8, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Duranium)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Duranium)}, + { 0, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Bronze) }, + { 1, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.CobaltBrass) }, + { 2, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.VanadiumSteel) }, + { 3, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.BlueSteel) }, + { 4, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Ultimet) }, + { 5, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.TungstenCarbide) }, + { 6, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.HSSE) }, + { 7, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.NaquadahAlloy) }, + { 8, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Duranium) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Duranium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - DIAMOND = new Component(Stream.of(new Object[][]{ + DIAMOND = new Component(Stream.of(new Object[][] { - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.gem, Materials.Diamond)}, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.gem, Materials.Diamond) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - PISTON = new Component(Stream.of(new Object[][]{ + PISTON = new Component(Stream.of(new Object[][] { - {1, MetaItems.ELECTRIC_PISTON_LV.getStackForm()}, - {2, MetaItems.ELECTRIC_PISTON_MV.getStackForm()}, - {3, MetaItems.ELECTRIC_PISTON_HV.getStackForm()}, - {4, MetaItems.ELECTRIC_PISTON_EV.getStackForm()}, - {5, MetaItems.ELECTRIC_PISTON_IV.getStackForm()}, - {6, MetaItems.ELECTRIC_PISTON_LUV.getStackForm()}, - {7, MetaItems.ELECTRIC_PISTON_ZPM.getStackForm()}, - {8, MetaItems.ELECTRIC_PISTON_UV.getStackForm()}, + { 1, MetaItems.ELECTRIC_PISTON_LV.getStackForm() }, + { 2, MetaItems.ELECTRIC_PISTON_MV.getStackForm() }, + { 3, MetaItems.ELECTRIC_PISTON_HV.getStackForm() }, + { 4, MetaItems.ELECTRIC_PISTON_EV.getStackForm() }, + { 5, MetaItems.ELECTRIC_PISTON_IV.getStackForm() }, + { 6, MetaItems.ELECTRIC_PISTON_LUV.getStackForm() }, + { 7, MetaItems.ELECTRIC_PISTON_ZPM.getStackForm() }, + { 8, MetaItems.ELECTRIC_PISTON_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - PISTON.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.ELECTRIC_PISTON_UHV.getStackForm()}, - {10, MetaItems.ELECTRIC_PISTON_UEV.getStackForm()}, - {11, MetaItems.ELECTRIC_PISTON_UIV.getStackForm()}, - {12, MetaItems.ELECTRIC_PISTON_UXV.getStackForm()}, - {13, MetaItems.ELECTRIC_PISTON_OpV.getStackForm()}, + PISTON.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.ELECTRIC_PISTON_UHV.getStackForm() }, + { 10, MetaItems.ELECTRIC_PISTON_UEV.getStackForm() }, + { 11, MetaItems.ELECTRIC_PISTON_UIV.getStackForm() }, + { 12, MetaItems.ELECTRIC_PISTON_UXV.getStackForm() }, + { 13, MetaItems.ELECTRIC_PISTON_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - EMITTER = new Component(Stream.of(new Object[][]{ + EMITTER = new Component(Stream.of(new Object[][] { - {1, MetaItems.EMITTER_LV.getStackForm()}, - {2, MetaItems.EMITTER_MV.getStackForm()}, - {3, MetaItems.EMITTER_HV.getStackForm()}, - {4, MetaItems.EMITTER_EV.getStackForm()}, - {5, MetaItems.EMITTER_IV.getStackForm()}, - {6, MetaItems.EMITTER_LuV.getStackForm()}, - {7, MetaItems.EMITTER_ZPM.getStackForm()}, - {8, MetaItems.EMITTER_UV.getStackForm()}, + { 1, MetaItems.EMITTER_LV.getStackForm() }, + { 2, MetaItems.EMITTER_MV.getStackForm() }, + { 3, MetaItems.EMITTER_HV.getStackForm() }, + { 4, MetaItems.EMITTER_EV.getStackForm() }, + { 5, MetaItems.EMITTER_IV.getStackForm() }, + { 6, MetaItems.EMITTER_LuV.getStackForm() }, + { 7, MetaItems.EMITTER_ZPM.getStackForm() }, + { 8, MetaItems.EMITTER_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - EMITTER.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.EMITTER_UHV.getStackForm()}, - {10, MetaItems.EMITTER_UEV.getStackForm()}, - {11, MetaItems.EMITTER_UIV.getStackForm()}, - {12, MetaItems.EMITTER_UXV.getStackForm()}, - {13, MetaItems.EMITTER_OpV.getStackForm()}, + EMITTER.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.EMITTER_UHV.getStackForm() }, + { 10, MetaItems.EMITTER_UEV.getStackForm() }, + { 11, MetaItems.EMITTER_UIV.getStackForm() }, + { 12, MetaItems.EMITTER_UXV.getStackForm() }, + { 13, MetaItems.EMITTER_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - CONVEYOR = new Component(Stream.of(new Object[][]{ + CONVEYOR = new Component(Stream.of(new Object[][] { - {1, MetaItems.CONVEYOR_MODULE_LV.getStackForm()}, - {2, MetaItems.CONVEYOR_MODULE_MV.getStackForm()}, - {3, MetaItems.CONVEYOR_MODULE_HV.getStackForm()}, - {4, MetaItems.CONVEYOR_MODULE_EV.getStackForm()}, - {5, MetaItems.CONVEYOR_MODULE_IV.getStackForm()}, - {6, MetaItems.CONVEYOR_MODULE_LuV.getStackForm()}, - {7, MetaItems.CONVEYOR_MODULE_ZPM.getStackForm()}, - {8, MetaItems.CONVEYOR_MODULE_UV.getStackForm()}, + { 1, MetaItems.CONVEYOR_MODULE_LV.getStackForm() }, + { 2, MetaItems.CONVEYOR_MODULE_MV.getStackForm() }, + { 3, MetaItems.CONVEYOR_MODULE_HV.getStackForm() }, + { 4, MetaItems.CONVEYOR_MODULE_EV.getStackForm() }, + { 5, MetaItems.CONVEYOR_MODULE_IV.getStackForm() }, + { 6, MetaItems.CONVEYOR_MODULE_LuV.getStackForm() }, + { 7, MetaItems.CONVEYOR_MODULE_ZPM.getStackForm() }, + { 8, MetaItems.CONVEYOR_MODULE_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - CONVEYOR.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.CONVEYOR_MODULE_UHV.getStackForm()}, - {10, MetaItems.CONVEYOR_MODULE_UEV.getStackForm()}, - {11, MetaItems.CONVEYOR_MODULE_UIV.getStackForm()}, - {12, MetaItems.CONVEYOR_MODULE_UXV.getStackForm()}, - {13, MetaItems.CONVEYOR_MODULE_OpV.getStackForm()}, + CONVEYOR.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.CONVEYOR_MODULE_UHV.getStackForm() }, + { 10, MetaItems.CONVEYOR_MODULE_UEV.getStackForm() }, + { 11, MetaItems.CONVEYOR_MODULE_UIV.getStackForm() }, + { 12, MetaItems.CONVEYOR_MODULE_UXV.getStackForm() }, + { 13, MetaItems.CONVEYOR_MODULE_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - ROBOT_ARM = new Component(Stream.of(new Object[][]{ + ROBOT_ARM = new Component(Stream.of(new Object[][] { - {1, MetaItems.ROBOT_ARM_LV.getStackForm()}, - {2, MetaItems.ROBOT_ARM_MV.getStackForm()}, - {3, MetaItems.ROBOT_ARM_HV.getStackForm()}, - {4, MetaItems.ROBOT_ARM_EV.getStackForm()}, - {5, MetaItems.ROBOT_ARM_IV.getStackForm()}, - {6, MetaItems.ROBOT_ARM_LuV.getStackForm()}, - {7, MetaItems.ROBOT_ARM_ZPM.getStackForm()}, - {8, MetaItems.ROBOT_ARM_UV.getStackForm()}, + { 1, MetaItems.ROBOT_ARM_LV.getStackForm() }, + { 2, MetaItems.ROBOT_ARM_MV.getStackForm() }, + { 3, MetaItems.ROBOT_ARM_HV.getStackForm() }, + { 4, MetaItems.ROBOT_ARM_EV.getStackForm() }, + { 5, MetaItems.ROBOT_ARM_IV.getStackForm() }, + { 6, MetaItems.ROBOT_ARM_LuV.getStackForm() }, + { 7, MetaItems.ROBOT_ARM_ZPM.getStackForm() }, + { 8, MetaItems.ROBOT_ARM_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - ROBOT_ARM.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.ROBOT_ARM_UHV.getStackForm()}, - {10, MetaItems.ROBOT_ARM_UEV.getStackForm()}, - {11, MetaItems.ROBOT_ARM_UIV.getStackForm()}, - {12, MetaItems.ROBOT_ARM_UXV.getStackForm()}, - {13, MetaItems.ROBOT_ARM_OpV.getStackForm()}, + ROBOT_ARM.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.ROBOT_ARM_UHV.getStackForm() }, + { 10, MetaItems.ROBOT_ARM_UEV.getStackForm() }, + { 11, MetaItems.ROBOT_ARM_UIV.getStackForm() }, + { 12, MetaItems.ROBOT_ARM_UXV.getStackForm() }, + { 13, MetaItems.ROBOT_ARM_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - COIL_HEATING = new Component(Stream.of(new Object[][]{ + COIL_HEATING = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Copper)}, - {1, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Copper)}, - {2, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Cupronickel)}, - {3, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Kanthal)}, - {4, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Nichrome)}, - {5, new UnificationEntry(OrePrefix.wireGtDouble, Materials.RTMAlloy)}, - {6, new UnificationEntry(OrePrefix.wireGtDouble, Materials.HSSG)}, - {7, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Naquadah)}, - {8, new UnificationEntry(OrePrefix.wireGtDouble, Materials.NaquadahAlloy)}, + { 0, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Copper) }, + { 1, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Copper) }, + { 2, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Cupronickel) }, + { 3, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Kanthal) }, + { 4, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Nichrome) }, + { 5, new UnificationEntry(OrePrefix.wireGtDouble, Materials.RTMAlloy) }, + { 6, new UnificationEntry(OrePrefix.wireGtDouble, Materials.HSSG) }, + { 7, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Naquadah) }, + { 8, new UnificationEntry(OrePrefix.wireGtDouble, Materials.NaquadahAlloy) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - COIL_HEATING_DOUBLE = new Component(Stream.of(new Object[][]{ + COIL_HEATING_DOUBLE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Copper)}, - {1, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Copper)}, - {2, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Cupronickel)}, - {3, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Kanthal)}, - {4, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Nichrome)}, - {5, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.RTMAlloy)}, - {6, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.HSSG)}, - {7, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Naquadah)}, - {8, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.NaquadahAlloy)}, + { 0, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Copper) }, + { 1, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Copper) }, + { 2, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Cupronickel) }, + { 3, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Kanthal) }, + { 4, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Nichrome) }, + { 5, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.RTMAlloy) }, + { 6, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.HSSG) }, + { 7, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Naquadah) }, + { 8, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.NaquadahAlloy) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); + COIL_ELECTRIC = new Component(Stream.of(new Object[][] { - COIL_ELECTRIC = new Component(Stream.of(new Object[][]{ - - {0, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Tin)}, - {1, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Silver)}, - {4, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Steel)}, - {5, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Graphene)}, - {6, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.NiobiumNitride)}, - {7, new UnificationEntry(OrePrefix.wireGtOctal, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.wireGtOctal, Materials.YttriumBariumCuprate)}, + { 0, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Tin) }, + { 1, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Silver) }, + { 4, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Steel) }, + { 5, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Graphene) }, + { 6, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.NiobiumNitride) }, + { 7, new UnificationEntry(OrePrefix.wireGtOctal, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.wireGtOctal, Materials.YttriumBariumCuprate) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - STICK_MAGNETIC = new Component(Stream.of(new Object[][]{ + STICK_MAGNETIC = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.stick, Materials.IronMagnetic)}, - {1, new UnificationEntry(OrePrefix.stick, Materials.IronMagnetic)}, - {2, new UnificationEntry(OrePrefix.stick, Materials.SteelMagnetic)}, - {3, new UnificationEntry(OrePrefix.stick, Materials.SteelMagnetic)}, - {4, new UnificationEntry(OrePrefix.stick, Materials.NeodymiumMagnetic)}, - {5, new UnificationEntry(OrePrefix.stick, Materials.NeodymiumMagnetic)}, - {6, new UnificationEntry(OrePrefix.stickLong, Materials.NeodymiumMagnetic)}, - {7, new UnificationEntry(OrePrefix.stickLong, Materials.NeodymiumMagnetic)}, - {8, new UnificationEntry(OrePrefix.block, Materials.NeodymiumMagnetic)}, + { 0, new UnificationEntry(OrePrefix.stick, Materials.IronMagnetic) }, + { 1, new UnificationEntry(OrePrefix.stick, Materials.IronMagnetic) }, + { 2, new UnificationEntry(OrePrefix.stick, Materials.SteelMagnetic) }, + { 3, new UnificationEntry(OrePrefix.stick, Materials.SteelMagnetic) }, + { 4, new UnificationEntry(OrePrefix.stick, Materials.NeodymiumMagnetic) }, + { 5, new UnificationEntry(OrePrefix.stick, Materials.NeodymiumMagnetic) }, + { 6, new UnificationEntry(OrePrefix.stickLong, Materials.NeodymiumMagnetic) }, + { 7, new UnificationEntry(OrePrefix.stickLong, Materials.NeodymiumMagnetic) }, + { 8, new UnificationEntry(OrePrefix.block, Materials.NeodymiumMagnetic) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - STICK_DISTILLATION = new Component(Stream.of(new Object[][]{ + STICK_DISTILLATION = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.stick, Materials.Blaze)}, - {1, new UnificationEntry(OrePrefix.spring, Materials.Copper)}, - {2, new UnificationEntry(OrePrefix.spring, Materials.Cupronickel)}, - {3, new UnificationEntry(OrePrefix.spring, Materials.Kanthal)}, - {4, new UnificationEntry(OrePrefix.spring, Materials.Nichrome)}, - {5, new UnificationEntry(OrePrefix.spring, Materials.RTMAlloy)}, - {6, new UnificationEntry(OrePrefix.spring, Materials.HSSG)}, - {7, new UnificationEntry(OrePrefix.spring, Materials.Naquadah)}, - {8, new UnificationEntry(OrePrefix.spring, Materials.NaquadahAlloy)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.stick, Materials.Blaze)}, + { 0, new UnificationEntry(OrePrefix.stick, Materials.Blaze) }, + { 1, new UnificationEntry(OrePrefix.spring, Materials.Copper) }, + { 2, new UnificationEntry(OrePrefix.spring, Materials.Cupronickel) }, + { 3, new UnificationEntry(OrePrefix.spring, Materials.Kanthal) }, + { 4, new UnificationEntry(OrePrefix.spring, Materials.Nichrome) }, + { 5, new UnificationEntry(OrePrefix.spring, Materials.RTMAlloy) }, + { 6, new UnificationEntry(OrePrefix.spring, Materials.HSSG) }, + { 7, new UnificationEntry(OrePrefix.spring, Materials.Naquadah) }, + { 8, new UnificationEntry(OrePrefix.spring, Materials.NaquadahAlloy) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.stick, Materials.Blaze) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - FIELD_GENERATOR = new Component(Stream.of(new Object[][]{ + FIELD_GENERATOR = new Component(Stream.of(new Object[][] { - {1, MetaItems.FIELD_GENERATOR_LV.getStackForm()}, - {2, MetaItems.FIELD_GENERATOR_MV.getStackForm()}, - {3, MetaItems.FIELD_GENERATOR_HV.getStackForm()}, - {4, MetaItems.FIELD_GENERATOR_EV.getStackForm()}, - {5, MetaItems.FIELD_GENERATOR_IV.getStackForm()}, - {6, MetaItems.FIELD_GENERATOR_LuV.getStackForm()}, - {7, MetaItems.FIELD_GENERATOR_ZPM.getStackForm()}, - {8, MetaItems.FIELD_GENERATOR_UV.getStackForm()}, + { 1, MetaItems.FIELD_GENERATOR_LV.getStackForm() }, + { 2, MetaItems.FIELD_GENERATOR_MV.getStackForm() }, + { 3, MetaItems.FIELD_GENERATOR_HV.getStackForm() }, + { 4, MetaItems.FIELD_GENERATOR_EV.getStackForm() }, + { 5, MetaItems.FIELD_GENERATOR_IV.getStackForm() }, + { 6, MetaItems.FIELD_GENERATOR_LuV.getStackForm() }, + { 7, MetaItems.FIELD_GENERATOR_ZPM.getStackForm() }, + { 8, MetaItems.FIELD_GENERATOR_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - FIELD_GENERATOR.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.FIELD_GENERATOR_UHV.getStackForm()}, - {10, MetaItems.FIELD_GENERATOR_UEV.getStackForm()}, - {11, MetaItems.FIELD_GENERATOR_UIV.getStackForm()}, - {12, MetaItems.FIELD_GENERATOR_UXV.getStackForm()}, - {13, MetaItems.FIELD_GENERATOR_OpV.getStackForm()}, + FIELD_GENERATOR.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.FIELD_GENERATOR_UHV.getStackForm() }, + { 10, MetaItems.FIELD_GENERATOR_UEV.getStackForm() }, + { 11, MetaItems.FIELD_GENERATOR_UIV.getStackForm() }, + { 12, MetaItems.FIELD_GENERATOR_UXV.getStackForm() }, + { 13, MetaItems.FIELD_GENERATOR_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - STICK_ELECTROMAGNETIC = new Component(Stream.of(new Object[][]{ + STICK_ELECTROMAGNETIC = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.stick, Materials.Iron)}, - {1, new UnificationEntry(OrePrefix.stick, Materials.Iron)}, - {2, new UnificationEntry(OrePrefix.stick, Materials.Steel)}, - {3, new UnificationEntry(OrePrefix.stick, Materials.Steel)}, - {4, new UnificationEntry(OrePrefix.stick, Materials.Neodymium)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.stick, Materials.VanadiumGallium)}, + { 0, new UnificationEntry(OrePrefix.stick, Materials.Iron) }, + { 1, new UnificationEntry(OrePrefix.stick, Materials.Iron) }, + { 2, new UnificationEntry(OrePrefix.stick, Materials.Steel) }, + { 3, new UnificationEntry(OrePrefix.stick, Materials.Steel) }, + { 4, new UnificationEntry(OrePrefix.stick, Materials.Neodymium) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.stick, Materials.VanadiumGallium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - STICK_RADIOACTIVE = new Component(Stream.of(new Object[][]{ + STICK_RADIOACTIVE = new Component(Stream.of(new Object[][] { - {4, new UnificationEntry(OrePrefix.stick, Materials.Uranium235)}, - {5, new UnificationEntry(OrePrefix.stick, Materials.Plutonium241)}, - {6, new UnificationEntry(OrePrefix.stick, Materials.NaquadahEnriched)}, - {7, new UnificationEntry(OrePrefix.stick, Materials.Americium)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.stick, Materials.Tritanium)}, + { 4, new UnificationEntry(OrePrefix.stick, Materials.Uranium235) }, + { 5, new UnificationEntry(OrePrefix.stick, Materials.Plutonium241) }, + { 6, new UnificationEntry(OrePrefix.stick, Materials.NaquadahEnriched) }, + { 7, new UnificationEntry(OrePrefix.stick, Materials.Americium) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.stick, Materials.Tritanium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - PIPE_REACTOR = new Component(Stream.of(new Object[][]{ + PIPE_REACTOR = new Component(Stream.of(new Object[][] { - {0, new ItemStack(Blocks.GLASS, 1, GTValues.W)}, - {1, new ItemStack(Blocks.GLASS, 1, GTValues.W)}, - {2, new ItemStack(Blocks.GLASS, 1, GTValues.W)}, - {3, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polyethylene)}, - {4, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Polyethylene)}, - {5, new UnificationEntry(OrePrefix.pipeHugeFluid, Materials.Polyethylene)}, - {6, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polytetrafluoroethylene)}, - {7, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Polytetrafluoroethylene)}, - {8, new UnificationEntry(OrePrefix.pipeHugeFluid, Materials.Polytetrafluoroethylene)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polyethylene)}, + { 0, new ItemStack(Blocks.GLASS, 1, GTValues.W) }, + { 1, new ItemStack(Blocks.GLASS, 1, GTValues.W) }, + { 2, new ItemStack(Blocks.GLASS, 1, GTValues.W) }, + { 3, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polyethylene) }, + { 4, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Polyethylene) }, + { 5, new UnificationEntry(OrePrefix.pipeHugeFluid, Materials.Polyethylene) }, + { 6, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polytetrafluoroethylene) }, + { 7, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Polytetrafluoroethylene) }, + { 8, new UnificationEntry(OrePrefix.pipeHugeFluid, Materials.Polytetrafluoroethylene) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polyethylene) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - POWER_COMPONENT = new Component(Stream.of(new Object[][]{ + POWER_COMPONENT = new Component(Stream.of(new Object[][] { - {2, MetaItems.ULTRA_LOW_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {3, MetaItems.LOW_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {4, MetaItems.POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {5, MetaItems.HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {6, MetaItems.HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {7, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {8, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {9, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {GTValues.FALLBACK, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT}, + { 2, MetaItems.ULTRA_LOW_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 3, MetaItems.LOW_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 4, MetaItems.POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 5, MetaItems.HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 6, MetaItems.HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 7, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 8, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 9, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { GTValues.FALLBACK, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - VOLTAGE_COIL = new Component(Stream.of(new Object[][]{ + VOLTAGE_COIL = new Component(Stream.of(new Object[][] { - {0, MetaItems.VOLTAGE_COIL_ULV.getStackForm()}, - {1, MetaItems.VOLTAGE_COIL_LV.getStackForm()}, - {2, MetaItems.VOLTAGE_COIL_MV.getStackForm()}, - {3, MetaItems.VOLTAGE_COIL_HV.getStackForm()}, - {4, MetaItems.VOLTAGE_COIL_EV.getStackForm()}, - {5, MetaItems.VOLTAGE_COIL_IV.getStackForm()}, - {6, MetaItems.VOLTAGE_COIL_LuV.getStackForm()}, - {7, MetaItems.VOLTAGE_COIL_ZPM.getStackForm()}, - {8, MetaItems.VOLTAGE_COIL_UV.getStackForm()}, - {GTValues.FALLBACK, MetaItems.VOLTAGE_COIL_UV}, + { 0, MetaItems.VOLTAGE_COIL_ULV.getStackForm() }, + { 1, MetaItems.VOLTAGE_COIL_LV.getStackForm() }, + { 2, MetaItems.VOLTAGE_COIL_MV.getStackForm() }, + { 3, MetaItems.VOLTAGE_COIL_HV.getStackForm() }, + { 4, MetaItems.VOLTAGE_COIL_EV.getStackForm() }, + { 5, MetaItems.VOLTAGE_COIL_IV.getStackForm() }, + { 6, MetaItems.VOLTAGE_COIL_LuV.getStackForm() }, + { 7, MetaItems.VOLTAGE_COIL_ZPM.getStackForm() }, + { 8, MetaItems.VOLTAGE_COIL_UV.getStackForm() }, + { GTValues.FALLBACK, MetaItems.VOLTAGE_COIL_UV }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - SPRING = new Component(Stream.of(new Object[][]{ + SPRING = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.spring, Materials.Lead)}, - {1, new UnificationEntry(OrePrefix.spring, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.spring, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.spring, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.spring, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.spring, Materials.Tungsten)}, - {6, new UnificationEntry(OrePrefix.spring, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.spring, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.spring, Materials.YttriumBariumCuprate)}, - {9, new UnificationEntry(OrePrefix.spring, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.spring, Materials.Lead) }, + { 1, new UnificationEntry(OrePrefix.spring, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.spring, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.spring, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.spring, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.spring, Materials.Tungsten) }, + { 6, new UnificationEntry(OrePrefix.spring, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.spring, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.spring, Materials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(OrePrefix.spring, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - public static class Component { private final Map ingredients; @@ -859,10 +856,7 @@ public Object getIngredient(int tier) { @SuppressWarnings("unused") public void appendIngredients(Map newIngredients) { ingredients.remove(GTValues.FALLBACK); - newIngredients.forEach((key, value) -> - ingredients.merge(key, value, (v1, v2) -> v2) - ); + newIngredients.forEach((key, value) -> ingredients.merge(key, value, (v1, v2) -> v2)); } } } - diff --git a/src/main/java/gregtech/loaders/recipe/CraftingRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/CraftingRecipeLoader.java index 3d835d9bd39..0b0d513a7f7 100644 --- a/src/main/java/gregtech/loaders/recipe/CraftingRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/CraftingRecipeLoader.java @@ -16,6 +16,7 @@ import gregtech.common.crafting.FacadeRecipe; import gregtech.common.items.MetaItems; import gregtech.loaders.recipe.handlers.ToolRecipeHandler; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -29,7 +30,8 @@ public class CraftingRecipeLoader { public static void init() { loadCraftingRecipes(); - GTLog.logger.info("Modifying vanilla recipes according to config. DON'T BE SCARED OF FML's WARNING ABOUT DANGEROUS ALTERNATIVE PREFIX."); + GTLog.logger.info( + "Modifying vanilla recipes according to config. DON'T BE SCARED OF FML's WARNING ABOUT DANGEROUS ALTERNATIVE PREFIX."); VanillaOverrideRecipes.init(); VanillaStandardRecipes.init(); } @@ -40,139 +42,305 @@ private static void loadCraftingRecipes() { ToolRecipeHandler.registerPowerUnitRecipes(); ToolRecipeHandler.registerCustomToolRecipes(); - ModHandler.addShapelessRecipe("integrated_circuit", IntCircuitIngredient.getIntegratedCircuit(0), new UnificationEntry(OrePrefix.circuit, Tier.LV)); + ModHandler.addShapelessRecipe("integrated_circuit", IntCircuitIngredient.getIntegratedCircuit(0), + new UnificationEntry(OrePrefix.circuit, Tier.LV)); - ModHandler.addShapedRecipe("item_filter", ITEM_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', new UnificationEntry(OrePrefix.plate, Materials.Steel)); - ModHandler.addShapedRecipe("fluid_filter_lapis", FLUID_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', new UnificationEntry(OrePrefix.plate, Materials.Lapis)); - ModHandler.addShapedRecipe("fluid_filter_lazurite", FLUID_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', new UnificationEntry(OrePrefix.plate, Materials.Lazurite)); - ModHandler.addShapedRecipe("fluid_filter_sodalite", FLUID_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', new UnificationEntry(OrePrefix.plate, Materials.Sodalite)); + ModHandler.addShapedRecipe("item_filter", ITEM_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', + new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', + new UnificationEntry(OrePrefix.plate, Materials.Steel)); + ModHandler.addShapedRecipe("fluid_filter_lapis", FLUID_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', + new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', + new UnificationEntry(OrePrefix.plate, Materials.Lapis)); + ModHandler.addShapedRecipe("fluid_filter_lazurite", FLUID_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', + new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', + new UnificationEntry(OrePrefix.plate, Materials.Lazurite)); + ModHandler.addShapedRecipe("fluid_filter_sodalite", FLUID_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', + new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', + new UnificationEntry(OrePrefix.plate, Materials.Sodalite)); - ModHandler.addShapedRecipe("ore_dictionary_filter_olivine", ORE_DICTIONARY_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', new UnificationEntry(OrePrefix.plate, Materials.Olivine)); - ModHandler.addShapedRecipe("ore_dictionary_filter_emerald", ORE_DICTIONARY_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', new UnificationEntry(OrePrefix.plate, Materials.Emerald)); + ModHandler.addShapedRecipe("ore_dictionary_filter_olivine", ORE_DICTIONARY_FILTER.getStackForm(), "XXX", "XYX", + "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', + new UnificationEntry(OrePrefix.plate, Materials.Olivine)); + ModHandler.addShapedRecipe("ore_dictionary_filter_emerald", ORE_DICTIONARY_FILTER.getStackForm(), "XXX", "XYX", + "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', + new UnificationEntry(OrePrefix.plate, Materials.Emerald)); - ModHandler.addShapedRecipe("smart_item_filter_olivine", SMART_FILTER.getStackForm(), "XEX", "XCX", "XEX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'C', new UnificationEntry(OrePrefix.circuit, Tier.LV), 'E', new UnificationEntry(OrePrefix.plate, Materials.Olivine)); - ModHandler.addShapedRecipe("smart_item_filter_emerald", SMART_FILTER.getStackForm(), "XEX", "XCX", "XEX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'C', new UnificationEntry(OrePrefix.circuit, Tier.LV), 'E', new UnificationEntry(OrePrefix.plate, Materials.Emerald)); + ModHandler.addShapedRecipe("smart_item_filter_olivine", SMART_FILTER.getStackForm(), "XEX", "XCX", "XEX", 'X', + new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'C', + new UnificationEntry(OrePrefix.circuit, Tier.LV), 'E', + new UnificationEntry(OrePrefix.plate, Materials.Olivine)); + ModHandler.addShapedRecipe("smart_item_filter_emerald", SMART_FILTER.getStackForm(), "XEX", "XCX", "XEX", 'X', + new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'C', + new UnificationEntry(OrePrefix.circuit, Tier.LV), 'E', + new UnificationEntry(OrePrefix.plate, Materials.Emerald)); - ModHandler.addShapedRecipe("plank_to_wooden_shape", WOODEN_FORM_EMPTY.getStackForm(), " ", " X ", "s ", 'X', new UnificationEntry(OrePrefix.plank, Materials.Wood)); - ModHandler.addShapedRecipe("wooden_shape_brick", WOODEN_FORM_BRICK.getStackForm(), "k ", " X", 'X', WOODEN_FORM_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("plank_to_wooden_shape", WOODEN_FORM_EMPTY.getStackForm(), " ", " X ", "s ", 'X', + new UnificationEntry(OrePrefix.plank, Materials.Wood)); + ModHandler.addShapedRecipe("wooden_shape_brick", WOODEN_FORM_BRICK.getStackForm(), "k ", " X", 'X', + WOODEN_FORM_EMPTY.getStackForm()); if (ConfigHolder.recipes.harderBrickRecipes) { - ModHandler.addShapelessRecipe("compressed_clay", COMPRESSED_CLAY.getStackForm(), WOODEN_FORM_BRICK.getStackForm(), new ItemStack(Items.CLAY_BALL)); + ModHandler.addShapelessRecipe("compressed_clay", COMPRESSED_CLAY.getStackForm(), + WOODEN_FORM_BRICK.getStackForm(), new ItemStack(Items.CLAY_BALL)); ModHandler.addSmeltingRecipe(COMPRESSED_CLAY.getStackForm(), new ItemStack(Items.BRICK), 0.3f); } - ModHandler.addShapedRecipe("compressed_coke_clay", COMPRESSED_COKE_CLAY.getStackForm(3), "XXX", "SYS", "SSS", 'Y', WOODEN_FORM_BRICK.getStackForm(), 'X', new ItemStack(Items.CLAY_BALL), 'S', "sand"); - ModHandler.addShapelessRecipe("fireclay_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Fireclay, 2), new UnificationEntry(OrePrefix.dust, Materials.Brick), new UnificationEntry(OrePrefix.dust, Materials.Clay)); + ModHandler.addShapedRecipe("compressed_coke_clay", COMPRESSED_COKE_CLAY.getStackForm(3), "XXX", "SYS", "SSS", + 'Y', WOODEN_FORM_BRICK.getStackForm(), 'X', new ItemStack(Items.CLAY_BALL), 'S', "sand"); + ModHandler.addShapelessRecipe("fireclay_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Fireclay, 2), + new UnificationEntry(OrePrefix.dust, Materials.Brick), + new UnificationEntry(OrePrefix.dust, Materials.Clay)); ModHandler.addSmeltingRecipe(COMPRESSED_COKE_CLAY.getStackForm(), COKE_OVEN_BRICK.getStackForm(), 0.3f); ModHandler.addSmeltingRecipe(COMPRESSED_FIRECLAY.getStackForm(), FIRECLAY_BRICK.getStackForm(), 0.3f); - ModHandler.addSmeltingRecipe(new UnificationEntry(OrePrefix.nugget, Materials.Iron), OreDictUnifier.get(OrePrefix.nugget, Materials.WroughtIron)); - - ModHandler.addShapedRecipe("clipboard", CLIPBOARD.getStackForm(), " Sd", "BWR", "PPP", 'P', Items.PAPER, 'R', new UnificationEntry(OrePrefix.springSmall, Iron), 'B', new UnificationEntry(OrePrefix.bolt, Iron), 'S', new UnificationEntry(OrePrefix.screw, Iron), 'W', new UnificationEntry(OrePrefix.plate, Wood)); + ModHandler.addSmeltingRecipe(new UnificationEntry(OrePrefix.nugget, Materials.Iron), + OreDictUnifier.get(OrePrefix.nugget, Materials.WroughtIron)); + ModHandler.addShapedRecipe("clipboard", CLIPBOARD.getStackForm(), " Sd", "BWR", "PPP", 'P', Items.PAPER, 'R', + new UnificationEntry(OrePrefix.springSmall, Iron), 'B', new UnificationEntry(OrePrefix.bolt, Iron), 'S', + new UnificationEntry(OrePrefix.screw, Iron), 'W', new UnificationEntry(OrePrefix.plate, Wood)); - ModHandler.addShapedRecipe("rubber_ring", OreDictUnifier.get(OrePrefix.ring, Materials.Rubber), "k", "X", 'X', new UnificationEntry(OrePrefix.plate, Materials.Rubber)); - ModHandler.addShapedRecipe("silicone_rubber_ring", OreDictUnifier.get(OrePrefix.ring, Materials.SiliconeRubber), "k", "P", 'P', OreDictUnifier.get(OrePrefix.plate, Materials.SiliconeRubber)); - ModHandler.addShapedRecipe("styrene_rubber_ring", OreDictUnifier.get(OrePrefix.ring, Materials.StyreneButadieneRubber), "k", "P", 'P', OreDictUnifier.get(OrePrefix.plate, Materials.StyreneButadieneRubber)); + ModHandler.addShapedRecipe("rubber_ring", OreDictUnifier.get(OrePrefix.ring, Materials.Rubber), "k", "X", 'X', + new UnificationEntry(OrePrefix.plate, Materials.Rubber)); + ModHandler.addShapedRecipe("silicone_rubber_ring", OreDictUnifier.get(OrePrefix.ring, Materials.SiliconeRubber), + "k", "P", 'P', OreDictUnifier.get(OrePrefix.plate, Materials.SiliconeRubber)); + ModHandler.addShapedRecipe("styrene_rubber_ring", + OreDictUnifier.get(OrePrefix.ring, Materials.StyreneButadieneRubber), "k", "P", 'P', + OreDictUnifier.get(OrePrefix.plate, Materials.StyreneButadieneRubber)); - ModHandler.addShapelessRecipe("iron_magnetic_stick", OreDictUnifier.get(OrePrefix.stick, Materials.IronMagnetic), new UnificationEntry(OrePrefix.stick, Materials.Iron), new UnificationEntry(OrePrefix.dust, Materials.Redstone), new UnificationEntry(OrePrefix.dust, Materials.Redstone), new UnificationEntry(OrePrefix.dust, Materials.Redstone), new UnificationEntry(OrePrefix.dust, Materials.Redstone)); + ModHandler.addShapelessRecipe("iron_magnetic_stick", + OreDictUnifier.get(OrePrefix.stick, Materials.IronMagnetic), + new UnificationEntry(OrePrefix.stick, Materials.Iron), + new UnificationEntry(OrePrefix.dust, Materials.Redstone), + new UnificationEntry(OrePrefix.dust, Materials.Redstone), + new UnificationEntry(OrePrefix.dust, Materials.Redstone), + new UnificationEntry(OrePrefix.dust, Materials.Redstone)); - ModHandler.addShapedRecipe("component_grinder_diamond", COMPONENT_GRINDER_DIAMOND.getStackForm(), "XSX", "SDS", "XSX", 'X', new UnificationEntry(OrePrefix.dust, Materials.Diamond), 'S', new UnificationEntry(OrePrefix.plateDouble, Materials.Steel), 'D', new UnificationEntry(OrePrefix.gem, Materials.Diamond)); - ModHandler.addShapedRecipe("component_grinder_tungsten", COMPONENT_GRINDER_TUNGSTEN.getStackForm(), "WSW", "SDS", "WSW", 'W', new UnificationEntry(OrePrefix.plate, Materials.Tungsten), 'S', new UnificationEntry(OrePrefix.plateDouble, Materials.VanadiumSteel), 'D', new UnificationEntry(OrePrefix.gem, Materials.Diamond)); + ModHandler.addShapedRecipe("component_grinder_diamond", COMPONENT_GRINDER_DIAMOND.getStackForm(), "XSX", "SDS", + "XSX", 'X', new UnificationEntry(OrePrefix.dust, Materials.Diamond), 'S', + new UnificationEntry(OrePrefix.plateDouble, Materials.Steel), 'D', + new UnificationEntry(OrePrefix.gem, Materials.Diamond)); + ModHandler.addShapedRecipe("component_grinder_tungsten", COMPONENT_GRINDER_TUNGSTEN.getStackForm(), "WSW", + "SDS", "WSW", 'W', new UnificationEntry(OrePrefix.plate, Materials.Tungsten), 'S', + new UnificationEntry(OrePrefix.plateDouble, Materials.VanadiumSteel), 'D', + new UnificationEntry(OrePrefix.gem, Materials.Diamond)); - ModHandler.addShapedRecipe("minecart_wheels_iron", IRON_MINECART_WHEELS.getStackForm(), " h ", "RSR", " w ", 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron), 'S', new UnificationEntry(OrePrefix.stick, Materials.Iron)); - ModHandler.addShapedRecipe("minecart_wheels_steel", STEEL_MINECART_WHEELS.getStackForm(), " h ", "RSR", " w ", 'R', new UnificationEntry(OrePrefix.ring, Materials.Steel), 'S', new UnificationEntry(OrePrefix.stick, Materials.Steel)); + ModHandler.addShapedRecipe("minecart_wheels_iron", IRON_MINECART_WHEELS.getStackForm(), " h ", "RSR", " w ", + 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Iron)); + ModHandler.addShapedRecipe("minecart_wheels_steel", STEEL_MINECART_WHEELS.getStackForm(), " h ", "RSR", " w ", + 'R', new UnificationEntry(OrePrefix.ring, Materials.Steel), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Steel)); - ModHandler.addShapedRecipe("nano_saber", NANO_SABER.getStackForm(), "PIC", "PIC", "XEX", 'P', new UnificationEntry(OrePrefix.plate, Materials.Platinum), 'I', new UnificationEntry(OrePrefix.plate, Ruridit), 'C', CARBON_FIBER_PLATE.getStackForm(), 'X', new UnificationEntry(OrePrefix.circuit, Tier.EV), 'E', ENERGIUM_CRYSTAL.getStackForm()); + ModHandler.addShapedRecipe("nano_saber", NANO_SABER.getStackForm(), "PIC", "PIC", "XEX", 'P', + new UnificationEntry(OrePrefix.plate, Materials.Platinum), 'I', + new UnificationEntry(OrePrefix.plate, Ruridit), 'C', CARBON_FIBER_PLATE.getStackForm(), 'X', + new UnificationEntry(OrePrefix.circuit, Tier.EV), 'E', ENERGIUM_CRYSTAL.getStackForm()); - ModHandler.addShapedRecipe("solar_panel_basic", COVER_SOLAR_PANEL.getStackForm(), "WGW", "CPC", 'W', SILICON_WAFER.getStackForm(), 'G', "paneGlass", 'C', new UnificationEntry(OrePrefix.circuit, Tier.LV), 'P', CARBON_FIBER_PLATE.getStackForm()); - ModHandler.addShapedRecipe("solar_panel_ulv", COVER_SOLAR_PANEL_ULV.getStackForm(), "WGW", "CAC", "P P", 'W', PHOSPHORUS_WAFER.getStackForm(), 'G', "paneGlass", 'C', new UnificationEntry(OrePrefix.circuit, Tier.HV), 'P', OreDictUnifier.get(OrePrefix.plate, GalliumArsenide), 'A', OreDictUnifier.get(OrePrefix.wireGtQuadruple, Graphene)); - ModHandler.addShapedRecipe("solar_panel_lv", COVER_SOLAR_PANEL_LV.getStackForm(), "WGW", "CAC", "P P", 'W', NAQUADAH_WAFER.getStackForm(), 'G', MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.TEMPERED_GLASS), 'C', new UnificationEntry(OrePrefix.circuit, Tier.LuV), 'P', OreDictUnifier.get(OrePrefix.plate, IndiumGalliumPhosphide), 'A', OreDictUnifier.get(OrePrefix.wireGtHex, Graphene)); + ModHandler.addShapedRecipe("solar_panel_basic", COVER_SOLAR_PANEL.getStackForm(), "WGW", "CPC", 'W', + SILICON_WAFER.getStackForm(), 'G', "paneGlass", 'C', new UnificationEntry(OrePrefix.circuit, Tier.LV), + 'P', CARBON_FIBER_PLATE.getStackForm()); + ModHandler.addShapedRecipe("solar_panel_ulv", COVER_SOLAR_PANEL_ULV.getStackForm(), "WGW", "CAC", "P P", 'W', + PHOSPHORUS_WAFER.getStackForm(), 'G', "paneGlass", 'C', + new UnificationEntry(OrePrefix.circuit, Tier.HV), 'P', + OreDictUnifier.get(OrePrefix.plate, GalliumArsenide), 'A', + OreDictUnifier.get(OrePrefix.wireGtQuadruple, Graphene)); + ModHandler.addShapedRecipe("solar_panel_lv", COVER_SOLAR_PANEL_LV.getStackForm(), "WGW", "CAC", "P P", 'W', + NAQUADAH_WAFER.getStackForm(), 'G', MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.TEMPERED_GLASS), + 'C', new UnificationEntry(OrePrefix.circuit, Tier.LuV), 'P', + OreDictUnifier.get(OrePrefix.plate, IndiumGalliumPhosphide), 'A', + OreDictUnifier.get(OrePrefix.wireGtHex, Graphene)); - ModHandler.addShapedRecipe("universal_fluid_cell", FLUID_CELL_UNIVERSAL.getStackForm(), "C ", " ", 'C', FLUID_CELL); - ModHandler.addShapedRecipe("universal_fluid_cell_revert", FLUID_CELL.getStackForm(), "C ", " ", 'C', FLUID_CELL_UNIVERSAL); + ModHandler.addShapedRecipe("universal_fluid_cell", FLUID_CELL_UNIVERSAL.getStackForm(), "C ", " ", 'C', + FLUID_CELL); + ModHandler.addShapedRecipe("universal_fluid_cell_revert", FLUID_CELL.getStackForm(), "C ", " ", 'C', + FLUID_CELL_UNIVERSAL); - ModHandler.addShapedRecipe("blacklight", BLACKLIGHT.getStackForm(), "SPS", "GRG", "CPK", 'S', new UnificationEntry(OrePrefix.screw, TungstenCarbide), 'P', new UnificationEntry(OrePrefix.plate, TungstenCarbide), 'G', MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS), 'R', new UnificationEntry(OrePrefix.spring, Europium), 'C', new UnificationEntry(OrePrefix.circuit, Tier.IV), 'K', new UnificationEntry(OrePrefix.cableGtSingle, Platinum)); + ModHandler.addShapedRecipe("blacklight", BLACKLIGHT.getStackForm(), "SPS", "GRG", "CPK", 'S', + new UnificationEntry(OrePrefix.screw, TungstenCarbide), 'P', + new UnificationEntry(OrePrefix.plate, TungstenCarbide), 'G', + MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS), 'R', + new UnificationEntry(OrePrefix.spring, Europium), 'C', new UnificationEntry(OrePrefix.circuit, Tier.IV), + 'K', new UnificationEntry(OrePrefix.cableGtSingle, Platinum)); - ModHandler.addShapedRecipe(true, "filter_casing", MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.FILTER_CASING, ConfigHolder.recipes.casingsPerCraft), "BBB", "III", "MFR", 'B', new ItemStack(Blocks.IRON_BARS), 'I', ITEM_FILTER.getStackForm(), 'M', ELECTRIC_MOTOR_MV.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Steel), 'R', new UnificationEntry(OrePrefix.rotor, Steel)); - ModHandler.addShapedRecipe(true, "filter_casing_sterile", MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.FILTER_CASING_STERILE, ConfigHolder.recipes.casingsPerCraft), "BEB", "ISI", "MFR", 'B', new UnificationEntry(OrePrefix.pipeLargeFluid, Polybenzimidazole), 'E', EMITTER_ZPM.getStackForm(), 'I', ITEM_FILTER.getStackForm(), 'S', BLACKLIGHT.getStackForm(), 'M', ELECTRIC_MOTOR_ZPM.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Tritanium), 'R', new UnificationEntry(OrePrefix.rotor, NaquadahAlloy)); + ModHandler.addShapedRecipe(true, "filter_casing", + MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.FILTER_CASING, + ConfigHolder.recipes.casingsPerCraft), + "BBB", "III", "MFR", 'B', new ItemStack(Blocks.IRON_BARS), 'I', ITEM_FILTER.getStackForm(), 'M', + ELECTRIC_MOTOR_MV.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Steel), 'R', + new UnificationEntry(OrePrefix.rotor, Steel)); + ModHandler.addShapedRecipe(true, "filter_casing_sterile", + MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.FILTER_CASING_STERILE, + ConfigHolder.recipes.casingsPerCraft), + "BEB", "ISI", "MFR", 'B', new UnificationEntry(OrePrefix.pipeLargeFluid, Polybenzimidazole), 'E', + EMITTER_ZPM.getStackForm(), 'I', ITEM_FILTER.getStackForm(), 'S', BLACKLIGHT.getStackForm(), 'M', + ELECTRIC_MOTOR_ZPM.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Tritanium), 'R', + new UnificationEntry(OrePrefix.rotor, NaquadahAlloy)); /////////////////////////////////////////////////// - // Shapes and Molds // + // Shapes and Molds // /////////////////////////////////////////////////// - ModHandler.addShapedRecipe("shape_empty", SHAPE_EMPTY.getStackForm(), "hf", "PP", "PP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel)); - - ModHandler.addShapedRecipe("shape_extruder_bottle", SHAPE_EXTRUDER_BOTTLE.getStackForm(), " x", " S ", " ", 'S', SHAPE_EXTRUDER_RING.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_gear", SHAPE_EXTRUDER_GEAR.getStackForm(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_RING.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_block", SHAPE_EXTRUDER_BLOCK.getStackForm(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_INGOT.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_pipe_huge", SHAPE_EXTRUDER_PIPE_HUGE.getStackForm(), " ", " S ", " x", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_pipe_large", SHAPE_EXTRUDER_PIPE_LARGE.getStackForm(), " ", " Sx", " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_pipe_normal", SHAPE_EXTRUDER_PIPE_NORMAL.getStackForm(), " x", " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_pipe_small", SHAPE_EXTRUDER_PIPE_SMALL.getStackForm(), " x ", " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_pipe_tiny", SHAPE_EXTRUDER_PIPE_TINY.getStackForm(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_wire", SHAPE_EXTRUDER_WIRE.getStackForm(), " x ", " S ", " ", 'S', SHAPE_EXTRUDER_ROD.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_ingot", SHAPE_EXTRUDER_INGOT.getStackForm(), "x ", " S ", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_cell", SHAPE_EXTRUDER_CELL.getStackForm(), " ", " Sx", " ", 'S', SHAPE_EXTRUDER_RING.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_ring", SHAPE_EXTRUDER_RING.getStackForm(), " ", " S ", " x ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_bolt", SHAPE_EXTRUDER_BOLT.getStackForm(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_ROD.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_rod", SHAPE_EXTRUDER_ROD.getStackForm(), " ", " Sx", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_rod_long", SHAPE_EXTRUDER_ROD_LONG.getStackForm(), " x", " S ", " ", 'S', SHAPE_EXTRUDER_ROD.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_plate", SHAPE_EXTRUDER_PLATE.getStackForm(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_FOIL.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_gear_small", SHAPE_EXTRUDER_GEAR_SMALL.getStackForm(), " x ", " S ", " ", 'S', SHAPE_EXTRUDER_RING.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_foil", SHAPE_EXTRUDER_FOIL.getStackForm(), " ", " S ", " x", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_rotor", SHAPE_EXTRUDER_ROTOR.getStackForm(), " ", " S ", "x ", 'S', SHAPE_EMPTY.getStackForm()); - - ModHandler.addShapedRecipe("shape_mold_rotor", SHAPE_MOLD_ROTOR.getStackForm(), " h", " S ", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_gear_small", SHAPE_MOLD_GEAR_SMALL.getStackForm(), " ", " ", "h S", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_name", SHAPE_MOLD_NAME.getStackForm(), " S", " ", "h ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_anvil", SHAPE_MOLD_ANVIL.getStackForm(), " S", " ", " h ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_cylinder", SHAPE_MOLD_CYLINDER.getStackForm(), " S", " ", " h", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_nugget", SHAPE_MOLD_NUGGET.getStackForm(), "S h", " ", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_block", SHAPE_MOLD_BLOCK.getStackForm(), " ", "hS ", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_ball", SHAPE_MOLD_BALL.getStackForm(), " ", " S ", "h ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_ingot", SHAPE_MOLD_INGOT.getStackForm(), " ", " S ", " h ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_bottle", SHAPE_MOLD_BOTTLE.getStackForm(), " ", " S ", " h", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_credit", SHAPE_MOLD_CREDIT.getStackForm(), "h ", " S ", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_gear", SHAPE_MOLD_GEAR.getStackForm(), " ", " Sh", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_plate", SHAPE_MOLD_PLATE.getStackForm(), " h ", " S ", " ", 'S', SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_empty", SHAPE_EMPTY.getStackForm(), "hf", "PP", "PP", 'P', + new UnificationEntry(OrePrefix.plate, Materials.Steel)); + + ModHandler.addShapedRecipe("shape_extruder_bottle", SHAPE_EXTRUDER_BOTTLE.getStackForm(), " x", " S ", " ", + 'S', SHAPE_EXTRUDER_RING.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_gear", SHAPE_EXTRUDER_GEAR.getStackForm(), "x ", " S ", " ", 'S', + SHAPE_EXTRUDER_RING.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_block", SHAPE_EXTRUDER_BLOCK.getStackForm(), "x ", " S ", " ", + 'S', SHAPE_EXTRUDER_INGOT.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_pipe_huge", SHAPE_EXTRUDER_PIPE_HUGE.getStackForm(), " ", " S ", + " x", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_pipe_large", SHAPE_EXTRUDER_PIPE_LARGE.getStackForm(), " ", " Sx", + " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_pipe_normal", SHAPE_EXTRUDER_PIPE_NORMAL.getStackForm(), " x", + " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_pipe_small", SHAPE_EXTRUDER_PIPE_SMALL.getStackForm(), " x ", " S ", + " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_pipe_tiny", SHAPE_EXTRUDER_PIPE_TINY.getStackForm(), "x ", " S ", + " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_wire", SHAPE_EXTRUDER_WIRE.getStackForm(), " x ", " S ", " ", 'S', + SHAPE_EXTRUDER_ROD.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_ingot", SHAPE_EXTRUDER_INGOT.getStackForm(), "x ", " S ", " ", + 'S', SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_cell", SHAPE_EXTRUDER_CELL.getStackForm(), " ", " Sx", " ", 'S', + SHAPE_EXTRUDER_RING.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_ring", SHAPE_EXTRUDER_RING.getStackForm(), " ", " S ", " x ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_bolt", SHAPE_EXTRUDER_BOLT.getStackForm(), "x ", " S ", " ", 'S', + SHAPE_EXTRUDER_ROD.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_rod", SHAPE_EXTRUDER_ROD.getStackForm(), " ", " Sx", " ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_rod_long", SHAPE_EXTRUDER_ROD_LONG.getStackForm(), " x", " S ", + " ", 'S', SHAPE_EXTRUDER_ROD.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_plate", SHAPE_EXTRUDER_PLATE.getStackForm(), "x ", " S ", " ", + 'S', SHAPE_EXTRUDER_FOIL.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_gear_small", SHAPE_EXTRUDER_GEAR_SMALL.getStackForm(), " x ", " S ", + " ", 'S', SHAPE_EXTRUDER_RING.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_foil", SHAPE_EXTRUDER_FOIL.getStackForm(), " ", " S ", " x", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_rotor", SHAPE_EXTRUDER_ROTOR.getStackForm(), " ", " S ", "x ", + 'S', SHAPE_EMPTY.getStackForm()); + + ModHandler.addShapedRecipe("shape_mold_rotor", SHAPE_MOLD_ROTOR.getStackForm(), " h", " S ", " ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_gear_small", SHAPE_MOLD_GEAR_SMALL.getStackForm(), " ", " ", "h S", + 'S', SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_name", SHAPE_MOLD_NAME.getStackForm(), " S", " ", "h ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_anvil", SHAPE_MOLD_ANVIL.getStackForm(), " S", " ", " h ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_cylinder", SHAPE_MOLD_CYLINDER.getStackForm(), " S", " ", " h", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_nugget", SHAPE_MOLD_NUGGET.getStackForm(), "S h", " ", " ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_block", SHAPE_MOLD_BLOCK.getStackForm(), " ", "hS ", " ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_ball", SHAPE_MOLD_BALL.getStackForm(), " ", " S ", "h ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_ingot", SHAPE_MOLD_INGOT.getStackForm(), " ", " S ", " h ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_bottle", SHAPE_MOLD_BOTTLE.getStackForm(), " ", " S ", " h", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_credit", SHAPE_MOLD_CREDIT.getStackForm(), "h ", " S ", " ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_gear", SHAPE_MOLD_GEAR.getStackForm(), " ", " Sh", " ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_plate", SHAPE_MOLD_PLATE.getStackForm(), " h ", " S ", " ", 'S', + SHAPE_EMPTY.getStackForm()); /////////////////////////////////////////////////// - // Credits // + // Credits // /////////////////////////////////////////////////// - ModHandler.addShapelessRecipe("coin_chocolate", COIN_CHOCOLATE.getStackForm(), new UnificationEntry(OrePrefix.dust, Materials.Cocoa), new UnificationEntry(OrePrefix.foil, Materials.Gold), new ItemStack(Items.MILK_BUCKET), new UnificationEntry(OrePrefix.dust, Materials.Sugar)); + ModHandler.addShapelessRecipe("coin_chocolate", COIN_CHOCOLATE.getStackForm(), + new UnificationEntry(OrePrefix.dust, Materials.Cocoa), + new UnificationEntry(OrePrefix.foil, Materials.Gold), new ItemStack(Items.MILK_BUCKET), + new UnificationEntry(OrePrefix.dust, Materials.Sugar)); - ModHandler.addShapelessRecipe("credit_copper", CREDIT_COPPER.getStackForm(8), CREDIT_CUPRONICKEL.getStackForm()); - ModHandler.addShapelessRecipe("credit_cupronickel_alt", CREDIT_CUPRONICKEL.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm()); - ModHandler.addShapelessRecipe("credit_cupronickel", CREDIT_CUPRONICKEL.getStackForm(8), CREDIT_SILVER.getStackForm()); - ModHandler.addShapelessRecipe("credit_silver_alt", CREDIT_SILVER.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm()); + ModHandler.addShapelessRecipe("credit_copper", CREDIT_COPPER.getStackForm(8), + CREDIT_CUPRONICKEL.getStackForm()); + ModHandler.addShapelessRecipe("credit_cupronickel_alt", CREDIT_CUPRONICKEL.getStackForm(), + CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), + CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), + CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm()); + ModHandler.addShapelessRecipe("credit_cupronickel", CREDIT_CUPRONICKEL.getStackForm(8), + CREDIT_SILVER.getStackForm()); + ModHandler.addShapelessRecipe("credit_silver_alt", CREDIT_SILVER.getStackForm(), + CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), + CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), + CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm()); ModHandler.addShapelessRecipe("credit_silver", CREDIT_SILVER.getStackForm(8), CREDIT_GOLD.getStackForm()); - ModHandler.addShapelessRecipe("credit_gold_alt", CREDIT_GOLD.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm()); + ModHandler.addShapelessRecipe("credit_gold_alt", CREDIT_GOLD.getStackForm(), CREDIT_SILVER.getStackForm(), + CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), + CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), + CREDIT_SILVER.getStackForm()); ModHandler.addShapelessRecipe("credit_gold", CREDIT_GOLD.getStackForm(8), CREDIT_PLATINUM.getStackForm()); - ModHandler.addShapelessRecipe("credit_platinum_alt", CREDIT_PLATINUM.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm()); + ModHandler.addShapelessRecipe("credit_platinum_alt", CREDIT_PLATINUM.getStackForm(), CREDIT_GOLD.getStackForm(), + CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), + CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), + CREDIT_GOLD.getStackForm()); ModHandler.addShapelessRecipe("credit_platinum", CREDIT_PLATINUM.getStackForm(8), CREDIT_OSMIUM.getStackForm()); - ModHandler.addShapelessRecipe("credit_osmium_alt", CREDIT_OSMIUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm()); + ModHandler.addShapelessRecipe("credit_osmium_alt", CREDIT_OSMIUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), + CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), + CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), + CREDIT_PLATINUM.getStackForm()); ModHandler.addShapelessRecipe("credit_osmium", CREDIT_OSMIUM.getStackForm(8), CREDIT_NAQUADAH.getStackForm()); - ModHandler.addShapelessRecipe("credit_naquadah_alt", CREDIT_NAQUADAH.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm()); - ModHandler.addShapelessRecipe("credit_naquadah", CREDIT_NAQUADAH.getStackForm(8), CREDIT_NEUTRONIUM.getStackForm()); - ModHandler.addShapelessRecipe("credit_darmstadtium", CREDIT_NEUTRONIUM.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm()); + ModHandler.addShapelessRecipe("credit_naquadah_alt", CREDIT_NAQUADAH.getStackForm(), + CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), + CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), + CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm()); + ModHandler.addShapelessRecipe("credit_naquadah", CREDIT_NAQUADAH.getStackForm(8), + CREDIT_NEUTRONIUM.getStackForm()); + ModHandler.addShapelessRecipe("credit_darmstadtium", CREDIT_NEUTRONIUM.getStackForm(), + CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), + CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), + CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm()); /////////////////////////////////////////////////// - // Armors // + // Armors // /////////////////////////////////////////////////// - ModHandler.addShapedRecipe("nightvision_goggles", MetaItems.NIGHTVISION_GOGGLES.getStackForm(), "CSC", "RBR", "LdL", 'C', new UnificationEntry(OrePrefix.circuit, Tier.ULV), 'S', new UnificationEntry(OrePrefix.screw, Steel), 'R', new UnificationEntry(OrePrefix.ring, Rubber), 'B', MetaItems.BATTERY_LV_SODIUM, 'L', new UnificationEntry(OrePrefix.lens, Glass)); - ModHandler.addShapedRecipe("fluid_jetpack", MetaItems.SEMIFLUID_JETPACK.getStackForm(), "xCw", "SUS", "RIR", 'C', new UnificationEntry(OrePrefix.circuit, Tier.LV), 'S', MetaItems.FLUID_CELL_LARGE_STEEL.getStackForm(), 'U', MetaItems.ELECTRIC_PUMP_LV.getStackForm(), 'R', new UnificationEntry(OrePrefix.rotor, Lead), 'I', new UnificationEntry(OrePrefix.pipeSmallFluid, Potin)); - ModHandler.addShapedRecipe("electric_jetpack", MetaItems.ELECTRIC_JETPACK.getStackForm(), "xCd", "TBT", "I I", 'C', new UnificationEntry(OrePrefix.circuit, Tier.MV), 'T', MetaItems.POWER_THRUSTER.getStackForm(), 'B', MetaItems.BATTERY_MV_LITHIUM.getStackForm(), 'I', new UnificationEntry(OrePrefix.wireGtDouble, AnnealedCopper)); - ModHandler.addShapedRecipe("electric_jetpack_advanced", MetaItems.ELECTRIC_JETPACK_ADVANCED.getStackForm(), "xJd", "TBT", "WCW", 'J', MetaItems.ELECTRIC_JETPACK.getStackForm(), 'T', MetaItems.POWER_THRUSTER_ADVANCED.getStackForm(), 'B', ENERGIUM_CRYSTAL.getStackForm(), 'W', new UnificationEntry(OrePrefix.wireGtQuadruple, Gold), 'C', new UnificationEntry(OrePrefix.circuit, Tier.HV)); - ModHandler.addShapedRecipe("nano_helmet", MetaItems.NANO_HELMET.getStackForm(), "PPP", "PNP", "xEd", 'P', MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'N', MetaItems.NIGHTVISION_GOGGLES.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); - ModHandler.addShapedRecipe("nano_chestplate", MetaItems.NANO_CHESTPLATE.getStackForm(), "PEP", "PPP", "PPP", 'P', MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); - ModHandler.addShapedRecipe("nano_leggings", MetaItems.NANO_LEGGINGS.getStackForm(), "PPP", "PEP", "PxP", 'P', MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); - ModHandler.addShapedRecipe("nano_boots", MetaItems.NANO_BOOTS.getStackForm(), "PxP", "PEP", 'P', MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); - ModHandler.addShapedRecipe("nano_chestplate_advanced", MetaItems.NANO_CHESTPLATE_ADVANCED.getStackForm(), "xJd", "PNP", "WCW", 'J', MetaItems.ELECTRIC_JETPACK_ADVANCED.getStackForm(), 'P', MetaItems.LOW_POWER_INTEGRATED_CIRCUIT.getStackForm(), 'N', MetaItems.NANO_CHESTPLATE.getStackForm(), 'W', new UnificationEntry(OrePrefix.wireGtQuadruple, Platinum), 'C', new UnificationEntry(OrePrefix.circuit, Tier.IV)); - ModHandler.addShapedRecipe("gravitation_engine", MetaItems.GRAVITATION_ENGINE.getStackForm(), "ESE", "POP", "ESE", 'E', MetaItems.EMITTER_LuV.getStackForm(), 'S', new UnificationEntry(OrePrefix.wireGtQuadruple, Osmium), 'P', new UnificationEntry(OrePrefix.plateDouble, Iridium), 'O', MetaItems.ENERGY_LAPOTRONIC_ORB.getStackForm()); + ModHandler.addShapedRecipe("nightvision_goggles", MetaItems.NIGHTVISION_GOGGLES.getStackForm(), "CSC", "RBR", + "LdL", 'C', new UnificationEntry(OrePrefix.circuit, Tier.ULV), 'S', + new UnificationEntry(OrePrefix.screw, Steel), 'R', new UnificationEntry(OrePrefix.ring, Rubber), 'B', + MetaItems.BATTERY_LV_SODIUM, 'L', new UnificationEntry(OrePrefix.lens, Glass)); + ModHandler.addShapedRecipe("fluid_jetpack", MetaItems.SEMIFLUID_JETPACK.getStackForm(), "xCw", "SUS", "RIR", + 'C', new UnificationEntry(OrePrefix.circuit, Tier.LV), 'S', + MetaItems.FLUID_CELL_LARGE_STEEL.getStackForm(), 'U', MetaItems.ELECTRIC_PUMP_LV.getStackForm(), 'R', + new UnificationEntry(OrePrefix.rotor, Lead), 'I', + new UnificationEntry(OrePrefix.pipeSmallFluid, Potin)); + ModHandler.addShapedRecipe("electric_jetpack", MetaItems.ELECTRIC_JETPACK.getStackForm(), "xCd", "TBT", "I I", + 'C', new UnificationEntry(OrePrefix.circuit, Tier.MV), 'T', MetaItems.POWER_THRUSTER.getStackForm(), + 'B', MetaItems.BATTERY_MV_LITHIUM.getStackForm(), 'I', + new UnificationEntry(OrePrefix.wireGtDouble, AnnealedCopper)); + ModHandler.addShapedRecipe("electric_jetpack_advanced", MetaItems.ELECTRIC_JETPACK_ADVANCED.getStackForm(), + "xJd", "TBT", "WCW", 'J', MetaItems.ELECTRIC_JETPACK.getStackForm(), 'T', + MetaItems.POWER_THRUSTER_ADVANCED.getStackForm(), 'B', ENERGIUM_CRYSTAL.getStackForm(), 'W', + new UnificationEntry(OrePrefix.wireGtQuadruple, Gold), 'C', + new UnificationEntry(OrePrefix.circuit, Tier.HV)); + ModHandler.addShapedRecipe("nano_helmet", MetaItems.NANO_HELMET.getStackForm(), "PPP", "PNP", "xEd", 'P', + MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'N', MetaItems.NIGHTVISION_GOGGLES.getStackForm(), 'E', + MetaItems.ENERGIUM_CRYSTAL.getStackForm()); + ModHandler.addShapedRecipe("nano_chestplate", MetaItems.NANO_CHESTPLATE.getStackForm(), "PEP", "PPP", "PPP", + 'P', MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); + ModHandler.addShapedRecipe("nano_leggings", MetaItems.NANO_LEGGINGS.getStackForm(), "PPP", "PEP", "PxP", 'P', + MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); + ModHandler.addShapedRecipe("nano_boots", MetaItems.NANO_BOOTS.getStackForm(), "PxP", "PEP", 'P', + MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); + ModHandler.addShapedRecipe("nano_chestplate_advanced", MetaItems.NANO_CHESTPLATE_ADVANCED.getStackForm(), "xJd", + "PNP", "WCW", 'J', MetaItems.ELECTRIC_JETPACK_ADVANCED.getStackForm(), 'P', + MetaItems.LOW_POWER_INTEGRATED_CIRCUIT.getStackForm(), 'N', MetaItems.NANO_CHESTPLATE.getStackForm(), + 'W', new UnificationEntry(OrePrefix.wireGtQuadruple, Platinum), 'C', + new UnificationEntry(OrePrefix.circuit, Tier.IV)); + ModHandler.addShapedRecipe("gravitation_engine", MetaItems.GRAVITATION_ENGINE.getStackForm(), "ESE", "POP", + "ESE", 'E', MetaItems.EMITTER_LuV.getStackForm(), 'S', + new UnificationEntry(OrePrefix.wireGtQuadruple, Osmium), 'P', + new UnificationEntry(OrePrefix.plateDouble, Iridium), 'O', + MetaItems.ENERGY_LAPOTRONIC_ORB.getStackForm()); } private static void registerFacadeRecipe(Material material, int facadeAmount) { OreIngredient ingredient = new OreIngredient(new UnificationEntry(OrePrefix.plate, material).toString()); - ForgeRegistries.RECIPES.register(new FacadeRecipe(null, ingredient, facadeAmount).setRegistryName("facade_" + material)); + ForgeRegistries.RECIPES + .register(new FacadeRecipe(null, ingredient, facadeAmount).setRegistryName("facade_" + material)); } } diff --git a/src/main/java/gregtech/loaders/recipe/DecorationRecipes.java b/src/main/java/gregtech/loaders/recipe/DecorationRecipes.java index a685699f7ea..75c0e216964 100644 --- a/src/main/java/gregtech/loaders/recipe/DecorationRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/DecorationRecipes.java @@ -2,21 +2,22 @@ import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; -import gregtech.common.blocks.BlockColored; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.item.EnumDyeColor; import static gregtech.api.recipes.RecipeMaps.*; + public class DecorationRecipes { - private DecorationRecipes(){} + private DecorationRecipes() {} + public static void init() { assemblerRecipes(); dyeRecipes(); } private static void assemblerRecipes() { - ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.block, Materials.Concrete, 5) .input(OrePrefix.plate, Materials.Iron, 2) @@ -40,11 +41,9 @@ private static void assemblerRecipes() { .outputs(MetaBlocks.STUDS.getItemVariant(EnumDyeColor.BLACK, 32)) .EUt(4).duration(20) .buildAndRegister(); - } private static void dyeRecipes() { - for (int i = 0; i < Materials.CHEMICAL_DYES.length; i++) { CHEMICAL_BATH_RECIPES.recipeBuilder() .inputs(MetaBlocks.METAL_SHEET.getItemVariant(EnumDyeColor.WHITE)) @@ -67,7 +66,5 @@ private static void dyeRecipes() { .EUt(2).duration(10) .buildAndRegister(); } - } - } diff --git a/src/main/java/gregtech/loaders/recipe/FuelRecipes.java b/src/main/java/gregtech/loaders/recipe/FuelRecipes.java index e1181f737e0..94da5ecb799 100644 --- a/src/main/java/gregtech/loaders/recipe/FuelRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/FuelRecipes.java @@ -8,7 +8,7 @@ public class FuelRecipes { public static void registerFuels() { - //diesel generator fuels + // diesel generator fuels RecipeMaps.COMBUSTION_GENERATOR_FUELS.recipeBuilder() .fluidInputs(Naphtha.getFluid(1)) .duration(10) @@ -99,7 +99,7 @@ public static void registerFuels() { .EUt((int) V[LV]) .buildAndRegister(); - //steam generator fuels + // steam generator fuels RecipeMaps.STEAM_TURBINE_FUELS.recipeBuilder() .fluidInputs(Steam.getFluid(640)) .fluidOutputs(DistilledWater.getFluid(4)) @@ -107,7 +107,7 @@ public static void registerFuels() { .EUt((int) V[LV]) .buildAndRegister(); - //gas turbine fuels + // gas turbine fuels RecipeMaps.GAS_TURBINE_FUELS.recipeBuilder() .fluidInputs(NaturalGas.getFluid(8)) .duration(5) @@ -216,7 +216,7 @@ public static void registerFuels() { .EUt((int) V[LV]) .buildAndRegister(); - //semi-fluid fuels, like creosote + // semi-fluid fuels, like creosote RecipeMaps.SEMI_FLUID_GENERATOR_FUELS.recipeBuilder() .fluidInputs(Creosote.getFluid(16)) .duration(1) @@ -259,7 +259,7 @@ public static void registerFuels() { .EUt((int) V[LV]) .buildAndRegister(); - //plasma turbine + // plasma turbine RecipeMaps.PLASMA_GENERATOR_FUELS.recipeBuilder() .fluidInputs(Helium.getPlasma(1)) .fluidOutputs(Helium.getFluid(1)) diff --git a/src/main/java/gregtech/loaders/recipe/FusionLoader.java b/src/main/java/gregtech/loaders/recipe/FusionLoader.java index 5803da01fb2..f5ec3a7b861 100644 --- a/src/main/java/gregtech/loaders/recipe/FusionLoader.java +++ b/src/main/java/gregtech/loaders/recipe/FusionLoader.java @@ -8,7 +8,6 @@ public class FusionLoader { public static void init() { - RecipeMaps.FUSION_RECIPES.recipeBuilder() .fluidInputs(Materials.Deuterium.getFluid(125)) .fluidInputs(Materials.Tritium.getFluid(125)) @@ -206,6 +205,5 @@ public static void init() { .EUt(VA[LuV]) .EUToStart(200_000_000) .buildAndRegister(); - } } diff --git a/src/main/java/gregtech/loaders/recipe/GTRecipeManager.java b/src/main/java/gregtech/loaders/recipe/GTRecipeManager.java index 07989f7b188..e91a9bd2c7a 100644 --- a/src/main/java/gregtech/loaders/recipe/GTRecipeManager.java +++ b/src/main/java/gregtech/loaders/recipe/GTRecipeManager.java @@ -4,6 +4,7 @@ import gregtech.loaders.recipe.handlers.DecompositionRecipeHandler; import gregtech.loaders.recipe.handlers.RecipeHandlerList; import gregtech.loaders.recipe.handlers.ToolRecipeHandler; + import net.minecraftforge.common.MinecraftForge; public final class GTRecipeManager { diff --git a/src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java index 3669cf026e9..eb820fbe624 100644 --- a/src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java @@ -28,6 +28,7 @@ import gregtech.common.metatileentities.storage.MetaTileEntityQuantumTank; import gregtech.loaders.recipe.chemistry.AssemblerRecipeLoader; import gregtech.loaders.recipe.chemistry.ChemistryRecipes; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; @@ -86,7 +87,6 @@ public static void init() { } private static void registerBendingCompressingRecipes() { - COMPRESSOR_RECIPES.recipeBuilder() .input(OrePrefix.dust, Materials.Fireclay) .outputs(MetaItems.COMPRESSED_FIRECLAY.getStackForm()) @@ -218,33 +218,54 @@ private static void registerBendingCompressingRecipes() { } private static void registerPrimitiveBlastFurnaceRecipes() { - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(gem, Coal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(dust, Coal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(gem, Charcoal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(dust, Charcoal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(OREDICT_FUEL_COKE).output(ingot, Steel).output(dustTiny, Ash).duration(1500).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(dust, Coke).output(ingot, Steel).output(dustTiny, Ash).duration(1500).buildAndRegister(); - - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, Iron).input(block, Coal, 2).output(block, Steel).output(dust, DarkAsh, 2).duration(16200).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, Iron).input(block, Charcoal, 2).output(block, Steel).output(dust, DarkAsh, 2).duration(16200).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, Iron).input(OREDICT_BLOCK_FUEL_COKE).output(block, Steel).output(dust, Ash).duration(13500).buildAndRegister(); - - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(gem, Coal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(dust, Coal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(gem, Charcoal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(dust, Charcoal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(OREDICT_FUEL_COKE).output(ingot, Steel).output(dustTiny, Ash).duration(600).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(dust, Coke).output(ingot, Steel).output(dustTiny, Ash).duration(600).buildAndRegister(); - - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, WroughtIron).input(block, Coal, 2).output(block, Steel).output(dust, DarkAsh, 2).duration(7200).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, WroughtIron).input(block, Charcoal, 2).output(block, Steel).output(dust, DarkAsh, 2).duration(7200).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, WroughtIron).input(OREDICT_BLOCK_FUEL_COKE).output(block, Steel).output(dust, Ash).duration(5400).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(gem, Coal, 2).output(ingot, Steel) + .output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(dust, Coal, 2).output(ingot, Steel) + .output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(gem, Charcoal, 2).output(ingot, Steel) + .output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(dust, Charcoal, 2).output(ingot, Steel) + .output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(OREDICT_FUEL_COKE).output(ingot, Steel) + .output(dustTiny, Ash).duration(1500).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(dust, Coke).output(ingot, Steel) + .output(dustTiny, Ash).duration(1500).buildAndRegister(); + + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, Iron).input(block, Coal, 2).output(block, Steel) + .output(dust, DarkAsh, 2).duration(16200).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, Iron).input(block, Charcoal, 2) + .output(block, Steel).output(dust, DarkAsh, 2).duration(16200).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, Iron).input(OREDICT_BLOCK_FUEL_COKE) + .output(block, Steel).output(dust, Ash).duration(13500).buildAndRegister(); + + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(gem, Coal, 2) + .output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(dust, Coal, 2) + .output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(gem, Charcoal, 2) + .output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(dust, Charcoal, 2) + .output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(OREDICT_FUEL_COKE) + .output(ingot, Steel).output(dustTiny, Ash).duration(600).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(dust, Coke).output(ingot, Steel) + .output(dustTiny, Ash).duration(600).buildAndRegister(); + + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, WroughtIron).input(block, Coal, 2) + .output(block, Steel).output(dust, DarkAsh, 2).duration(7200).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, WroughtIron).input(block, Charcoal, 2) + .output(block, Steel).output(dust, DarkAsh, 2).duration(7200).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, WroughtIron).input(OREDICT_BLOCK_FUEL_COKE) + .output(block, Steel).output(dust, Ash).duration(5400).buildAndRegister(); } private static void registerCokeOvenRecipes() { - COKE_OVEN_RECIPES.recipeBuilder().input(log, Wood).output(gem, Charcoal).fluidOutputs(Creosote.getFluid(250)).duration(900).buildAndRegister(); - COKE_OVEN_RECIPES.recipeBuilder().input(gem, Coal).output(gem, Coke).fluidOutputs(Creosote.getFluid(500)).duration(900).buildAndRegister(); - COKE_OVEN_RECIPES.recipeBuilder().input(block, Coal).output(block, Coke).fluidOutputs(Creosote.getFluid(4500)).duration(8100).buildAndRegister(); + COKE_OVEN_RECIPES.recipeBuilder().input(log, Wood).output(gem, Charcoal).fluidOutputs(Creosote.getFluid(250)) + .duration(900).buildAndRegister(); + COKE_OVEN_RECIPES.recipeBuilder().input(gem, Coal).output(gem, Coke).fluidOutputs(Creosote.getFluid(500)) + .duration(900).buildAndRegister(); + COKE_OVEN_RECIPES.recipeBuilder().input(block, Coal).output(block, Coke).fluidOutputs(Creosote.getFluid(4500)) + .duration(8100).buildAndRegister(); } private static void registerStoneBricksRecipes() { @@ -297,19 +318,18 @@ private static void registerStoneBricksRecipes() { } private static void registerMixingCrystallizationRecipes() { - RecipeMaps.AUTOCLAVE_RECIPES.recipeBuilder() .input(OrePrefix.dust, Materials.SiliconDioxide) .fluidInputs(Materials.DistilledWater.getFluid(250)) .chancedOutput(OreDictUnifier.get(OrePrefix.gem, Materials.Quartzite), 1000, 1000) .duration(1200).EUt(24).buildAndRegister(); - //todo find UU-Matter replacement -// RecipeMaps.AUTOCLAVE_RECIPES.recipeBuilder() -// .input(OrePrefix.dust, Materials.NetherStar) -// .fluidInputs(Materials.UUMatter.getFluid(576)) -// .chancedOutput(new ItemStack(Items.NETHER_STAR), 3333, 3333) -// .duration(72000).EUt(VA[HV]).buildAndRegister(); + // todo find UU-Matter replacement + // RecipeMaps.AUTOCLAVE_RECIPES.recipeBuilder() + // .input(OrePrefix.dust, Materials.NetherStar) + // .fluidInputs(Materials.UUMatter.getFluid(576)) + // .chancedOutput(new ItemStack(Items.NETHER_STAR), 3333, 3333) + // .duration(72000).EUt(VA[HV]).buildAndRegister(); RecipeMaps.MIXER_RECIPES.recipeBuilder() .input(OrePrefix.crushedPurified, Materials.Sphalerite) @@ -335,26 +355,41 @@ private static void registerMixingCrystallizationRecipes() { .fluidInputs(Concrete.getFluid(L)) .outputs(MetaBlocks.ASPHALT.getItemVariant(BlockAsphalt.BlockType.ASPHALT)) .duration(60).EUt(16).buildAndRegister(); - } private static final MaterialStack[][] alloySmelterList = { - {new MaterialStack(Materials.Copper, 3L), new MaterialStack(Materials.Tin, 1), new MaterialStack(Materials.Bronze, 4L)}, - {new MaterialStack(Materials.Copper, 3L), new MaterialStack(Materials.Zinc, 1), new MaterialStack(Materials.Brass, 4L)}, - {new MaterialStack(Materials.Copper, 1), new MaterialStack(Materials.Nickel, 1), new MaterialStack(Materials.Cupronickel, 2L)}, - {new MaterialStack(Materials.Copper, 1), new MaterialStack(Materials.Redstone, 4L), new MaterialStack(Materials.RedAlloy, 1)}, - {new MaterialStack(Materials.AnnealedCopper, 3L), new MaterialStack(Materials.Tin, 1), new MaterialStack(Materials.Bronze, 4L)}, - {new MaterialStack(Materials.AnnealedCopper, 3L), new MaterialStack(Materials.Zinc, 1), new MaterialStack(Materials.Brass, 4L)}, - {new MaterialStack(Materials.AnnealedCopper, 1), new MaterialStack(Materials.Nickel, 1), new MaterialStack(Materials.Cupronickel, 2L)}, - {new MaterialStack(Materials.AnnealedCopper, 1), new MaterialStack(Materials.Redstone, 4L), new MaterialStack(Materials.RedAlloy, 1)}, - {new MaterialStack(Materials.Iron, 1), new MaterialStack(Materials.Tin, 1), new MaterialStack(Materials.TinAlloy, 2L)}, - {new MaterialStack(Materials.WroughtIron, 1), new MaterialStack(Materials.Tin, 1), new MaterialStack(Materials.TinAlloy, 2L)}, - {new MaterialStack(Materials.Iron, 2L), new MaterialStack(Materials.Nickel, 1), new MaterialStack(Materials.Invar, 3L)}, - {new MaterialStack(Materials.WroughtIron, 2L), new MaterialStack(Materials.Nickel, 1), new MaterialStack(Materials.Invar, 3L)}, - {new MaterialStack(Materials.Lead, 4L), new MaterialStack(Materials.Antimony, 1), new MaterialStack(Materials.BatteryAlloy, 5L)}, - {new MaterialStack(Materials.Gold, 1), new MaterialStack(Materials.Silver, 1), new MaterialStack(Materials.Electrum, 2L)}, - {new MaterialStack(Materials.Magnesium, 1), new MaterialStack(Materials.Aluminium, 2L), new MaterialStack(Materials.Magnalium, 3L)}, - {new MaterialStack(Materials.Silver, 1), new MaterialStack(Materials.Electrotine, 4), new MaterialStack(Materials.BlueAlloy, 1)}}; + { new MaterialStack(Materials.Copper, 3L), new MaterialStack(Materials.Tin, 1), + new MaterialStack(Materials.Bronze, 4L) }, + { new MaterialStack(Materials.Copper, 3L), new MaterialStack(Materials.Zinc, 1), + new MaterialStack(Materials.Brass, 4L) }, + { new MaterialStack(Materials.Copper, 1), new MaterialStack(Materials.Nickel, 1), + new MaterialStack(Materials.Cupronickel, 2L) }, + { new MaterialStack(Materials.Copper, 1), new MaterialStack(Materials.Redstone, 4L), + new MaterialStack(Materials.RedAlloy, 1) }, + { new MaterialStack(Materials.AnnealedCopper, 3L), new MaterialStack(Materials.Tin, 1), + new MaterialStack(Materials.Bronze, 4L) }, + { new MaterialStack(Materials.AnnealedCopper, 3L), new MaterialStack(Materials.Zinc, 1), + new MaterialStack(Materials.Brass, 4L) }, + { new MaterialStack(Materials.AnnealedCopper, 1), new MaterialStack(Materials.Nickel, 1), + new MaterialStack(Materials.Cupronickel, 2L) }, + { new MaterialStack(Materials.AnnealedCopper, 1), new MaterialStack(Materials.Redstone, 4L), + new MaterialStack(Materials.RedAlloy, 1) }, + { new MaterialStack(Materials.Iron, 1), new MaterialStack(Materials.Tin, 1), + new MaterialStack(Materials.TinAlloy, 2L) }, + { new MaterialStack(Materials.WroughtIron, 1), new MaterialStack(Materials.Tin, 1), + new MaterialStack(Materials.TinAlloy, 2L) }, + { new MaterialStack(Materials.Iron, 2L), new MaterialStack(Materials.Nickel, 1), + new MaterialStack(Materials.Invar, 3L) }, + { new MaterialStack(Materials.WroughtIron, 2L), new MaterialStack(Materials.Nickel, 1), + new MaterialStack(Materials.Invar, 3L) }, + { new MaterialStack(Materials.Lead, 4L), new MaterialStack(Materials.Antimony, 1), + new MaterialStack(Materials.BatteryAlloy, 5L) }, + { new MaterialStack(Materials.Gold, 1), new MaterialStack(Materials.Silver, 1), + new MaterialStack(Materials.Electrum, 2L) }, + { new MaterialStack(Materials.Magnesium, 1), new MaterialStack(Materials.Aluminium, 2L), + new MaterialStack(Materials.Magnalium, 3L) }, + { new MaterialStack(Materials.Silver, 1), new MaterialStack(Materials.Electrotine, 4), + new MaterialStack(Materials.BlueAlloy, 1) } }; private static void registerAlloyRecipes() { for (MaterialStack[] stack : alloySmelterList) { @@ -374,8 +409,7 @@ private static void registerAlloyRecipes() { .outputs(OreDictUnifier.get(OrePrefix.ingot, stack[2].material, (int) stack[2].amount)) .buildAndRegister(); } - if (stack[0].material.hasProperty(PropertyKey.INGOT) - && stack[1].material.hasProperty(PropertyKey.INGOT)) { + if (stack[0].material.hasProperty(PropertyKey.INGOT) && stack[1].material.hasProperty(PropertyKey.INGOT)) { RecipeMaps.ALLOY_SMELTER_RECIPES.recipeBuilder() .duration((int) stack[2].amount * 50).EUt(16) .input(OrePrefix.ingot, stack[0].material, (int) stack[0].amount) @@ -391,13 +425,19 @@ private static void registerAlloyRecipes() { .buildAndRegister(); } - COMPRESSOR_RECIPES.recipeBuilder().inputs(MetaItems.CARBON_FIBERS.getStackForm(2)).outputs(MetaItems.CARBON_MESH.getStackForm()).duration(100).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().inputs(MetaItems.CARBON_MESH.getStackForm()).outputs(MetaItems.CARBON_FIBER_PLATE.getStackForm()).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().inputs(MetaItems.CARBON_FIBERS.getStackForm(2)) + .outputs(MetaItems.CARBON_MESH.getStackForm()).duration(100).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().inputs(MetaItems.CARBON_MESH.getStackForm()) + .outputs(MetaItems.CARBON_FIBER_PLATE.getStackForm()).buildAndRegister(); - ALLOY_SMELTER_RECIPES.recipeBuilder().duration(10).EUt(VA[ULV]).input(OrePrefix.ingot, Materials.Rubber, 2).notConsumable(MetaItems.SHAPE_MOLD_PLATE).output(OrePrefix.plate, Materials.Rubber).buildAndRegister(); - ALLOY_SMELTER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).input(OrePrefix.dust, Materials.Sulfur).input(OrePrefix.dust, Materials.RawRubber, 3).output(OrePrefix.ingot, Materials.Rubber).buildAndRegister(); + ALLOY_SMELTER_RECIPES.recipeBuilder().duration(10).EUt(VA[ULV]).input(OrePrefix.ingot, Materials.Rubber, 2) + .notConsumable(MetaItems.SHAPE_MOLD_PLATE).output(OrePrefix.plate, Materials.Rubber).buildAndRegister(); + ALLOY_SMELTER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).input(OrePrefix.dust, Materials.Sulfur) + .input(OrePrefix.dust, Materials.RawRubber, 3).output(OrePrefix.ingot, Materials.Rubber) + .buildAndRegister(); - ALLOY_SMELTER_RECIPES.recipeBuilder().duration(150).EUt(VA[ULV]).inputs(OreDictUnifier.get("sand")).inputs(new ItemStack(Items.CLAY_BALL)).outputs(COKE_OVEN_BRICK.getStackForm(2)).buildAndRegister(); + ALLOY_SMELTER_RECIPES.recipeBuilder().duration(150).EUt(VA[ULV]).inputs(OreDictUnifier.get("sand")) + .inputs(new ItemStack(Items.CLAY_BALL)).outputs(COKE_OVEN_BRICK.getStackForm(2)).buildAndRegister(); } private static void registerAssemblerRecipes() { @@ -583,99 +623,314 @@ private static void registerAssemblerRecipes() { .duration(100) .buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, WroughtIron, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ULV)).circuitMeta(8).duration(25).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Steel, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Aluminium, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.MV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, StainlessSteel, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.HV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Titanium, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.EV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, TungstenSteel, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.IV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, RhodiumPlatedPalladium, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, NaquadahAlloy, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Darmstadtium, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Neutronium, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UHV)).circuitMeta(8).duration(50).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(OrePrefix.wireGtDouble, Materials.Cupronickel, 8).input(OrePrefix.foil, Materials.Bronze, 8).fluidInputs(Materials.TinAlloy.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.CUPRONICKEL)).duration(200).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[MV]).input(OrePrefix.wireGtDouble, Materials.Kanthal, 8).input(OrePrefix.foil, Materials.Aluminium, 8).fluidInputs(Materials.Copper.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.KANTHAL)).duration(300).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[HV]).input(OrePrefix.wireGtDouble, Materials.Nichrome, 8).input(OrePrefix.foil, Materials.StainlessSteel, 8).fluidInputs(Materials.Aluminium.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.NICHROME)).duration(400).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[EV]).input(OrePrefix.wireGtDouble, Materials.RTMAlloy, 8).input(OrePrefix.foil, Materials.VanadiumSteel, 8).fluidInputs(Materials.Nichrome.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.RTM_ALLOY)).duration(500).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[IV]).input(OrePrefix.wireGtDouble, Materials.HSSG, 8).input(OrePrefix.foil, Materials.TungstenCarbide, 8).fluidInputs(Materials.Tungsten.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.HSS_G)).duration(600).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).input(OrePrefix.wireGtDouble, Materials.Naquadah, 8).input(OrePrefix.foil, Materials.Osmium, 8).fluidInputs(Materials.TungstenSteel.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.NAQUADAH)).duration(700).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).input(OrePrefix.wireGtDouble, Materials.Trinium, 8).input(OrePrefix.foil, Materials.NaquadahEnriched, 8).fluidInputs(Materials.Naquadah.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.TRINIUM)).duration(800).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).input(OrePrefix.wireGtDouble, Materials.Tritanium, 8).input(OrePrefix.foil, Materials.Naquadria, 8).fluidInputs(Materials.Trinium.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.TRITANIUM)).duration(900).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Bronze, 6).inputs(new ItemStack(Blocks.BRICK_BLOCK, 1)).circuitMeta(6).outputs(METAL_CASING.getItemVariant(BRONZE_BRICKS, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Invar, 6).input(OrePrefix.frameGt, Materials.Invar, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.INVAR_HEATPROOF, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Steel, 6).input(OrePrefix.frameGt, Materials.Steel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STEEL_SOLID, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Aluminium, 6).input(OrePrefix.frameGt, Materials.Aluminium, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.ALUMINIUM_FROSTPROOF, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.TungstenSteel, 6).input(OrePrefix.frameGt, Materials.TungstenSteel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.TUNGSTENSTEEL_ROBUST, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.StainlessSteel, 6).input(OrePrefix.frameGt, Materials.StainlessSteel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STAINLESS_CLEAN, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Titanium, 6).input(OrePrefix.frameGt, Materials.Titanium, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.TITANIUM_STABLE, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(plate, HSSE, 6).input(frameGt, Europium).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.HSSE_STURDY, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(plate, Palladium, 6).input(frameGt, Iridium).circuitMeta(6).outputs(METAL_CASING.getItemVariant(MetalCasingType.PALLADIUM_SUBSTATION, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STEEL_SOLID)).fluidInputs(Materials.Polytetrafluoroethylene.getFluid(216)).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.PTFE_INERT_CASING)).duration(50).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).input(OrePrefix.wireGtDouble, Materials.IndiumTinBariumTitaniumCuprate, 32).input(OrePrefix.foil, Materials.NiobiumTitanium, 32).fluidInputs(Materials.Trinium.getFluid(GTValues.L * 24)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).duration(100).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).input(OrePrefix.wireGtDouble, Materials.UraniumRhodiumDinaquadide, 16).input(OrePrefix.foil, Materials.NiobiumTitanium, 16).fluidInputs(Materials.Trinium.getFluid(GTValues.L * 16)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).duration(100).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).input(OrePrefix.wireGtDouble, Materials.EnrichedNaquadahTriniumEuropiumDuranide, 8).input(OrePrefix.foil, Materials.NiobiumTitanium, 8).fluidInputs(Materials.Trinium.getFluid(GTValues.L * 8)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).duration(100).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).input(OrePrefix.wireGtDouble, Materials.RutheniumTriniumAmericiumNeutronate, 4).input(OrePrefix.foil, Materials.NiobiumTitanium, 4).fluidInputs(Materials.Trinium.getFluid(GTValues.L * 4)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).duration(200).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).inputs(MetaItems.FIELD_GENERATOR_IV.getStackForm(2)).inputs(MetaItems.ELECTRIC_PUMP_IV.getStackForm()).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm(2)).input(OrePrefix.circuit, MarkerMaterials.Tier.LuV, 4).input(OrePrefix.pipeSmallFluid, Materials.Naquadah, 4).input(OrePrefix.plate, Materials.Europium, 4).fluidInputs(Materials.VanadiumGallium.getFluid(GTValues.L * 4)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).inputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS)).input(OrePrefix.plate, Materials.Naquadah, 4).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm(4)).outputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.FUSION_GLASS, ConfigHolder.recipes.casingsPerCraft)).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L)).duration(50).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm()).inputs(MetaItems.ELECTRIC_PUMP_LuV.getStackForm()).input(OrePrefix.plate, Materials.TungstenSteel, 6).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)).inputs(MetaItems.VOLTAGE_COIL_ZPM.getStackForm(2)).inputs(MetaItems.FIELD_GENERATOR_LuV.getStackForm()).input(OrePrefix.plate, Materials.Europium, 6).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L * 2)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING_MK2, ConfigHolder.recipes.casingsPerCraft)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)).inputs(MetaItems.VOLTAGE_COIL_UV.getStackForm(2)).inputs(MetaItems.FIELD_GENERATOR_ZPM.getStackForm()).input(OrePrefix.plate, Materials.Americium, 6).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L * 4)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING_MK3, ConfigHolder.recipes.casingsPerCraft)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Magnalium, 6).input(OrePrefix.frameGt, Materials.BlueSteel, 1).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)).input(OrePrefix.plate, Materials.StainlessSteel, 6).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STAINLESS_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)).input(OrePrefix.plate, Materials.Titanium, 6).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.TITANIUM_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)).input(OrePrefix.plate, Materials.TungstenSteel, 6).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.TUNGSTENSTEEL_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(48).input(OrePrefix.frameGt, Materials.Steel).input(OrePrefix.plate, Materials.Polyethylene, 6).fluidInputs(Concrete.getFluid(L)).outputs(MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.PLASCRETE, ConfigHolder.recipes.casingsPerCraft)).duration(200).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(48).input(OrePrefix.frameGt, Materials.Steel).input(OrePrefix.plate, Materials.Polyethylene, 6).fluidInputs(Glass.getFluid(L)).outputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.CLEANROOM_GLASS, ConfigHolder.recipes.casingsPerCraft)).duration(200).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, WroughtIron, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ULV)).circuitMeta(8).duration(25) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Steel, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Aluminium, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.MV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, StainlessSteel, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.HV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Titanium, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.EV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, TungstenSteel, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.IV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, RhodiumPlatedPalladium, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, NaquadahAlloy, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Darmstadtium, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Neutronium, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UHV)).circuitMeta(8).duration(50) + .buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(OrePrefix.wireGtDouble, Materials.Cupronickel, 8) + .input(OrePrefix.foil, Materials.Bronze, 8).fluidInputs(Materials.TinAlloy.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.CUPRONICKEL)).duration(200).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[MV]).input(OrePrefix.wireGtDouble, Materials.Kanthal, 8) + .input(OrePrefix.foil, Materials.Aluminium, 8).fluidInputs(Materials.Copper.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.KANTHAL)).duration(300).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[HV]).input(OrePrefix.wireGtDouble, Materials.Nichrome, 8) + .input(OrePrefix.foil, Materials.StainlessSteel, 8) + .fluidInputs(Materials.Aluminium.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.NICHROME)).duration(400).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[EV]).input(OrePrefix.wireGtDouble, Materials.RTMAlloy, 8) + .input(OrePrefix.foil, Materials.VanadiumSteel, 8).fluidInputs(Materials.Nichrome.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.RTM_ALLOY)).duration(500).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[IV]).input(OrePrefix.wireGtDouble, Materials.HSSG, 8) + .input(OrePrefix.foil, Materials.TungstenCarbide, 8) + .fluidInputs(Materials.Tungsten.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.HSS_G)).duration(600).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).input(OrePrefix.wireGtDouble, Materials.Naquadah, 8) + .input(OrePrefix.foil, Materials.Osmium, 8).fluidInputs(Materials.TungstenSteel.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.NAQUADAH)).duration(700).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).input(OrePrefix.wireGtDouble, Materials.Trinium, 8) + .input(OrePrefix.foil, Materials.NaquadahEnriched, 8) + .fluidInputs(Materials.Naquadah.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.TRINIUM)).duration(800).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).input(OrePrefix.wireGtDouble, Materials.Tritanium, 8) + .input(OrePrefix.foil, Materials.Naquadria, 8).fluidInputs(Materials.Trinium.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.TRITANIUM)).duration(900).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Bronze, 6) + .inputs(new ItemStack(Blocks.BRICK_BLOCK, 1)).circuitMeta(6) + .outputs(METAL_CASING.getItemVariant(BRONZE_BRICKS, ConfigHolder.recipes.casingsPerCraft)).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Invar, 6) + .input(OrePrefix.frameGt, Materials.Invar, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING + .getItemVariant(MetalCasingType.INVAR_HEATPROOF, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Steel, 6) + .input(OrePrefix.frameGt, Materials.Steel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING + .getItemVariant(MetalCasingType.STEEL_SOLID, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Aluminium, 6) + .input(OrePrefix.frameGt, Materials.Aluminium, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING + .getItemVariant(MetalCasingType.ALUMINIUM_FROSTPROOF, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.TungstenSteel, 6) + .input(OrePrefix.frameGt, Materials.TungstenSteel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING + .getItemVariant(MetalCasingType.TUNGSTENSTEEL_ROBUST, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.StainlessSteel, 6) + .input(OrePrefix.frameGt, Materials.StainlessSteel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING + .getItemVariant(MetalCasingType.STAINLESS_CLEAN, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Titanium, 6) + .input(OrePrefix.frameGt, Materials.Titanium, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING + .getItemVariant(MetalCasingType.TITANIUM_STABLE, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(plate, HSSE, 6).input(frameGt, Europium).circuitMeta(6) + .outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.HSSE_STURDY, + ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(plate, Palladium, 6).input(frameGt, Iridium).circuitMeta(6) + .outputs(METAL_CASING.getItemVariant(MetalCasingType.PALLADIUM_SUBSTATION, + ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16) + .inputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STEEL_SOLID)) + .fluidInputs(Materials.Polytetrafluoroethylene.getFluid(216)).circuitMeta(6) + .outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.PTFE_INERT_CASING)).duration(50) + .buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]) + .input(OrePrefix.wireGtDouble, Materials.IndiumTinBariumTitaniumCuprate, 32) + .input(OrePrefix.foil, Materials.NiobiumTitanium, 32) + .fluidInputs(Materials.Trinium.getFluid(GTValues.L * 24)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)) + .duration(100).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]) + .input(OrePrefix.wireGtDouble, Materials.UraniumRhodiumDinaquadide, 16) + .input(OrePrefix.foil, Materials.NiobiumTitanium, 16) + .fluidInputs(Materials.Trinium.getFluid(GTValues.L * 16)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)) + .duration(100).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]) + .input(OrePrefix.wireGtDouble, Materials.EnrichedNaquadahTriniumEuropiumDuranide, 8) + .input(OrePrefix.foil, Materials.NiobiumTitanium, 8) + .fluidInputs(Materials.Trinium.getFluid(GTValues.L * 8)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)) + .duration(100).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]) + .input(OrePrefix.wireGtDouble, Materials.RutheniumTriniumAmericiumNeutronate, 4) + .input(OrePrefix.foil, Materials.NiobiumTitanium, 4) + .fluidInputs(Materials.Trinium.getFluid(GTValues.L * 4)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)) + .duration(200).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]) + .inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)) + .inputs(MetaItems.FIELD_GENERATOR_IV.getStackForm(2)).inputs(MetaItems.ELECTRIC_PUMP_IV.getStackForm()) + .inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm(2)) + .input(OrePrefix.circuit, MarkerMaterials.Tier.LuV, 4) + .input(OrePrefix.pipeSmallFluid, Materials.Naquadah, 4).input(OrePrefix.plate, Materials.Europium, 4) + .fluidInputs(Materials.VanadiumGallium.getFluid(GTValues.L * 4)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)) + .duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]) + .inputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS)) + .input(OrePrefix.plate, Materials.Naquadah, 4).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm(4)) + .outputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.FUSION_GLASS, + ConfigHolder.recipes.casingsPerCraft)) + .fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L)).duration(50) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)) + .inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)) + .inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm()).inputs(MetaItems.ELECTRIC_PUMP_LuV.getStackForm()) + .input(OrePrefix.plate, Materials.TungstenSteel, 6) + .fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING, + ConfigHolder.recipes.casingsPerCraft)) + .duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)) + .inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)) + .inputs(MetaItems.VOLTAGE_COIL_ZPM.getStackForm(2)).inputs(MetaItems.FIELD_GENERATOR_LuV.getStackForm()) + .input(OrePrefix.plate, Materials.Europium, 6) + .fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L * 2)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING_MK2, + ConfigHolder.recipes.casingsPerCraft)) + .duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)) + .inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)) + .inputs(MetaItems.VOLTAGE_COIL_UV.getStackForm(2)).inputs(MetaItems.FIELD_GENERATOR_ZPM.getStackForm()) + .input(OrePrefix.plate, Materials.Americium, 6) + .fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L * 4)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING_MK3, + ConfigHolder.recipes.casingsPerCraft)) + .duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Magnalium, 6) + .input(OrePrefix.frameGt, Materials.BlueSteel, 1).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING + .getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16) + .inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)) + .input(OrePrefix.plate, Materials.StainlessSteel, 6).circuitMeta(6) + .outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STAINLESS_TURBINE_CASING, + ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16) + .inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)) + .input(OrePrefix.plate, Materials.Titanium, 6).circuitMeta(6) + .outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.TITANIUM_TURBINE_CASING, + ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16) + .inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)) + .input(OrePrefix.plate, Materials.TungstenSteel, 6).circuitMeta(6) + .outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.TUNGSTENSTEEL_TURBINE_CASING, + ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(48).input(OrePrefix.frameGt, Materials.Steel) + .input(OrePrefix.plate, Materials.Polyethylene, 6).fluidInputs(Concrete.getFluid(L)) + .outputs(MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.PLASCRETE, + ConfigHolder.recipes.casingsPerCraft)) + .duration(200).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(48).input(OrePrefix.frameGt, Materials.Steel) + .input(OrePrefix.plate, Materials.Polyethylene, 6).fluidInputs(Glass.getFluid(L)) + .outputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.CLEANROOM_GLASS, + ConfigHolder.recipes.casingsPerCraft)) + .duration(200).buildAndRegister(); // If these recipes are changed, change the values in MaterialInfoLoader.java - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(25).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ULV)).input(OrePrefix.cableGtSingle, Materials.RedAlloy, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[0].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LV)).input(OrePrefix.cableGtSingle, Materials.Tin, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[1].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.MV)).input(OrePrefix.cableGtSingle, Materials.Copper, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[2].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.MV)).input(OrePrefix.cableGtSingle, Materials.AnnealedCopper, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[2].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.HV)).input(OrePrefix.cableGtSingle, Materials.Gold, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[3].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.EV)).input(OrePrefix.cableGtSingle, Materials.Aluminium, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[4].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.IV)).input(OrePrefix.cableGtSingle, Materials.Platinum, 2).fluidInputs(Polytetrafluoroethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[5].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)).input(OrePrefix.cableGtSingle, Materials.NiobiumTitanium, 2).fluidInputs(Polytetrafluoroethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[6].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)).input(OrePrefix.cableGtSingle, Materials.VanadiumGallium, 2).fluidInputs(Polybenzimidazole.getFluid(L * 2)).outputs(MetaTileEntities.HULL[7].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)).input(cableGtSingle, Materials.YttriumBariumCuprate, 2).fluidInputs(Polybenzimidazole.getFluid(L * 2)).outputs(MetaTileEntities.HULL[8].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UHV)).input(cableGtSingle, Materials.Europium, 2).fluidInputs(Polybenzimidazole.getFluid(L * 2)).outputs(MetaTileEntities.HULL[9].getStackForm()).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(2).input(OreDictNames.chestWood.toString()).input(plate, Iron, 5).outputs(new ItemStack(Blocks.HOPPER)).duration(800).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(2).input(OreDictNames.chestWood.toString()).input(plate, WroughtIron, 5).outputs(new ItemStack(Blocks.HOPPER)).duration(800).circuitMeta(1).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plank, Wood, 4).input(screw, Iron, 4).outputs(WOODEN_CRATE.getStackForm()).duration(100).circuitMeta(5).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Bronze, 4).input(plate, Bronze, 4).outputs(BRONZE_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Steel, 4).input(plate, Steel, 4).outputs(STEEL_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Aluminium, 4).input(plate, Aluminium, 4).outputs(ALUMINIUM_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, StainlessSteel, 4).input(plate, StainlessSteel, 4).outputs(STAINLESS_STEEL_CRATE.getStackForm()).circuitMeta(1).duration(200).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Titanium, 4).input(plate, Titanium, 4).outputs(TITANIUM_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, TungstenSteel, 4).input(plate, TungstenSteel, 4).outputs(TUNGSTENSTEEL_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Bronze, 2).input(plate, Bronze, 4).outputs(BRONZE_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Steel, 2).input(plate, Steel, 4).outputs(STEEL_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Aluminium, 2).input(plate, Aluminium, 4).outputs(ALUMINIUM_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, StainlessSteel, 2).input(plate, StainlessSteel, 4).outputs(STAINLESS_STEEL_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Titanium, 2).input(plate, Titanium, 4).outputs(TITANIUM_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, TungstenSteel, 2).input(plate, TungstenSteel, 4).outputs(TUNGSTENSTEEL_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Gold, 2).input(plate, Gold, 4).outputs(GOLD_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polyethylene, 4).input(CARBON_MESH).fluidInputs(Polyethylene.getFluid(288)).output(DUCT_TAPE).duration(100).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, SiliconeRubber, 2).input(CARBON_MESH).fluidInputs(Polyethylene.getFluid(288)).output(DUCT_TAPE, 2).duration(100).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polycaprolactam, 2).input(CARBON_MESH).fluidInputs(Polyethylene.getFluid(144)).output(DUCT_TAPE, 4).duration(100).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polybenzimidazole).input(CARBON_MESH).fluidInputs(Polyethylene.getFluid(72)).output(DUCT_TAPE, 8).duration(100).buildAndRegister(); - - ModHandler.addShapedRecipe("basic_tape", BASIC_TAPE.getStackForm(), " P ", "PSP", " P ", 'P', new UnificationEntry(plate, Paper), 'S', STICKY_RESIN.getStackForm()); - ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ULV]).input(plate, Paper, 2).input(STICKY_RESIN).output(BASIC_TAPE, 2).duration(100).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(25).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ULV)) + .input(OrePrefix.cableGtSingle, Materials.RedAlloy, 2) + .fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[0].getStackForm()) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LV)) + .input(OrePrefix.cableGtSingle, Materials.Tin, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)) + .outputs(MetaTileEntities.HULL[1].getStackForm()).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.MV)) + .input(OrePrefix.cableGtSingle, Materials.Copper, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)) + .outputs(MetaTileEntities.HULL[2].getStackForm()).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.MV)) + .input(OrePrefix.cableGtSingle, Materials.AnnealedCopper, 2) + .fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[2].getStackForm()) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.HV)) + .input(OrePrefix.cableGtSingle, Materials.Gold, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)) + .outputs(MetaTileEntities.HULL[3].getStackForm()).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.EV)) + .input(OrePrefix.cableGtSingle, Materials.Aluminium, 2) + .fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[4].getStackForm()) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.IV)) + .input(OrePrefix.cableGtSingle, Materials.Platinum, 2) + .fluidInputs(Polytetrafluoroethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[5].getStackForm()) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)) + .input(OrePrefix.cableGtSingle, Materials.NiobiumTitanium, 2) + .fluidInputs(Polytetrafluoroethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[6].getStackForm()) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)) + .input(OrePrefix.cableGtSingle, Materials.VanadiumGallium, 2) + .fluidInputs(Polybenzimidazole.getFluid(L * 2)).outputs(MetaTileEntities.HULL[7].getStackForm()) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)) + .input(cableGtSingle, Materials.YttriumBariumCuprate, 2).fluidInputs(Polybenzimidazole.getFluid(L * 2)) + .outputs(MetaTileEntities.HULL[8].getStackForm()).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UHV)) + .input(cableGtSingle, Materials.Europium, 2).fluidInputs(Polybenzimidazole.getFluid(L * 2)) + .outputs(MetaTileEntities.HULL[9].getStackForm()).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(2).input(OreDictNames.chestWood.toString()).input(plate, Iron, 5) + .outputs(new ItemStack(Blocks.HOPPER)).duration(800).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(2).input(OreDictNames.chestWood.toString()).input(plate, WroughtIron, 5) + .outputs(new ItemStack(Blocks.HOPPER)).duration(800).circuitMeta(1).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plank, Wood, 4).input(screw, Iron, 4) + .outputs(WOODEN_CRATE.getStackForm()).duration(100).circuitMeta(5).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Bronze, 4).input(plate, Bronze, 4) + .outputs(BRONZE_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Steel, 4).input(plate, Steel, 4) + .outputs(STEEL_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Aluminium, 4).input(plate, Aluminium, 4) + .outputs(ALUMINIUM_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, StainlessSteel, 4).input(plate, StainlessSteel, 4) + .outputs(STAINLESS_STEEL_CRATE.getStackForm()).circuitMeta(1).duration(200).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Titanium, 4).input(plate, Titanium, 4) + .outputs(TITANIUM_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, TungstenSteel, 4).input(plate, TungstenSteel, 4) + .outputs(TUNGSTENSTEEL_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Bronze, 2).input(plate, Bronze, 4) + .outputs(BRONZE_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Steel, 2).input(plate, Steel, 4) + .outputs(STEEL_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Aluminium, 2).input(plate, Aluminium, 4) + .outputs(ALUMINIUM_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, StainlessSteel, 2).input(plate, StainlessSteel, 4) + .outputs(STAINLESS_STEEL_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Titanium, 2).input(plate, Titanium, 4) + .outputs(TITANIUM_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, TungstenSteel, 2).input(plate, TungstenSteel, 4) + .outputs(TUNGSTENSTEEL_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Gold, 2).input(plate, Gold, 4) + .outputs(GOLD_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polyethylene, 4).input(CARBON_MESH) + .fluidInputs(Polyethylene.getFluid(288)).output(DUCT_TAPE).duration(100).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, SiliconeRubber, 2).input(CARBON_MESH) + .fluidInputs(Polyethylene.getFluid(288)).output(DUCT_TAPE, 2).duration(100).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polycaprolactam, 2).input(CARBON_MESH) + .fluidInputs(Polyethylene.getFluid(144)).output(DUCT_TAPE, 4).duration(100).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polybenzimidazole).input(CARBON_MESH) + .fluidInputs(Polyethylene.getFluid(72)).output(DUCT_TAPE, 8).duration(100).buildAndRegister(); + + ModHandler.addShapedRecipe("basic_tape", BASIC_TAPE.getStackForm(), " P ", "PSP", " P ", 'P', + new UnificationEntry(plate, Paper), 'S', STICKY_RESIN.getStackForm()); + ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ULV]).input(plate, Paper, 2).input(STICKY_RESIN).output(BASIC_TAPE, 2) + .duration(100).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() .input(plateDouble, Steel, 2) @@ -761,12 +1016,18 @@ private static void registerBlastFurnaceRecipes() { .buildAndRegister(); // Aluminium from aluminium oxide gems - BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, Ruby).output(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, Ruby).output(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, GreenSapphire).output(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, GreenSapphire).output(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, Sapphire).output(nugget, Aluminium, 3).blastFurnaceTemp(1200).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, Sapphire).output(nugget, Aluminium, 3).blastFurnaceTemp(1200).buildAndRegister(); + BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, Ruby).output(nugget, Aluminium, 3) + .chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); + BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, Ruby).output(nugget, Aluminium, 3) + .chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); + BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, GreenSapphire).output(nugget, Aluminium, 3) + .chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); + BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, GreenSapphire).output(nugget, Aluminium, 3) + .chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); + BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, Sapphire).output(nugget, Aluminium, 3) + .blastFurnaceTemp(1200).buildAndRegister(); + BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, Sapphire).output(nugget, Aluminium, 3) + .blastFurnaceTemp(1200).buildAndRegister(); // Titanium tetrachloride BLAST_RECIPES.recipeBuilder().duration(800).EUt(VA[HV]) @@ -787,7 +1048,7 @@ private static void registerBlastFurnaceRecipes() { .blastFurnaceTemp(1700) .duration(1600).EUt(VA[HV]).buildAndRegister(); - //Tempered Glass + // Tempered Glass BLAST_RECIPES.recipeBuilder() .input(block, Glass) .fluidInputs(Oxygen.getFluid(100)) @@ -847,7 +1108,8 @@ private static void registerBlastFurnaceMetallurgyRecipes() { .buildAndRegister(); } - private static void createSulfurDioxideRecipe(Material inputMaterial, Material outputMaterial, int sulfurDioxideAmount) { + private static void createSulfurDioxideRecipe(Material inputMaterial, Material outputMaterial, + int sulfurDioxideAmount) { BLAST_RECIPES.recipeBuilder().duration(120).EUt(VA[MV]).blastFurnaceTemp(1200) .input(dust, inputMaterial) .fluidInputs(Oxygen.getFluid(3000)) @@ -858,8 +1120,6 @@ private static void createSulfurDioxideRecipe(Material inputMaterial, Material o } private static void registerDecompositionRecipes() { - - EXTRACTOR_RECIPES.recipeBuilder() .inputs(STICKY_RESIN.getStackForm()) .output(dust, RawRubber, 3) @@ -886,20 +1146,27 @@ private static void registerDecompositionRecipes() { .output(dust, RawRubber, 2) .buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).input("treeSapling", 8).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.WHEAT, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.POTATO, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.CARROT, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Blocks.CACTUS, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.REEDS, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Blocks.BROWN_MUSHROOM, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Blocks.RED_MUSHROOM, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.BEETROOT, 8)).output(PLANT_BALL).buildAndRegister(); - + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).input("treeSapling", 8).output(PLANT_BALL) + .buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.WHEAT, 8)).output(PLANT_BALL) + .buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.POTATO, 8)) + .output(PLANT_BALL).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.CARROT, 8)) + .output(PLANT_BALL).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Blocks.CACTUS, 8)) + .output(PLANT_BALL).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.REEDS, 8)).output(PLANT_BALL) + .buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Blocks.BROWN_MUSHROOM, 8)) + .output(PLANT_BALL).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Blocks.RED_MUSHROOM, 8)) + .output(PLANT_BALL).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.BEETROOT, 8)) + .output(PLANT_BALL).buildAndRegister(); } private static void registerRecyclingRecipes() { - MACERATOR_RECIPES.recipeBuilder() .input(stone, Endstone) .output(dust, Endstone) @@ -1010,7 +1277,6 @@ private static void registerRecyclingRecipes() { } private static void registerFluidRecipes() { - FLUID_HEATER_RECIPES.recipeBuilder().duration(32).EUt(4) .fluidInputs(Ice.getFluid(L)) .circuitMeta(1) @@ -1030,8 +1296,10 @@ private static void registerFluidRecipes() { .duration(100).EUt(16).buildAndRegister(); } - FLUID_HEATER_RECIPES.recipeBuilder().duration(30).EUt(VA[LV]).fluidInputs(Water.getFluid(6)).circuitMeta(1).fluidOutputs(Steam.getFluid(960)).buildAndRegister(); - FLUID_HEATER_RECIPES.recipeBuilder().duration(30).EUt(VA[LV]).fluidInputs(DistilledWater.getFluid(6)).circuitMeta(1).fluidOutputs(Steam.getFluid(960)).buildAndRegister(); + FLUID_HEATER_RECIPES.recipeBuilder().duration(30).EUt(VA[LV]).fluidInputs(Water.getFluid(6)).circuitMeta(1) + .fluidOutputs(Steam.getFluid(960)).buildAndRegister(); + FLUID_HEATER_RECIPES.recipeBuilder().duration(30).EUt(VA[LV]).fluidInputs(DistilledWater.getFluid(6)) + .circuitMeta(1).fluidOutputs(Steam.getFluid(960)).buildAndRegister(); } private static void registerSmoothRecipe(List roughStack, List smoothStack) { @@ -1055,7 +1323,8 @@ private static void registerCobbleRecipe(List smoothStack, List polishedStack, List brickStack, MarkerMaterial color) { + private static void registerBricksRecipe(List polishedStack, List brickStack, + MarkerMaterial color) { for (int i = 0; i < polishedStack.size(); i++) { LASER_ENGRAVER_RECIPES.recipeBuilder() .inputs(polishedStack.get(i)) @@ -1078,97 +1347,138 @@ private static void registerMossRecipe(List regularStack, List void registerMachineRecipe(boolean withUnificationData, T[] metaTileEntities, Object... recipe) { + public static < + T extends MetaTileEntity & ITieredMetaTileEntity> void registerMachineRecipe(boolean withUnificationData, + T[] metaTileEntities, + Object... recipe) { for (T metaTileEntity : metaTileEntities) { // Needed to skip certain tiers if not enabled. @@ -442,12 +1162,14 @@ public static void registerMa if (prepRecipe == null) { return; } - ModHandler.addShapedRecipe(withUnificationData, metaTileEntity.getMetaName(), metaTileEntity.getStackForm(), prepRecipe); + ModHandler.addShapedRecipe(withUnificationData, metaTileEntity.getMetaName(), + metaTileEntity.getStackForm(), prepRecipe); } } } - public static void registerMachineRecipe(T[] metaTileEntities, Object... recipe) { + public static void registerMachineRecipe(T[] metaTileEntities, + Object... recipe) { registerMachineRecipe(true, metaTileEntities, recipe); } @@ -463,5 +1185,4 @@ private static Object[] prepareRecipe(int tier, Object... recipe) { } return recipe; } - } diff --git a/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java index 838e6ecc757..cc01014c03a 100644 --- a/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java @@ -4,6 +4,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.recipes.ModHandler; import gregtech.api.unification.stack.UnificationEntry; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Loader; @@ -15,8 +16,8 @@ import static gregtech.api.unification.material.MarkerMaterials.Tier; import static gregtech.api.unification.material.Materials.*; import static gregtech.api.unification.ore.OrePrefix.*; -import static gregtech.common.blocks.MetaBlocks.LD_ITEM_PIPE; import static gregtech.common.blocks.MetaBlocks.LD_FLUID_PIPE; +import static gregtech.common.blocks.MetaBlocks.LD_ITEM_PIPE; import static gregtech.common.items.MetaItems.*; import static gregtech.common.items.MetaItems.SENSOR_UV; import static gregtech.common.metatileentities.MetaTileEntities.*; @@ -24,7 +25,6 @@ public class MetaTileEntityMachineRecipeLoader { public static void init() { - // Fluid Hatches registerHatchBusRecipe(ULV, FLUID_IMPORT_HATCH[ULV], FLUID_EXPORT_HATCH[ULV], new ItemStack(Blocks.GLASS)); registerHatchBusRecipe(LV, FLUID_IMPORT_HATCH[LV], FLUID_EXPORT_HATCH[LV], new ItemStack(Blocks.GLASS)); @@ -33,7 +33,8 @@ public static void init() { registerHatchBusRecipe(EV, FLUID_IMPORT_HATCH[EV], FLUID_EXPORT_HATCH[EV], ALUMINIUM_DRUM.getStackForm()); registerHatchBusRecipe(IV, FLUID_IMPORT_HATCH[IV], FLUID_EXPORT_HATCH[IV], STAINLESS_STEEL_DRUM.getStackForm()); registerHatchBusRecipe(LuV, FLUID_IMPORT_HATCH[LuV], FLUID_EXPORT_HATCH[LuV], TITANIUM_DRUM.getStackForm()); - registerHatchBusRecipe(ZPM, FLUID_IMPORT_HATCH[ZPM], FLUID_EXPORT_HATCH[ZPM], TUNGSTENSTEEL_DRUM.getStackForm()); + registerHatchBusRecipe(ZPM, FLUID_IMPORT_HATCH[ZPM], FLUID_EXPORT_HATCH[ZPM], + TUNGSTENSTEEL_DRUM.getStackForm()); registerHatchBusRecipe(UV, FLUID_IMPORT_HATCH[UV], FLUID_EXPORT_HATCH[UV], QUANTUM_TANK[0].getStackForm()); registerHatchBusRecipe(UHV, FLUID_IMPORT_HATCH[UHV], FLUID_EXPORT_HATCH[UHV], QUANTUM_TANK[1].getStackForm()); @@ -512,7 +513,6 @@ public static void init() { .EUt(VA[UV])) .duration(1000).EUt(VA[UHV]).buildAndRegister(); - // Power Transformers ASSEMBLER_RECIPES.recipeBuilder() @@ -1025,7 +1025,8 @@ public static void init() { } } - private static void registerHatchBusRecipe(int tier, MetaTileEntity inputBus, MetaTileEntity outputBus, ItemStack extra) { + private static void registerHatchBusRecipe(int tier, MetaTileEntity inputBus, MetaTileEntity outputBus, + ItemStack extra) { // Glue recipe for ULV and LV // 250L for ULV, 500L for LV if (tier <= GTValues.LV) { @@ -1115,23 +1116,32 @@ private static void registerHatchBusRecipe(int tier, MetaTileEntity inputBus, Me private static int getFluidAmount(int offsetTier) { switch (offsetTier) { - case 0: return 4; - case 1: return 9; - case 2: return 18; - case 3: return 36; - case 4: return 72; - case 5: return 144; - case 6: return 288; - case 7: return 432; - case 8: return 576; + case 0: + return 4; + case 1: + return 9; + case 2: + return 18; + case 3: + return 36; + case 4: + return 72; + case 5: + return 144; + case 6: + return 288; + case 7: + return 432; + case 8: + return 576; case 9: - default: return 720; + default: + return 720; } } // TODO clean this up with a CraftingComponent rework private static void registerLaserRecipes() { - // 256A Laser Source Hatches ASSEMBLER_RECIPES.recipeBuilder() .input(HULL[IV]) diff --git a/src/main/java/gregtech/loaders/recipe/MiscRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/MiscRecipeLoader.java index 795b880849c..fb3b3173dc4 100644 --- a/src/main/java/gregtech/loaders/recipe/MiscRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/MiscRecipeLoader.java @@ -20,6 +20,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -33,11 +34,11 @@ public class MiscRecipeLoader { public static void init() { - // Basic Terminal Recipe ModHandler.addShapedRecipe(true, "basic_terminal", TERMINAL.getStackForm(), - "SGS", "PBP", "PWP", 'S', new UnificationEntry(screw, WroughtIron), 'G', OreDictUnifier.get("paneGlass"), 'B', new ItemStack(Items.BOOK), - 'P', new UnificationEntry(plate, WroughtIron), 'W', new UnificationEntry(wireGtSingle, RedAlloy)); + "SGS", "PBP", "PWP", 'S', new UnificationEntry(screw, WroughtIron), 'G', + OreDictUnifier.get("paneGlass"), 'B', new ItemStack(Items.BOOK), + 'P', new UnificationEntry(plate, WroughtIron), 'W', new UnificationEntry(wireGtSingle, RedAlloy)); // Multiblock Builder ModHandler.addShapedRecipe(true, "multiblock_builder", MULTIBLOCK_BUILDER.getStackForm(), @@ -238,7 +239,8 @@ public static void init() { .buildAndRegister(); ASSEMBLY_LINE_RECIPES.recipeBuilder().duration(1000).EUt(GTValues.VA[GTValues.LuV]) - .inputNBT(((ArmorMetaItem) QUANTUM_CHESTPLATE.getStackForm().getItem()).getItem(QUANTUM_CHESTPLATE.getStackForm()), NBTMatcher.ANY, NBTCondition.ANY) + .inputNBT(((ArmorMetaItem) QUANTUM_CHESTPLATE.getStackForm().getItem()) + .getItem(QUANTUM_CHESTPLATE.getStackForm()), NBTMatcher.ANY, NBTCondition.ANY) .inputs(HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm(2)) .input(wireFine, NiobiumTitanium, 64) .input(wireGtQuadruple, Osmium, 6) @@ -254,7 +256,6 @@ public static void init() { .scannerResearch(GRAVITATION_ENGINE.getStackForm()) .buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(80).EUt(VA[HV]) .inputs(MetaItems.COVER_SCREEN.getStackForm()) .inputs((ItemStack) CraftingComponent.HULL.getIngredient(1)) @@ -375,25 +376,35 @@ public static void init() { .duration(40).EUt(6).buildAndRegister(); // Dyed Lens Recipes - RecipeBuilder builder = CHEMICAL_BATH_RECIPES.recipeBuilder().EUt(VA[HV]).duration(200).input(craftingLens, Glass); + RecipeBuilder builder = CHEMICAL_BATH_RECIPES.recipeBuilder().EUt(VA[HV]).duration(200).input(craftingLens, + Glass); final int dyeAmount = 288; - builder.copy().fluidInputs(DyeWhite.getFluid(dyeAmount)) .output(lens, Glass) .buildAndRegister(); - builder.copy().fluidInputs(DyeOrange.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Orange)) .buildAndRegister(); - builder.copy().fluidInputs(DyeMagenta.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Magenta)) .buildAndRegister(); - builder.copy().fluidInputs(DyeLightBlue.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.LightBlue)).buildAndRegister(); - builder.copy().fluidInputs(DyeYellow.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Yellow)) .buildAndRegister(); - builder.copy().fluidInputs(DyeLime.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Lime)) .buildAndRegister(); - builder.copy().fluidInputs(DyePink.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Pink)) .buildAndRegister(); - builder.copy().fluidInputs(DyeGray.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Gray)) .buildAndRegister(); - builder.copy().fluidInputs(DyeLightGray.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.LightGray)).buildAndRegister(); - builder.copy().fluidInputs(DyeCyan.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Cyan)) .buildAndRegister(); - builder.copy().fluidInputs(DyePurple.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Purple)) .buildAndRegister(); - builder.copy().fluidInputs(DyeBlue.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Blue)) .buildAndRegister(); - builder.copy().fluidInputs(DyeBrown.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Brown)) .buildAndRegister(); - builder.copy().fluidInputs(DyeGreen.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Green)) .buildAndRegister(); - builder.copy().fluidInputs(DyeRed.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Red)) .buildAndRegister(); - builder.copy().fluidInputs(DyeBlack.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Black)) .buildAndRegister(); + builder.copy().fluidInputs(DyeWhite.getFluid(dyeAmount)).output(lens, Glass).buildAndRegister(); + builder.copy().fluidInputs(DyeOrange.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Orange)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeMagenta.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Magenta)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeLightBlue.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.LightBlue)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeYellow.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Yellow)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeLime.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Lime)).buildAndRegister(); + builder.copy().fluidInputs(DyePink.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Pink)).buildAndRegister(); + builder.copy().fluidInputs(DyeGray.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Gray)).buildAndRegister(); + builder.copy().fluidInputs(DyeLightGray.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.LightGray)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeCyan.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Cyan)).buildAndRegister(); + builder.copy().fluidInputs(DyePurple.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Purple)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeBlue.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Blue)).buildAndRegister(); + builder.copy().fluidInputs(DyeBrown.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Brown)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeGreen.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Green)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeRed.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Red)).buildAndRegister(); + builder.copy().fluidInputs(DyeBlack.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Black)) + .buildAndRegister(); // NAN Certificate EXTRUDER_RECIPES.recipeBuilder() @@ -411,26 +422,46 @@ public static void init() { .output(FERTILIZER, 4) .duration(100).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite) .input(dust, Sulfur) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite) .input(dust, TricalciumPhosphate).fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite) .input(dust, Phosphate) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite) .input(dust, Ash, 3) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 1).duration(100).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite) .input(dust, DarkAsh) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 1).duration(100).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium) .input(dust, Sulfur) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium) .input(dust, TricalciumPhosphate).fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 4).duration(400).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium) .input(dust, Phosphate) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium) .input(dust, Ash, 3) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium) .input(dust, DarkAsh) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite) .input(dust, Sulfur) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite) .input(dust, TricalciumPhosphate).fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 4).duration(400).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite) .input(dust, Phosphate) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite) .input(dust, Ash, 3) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite) .input(dust, DarkAsh) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, Sulfur) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, TricalciumPhosphate).fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 4).duration(400).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, Phosphate) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, Ash, 3) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, DarkAsh) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite).input(dust, Sulfur).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite).input(dust, TricalciumPhosphate) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite).input(dust, Phosphate).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite).input(dust, Ash, 3).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 1).duration(100).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite).input(dust, DarkAsh).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 1).duration(100).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium).input(dust, Sulfur).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium).input(dust, TricalciumPhosphate) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 4).duration(400).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium).input(dust, Phosphate).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium).input(dust, Ash, 3).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium).input(dust, DarkAsh).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite).input(dust, Sulfur).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite).input(dust, TricalciumPhosphate) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 4).duration(400).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite).input(dust, Phosphate).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite).input(dust, Ash, 3).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite).input(dust, DarkAsh).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, Sulfur) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, TricalciumPhosphate) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 4).duration(400).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, Phosphate) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, Ash, 3) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, DarkAsh) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); ELECTROLYZER_RECIPES.recipeBuilder() .input(FERTILIZER) diff --git a/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java b/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java index b657766e6ee..81955f6b6fb 100644 --- a/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java @@ -1,6 +1,5 @@ package gregtech.loaders.recipe; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.recipes.RecipeBuilder; @@ -20,17 +19,21 @@ import gregtech.api.unification.stack.MaterialStack; import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTUtility; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Tuple; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.ImmutableList; + import java.util.*; import java.util.Map.Entry; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.L; import static gregtech.api.GTValues.M; import static gregtech.api.unification.material.info.MaterialFlags.*; @@ -54,8 +57,8 @@ public static void init() { } } - public static void registerRecyclingRecipes(ItemStack input, List components, boolean ignoreArcSmelting, @Nullable OrePrefix prefix) { - + public static void registerRecyclingRecipes(ItemStack input, List components, + boolean ignoreArcSmelting, @Nullable OrePrefix prefix) { // Gather the valid Materials for use in recycling recipes. // - Filter out Materials that cannot create a Dust // - Filter out Materials that do not equate to at least 1 Nugget worth of Material. @@ -89,13 +92,14 @@ public static void registerRecyclingRecipes(ItemStack input, List } // Skip Ingot -> Ingot Arc Recipes - if (OreDictUnifier.getPrefix(input) == OrePrefix.ingot && m.getProperty(PropertyKey.INGOT).getArcSmeltInto() == m) { + if (OreDictUnifier.getPrefix(input) == OrePrefix.ingot && + m.getProperty(PropertyKey.INGOT).getArcSmeltInto() == m) { return; } // Prevent Magnetic dust -> Regular Ingot Arc Furnacing, avoiding the EBF recipe // "I will rework magnetic materials soon" - DStrand1 - if(prefix == OrePrefix.dust && m.hasFlag(IS_MAGNETIC)) { + if (prefix == OrePrefix.dust && m.hasFlag(IS_MAGNETIC)) { return; } } @@ -103,13 +107,11 @@ public static void registerRecyclingRecipes(ItemStack input, List } private static void registerMaceratorRecycling(ItemStack input, List materials, int multiplier) { - // Finalize the output list. List outputs = finalizeOutputs( materials, RecipeMaps.MACERATOR_RECIPES.getMaxOutputs(), - OreDictUnifier::getDust - ); + OreDictUnifier::getDust); // Exit if no valid Materials exist for this recycling Recipe. if (outputs.size() == 0) return; @@ -125,10 +127,10 @@ private static void registerMaceratorRecycling(ItemStack input, List materials, int multiplier, @Nullable OrePrefix prefix) { + private static void registerExtractorRecycling(ItemStack input, List materials, int multiplier, + @Nullable OrePrefix prefix) { // Handle simple materials separately if (prefix != null && prefix.secondaryMaterials.isEmpty()) { MaterialStack ms = OreDictUnifier.getMaterial(input); @@ -155,13 +157,15 @@ private static void registerExtractorRecycling(ItemStack input, List ms.material.hasProperty(PropertyKey.FLUID)).findFirst().orElse(null); + MaterialStack fluidMs = materials.stream().filter(ms -> ms.material.hasProperty(PropertyKey.FLUID)).findFirst() + .orElse(null); if (fluidMs == null) return; // Find the next MaterialStack, which will be the Item output. // This can sometimes be before the Fluid output in the list, so we have to // assume it can be anywhere in the list. - MaterialStack itemMs = materials.stream().filter(ms -> !ms.material.equals(fluidMs.material)).findFirst().orElse(null); + MaterialStack itemMs = materials.stream().filter(ms -> !ms.material.equals(fluidMs.material)).findFirst() + .orElse(null); // Calculate the duration based off of those two possible outputs. // - Sum the two Material amounts together (if both exist) @@ -188,7 +192,8 @@ private static void registerExtractorRecycling(ItemStack input, List materials, @Nullable OrePrefix prefix) { + private static void registerArcRecycling(ItemStack input, List materials, + @Nullable OrePrefix prefix) { // Block dusts from being arc'd instead of EBF'd MaterialStack ms = OreDictUnifier.getMaterial(input); if (prefix == OrePrefix.dust && ms != null && ms.material.hasProperty(PropertyKey.BLAST)) { @@ -214,14 +219,12 @@ private static void registerArcRecycling(ItemStack input, List ma .outputs(output) .duration(calculateDuration(Collections.singletonList(output))) .EUt(GTValues.VA[GTValues.LV]); - } - else { + } else { // Finalize the output List List outputs = finalizeOutputs( Collections.singletonList(materialOutput), RecipeMaps.ARC_FURNACE_RECIPES.getMaxOutputs(), - RecyclingRecipes::getArcIngotOrDust - ); + RecyclingRecipes::getArcIngotOrDust); builder = RecipeMaps.ARC_FURNACE_RECIPES.recipeBuilder() .inputs(input.copy()) @@ -252,8 +255,7 @@ private static void registerArcRecycling(ItemStack input, List ma List outputs = finalizeOutputs( materials, RecipeMaps.ARC_FURNACE_RECIPES.getMaxOutputs(), - RecyclingRecipes::getArcIngotOrDust - ); + RecyclingRecipes::getArcIngotOrDust); // Exit if no valid outputs exist for this recycling Recipe. if (outputs.size() == 0) return; @@ -316,7 +318,7 @@ private static MaterialStack getArcSmeltingResult(MaterialStack materialStack) { return null; } - // Else if the Material is an Ingot, return the Arc Smelting + // Else if the Material is an Ingot, return the Arc Smelting // result if it exists, otherwise return the Material itself. if (material.hasProperty(PropertyKey.INGOT)) { Material arcSmelt = material.getProperty(PropertyKey.INGOT).getArcSmeltInto(); @@ -355,7 +357,6 @@ private static MaterialStack getGemArcSmeltResult(MaterialStack materialStack) { } private static int calculateVoltageMultiplier(List materials) { - // Gather the highest blast temperature of any material in the list int highestTemp = 0; for (MaterialStack ms : materials) { @@ -365,13 +366,14 @@ private static int calculateVoltageMultiplier(List materials) { if (prop.getBlastTemperature() > highestTemp) { highestTemp = prop.getBlastTemperature(); } - } - else if(m.hasFlag(IS_MAGNETIC) && m.hasProperty(PropertyKey.INGOT) && m.getProperty(PropertyKey.INGOT).getSmeltingInto().hasProperty(PropertyKey.BLAST)) { - BlastProperty prop = m.getProperty(PropertyKey.INGOT).getSmeltingInto().getProperty(PropertyKey.BLAST); - if (prop.getBlastTemperature() > highestTemp) { - highestTemp = prop.getBlastTemperature(); - } - } + } else if (m.hasFlag(IS_MAGNETIC) && m.hasProperty(PropertyKey.INGOT) && + m.getProperty(PropertyKey.INGOT).getSmeltingInto().hasProperty(PropertyKey.BLAST)) { + BlastProperty prop = m.getProperty(PropertyKey.INGOT).getSmeltingInto() + .getProperty(PropertyKey.BLAST); + if (prop.getBlastTemperature() > highestTemp) { + highestTemp = prop.getBlastTemperature(); + } + } } // No blast temperature in the list means no multiplier @@ -402,7 +404,6 @@ private static int calculateDuration(List materials) { * Combines any matching Materials in the List into one MaterialStack */ private static List combineStacks(List rawList) { - // Combine any stacks in the List that have the same Item. Map materialStacksExploded = new HashMap<>(); for (MaterialStack ms : rawList) { @@ -414,8 +415,8 @@ private static List combineStacks(List rawList) { .collect(Collectors.toList()); } - private static List finalizeOutputs(List materials, int maxOutputs, Function toItemStackMapper) { - + private static List finalizeOutputs(List materials, int maxOutputs, + Function toItemStackMapper) { // Map of ItemStack, Long to properly sort by the true material amount for outputs List> outputs = new ArrayList<>(); @@ -491,23 +492,29 @@ private static List finalizeOutputs(List materials, in return returnValues; } - private static void splitStacks(List> list, ItemStack originalStack, UnificationEntry entry) { + private static void splitStacks(List> list, ItemStack originalStack, + UnificationEntry entry) { int amount = originalStack.getCount(); while (amount > 64) { - list.add(new Tuple<>(GTUtility.copy(64, originalStack), new MaterialStack(entry.material, entry.orePrefix.getMaterialAmount(entry.material) * 64))); + list.add(new Tuple<>(GTUtility.copy(64, originalStack), + new MaterialStack(entry.material, entry.orePrefix.getMaterialAmount(entry.material) * 64))); amount -= 64; } - list.add(new Tuple<>(GTUtility.copy(amount, originalStack), new MaterialStack(entry.material, entry.orePrefix.getMaterialAmount(entry.material) * amount))); + list.add(new Tuple<>(GTUtility.copy(amount, originalStack), + new MaterialStack(entry.material, entry.orePrefix.getMaterialAmount(entry.material) * amount))); } - private static final List DUST_ORDER = ImmutableList.of(OrePrefix.dust, OrePrefix.dustSmall, OrePrefix.dustTiny); - private static final List INGOT_ORDER = ImmutableList.of(OrePrefix.block, OrePrefix.ingot, OrePrefix.nugget); + private static final List DUST_ORDER = ImmutableList.of(OrePrefix.dust, OrePrefix.dustSmall, + OrePrefix.dustTiny); + private static final List INGOT_ORDER = ImmutableList.of(OrePrefix.block, OrePrefix.ingot, + OrePrefix.nugget); - private static void shrinkStacks(List> list, ItemStack originalStack, UnificationEntry entry) { + private static void shrinkStacks(List> list, ItemStack originalStack, + UnificationEntry entry) { Material material = entry.material; long materialAmount = originalStack.getCount() * entry.orePrefix.getMaterialAmount(material); - //noinspection ConstantConditions + // noinspection ConstantConditions final List chosenList = material.hasProperty(PropertyKey.INGOT) ? INGOT_ORDER : DUST_ORDER; // Break materialAmount into a maximal stack @@ -527,7 +534,10 @@ private static void shrinkStacks(List> list, Ite if (tempList.containsKey(chosenList.get(0))) { OrePrefix prefix = chosenList.get(0); MaterialStack ms = tempList.get(prefix); - splitStacks(list, OreDictUnifier.get(chosenList.get(0), ms.material, (int) (ms.amount / prefix.getMaterialAmount(material))), new UnificationEntry(prefix, material)); + splitStacks(list, + OreDictUnifier.get(chosenList.get(0), ms.material, + (int) (ms.amount / prefix.getMaterialAmount(material))), + new UnificationEntry(prefix, material)); } OrePrefix mediumPrefix = chosenList.get(1); // dustSmall or ingot @@ -539,21 +549,24 @@ private static void shrinkStacks(List> list, Ite if (mediumMS != null && smallestMS != null) { long singleStackAmount = mediumMS.amount + smallestMS.amount; if (singleStackAmount / smallestPrefix.getMaterialAmount(material) <= 64) { - list.add(new Tuple<>(OreDictUnifier.get(smallestPrefix, material, (int) (singleStackAmount / smallestPrefix.getMaterialAmount(material))), new MaterialStack(material, singleStackAmount))); + list.add(new Tuple<>( + OreDictUnifier.get(smallestPrefix, material, + (int) (singleStackAmount / smallestPrefix.getMaterialAmount(material))), + new MaterialStack(material, singleStackAmount))); return; } } // Otherwise simply add the stacks to the List if they exist if (mediumMS != null) list.add(new Tuple<>( - OreDictUnifier.get(mediumPrefix, material, (int) (mediumMS.amount / mediumPrefix.getMaterialAmount(material))), - new MaterialStack(material, mediumMS.amount) - )); + OreDictUnifier.get(mediumPrefix, material, + (int) (mediumMS.amount / mediumPrefix.getMaterialAmount(material))), + new MaterialStack(material, mediumMS.amount))); if (smallestMS != null) list.add(new Tuple<>( - OreDictUnifier.get(smallestPrefix, material, (int) (smallestMS.amount / smallestPrefix.getMaterialAmount(material))), - new MaterialStack(material, smallestMS.amount) - )); + OreDictUnifier.get(smallestPrefix, material, + (int) (smallestMS.amount / smallestPrefix.getMaterialAmount(material))), + new MaterialStack(material, smallestMS.amount))); } private static boolean isAshMaterial(MaterialStack ms) { @@ -563,11 +576,10 @@ private static boolean isAshMaterial(MaterialStack ms) { /** * Performs various NBT matching on the provided input and adds the result to the provided RecipeBuilder * - * @param input The input itemStack + * @param input The input itemStack * @param builder The RecipeBuilder to add the NBT condition to */ private static void cleanInputNBT(ItemStack input, RecipeBuilder builder) { - // Ignore String tag from naming machines MetaTileEntity mte = GTUtility.getMetaTileEntity(input); if (mte != null) { diff --git a/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java b/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java index 970ed03ff81..b057a3e3b0d 100644 --- a/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java @@ -13,6 +13,7 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; @@ -56,15 +57,19 @@ public static void init() { private static void woodRecipes() { if (ConfigHolder.recipes.nerfWoodCrafting) { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:stick")); - ModHandler.addShapedRecipe("stick_saw", new ItemStack(Items.STICK, 4), "s", "P", "P", 'P', new UnificationEntry(OrePrefix.plank, Materials.Wood)); - ModHandler.addShapedRecipe("stick_normal", new ItemStack(Items.STICK, 2), "P", "P", 'P', new UnificationEntry(OrePrefix.plank, Materials.Wood)); + ModHandler.addShapedRecipe("stick_saw", new ItemStack(Items.STICK, 4), "s", "P", "P", 'P', + new UnificationEntry(OrePrefix.plank, Materials.Wood)); + ModHandler.addShapedRecipe("stick_normal", new ItemStack(Items.STICK, 2), "P", "P", 'P', + new UnificationEntry(OrePrefix.plank, Materials.Wood)); } if (ConfigHolder.recipes.nerfPaperCrafting) { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:paper")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:sugar")); - ModHandler.addShapedRecipe("paper_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Paper, 2), "SSS", " m ", 'S', new ItemStack(Items.REEDS)); - ModHandler.addShapedRecipe("sugar", OreDictUnifier.get(OrePrefix.dust, Materials.Sugar, 1), "Sm ", 'S', new ItemStack(Items.REEDS)); + ModHandler.addShapedRecipe("paper_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Paper, 2), "SSS", + " m ", 'S', new ItemStack(Items.REEDS)); + ModHandler.addShapedRecipe("sugar", OreDictUnifier.get(OrePrefix.dust, Materials.Sugar, 1), "Sm ", 'S', + new ItemStack(Items.REEDS)); ModHandler.addShapedRecipe("paper", new ItemStack(Items.PAPER, 2), " r ", "SSS", " B ", 'S', OreDictUnifier.get(OrePrefix.dust, Materials.Paper), @@ -74,15 +79,17 @@ private static void woodRecipes() { if (!ConfigHolder.recipes.hardWoodRecipes) return; ModHandler.removeRecipeByName(new ResourceLocation("minecraft:ladder")); - ModHandler.addShapedRecipe("ladder", new ItemStack(Blocks.LADDER, 2), "SrS", "SRS", "ShS", 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood), 'R', new UnificationEntry(OrePrefix.bolt, Materials.Wood)); + ModHandler.addShapedRecipe("ladder", new ItemStack(Blocks.LADDER, 2), "SrS", "SRS", "ShS", 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood), 'R', + new UnificationEntry(OrePrefix.bolt, Materials.Wood)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:trapdoor")); ModHandler.addShapedRecipe("trapdoor", new ItemStack(Blocks.TRAPDOOR), "SRS", "RRR", "SRS", 'S', new UnificationEntry(OrePrefix.slab, Materials.Wood), - 'R', new UnificationEntry(OrePrefix.stick, Materials.Wood) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("bowl", new ItemStack(Items.BOWL), "k", "X", 'X', new UnificationEntry(OrePrefix.plank, Materials.Wood)); + ModHandler.addShapedRecipe("bowl", new ItemStack(Items.BOWL), "k", "X", 'X', + new UnificationEntry(OrePrefix.plank, Materials.Wood)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:bowl")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:chest")); @@ -129,8 +136,7 @@ private static void redstoneRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:sticky_piston")); ModHandler.addShapedRecipe("sticky_piston", new ItemStack(Blocks.STICKY_PISTON, 1), "h", "R", "P", 'R', "slimeball", - 'P', new ItemStack(Blocks.PISTON) - ); + 'P', new ItemStack(Blocks.PISTON)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:piston")); @@ -139,8 +145,7 @@ private static void redstoneRecipes() { 'C', OreDictNames.stoneCobble, 'R', new UnificationEntry(OrePrefix.plate, Materials.RedAlloy), 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron), - 'F', OreDictNames.fenceWood - ); + 'F', OreDictNames.fenceWood); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.stick, Materials.Iron) @@ -187,35 +192,34 @@ private static void redstoneRecipes() { .outputs(new ItemStack(Blocks.PISTON, 16)) .duration(800).EUt(VA[LV]).buildAndRegister(); - ModHandler.removeRecipeByName(new ResourceLocation("minecraft:stone_pressure_plate")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:wooden_pressure_plate")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:heavy_weighted_pressure_plate")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:light_weighted_pressure_plate")); - ModHandler.addShapedRecipe("stone_pressure_plate", new ItemStack(Blocks.STONE_PRESSURE_PLATE, 2), "ShS", "LCL", "SdS", + ModHandler.addShapedRecipe("stone_pressure_plate", new ItemStack(Blocks.STONE_PRESSURE_PLATE, 2), "ShS", "LCL", + "SdS", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'L', new ItemStack(Blocks.STONE_SLAB), - 'C', new UnificationEntry(OrePrefix.spring, Materials.Iron) - ); + 'C', new UnificationEntry(OrePrefix.spring, Materials.Iron)); - ModHandler.addShapedRecipe("wooden_pressure_plate", new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", + ModHandler.addShapedRecipe("wooden_pressure_plate", new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 2), "SrS", + "LCL", "SdS", 'S', new UnificationEntry(OrePrefix.bolt, Materials.Wood), 'L', new UnificationEntry(OrePrefix.plate, Materials.Wood), - 'C', new UnificationEntry(OrePrefix.spring, Materials.Iron) - ); + 'C', new UnificationEntry(OrePrefix.spring, Materials.Iron)); - ModHandler.addShapedRecipe("heavy_weighted_pressure_plate", new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE), "ShS", "LCL", "SdS", + ModHandler.addShapedRecipe("heavy_weighted_pressure_plate", new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE), + "ShS", "LCL", "SdS", 'S', new UnificationEntry(OrePrefix.screw, Materials.Steel), 'L', new UnificationEntry(OrePrefix.plate, Materials.Gold), - 'C', new UnificationEntry(OrePrefix.spring, Materials.Steel) - ); + 'C', new UnificationEntry(OrePrefix.spring, Materials.Steel)); - ModHandler.addShapedRecipe("light_weighted_pressure_plate", new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE), "ShS", "LCL", "SdS", + ModHandler.addShapedRecipe("light_weighted_pressure_plate", new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE), + "ShS", "LCL", "SdS", 'S', new UnificationEntry(OrePrefix.screw, Materials.Steel), 'L', new UnificationEntry(OrePrefix.plate, Materials.Iron), - 'C', new UnificationEntry(OrePrefix.spring, Materials.Steel) - ); + 'C', new UnificationEntry(OrePrefix.spring, Materials.Steel)); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.spring, Materials.Iron) @@ -262,8 +266,7 @@ private static void redstoneRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:lever")); ModHandler.addShapedRecipe("lever", new ItemStack(Blocks.LEVER), "B", "S", 'B', new ItemStack(Blocks.STONE_BUTTON), - 'S', new ItemStack(Items.STICK) - ); + 'S', new ItemStack(Items.STICK)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:daylight_detector")); ModHandler.removeRecipeByName(new ResourceLocation("appliedenergistics2:misc/vanilla_daylight_detector")); @@ -271,36 +274,33 @@ private static void redstoneRecipes() { 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W), 'P', new UnificationEntry(OrePrefix.plate, Materials.NetherQuartz), 'S', new UnificationEntry(OrePrefix.slab, Materials.Wood), - 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); - ModHandler.addShapedRecipe("daylight_detector_certus", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", "SRS", + ModHandler.addShapedRecipe("daylight_detector_certus", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", + "SRS", 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W), 'P', new UnificationEntry(OrePrefix.plate, Materials.CertusQuartz), 'S', new UnificationEntry(OrePrefix.slab, Materials.Wood), - 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); - ModHandler.addShapedRecipe("daylight_detector_quartzite", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", "SRS", + ModHandler.addShapedRecipe("daylight_detector_quartzite", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", + "SRS", 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W), 'P', new UnificationEntry(OrePrefix.plate, Materials.Quartzite), 'S', new UnificationEntry(OrePrefix.slab, Materials.Wood), - 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:redstone_lamp")); ModHandler.addShapedRecipe("redstone_lamp", new ItemStack(Blocks.REDSTONE_LAMP), "PPP", "PGP", "PRP", 'P', new ItemStack(Blocks.GLASS_PANE, 1, GTValues.W), 'G', new UnificationEntry(OrePrefix.block, Materials.Glowstone), - 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:tripwire_hook")); ModHandler.addShapedRecipe("tripwire_hook", new ItemStack(Blocks.TRIPWIRE_HOOK), "IRI", "SRS", " S ", 'I', new UnificationEntry(OrePrefix.ring, Materials.Iron), 'R', new UnificationEntry(OrePrefix.stick, Materials.Wood), - 'S', new ItemStack(Items.STRING) - ); + 'S', new ItemStack(Items.STRING)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:dropper")); ModHandler.addShapedRecipe("dropper", new ItemStack(Blocks.DROPPER), "CRC", "STS", "GAG", @@ -309,8 +309,7 @@ private static void redstoneRecipes() { 'S', new UnificationEntry(OrePrefix.springSmall, Materials.Iron), 'T', new ItemStack(Items.STRING), 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron), - 'A', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'A', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:observer")); ModHandler.addShapedRecipe("observer", new ItemStack(Blocks.OBSERVER), "RCR", "CQC", "GSG", @@ -318,32 +317,28 @@ private static void redstoneRecipes() { 'C', OreDictNames.stoneCobble, 'Q', new UnificationEntry(OrePrefix.plate, Materials.NetherQuartz), 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron), - 'S', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'S', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.addShapedRecipe("observer_certus", new ItemStack(Blocks.OBSERVER), "RCR", "CQC", "GSG", 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron), 'C', OreDictNames.stoneCobble, 'Q', new UnificationEntry(OrePrefix.plate, Materials.CertusQuartz), 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron), - 'S', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'S', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.addShapedRecipe("observer_quartzite", new ItemStack(Blocks.OBSERVER), "RCR", "CQC", "GSG", 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron), 'C', OreDictNames.stoneCobble, 'Q', new UnificationEntry(OrePrefix.plate, Materials.Quartzite), 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron), - 'S', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'S', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:repeater")); ModHandler.addShapedRecipe("repeater", new ItemStack(Items.REPEATER), "S S", "TdT", "PRP", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE), - 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:comparator")); ModHandler.removeRecipeByName(new ResourceLocation("appliedenergistics2:misc/vanilla_comparator")); @@ -351,22 +346,19 @@ private static void redstoneRecipes() { 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(OrePrefix.plate, Materials.NetherQuartz), - 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE) - ); + 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); ModHandler.addShapedRecipe("comparator_certus", new ItemStack(Items.COMPARATOR), "STS", "TQT", "PdP", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(OrePrefix.plate, Materials.CertusQuartz), - 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE) - ); + 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); ModHandler.addShapedRecipe("comparator_quartzite", new ItemStack(Items.COMPARATOR), "STS", "TQT", "PdP", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(OrePrefix.plate, Materials.Quartzite), - 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE) - ); + 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:golden_rail")); ModHandler.addShapedRecipe("golden_rail", new ItemStack(Blocks.GOLDEN_RAIL, 6), "SPS", "IWI", "GdG", @@ -374,34 +366,31 @@ private static void redstoneRecipes() { 'P', new UnificationEntry(OrePrefix.plate, Materials.RedAlloy), 'I', new UnificationEntry(OrePrefix.stick, Materials.Iron), 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood), - 'G', new UnificationEntry(OrePrefix.stick, Materials.Gold) - ); + 'G', new UnificationEntry(OrePrefix.stick, Materials.Gold)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:detector_rail")); ModHandler.addShapedRecipe("detector_rail", new ItemStack(Blocks.DETECTOR_RAIL, 6), "SPS", "IWI", "IdI", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'P', new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE), 'I', new UnificationEntry(OrePrefix.stick, Materials.Iron), - 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood) - ); + 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:rail")); ModHandler.addShapedRecipe("rail", new ItemStack(Blocks.RAIL, 8), "ShS", "IWI", "IdI", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'I', new UnificationEntry(OrePrefix.stick, Materials.Iron), - 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood) - ); + 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:activator_rail")); ModHandler.addShapedRecipe("activator_rail", new ItemStack(Blocks.ACTIVATOR_RAIL, 6), "SPS", "IWI", "IdI", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'P', new ItemStack(Blocks.REDSTONE_TORCH), 'I', new UnificationEntry(OrePrefix.stick, Materials.Iron), - 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood) - ); + 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:redstone_torch")); - ModHandler.addShapedRecipe("redstone_torch", new ItemStack(Blocks.REDSTONE_TORCH), "R", "T", 'R', new UnificationEntry(OrePrefix.dust, Materials.Redstone), 'T', new ItemStack(Blocks.TORCH)); + ModHandler.addShapedRecipe("redstone_torch", new ItemStack(Blocks.REDSTONE_TORCH), "R", "T", 'R', + new UnificationEntry(OrePrefix.dust, Materials.Redstone), 'T', new ItemStack(Blocks.TORCH)); } /** @@ -410,24 +399,21 @@ private static void redstoneRecipes() { private static void metalRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:cauldron")); ModHandler.addShapedRecipe("cauldron", new ItemStack(Items.CAULDRON), "X X", "XhX", "XXX", - 'X', new UnificationEntry(OrePrefix.plate, Materials.Iron) - ); + 'X', new UnificationEntry(OrePrefix.plate, Materials.Iron)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:hopper")); ModHandler.addShapedRecipe("hopper", new ItemStack(Blocks.HOPPER), "XCX", "XGX", "wXh", 'X', new UnificationEntry(OrePrefix.plate, Materials.Iron), 'C', "chestWood", - 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron) - ); + 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:iron_bars")); ModHandler.addShapedRecipe("iron_bars", new ItemStack(Blocks.IRON_BARS, 8), " h ", "XXX", "XXX", - 'X', new UnificationEntry(OrePrefix.stick, Materials.Iron) - ); + 'X', new UnificationEntry(OrePrefix.stick, Materials.Iron)); - ModHandler.addShapedRecipe("iron_bucket", new ItemStack(Items.BUCKET), "XhX", " X ", 'X', new UnificationEntry(OrePrefix.plate, Materials.Iron)); + ModHandler.addShapedRecipe("iron_bucket", new ItemStack(Items.BUCKET), "XhX", " X ", 'X', + new UnificationEntry(OrePrefix.plate, Materials.Iron)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:bucket")); - } /** @@ -439,8 +425,7 @@ private static void metalAdvancedRecipes() { 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron), 'T', new ItemStack(Blocks.IRON_BARS), 'R', new UnificationEntry(OrePrefix.ring, Materials.Steel), - 'S', new UnificationEntry(OrePrefix.screw, Materials.Steel) - ); + 'S', new UnificationEntry(OrePrefix.screw, Materials.Steel)); ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.plate, Materials.Iron, 4) .inputs(new ItemStack(Blocks.IRON_BARS)) @@ -452,16 +437,13 @@ private static void metalAdvancedRecipes() { ModHandler.addShapedRecipe("anvil", new ItemStack(Blocks.ANVIL), "BBB", "SBS", "PBP", 'B', new UnificationEntry(OrePrefix.block, Materials.Iron), 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), - 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron) - ); + 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:iron_trapdoor")); ModHandler.addShapedRecipe("iron_trapdoor", new ItemStack(Blocks.IRON_TRAPDOOR), "SPS", "PTP", "sPd", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron), - 'T', new ItemStack(Blocks.TRAPDOOR) - ); - + 'T', new ItemStack(Blocks.TRAPDOOR)); } /** @@ -496,11 +478,11 @@ private static void miscRecipes() { 'G', new ItemStack(Blocks.GLASS), 'L', new UnificationEntry(OrePrefix.lens, Materials.NetherStar), 'S', new ItemStack(Items.NETHER_STAR), - 'O', new UnificationEntry(OrePrefix.plate, Materials.Obsidian) - ); + 'O', new UnificationEntry(OrePrefix.plate, Materials.Obsidian)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:lit_pumpkin")); - ModHandler.addShapedRecipe("lit_pumpkin", new ItemStack(Blocks.LIT_PUMPKIN), "PT", "k ", 'P', new ItemStack(Blocks.PUMPKIN), 'T', new ItemStack(Blocks.TORCH)); + ModHandler.addShapedRecipe("lit_pumpkin", new ItemStack(Blocks.LIT_PUMPKIN), "PT", "k ", 'P', + new ItemStack(Blocks.PUMPKIN), 'T', new ItemStack(Blocks.TORCH)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:golden_apple")); @@ -509,8 +491,7 @@ private static void miscRecipes() { 'S', new ItemStack(Items.STRING), 'P', new ItemStack(Items.PAPER), 'L', new ItemStack(Items.LEATHER), - 'G', MetaItems.STICKY_RESIN.getStackForm().copy() - ); + 'G', MetaItems.STICKY_RESIN.getStackForm().copy()); ModHandler.removeRecipeByName(new ResourceLocation("brewing_stand")); ModHandler.addShapedRecipe("brewing_stand", new ItemStack(Items.BREWING_STAND), "RBR", "ABA", "SCS", @@ -533,8 +514,7 @@ private static void miscRecipes() { 'D', new UnificationEntry(OrePrefix.gem, Materials.Diamond), 'C', new ItemStack(Blocks.CARPET, 1, 14), 'P', new UnificationEntry(OrePrefix.plate, Materials.Obsidian), - 'B', new ItemStack(Blocks.BOOKSHELF) - ); + 'B', new ItemStack(Blocks.BOOKSHELF)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:jukebox")); ModHandler.addShapedRecipe("jukebox", new ItemStack(Blocks.JUKEBOX), "LBL", "NRN", "LGL", @@ -542,8 +522,7 @@ private static void miscRecipes() { 'B', new UnificationEntry(OrePrefix.bolt, Materials.Diamond), 'N', new ItemStack(Blocks.NOTEBLOCK), 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron), - 'G', new UnificationEntry(OrePrefix.gear, Materials.Iron) - ); + 'G', new UnificationEntry(OrePrefix.gear, Materials.Iron)); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.bolt, Materials.Diamond) @@ -559,8 +538,7 @@ private static void miscRecipes() { 'P', new UnificationEntry(OrePrefix.plate, Materials.Wood), 'B', new ItemStack(Blocks.IRON_BARS), 'G', new UnificationEntry(OrePrefix.gear, Materials.Wood), - 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.plate, Materials.Wood, 4) @@ -573,8 +551,7 @@ private static void miscRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:furnace")); ModHandler.addShapedRecipe("furnace", new ItemStack(Blocks.FURNACE), "CCC", "FFF", "CCC", 'F', new ItemStack(Items.FLINT), - 'C', OreDictNames.stoneCobble - ); + 'C', OreDictNames.stoneCobble); ASSEMBLER_RECIPES.recipeBuilder() .circuitMeta(8) @@ -584,8 +561,10 @@ private static void miscRecipes() { .duration(100).EUt(VA[ULV]).buildAndRegister(); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:crafting_table")); - ModHandler.addShapedRecipe("crafting_table", new ItemStack(Blocks.CRAFTING_TABLE), "FF", "WW", 'F', new ItemStack(Items.FLINT), 'W', new UnificationEntry(OrePrefix.log, Materials.Wood)); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(80).EUt(6).input("logWood", 1).inputs(new ItemStack(Items.FLINT)).outputs(new ItemStack(Blocks.CRAFTING_TABLE)).buildAndRegister(); + ModHandler.addShapedRecipe("crafting_table", new ItemStack(Blocks.CRAFTING_TABLE), "FF", "WW", 'F', + new ItemStack(Items.FLINT), 'W', new UnificationEntry(OrePrefix.log, Materials.Wood)); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(80).EUt(6).input("logWood", 1) + .inputs(new ItemStack(Items.FLINT)).outputs(new ItemStack(Blocks.CRAFTING_TABLE)).buildAndRegister(); ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.STONEBRICK)); @@ -594,7 +573,8 @@ private static void miscRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:polished_andesite")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:lead")); - ModHandler.addShapedRecipe("lead", new ItemStack(Items.LEAD), "SSS", "SBS", "SSS", 'S', new ItemStack(Items.STRING), 'B', new ItemStack(Items.SLIME_BALL)); + ModHandler.addShapedRecipe("lead", new ItemStack(Items.LEAD), "SSS", "SBS", "SSS", 'S', + new ItemStack(Items.STRING), 'B', new ItemStack(Items.SLIME_BALL)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:bow")); ModHandler.addShapedRecipe("bow", new ItemStack(Items.BOW), "hLS", "LRS", "fLS", @@ -620,10 +600,14 @@ private static void miscRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:furnace_minecart")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:tnt_minecart")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:hopper_minecart")); - ModHandler.addShapedRecipe("chest_minecart", new ItemStack(Items.CHEST_MINECART), "hIw", " M ", " d ", 'I', "chestWood", 'M', new ItemStack(Items.MINECART)); - ModHandler.addShapedRecipe("furnace_minecart", new ItemStack(Items.FURNACE_MINECART), "hIw", " M ", " d ", 'I', new ItemStack(Blocks.FURNACE), 'M', new ItemStack(Items.MINECART)); - ModHandler.addShapedRecipe("tnt_minecart", new ItemStack(Items.TNT_MINECART), "hIw", " M ", " d ", 'I', new ItemStack(Blocks.TNT), 'M', new ItemStack(Items.MINECART)); - ModHandler.addShapedRecipe("hopper_minecart", new ItemStack(Items.HOPPER_MINECART), "hIw", " M ", " d ", 'I', new ItemStack(Blocks.HOPPER), 'M', new ItemStack(Items.MINECART)); + ModHandler.addShapedRecipe("chest_minecart", new ItemStack(Items.CHEST_MINECART), "hIw", " M ", " d ", 'I', + "chestWood", 'M', new ItemStack(Items.MINECART)); + ModHandler.addShapedRecipe("furnace_minecart", new ItemStack(Items.FURNACE_MINECART), "hIw", " M ", " d ", 'I', + new ItemStack(Blocks.FURNACE), 'M', new ItemStack(Items.MINECART)); + ModHandler.addShapedRecipe("tnt_minecart", new ItemStack(Items.TNT_MINECART), "hIw", " M ", " d ", 'I', + new ItemStack(Blocks.TNT), 'M', new ItemStack(Items.MINECART)); + ModHandler.addShapedRecipe("hopper_minecart", new ItemStack(Items.HOPPER_MINECART), "hIw", " M ", " d ", 'I', + new ItemStack(Blocks.HOPPER), 'M', new ItemStack(Items.MINECART)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:flower_pot")); ModHandler.addShapedRecipe("flower_pot", new ItemStack(Items.FLOWER_POT), "BfB", " B ", @@ -682,9 +666,12 @@ private static void addBedRecipe(int meta) { */ private static void dyeRecipes() { for (MarkerMaterial colorMaterial : MarkerMaterials.Color.VALUES) { - ModHandler.removeRecipeByName(new ResourceLocation(String.format("minecraft:%s_concrete_powder", colorMaterial))); - ModHandler.removeRecipeByName(new ResourceLocation(String.format("minecraft:%s_stained_hardened_clay", colorMaterial))); - ModHandler.removeRecipeByName(new ResourceLocation(String.format("minecraft:%s_stained_glass", colorMaterial))); + ModHandler.removeRecipeByName( + new ResourceLocation(String.format("minecraft:%s_concrete_powder", colorMaterial))); + ModHandler.removeRecipeByName( + new ResourceLocation(String.format("minecraft:%s_stained_hardened_clay", colorMaterial))); + ModHandler.removeRecipeByName( + new ResourceLocation(String.format("minecraft:%s_stained_glass", colorMaterial))); ModHandler.removeRecipeByName(new ResourceLocation(String.format("minecraft:%s_wool", colorMaterial))); } ModHandler.removeRecipeByName("minecraft:dark_prismarine"); @@ -756,23 +743,32 @@ private static void removeCompressionRecipes() { // Slab replacement ModHandler.removeRecipeByName("minecraft:stone_slab"); - ModHandler.addShapedRecipe("stone_slab_saw", new ItemStack(Blocks.STONE_SLAB), "sS", 'S', new ItemStack(Blocks.STONE)); + ModHandler.addShapedRecipe("stone_slab_saw", new ItemStack(Blocks.STONE_SLAB), "sS", 'S', + new ItemStack(Blocks.STONE)); ModHandler.removeRecipeByName("minecraft:sandstone_slab"); - ModHandler.addShapedRecipe("sandstone_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 1), "sS", 'S', new ItemStack(Blocks.SANDSTONE, 1, W)); + ModHandler.addShapedRecipe("sandstone_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 1), "sS", 'S', + new ItemStack(Blocks.SANDSTONE, 1, W)); ModHandler.removeRecipeByName("minecraft:cobblestone_slab"); - ModHandler.addShapedRecipe("cobblestone_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 3), "sS", 'S', new ItemStack(Blocks.COBBLESTONE)); + ModHandler.addShapedRecipe("cobblestone_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 3), "sS", 'S', + new ItemStack(Blocks.COBBLESTONE)); ModHandler.removeRecipeByName("minecraft:brick_slab"); - ModHandler.addShapedRecipe("brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 4), "sS", 'S', new ItemStack(Blocks.BRICK_BLOCK)); + ModHandler.addShapedRecipe("brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 4), "sS", 'S', + new ItemStack(Blocks.BRICK_BLOCK)); ModHandler.removeRecipeByName("minecraft:stone_brick_slab"); - ModHandler.addShapedRecipe("stone_brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 5), "sS", 'S', OreDictNames.stoneBricks); + ModHandler.addShapedRecipe("stone_brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 5), "sS", 'S', + OreDictNames.stoneBricks); ModHandler.removeRecipeByName("minecraft:nether_brick_slab"); - ModHandler.addShapedRecipe("nether_brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 6), "sS", 'S', new ItemStack(Blocks.NETHER_BRICK)); + ModHandler.addShapedRecipe("nether_brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 6), "sS", 'S', + new ItemStack(Blocks.NETHER_BRICK)); ModHandler.removeRecipeByName("minecraft:quartz_slab"); - ModHandler.addShapedRecipe("quartz_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 7), "sS", 'S', new ItemStack(Blocks.QUARTZ_BLOCK, 1, W)); + ModHandler.addShapedRecipe("quartz_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 7), "sS", 'S', + new ItemStack(Blocks.QUARTZ_BLOCK, 1, W)); ModHandler.removeRecipeByName("minecraft:red_sandstone_slab"); - ModHandler.addShapedRecipe("red_sandstone_slab_saw", new ItemStack(Blocks.STONE_SLAB2), "sS", 'S', new ItemStack(Blocks.RED_SANDSTONE, 1, W)); + ModHandler.addShapedRecipe("red_sandstone_slab_saw", new ItemStack(Blocks.STONE_SLAB2), "sS", 'S', + new ItemStack(Blocks.RED_SANDSTONE, 1, W)); ModHandler.removeRecipeByName("minecraft:purpur_slab"); - ModHandler.addShapedRecipe("purpur_slab_saw", new ItemStack(Blocks.PURPUR_SLAB), "sS", 'S', new ItemStack(Blocks.PURPUR_BLOCK)); + ModHandler.addShapedRecipe("purpur_slab_saw", new ItemStack(Blocks.PURPUR_SLAB), "sS", 'S', + new ItemStack(Blocks.PURPUR_BLOCK)); } } @@ -785,8 +781,7 @@ private static void toolArmorRecipes() { ModHandler.addShapedRecipe("flint_and_steel", new ItemStack(Items.FLINT_AND_STEEL), "G", "F", "S", 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Steel), 'F', new ItemStack(Items.FLINT, 1), - 'S', new UnificationEntry(OrePrefix.springSmall, Materials.Steel) - ); + 'S', new UnificationEntry(OrePrefix.springSmall, Materials.Steel)); } if (!ConfigHolder.recipes.hardToolArmorRecipes) @@ -829,8 +824,7 @@ private static void toolArmorRecipes() { 'B', new UnificationEntry(OrePrefix.bolt, Materials.IronMagnetic), 'R', new UnificationEntry(OrePrefix.ring, Materials.Zinc), 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron), - 'A', new UnificationEntry(OrePrefix.bolt, Materials.RedAlloy) - ); + 'A', new UnificationEntry(OrePrefix.bolt, Materials.RedAlloy)); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.plate, Materials.Iron) @@ -845,8 +839,7 @@ private static void toolArmorRecipes() { ModHandler.addShapedRecipe("fishing_rod", new ItemStack(Items.FISHING_ROD), " S", " SL", "SxR", 'S', new UnificationEntry(OrePrefix.stickLong, Materials.Wood), 'L', new ItemStack(Items.STRING), - 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron) - ); + 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:clock")); ModHandler.addShapedRecipe("clock", new ItemStack(Items.CLOCK), "RPR", "BCB", "dSw", @@ -854,8 +847,7 @@ private static void toolArmorRecipes() { 'P', new UnificationEntry(OrePrefix.plate, Materials.Gold), 'B', new UnificationEntry(OrePrefix.bolt, Materials.Gold), 'C', new ItemStack(Items.COMPARATOR), - 'S', new UnificationEntry(OrePrefix.screw, Materials.Gold) - ); + 'S', new UnificationEntry(OrePrefix.screw, Materials.Gold)); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.plate, Materials.Gold) @@ -871,16 +863,14 @@ private static void toolArmorRecipes() { 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron), 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron), - 'T', new ItemStack(Items.STICK) - ); + 'T', new ItemStack(Items.STICK)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:shield")); ModHandler.addShapedRecipe("shield", new ItemStack(Items.SHIELD), "BRB", "LPL", "BRB", 'B', new UnificationEntry(OrePrefix.bolt, Materials.Iron), 'R', new UnificationEntry(OrePrefix.stick, Materials.Iron), 'L', new UnificationEntry(OrePrefix.stickLong, Materials.Iron), - 'P', new UnificationEntry(OrePrefix.plate, Materials.Wood) - ); + 'P', new UnificationEntry(OrePrefix.plate, Materials.Wood)); // Remove a bunch of processing recipes for tools and armor, since we have significantly better options ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_HELMET, 1, W)); @@ -910,71 +900,65 @@ private static void createShovelRecipe(String regName, ItemStack output, Materia ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "hPf", " S ", " S ", 'P', new UnificationEntry(OrePrefix.plate, material), - 'S', new ItemStack(Items.STICK) - ); + 'S', new ItemStack(Items.STICK)); } private static void createPickaxeRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "PII", "hSf", " S ", 'P', new UnificationEntry(OrePrefix.plate, material), - 'I', new UnificationEntry(material.equals(Materials.Diamond) ? OrePrefix.gem : OrePrefix.ingot, material), - 'S', new ItemStack(Items.STICK) - ); + 'I', + new UnificationEntry(material.equals(Materials.Diamond) ? OrePrefix.gem : OrePrefix.ingot, material), + 'S', new ItemStack(Items.STICK)); } private static void createAxeRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "PIf", "PS ", "hS ", 'P', new UnificationEntry(OrePrefix.plate, material), - 'I', new UnificationEntry(material.equals(Materials.Diamond) ? OrePrefix.gem : OrePrefix.ingot, material), - 'S', new ItemStack(Items.STICK) - ); + 'I', + new UnificationEntry(material.equals(Materials.Diamond) ? OrePrefix.gem : OrePrefix.ingot, material), + 'S', new ItemStack(Items.STICK)); } private static void createSwordRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, " P ", "hPf", " S ", 'P', new UnificationEntry(OrePrefix.plate, material), - 'S', new ItemStack(Items.STICK) - ); + 'S', new ItemStack(Items.STICK)); } private static void createHoeRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "PIf", "hS ", " S ", 'P', new UnificationEntry(OrePrefix.plate, material), - 'I', new UnificationEntry(material.equals(Materials.Diamond) ? OrePrefix.gem : OrePrefix.ingot, material), - 'S', new ItemStack(Items.STICK) - ); + 'I', + new UnificationEntry(material.equals(Materials.Diamond) ? OrePrefix.gem : OrePrefix.ingot, material), + 'S', new ItemStack(Items.STICK)); } private static void createHelmetRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "PPP", "PhP", - 'P', new UnificationEntry(OrePrefix.plate, material) - ); + 'P', new UnificationEntry(OrePrefix.plate, material)); } private static void createChestplateRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "PhP", "PPP", "PPP", - 'P', new UnificationEntry(OrePrefix.plate, material) - ); + 'P', new UnificationEntry(OrePrefix.plate, material)); } private static void createLeggingsRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "PPP", "PhP", "P P", - 'P', new UnificationEntry(OrePrefix.plate, material) - ); + 'P', new UnificationEntry(OrePrefix.plate, material)); } private static void createBootsRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "P P", "PhP", - 'P', new UnificationEntry(OrePrefix.plate, material) - ); + 'P', new UnificationEntry(OrePrefix.plate, material)); } private static void alwaysRemovedRecipes() { diff --git a/src/main/java/gregtech/loaders/recipe/VanillaStandardRecipes.java b/src/main/java/gregtech/loaders/recipe/VanillaStandardRecipes.java index bf8e90f11d5..ecfb4e8e739 100644 --- a/src/main/java/gregtech/loaders/recipe/VanillaStandardRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/VanillaStandardRecipes.java @@ -11,6 +11,7 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; @@ -53,7 +54,7 @@ private static void compressingRecipes() { .outputs(new ItemStack(Blocks.STONE)) .buildAndRegister(); - //todo autogenerate 2x2 recipes? + // todo autogenerate 2x2 recipes? COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2) .inputs(new ItemStack(Blocks.SAND, 4)) .outputs(new ItemStack(Blocks.SANDSTONE)) @@ -89,8 +90,10 @@ private static void compressingRecipes() { .outputs(new ItemStack(Blocks.GLOWSTONE)) .buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().inputs(new ItemStack(Blocks.ICE, 2, GTValues.W)).outputs(new ItemStack(Blocks.PACKED_ICE)).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().input(OrePrefix.dust, Materials.Ice, 1).outputs(new ItemStack(Blocks.ICE)).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().inputs(new ItemStack(Blocks.ICE, 2, GTValues.W)) + .outputs(new ItemStack(Blocks.PACKED_ICE)).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().input(OrePrefix.dust, Materials.Ice, 1).outputs(new ItemStack(Blocks.ICE)) + .buildAndRegister(); PACKER_RECIPES.recipeBuilder() .inputs(new ItemStack(Items.WHEAT, 9)) @@ -113,11 +116,14 @@ private static void compressingRecipes() { * - Removes some glass related recipes based on configs */ private static void glassRecipes() { - ModHandler.addShapedRecipe("glass_dust_hammer", OreDictUnifier.get(dust, Materials.Glass), "hG", 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W)); + ModHandler.addShapedRecipe("glass_dust_hammer", OreDictUnifier.get(dust, Materials.Glass), "hG", 'G', + new ItemStack(Blocks.GLASS, 1, GTValues.W)); - ModHandler.addShapelessRecipe("glass_dust_handcrafting", OreDictUnifier.get(dust, Glass), "dustSand", "dustFlint"); + ModHandler.addShapelessRecipe("glass_dust_handcrafting", OreDictUnifier.get(dust, Glass), "dustSand", + "dustFlint"); - ModHandler.addShapedRecipe("quartz_sand", OreDictUnifier.get(OrePrefix.dust, Materials.QuartzSand), "S", "m", 'S', new ItemStack(Blocks.SAND)); + ModHandler.addShapedRecipe("quartz_sand", OreDictUnifier.get(OrePrefix.dust, Materials.QuartzSand), "S", "m", + 'S', new ItemStack(Blocks.SAND)); RecipeMaps.MACERATOR_RECIPES.recipeBuilder() .inputs(new ItemStack(Blocks.SAND)) @@ -187,7 +193,8 @@ private static void glassRecipes() { ModHandler.removeRecipeByOutput(new ItemStack(Blocks.STAINED_GLASS_PANE, 16, i)); } - ModHandler.addShapedRecipe("stained_glass_pane_" + i, new ItemStack(Blocks.STAINED_GLASS_PANE, 2, i), "sG", 'G', new ItemStack(Blocks.STAINED_GLASS, 1, i)); + ModHandler.addShapedRecipe("stained_glass_pane_" + i, new ItemStack(Blocks.STAINED_GLASS_PANE, 2, i), "sG", + 'G', new ItemStack(Blocks.STAINED_GLASS, 1, i)); CUTTER_RECIPES.recipeBuilder().duration(50).EUt(VA[ULV]) .inputs(new ItemStack(Blocks.STAINED_GLASS, 3, i)) @@ -198,7 +205,8 @@ private static void glassRecipes() { if (ConfigHolder.recipes.hardGlassRecipes) ModHandler.removeRecipeByOutput(new ItemStack(Blocks.GLASS_PANE, 16)); - ModHandler.addShapedRecipe("glass_pane", new ItemStack(Blocks.GLASS_PANE, 2), "sG", 'G', new ItemStack(Blocks.GLASS)); + ModHandler.addShapedRecipe("glass_pane", new ItemStack(Blocks.GLASS_PANE, 2), "sG", 'G', + new ItemStack(Blocks.GLASS)); CUTTER_RECIPES.recipeBuilder().duration(50).EUt(VA[ULV]) .inputs(new ItemStack(Blocks.GLASS, 3)) @@ -210,7 +218,8 @@ private static void glassRecipes() { * Adds smashing related recipes for vanilla blocks and items */ private static void smashingRecipes() { - ModHandler.addShapedRecipe("cobblestone_hammer", new ItemStack(Blocks.COBBLESTONE), "h", "C", 'C', new UnificationEntry(OrePrefix.stone)); + ModHandler.addShapedRecipe("cobblestone_hammer", new ItemStack(Blocks.COBBLESTONE), "h", "C", 'C', + new UnificationEntry(OrePrefix.stone)); FORGE_HAMMER_RECIPES.recipeBuilder() .input(stone.name(), 1) @@ -253,16 +262,23 @@ private static void smashingRecipes() { .EUt(2).duration(400).buildAndRegister(); if (!ConfigHolder.recipes.disableManualCompression) { - ModHandler.addShapelessRecipe("nether_quartz_block_to_nether_quartz", new ItemStack(Items.QUARTZ, 4), Blocks.QUARTZ_BLOCK); + ModHandler.addShapelessRecipe("nether_quartz_block_to_nether_quartz", new ItemStack(Items.QUARTZ, 4), + Blocks.QUARTZ_BLOCK); } - ModHandler.addShapelessRecipe("clay_block_to_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Clay), 'm', Blocks.CLAY); - ModHandler.addShapelessRecipe("clay_ball_to_dust", OreDictUnifier.get(OrePrefix.dustSmall, Materials.Clay), 'm', Items.CLAY_BALL); - ModHandler.addShapelessRecipe("brick_block_to_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Brick), 'm', Blocks.BRICK_BLOCK); - ModHandler.addShapelessRecipe("brick_to_dust", OreDictUnifier.get(OrePrefix.dustSmall, Materials.Brick), 'm', Items.BRICK); - ModHandler.addShapelessRecipe("wheat_to_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Wheat), 'm', Items.WHEAT); + ModHandler.addShapelessRecipe("clay_block_to_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Clay), 'm', + Blocks.CLAY); + ModHandler.addShapelessRecipe("clay_ball_to_dust", OreDictUnifier.get(OrePrefix.dustSmall, Materials.Clay), 'm', + Items.CLAY_BALL); + ModHandler.addShapelessRecipe("brick_block_to_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Brick), 'm', + Blocks.BRICK_BLOCK); + ModHandler.addShapelessRecipe("brick_to_dust", OreDictUnifier.get(OrePrefix.dustSmall, Materials.Brick), 'm', + Items.BRICK); + ModHandler.addShapelessRecipe("wheat_to_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Wheat), 'm', + Items.WHEAT); ModHandler.addShapelessRecipe("gravel_to_flint", new ItemStack(Items.FLINT), 'm', Blocks.GRAVEL); ModHandler.addShapelessRecipe("bone_to_bone_meal", new ItemStack(Items.DYE, 4, 15), 'm', Items.BONE); - ModHandler.addShapelessRecipe("blaze_rod_to_powder", new ItemStack(Items.BLAZE_POWDER, 3), 'm', Items.BLAZE_ROD); + ModHandler.addShapelessRecipe("blaze_rod_to_powder", new ItemStack(Items.BLAZE_POWDER, 3), 'm', + Items.BLAZE_ROD); RecipeMaps.MACERATOR_RECIPES.recipeBuilder() .inputs(new ItemStack(Items.DYE, 1, EnumDyeColor.BROWN.getDyeDamage())) @@ -426,25 +442,50 @@ private static void woodRecipes() { .outputs(new ItemStack(Blocks.TORCH, 8)) .duration(100).EUt(1).buildAndRegister(); - ModHandler.addShapedRecipe("sticky_resin_torch", new ItemStack(Blocks.TORCH, 3), "X", "Y", 'X', MetaItems.STICKY_RESIN, 'Y', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_sulfur", new ItemStack(Blocks.TORCH, 2), "C", "S", 'C', new UnificationEntry(OrePrefix.dust, Materials.Sulfur), 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_phosphorus", new ItemStack(Blocks.TORCH, 6), "C", "S", 'C', new UnificationEntry(OrePrefix.dust, Materials.Phosphorus), 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_coal_dust", new ItemStack(Blocks.TORCH, 4), "C", "S", 'C', new UnificationEntry(OrePrefix.dust, Materials.Coal), 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_charcoal_dust", new ItemStack(Blocks.TORCH, 4), "C", "S", 'C', new UnificationEntry(OrePrefix.dust, Materials.Charcoal), 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_coke", new ItemStack(Blocks.TORCH, 8), "C", "S", 'C', new UnificationEntry(OrePrefix.gem, Materials.Coke), 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_coke_dust", new ItemStack(Blocks.TORCH, 8), "C", "S", 'C', new UnificationEntry(OrePrefix.dust, Materials.Coke), 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_creosote", new ItemStack(Blocks.TORCH, 16), "WB", "S ", 'W', OreDictUnifier.get("wool"), 'S', new UnificationEntry(stick, Wood), 'B', FluidUtil.getFilledBucket(Creosote.getFluid(1000))); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).input(dust, Redstone).input(stick, Wood).outputs(new ItemStack(Blocks.REDSTONE_TORCH, 1)).duration(100).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).input(stick, Wood).input(dust, Sulfur).outputs(new ItemStack(Blocks.TORCH, 2)).duration(100).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).input(stick, Wood).input(dust, Phosphorus).outputs(new ItemStack(Blocks.TORCH, 6)).duration(100).circuitMeta(1).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(40).circuitMeta(7).inputs(new ItemStack(Items.STICK, 7)).outputs(new ItemStack(Blocks.LADDER, ConfigHolder.recipes.hardWoodRecipes ? 2 : 3)).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)).inputs(OreDictUnifier.get("chestWood")).outputs(new ItemStack(Items.CHEST_MINECART)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)).inputs(new ItemStack(Blocks.FURNACE)).outputs(new ItemStack(Items.FURNACE_MINECART)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)).inputs(new ItemStack(Blocks.TNT)).outputs(new ItemStack(Items.TNT_MINECART)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)).inputs(new ItemStack(Blocks.HOPPER)).outputs(new ItemStack(Items.HOPPER_MINECART)).buildAndRegister(); + ModHandler.addShapedRecipe("sticky_resin_torch", new ItemStack(Blocks.TORCH, 3), "X", "Y", 'X', + MetaItems.STICKY_RESIN, 'Y', new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_sulfur", new ItemStack(Blocks.TORCH, 2), "C", "S", 'C', + new UnificationEntry(OrePrefix.dust, Materials.Sulfur), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_phosphorus", new ItemStack(Blocks.TORCH, 6), "C", "S", 'C', + new UnificationEntry(OrePrefix.dust, Materials.Phosphorus), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_coal_dust", new ItemStack(Blocks.TORCH, 4), "C", "S", 'C', + new UnificationEntry(OrePrefix.dust, Materials.Coal), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_charcoal_dust", new ItemStack(Blocks.TORCH, 4), "C", "S", 'C', + new UnificationEntry(OrePrefix.dust, Materials.Charcoal), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_coke", new ItemStack(Blocks.TORCH, 8), "C", "S", 'C', + new UnificationEntry(OrePrefix.gem, Materials.Coke), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_coke_dust", new ItemStack(Blocks.TORCH, 8), "C", "S", 'C', + new UnificationEntry(OrePrefix.dust, Materials.Coke), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_creosote", new ItemStack(Blocks.TORCH, 16), "WB", "S ", 'W', + OreDictUnifier.get("wool"), 'S', new UnificationEntry(stick, Wood), 'B', + FluidUtil.getFilledBucket(Creosote.getFluid(1000))); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).input(dust, Redstone).input(stick, Wood) + .outputs(new ItemStack(Blocks.REDSTONE_TORCH, 1)).duration(100).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).input(stick, Wood).input(dust, Sulfur) + .outputs(new ItemStack(Blocks.TORCH, 2)).duration(100).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).input(stick, Wood).input(dust, Phosphorus) + .outputs(new ItemStack(Blocks.TORCH, 6)).duration(100).circuitMeta(1).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(40).circuitMeta(7).inputs(new ItemStack(Items.STICK, 7)) + .outputs(new ItemStack(Blocks.LADDER, ConfigHolder.recipes.hardWoodRecipes ? 2 : 3)).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)) + .inputs(OreDictUnifier.get("chestWood")).outputs(new ItemStack(Items.CHEST_MINECART)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)) + .inputs(new ItemStack(Blocks.FURNACE)).outputs(new ItemStack(Items.FURNACE_MINECART)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)) + .inputs(new ItemStack(Blocks.TNT)).outputs(new ItemStack(Items.TNT_MINECART)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)) + .inputs(new ItemStack(Blocks.HOPPER)).outputs(new ItemStack(Items.HOPPER_MINECART)).buildAndRegister(); } /** @@ -709,11 +750,21 @@ private static void redstoneRecipes() { 'R', STICKY_RESIN.getStackForm(), 'P', new ItemStack(Blocks.PISTON)); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Iron).inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)).input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Bronze).inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)).input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Steel).inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)).input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON, 2)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Aluminium).inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)).input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Titanium).inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)).input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON, 8)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Iron) + .inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)) + .input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Bronze) + .inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)) + .input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Steel) + .inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)) + .input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON, 2)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Aluminium) + .inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)) + .input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON, 4)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Titanium) + .inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)) + .input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON, 8)).buildAndRegister(); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.plate, Materials.Gold, 2) @@ -728,26 +779,24 @@ private static void redstoneRecipes() { ModHandler.addShapedRecipe("comparator_certus", new ItemStack(Items.COMPARATOR), " T ", "TQT", "SSS", 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(OrePrefix.gem, Materials.CertusQuartz), - 'S', new UnificationEntry(OrePrefix.stone) - ); + 'S', new UnificationEntry(OrePrefix.stone)); ModHandler.addShapedRecipe("comparator_quartzite", new ItemStack(Items.COMPARATOR), " T ", "TQT", "SSS", 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(OrePrefix.gem, Materials.Quartzite), - 'S', new UnificationEntry(OrePrefix.stone) - ); + 'S', new UnificationEntry(OrePrefix.stone)); - ModHandler.addShapedRecipe("daylight_detector_certus", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "CCC", "PPP", + ModHandler.addShapedRecipe("daylight_detector_certus", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "CCC", + "PPP", 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W), 'C', new UnificationEntry(gem, CertusQuartz), - 'P', new UnificationEntry(OrePrefix.slab, Materials.Wood) - ); + 'P', new UnificationEntry(OrePrefix.slab, Materials.Wood)); - ModHandler.addShapedRecipe("daylight_detector_quartzite", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "CCC", "PPP", + ModHandler.addShapedRecipe("daylight_detector_quartzite", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "CCC", + "PPP", 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W), 'C', new UnificationEntry(gem, Quartzite), - 'P', new UnificationEntry(OrePrefix.slab, Materials.Wood) - ); + 'P', new UnificationEntry(OrePrefix.slab, Materials.Wood)); ASSEMBLER_RECIPES.recipeBuilder() .input(plank, Wood, 8) @@ -794,40 +843,34 @@ private static void metalRecipes() { 'P', new UnificationEntry(plate, Materials.Iron), 'C', new ItemStack(Items.IRON_CHESTPLATE), 'L', new ItemStack(Items.IRON_LEGGINGS), - 'S', new UnificationEntry(screw, Materials.Iron) - ); + 'S', new UnificationEntry(screw, Materials.Iron)); ModHandler.addShapedRecipe("golden_horse_armor", new ItemStack(Items.GOLDEN_HORSE_ARMOR), "hdH", "PCP", "LSL", 'H', new ItemStack(Items.GOLDEN_HELMET), 'P', new UnificationEntry(plate, Materials.Gold), 'C', new ItemStack(Items.GOLDEN_CHESTPLATE), 'L', new ItemStack(Items.GOLDEN_LEGGINGS), - 'S', new UnificationEntry(screw, Materials.Gold) - ); + 'S', new UnificationEntry(screw, Materials.Gold)); ModHandler.addShapedRecipe("diamond_horse_armor", new ItemStack(Items.DIAMOND_HORSE_ARMOR), "hdH", "PCP", "LSL", 'H', new ItemStack(Items.DIAMOND_HELMET), 'P', new UnificationEntry(plate, Materials.Diamond), 'C', new ItemStack(Items.DIAMOND_CHESTPLATE), 'L', new ItemStack(Items.DIAMOND_LEGGINGS), - 'S', new UnificationEntry(bolt, Materials.Diamond) - ); + 'S', new UnificationEntry(bolt, Materials.Diamond)); ModHandler.addShapedRecipe("chainmail_helmet", new ItemStack(Items.CHAINMAIL_HELMET), "PPP", "PhP", - 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron) - ); + 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron)); - ModHandler.addShapedRecipe("chainmail_chestplate", new ItemStack(Items.CHAINMAIL_CHESTPLATE), "PhP", "PPP", "PPP", - 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron) - ); + ModHandler.addShapedRecipe("chainmail_chestplate", new ItemStack(Items.CHAINMAIL_CHESTPLATE), "PhP", "PPP", + "PPP", + 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron)); ModHandler.addShapedRecipe("chainmail_leggings", new ItemStack(Items.CHAINMAIL_LEGGINGS), "PPP", "PhP", "P P", - 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron) - ); + 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron)); ModHandler.addShapedRecipe("chainmail_boots", new ItemStack(Items.CHAINMAIL_BOOTS), "P P", "PhP", - 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron) - ); + 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron)); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.plate, Materials.Iron, 7) @@ -858,12 +901,10 @@ private static void metalRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:minecart")); ModHandler.addShapedRecipe("minecart_iron", new ItemStack(Items.MINECART), " h ", "PwP", "WPW", 'W', MetaItems.IRON_MINECART_WHEELS.getStackForm(), - 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron) - ); + 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron)); ModHandler.addShapedRecipe("minecart_steel", new ItemStack(Items.MINECART), " h ", "PwP", "WPW", 'W', MetaItems.STEEL_MINECART_WHEELS.getStackForm(), - 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel) - ); + 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel)); } /** @@ -926,14 +967,21 @@ private static void miscRecipes() { .outputs(new ItemStack(Items.BOW, 1)) .duration(100).EUt(4).buildAndRegister(); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(128).EUt(4).notConsumable(SHAPE_MOLD_BALL).fluidInputs(Water.getFluid(250)).outputs(new ItemStack(Items.SNOWBALL)).buildAndRegister(); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(128).EUt(4).notConsumable(SHAPE_MOLD_BALL).fluidInputs(DistilledWater.getFluid(250)).outputs(new ItemStack(Items.SNOWBALL)).buildAndRegister(); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(512).EUt(4).notConsumable(SHAPE_MOLD_BLOCK).fluidInputs(Water.getFluid(1000)).outputs(new ItemStack(Blocks.SNOW)).buildAndRegister(); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(512).EUt(4).notConsumable(SHAPE_MOLD_BLOCK).fluidInputs(DistilledWater.getFluid(1000)).outputs(new ItemStack(Blocks.SNOW)).buildAndRegister(); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(1024).EUt(16).notConsumable(SHAPE_MOLD_BLOCK).fluidInputs(Lava.getFluid(1000)).outputs(new ItemStack(Blocks.OBSIDIAN)).buildAndRegister(); - - FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(1680).EUt(16).notConsumable(SHAPE_MOLD_ANVIL).fluidInputs(Iron.getFluid(L * 31)).outputs(new ItemStack(Blocks.ANVIL)).buildAndRegister(); - ALLOY_SMELTER_RECIPES.recipeBuilder().input(ingot, Iron, 31).notConsumable(SHAPE_MOLD_ANVIL).outputs(new ItemStack(Blocks.ANVIL)).duration(1680).EUt(16).buildAndRegister(); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(128).EUt(4).notConsumable(SHAPE_MOLD_BALL) + .fluidInputs(Water.getFluid(250)).outputs(new ItemStack(Items.SNOWBALL)).buildAndRegister(); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(128).EUt(4).notConsumable(SHAPE_MOLD_BALL) + .fluidInputs(DistilledWater.getFluid(250)).outputs(new ItemStack(Items.SNOWBALL)).buildAndRegister(); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(512).EUt(4).notConsumable(SHAPE_MOLD_BLOCK) + .fluidInputs(Water.getFluid(1000)).outputs(new ItemStack(Blocks.SNOW)).buildAndRegister(); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(512).EUt(4).notConsumable(SHAPE_MOLD_BLOCK) + .fluidInputs(DistilledWater.getFluid(1000)).outputs(new ItemStack(Blocks.SNOW)).buildAndRegister(); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(1024).EUt(16).notConsumable(SHAPE_MOLD_BLOCK) + .fluidInputs(Lava.getFluid(1000)).outputs(new ItemStack(Blocks.OBSIDIAN)).buildAndRegister(); + + FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(1680).EUt(16).notConsumable(SHAPE_MOLD_ANVIL) + .fluidInputs(Iron.getFluid(L * 31)).outputs(new ItemStack(Blocks.ANVIL)).buildAndRegister(); + ALLOY_SMELTER_RECIPES.recipeBuilder().input(ingot, Iron, 31).notConsumable(SHAPE_MOLD_ANVIL) + .outputs(new ItemStack(Blocks.ANVIL)).duration(1680).EUt(16).buildAndRegister(); ModHandler.addSmeltingRecipe(new ItemStack(Items.SLIME_BALL), STICKY_RESIN.getStackForm(), 0.3f); @@ -955,62 +1003,115 @@ private static void miscRecipes() { .outputs(new ItemStack(Blocks.STONEBRICK, 1, 1)) .duration(40).EUt(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).input(stoneCobble.name(), 6).outputs(new ItemStack(Blocks.STONE_STAIRS, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.BRICK_BLOCK, 6)).outputs(new ItemStack(Blocks.BRICK_STAIRS, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.STONEBRICK, 6, GTValues.W)).outputs(new ItemStack(Blocks.STONE_BRICK_STAIRS, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.NETHER_BRICK, 6)).outputs(new ItemStack(Blocks.NETHER_BRICK_STAIRS, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.SANDSTONE, 6)).outputs(new ItemStack(Blocks.SANDSTONE_STAIRS, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.QUARTZ_BLOCK, 6)).outputs(new ItemStack(Blocks.QUARTZ_STAIRS, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.PURPUR_BLOCK, 6)).outputs(new ItemStack(Blocks.PURPUR_STAIRS, 4)).buildAndRegister(); - - - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(2).inputs(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 0)).outputs(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 2)).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.STONE)).outputs(new ItemStack(Blocks.STONEBRICK, 1, 0)).circuitMeta(4).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.END_STONE)).outputs(new ItemStack(Blocks.END_BRICKS, 1, 0)).circuitMeta(4).duration(50).buildAndRegister(); - - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.SANDSTONE)).outputs(new ItemStack(Blocks.SANDSTONE, 1, 2)).circuitMeta(1).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.RED_SANDSTONE)).outputs(new ItemStack(Blocks.RED_SANDSTONE, 1, 2)).circuitMeta(1).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.SANDSTONE, 1, 2)).outputs(new ItemStack(Blocks.SANDSTONE, 1, 0)).circuitMeta(1).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.RED_SANDSTONE, 1, 2)).outputs(new ItemStack(Blocks.RED_SANDSTONE, 1, 0)).circuitMeta(1).duration(50).buildAndRegister(); - + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).input(stoneCobble.name(), 6) + .outputs(new ItemStack(Blocks.STONE_STAIRS, 4)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7) + .inputs(new ItemStack(Blocks.BRICK_BLOCK, 6)).outputs(new ItemStack(Blocks.BRICK_STAIRS, 4)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7) + .inputs(new ItemStack(Blocks.STONEBRICK, 6, GTValues.W)) + .outputs(new ItemStack(Blocks.STONE_BRICK_STAIRS, 4)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7) + .inputs(new ItemStack(Blocks.NETHER_BRICK, 6)).outputs(new ItemStack(Blocks.NETHER_BRICK_STAIRS, 4)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.SANDSTONE, 6)) + .outputs(new ItemStack(Blocks.SANDSTONE_STAIRS, 4)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7) + .inputs(new ItemStack(Blocks.QUARTZ_BLOCK, 6)).outputs(new ItemStack(Blocks.QUARTZ_STAIRS, 4)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7) + .inputs(new ItemStack(Blocks.PURPUR_BLOCK, 6)).outputs(new ItemStack(Blocks.PURPUR_STAIRS, 4)) + .buildAndRegister(); - CANNER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Blocks.PUMPKIN)).inputs(new ItemStack(Blocks.TORCH)).outputs(new ItemStack(Blocks.LIT_PUMPKIN)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(2) + .inputs(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 0)).outputs(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 2)) + .buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(40).inputs(new ItemStack(Items.PRISMARINE_CRYSTALS, 5)).inputs(new ItemStack(Items.PRISMARINE_SHARD, 4)).outputs(new ItemStack(Blocks.SEA_LANTERN)).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.STONE)) + .outputs(new ItemStack(Blocks.STONEBRICK, 1, 0)).circuitMeta(4).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.END_STONE)) + .outputs(new ItemStack(Blocks.END_BRICKS, 1, 0)).circuitMeta(4).duration(50).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.SANDSTONE)) + .outputs(new ItemStack(Blocks.SANDSTONE, 1, 2)).circuitMeta(1).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.RED_SANDSTONE)) + .outputs(new ItemStack(Blocks.RED_SANDSTONE, 1, 2)).circuitMeta(1).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.SANDSTONE, 1, 2)) + .outputs(new ItemStack(Blocks.SANDSTONE, 1, 0)).circuitMeta(1).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.RED_SANDSTONE, 1, 2)) + .outputs(new ItemStack(Blocks.RED_SANDSTONE, 1, 0)).circuitMeta(1).duration(50).buildAndRegister(); + + CANNER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Blocks.PUMPKIN)) + .inputs(new ItemStack(Blocks.TORCH)).outputs(new ItemStack(Blocks.LIT_PUMPKIN)).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(40).inputs(new ItemStack(Items.PRISMARINE_CRYSTALS, 5)) + .inputs(new ItemStack(Items.PRISMARINE_SHARD, 4)).outputs(new ItemStack(Blocks.SEA_LANTERN)) + .buildAndRegister(); - ALLOY_SMELTER_RECIPES.recipeBuilder().EUt(4).duration(40).inputs(new ItemStack(Items.NETHERBRICK, 2)).inputs(new ItemStack(Items.NETHER_WART, 2)).outputs(new ItemStack(Blocks.RED_NETHER_BRICK)).buildAndRegister(); + ALLOY_SMELTER_RECIPES.recipeBuilder().EUt(4).duration(40).inputs(new ItemStack(Items.NETHERBRICK, 2)) + .inputs(new ItemStack(Items.NETHER_WART, 2)).outputs(new ItemStack(Blocks.RED_NETHER_BRICK)) + .buildAndRegister(); if (!ConfigHolder.recipes.hardMiscRecipes) { - ASSEMBLER_RECIPES.recipeBuilder().duration(80).EUt(6).circuitMeta(4).input("plankWood", 4).outputs(new ItemStack(Blocks.CRAFTING_TABLE)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().circuitMeta(8).input(stoneCobble.name(), 8).outputs(new ItemStack(Blocks.FURNACE)).duration(100).EUt(VA[ULV]).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().inputs(new ItemStack(Blocks.OBSIDIAN, 4)).input(gem, Diamond, 2).inputs(new ItemStack(Items.BOOK)).outputs(new ItemStack(Blocks.ENCHANTING_TABLE)).duration(100).EUt(VA[ULV]).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).circuitMeta(1).inputs(new ItemStack(Blocks.COBBLESTONE, 7)).inputs(new ItemStack(Items.BOW)).input(dust, Redstone).outputs(new ItemStack(Blocks.DISPENSER)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).circuitMeta(2).inputs(new ItemStack(Blocks.COBBLESTONE, 7)).input(dust, Redstone).outputs(new ItemStack(Blocks.DROPPER)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)).input(dust, Redstone, 2).input(plate, NetherQuartz).outputs(new ItemStack(Blocks.OBSERVER)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)).input(dust, Redstone, 2).input(plate, CertusQuartz).outputs(new ItemStack(Blocks.OBSERVER)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)).input(dust, Redstone, 2).input(plate, Quartzite).outputs(new ItemStack(Blocks.OBSERVER)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Blocks.OBSIDIAN, 8)).inputs(new ItemStack(Items.ENDER_EYE)).outputs(new ItemStack(Blocks.ENDER_CHEST)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(30).EUt(VA[ULV]).inputs(new ItemStack(Blocks.STONE_SLAB, 1, 0)).inputs(new ItemStack(Items.STICK, 6)).outputs(new ItemStack(Items.ARMOR_STAND)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(80).EUt(6).circuitMeta(4).input("plankWood", 4) + .outputs(new ItemStack(Blocks.CRAFTING_TABLE)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().circuitMeta(8).input(stoneCobble.name(), 8) + .outputs(new ItemStack(Blocks.FURNACE)).duration(100).EUt(VA[ULV]).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().inputs(new ItemStack(Blocks.OBSIDIAN, 4)).input(gem, Diamond, 2) + .inputs(new ItemStack(Items.BOOK)).outputs(new ItemStack(Blocks.ENCHANTING_TABLE)).duration(100) + .EUt(VA[ULV]).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).circuitMeta(1) + .inputs(new ItemStack(Blocks.COBBLESTONE, 7)).inputs(new ItemStack(Items.BOW)).input(dust, Redstone) + .outputs(new ItemStack(Blocks.DISPENSER)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).circuitMeta(2) + .inputs(new ItemStack(Blocks.COBBLESTONE, 7)).input(dust, Redstone) + .outputs(new ItemStack(Blocks.DROPPER)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)) + .input(dust, Redstone, 2).input(plate, NetherQuartz).outputs(new ItemStack(Blocks.OBSERVER)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)) + .input(dust, Redstone, 2).input(plate, CertusQuartz).outputs(new ItemStack(Blocks.OBSERVER)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)) + .input(dust, Redstone, 2).input(plate, Quartzite).outputs(new ItemStack(Blocks.OBSERVER)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Blocks.OBSIDIAN, 8)) + .inputs(new ItemStack(Items.ENDER_EYE)).outputs(new ItemStack(Blocks.ENDER_CHEST)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(30).EUt(VA[ULV]).inputs(new ItemStack(Blocks.STONE_SLAB, 1, 0)) + .inputs(new ItemStack(Items.STICK, 6)).outputs(new ItemStack(Items.ARMOR_STAND)).buildAndRegister(); } - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).circuitMeta(3).inputs(new ItemStack(Blocks.NETHER_BRICK)).outputs(new ItemStack(Blocks.NETHER_BRICK_FENCE)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).circuitMeta(3).inputs(new ItemStack(Blocks.NETHER_BRICK)) + .outputs(new ItemStack(Blocks.NETHER_BRICK_FENCE)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).circuitMeta(6).inputs(new ItemStack(Blocks.COBBLESTONE, 1, 0)).outputs(new ItemStack(Blocks.COBBLESTONE_WALL, 1, 0)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).circuitMeta(6).inputs(new ItemStack(Blocks.MOSSY_COBBLESTONE, 1, 0)).outputs(new ItemStack(Blocks.COBBLESTONE_WALL, 1, 1)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).circuitMeta(6) + .inputs(new ItemStack(Blocks.COBBLESTONE, 1, 0)).outputs(new ItemStack(Blocks.COBBLESTONE_WALL, 1, 0)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).circuitMeta(6) + .inputs(new ItemStack(Blocks.MOSSY_COBBLESTONE, 1, 0)) + .outputs(new ItemStack(Blocks.COBBLESTONE_WALL, 1, 1)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Items.CHORUS_FRUIT_POPPED)).inputs(new ItemStack(Items.BLAZE_ROD)).outputs(new ItemStack(Blocks.END_ROD, 4)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Items.CHORUS_FRUIT_POPPED)) + .inputs(new ItemStack(Items.BLAZE_ROD)).outputs(new ItemStack(Blocks.END_ROD, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).input("chestWood", 1).inputs(new ItemStack(Items.SHULKER_SHELL, 2)).outputs(new ItemStack(Blocks.PURPLE_SHULKER_BOX)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).input("chestWood", 1) + .inputs(new ItemStack(Items.SHULKER_SHELL, 2)).outputs(new ItemStack(Blocks.PURPLE_SHULKER_BOX)) + .buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).circuitMeta(1).input("wool", 1).inputs(new ItemStack(Items.STICK, 8)).outputs(new ItemStack(Items.PAINTING)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Items.LEATHER)).inputs(new ItemStack(Items.STICK, 8)).outputs(new ItemStack(Items.ITEM_FRAME)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).input("plankWood", 6).inputs(new ItemStack(Items.STICK)).circuitMeta(9).outputs(new ItemStack(Items.SIGN, 3)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).circuitMeta(1).input("wool", 1) + .inputs(new ItemStack(Items.STICK, 8)).outputs(new ItemStack(Items.PAINTING)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Items.LEATHER)) + .inputs(new ItemStack(Items.STICK, 8)).outputs(new ItemStack(Items.ITEM_FRAME)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).input("plankWood", 6).inputs(new ItemStack(Items.STICK)) + .circuitMeta(9).outputs(new ItemStack(Items.SIGN, 3)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(10).EUt(2).inputs(new ItemStack(Items.BRICK, 3)).outputs(new ItemStack(Items.FLOWER_POT)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(10).EUt(2).inputs(new ItemStack(Items.BRICK, 3)) + .outputs(new ItemStack(Items.FLOWER_POT)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(30).EUt(16).inputs(new ItemStack(Items.GHAST_TEAR)).inputs(new ItemStack(Items.ENDER_EYE)).outputs(new ItemStack(Items.END_CRYSTAL)).fluidInputs(Glass.getFluid(GTValues.L * 7)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(30).EUt(16).inputs(new ItemStack(Items.GHAST_TEAR)) + .inputs(new ItemStack(Items.ENDER_EYE)).outputs(new ItemStack(Items.END_CRYSTAL)) + .fluidInputs(Glass.getFluid(GTValues.L * 7)).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.stick, Materials.Iron, 12) @@ -1059,10 +1160,9 @@ private static void miscRecipes() { 'L', new ItemStack(Items.LEATHER), 'C', new ItemStack(Blocks.CARPET, 1, GTValues.W), 'R', new UnificationEntry(ring, Iron), - 'S', new ItemStack(Items.STRING) - ); + 'S', new ItemStack(Items.STRING)); - for (FluidStack fluidStack : new FluidStack[]{Water.getFluid(200), DistilledWater.getFluid(36)}) { + for (FluidStack fluidStack : new FluidStack[] { Water.getFluid(200), DistilledWater.getFluid(36) }) { AUTOCLAVE_RECIPES.recipeBuilder() .inputs(new ItemStack(Blocks.STONE, 1, 1)) .fluidInputs(fluidStack) @@ -1213,7 +1313,6 @@ private static void mixingRecipes() { } private static void dyeRecipes() { - RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() .inputs(new ItemStack(Blocks.RED_FLOWER, 1, 0)) .outputs(new ItemStack(Items.DYE, 2, 1)) diff --git a/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java index 97f8746464a..9eb764c8870 100644 --- a/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java @@ -14,6 +14,7 @@ import gregtech.common.blocks.wood.BlockGregPlanks; import gregtech.common.items.MetaItems; import gregtech.loaders.WoodTypeEntry; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -22,10 +23,11 @@ import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fml.common.registry.GameRegistry; -import javax.annotation.Nonnull; import java.util.Arrays; import java.util.List; +import javax.annotation.Nonnull; + import static gregtech.api.GTValues.*; import static gregtech.api.recipes.RecipeMaps.*; import static gregtech.api.unification.material.Materials.*; @@ -129,8 +131,7 @@ private static List getDefaultEntries() { .material(TreatedWood) .registerAllOres() .registerAllUnificationInfo() - .build() - ); + .build()); } return DEFAULT_ENTRIES; } @@ -179,7 +180,8 @@ public static void registerWoodUnificationInfo(@Nonnull WoodTypeEntry entry) { } if (entry.addDoorsUnificationInfo) { OreDictUnifier.registerOre(entry.door, ConfigHolder.recipes.hardWoodRecipes ? - new ItemMaterialInfo(new MaterialStack(entry.material, M * 2), new MaterialStack(Materials.Iron, M / 9)) : // screw + new ItemMaterialInfo(new MaterialStack(entry.material, M * 2), + new MaterialStack(Materials.Iron, M / 9)) : // screw new ItemMaterialInfo(new MaterialStack(entry.material, M * 2))); } } @@ -207,7 +209,8 @@ public static void registerWoodUnificationInfo(@Nonnull WoodTypeEntry entry) { OreDictUnifier.registerOre(entry.fenceGate, fenceGate, entry.material); } if (entry.addFenceGatesUnificationInfo) { - OreDictUnifier.registerOre(entry.fenceGate, new ItemMaterialInfo(new MaterialStack(entry.material, M * 3))); + OreDictUnifier.registerOre(entry.fenceGate, + new ItemMaterialInfo(new MaterialStack(entry.material, M * 3))); } } @@ -216,7 +219,8 @@ public static void registerWoodUnificationInfo(@Nonnull WoodTypeEntry entry) { OreDictUnifier.registerOre(entry.stairs, stair, entry.material); } if (entry.addStairsUnificationInfo) { - OreDictUnifier.registerOre(entry.stairs, new ItemMaterialInfo(new MaterialStack(entry.material, (3 * M) / 2))); + OreDictUnifier.registerOre(entry.stairs, + new ItemMaterialInfo(new MaterialStack(entry.material, (3 * M) / 2))); } } @@ -295,8 +299,7 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { 'P', entry.planks.copy(), 'T', new ItemStack(Blocks.TRAPDOOR), 'R', new UnificationEntry(ring, Iron), - 'S', new UnificationEntry(screw, Iron) - ); + 'S', new UnificationEntry(screw, Iron)); // plank -> door assembling ASSEMBLER_RECIPES.recipeBuilder() @@ -309,8 +312,7 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { if (!hasDoorRecipe) { ModHandler.addShapedRecipe(name + "_door", GTUtility.copy(3, entry.door), "PP", "PP", "PP", - 'P', entry.planks.copy() - ); + 'P', entry.planks.copy()); } ASSEMBLER_RECIPES.recipeBuilder() @@ -373,15 +375,13 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { ModHandler.addShapedRecipe(hasFenceRecipe ? entry.fenceRecipeName : name + "_fence", entry.fence.copy(), "PSP", "PSP", "PSP", 'P', entry.planks.copy(), - 'S', entry.getStick() - ); + 'S', entry.getStick()); } else { if (!hasFenceRecipe) { ModHandler.addShapedRecipe(name + "_fence", GTUtility.copy(3, entry.fence), "PSP", "PSP", 'P', entry.planks.copy(), - 'S', entry.getStick() - ); + 'S', entry.getStick()); } } @@ -403,12 +403,12 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { ModHandler.removeRecipeByName(new ResourceLocation(entry.modid, entry.fenceGateRecipeName)); } - ModHandler.addShapedRecipe(hasFenceGateRecipe ? entry.fenceGateRecipeName : name + "_fence_gate", entry.fenceGate.copy(), + ModHandler.addShapedRecipe(hasFenceGateRecipe ? entry.fenceGateRecipeName : name + "_fence_gate", + entry.fenceGate.copy(), "F F", "SPS", "SPS", 'P', entry.planks.copy(), 'S', entry.getStick(), - 'F', new ItemStack(Items.FLINT) - ); + 'F', new ItemStack(Items.FLINT)); ModHandler.addShapedRecipe(name + "_fence_gate_screws", GTUtility.copy(2, entry.fenceGate), "IdI", "SPS", "SPS", @@ -420,8 +420,7 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { ModHandler.addShapedRecipe(name + "_fence_gate", entry.fenceGate.copy(), "SPS", "SPS", 'P', entry.planks.copy(), - 'S', entry.getStick() - ); + 'S', entry.getStick()); } } @@ -471,12 +470,14 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { * Standard recipes for GT woods */ private static void registerGTWoodRecipes() { - ModHandler.addShapedRecipe("treated_wood_planks", MetaBlocks.PLANKS.getItemVariant(BlockGregPlanks.BlockType.TREATED_PLANK, 8), + ModHandler.addShapedRecipe("treated_wood_planks", + MetaBlocks.PLANKS.getItemVariant(BlockGregPlanks.BlockType.TREATED_PLANK, 8), "PPP", "PBP", "PPP", 'P', "plankWood", 'B', FluidUtil.getFilledBucket(Creosote.getFluid(1000))); - ModHandler.addShapedRecipe("treated_wood_stick", OreDictUnifier.get(OrePrefix.stick, TreatedWood, ConfigHolder.recipes.nerfWoodCrafting ? 2 : 4), + ModHandler.addShapedRecipe("treated_wood_stick", + OreDictUnifier.get(OrePrefix.stick, TreatedWood, ConfigHolder.recipes.nerfWoodCrafting ? 2 : 4), "L", "L", 'L', MetaBlocks.PLANKS.getItemVariant(BlockGregPlanks.BlockType.TREATED_PLANK)); if (ConfigHolder.recipes.nerfWoodCrafting) { diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/AcidRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/AcidRecipes.java index 8d0d3e2ef75..7513125c202 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/AcidRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/AcidRecipes.java @@ -16,7 +16,6 @@ public static void init() { } private static void sulfuricAcidRecipes() { - CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(2) .input(dust, Sulfur) @@ -62,7 +61,6 @@ private static void sulfuricAcidRecipes() { } private static void nitricAcidRecipes() { - CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(1) .fluidInputs(Hydrogen.getFluid(3000)) @@ -127,7 +125,6 @@ private static void nitricAcidRecipes() { } private static void phosphoricAcidRecipes() { - CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(1) .input(dust, Phosphorus, 4) @@ -159,7 +156,5 @@ private static void phosphoricAcidRecipes() { .duration(320).EUt(VA[LV]).buildAndRegister(); } - private static void aceticAcidRecipes() { - - } + private static void aceticAcidRecipes() {} } diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/AssemblerRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/chemistry/AssemblerRecipeLoader.java index 90c271e2950..44be226b0c8 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/AssemblerRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/AssemblerRecipeLoader.java @@ -1,6 +1,7 @@ package gregtech.loaders.recipe.chemistry; import gregtech.common.ConfigHolder; + import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -19,7 +20,6 @@ public class AssemblerRecipeLoader { public static void init() { - // Gearbox-like ASSEMBLER_RECIPES.recipeBuilder() .input(plate, Bronze, 4) @@ -73,7 +73,8 @@ public static void init() { .input(rotor, TungstenSteel, 2) .input(pipeNormalFluid, TungstenSteel, 4) .inputs(METAL_CASING.getItemVariant(TUNGSTENSTEEL_ROBUST)) - .outputs(MULTIBLOCK_CASING.getItemVariant(EXTREME_ENGINE_INTAKE_CASING, ConfigHolder.recipes.casingsPerCraft)) + .outputs(MULTIBLOCK_CASING.getItemVariant(EXTREME_ENGINE_INTAKE_CASING, + ConfigHolder.recipes.casingsPerCraft)) .duration(50).EUt(16).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/BrewingRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/BrewingRecipes.java index 5ff0e665e9d..16ddc802f42 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/BrewingRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/BrewingRecipes.java @@ -1,6 +1,7 @@ package gregtech.loaders.recipe.chemistry; import gregtech.api.unification.material.Material; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -13,8 +14,7 @@ public class BrewingRecipes { public static void init() { - - for (Material material : new Material[]{Talc, Soapstone, Redstone}) { + for (Material material : new Material[] { Talc, Soapstone, Redstone }) { BREWING_RECIPES.recipeBuilder() .input(dust, material) .fluidInputs(Oil.getFluid(1000)) @@ -35,14 +35,23 @@ public static void init() { } // Biomass - BREWING_RECIPES.recipeBuilder().duration(800).EUt(3).input("treeSapling", 1).fluidInputs(Water.getFluid(100)).fluidOutputs(Biomass.getFluid(100)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.POTATO)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.CARROT)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.CACTUS)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.REEDS)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.BROWN_MUSHROOM)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.RED_MUSHROOM)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.BEETROOT)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().EUt(4).duration(128).input(BIO_CHAFF).fluidInputs(Water.getFluid(750)).fluidOutputs(Biomass.getFluid(750)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(800).EUt(3).input("treeSapling", 1).fluidInputs(Water.getFluid(100)) + .fluidOutputs(Biomass.getFluid(100)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.POTATO)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.CARROT)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.CACTUS)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.REEDS)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.BROWN_MUSHROOM)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.RED_MUSHROOM)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.BEETROOT)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().EUt(4).duration(128).input(BIO_CHAFF).fluidInputs(Water.getFluid(750)) + .fluidOutputs(Biomass.getFluid(750)).buildAndRegister(); } } diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/ChemicalBathRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/ChemicalBathRecipes.java index f420f9fcb3d..56904e7dd4f 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/ChemicalBathRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/ChemicalBathRecipes.java @@ -4,6 +4,7 @@ import gregtech.common.blocks.StoneVariantBlock; import gregtech.common.blocks.StoneVariantBlock.StoneVariant; import gregtech.common.blocks.wood.BlockGregPlanks; + import net.minecraft.init.Items; import static gregtech.api.GTValues.*; @@ -14,7 +15,6 @@ public class ChemicalBathRecipes { public static void init() { - CHEMICAL_BATH_RECIPES.recipeBuilder() .input(dust, Wood) .fluidInputs(Water.getFluid(100)) @@ -58,9 +58,11 @@ public static void init() { .duration(100).EUt(VA[ULV]).buildAndRegister(); CHEMICAL_BATH_RECIPES.recipeBuilder() - .inputs(MetaBlocks.STONE_BLOCKS.get(StoneVariant.SMOOTH).getItemVariant(StoneVariantBlock.StoneType.CONCRETE_LIGHT)) + .inputs(MetaBlocks.STONE_BLOCKS.get(StoneVariant.SMOOTH) + .getItemVariant(StoneVariantBlock.StoneType.CONCRETE_LIGHT)) .fluidInputs(Water.getFluid(100)) - .outputs(MetaBlocks.STONE_BLOCKS.get(StoneVariant.SMOOTH).getItemVariant(StoneVariantBlock.StoneType.CONCRETE_DARK)) + .outputs(MetaBlocks.STONE_BLOCKS.get(StoneVariant.SMOOTH) + .getItemVariant(StoneVariantBlock.StoneType.CONCRETE_DARK)) .duration(100).EUt(VA[ULV]).buildAndRegister(); CHEMICAL_BATH_RECIPES.recipeBuilder() diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/ChemistryRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/ChemistryRecipes.java index 33dc55e3830..0a44f0a8b66 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/ChemistryRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/ChemistryRecipes.java @@ -1,6 +1,7 @@ package gregtech.loaders.recipe.chemistry; import gregtech.api.fluids.store.FluidStorageKeys; + import net.minecraft.init.Items; import static gregtech.api.GTValues.*; @@ -12,7 +13,6 @@ public class ChemistryRecipes { public static void init() { - PetrochemRecipes.init(); DistillationRecipes.init(); SeparationRecipes.init(); @@ -30,7 +30,6 @@ public static void init() { NaquadahRecipes.init(); AcidRecipes.init(); - // A Few Random Recipes FLUID_HEATER_RECIPES.recipeBuilder() .circuitMeta(1) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/FuelRecipeChains.java b/src/main/java/gregtech/loaders/recipe/chemistry/FuelRecipeChains.java index 5e5707d5f17..010a74e0cdb 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/FuelRecipeChains.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/FuelRecipeChains.java @@ -8,7 +8,6 @@ public class FuelRecipeChains { public static void init() { - // High Octane Gasoline LARGE_CHEMICAL_RECIPES.recipeBuilder().EUt(VA[HV]).duration(100) .fluidInputs(Naphtha.getFluid(16000)) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/GemSlurryRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/GemSlurryRecipes.java index 49fe44d3e18..4a36c1eb79e 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/GemSlurryRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/GemSlurryRecipes.java @@ -9,7 +9,6 @@ public class GemSlurryRecipes { public static void init() { - // Ruby MIXER_RECIPES.recipeBuilder().duration(280).EUt(VA[EV]) .input(crushed, Ruby, 2) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/GrowthMediumRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/GrowthMediumRecipes.java index 8739093923e..0bd90974ed9 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/GrowthMediumRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/GrowthMediumRecipes.java @@ -1,6 +1,7 @@ package gregtech.loaders.recipe.chemistry; import gregtech.api.metatileentity.multiblock.CleanroomType; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -15,7 +16,6 @@ public class GrowthMediumRecipes { public static void init() { - // Bio Chaff MACERATOR_RECIPES.recipeBuilder().duration(200) .input(PLANT_BALL, 2) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/LCRCombined.java b/src/main/java/gregtech/loaders/recipe/chemistry/LCRCombined.java index 59bcd489698..01fd09384f6 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/LCRCombined.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/LCRCombined.java @@ -8,7 +8,6 @@ public class LCRCombined { static void init() { - LARGE_CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(24) .fluidInputs(Methane.getFluid(3000)) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/NaquadahRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/NaquadahRecipes.java index 24045fd506d..b4a3087751c 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/NaquadahRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/NaquadahRecipes.java @@ -22,7 +22,6 @@ public class NaquadahRecipes { // |> 0.25 Barium public static void init() { - // FLUOROANTIMONIC ACID CHEMICAL_RECIPES.recipeBuilder().EUt(VA[ULV]).duration(60) @@ -45,7 +44,6 @@ public static void init() { .fluidOutputs(Hydrogen.getFluid(2000)) .buildAndRegister(); - // STARTING POINT LARGE_CHEMICAL_RECIPES.recipeBuilder().EUt(VA[LuV]).duration(600) @@ -56,7 +54,6 @@ public static void init() { .output(dust, TitaniumTrifluoride, 4) .buildAndRegister(); - // ENRICHED NAQUADAH PROCESS CENTRIFUGE_RECIPES.recipeBuilder().EUt(VA[EV]).duration(400) @@ -94,7 +91,6 @@ public static void init() { .fluidOutputs(NaquadriaSolution.getFluid(150)) .buildAndRegister(); - // NAQUADRIA PROCESS CENTRIFUGE_RECIPES.recipeBuilder().EUt(VA[EV]).duration(400) @@ -132,7 +128,6 @@ public static void init() { .fluidOutputs(EnrichedNaquadahSolution.getFluid(150)) .buildAndRegister(); - // TRINIUM BLAST_RECIPES.recipeBuilder().duration(750).EUt(VA[LuV]).blastFurnaceTemp(Trinium.getBlastTemperature()) @@ -142,7 +137,6 @@ public static void init() { .output(dust, ZincSulfide, 2) .buildAndRegister(); - // BYPRODUCT PROCESSING // Titanium Trifluoride diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/NuclearRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/NuclearRecipes.java index 1bb959cc6c4..08d8567299b 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/NuclearRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/NuclearRecipes.java @@ -8,7 +8,6 @@ public class NuclearRecipes { public static void init() { - CHEMICAL_RECIPES.recipeBuilder().duration(200).EUt(VA[LV]) .input(dust, Uraninite, 3) .fluidInputs(HydrofluoricAcid.getFluid(4000)) @@ -34,6 +33,5 @@ public static void init() { .output(dust, Uranium238) .fluidOutputs(Fluorine.getFluid(6000)) .buildAndRegister(); - } } diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/PetrochemRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/PetrochemRecipes.java index 623f662a1d4..abbf301bb49 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/PetrochemRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/PetrochemRecipes.java @@ -65,7 +65,6 @@ public static void init() { } private static void desulfurizationRecipes() { - CHEMICAL_RECIPES.recipeBuilder() .fluidInputs(SulfuricHeavyFuel.getFluid(8000)) .fluidInputs(Hydrogen.getFluid(2000)) @@ -103,7 +102,6 @@ private static void desulfurizationRecipes() { } private static void distillationRecipes() { - DISTILLATION_RECIPES.recipeBuilder() .fluidInputs(RefineryGas.getFluid(1000)) .fluidOutputs(Butane.getFluid(60)) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/PlatGroupMetalsRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/PlatGroupMetalsRecipes.java index c31041ff99e..a141203d3b4 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/PlatGroupMetalsRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/PlatGroupMetalsRecipes.java @@ -9,7 +9,6 @@ public class PlatGroupMetalsRecipes { public static void init() { - // Primary Chain // Platinum Group Sludge Production @@ -68,16 +67,16 @@ public static void init() { // MODIFY THIS RECIPE TO RE-BALANCE THE LINE // // Current Losses of Materials per recipe (update this if rebalanced): - // H: Loses - // N: Loses - // O: Loses + // H: Loses + // N: Loses + // O: Loses // Cl: Perfectly Conserved // // If modified, this is how much 1 of each product will change the above losses by: - // Pt: 266L of Cl + // Pt: 266L of Cl // // These numbers are not correct: - // Pd: 200L of N, 600L of H + // Pd: 200L of N, 600L of H // Ru/Rh: 667L of O // Ir/Os: 620L of O, 100L of H // @@ -93,7 +92,6 @@ public static void init() { .output(dust, PlatinumSludgeResidue, 2) .buildAndRegister(); - // PLATINUM ELECTROLYZER_RECIPES.recipeBuilder().duration(100).EUt(VA[MV]) @@ -102,7 +100,6 @@ public static void init() { .fluidOutputs(Chlorine.getFluid(800)) .buildAndRegister(); - // PALLADIUM CHEMICAL_RECIPES.recipeBuilder().duration(200).EUt(VA[MV]) @@ -112,7 +109,6 @@ public static void init() { .output(dust, AmmoniumChloride, 2) .buildAndRegister(); - // RHODIUM / RUTHENIUM CHEMICAL_RECIPES.recipeBuilder().duration(450).EUt(VA[EV]) @@ -137,7 +133,6 @@ public static void init() { .fluidOutputs(CarbonDioxide.getFluid(2000)) .buildAndRegister(); - // OSMIUM / IRIDIUM LARGE_CHEMICAL_RECIPES.recipeBuilder().duration(400).EUt(VA[IV]) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/PolymerRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/PolymerRecipes.java index a799ec72a75..7a1531eeb7c 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/PolymerRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/PolymerRecipes.java @@ -18,7 +18,6 @@ public static void init() { } private static void polyethyleneProcess() { - CHEMICAL_RECIPES.recipeBuilder() .fluidInputs(SulfuricAcid.getFluid(1000)) .fluidInputs(Ethanol.getFluid(1000)) @@ -65,7 +64,6 @@ private static void polyethyleneProcess() { } private static void polyvinylChlorideProcess() { - CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(3) .fluidInputs(Oxygen.getFluid(1000)) @@ -121,7 +119,6 @@ private static void polyvinylChlorideProcess() { } private static void ptfeProcess() { - CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(1) .fluidInputs(Chlorine.getFluid(6000)) @@ -178,7 +175,6 @@ private static void ptfeProcess() { } private static void epoxyProcess() { - CHEMICAL_RECIPES.recipeBuilder() .input(dustTiny, SodiumHydroxide) .fluidInputs(SeedOil.getFluid(6000)) @@ -326,7 +322,6 @@ private static void epoxyProcess() { } private static void styreneButadieneProcess() { - CHEMICAL_RECIPES.recipeBuilder() .fluidInputs(Ethylene.getFluid(1000)) .fluidInputs(Benzene.getFluid(1000)) @@ -503,6 +498,5 @@ public static void polycaprolactamProcess() { .fluidInputs(Nitrogen.getFluid(1000)) .output(ingot, Polycaprolactam, 1) .buildAndRegister(); - } } diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java index dbdaa04cdfb..7871a518e8c 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java @@ -4,6 +4,7 @@ import gregtech.api.unification.material.MarkerMaterials; import gregtech.api.unification.material.Materials; import gregtech.common.items.MetaItems; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -18,7 +19,6 @@ public class ReactorRecipes { public static void init() { - CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(1) .fluidInputs(Isoprene.getFluid(144)) @@ -76,8 +76,6 @@ public static void init() { .fluidOutputs(PolyphenyleneSulfide.getFluid(1500)) .duration(240).EUt(360).buildAndRegister(); - - CHEMICAL_RECIPES.recipeBuilder() .input(dust, Polydimethylsiloxane, 9) .input(dust, Sulfur) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/SeparationRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/SeparationRecipes.java index 7001a4b977e..3d51fc11124 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/SeparationRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/SeparationRecipes.java @@ -5,6 +5,7 @@ import gregtech.api.util.GTUtility; import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -29,7 +30,6 @@ public class SeparationRecipes { public static void init() { - // Centrifuge CENTRIFUGE_RECIPES.recipeBuilder() .fluidInputs(RefineryGas.getFluid(8000)) @@ -97,7 +97,8 @@ public static void init() { int healAmount = itemFood.getHealAmount(itemStack); float saturationModifier = itemFood.getSaturationModifier(itemStack); if (healAmount > 0) { - FluidStack outputStack = Methane.getFluid(Math.round(9 * healAmount * (1.0f + saturationModifier))); + FluidStack outputStack = Methane + .getFluid(Math.round(9 * healAmount * (1.0f + saturationModifier))); CENTRIFUGE_RECIPES.recipeBuilder().duration(144).EUt(5) .inputs(itemStack) @@ -570,7 +571,6 @@ public static void init() { .inputs(new ItemStack(Blocks.BOOKSHELF)) .outputs(new ItemStack(Items.BOOK, 3)) .duration(300).EUt(2).buildAndRegister(); - } @SuppressWarnings("unchecked") diff --git a/src/main/java/gregtech/loaders/recipe/handlers/DecompositionRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/DecompositionRecipeHandler.java index 79bdee19c5b..0e1fd185aed 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/DecompositionRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/DecompositionRecipeHandler.java @@ -8,6 +8,7 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.MaterialStack; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -31,15 +32,16 @@ private static void processDecomposition(OrePrefix decomposePrefix, Material mat if (material.getMaterialComponents().isEmpty() || (!material.hasFlag(DECOMPOSITION_BY_ELECTROLYZING) && !material.hasFlag(DECOMPOSITION_BY_CENTRIFUGING)) || - //disable decomposition if explicitly disabled for this material or for one of it's components + // disable decomposition if explicitly disabled for this material or for one of it's components material.hasFlag(DISABLE_DECOMPOSITION) || - material.getMaterialComponents().size() > 6) return; + material.getMaterialComponents().size() > 6) + return; List outputs = new ArrayList<>(); List fluidOutputs = new ArrayList<>(); int totalInputAmount = 0; - //compute outputs + // compute outputs for (MaterialStack component : material.getMaterialComponents()) { totalInputAmount += component.amount; if (component.material.hasProperty(PropertyKey.DUST)) { @@ -49,9 +51,9 @@ private static void processDecomposition(OrePrefix decomposePrefix, Material mat } } - //only reduce items + // only reduce items if (decomposePrefix != null) { - //calculate lowest common denominator + // calculate lowest common denominator List materialAmounts = new ArrayList<>(); materialAmounts.add(totalInputAmount); outputs.forEach(itemStack -> materialAmounts.add(itemStack.getCount())); @@ -65,7 +67,7 @@ private static void processDecomposition(OrePrefix decomposePrefix, Material mat highestDivisor = i; } - //divide components + // divide components if (highestDivisor != 1) { List reducedOutputs = new ArrayList<>(); @@ -89,8 +91,7 @@ private static void processDecomposition(OrePrefix decomposePrefix, Material mat } } - - //generate builder + // generate builder RecipeBuilder builder; if (material.hasFlag(DECOMPOSITION_BY_ELECTROLYZING)) { builder = RecipeMaps.ELECTROLYZER_RECIPES.recipeBuilder() @@ -104,14 +105,14 @@ private static void processDecomposition(OrePrefix decomposePrefix, Material mat builder.outputs(outputs); builder.fluidOutputs(fluidOutputs); - //finish builder + // finish builder if (decomposePrefix != null) { builder.input(decomposePrefix, material, totalInputAmount); } else { builder.fluidInputs(material.getFluid(1000)); } - //register recipe + // register recipe builder.buildAndRegister(); } @@ -126,5 +127,4 @@ private static boolean isEveryMaterialReducible(int divisor, List mater private static int getSmallestMaterialAmount(List materialAmounts) { return materialAmounts.stream().min(Integer::compare).orElse(0); } - } diff --git a/src/main/java/gregtech/loaders/recipe/handlers/MaterialRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/MaterialRecipeHandler.java index cc66ed01027..8ff1f825974 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/MaterialRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/MaterialRecipeHandler.java @@ -15,14 +15,16 @@ import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; import gregtech.loaders.recipe.CraftingComponent; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.*; import static gregtech.api.recipes.RecipeMaps.*; import static gregtech.api.unification.material.info.MaterialFlags.*; @@ -56,8 +58,8 @@ public static void register() { for (int i = 0; i < GEM_ORDER.size(); i++) { OrePrefix gemPrefix = GEM_ORDER.get(i); OrePrefix prevGemPrefix = i == 0 ? null : GEM_ORDER.get(i - 1); - gemPrefix.addProcessingHandler(PropertyKey.GEM, (p, material, property) -> - processGemConversion(p, prevGemPrefix, material)); + gemPrefix.addProcessingHandler(PropertyKey.GEM, + (p, material, property) -> processGemConversion(p, prevGemPrefix, material)); } } @@ -102,7 +104,8 @@ public static void processDust(OrePrefix dustPrefix, Material mat, DustProperty if (oreProperty != null) { Material smeltingResult = oreProperty.getDirectSmeltResult(); if (smeltingResult != null) { - ModHandler.addSmeltingRecipe(OreDictUnifier.get(dustPrefix, mat), OreDictUnifier.get(OrePrefix.ingot, smeltingResult)); + ModHandler.addSmeltingRecipe(OreDictUnifier.get(dustPrefix, mat), + OreDictUnifier.get(OrePrefix.ingot, smeltingResult)); } } @@ -197,7 +200,8 @@ private static void processEBFRecipe(Material material, BlastProperty property, // Add Vacuum Freezer recipe if required. if (ingotHot.doGenerateItem(material)) { int vacuumEUt = property.getVacuumEUtOverride() != -1 ? property.getVacuumEUtOverride() : VA[MV]; - int vacuumDuration = property.getVacuumDurationOverride() != -1 ? property.getVacuumDurationOverride() : (int) material.getMass() * 3; + int vacuumDuration = property.getVacuumDurationOverride() != -1 ? property.getVacuumDurationOverride() : + (int) material.getMass() * 3; if (blastTemp < 5000) { RecipeMaps.VACUUM_RECIPES.recipeBuilder() @@ -262,7 +266,8 @@ public static void processTinyDust(OrePrefix orePrefix, Material material, DustP public static void processIngot(OrePrefix ingotPrefix, Material material, IngotProperty property) { if (material.hasFlag(MORTAR_GRINDABLE)) { ModHandler.addShapedRecipe(String.format("mortar_grind_%s", material), - OreDictUnifier.get(OrePrefix.dust, material), "X", "m", 'X', new UnificationEntry(ingotPrefix, material)); + OreDictUnifier.get(OrePrefix.dust, material), "X", "m", 'X', + new UnificationEntry(ingotPrefix, material)); } if (material.hasFlag(GENERATE_ROD)) { @@ -363,7 +368,6 @@ public static void processIngot(OrePrefix ingotPrefix, Material material, IngotP } } } - } public static void processGemConversion(OrePrefix gemPrefix, @Nullable OrePrefix prevPrefix, Material material) { @@ -495,12 +499,14 @@ public static void processBlock(OrePrefix blockPrefix, Material material, DustPr result.add(blockEntry); } - //do not allow hand crafting or uncrafting, extruding or alloy smelting of blacklisted blocks + // do not allow hand crafting or uncrafting, extruding or alloy smelting of blacklisted blocks if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_RECIPES)) { - //do not allow hand crafting or uncrafting of blacklisted blocks - if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES) && !ConfigHolder.recipes.disableManualCompression) { - ModHandler.addShapelessRecipe(String.format("block_compress_%s", material), blockStack, result.toArray()); + // do not allow hand crafting or uncrafting of blacklisted blocks + if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES) && + !ConfigHolder.recipes.disableManualCompression) { + ModHandler.addShapelessRecipe(String.format("block_compress_%s", material), blockStack, + result.toArray()); ModHandler.addShapelessRecipe(String.format("block_decompress_%s", material), GTUtility.copy((int) (materialAmount / M), OreDictUnifier.get(blockEntry)), diff --git a/src/main/java/gregtech/loaders/recipe/handlers/OreRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/OreRecipeHandler.java index 3ff64f66a45..c31486610f2 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/OreRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/OreRecipeHandler.java @@ -15,7 +15,9 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; + import org.apache.commons.lang3.tuple.Pair; import java.util.List; @@ -50,7 +52,6 @@ public static void register() { OrePrefix.dustPure.addProcessingHandler(PropertyKey.ORE, OreRecipeHandler::processPureDust); } - private static void processMetalSmelting(OrePrefix crushedPrefix, Material material, OreProperty property) { Material smeltingResult = property.getDirectSmeltResult() != null ? property.getDirectSmeltResult() : material; @@ -69,7 +70,8 @@ public static void processOre(OrePrefix orePrefix, Material material, OrePropert if (byproductStack.isEmpty()) byproductStack = OreDictUnifier.get(OrePrefix.dust, byproductMaterial); ItemStack crushedStack = OreDictUnifier.get(OrePrefix.crushed, material); ItemStack ingotStack; - Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : property.getDirectSmeltResult(); + Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : + property.getDirectSmeltResult(); double amountOfCrushedOre = property.getOreMultiplier(); if (smeltingMaterial.hasProperty(PropertyKey.INGOT)) { ingotStack = OreDictUnifier.get(OrePrefix.ingot, smeltingMaterial); @@ -87,7 +89,8 @@ public static void processOre(OrePrefix orePrefix, Material material, OrePropert .input(orePrefix, material) .duration(10).EUt(16); if (material.hasProperty(PropertyKey.GEM) && !OreDictUnifier.get(OrePrefix.gem, material).isEmpty()) { - builder.outputs(GTUtility.copy((int) Math.ceil(amountOfCrushedOre) * oreTypeMultiplier, OreDictUnifier.get(OrePrefix.gem, material, crushedStack.getCount()))); + builder.outputs(GTUtility.copy((int) Math.ceil(amountOfCrushedOre) * oreTypeMultiplier, + OreDictUnifier.get(OrePrefix.gem, material, crushedStack.getCount()))); } else { builder.outputs(GTUtility.copy((int) Math.ceil(amountOfCrushedOre) * oreTypeMultiplier, crushedStack)); } @@ -108,7 +111,7 @@ public static void processOre(OrePrefix orePrefix, Material material, OrePropert builder.buildAndRegister(); } - //do not try to add smelting recipes for materials which require blast furnace + // do not try to add smelting recipes for materials which require blast furnace if (!ingotStack.isEmpty() && doesMaterialUseNormalFurnace(smeltingMaterial)) { ModHandler.addSmeltingRecipe(new UnificationEntry(orePrefix, material), ingotStack, 0.5f); } @@ -118,7 +121,7 @@ public static void processCrushedOre(OrePrefix crushedPrefix, Material material, ItemStack impureDustStack = OreDictUnifier.get(OrePrefix.dustImpure, material); Material byproductMaterial = property.getOreByProduct(0, material); - //fallback for dirtyGravel, shard & clump + // fallback for dirtyGravel, shard & clump if (impureDustStack.isEmpty()) { impureDustStack = GTUtility.copyFirst( OreDictUnifier.get(OrePrefix.dirtyGravel, material), @@ -137,7 +140,8 @@ public static void processCrushedOre(OrePrefix crushedPrefix, Material material, .input(crushedPrefix, material) .outputs(impureDustStack) .duration(400) - .chancedOutput(OreDictUnifier.get(OrePrefix.dust, byproductMaterial, property.getByProductMultiplier()), 1400, 850) + .chancedOutput(OreDictUnifier.get(OrePrefix.dust, byproductMaterial, property.getByProductMultiplier()), + 1400, 850) .buildAndRegister(); ItemStack crushedPurifiedOre = GTUtility.copyFirst( @@ -175,7 +179,8 @@ public static void processCrushedOre(OrePrefix crushedPrefix, Material material, RecipeMaps.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder() .input(crushedPrefix, material) .outputs(crushedCentrifugedOre) - .chancedOutput(OrePrefix.dust, property.getOreByProduct(1, material), property.getByProductMultiplier(), 3333, 0) + .chancedOutput(OrePrefix.dust, property.getOreByProduct(1, material), property.getByProductMultiplier(), + 3333, 0) .output(OrePrefix.dust, Materials.Stone) .buildAndRegister(); @@ -186,7 +191,9 @@ public static void processCrushedOre(OrePrefix crushedPrefix, Material material, .input(crushedPrefix, material) .fluidInputs(washedInTuple.getKey().getFluid(washedInTuple.getValue())) .outputs(crushedPurifiedOre) - .chancedOutput(OreDictUnifier.get(OrePrefix.dust, washingByproduct, property.getByProductMultiplier()), 7000, 580) + .chancedOutput( + OreDictUnifier.get(OrePrefix.dust, washingByproduct, property.getByProductMultiplier()), + 7000, 580) .chancedOutput(OreDictUnifier.get(OrePrefix.dust, Materials.Stone), 4000, 650) .duration(200).EUt(VA[LV]) .buildAndRegister(); @@ -318,7 +325,7 @@ public static void processDirtyDust(OrePrefix dustPrefix, Material material, Ore .outputs(dustStack) .duration(8).EUt(4).buildAndRegister(); - //dust gains same amount of material as normal dust + // dust gains same amount of material as normal dust processMetalSmelting(dustPrefix, material, property); } @@ -328,22 +335,25 @@ public static void processPureDust(OrePrefix purePrefix, Material material, OreP if (property.getSeparatedInto() != null && !property.getSeparatedInto().isEmpty()) { List separatedMaterial = property.getSeparatedInto(); - OrePrefix prefix = (separatedMaterial.get(separatedMaterial.size() - 1).getBlastTemperature() == 0 && separatedMaterial.get(separatedMaterial.size() - 1).hasProperty(PropertyKey.INGOT)) - ? OrePrefix.nugget : OrePrefix.dust; + OrePrefix prefix = (separatedMaterial.get(separatedMaterial.size() - 1).getBlastTemperature() == 0 && + separatedMaterial.get(separatedMaterial.size() - 1).hasProperty(PropertyKey.INGOT)) ? + OrePrefix.nugget : OrePrefix.dust; - ItemStack separatedStack2 = OreDictUnifier.get(prefix, separatedMaterial.get(separatedMaterial.size() - 1), prefix == OrePrefix.nugget ? 2 : 1); + ItemStack separatedStack2 = OreDictUnifier.get(prefix, separatedMaterial.get(separatedMaterial.size() - 1), + prefix == OrePrefix.nugget ? 2 : 1); RecipeMaps.ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder() .input(purePrefix, material) .outputs(dustStack) .chancedOutput(OrePrefix.dust, separatedMaterial.get(0), 1000, 250) - .chancedOutput(separatedStack2, prefix == OrePrefix.dust ? 500 : 2000, prefix == OrePrefix.dust ? 150 : 600) + .chancedOutput(separatedStack2, prefix == OrePrefix.dust ? 500 : 2000, + prefix == OrePrefix.dust ? 150 : 600) .duration(200).EUt(24) .buildAndRegister(); } if (dustStack.isEmpty()) { - //fallback for reduced & cleanGravel + // fallback for reduced & cleanGravel dustStack = GTUtility.copyFirst( OreDictUnifier.get(OrePrefix.reduced, material), OreDictUnifier.get(OrePrefix.cleanGravel, material)); diff --git a/src/main/java/gregtech/loaders/recipe/handlers/PartsRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/PartsRecipeHandler.java index 21eb68cab9f..24ec5349133 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/PartsRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/PartsRecipeHandler.java @@ -18,6 +18,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; import gregtech.common.items.behaviors.AbstractMaterialPartBehavior; + import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; @@ -30,8 +31,7 @@ public class PartsRecipeHandler { - private PartsRecipeHandler() { - } + private PartsRecipeHandler() {} public static void register() { OrePrefix.stick.addProcessingHandler(PropertyKey.DUST, PartsRecipeHandler::processStick); @@ -213,8 +213,10 @@ public static void processGear(OrePrefix gearPrefix, Material material, DustProp if (material.hasFlag(GENERATE_PLATE) && material.hasFlag(GENERATE_ROD)) { if (gearPrefix == OrePrefix.gearSmall) { - ModHandler.addShapedRecipe(String.format("small_gear_%s", material), OreDictUnifier.get(gearSmall, material), - " R ", "hPx", " R ", 'R', new UnificationEntry(stick, material), 'P', new UnificationEntry(plate, material)); + ModHandler.addShapedRecipe(String.format("small_gear_%s", material), + OreDictUnifier.get(gearSmall, material), + " R ", "hPx", " R ", 'R', new UnificationEntry(stick, material), 'P', + new UnificationEntry(plate, material)); RecipeMaps.EXTRUDER_RECIPES.recipeBuilder() .input(OrePrefix.ingot, material) diff --git a/src/main/java/gregtech/loaders/recipe/handlers/PipeRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/PipeRecipeHandler.java index cccaa0043f7..bd58e4263e8 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/PipeRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/PipeRecipeHandler.java @@ -1,6 +1,5 @@ package gregtech.loaders.recipe.handlers; -import com.google.common.base.CaseFormat; import gregtech.api.recipes.ModHandler; import gregtech.api.recipes.RecipeMaps; import gregtech.api.unification.OreDictUnifier; @@ -14,8 +13,11 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTUtility; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; +import com.google.common.base.CaseFormat; + import static gregtech.api.GTValues.*; import static gregtech.api.recipes.RecipeMaps.ASSEMBLER_RECIPES; import static gregtech.api.unification.material.Materials.Glue; @@ -32,7 +34,8 @@ public static void register() { OrePrefix.pipeLargeFluid.addProcessingHandler(PropertyKey.FLUID_PIPE, PipeRecipeHandler::processPipeLarge); OrePrefix.pipeHugeFluid.addProcessingHandler(PropertyKey.FLUID_PIPE, PipeRecipeHandler::processPipeHuge); - OrePrefix.pipeQuadrupleFluid.addProcessingHandler(PropertyKey.FLUID_PIPE, PipeRecipeHandler::processPipeQuadruple); + OrePrefix.pipeQuadrupleFluid.addProcessingHandler(PropertyKey.FLUID_PIPE, + PipeRecipeHandler::processPipeQuadruple); OrePrefix.pipeNonupleFluid.addProcessingHandler(PropertyKey.FLUID_PIPE, PipeRecipeHandler::processPipeNonuple); OrePrefix.pipeTinyItem.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processPipeTiny); @@ -41,10 +44,14 @@ public static void register() { OrePrefix.pipeLargeItem.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processPipeLarge); OrePrefix.pipeHugeItem.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processPipeHuge); - OrePrefix.pipeSmallRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processRestrictivePipe); - OrePrefix.pipeNormalRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processRestrictivePipe); - OrePrefix.pipeLargeRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processRestrictivePipe); - OrePrefix.pipeHugeRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processRestrictivePipe); + OrePrefix.pipeSmallRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, + PipeRecipeHandler::processRestrictivePipe); + OrePrefix.pipeNormalRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, + PipeRecipeHandler::processRestrictivePipe); + OrePrefix.pipeLargeRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, + PipeRecipeHandler::processRestrictivePipe); + OrePrefix.pipeHugeRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, + PipeRecipeHandler::processRestrictivePipe); } private static void processRestrictivePipe(OrePrefix pipePrefix, Material material, ItemPipeProperties property) { @@ -63,9 +70,12 @@ private static void processRestrictivePipe(OrePrefix pipePrefix, Material materi .EUt(VA[ULV]) .buildAndRegister(); - ModHandler.addShapedRecipe(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, pipePrefix.toString()) + "_" + material.toCamelCaseString(), + ModHandler.addShapedRecipe( + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, pipePrefix.toString()) + "_" + + material.toCamelCaseString(), OreDictUnifier.get(pipePrefix, material), "PR", "Rh", - 'P', new UnificationEntry(unrestrictive, material), 'R', OreDictUnifier.get(OrePrefix.ring, Materials.Iron)); + 'P', new UnificationEntry(unrestrictive, material), 'R', + OreDictUnifier.get(OrePrefix.ring, Materials.Iron)); } private static void processPipeTiny(OrePrefix pipePrefix, Material material, IMaterialProperty property) { @@ -102,8 +112,7 @@ private static void processPipeTiny(OrePrefix pipePrefix, Material material, IMa .fluidInputs(Glue.getFluid(10)) .output(pipePrefix, material, 2) .buildAndRegister(); - } - else { + } else { ModHandler.addShapedRecipe(String.format("tiny_%s_pipe", material), GTUtility.copy(2, pipeStack), " s ", "hXw", 'X', new UnificationEntry(OrePrefix.plate, material)); @@ -228,8 +237,7 @@ private static void processPipeLarge(OrePrefix pipePrefix, Material material, IM .fluidInputs(Glue.getFluid(50)) .output(pipePrefix, material) .buildAndRegister(); - } - else { + } else { ModHandler.addShapedRecipe(String.format("large_%s_pipe", material), pipeStack, "XXX", "w h", "XXX", 'X', new UnificationEntry(OrePrefix.plate, material)); @@ -270,8 +278,7 @@ private static void processPipeHuge(OrePrefix pipePrefix, Material material, IMa .fluidInputs(Glue.getFluid(100)) .output(pipePrefix, material) .buildAndRegister(); - } - else { + } else { ModHandler.addShapedRecipe(String.format("huge_%s_pipe", material), pipeStack, "XXX", "w h", "XXX", 'X', new UnificationEntry(OrePrefix.plateDouble, material)); diff --git a/src/main/java/gregtech/loaders/recipe/handlers/PolarizingRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/PolarizingRecipeHandler.java index e65e1e6b748..9a412ddf7ab 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/PolarizingRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/PolarizingRecipeHandler.java @@ -10,15 +10,17 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.UnificationEntry; + import net.minecraft.item.ItemStack; import static gregtech.api.GTValues.*; public class PolarizingRecipeHandler { - private static final OrePrefix[] POLARIZING_PREFIXES = new OrePrefix[]{ - OrePrefix.stick, OrePrefix.stickLong, OrePrefix.plate, OrePrefix.ingot, OrePrefix.plateDense, OrePrefix.rotor, - OrePrefix.bolt, OrePrefix.screw, OrePrefix.wireFine, OrePrefix.foil, OrePrefix.ring}; + private static final OrePrefix[] POLARIZING_PREFIXES = new OrePrefix[] { + OrePrefix.stick, OrePrefix.stickLong, OrePrefix.plate, OrePrefix.ingot, OrePrefix.plateDense, + OrePrefix.rotor, + OrePrefix.bolt, OrePrefix.screw, OrePrefix.wireFine, OrePrefix.foil, OrePrefix.ring }; public static void register() { for (OrePrefix orePrefix : POLARIZING_PREFIXES) { @@ -31,15 +33,16 @@ public static void processPolarizing(OrePrefix polarizingPrefix, Material materi if (magneticMaterial != null && polarizingPrefix.doGenerateItem(magneticMaterial)) { ItemStack magneticStack = OreDictUnifier.get(polarizingPrefix, magneticMaterial); - RecipeMaps.POLARIZER_RECIPES.recipeBuilder() //polarizing + RecipeMaps.POLARIZER_RECIPES.recipeBuilder() // polarizing .input(polarizingPrefix, material) .outputs(magneticStack) - .duration((int) ((int) material.getMass() * polarizingPrefix.getMaterialAmount(material) / GTValues.M)) + .duration((int) ((int) material.getMass() * polarizingPrefix.getMaterialAmount(material) / + GTValues.M)) .EUt(getVoltageMultiplier(material)) .buildAndRegister(); ModHandler.addSmeltingRecipe(new UnificationEntry(polarizingPrefix, magneticMaterial), - OreDictUnifier.get(polarizingPrefix, material)); //de-magnetizing + OreDictUnifier.get(polarizingPrefix, material)); // de-magnetizing } } diff --git a/src/main/java/gregtech/loaders/recipe/handlers/RecyclingRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/RecyclingRecipeHandler.java index fa3ea10db1c..fcdc4fb2084 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/RecyclingRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/RecyclingRecipeHandler.java @@ -27,14 +27,13 @@ public class RecyclingRecipeHandler { (Predicate) orePrefix -> orePrefix.name().startsWith("gem"), (Predicate) orePrefix -> orePrefix.name().startsWith("cableGt"), (Predicate) orePrefix -> orePrefix.name().startsWith("wireGt"), - (Predicate) orePrefix -> orePrefix.name().startsWith("pipe") - ); + (Predicate) orePrefix -> orePrefix.name().startsWith("pipe")); private static final List IGNORE_ARC_SMELTING = Arrays.asList( OrePrefix.ingot, OrePrefix.gem, OrePrefix.nugget); public static void register() { - //registers universal maceration recipes for specified ore prefixes + // registers universal maceration recipes for specified ore prefixes for (OrePrefix orePrefix : OrePrefix.values()) { if (CRUSHING_PREFIXES.stream().anyMatch(object -> { if (object instanceof OrePrefix) @@ -50,11 +49,12 @@ public static void processCrushing(OrePrefix thingPrefix, Material material, Dus ArrayList materialStacks = new ArrayList<>(); materialStacks.add(new MaterialStack(material, thingPrefix.getMaterialAmount(material))); materialStacks.addAll(thingPrefix.secondaryMaterials); - //only ignore arc smelting for blacklisted prefixes if yielded material is the same as input material - //if arc smelting gives different material, allow it - boolean ignoreArcSmelting = IGNORE_ARC_SMELTING.contains(thingPrefix) && !( - material.hasProperty(PropertyKey.INGOT) - && material.getProperty(PropertyKey.INGOT).getArcSmeltInto() != material); - RecyclingRecipes.registerRecyclingRecipes(OreDictUnifier.get(thingPrefix, material), materialStacks, ignoreArcSmelting, thingPrefix); + // only ignore arc smelting for blacklisted prefixes if yielded material is the same as input material + // if arc smelting gives different material, allow it + boolean ignoreArcSmelting = IGNORE_ARC_SMELTING.contains(thingPrefix) && + !(material.hasProperty(PropertyKey.INGOT) && + material.getProperty(PropertyKey.INGOT).getArcSmeltInto() != material); + RecyclingRecipes.registerRecyclingRecipes(OreDictUnifier.get(thingPrefix, material), materialStacks, + ignoreArcSmelting, thingPrefix); } } diff --git a/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java index 132062ea8da..1d5d8c57d2b 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java @@ -1,6 +1,5 @@ package gregtech.loaders.recipe.handlers; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IElectricItem; @@ -19,17 +18,21 @@ import gregtech.common.crafting.ToolHeadReplaceRecipe; import gregtech.common.items.MetaItems; import gregtech.common.items.ToolItems; + import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.ForgeRegistries; -import javax.annotation.Nonnull; +import com.google.common.collect.ImmutableList; + import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; + import static gregtech.api.GTValues.*; import static gregtech.api.recipes.RecipeMaps.LATHE_RECIPES; import static gregtech.api.unification.material.info.MaterialFlags.*; @@ -67,12 +70,16 @@ public static void initializeMetaItems() { powerUnitItems.put(GTValues.IV, MetaItems.POWER_UNIT_IV); batteryItems.put(GTValues.ULV, Collections.singletonList(MetaItems.BATTERY_ULV_TANTALUM)); - batteryItems.put(GTValues.LV, ImmutableList.of(MetaItems.BATTERY_LV_LITHIUM, MetaItems.BATTERY_LV_CADMIUM, MetaItems.BATTERY_LV_SODIUM)); - batteryItems.put(GTValues.MV, ImmutableList.of(MetaItems.BATTERY_MV_LITHIUM, MetaItems.BATTERY_MV_CADMIUM, MetaItems.BATTERY_MV_SODIUM)); - batteryItems.put(GTValues.HV, ImmutableList.of(MetaItems.BATTERY_HV_LITHIUM, MetaItems.BATTERY_HV_CADMIUM, MetaItems.BATTERY_HV_SODIUM, MetaItems.ENERGIUM_CRYSTAL)); + batteryItems.put(GTValues.LV, ImmutableList.of(MetaItems.BATTERY_LV_LITHIUM, MetaItems.BATTERY_LV_CADMIUM, + MetaItems.BATTERY_LV_SODIUM)); + batteryItems.put(GTValues.MV, ImmutableList.of(MetaItems.BATTERY_MV_LITHIUM, MetaItems.BATTERY_MV_CADMIUM, + MetaItems.BATTERY_MV_SODIUM)); + batteryItems.put(GTValues.HV, ImmutableList.of(MetaItems.BATTERY_HV_LITHIUM, MetaItems.BATTERY_HV_CADMIUM, + MetaItems.BATTERY_HV_SODIUM, MetaItems.ENERGIUM_CRYSTAL)); batteryItems.put(GTValues.EV, ImmutableList.of(MetaItems.BATTERY_EV_VANADIUM, MetaItems.LAPOTRON_CRYSTAL)); batteryItems.put(GTValues.IV, ImmutableList.of(MetaItems.BATTERY_IV_VANADIUM, MetaItems.ENERGY_LAPOTRONIC_ORB)); - batteryItems.put(GTValues.LuV, ImmutableList.of(MetaItems.BATTERY_LUV_VANADIUM, MetaItems.ENERGY_LAPOTRONIC_ORB_CLUSTER)); + batteryItems.put(GTValues.LuV, + ImmutableList.of(MetaItems.BATTERY_LUV_VANADIUM, MetaItems.ENERGY_LAPOTRONIC_ORB_CLUSTER)); batteryItems.put(GTValues.ZPM, ImmutableList.of(MetaItems.BATTERY_ZPM_NAQUADRIA, MetaItems.ENERGY_MODULE)); batteryItems.put(GTValues.UV, ImmutableList.of(MetaItems.BATTERY_UV_NAQUADRIA, MetaItems.ENERGY_CLUSTER)); @@ -88,7 +95,8 @@ public static void initializeMetaItems() { ToolHeadReplaceRecipe.setToolHeadForTool(OrePrefix.toolHeadBuzzSaw, ToolItems.BUZZSAW); ToolHeadReplaceRecipe.setToolHeadForTool(OrePrefix.toolHeadScrewdriver, ToolItems.SCREWDRIVER_LV); - ForgeRegistries.RECIPES.register(new ToolHeadReplaceRecipe().setRegistryName(new ResourceLocation(MODID, "replacetoolhead"))); + ForgeRegistries.RECIPES + .register(new ToolHeadReplaceRecipe().setRegistryName(new ResourceLocation(MODID, "replacetoolhead"))); } public static void registerPowerUnitRecipes() { @@ -96,9 +104,11 @@ public static void registerPowerUnitRecipes() { List tieredBatteryItems = batteryItems.get(tier); for (MetaValueItem batteryItem : tieredBatteryItems) { ItemStack batteryStack = batteryItem.getStackForm(); - long maxCharge = batteryStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null).getMaxCharge(); + long maxCharge = batteryStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null) + .getMaxCharge(); ItemStack powerUnitStack = powerUnitItems.get(tier).getMaxChargeOverrideStack(maxCharge); - String recipeName = String.format("%s_%s", powerUnitItems.get(tier).unlocalizedName, batteryItem.unlocalizedName); + String recipeName = String.format("%s_%s", powerUnitItems.get(tier).unlocalizedName, + batteryItem.unlocalizedName); ModHandler.addShapedEnergyTransferRecipe(recipeName, powerUnitStack, Ingredient.fromStacks(batteryStack), true, false, @@ -115,7 +125,8 @@ public static void registerPowerUnitRecipes() { private static void processTool(OrePrefix prefix, Material material, ToolProperty property) { UnificationEntry stick = new UnificationEntry(OrePrefix.stick, Materials.Wood); UnificationEntry plate = new UnificationEntry(OrePrefix.plate, material); - UnificationEntry ingot = new UnificationEntry(material.hasProperty(GEM) ? OrePrefix.gem : OrePrefix.ingot, material); + UnificationEntry ingot = new UnificationEntry(material.hasProperty(GEM) ? OrePrefix.gem : OrePrefix.ingot, + material); if (material.hasFlag(GENERATE_PLATE)) { addToolRecipe(material, ToolItems.MINING_HAMMER, true, @@ -234,7 +245,8 @@ private static void processElectricTool(OrePrefix prefix, Material material, Too 'X', plate, 'S', steelPlate); - addElectricToolRecipe(toolPrefix, material, new IGTTool[]{ToolItems.DRILL_LV, ToolItems.DRILL_MV, ToolItems.DRILL_HV, ToolItems.DRILL_EV, ToolItems.DRILL_IV}); + addElectricToolRecipe(toolPrefix, material, new IGTTool[] { ToolItems.DRILL_LV, ToolItems.DRILL_MV, + ToolItems.DRILL_HV, ToolItems.DRILL_EV, ToolItems.DRILL_IV }); // chainsaw toolPrefix = OrePrefix.toolHeadChainsaw; @@ -245,11 +257,12 @@ private static void processElectricTool(OrePrefix prefix, Material material, Too 'S', steelPlate, 'R', steelRing); - addElectricToolRecipe(toolPrefix, material, new IGTTool[]{ToolItems.CHAINSAW_LV}); + addElectricToolRecipe(toolPrefix, material, new IGTTool[] { ToolItems.CHAINSAW_LV }); // wrench toolPrefix = OrePrefix.toolHeadWrench; - addElectricToolRecipe(toolPrefix, material, new IGTTool[]{ToolItems.WRENCH_LV, ToolItems.WRENCH_HV, ToolItems.WRENCH_IV}); + addElectricToolRecipe(toolPrefix, material, + new IGTTool[] { ToolItems.WRENCH_LV, ToolItems.WRENCH_HV, ToolItems.WRENCH_IV }); ModHandler.addShapedRecipe(String.format("wrench_head_%s", material), OreDictUnifier.get(toolPrefix, material), @@ -260,7 +273,7 @@ private static void processElectricTool(OrePrefix prefix, Material material, Too // buzzsaw toolPrefix = OrePrefix.toolHeadBuzzSaw; - addElectricToolRecipe(toolPrefix, material, new IGTTool[]{ToolItems.BUZZSAW}); + addElectricToolRecipe(toolPrefix, material, new IGTTool[] { ToolItems.BUZZSAW }); ModHandler.addShapedRecipe(String.format("buzzsaw_blade_%s", material), OreDictUnifier.get(toolPrefix, material), @@ -280,7 +293,7 @@ private static void processElectricTool(OrePrefix prefix, Material material, Too // screwdriver if (material.hasFlag(GENERATE_LONG_ROD)) { toolPrefix = OrePrefix.toolHeadScrewdriver; - addElectricToolRecipe(toolPrefix, material, new IGTTool[]{ToolItems.SCREWDRIVER_LV}); + addElectricToolRecipe(toolPrefix, material, new IGTTool[] { ToolItems.SCREWDRIVER_LV }); ModHandler.addShapedRecipe(String.format("screwdriver_tip_%s", material), OreDictUnifier.get(toolPrefix, material), @@ -304,7 +317,8 @@ public static void addElectricToolRecipe(OrePrefix toolHead, Material material, } } - public static void addToolRecipe(@Nonnull Material material, @Nonnull IGTTool tool, boolean mirrored, Object... recipe) { + public static void addToolRecipe(@Nonnull Material material, @Nonnull IGTTool tool, boolean mirrored, + Object... recipe) { if (mirrored) { ModHandler.addMirroredShapedRecipe(String.format("%s_%s", tool.getToolId(), material), tool.get(material), recipe); @@ -362,7 +376,7 @@ private static void registerFlintToolRecipes() { } private static void registerMortarRecipes() { - for (Material material : new Material[]{ + for (Material material : new Material[] { Materials.Bronze, Materials.Iron, Materials.Invar, Materials.Steel, Materials.DamascusSteel, Materials.CobaltBrass, Materials.WroughtIron }) { @@ -374,7 +388,7 @@ private static void registerMortarRecipes() { } private static void registerSoftToolRecipes() { - final Material[] softMaterials = new Material[]{ + final Material[] softMaterials = new Material[] { Materials.Wood, Materials.Rubber, Materials.Polyethylene, Materials.Polytetrafluoroethylene, Materials.Polybenzimidazole }; @@ -408,7 +422,8 @@ private static void registerSoftToolRecipes() { private static void registerElectricRecipes() { for (MetaValueItem batteryItem : batteryItems.get(LV)) { - ModHandler.addShapedEnergyTransferRecipe("prospector_lv_" + batteryItem.unlocalizedName, MetaItems.PROSPECTOR_LV.getStackForm(), + ModHandler.addShapedEnergyTransferRecipe("prospector_lv_" + batteryItem.unlocalizedName, + MetaItems.PROSPECTOR_LV.getStackForm(), batteryItem::isItemEqual, true, true, "EPS", "CDC", "PBP", 'E', MetaItems.EMITTER_LV.getStackForm(), @@ -418,7 +433,8 @@ private static void registerElectricRecipes() { 'C', new UnificationEntry(OrePrefix.circuit, MarkerMaterials.Tier.LV), 'B', batteryItem.getStackForm()); - ModHandler.addShapedEnergyTransferRecipe("magnet_lv_" + batteryItem.unlocalizedName, MetaItems.ITEM_MAGNET_LV.getStackForm(), + ModHandler.addShapedEnergyTransferRecipe("magnet_lv_" + batteryItem.unlocalizedName, + MetaItems.ITEM_MAGNET_LV.getStackForm(), batteryItem::isItemEqual, true, true, "MwM", "MBM", "CPC", 'M', new UnificationEntry(OrePrefix.stick, Materials.SteelMagnetic), @@ -428,7 +444,8 @@ private static void registerElectricRecipes() { } for (MetaValueItem batteryItem : batteryItems.get(MV)) { - ModHandler.addShapedEnergyTransferRecipe("tricorder_" + batteryItem.unlocalizedName, MetaItems.TRICORDER_SCANNER.getStackForm(), + ModHandler.addShapedEnergyTransferRecipe("tricorder_" + batteryItem.unlocalizedName, + MetaItems.TRICORDER_SCANNER.getStackForm(), batteryItem::isItemEqual, true, true, "EPS", "CDC", "PBP", 'E', MetaItems.EMITTER_MV.getStackForm(), @@ -440,7 +457,8 @@ private static void registerElectricRecipes() { } for (MetaValueItem batteryItem : batteryItems.get(HV)) { - ModHandler.addShapedEnergyTransferRecipe("prospector_hv_" + batteryItem.unlocalizedName, MetaItems.PROSPECTOR_HV.getStackForm(), + ModHandler.addShapedEnergyTransferRecipe("prospector_hv_" + batteryItem.unlocalizedName, + MetaItems.PROSPECTOR_HV.getStackForm(), batteryItem::isItemEqual, true, true, "EPS", "CDC", "PBP", 'E', MetaItems.EMITTER_HV.getStackForm(), @@ -450,7 +468,8 @@ private static void registerElectricRecipes() { 'C', new UnificationEntry(OrePrefix.circuit, MarkerMaterials.Tier.HV), 'B', batteryItem.getStackForm()); - ModHandler.addShapedEnergyTransferRecipe("magnet_hv_" + batteryItem.unlocalizedName, MetaItems.ITEM_MAGNET_HV.getStackForm(), + ModHandler.addShapedEnergyTransferRecipe("magnet_hv_" + batteryItem.unlocalizedName, + MetaItems.ITEM_MAGNET_HV.getStackForm(), batteryItem::isItemEqual, true, true, "MwM", "MBM", "CPC", 'M', new UnificationEntry(OrePrefix.stick, Materials.NeodymiumMagnetic), @@ -460,7 +479,8 @@ private static void registerElectricRecipes() { } for (MetaValueItem batteryItem : batteryItems.get(LuV)) { - ModHandler.addShapedEnergyTransferRecipe("prospector_luv_" + batteryItem.unlocalizedName, MetaItems.PROSPECTOR_LUV.getStackForm(), + ModHandler.addShapedEnergyTransferRecipe("prospector_luv_" + batteryItem.unlocalizedName, + MetaItems.PROSPECTOR_LUV.getStackForm(), batteryItem::isItemEqual, true, true, "EPS", "CDC", "PBP", 'E', MetaItems.EMITTER_LuV.getStackForm(), diff --git a/src/main/java/gregtech/loaders/recipe/handlers/WireCombiningHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/WireCombiningHandler.java index fad7c199b3d..388558a8d2d 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/WireCombiningHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/WireCombiningHandler.java @@ -1,6 +1,5 @@ package gregtech.loaders.recipe.handlers; -import com.google.common.collect.ImmutableMap; import gregtech.api.GTValues; import gregtech.api.recipes.ModHandler; import gregtech.api.unification.OreDictUnifier; @@ -10,6 +9,8 @@ import gregtech.api.unification.material.properties.WireProperties; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.UnificationEntry; + +import com.google.common.collect.ImmutableMap; import org.apache.commons.lang3.ArrayUtils; import java.util.Map; @@ -19,7 +20,7 @@ public class WireCombiningHandler { - private static final OrePrefix[] WIRE_DOUBLING_ORDER = new OrePrefix[]{ + private static final OrePrefix[] WIRE_DOUBLING_ORDER = new OrePrefix[] { wireGtSingle, wireGtDouble, wireGtQuadruple, wireGtOctal, wireGtHex }; @@ -28,11 +29,9 @@ public class WireCombiningHandler { cableGtDouble, wireGtDouble, cableGtQuadruple, wireGtQuadruple, cableGtOctal, wireGtOctal, - cableGtHex, wireGtHex - ); + cableGtHex, wireGtHex); public static void register() { - // Generate Wire Packer/Unpacker recipes TODO Move into generateWireCombining? wireGtSingle.addProcessingHandler(PropertyKey.WIRE, WireCombiningHandler::processWireCompression); diff --git a/src/main/java/gregtech/loaders/recipe/handlers/WireRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/WireRecipeHandler.java index 851b221312f..129150429d5 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/WireRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/WireRecipeHandler.java @@ -1,6 +1,5 @@ package gregtech.loaders.recipe.handlers; -import com.google.common.collect.ImmutableMap; import gregtech.api.GTValues; import gregtech.api.recipes.ModHandler; import gregtech.api.recipes.builders.AssemblerRecipeBuilder; @@ -12,6 +11,8 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTUtility; +import com.google.common.collect.ImmutableMap; + import java.util.Map; import static gregtech.api.GTValues.*; @@ -29,10 +30,10 @@ * - Rubber: This can be used for any cable EV-tier or lower. After that it is unavailable. * * - Silicone Rubber: This can be used for any cable tier, saving the amount of fluid needed. However, at IV, - * it will require a Foil of the cable material as well, making it undesirable. + * it will require a Foil of the cable material as well, making it undesirable. * * - Styrene-Butadiene Rubber (SBR): This can be used for any cable tier, and is the most optimal cable-covering - * fluid available. + * fluid available. * * Extra Materials for Cable Covering: * - Polyphenylene Sulfide (PPS): At LuV, this foil is required to cover cables. Lower tiers will not use it. @@ -46,11 +47,9 @@ public class WireRecipeHandler { cableGtDouble, 1, cableGtQuadruple, 2, cableGtOctal, 3, - cableGtHex, 5 - ); + cableGtHex, 5); public static void register() { - // Generate 1x Wire creation recipes (Wiremill, Extruder, Wire Cutters) wireGtSingle.addProcessingHandler(PropertyKey.WIRE, WireRecipeHandler::processWireSingle); @@ -62,10 +61,11 @@ public static void register() { wireGtHex.addProcessingHandler(PropertyKey.WIRE, WireRecipeHandler::generateCableCovering); } + private static final OrePrefix[] wireSizes = { wireGtDouble, wireGtQuadruple, wireGtOctal, wireGtHex }; - private static final OrePrefix[] wireSizes = {wireGtDouble, wireGtQuadruple, wireGtOctal, wireGtHex}; public static void processWireSingle(OrePrefix wirePrefix, Material material, WireProperties property) { - OrePrefix prefix = material.hasProperty(PropertyKey.INGOT) ? ingot : material.hasProperty(PropertyKey.GEM) ? gem : dust; + OrePrefix prefix = material.hasProperty(PropertyKey.INGOT) ? ingot : + material.hasProperty(PropertyKey.GEM) ? gem : dust; EXTRUDER_RECIPES.recipeBuilder() .input(prefix, material) @@ -102,7 +102,6 @@ public static void processWireSingle(OrePrefix wirePrefix, Material material, Wi } public static void generateCableCovering(OrePrefix wirePrefix, Material material, WireProperties property) { - // Superconductors have no Cables, so exit early if (property.isSuperconductor()) return; @@ -166,7 +165,8 @@ public static void generateCableCovering(OrePrefix wirePrefix, Material material .buildAndRegister(); } - private static void generateManualRecipe(OrePrefix wirePrefix, Material material, OrePrefix cablePrefix, int cableAmount) { + private static void generateManualRecipe(OrePrefix wirePrefix, Material material, OrePrefix cablePrefix, + int cableAmount) { int insulationAmount = INSULATION_AMOUNT.get(cablePrefix); Object[] ingredients = new Object[insulationAmount + 1]; ingredients[0] = new UnificationEntry(wirePrefix, material); @@ -175,8 +175,7 @@ private static void generateManualRecipe(OrePrefix wirePrefix, Material material } ModHandler.addShapelessRecipe(String.format("%s_cable_%d", material, cableAmount), OreDictUnifier.get(cablePrefix, material), - ingredients - ); + ingredients); PACKER_RECIPES.recipeBuilder() .input(wirePrefix, material) diff --git a/src/main/java/gregtech/modules/BaseGregTechModule.java b/src/main/java/gregtech/modules/BaseGregTechModule.java index 139be22a2eb..ed4244abcbf 100644 --- a/src/main/java/gregtech/modules/BaseGregTechModule.java +++ b/src/main/java/gregtech/modules/BaseGregTechModule.java @@ -2,12 +2,14 @@ import gregtech.api.modules.IGregTechModule; import gregtech.api.util.GTUtility; + import net.minecraft.util.ResourceLocation; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.Set; +import javax.annotation.Nonnull; + public abstract class BaseGregTechModule implements IGregTechModule { @Nonnull diff --git a/src/main/java/gregtech/modules/GregTechModules.java b/src/main/java/gregtech/modules/GregTechModules.java index 7a5ede9668a..9c07e90db26 100644 --- a/src/main/java/gregtech/modules/GregTechModules.java +++ b/src/main/java/gregtech/modules/GregTechModules.java @@ -11,9 +11,9 @@ public class GregTechModules implements IModuleContainer { // Integration modules public static final String MODULE_JEI = "jei_integration"; public static final String MODULE_TOP = "top_integration"; - public static final String MODULE_CT = "ct_integration"; + public static final String MODULE_CT = "ct_integration"; public static final String MODULE_GRS = "grs_integration"; - public static final String MODULE_OC = "oc_integration"; + public static final String MODULE_OC = "oc_integration"; public static final String MODULE_HWYLA = "hwyla_integration"; public static final String MODULE_BAUBLES = "baubles_integration"; public static final String MODULE_FR = "fr_integration"; diff --git a/src/main/java/gregtech/modules/ModuleManager.java b/src/main/java/gregtech/modules/ModuleManager.java index 8cf46d333ef..f5e8c4dc310 100644 --- a/src/main/java/gregtech/modules/ModuleManager.java +++ b/src/main/java/gregtech/modules/ModuleManager.java @@ -1,9 +1,8 @@ package gregtech.modules; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.modules.*; + import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; @@ -11,6 +10,9 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.discovery.ASMDataTable; import net.minecraftforge.fml.common.event.*; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -35,8 +37,7 @@ public class ModuleManager implements IModuleManager { private final Logger logger = LogManager.getLogger("GregTech Module Loader"); private Configuration config; - private ModuleManager() { - } + private ModuleManager() {} public static ModuleManager getInstance() { return INSTANCE; @@ -50,7 +51,8 @@ public boolean isModuleEnabled(ResourceLocation id) { public boolean isModuleEnabled(IGregTechModule module) { GregTechModule annotation = module.getClass().getAnnotation(GregTechModule.class); String comment = getComment(module); - Property prop = getConfiguration().get(MODULE_CFG_CATEGORY_NAME, annotation.containerID() + ":" + annotation.moduleID(), true, comment); + Property prop = getConfiguration().get(MODULE_CFG_CATEGORY_NAME, + annotation.containerID() + ":" + annotation.moduleID(), true, comment); return prop.getBoolean(); } @@ -80,13 +82,13 @@ public void registerContainer(IModuleContainer container) { } public void setup(ASMDataTable asmDataTable, File configDirectory) { - // find and register all containers registered with the @ModuleContainer annotation, then sort them by container name + // find and register all containers registered with the @ModuleContainer annotation, then sort them by container + // name discoverContainers(asmDataTable); containers = containers.entrySet().stream() .sorted(Map.Entry.comparingByKey()) .collect(Collectors.toMap( - Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a, LinkedHashMap::new - )); + Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a, LinkedHashMap::new)); currentStage = ModuleStage.M_SETUP; configFolder = new File(configDirectory, GTValues.MODID); @@ -265,7 +267,8 @@ private void configureModules(Map> modules) { GregTechModule annotation = module.getClass().getAnnotation(GregTechModule.class); String moduleID = annotation.moduleID(); toLoad.remove(new ResourceLocation(moduleID)); - logger.info("Module {} is missing at least one of module dependencies: {}, skipping loading...", moduleID, dependencies); + logger.info("Module {} is missing at least one of module dependencies: {}, skipping loading...", + moduleID, dependencies); } } } while (changed); @@ -334,7 +337,8 @@ private List getInstances(ASMDataTable table) { logger.error("Could not initialize module " + moduleID, e); } } else { - logger.info("Module {} is missing at least one of mod dependencies: {}, skipping loading...", moduleID, modDependencies); + logger.info("Module {} is missing at least one of mod dependencies: {}, skipping loading...", moduleID, + modDependencies); } } return instances.stream().sorted((m1, m2) -> { diff --git a/src/main/java/gregtech/tools/ToolsModule.java b/src/main/java/gregtech/tools/ToolsModule.java index d625768caec..8114b4c4628 100644 --- a/src/main/java/gregtech/tools/ToolsModule.java +++ b/src/main/java/gregtech/tools/ToolsModule.java @@ -7,23 +7,25 @@ import gregtech.modules.GregTechModules; import gregtech.tools.enchants.EnchantmentEnderDamage; import gregtech.tools.enchants.EnchantmentHardHammer; + import net.minecraft.enchantment.Enchantment; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + @GregTechModule( - moduleID = GregTechModules.MODULE_TOOLS, - containerID = GTValues.MODID, - name = "GregTech Tools", - description = "GregTech Tools Module. Cannot be disabled for now." -) + moduleID = GregTechModules.MODULE_TOOLS, + containerID = GTValues.MODID, + name = "GregTech Tools", + description = "GregTech Tools Module. Cannot be disabled for now.") public class ToolsModule extends BaseGregTechModule { public static final Logger logger = LogManager.getLogger("GregTech Tools"); diff --git a/src/main/java/gregtech/tools/enchants/EnchantmentEnderDamage.java b/src/main/java/gregtech/tools/enchants/EnchantmentEnderDamage.java index d225b74f40b..e1054198f71 100644 --- a/src/main/java/gregtech/tools/enchants/EnchantmentEnderDamage.java +++ b/src/main/java/gregtech/tools/enchants/EnchantmentEnderDamage.java @@ -1,6 +1,7 @@ package gregtech.tools.enchants; import gregtech.api.util.GTUtility; + import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.entity.Entity; @@ -20,7 +21,7 @@ public class EnchantmentEnderDamage extends Enchantment { public static final EnchantmentEnderDamage INSTANCE = new EnchantmentEnderDamage(); private EnchantmentEnderDamage() { - super(Rarity.UNCOMMON, EnumEnchantmentType.WEAPON, new EntityEquipmentSlot[]{EntityEquipmentSlot.MAINHAND}); + super(Rarity.UNCOMMON, EnumEnchantmentType.WEAPON, new EntityEquipmentSlot[] { EntityEquipmentSlot.MAINHAND }); this.setRegistryName(GTUtility.gregtechId("disjunction")); this.setName("disjunction"); } @@ -43,9 +44,13 @@ public int getMaxLevel() { @Override public void onEntityDamaged(@Nonnull EntityLivingBase user, @Nonnull Entity target, int level) { String entityName = EntityList.getEntityString(target); - if (target instanceof EntityLivingBase && (target instanceof EntityEnderman || target instanceof EntityDragon || target instanceof EntityEndermite || (entityName != null && entityName.toLowerCase().contains("ender")))) { - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, level * 200, Math.max(1, (5 * level) / 7))); - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, level * 200, Math.max(1, (5 * level) / 7))); + if (target instanceof EntityLivingBase && (target instanceof EntityEnderman || target instanceof EntityDragon || + target instanceof EntityEndermite || + (entityName != null && entityName.toLowerCase().contains("ender")))) { + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, level * 200, Math.max(1, (5 * level) / 7))); + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, level * 200, Math.max(1, (5 * level) / 7))); } } } diff --git a/src/main/java/gregtech/tools/enchants/EnchantmentHardHammer.java b/src/main/java/gregtech/tools/enchants/EnchantmentHardHammer.java index 4539af8950a..b2e7806d42c 100644 --- a/src/main/java/gregtech/tools/enchants/EnchantmentHardHammer.java +++ b/src/main/java/gregtech/tools/enchants/EnchantmentHardHammer.java @@ -2,6 +2,7 @@ import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.util.GTUtility; + import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.init.Enchantments; @@ -15,7 +16,7 @@ public class EnchantmentHardHammer extends Enchantment { public static final EnchantmentHardHammer INSTANCE = new EnchantmentHardHammer(); private EnchantmentHardHammer() { - super(Rarity.UNCOMMON, EnumEnchantmentType.DIGGER, new EntityEquipmentSlot[]{EntityEquipmentSlot.MAINHAND}); + super(Rarity.UNCOMMON, EnumEnchantmentType.DIGGER, new EntityEquipmentSlot[] { EntityEquipmentSlot.MAINHAND }); this.setRegistryName(GTUtility.gregtechId("hard_hammer")); this.setName("hard_hammer"); } @@ -36,9 +37,9 @@ public int getMaxLevel() { @Override public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack) { - return super.canApplyAtEnchantingTable(stack) - && stack.getItem().getToolClasses(stack).contains(ToolClasses.PICKAXE) - && !stack.getItem().getToolClasses(stack).contains(ToolClasses.HARD_HAMMER); + return super.canApplyAtEnchantingTable(stack) && + stack.getItem().getToolClasses(stack).contains(ToolClasses.PICKAXE) && + !stack.getItem().getToolClasses(stack).contains(ToolClasses.HARD_HAMMER); } @Override @@ -46,4 +47,3 @@ protected boolean canApplyTogether(@Nonnull Enchantment ench) { return super.canApplyTogether(ench) && ench != Enchantments.SILK_TOUCH && ench != Enchantments.FORTUNE; } } - diff --git a/src/test/java/gregtech/Bootstrap.java b/src/test/java/gregtech/Bootstrap.java index 03484fbc012..6993ca15851 100644 --- a/src/test/java/gregtech/Bootstrap.java +++ b/src/test/java/gregtech/Bootstrap.java @@ -10,6 +10,7 @@ import gregtech.common.items.MetaItems; import gregtech.core.unification.material.internal.MaterialRegistryManager; import gregtech.modules.ModuleManager; + import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.Locale; import net.minecraft.network.INetHandler; @@ -48,7 +49,8 @@ public static void perform() { deobfuscatedEnvironment.setAccessible(true); deobfuscatedEnvironment.setBoolean(null, true); - Method setLocale = I18n.class.getDeclaredMethod("setLocale", Locale.class); // No need to care about obfuscation + Method setLocale = I18n.class.getDeclaredMethod("setLocale", Locale.class); // No need to care about + // obfuscation setLocale.setAccessible(true); setLocale.invoke(null, new Locale()); @@ -168,7 +170,8 @@ public INetHandler getClientPlayHandler() { } @Override - public void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set channelSet, String channel, Side side) { + public void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set channelSet, + String channel, Side side) { throw new UnsupportedOperationException(); } diff --git a/src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java b/src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java index ecd26210a42..68ae9384de7 100644 --- a/src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java +++ b/src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java @@ -10,9 +10,11 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.world.DummyWorld; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; + import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -28,7 +30,6 @@ public static void bootstrap() { @Test public void trySearchNewRecipe() { - World world = DummyWorld.INSTANCE; // Create an empty recipe map to work with @@ -40,13 +41,12 @@ public void trySearchNewRecipe() { new SimpleRecipeBuilder().EUt(30), false); - MetaTileEntity at = - MetaTileEntities.registerMetaTileEntity(190, - new SimpleMachineMetaTileEntity( - GTUtility.gregtechId("chemical_reactor.lv"), - map, - null, - 1, false)); + MetaTileEntity at = MetaTileEntities.registerMetaTileEntity(190, + new SimpleMachineMetaTileEntity( + GTUtility.gregtechId("chemical_reactor.lv"), + map, + null, + 1, false)); MetaTileEntity atte = new MetaTileEntityHolder().setMetaTileEntity(at); ((MetaTileEntityHolder) atte.getHolder()).setWorld(world); map.recipeBuilder() @@ -56,6 +56,7 @@ public void trySearchNewRecipe() { .buildAndRegister(); AbstractRecipeLogic arl = new AbstractRecipeLogic(atte, map) { + @Override protected long getEnergyInputPerSecond() { return Long.MAX_VALUE; diff --git a/src/test/java/gregtech/api/capability/impl/EnergyContainerListTest.java b/src/test/java/gregtech/api/capability/impl/EnergyContainerListTest.java index 546e56c8d3d..51302795940 100644 --- a/src/test/java/gregtech/api/capability/impl/EnergyContainerListTest.java +++ b/src/test/java/gregtech/api/capability/impl/EnergyContainerListTest.java @@ -4,15 +4,18 @@ import gregtech.api.gui.ModularUI; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; + import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Test; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + import static gregtech.api.GTValues.*; import static org.hamcrest.CoreMatchers.is; @@ -21,6 +24,7 @@ public class EnergyContainerListTest { @Nonnull private static MetaTileEntity createDummyMTE() { return new MetaTileEntity(new ResourceLocation("")) { + @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return null; diff --git a/src/test/java/gregtech/api/capability/impl/FluidTankListTest.java b/src/test/java/gregtech/api/capability/impl/FluidTankListTest.java index ed636cfa186..2f0dcb3b8c5 100644 --- a/src/test/java/gregtech/api/capability/impl/FluidTankListTest.java +++ b/src/test/java/gregtech/api/capability/impl/FluidTankListTest.java @@ -4,18 +4,21 @@ import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.unification.material.Materials; import gregtech.api.util.OverlayedFluidHandler; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidTank; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static net.minecraftforge.fluids.FluidRegistry.LAVA; import static net.minecraftforge.fluids.FluidRegistry.WATER; @@ -30,61 +33,61 @@ public static void bootstrap() { public void testSimpleFills() { new FluidHandlerTester(false, new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 1000) - .expectContents(new FluidStack(WATER, 1000)); + .beginSimulation() + .fill(WATER, 1000) + .expectContents(new FluidStack(WATER, 1000)); new FluidHandlerTester(false, new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 333)) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 666)) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 999)) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 1000)); + .beginSimulation() + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 333)) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 666)) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 999)) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 1000)); new FluidHandlerTester(false, new FluidTank(1000), new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 333), null) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 666), null) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 999), null) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 1000), null); + .beginSimulation() + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 333), null) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 666), null) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 999), null) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 1000), null); new FluidHandlerTester(true, new FluidTank(1000), new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 333), null) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 666), null) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 999), null) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 1000), new FluidStack(WATER, 332)); + .beginSimulation() + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 333), null) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 666), null) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 999), null) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 1000), new FluidStack(WATER, 332)); new FluidHandlerTester(false, new FluidTank(1000), new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 1500) - .expectContents(new FluidStack(WATER, 1000), null); + .beginSimulation() + .fill(WATER, 1500) + .expectContents(new FluidStack(WATER, 1000), null); new FluidHandlerTester(true, new FluidTank(1000), new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 1500) - .expectContents(new FluidStack(WATER, 1000), new FluidStack(WATER, 500)); + .beginSimulation() + .fill(WATER, 1500) + .expectContents(new FluidStack(WATER, 1000), new FluidStack(WATER, 500)); } @Test @@ -93,60 +96,60 @@ public void testMultipleFluidFills() { new FluidTank(1000), new FluidTank(1000), new FluidTank(1000)) - .fill(WATER, 800) - .fill(WATER, 800) - .fill(LAVA, 800) - .expectContents( - new FluidStack(WATER, 1000), - new FluidStack(LAVA, 800), - null) - .drain(WATER, 1000) - .expectContents( - null, - new FluidStack(LAVA, 800), - null) - .fill(LAVA, 800) - .expectContents( - null, - new FluidStack(LAVA, 1000), - null) - .fill(LAVA, 800) - .expectContents( - null, - new FluidStack(LAVA, 1000), - null); + .fill(WATER, 800) + .fill(WATER, 800) + .fill(LAVA, 800) + .expectContents( + new FluidStack(WATER, 1000), + new FluidStack(LAVA, 800), + null) + .drain(WATER, 1000) + .expectContents( + null, + new FluidStack(LAVA, 800), + null) + .fill(LAVA, 800) + .expectContents( + null, + new FluidStack(LAVA, 1000), + null) + .fill(LAVA, 800) + .expectContents( + null, + new FluidStack(LAVA, 1000), + null); new FluidHandlerTester(true, new FluidTank(1000), new FluidTank(1000), new FluidTank(1000)) - .fill(WATER, 800) - .fill(WATER, 800) - .fill(LAVA, 800) - .expectContents( - new FluidStack(WATER, 1000), - new FluidStack(WATER, 600), - new FluidStack(LAVA, 800)) - .drain(WATER, 1600) - .expectContents( - null, - null, - new FluidStack(LAVA, 800)) - .fill(LAVA, 800) - .expectContents( - new FluidStack(LAVA, 600), - null, - new FluidStack(LAVA, 1000)) - .fill(LAVA, 800) - .expectContents( - new FluidStack(LAVA, 1000), - new FluidStack(LAVA, 400), - new FluidStack(LAVA, 1000)) - .fill(WATER, 69420) - .expectContents( - new FluidStack(LAVA, 1000), - new FluidStack(LAVA, 400), - new FluidStack(LAVA, 1000)); + .fill(WATER, 800) + .fill(WATER, 800) + .fill(LAVA, 800) + .expectContents( + new FluidStack(WATER, 1000), + new FluidStack(WATER, 600), + new FluidStack(LAVA, 800)) + .drain(WATER, 1600) + .expectContents( + null, + null, + new FluidStack(LAVA, 800)) + .fill(LAVA, 800) + .expectContents( + new FluidStack(LAVA, 600), + null, + new FluidStack(LAVA, 1000)) + .fill(LAVA, 800) + .expectContents( + new FluidStack(LAVA, 1000), + new FluidStack(LAVA, 400), + new FluidStack(LAVA, 1000)) + .fill(WATER, 69420) + .expectContents( + new FluidStack(LAVA, 1000), + new FluidStack(LAVA, 400), + new FluidStack(LAVA, 1000)); } @Test @@ -154,36 +157,34 @@ public void testMixedSameFluidFill() { new FluidHandlerTester(new FluidTankList(true, new FluidTankList(false, new FluidTank(1000), - new FluidTank(1000) - ), + new FluidTank(1000)), new FluidTank(1000), new FluidTank(1000))) // distinct slots first - .beginSimulation() - .fill(WATER, 800) - .fill(WATER, 800) - .fill(WATER, 800) - .expectContents( - new FluidStack(WATER, 1000), - null, - new FluidStack(WATER, 1000), - new FluidStack(WATER, 400)); + .beginSimulation() + .fill(WATER, 800) + .fill(WATER, 800) + .fill(WATER, 800) + .expectContents( + new FluidStack(WATER, 1000), + null, + new FluidStack(WATER, 1000), + new FluidStack(WATER, 400)); new FluidHandlerTester(new FluidTankList(false, new FluidTankList(true, new FluidTank(1000), - new FluidTank(1000) - ), + new FluidTank(1000)), new FluidTank(1000), new FluidTank(1000))) // non-distinct slots first - .beginSimulation() - .fill(WATER, 800) - .fill(WATER, 800) - .fill(WATER, 800) - .expectContents( - new FluidStack(WATER, 1000), - new FluidStack(WATER, 1000), - new FluidStack(WATER, 400), - null); + .beginSimulation() + .fill(WATER, 800) + .fill(WATER, 800) + .fill(WATER, 800) + .expectContents( + new FluidStack(WATER, 1000), + new FluidStack(WATER, 1000), + new FluidStack(WATER, 400), + null); } @Test @@ -192,121 +193,122 @@ public void testDrain() { new FluidTank(1000), new FluidTank(1000), new FluidTank(1000)) - .fill(WATER, 1500) - .fill(LAVA, 500) - .expectContents( - new FluidStack(WATER, 1000), - new FluidStack(WATER, 500), - new FluidStack(LAVA, 500)) - .drain(1000) - .expectContents( - null, - new FluidStack(WATER, 500), - new FluidStack(LAVA, 500)) - .drain(1000) - .expectContents( - null, - null, - new FluidStack(LAVA, 500)) - .drain(1000) - .expectContents( - null, - null, - null) - .fill(LAVA, 500) - .fill(WATER, 1500) - .expectContents( - new FluidStack(LAVA, 500), - new FluidStack(WATER, 1000), - new FluidStack(WATER, 500)) - .drain(1000) - .expectContents( - null, - new FluidStack(WATER, 1000), - new FluidStack(WATER, 500)) - .drain(500) - .expectContents( - null, - new FluidStack(WATER, 500), - new FluidStack(WATER, 500)) - .drain(1000) - .expectContents( - null, - null, - null); + .fill(WATER, 1500) + .fill(LAVA, 500) + .expectContents( + new FluidStack(WATER, 1000), + new FluidStack(WATER, 500), + new FluidStack(LAVA, 500)) + .drain(1000) + .expectContents( + null, + new FluidStack(WATER, 500), + new FluidStack(LAVA, 500)) + .drain(1000) + .expectContents( + null, + null, + new FluidStack(LAVA, 500)) + .drain(1000) + .expectContents( + null, + null, + null) + .fill(LAVA, 500) + .fill(WATER, 1500) + .expectContents( + new FluidStack(LAVA, 500), + new FluidStack(WATER, 1000), + new FluidStack(WATER, 500)) + .drain(1000) + .expectContents( + null, + new FluidStack(WATER, 1000), + new FluidStack(WATER, 500)) + .drain(500) + .expectContents( + null, + new FluidStack(WATER, 500), + new FluidStack(WATER, 500)) + .drain(1000) + .expectContents( + null, + null, + null); } @Test public void testFilterOrdering() { SingleFluidFilter waterFilter = new SingleFluidFilter(new FluidStack(WATER, 1), false); SingleFluidFilter lavaFilter = new SingleFluidFilter(new FluidStack(LAVA, 1), false); - SingleFluidFilter creosoteFilter = new SingleFluidFilter(new FluidStack(Materials.Creosote.getFluid(), 1), false); + SingleFluidFilter creosoteFilter = new SingleFluidFilter(new FluidStack(Materials.Creosote.getFluid(), 1), + false); new FluidHandlerTester(false, new FilteredFluidHandler(1000).setFilter(waterFilter), new FilteredFluidHandler(1000).setFilter(lavaFilter), new FilteredFluidHandler(1000).setFilter(creosoteFilter)) - .beginSimulation() - .fill(WATER, 800) - .fill(LAVA, 800) - .fill(WATER, 800) - .expectContents( - new FluidStack(WATER, 1000), - new FluidStack(LAVA, 800), - null); + .beginSimulation() + .fill(WATER, 800) + .fill(LAVA, 800) + .fill(WATER, 800) + .expectContents( + new FluidStack(WATER, 1000), + new FluidStack(LAVA, 800), + null); new FluidHandlerTester(true, new FilteredFluidHandler(1000).setFilter(waterFilter), new FilteredFluidHandler(1000).setFilter(lavaFilter), new FilteredFluidHandler(1000).setFilter(creosoteFilter)) - .beginSimulation() - .fill(WATER, 800) - .fill(LAVA, 800) - .fill(WATER, 800) - .expectContents( - new FluidStack(WATER, 1000), - new FluidStack(LAVA, 800), - null); + .beginSimulation() + .fill(WATER, 800) + .fill(LAVA, 800) + .fill(WATER, 800) + .expectContents( + new FluidStack(WATER, 1000), + new FluidStack(LAVA, 800), + null); new FluidHandlerTester(true, new FilteredFluidHandler(1000).setFilter(waterFilter), new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 800) - .fill(LAVA, 800) - .expectContents( - new FluidStack(WATER, 800), - new FluidStack(LAVA, 800)); + .beginSimulation() + .fill(WATER, 800) + .fill(LAVA, 800) + .expectContents( + new FluidStack(WATER, 800), + new FluidStack(LAVA, 800)); new FluidHandlerTester(true, new FilteredFluidHandler(1000).setFilter(waterFilter), new FluidTank(1000)) - .beginSimulation() - .fill(LAVA, 800) - .fill(WATER, 800) - .expectContents( - new FluidStack(WATER, 800), - new FluidStack(LAVA, 800)); + .beginSimulation() + .fill(LAVA, 800) + .fill(WATER, 800) + .expectContents( + new FluidStack(WATER, 800), + new FluidStack(LAVA, 800)); new FluidHandlerTester(true, new FluidTank(1000), new FilteredFluidHandler(1000).setFilter(waterFilter)) - .beginSimulation() - .fill(WATER, 800) - .fill(LAVA, 800) - .expectContents( - new FluidStack(LAVA, 800), - new FluidStack(WATER, 800)); + .beginSimulation() + .fill(WATER, 800) + .fill(LAVA, 800) + .expectContents( + new FluidStack(LAVA, 800), + new FluidStack(WATER, 800)); new FluidHandlerTester(true, new FluidTank(1000), new FilteredFluidHandler(1000).setFilter(waterFilter)) - .beginSimulation() - .fill(LAVA, 800) - .fill(WATER, 800) - .expectContents( - new FluidStack(LAVA, 800), - new FluidStack(WATER, 800)); + .beginSimulation() + .fill(LAVA, 800) + .fill(WATER, 800) + .expectContents( + new FluidStack(LAVA, 800), + new FluidStack(WATER, 800)); } private static final class FluidHandlerTester { @@ -412,8 +414,9 @@ FluidHandlerTester expectContents(@Nonnull FluidStack... optionalFluidStacks) { if (!eq(tank.getFluid(), optionalFluidStacks[i])) { throw new AssertionError("Contents of the tank don't match expected state.\n" + "Expected: [\n " + Arrays.stream(optionalFluidStacks) - .map(FluidHandlerTester::ftos) - .collect(Collectors.joining(",\n ")) + "\n]\n" + + .map(FluidHandlerTester::ftos) + .collect(Collectors.joining(",\n ")) + + "\n]\n" + "Tank: " + this.tank.toString(true)); } } diff --git a/src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java b/src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java index 5578234dad6..b229f1cc5e4 100644 --- a/src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java +++ b/src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java @@ -1,6 +1,5 @@ package gregtech.api.capability.impl; -import com.google.common.collect.ImmutableList; import gregtech.Bootstrap; import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.metatileentity.MetaTileEntity; @@ -19,21 +18,25 @@ import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityItemBus; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMaintenanceHatch; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; + +import com.google.common.collect.ImmutableList; import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import javax.annotation.Nonnull; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + import static gregtech.api.util.GTUtility.gregtechId; import static org.hamcrest.CoreMatchers.*; @@ -46,7 +49,6 @@ public static void bootstrap() { @Test public void trySearchNewRecipe() { - World world = DummyWorld.INSTANCE; // Create a recipe Map to be used for testing @@ -65,41 +67,39 @@ public void trySearchNewRecipe() { .blastFurnaceTemp(1) .buildAndRegister(); - RecipeMapMultiblockController mbt = - MetaTileEntities.registerMetaTileEntity(509, - new MetaTileEntityElectricBlastFurnace( - // super function calls the world, which equal null in test - gregtechId("electric_blast_furnace")) { - @Override - public boolean canBeDistinct() { - return false; - } - - @Override - public void reinitializeStructurePattern() { - - } - - // function checks for the temperature of the recipe against the coils - @Override - public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { - return true; - } - - // ignore maintenance problems - @Override - public boolean hasMaintenanceMechanics() { - return false; - } - - // ignore muffler outputs - @Override - public boolean hasMufflerMechanics() { - return false; - } - }); - - //isValid() check in the dirtying logic requires both a metatileentity and a holder + RecipeMapMultiblockController mbt = MetaTileEntities.registerMetaTileEntity(509, + new MetaTileEntityElectricBlastFurnace( + // super function calls the world, which equal null in test + gregtechId("electric_blast_furnace")) { + + @Override + public boolean canBeDistinct() { + return false; + } + + @Override + public void reinitializeStructurePattern() {} + + // function checks for the temperature of the recipe against the coils + @Override + public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { + return true; + } + + // ignore maintenance problems + @Override + public boolean hasMaintenanceMechanics() { + return false; + } + + // ignore muffler outputs + @Override + public boolean hasMufflerMechanics() { + return false; + } + }); + + // isValid() check in the dirtying logic requires both a metatileentity and a holder try { Field field = MetaTileEntity.class.getDeclaredField("holder"); field.setAccessible(true); @@ -118,8 +118,9 @@ public boolean hasMufflerMechanics() { ((MetaTileEntityHolder) mbt.getHolder()).setWorld(world); - //Controller and isAttachedToMultiBlock need the world so we fake it here. + // Controller and isAttachedToMultiBlock need the world so we fake it here. MetaTileEntityItemBus importItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -131,6 +132,7 @@ public MultiblockControllerBase getController() { } }; MetaTileEntityItemBus exportItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -141,7 +143,9 @@ public MultiblockControllerBase getController() { return mbt; } }; - MetaTileEntityFluidHatch importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, false) { + MetaTileEntityFluidHatch importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, + false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -152,7 +156,9 @@ public MultiblockControllerBase getController() { return mbt; } }; - MetaTileEntityFluidHatch exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export.lv"), 1, true) { + MetaTileEntityFluidHatch exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export.lv"), 1, + true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -164,7 +170,7 @@ public MultiblockControllerBase getController() { } }; - //Controller is a private field but we need that information + // Controller is a private field but we need that information try { Field field = MetaTileEntityMultiblockPart.class.getDeclaredField("controllerTile"); field.setAccessible(true); @@ -219,7 +225,6 @@ protected IMultipleTankHandler getInputTank() { protected IMultipleTankHandler getOutputTank() { return importFluidBus.getExportFluids(); } - }; mbl.isOutputsFull = false; @@ -279,7 +284,6 @@ protected IMultipleTankHandler getOutputTank() { @Test public void trySearchNewRecipeDistinct() { - World world = DummyWorld.INSTANCE; // Create a recipe Map to be used for testing @@ -298,42 +302,38 @@ public void trySearchNewRecipeDistinct() { .blastFurnaceTemp(1) .buildAndRegister(); - RecipeMapMultiblockController mbt = - MetaTileEntities.registerMetaTileEntity(510, - new MetaTileEntityElectricBlastFurnace( - // super function calls the world, which equal null in test - gregtechId("electric_blast_furnace")) { - - @Override - public boolean hasMufflerMechanics() { - return false; - } - - // ignore maintenance problems - @Override - public boolean hasMaintenanceMechanics() { - return false; - } + RecipeMapMultiblockController mbt = MetaTileEntities.registerMetaTileEntity(510, + new MetaTileEntityElectricBlastFurnace( + // super function calls the world, which equal null in test + gregtechId("electric_blast_furnace")) { + @Override + public boolean hasMufflerMechanics() { + return false; + } - @Override - public void reinitializeStructurePattern() { + // ignore maintenance problems + @Override + public boolean hasMaintenanceMechanics() { + return false; + } - } + @Override + public void reinitializeStructurePattern() {} - @Override - public boolean isDistinct() { - return true; - } + @Override + public boolean isDistinct() { + return true; + } - // function checks for the temperature of the recipe against the coils - @Override - public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { - return true; - } - }); + // function checks for the temperature of the recipe against the coils + @Override + public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { + return true; + } + }); - //isValid() check in the dirtying logic requires both a metatileentity and a holder + // isValid() check in the dirtying logic requires both a metatileentity and a holder try { Field field = MetaTileEntity.class.getDeclaredField("holder"); field.setAccessible(true); @@ -352,9 +352,9 @@ public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { ((MetaTileEntityHolder) mbt.getHolder()).setWorld(world); - - //Controller and isAttachedToMultiBlock need the world so we fake it here. + // Controller and isAttachedToMultiBlock need the world so we fake it here. MetaTileEntityItemBus importItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -366,6 +366,7 @@ public MultiblockControllerBase getController() { } }; MetaTileEntityItemBus importItemBus2 = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -377,6 +378,7 @@ public MultiblockControllerBase getController() { } }; MetaTileEntityItemBus exportItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -387,7 +389,9 @@ public MultiblockControllerBase getController() { return mbt; } }; - MetaTileEntityFluidHatch importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, false) { + MetaTileEntityFluidHatch importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, + false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -398,7 +402,9 @@ public MultiblockControllerBase getController() { return mbt; } }; - MetaTileEntityFluidHatch exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export.lv"), 1, true) { + MetaTileEntityFluidHatch exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export.lv"), 1, + true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -410,7 +416,7 @@ public MultiblockControllerBase getController() { } }; - //Controller is a private field but we need that information + // Controller is a private field but we need that information try { Field field = MetaTileEntityMultiblockPart.class.getDeclaredField("controllerTile"); field.setAccessible(true); @@ -474,7 +480,6 @@ protected List getInputBuses() { a.add(importItemBus2.getImportItems()); return a; } - }; MatcherAssert.assertThat(mbt.isDistinct(), is(true)); @@ -549,21 +554,21 @@ protected List getInputBuses() { @Test public void testMaintenancePenalties() { - TestableMaintenanceHatch maintenanceHatch = new TestableMaintenanceHatch(gregtechId("maintenance.hatch"), false); + TestableMaintenanceHatch maintenanceHatch = new TestableMaintenanceHatch(gregtechId("maintenance.hatch"), + false); RecipeMapMultiblockController mbt = MetaTileEntities.registerMetaTileEntity(508, new MetaTileEntityElectricBlastFurnace( // super function calls the world, which equal null in test gregtechId("electric_blast_furnace")) { + @Override public boolean canBeDistinct() { return false; } @Override - public void reinitializeStructurePattern() { - - } + public void reinitializeStructurePattern() {} // function checks for the temperature of the recipe against the coils @Override @@ -586,14 +591,14 @@ public boolean hasMufflerMechanics() { @Override public List getAbilities(MultiblockAbility ability) { if (ability == MultiblockAbility.MAINTENANCE_HATCH) { - //noinspection unchecked + // noinspection unchecked return (List) ImmutableList.of(maintenanceHatch); } return super.getAbilities(ability); } }); - //isValid() check in the dirtying logic requires both a metatileentity and a holder + // isValid() check in the dirtying logic requires both a metatileentity and a holder try { Field field = MetaTileEntity.class.getDeclaredField("holder"); field.setAccessible(true); @@ -614,8 +619,9 @@ public List getAbilities(MultiblockAbility ability) { maintenanceHatch.myController = mbt; - //Controller and isAttachedToMultiBlock need the world so we fake it here. + // Controller and isAttachedToMultiBlock need the world so we fake it here. MetaTileEntityItemBus importItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -627,6 +633,7 @@ public MultiblockControllerBase getController() { } }; MetaTileEntityItemBus exportItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -638,7 +645,7 @@ public MultiblockControllerBase getController() { } }; - //Controller is a private field but we need that information + // Controller is a private field but we need that information try { Field field = MetaTileEntityMultiblockPart.class.getDeclaredField("controllerTile"); field.setAccessible(true); diff --git a/src/test/java/gregtech/api/recipes/RecipeMapTest.java b/src/test/java/gregtech/api/recipes/RecipeMapTest.java index 5c204db6bc6..4c158bee333 100644 --- a/src/test/java/gregtech/api/recipes/RecipeMapTest.java +++ b/src/test/java/gregtech/api/recipes/RecipeMapTest.java @@ -7,12 +7,14 @@ import gregtech.api.recipes.map.MapFluidIngredient; import gregtech.api.recipes.map.MapItemStackIngredient; import gregtech.api.recipes.map.MapOreDictIngredient; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; + +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.hamcrest.MatcherAssert; import org.hamcrest.core.IsNot; import org.junit.jupiter.api.BeforeAll; @@ -83,11 +85,13 @@ public void setupRecipes() { public void findRecipe() { MatcherAssert.assertThat(map.getRecipeList().size(), is(3)); - Recipe r = map.findRecipe(1, Collections.singletonList(new ItemStack(Blocks.COBBLESTONE)), Collections.singletonList(null)); + Recipe r = map.findRecipe(1, Collections.singletonList(new ItemStack(Blocks.COBBLESTONE)), + Collections.singletonList(null)); MatcherAssert.assertThat(r, notNullValue()); // This test is failing for me locally -dan - Recipe r2 = map.findRecipe(1, Collections.singletonList(new ItemStack(Blocks.STONE)), Collections.singletonList(new FluidStack(FluidRegistry.WATER, 1))); + Recipe r2 = map.findRecipe(1, Collections.singletonList(new ItemStack(Blocks.STONE)), + Collections.singletonList(new FluidStack(FluidRegistry.WATER, 1))); MatcherAssert.assertThat(r2, notNullValue()); } @@ -99,8 +103,7 @@ public void findRecipeFluidOnly() { Arrays.asList( Epichlorohydrin.getFluid(144), Naphtha.getFluid(3000), - NitrogenDioxide.getFluid(1000)) - ); + NitrogenDioxide.getFluid(1000))); MatcherAssert.assertThat(r, notNullValue()); } @@ -111,8 +114,7 @@ public void removeRecipe() { Arrays.asList( Epichlorohydrin.getFluid(144), Naphtha.getFluid(3000), - NitrogenDioxide.getFluid(1000)) - ); + NitrogenDioxide.getFluid(1000))); MatcherAssert.assertThat(r, notNullValue()); assert map.removeRecipe(r); MatcherAssert.assertThat(map.findRecipe(30, @@ -120,16 +122,15 @@ public void removeRecipe() { Arrays.asList( Epichlorohydrin.getFluid(144), Naphtha.getFluid(3000), - NitrogenDioxide.getFluid(1000)) - ), nullValue()); + NitrogenDioxide.getFluid(1000))), + nullValue()); MatcherAssert.assertThat(map.getRecipeList().size(), is(2)); } @Test public void recipeLookupIgnoresStackAmount() { MapItemStackIngredient ingFromStack = new MapItemStackIngredient( - new ItemStack(Blocks.COBBLESTONE), 0, null - ); + new ItemStack(Blocks.COBBLESTONE), 0, null); RecipeBuilder r = new RecipeBuilder<>() .inputs(new ItemStack(Blocks.COBBLESTONE)) @@ -138,8 +139,10 @@ public void recipeLookupIgnoresStackAmount() { .EUt(1).duration(1); Recipe rec = (Recipe) r.build().getResult(); - MapItemStackIngredient ing0FromGTRecipeInput = new MapItemStackIngredient(rec.getInputs().get(0).getInputStacks()[0], rec.getInputs().get(0)); - MapItemStackIngredient ing1FromGTRecipeInput = new MapItemStackIngredient(rec.getInputs().get(1).getInputStacks()[0], rec.getInputs().get(1)); + MapItemStackIngredient ing0FromGTRecipeInput = new MapItemStackIngredient( + rec.getInputs().get(0).getInputStacks()[0], rec.getInputs().get(0)); + MapItemStackIngredient ing1FromGTRecipeInput = new MapItemStackIngredient( + rec.getInputs().get(1).getInputStacks()[0], rec.getInputs().get(1)); MatcherAssert.assertThat(ingFromStack, equalTo(ing0FromGTRecipeInput)); MatcherAssert.assertThat(ingFromStack, equalTo(ing1FromGTRecipeInput)); @@ -150,8 +153,7 @@ public void recipeLookupIgnoresStackAmount() { @Test public void recipeLookupIgnoresFluidStackAmount() { MapFluidIngredient ingFromStack = new MapFluidIngredient( - new FluidStack(FluidRegistry.getFluid("water"), 1000) - ); + new FluidStack(FluidRegistry.getFluid("water"), 1000)); RecipeBuilder r = new RecipeBuilder<>() .fluidInputs(new FluidStack(FluidRegistry.getFluid("water"), 1000)) @@ -192,7 +194,8 @@ public void MapIngredientEquals() { .EUt(1).duration(1); Recipe rec = (Recipe) r.build().getResult(); - MapItemStackIngredient ing0FromGTRecipeInput = new MapItemStackIngredient(rec.getInputs().get(0).getInputStacks()[0], rec.getInputs().get(0)); + MapItemStackIngredient ing0FromGTRecipeInput = new MapItemStackIngredient( + rec.getInputs().get(0).getInputStacks()[0], rec.getInputs().get(0)); MapOreDictIngredient ing1FromGTRecipeInput = new MapOreDictIngredient(OreDictionary.getOreID("cobblestone")); MatcherAssert.assertThat(ing0FromGTRecipeInput, new IsNot<>(equalTo(ing1FromGTRecipeInput))); @@ -214,16 +217,19 @@ public void MapHashCollision() { Recipe rec = (Recipe) r.build().getResult(); - //create the MapItemStackIngredient and call hashCode so the hash cached to the "hash" field + // create the MapItemStackIngredient and call hashCode so the hash cached to the "hash" field - MapItemStackIngredient ing0FromGTRecipeInput = new MapItemStackIngredient(rec.getInputs().get(0).getInputStacks()[0], rec.getInputs().get(0)); + MapItemStackIngredient ing0FromGTRecipeInput = new MapItemStackIngredient( + rec.getInputs().get(0).getInputStacks()[0], rec.getInputs().get(0)); ing0FromGTRecipeInput.hashCode(); - MapItemStackIngredient ing1FromGTRecipeInput = new MapItemStackIngredient(rec.getInputs().get(1).getInputStacks()[0], rec.getInputs().get(0)); + MapItemStackIngredient ing1FromGTRecipeInput = new MapItemStackIngredient( + rec.getInputs().get(1).getInputStacks()[0], rec.getInputs().get(0)); ing1FromGTRecipeInput.hashCode(); - MapItemStackIngredient ing2FromGTRecipeInput = new MapItemStackIngredient(rec.getInputs().get(2).getInputStacks()[0], rec.getInputs().get(0)); + MapItemStackIngredient ing2FromGTRecipeInput = new MapItemStackIngredient( + rec.getInputs().get(2).getInputStacks()[0], rec.getInputs().get(0)); ing1FromGTRecipeInput.hashCode(); - //Reflection so the equals in AbstractMapIngredient doesn't return false due to anonymous class check failure + // Reflection so the equals in AbstractMapIngredient doesn't return false due to anonymous class check failure try { Field hash = AbstractMapIngredient.class.getDeclaredField("hash"); @@ -235,14 +241,14 @@ public void MapHashCollision() { throw new RuntimeException(e); } - //Add the cobblestone ingredients to the map, which should considered equals. + // Add the cobblestone ingredients to the map, which should considered equals. Object2ObjectOpenHashMap map = new Object2ObjectOpenHashMap<>(); map.put(ing0FromGTRecipeInput, ing0FromGTRecipeInput); map.put(ing1FromGTRecipeInput, ing1FromGTRecipeInput); MatcherAssert.assertThat(map.keySet().size(), is(1)); - //Add the stone, which is not equal and is a new key + // Add the stone, which is not equal and is a new key map.put(ing2FromGTRecipeInput, ing2FromGTRecipeInput); MatcherAssert.assertThat(map.keySet().size(), is(2)); diff --git a/src/test/java/gregtech/api/recipes/chance/boost/ChanceBoostTest.java b/src/test/java/gregtech/api/recipes/chance/boost/ChanceBoostTest.java index 09ec9255de6..f36cec796b5 100644 --- a/src/test/java/gregtech/api/recipes/chance/boost/ChanceBoostTest.java +++ b/src/test/java/gregtech/api/recipes/chance/boost/ChanceBoostTest.java @@ -3,9 +3,8 @@ import gregtech.api.GTValues; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.chance.ChanceEntry; -import gregtech.api.recipes.chance.boost.BoostableChanceEntry; -import gregtech.api.recipes.chance.boost.ChanceBoostFunction; import gregtech.api.recipes.chance.output.BoostableChanceOutput; + import org.hamcrest.MatcherAssert; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; @@ -23,7 +22,9 @@ public class ChanceBoostTest { private static final int RESULT_TWO_BOOST = BASE_AMOUNT + (BOOST_AMOUNT * 2); @SuppressWarnings("DataFlowIssue") - private static final BoostableChanceEntry CHANCE_ENTRY = new BoostableChanceOutput<>(null, BASE_AMOUNT, BOOST_AMOUNT) { + private static final BoostableChanceEntry CHANCE_ENTRY = new BoostableChanceOutput<>(null, BASE_AMOUNT, + BOOST_AMOUNT) { + @Override public @NotNull ChanceEntry copy() { return null; diff --git a/src/test/java/gregtech/api/recipes/chance/output/ChancedOutputLogicTest.java b/src/test/java/gregtech/api/recipes/chance/output/ChancedOutputLogicTest.java index 25e3ba87c46..4e6cbf026c9 100644 --- a/src/test/java/gregtech/api/recipes/chance/output/ChancedOutputLogicTest.java +++ b/src/test/java/gregtech/api/recipes/chance/output/ChancedOutputLogicTest.java @@ -1,8 +1,9 @@ package gregtech.api.recipes.chance.output; -import com.google.common.collect.ImmutableList; import gregtech.api.recipes.chance.ChanceEntry; import gregtech.api.recipes.chance.boost.ChanceBoostFunction; + +import com.google.common.collect.ImmutableList; import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; import org.jetbrains.annotations.NotNull; @@ -14,6 +15,7 @@ public class ChancedOutputLogicTest { private static class TestChancedOutput extends ChancedOutput { + public TestChancedOutput(@NotNull String ingredient, int chance) { super(ingredient, chance); } @@ -24,7 +26,8 @@ public TestChancedOutput(@NotNull String ingredient, int chance) { } } - private static > void listsMatch(@NotNull List original, @Nullable List rolled) { + private static > void listsMatch(@NotNull List original, + @Nullable List rolled) { MatcherAssert.assertThat(rolled, CoreMatchers.notNullValue()); MatcherAssert.assertThat(rolled.size(), CoreMatchers.is(original.size())); for (int i = 0; i < original.size(); i++) { @@ -37,8 +40,7 @@ public void testORLogic() { List chanceEntries = ImmutableList.of( new TestChancedOutput("a", ChancedOutputLogic.getMaxChancedValue()), new TestChancedOutput("b", ChancedOutputLogic.getMaxChancedValue()), - new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue()) - ); + new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue())); List list = ChancedOutputLogic.OR.roll(chanceEntries, ChanceBoostFunction.NONE, 0, 0); listsMatch(chanceEntries, list); @@ -49,8 +51,7 @@ public void testANDLogic() { List chanceEntries = ImmutableList.of( new TestChancedOutput("a", ChancedOutputLogic.getMaxChancedValue()), new TestChancedOutput("b", ChancedOutputLogic.getMaxChancedValue()), - new TestChancedOutput("c", 0) - ); + new TestChancedOutput("c", 0)); List list = ChancedOutputLogic.AND.roll(chanceEntries, ChanceBoostFunction.NONE, 0, 0); MatcherAssert.assertThat(list, CoreMatchers.nullValue()); @@ -58,8 +59,7 @@ public void testANDLogic() { chanceEntries = ImmutableList.of( new TestChancedOutput("a", ChancedOutputLogic.getMaxChancedValue()), new TestChancedOutput("b", ChancedOutputLogic.getMaxChancedValue()), - new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue()) - ); + new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue())); list = ChancedOutputLogic.AND.roll(chanceEntries, ChanceBoostFunction.NONE, 0, 0); listsMatch(chanceEntries, list); @@ -70,8 +70,7 @@ public void testXORLogic() { List chanceEntries = ImmutableList.of( new TestChancedOutput("a", ChancedOutputLogic.getMaxChancedValue()), new TestChancedOutput("b", ChancedOutputLogic.getMaxChancedValue()), - new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue()) - ); + new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue())); List list = ChancedOutputLogic.XOR.roll(chanceEntries, ChanceBoostFunction.NONE, 0, 0); MatcherAssert.assertThat(list, CoreMatchers.notNullValue()); @@ -84,8 +83,7 @@ public void testNONELogic() { List chanceEntries = ImmutableList.of( new TestChancedOutput("a", ChancedOutputLogic.getMaxChancedValue()), new TestChancedOutput("b", ChancedOutputLogic.getMaxChancedValue()), - new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue()) - ); + new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue())); List list = ChancedOutputLogic.NONE.roll(chanceEntries, ChanceBoostFunction.NONE, 0, 0); MatcherAssert.assertThat(list, CoreMatchers.nullValue()); diff --git a/src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java b/src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java index 48f08df660b..13e03f3775f 100644 --- a/src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java +++ b/src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java @@ -22,21 +22,24 @@ import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityFluidHatch; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityItemBus; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; + import org.hamcrest.MatcherAssert; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import javax.annotation.Nonnull; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import javax.annotation.Nonnull; + import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; @@ -73,9 +76,7 @@ public boolean canBeDistinct() { } @Override - public void reinitializeStructurePattern() { - - } + public void reinitializeStructurePattern() {} // function checks for the temperature of the recipe against the coils @Override @@ -91,11 +92,13 @@ public boolean hasMaintenanceMechanics() { }); try { - Field field = MetaTileEntityElectricBlastFurnace.class.getSuperclass().getDeclaredField("recipeMapWorkable"); + Field field = MetaTileEntityElectricBlastFurnace.class.getSuperclass() + .getDeclaredField("recipeMapWorkable"); field.setAccessible(true); Object recipeMapWorkableField = field.get(mbt); - Method setParallelLimitMethod = recipeMapWorkableField.getClass().getSuperclass().getSuperclass().getDeclaredMethod("setParallelLimit", int.class); + Method setParallelLimitMethod = recipeMapWorkableField.getClass().getSuperclass().getSuperclass() + .getDeclaredMethod("setParallelLimit", int.class); setParallelLimitMethod.setAccessible(true); setParallelLimitMethod.invoke(recipeMapWorkableField, 4); @@ -103,7 +106,7 @@ public boolean hasMaintenanceMechanics() { e.printStackTrace(); } - //isValid() check in the dirtying logic requires both a metatileentity and a holder + // isValid() check in the dirtying logic requires both a metatileentity and a holder try { Field field = MetaTileEntity.class.getDeclaredField("holder"); field.setAccessible(true); @@ -122,8 +125,9 @@ public boolean hasMaintenanceMechanics() { ((MetaTileEntityHolder) mbt.getHolder()).setWorld(world); - //Controller and isAttachedToMultiBlock need the world so we fake it here. + // Controller and isAttachedToMultiBlock need the world so we fake it here. importItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -135,6 +139,7 @@ public MultiblockControllerBase getController() { } }; exportItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -146,6 +151,7 @@ public MultiblockControllerBase getController() { } }; importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -157,6 +163,7 @@ public MultiblockControllerBase getController() { } }; secondImportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.zpm"), 7, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -168,6 +175,7 @@ public MultiblockControllerBase getController() { } }; exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export.uhv"), 9, true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -179,7 +187,7 @@ public MultiblockControllerBase getController() { } }; - //Controller is a private field but we need that information + // Controller is a private field but we need that information try { Field field = MetaTileEntityMultiblockPart.class.getDeclaredField("controllerTile"); field.setAccessible(true); @@ -196,7 +204,6 @@ public MultiblockControllerBase getController() { @Test public void findMultipliedRecipe_AtMaxParallelsTest() { - MetaTileEntityElectricBlastFurnace EBF = initEBF(511); int parallelLimit = 4; @@ -223,31 +230,33 @@ public void findMultipliedRecipe_AtMaxParallelsTest() { // Initially populate the input bus importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), - exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, EBF); + RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, + importItemBus.getImportItems(), importFluidBus.getImportFluids(), + exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, + EBF); - //Check if the correct number of parallels were done + // Check if the correct number of parallels were done MatcherAssert.assertThat(parallelRecipe.getParallel(), is(4)); - //Check that the EUt of the recipe was multiplied correctly + // Check that the EUt of the recipe was multiplied correctly MatcherAssert.assertThat(parallelRecipe.getEUt(), is(120)); - //Check if the recipe duration was not modified + // Check if the recipe duration was not modified MatcherAssert.assertThat(parallelRecipe.getDuration(), is(100)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(parallelRecipe.getOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 4), parallelRecipe.getOutputs().get(0)), is(true)); - - //Check the recipe inputs - //assertEquals(CountableIngredient.from(new ItemStack(Blocks.COBBLESTONE), 4), parallelRecipe.getInputs().get(0)); + MatcherAssert.assertThat( + hashStrategy.equals(new ItemStack(Blocks.STONE, 4), parallelRecipe.getOutputs().get(0)), is(true)); + // Check the recipe inputs + // assertEquals(CountableIngredient.from(new ItemStack(Blocks.COBBLESTONE), 4), + // parallelRecipe.getInputs().get(0)); } @Test public void findMultipliedRecipe_LessThanMaxParallelsTest() { - MetaTileEntityElectricBlastFurnace EBF = initEBF(512); int parallelLimit = 4; @@ -274,30 +283,32 @@ public void findMultipliedRecipe_LessThanMaxParallelsTest() { // Initially populate the input bus importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 2), false); - RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), - exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, EBF); + RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, + importItemBus.getImportItems(), importFluidBus.getImportFluids(), + exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, + EBF); - //Check if the correct number of parallels were done + // Check if the correct number of parallels were done MatcherAssert.assertThat(parallelRecipe.getParallel(), is(2)); - //Check that the EUt of the recipe was multiplied correctly + // Check that the EUt of the recipe was multiplied correctly MatcherAssert.assertThat(parallelRecipe.getEUt(), is(60)); - //Check if the recipe duration was not modified + // Check if the recipe duration was not modified MatcherAssert.assertThat(parallelRecipe.getDuration(), is(100)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(parallelRecipe.getOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 2), parallelRecipe.getOutputs().get(0)), is(true)); + MatcherAssert.assertThat( + hashStrategy.equals(new ItemStack(Blocks.STONE, 2), parallelRecipe.getOutputs().get(0)), is(true)); - //Check the recipe inputs + // Check the recipe inputs MatcherAssert.assertThat(parallelRecipe.getInputs().get(0).getAmount(), is(2)); } @Test public void findMultipliedRecipe_FluidOnlyMaxParallelTest() { - MetaTileEntityElectricBlastFurnace EBF = initEBF(519); int parallelLimit = 4; @@ -325,30 +336,32 @@ public void findMultipliedRecipe_FluidOnlyMaxParallelTest() { importFluidBus.getImportFluids().fill(Materials.Toluene.getFluid(4000), true); secondImportFluidBus.getImportFluids().fill(Materials.RawGasoline.getFluid(50000), true); - IMultipleTankHandler tankHandler = new FluidTankList(false, importFluidBus.getImportFluids().getTankAt(0), secondImportFluidBus.getImportFluids().getTankAt(0)); + IMultipleTankHandler tankHandler = new FluidTankList(false, importFluidBus.getImportFluids().getTankAt(0), + secondImportFluidBus.getImportFluids().getTankAt(0)); - RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, importItemBus.getImportItems(), tankHandler, - exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, EBF); + RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, + importItemBus.getImportItems(), tankHandler, + exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, + EBF); - //Check if the correct number of parallels were done + // Check if the correct number of parallels were done MatcherAssert.assertThat(parallelRecipe.getParallel(), is(4)); - //Check that the EUt of the recipe was multiplied correctly + // Check that the EUt of the recipe was multiplied correctly MatcherAssert.assertThat(parallelRecipe.getEUt(), is(1920)); - //Check if the recipe duration was not modified + // Check if the recipe duration was not modified MatcherAssert.assertThat(parallelRecipe.getDuration(), is(10)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(parallelRecipe.getFluidOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(Materials.Gasoline.getFluid(44000).equals(parallelRecipe.getFluidOutputs().get(0)), is(true)); - + MatcherAssert.assertThat(Materials.Gasoline.getFluid(44000).equals(parallelRecipe.getFluidOutputs().get(0)), + is(true)); } @Test public void findMultipliedRecipe_FluidOnlyLessThanMaxParallelTest() { - MetaTileEntityElectricBlastFurnace EBF = initEBF(520); int parallelLimit = 4; @@ -376,32 +389,34 @@ public void findMultipliedRecipe_FluidOnlyLessThanMaxParallelTest() { importFluidBus.getImportFluids().fill(Materials.Toluene.getFluid(2000), true); secondImportFluidBus.getImportFluids().fill(Materials.RawGasoline.getFluid(50000), true); - IMultipleTankHandler tankHandler = new FluidTankList(false, importFluidBus.getImportFluids().getTankAt(0), secondImportFluidBus.getImportFluids().getTankAt(0)); + IMultipleTankHandler tankHandler = new FluidTankList(false, importFluidBus.getImportFluids().getTankAt(0), + secondImportFluidBus.getImportFluids().getTankAt(0)); - RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, importItemBus.getImportItems(), tankHandler, - exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, EBF); + RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, + importItemBus.getImportItems(), tankHandler, + exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, + EBF); - //Check if the correct number of parallels were done + // Check if the correct number of parallels were done MatcherAssert.assertThat(parallelRecipe.getParallel(), is(2)); - //Check that the EUt of the recipe was multiplied correctly + // Check that the EUt of the recipe was multiplied correctly MatcherAssert.assertThat(parallelRecipe.getEUt(), is(960)); - //Check if the recipe duration was not modified + // Check if the recipe duration was not modified MatcherAssert.assertThat(parallelRecipe.getDuration(), is(10)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(parallelRecipe.getFluidOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(Materials.Gasoline.getFluid(22000).equals(parallelRecipe.getFluidOutputs().get(0)), is(true)); - + MatcherAssert.assertThat(Materials.Gasoline.getFluid(22000).equals(parallelRecipe.getFluidOutputs().get(0)), + is(true)); } @Test public void findAppendedParallelItemRecipe_AtMaxParallelsTest() { MetaTileEntityElectricBlastFurnace EBF = initEBF(513); - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -429,26 +444,26 @@ public void findAppendedParallelItemRecipe_AtMaxParallelsTest() { RecipeBuilder parallelRecipe = logic.findAppendedParallelItemRecipe(map, importItemBus.getImportItems(), exportItemBus.getExportItems(), parallelLimit, 120, EBF); - //Check if the correct number of parallels were done + // Check if the correct number of parallels were done MatcherAssert.assertThat(parallelRecipe.getParallel(), is(4)); - //Check that the EUt of the recipe was not modified + // Check that the EUt of the recipe was not modified MatcherAssert.assertThat(parallelRecipe.getEUt(), is(30)); - //Check if the recipe duration was multiplied correctly + // Check if the recipe duration was multiplied correctly MatcherAssert.assertThat(parallelRecipe.getDuration(), is(400)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(parallelRecipe.getOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 4), parallelRecipe.getOutputs().get(0)), is(true)); + MatcherAssert.assertThat( + hashStrategy.equals(new ItemStack(Blocks.STONE, 4), parallelRecipe.getOutputs().get(0)), is(true)); } @Test public void findAppendedParallelItemRecipe_LessThanMaxParallelsTest() { MetaTileEntityElectricBlastFurnace EBF = initEBF(514); - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -476,19 +491,20 @@ public void findAppendedParallelItemRecipe_LessThanMaxParallelsTest() { RecipeBuilder parallelRecipe = logic.findAppendedParallelItemRecipe(map, importItemBus.getImportItems(), exportItemBus.getExportItems(), parallelLimit, 120, EBF); - //Check if the correct number of parallels were done + // Check if the correct number of parallels were done MatcherAssert.assertThat(parallelRecipe.getParallel(), is(2)); - //Check that the EUt of the recipe was not modified + // Check that the EUt of the recipe was not modified MatcherAssert.assertThat(parallelRecipe.getEUt(), is(30)); - //Check if the recipe duration was multiplied correctly + // Check if the recipe duration was multiplied correctly MatcherAssert.assertThat(parallelRecipe.getDuration(), is(200)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(parallelRecipe.getOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 2), parallelRecipe.getOutputs().get(0)), is(true)); + MatcherAssert.assertThat( + hashStrategy.equals(new ItemStack(Blocks.STONE, 2), parallelRecipe.getOutputs().get(0)), is(true)); } // An end-to-end test for finding parallel recipes @@ -499,6 +515,7 @@ public void findParallelRecipe_Test() { int parallelLimit = 4; MultiblockRecipeLogic mrl = new MultiblockRecipeLogic(mbt) { + @Override protected long getEnergyStored() { return Long.MAX_VALUE; @@ -548,22 +565,21 @@ public MetaTileEntity getMetaTileEntity() { // Initially populate the input bus importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - - Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), exportItemBus.getExportItems(), + Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), 128, parallelLimit); - - //Check that the EUt of the recipe was multiplied correctly + // Check that the EUt of the recipe was multiplied correctly MatcherAssert.assertThat(outputRecipe.getEUt(), is(120)); - //Check if the recipe duration was not modified + // Check if the recipe duration was not modified MatcherAssert.assertThat(outputRecipe.getDuration(), is(100)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(outputRecipe.getOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 4), outputRecipe.getOutputs().get(0)), is(true)); - + MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 4), outputRecipe.getOutputs().get(0)), + is(true)); } // An end-to-end test for finding parallel recipes @@ -574,6 +590,7 @@ public void findParallelRecipe_FailingFromInputTest() { int parallelLimit = 4; MultiblockRecipeLogic mrl = new MultiblockRecipeLogic(mbt) { + @Override protected long getEnergyStored() { return Long.MAX_VALUE; @@ -621,10 +638,10 @@ public MetaTileEntity getMetaTileEntity() { IParallelableRecipeLogic logic = new ParallelableTestLogic(EBF, map, ParallelLogicType.MULTIPLY); // Don't populate the input bus, so the recipe will fail - //importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); + // importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - - Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), exportItemBus.getExportItems(), + Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), 32, parallelLimit); MatcherAssert.assertThat(outputRecipe, nullValue()); @@ -638,6 +655,7 @@ public void findParallelRecipe_FailingFromOutputTest() { int parallelLimit = 4; MultiblockRecipeLogic mrl = new MultiblockRecipeLogic(mbt) { + @Override protected long getEnergyStored() { return Long.MAX_VALUE; @@ -690,8 +708,8 @@ public MetaTileEntity getMetaTileEntity() { exportItemBus.getExportItems().insertItem(2, new ItemStack(Blocks.BONE_BLOCK, 16), false); exportItemBus.getExportItems().insertItem(3, new ItemStack(Blocks.BONE_BLOCK, 16), false); - - Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), exportItemBus.getExportItems(), + Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), Integer.MAX_VALUE, parallelLimit); MatcherAssert.assertThat(outputRecipe, nullValue()); @@ -704,6 +722,7 @@ public void applyParallelBonus_Test() { int parallelLimit = 4; MultiblockRecipeLogic mrl = new MultiblockRecipeLogic(mbt) { + @Override protected long getEnergyStored() { return Long.MAX_VALUE; @@ -753,20 +772,21 @@ public MetaTileEntity getMetaTileEntity() { // Initially populate the input bus importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), exportItemBus.getExportItems(), + Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), 128, parallelLimit); - - //Check that the EUt of the recipe was not modified + // Check that the EUt of the recipe was not modified MatcherAssert.assertThat(outputRecipe.getEUt(), is(1)); - //Check if the recipe duration was multiplied correctly + // Check if the recipe duration was multiplied correctly MatcherAssert.assertThat(outputRecipe.getDuration(), is(50)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(outputRecipe.getOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 4), outputRecipe.getOutputs().get(0)), is(true)); + MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 4), outputRecipe.getOutputs().get(0)), + is(true)); } private static class ParallelableTestLogic implements IParallelableRecipeLogic { @@ -776,7 +796,8 @@ private static class ParallelableTestLogic implements IParallelableRecipeLogic { private final ParallelLogicType logicType; private final boolean enableBonusOverride; - public ParallelableTestLogic(MetaTileEntity metaTileEntity, RecipeMap recipeMap, ParallelLogicType logicType) { + public ParallelableTestLogic(MetaTileEntity metaTileEntity, RecipeMap recipeMap, + ParallelLogicType logicType) { this(metaTileEntity, recipeMap, logicType, false); } diff --git a/src/test/java/gregtech/api/recipes/logic/OverclockingTest.java b/src/test/java/gregtech/api/recipes/logic/OverclockingTest.java index ac80de58ecb..d503cff24ea 100644 --- a/src/test/java/gregtech/api/recipes/logic/OverclockingTest.java +++ b/src/test/java/gregtech/api/recipes/logic/OverclockingTest.java @@ -1,6 +1,5 @@ package gregtech.api.recipes.logic; - import org.junit.jupiter.api.Test; import static gregtech.api.GTValues.*; @@ -118,7 +117,8 @@ public void testHeatingCoilsDiffTemp() { final int machineTier = HV; // 1800K recipe, 1800K machine - int[] oc = testHeatingOC(recipeDuration, recipeTier, recipeVoltage, machineTier, (int) V[machineTier], 1800, 1800); + int[] oc = testHeatingOC(recipeDuration, recipeTier, recipeVoltage, machineTier, (int) V[machineTier], 1800, + 1800); // 0 EU discounts, 2 overclocks assertThat(oc[0], is(recipeVoltage * ((int) Math.pow(4, 2)))); @@ -170,12 +170,13 @@ public void testFusionReactor() { assertThat(oc[1], is(recipeDuration / ((int) Math.pow(2, 2)))); } - private static int[] testOC(int recipeDuration, int recipeTier, int recipeVoltage, int machineTier, int maxVoltage) { + private static int[] testOC(int recipeDuration, int recipeTier, int recipeVoltage, int machineTier, + int maxVoltage) { int numberOfOCs = machineTier - recipeTier; if (recipeTier == ULV) numberOfOCs--; // no ULV overclocking // cannot overclock, so return the starting values - if (numberOfOCs <= 0) return new int[]{recipeVoltage, recipeDuration}; + if (numberOfOCs <= 0) return new int[] { recipeVoltage, recipeDuration }; return OverclockingLogic.standardOverclockingLogic( recipeVoltage, @@ -186,7 +187,8 @@ private static int[] testOC(int recipeDuration, int recipeTier, int recipeVoltag OverclockingLogic.STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); } - private static int[] testHeatingOC(int recipeDuration, int recipeTier, int recipeVoltage, int machineTier, int maxVoltage, + private static int[] testHeatingOC(int recipeDuration, int recipeTier, int recipeVoltage, int machineTier, + int maxVoltage, int recipeTemperature, int machineTemperature) { int numberOfOCs = machineTier - recipeTier; if (recipeTier == ULV) numberOfOCs--; // no ULV overclocking @@ -194,7 +196,7 @@ private static int[] testHeatingOC(int recipeDuration, int recipeTier, int recip recipeVoltage = OverclockingLogic.applyCoilEUtDiscount(recipeVoltage, machineTemperature, recipeTemperature); // cannot overclock, so return the starting values - if (numberOfOCs <= 0) return new int[]{recipeVoltage, recipeDuration}; + if (numberOfOCs <= 0) return new int[] { recipeVoltage, recipeDuration }; return OverclockingLogic.heatingCoilOverclockingLogic( recipeVoltage, @@ -205,12 +207,13 @@ private static int[] testHeatingOC(int recipeDuration, int recipeTier, int recip recipeTemperature); } - private static int[] testFusionOC(int recipeDuration, int recipeTier, int recipeVoltage, int machineTier, int maxVoltage) { + private static int[] testFusionOC(int recipeDuration, int recipeTier, int recipeVoltage, int machineTier, + int maxVoltage) { int numberOfOCs = machineTier - recipeTier; if (recipeTier == ULV) numberOfOCs--; // no ULV overclocking // cannot overclock, so return the starting values - if (numberOfOCs <= 0) return new int[]{recipeVoltage, recipeDuration}; + if (numberOfOCs <= 0) return new int[] { recipeVoltage, recipeDuration }; return OverclockingLogic.standardOverclockingLogic( recipeVoltage, diff --git a/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java b/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java index 3f1e5b89eac..06c0540d406 100644 --- a/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java +++ b/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java @@ -17,9 +17,11 @@ import gregtech.common.metatileentities.electric.SimpleMachineMetaTileEntityResizable; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityFluidHatch; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityItemBus; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -33,9 +35,12 @@ public class ParallelLogicTest { MetaTileEntityItemBus importItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, false); MetaTileEntityItemBus exportItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, true); - MetaTileEntityFluidHatch importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, false); - MetaTileEntityFluidHatch secondImportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, false); - MetaTileEntityFluidHatch exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, true); + MetaTileEntityFluidHatch importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, + false); + MetaTileEntityFluidHatch secondImportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, + false); + MetaTileEntityFluidHatch exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, + true); @BeforeAll public static void bootstrap() { @@ -44,7 +49,6 @@ public static void bootstrap() { @Test public void getMaxRecipeMultiplier_ItemLimitTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -68,15 +72,14 @@ public void getMaxRecipeMultiplier_ItemLimitTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 3), false); importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(8000), true); - int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), parallelLimit); + int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), parallelLimit); assertThat(itemRatio, is(3)); - } @Test public void getMaxRecipeMultiplier_FluidLimitTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -100,15 +103,14 @@ public void getMaxRecipeMultiplier_FluidLimitTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(8000), true); - int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), parallelLimit); + int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), parallelLimit); assertThat(itemRatio, is(2)); - } @Test public void getMaxRecipeMultiplier_LimitFailureTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -132,15 +134,14 @@ public void getMaxRecipeMultiplier_LimitFailureTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.STONE, 16), false); importFluidBus.getImportFluids().fill(Materials.Naphtha.getFluid(8000), true); - int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), parallelLimit); + int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), parallelLimit); assertThat(itemRatio, is(0)); - } @Test public void getMaxRecipeMultiplier_ItemFailureTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -164,15 +165,14 @@ public void getMaxRecipeMultiplier_ItemFailureTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.STONE, 16), false); importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(8000), true); - int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), parallelLimit); + int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), parallelLimit); assertThat(itemRatio, is(0)); - } @Test public void getMaxRecipeMultiplier_FluidFailureTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -196,15 +196,14 @@ public void getMaxRecipeMultiplier_FluidFailureTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); importFluidBus.getImportFluids().fill(Materials.Naphtha.getFluid(8000), true); - int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), parallelLimit); + int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), parallelLimit); assertThat(itemRatio, is(0)); - } @Test public void limitParallelByItems_MaxParallelTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -228,15 +227,14 @@ public void limitParallelByItems_MaxParallelTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(8000), true); - int itemRatio = ParallelLogic.limitParallelByItems(recipe, new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByItems(recipe, + new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); assertThat(itemRatio, is(4)); - } @Test public void limitParallelByItems_LessThanMaxParallelsTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -264,16 +262,14 @@ public void limitParallelByItems_LessThanMaxParallelsTest() { exportItemBus.getExportItems().insertItem(2, new ItemStack(Blocks.BONE_BLOCK), false); exportItemBus.getExportItems().insertItem(3, new ItemStack(Blocks.STONE, 62), false); - - int itemRatio = ParallelLogic.limitParallelByItems(recipe, new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByItems(recipe, + new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); assertThat(itemRatio, is(2)); - } @Test public void limitParallelByItems_SplitAcrossStacksTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -301,16 +297,14 @@ public void limitParallelByItems_SplitAcrossStacksTest() { exportItemBus.getExportItems().insertItem(2, new ItemStack(Blocks.STONE, 62), false); exportItemBus.getExportItems().insertItem(3, new ItemStack(Blocks.STONE, 62), false); - - int itemRatio = ParallelLogic.limitParallelByItems(recipe, new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByItems(recipe, + new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); assertThat(itemRatio, is(4)); - } @Test public void limitParallelByItems_ItemOutputFullTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -340,15 +334,14 @@ public void limitParallelByItems_ItemOutputFullTest() { exportItemBus.getExportItems().insertItem(2, new ItemStack(Blocks.BONE_BLOCK), false); exportItemBus.getExportItems().insertItem(3, new ItemStack(Blocks.BONE_BLOCK), false); - int itemRatio = ParallelLogic.limitParallelByItems(recipe, new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByItems(recipe, + new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); assertThat(itemRatio, is(0)); - } @Test public void limitParallelByFluids_MaxParallelTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -370,15 +363,14 @@ public void limitParallelByFluids_MaxParallelTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - int itemRatio = ParallelLogic.limitParallelByFluids(recipe, new OverlayedFluidHandler(exportFluidBus.getExportFluids()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByFluids(recipe, + new OverlayedFluidHandler(exportFluidBus.getExportFluids()), parallelLimit); assertThat(itemRatio, is(4)); - } @Test public void limitParallelByFluids_PartialParallelsTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -402,15 +394,14 @@ public void limitParallelByFluids_PartialParallelsTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); exportFluidBus.getExportFluids().fill(Materials.Acetone.getFluid(15800), true); - int itemRatio = ParallelLogic.limitParallelByFluids(recipe, new OverlayedFluidHandler(exportFluidBus.getExportFluids()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByFluids(recipe, + new OverlayedFluidHandler(exportFluidBus.getExportFluids()), parallelLimit); assertThat(itemRatio, is(2)); - } @Test public void limitParallelByFluids_FluidOutputFullTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -434,10 +425,10 @@ public void limitParallelByFluids_FluidOutputFullTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); exportFluidBus.getExportFluids().fill(Materials.Acetone.getFluid(16000), true); - int itemRatio = ParallelLogic.limitParallelByFluids(recipe, new OverlayedFluidHandler(exportFluidBus.getExportFluids()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByFluids(recipe, + new OverlayedFluidHandler(exportFluidBus.getExportFluids()), parallelLimit); assertThat(itemRatio, is(0)); - } @Test @@ -485,7 +476,6 @@ public void getMaxRatioItem_SameNonConsumedTest() { recipe, parallelLimit); assertThat(thirdItemRatio, is(parallelLimit)); - } @Test @@ -513,12 +503,10 @@ public void getMaxRatioItem_DifferentNonConsumedTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 4), false); importItemBus.getImportItems().insertItem(1, new ItemStack(Blocks.STONE, 1), false); - int itemRatio = ParallelLogic.getMaxRatioItem(GTHashMaps.fromItemHandler(importItemBus.getImportItems()), recipe, parallelLimit); assertThat(itemRatio, is(4)); - } @Test @@ -544,12 +532,10 @@ public void getMaxRatioItem_OnlyNonConsumedTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.STONE, 1), false); - int itemRatio = ParallelLogic.getMaxRatioItem(GTHashMaps.fromItemHandler(importItemBus.getImportItems()), recipe, parallelLimit); assertThat(itemRatio, is(parallelLimit)); - } @Test @@ -597,7 +583,6 @@ public void getMaxRatioItem_OnlyNonConsumedWithStacksizeTest() { recipe, parallelLimit); assertThat(secondItemRatio, is(parallelLimit)); - } @Test @@ -624,7 +609,8 @@ public void getMaxRatioFluid_RegularFluidInputsTest() { // Test Not enough fluid for 1 parallel importFluidBus.getImportFluids().fill(Materials.Water.getFluid(500), true); - int fluidRatioFailure = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioFailure = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioFailure, is(0)); @@ -640,11 +626,11 @@ public void getMaxRatioFluid_RegularFluidInputsTest() { // Test Parallel Limit with > max parallels importFluidBus.getImportFluids().fill(Materials.Water.getFluid(2500), true); - int secondFluidRatio = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int secondFluidRatio = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(secondFluidRatio, is(parallelLimit)); - } @Test @@ -672,7 +658,8 @@ public void getMaxRatioFluid_SameNonConsumedTest() { // Test Not enough fluid for 1 parallel importFluidBus.getImportFluids().fill(Materials.Water.getFluid(500), true); - int fluidRatioFailure = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioFailure = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioFailure, is(0)); @@ -688,7 +675,8 @@ public void getMaxRatioFluid_SameNonConsumedTest() { // Test Parallel Limit Exactly equal inputs importFluidBus.getImportFluids().fill(Materials.Water.getFluid(2000), true); - int fluidRatioExact = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioExact = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioExact, is(parallelLimit)); @@ -696,11 +684,11 @@ public void getMaxRatioFluid_SameNonConsumedTest() { // Test Parallel Limit with > max parallels importFluidBus.getImportFluids().fill(Materials.Water.getFluid(2500), true); - int secondFluidRatio = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int secondFluidRatio = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(secondFluidRatio, is(parallelLimit)); - } @Test @@ -728,7 +716,8 @@ public void getMaxRatioFluid_DifferentNonConsumedTest() { // Test Not enough fluid for 1 parallel importFluidBus.getImportFluids().fill(Materials.Water.getFluid(1000), true); - int fluidRatioFailure = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioFailure = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioFailure, is(0)); @@ -737,7 +726,8 @@ public void getMaxRatioFluid_DifferentNonConsumedTest() { importFluidBus.getImportFluids().fill(Materials.Water.getFluid(1000), true); secondImportFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(1), true); - IMultipleTankHandler tankHandler = new FluidTankList(false, importFluidBus.getImportFluids().getTankAt(0), secondImportFluidBus.getImportFluids().getTankAt(0)); + IMultipleTankHandler tankHandler = new FluidTankList(false, importFluidBus.getImportFluids().getTankAt(0), + secondImportFluidBus.getImportFluids().getTankAt(0)); int fluidRatio = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(tankHandler), recipe, parallelLimit); @@ -759,7 +749,6 @@ public void getMaxRatioFluid_DifferentNonConsumedTest() { recipe, parallelLimit); assertThat(secondFluidRatio, is(parallelLimit)); - } @Test @@ -786,16 +775,17 @@ public void getMaxRatioFluid_OnlyNonConsumedTest() { // Test Not enough fluid for 1 parallel importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(0), true); - int fluidRatioFailure = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioFailure = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioFailure, is(0)); - // Test Parallel Limit Exactly equal inputs importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(4), true); - int fluidRatioExact = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioExact = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioExact, is(parallelLimit)); @@ -803,12 +793,11 @@ public void getMaxRatioFluid_OnlyNonConsumedTest() { // Test Parallel Limit with > max parallels importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(2500), true); - - int secondFluidRatio = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int secondFluidRatio = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(secondFluidRatio, is(parallelLimit)); - } @Test @@ -835,16 +824,17 @@ public void getMaxRatioFluid_OnlyNonConsumedWithStacksizeTest() { // Test Not enough fluid for 1 parallel importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(500), true); - int fluidRatioFailure = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioFailure = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioFailure, is(0)); - // Test Parallel Limit Exactly equal inputs importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(500), true); - int fluidRatioExact = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioExact = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioExact, is(parallelLimit)); @@ -852,17 +842,15 @@ public void getMaxRatioFluid_OnlyNonConsumedWithStacksizeTest() { // Test Parallel Limit with > max parallels importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(2500), true); - - int secondFluidRatio = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int secondFluidRatio = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(secondFluidRatio, is(parallelLimit)); - } @Test public void doParallelRecipes_ExistingEUValueTest() { - int parallelAmount = 4; // Do not specify the EUt or duration to test how they are taken into account @@ -871,18 +859,21 @@ public void doParallelRecipes_ExistingEUValueTest() { .output(Items.CARROT) .build().getResult(); - SimpleMachineMetaTileEntityResizable macerator = MetaTileEntities.registerMetaTileEntity(1, new SimpleMachineMetaTileEntityResizable( - gregtechId("macerator"), - RecipeMaps.MACERATOR_RECIPES, - -1, - 4, - null, - GTValues.EV)); + SimpleMachineMetaTileEntityResizable macerator = MetaTileEntities.registerMetaTileEntity(1, + new SimpleMachineMetaTileEntityResizable( + gregtechId("macerator"), + RecipeMaps.MACERATOR_RECIPES, + -1, + 4, + null, + GTValues.EV)); macerator.getImportItems().setStackInSlot(0, new ItemStack(Blocks.STONE, 10)); - RecipeBuilder testMaceratorRecipe = doParallelRecipes(maceratorRecipe, RecipeMaps.MACERATOR_RECIPES, macerator.getImportItems(), - macerator.getImportFluids(), macerator.getExportItems(), macerator.getExportFluids(), parallelAmount, GTValues.V[GTValues.EV], macerator); + RecipeBuilder testMaceratorRecipe = doParallelRecipes(maceratorRecipe, RecipeMaps.MACERATOR_RECIPES, + macerator.getImportItems(), + macerator.getImportFluids(), macerator.getExportItems(), macerator.getExportFluids(), parallelAmount, + GTValues.V[GTValues.EV], macerator); assertThat(testMaceratorRecipe, notNullValue()); @@ -891,6 +882,5 @@ public void doParallelRecipes_ExistingEUValueTest() { // 150 is the default duration value assigned to macerator recipes when not specified assertThat(testMaceratorRecipe.getDuration(), is(150)); - } } diff --git a/src/test/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorageTest.java b/src/test/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorageTest.java index 8d4425973f4..e3daea5e015 100644 --- a/src/test/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorageTest.java +++ b/src/test/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorageTest.java @@ -12,6 +12,7 @@ import static org.hamcrest.CoreMatchers.is; public class RecipePropertyStorageTest { + private static final String propInt1Key = "propInt1"; private static final DefaultProperty propInt1 = new DefaultProperty<>(propInt1Key, Integer.class); @@ -49,7 +50,6 @@ public void storing_property_with_wrong_cast_fails() { MatcherAssert.assertThat(storage.store(wrongCast, "This is not int"), is(false)); } - @Test public void storing_property_without_value_fails() { MatcherAssert.assertThat(storage.store(propInt1, null), is(false)); @@ -57,23 +57,23 @@ public void storing_property_without_value_fails() { @Test public void get_size_returns_correct_value() { - storage.store(propInt1, 1); //succeeds + storage.store(propInt1, 1); // succeeds MatcherAssert.assertThat(storage.getSize(), is(1)); - storage.store(propInt2, 2); //succeeds + storage.store(propInt2, 2); // succeeds MatcherAssert.assertThat(storage.getSize(), is(2)); - storage.store(propInt1, 1); //fails + storage.store(propInt1, 1); // fails MatcherAssert.assertThat(storage.getSize(), is(2)); } @Test public void get_recipe_properties_returns_correct_value() { - storage.store(propInt1, 1); //succeeds - storage.store(propInt2, 2); //succeeds + storage.store(propInt1, 1); // succeeds + storage.store(propInt2, 2); // succeeds Map, Object> map = new HashMap<>(); map.put(propInt1, 1); @@ -83,13 +83,15 @@ public void get_recipe_properties_returns_correct_value() { Set, Object>> actualProperties = storage.getRecipeProperties(); MatcherAssert.assertThat(actualProperties.size(), is(2)); - MatcherAssert.assertThat(actualProperties.containsAll(expectedProperties) && expectedProperties.containsAll(actualProperties), is(true)); + MatcherAssert.assertThat( + actualProperties.containsAll(expectedProperties) && expectedProperties.containsAll(actualProperties), + is(true)); } @Test public void get_recipe_property_value_returns_correct_value_if_exists() { final int expectedValue = 1; - storage.store(propInt1, expectedValue); //succeeds + storage.store(propInt1, expectedValue); // succeeds int actual = storage.getRecipePropertyValue(propInt1, 0); @@ -99,7 +101,7 @@ public void get_recipe_property_value_returns_correct_value_if_exists() { @Test public void get_recipe_property_value_returns_default_value_if_does_not_exists() { final int expectedValue = 0; - storage.store(propInt1, 1); //succeeds + storage.store(propInt1, 1); // succeeds int actual = storage.getRecipePropertyValue(propInt2, expectedValue); @@ -107,10 +109,10 @@ public void get_recipe_property_value_returns_default_value_if_does_not_exists() } @Test - //CT way + // CT way public void get_recipe_property_keys() { - storage.store(propInt1, 1); //succeeds - storage.store(propInt2, 2); //succeeds + storage.store(propInt1, 1); // succeeds + storage.store(propInt2, 2); // succeeds Set expectedKeys = new HashSet<>(); expectedKeys.add(propInt1.getKey()); @@ -118,15 +120,16 @@ public void get_recipe_property_keys() { Set actualKeys = storage.getRecipePropertyKeys(); - MatcherAssert.assertThat(expectedKeys.containsAll(actualKeys) && actualKeys.containsAll(expectedKeys), is(true)); + MatcherAssert.assertThat(expectedKeys.containsAll(actualKeys) && actualKeys.containsAll(expectedKeys), + is(true)); } @Test - //CT way + // CT way public void get_raw_recipe_property_value_via_string_key() { final int expectedValue = 1; - storage.store(propInt1, expectedValue); //succeeds + storage.store(propInt1, expectedValue); // succeeds Object actualValue = storage.getRawRecipePropertyValue(propInt1.getKey()); diff --git a/src/test/java/gregtech/api/util/OreGlobTest.java b/src/test/java/gregtech/api/util/OreGlobTest.java index e76d72b1403..f9f888f02f2 100644 --- a/src/test/java/gregtech/api/util/OreGlobTest.java +++ b/src/test/java/gregtech/api/util/OreGlobTest.java @@ -8,6 +8,7 @@ import gregtech.common.covers.filter.oreglob.impl.OreGlobParser; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; import gregtech.common.covers.filter.oreglob.node.OreGlobNodes; + import org.hamcrest.Description; import org.hamcrest.TypeSafeMatcher; import org.junit.jupiter.api.BeforeAll; @@ -34,20 +35,15 @@ public void compileTest() { append( match("dust"), everything(), - match("Gold") - ), + match("Gold")), and( append( match("plate"), - everything() - ), + everything()), not(append( everything(), match("Double"), - everything() - )) - ) - )); + everything()))))); assertCompile("1^2^3^4^5^!(1^2^3)", xor( @@ -59,9 +55,7 @@ public void compileTest() { not(xor( match("1"), match("2"), - match("3") - )) - )); + match("3"))))); assertCompile("(??***)(?*?*?****?*???*?)()()()", chars(10, true)); assertCompile("(?)(??)(??*)(??**)", chars(7, true)); @@ -74,30 +68,24 @@ public void compileTest() { not(append( match("a"), match("b"), - match("c") - ))); + match("c")))); assertCompile("!(a b c)", not(append( match("a"), match("b"), - match("c") - ))); + match("c")))); assertCompile("!(a b) c", append( not(append( match("a"), - match("b") - )), - match("c") - )); + match("b"))), + match("c"))); assertCompile("(!a b) c", append( not(append( match("a"), - match("b") - )), - match("c") - )); + match("b"))), + match("c"))); assertCompile("?*", nonempty()); assertCompile("!()", nonempty()); @@ -107,29 +95,24 @@ public void compileTest() { assertCompile("!(x) !(y)", or( not(match("x")), - not(match("y")) - )); + not(match("y")))); assertCompile("(a | b | !*)", or( match("a"), - match("b") - )); + match("b"))); assertCompile("(() | () | abc)", or( empty(), - match("abc") - )); + match("abc"))); assertCompile("((a | ()) | b | ())", or( or( match("a"), - empty() - ), - match("b") - )); + empty()), + match("b"))); assertCompile("(() | !())", everything()); @@ -139,20 +122,17 @@ public void compileTest() { assertCompile("((a | ()) | ())", or( match("a"), - empty() - )); + empty())); assertCompile("(a & b & *)", and( match("a"), - match("b") - )); + match("b"))); assertCompile("(a & b & !())", and( match("a"), - match("b") - )); + match("b"))); assertCompile("(a & b & !*)", nothing()); assertCompile("(() & ?)", nothing()); diff --git a/src/test/java/gregtech/api/util/SmallDigitsTest.java b/src/test/java/gregtech/api/util/SmallDigitsTest.java index 4a535744f71..e21e88bde84 100644 --- a/src/test/java/gregtech/api/util/SmallDigitsTest.java +++ b/src/test/java/gregtech/api/util/SmallDigitsTest.java @@ -20,7 +20,8 @@ public void testNoNesting() { @Test public void testNested() { - MatcherAssert.assertThat(SmallDigits.toSmallDownNumbers("(CuAu4)(ZnCu3)Fe2(Ni(AuAgCu3)Fe3)4"), is("(CuAu₄)(ZnCu₃)Fe₂(Ni(AuAgCu₃)Fe₃)₄")); + MatcherAssert.assertThat(SmallDigits.toSmallDownNumbers("(CuAu4)(ZnCu3)Fe2(Ni(AuAgCu3)Fe3)4"), + is("(CuAu₄)(ZnCu₃)Fe₂(Ni(AuAgCu₃)Fe₃)₄")); } @Test diff --git a/src/test/java/gregtech/api/util/TierByVoltageTest.java b/src/test/java/gregtech/api/util/TierByVoltageTest.java index 9035fb8796e..b0f75d0ac86 100644 --- a/src/test/java/gregtech/api/util/TierByVoltageTest.java +++ b/src/test/java/gregtech/api/util/TierByVoltageTest.java @@ -1,6 +1,5 @@ package gregtech.api.util; - import org.junit.jupiter.api.Test; import static gregtech.api.GTValues.*; diff --git a/src/test/java/gregtech/client/I18nTest.java b/src/test/java/gregtech/client/I18nTest.java index f3d6ea1f18f..c012116a581 100644 --- a/src/test/java/gregtech/client/I18nTest.java +++ b/src/test/java/gregtech/client/I18nTest.java @@ -1,7 +1,9 @@ package gregtech.client; import gregtech.Bootstrap; + import net.minecraft.client.resources.I18n; + import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/src/test/java/gregtech/common/covers/CoverFluidRegulatorTest.java b/src/test/java/gregtech/common/covers/CoverFluidRegulatorTest.java index 037ad8e6e04..b5402ff0afa 100644 --- a/src/test/java/gregtech/common/covers/CoverFluidRegulatorTest.java +++ b/src/test/java/gregtech/common/covers/CoverFluidRegulatorTest.java @@ -3,12 +3,14 @@ import gregtech.Bootstrap; import gregtech.api.capability.impl.FluidHandlerProxy; import gregtech.api.capability.impl.FluidTankList; + import net.minecraft.util.EnumFacing; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; + import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -32,7 +34,6 @@ public static void bootstrap() { @Test public void doKeepExact_does_nothing_if_no_destination_tank_exists() { - // Create a regulator for testing with, and set it to "Keep Exact" mode CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; @@ -40,9 +41,8 @@ public void doKeepExact_does_nothing_if_no_destination_tank_exists() { FluidStack water = new FluidStack(FluidRegistry.WATER, 1234); // Source consists of only an output tank containing a bit of water - IFluidHandler source = - new FluidHandlerProxy(new FluidTankList(false), - new FluidTankList(false, new FluidTank(water.copy(), 64000))); + IFluidHandler source = new FluidHandlerProxy(new FluidTankList(false), + new FluidTankList(false, new FluidTank(water.copy(), 64000))); // Tell it to keep exact from a machine with an empty fluid tank and null target fluid tank int amountTransferred = cfr.doKeepExact(1000, source, null, isWater, 1000); @@ -58,14 +58,12 @@ public void doKeepExact_moves_one_fluid_into_an_empty_tank() { FluidStack water = new FluidStack(FluidRegistry.WATER, 1234); - IFluidHandler source = - new FluidHandlerProxy(new FluidTankList(false), - new FluidTankList(false, new FluidTank(water.copy(), 64000))); + IFluidHandler source = new FluidHandlerProxy(new FluidTankList(false), + new FluidTankList(false, new FluidTank(water.copy(), 64000))); // Dest consists of one empty input tank - IFluidHandler dest = - new FluidHandlerProxy(new FluidTankList(false, new FluidTank(64000)), - new FluidTankList(false)); + IFluidHandler dest = new FluidHandlerProxy(new FluidTankList(false, new FluidTank(64000)), + new FluidTankList(false)); // Tell it to keep exact from a machine with an empty fluid tank and no target fluid tank int amountTransferred = cfr.doKeepExact(1000, source, dest, isWater, 1000); @@ -79,14 +77,12 @@ public void doKeepExact_moves_only_as_much_fluid_as_exists_in_the_source() { CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; - IFluidHandler source = - new FluidHandlerProxy(new FluidTankList(false), - new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 1234), 64000))); + IFluidHandler source = new FluidHandlerProxy(new FluidTankList(false), + new FluidTankList(false, + new FluidTank(new FluidStack(FluidRegistry.WATER, 1234), 64000))); - IFluidHandler dest = - new FluidHandlerProxy(new FluidTankList(false, new FluidTank(64000)), - new FluidTankList(false)); + IFluidHandler dest = new FluidHandlerProxy(new FluidTankList(false, new FluidTank(64000)), + new FluidTankList(false)); int amountTransferred = cfr.doKeepExact(10000, source, dest, isWater, 10000); @@ -98,16 +94,14 @@ public void doKeepExact_moves_only_the_fluid_required_if_more_could_be_moved() { CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; - IFluidHandler source = - new FluidHandlerProxy( + IFluidHandler source = new FluidHandlerProxy( new FluidTankList(false), new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000))); + new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000))); - IFluidHandler dest = - new FluidHandlerProxy( + IFluidHandler dest = new FluidHandlerProxy( new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 100), 64000)), + new FluidTank(new FluidStack(FluidRegistry.WATER, 100), 64000)), new FluidTankList(false)); int amountTransferred = cfr.doKeepExact(10000, source, dest, isWater, 144); @@ -121,19 +115,17 @@ public void doKeepExact_moves_multiple_valid_fluids() { CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; - IFluidHandler source = - new FluidHandlerProxy( + IFluidHandler source = new FluidHandlerProxy( new FluidTankList(false), new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), - new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); + new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), + new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); // One tank with 100mB water, another with nothing - IFluidHandler dest = - new FluidHandlerProxy( + IFluidHandler dest = new FluidHandlerProxy( new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 100), 64000), - new FluidTank(64000)), + new FluidTank(new FluidStack(FluidRegistry.WATER, 100), 64000), + new FluidTank(64000)), new FluidTankList(false)); // accept any fluid this time @@ -148,8 +140,10 @@ public void doKeepExact_moves_multiple_valid_fluids() { IFluidTankProperties tank2 = dest.getTankProperties()[1]; MatcherAssert.assertThat(tank1.getContents(), notNullValue()); MatcherAssert.assertThat(tank2.getContents(), notNullValue()); - MatcherAssert.assertThat(tank1.getContents().isFluidStackIdentical(new FluidStack(FluidRegistry.WATER, 144)), is(true)); - MatcherAssert.assertThat(tank2.getContents().isFluidStackIdentical(new FluidStack(FluidRegistry.LAVA, 144)), is(true)); + MatcherAssert.assertThat(tank1.getContents().isFluidStackIdentical(new FluidStack(FluidRegistry.WATER, 144)), + is(true)); + MatcherAssert.assertThat(tank2.getContents().isFluidStackIdentical(new FluidStack(FluidRegistry.LAVA, 144)), + is(true)); } @Test @@ -159,15 +153,13 @@ public void doKeepExact_respects_transfer_limit_with_one_fluid() { cfr.transferMode = TransferMode.KEEP_EXACT; // One output tank full of water - IFluidHandler source = - new FluidHandlerProxy( + IFluidHandler source = new FluidHandlerProxy( new FluidTankList(false), new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000))); + new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000))); // One input tank with nothing in it - IFluidHandler dest = - new FluidHandlerProxy( + IFluidHandler dest = new FluidHandlerProxy( new FluidTankList(false, new FluidTank(64000)), new FluidTankList(false)); @@ -184,19 +176,17 @@ public void doKeepExact_respects_transfer_limit_with_multiple_fluids() { CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; - IFluidHandler source = - new FluidHandlerProxy( + IFluidHandler source = new FluidHandlerProxy( new FluidTankList(false), new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), - new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); + new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), + new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); // One tank with 100mB water, another with nothing - IFluidHandler dest = - new FluidHandlerProxy( + IFluidHandler dest = new FluidHandlerProxy( new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 100), 64000), - new FluidTank(64000)), + new FluidTank(new FluidStack(FluidRegistry.WATER, 100), 64000), + new FluidTank(64000)), new FluidTankList(false)); // accept any fluid this time @@ -212,19 +202,17 @@ public void doKeepExact_does_nothing_if_levels_are_already_correct_in_dest() { CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; - IFluidHandler source = - new FluidHandlerProxy( + IFluidHandler source = new FluidHandlerProxy( new FluidTankList(false), new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), - new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); + new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), + new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); // One tank with 144mB water, another with 144mB lava - IFluidHandler dest = - new FluidHandlerProxy( + IFluidHandler dest = new FluidHandlerProxy( new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 144), 64000), - new FluidTank(new FluidStack(FluidRegistry.LAVA, 144), 64000)), + new FluidTank(new FluidStack(FluidRegistry.WATER, 144), 64000), + new FluidTank(new FluidStack(FluidRegistry.LAVA, 144), 64000)), new FluidTankList(false)); // accept any fluid this time @@ -240,19 +228,17 @@ public void doKeepExact_ignores_fluids_not_in_filter() { CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; - IFluidHandler source = - new FluidHandlerProxy( + IFluidHandler source = new FluidHandlerProxy( new FluidTankList(false), new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), - new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); + new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), + new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); // One tank with 144mB water, another with 100mB lava - IFluidHandler dest = - new FluidHandlerProxy( + IFluidHandler dest = new FluidHandlerProxy( new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 144), 64000), - new FluidTank(new FluidStack(FluidRegistry.LAVA, 100), 64000)), + new FluidTank(new FluidStack(FluidRegistry.WATER, 144), 64000), + new FluidTank(new FluidStack(FluidRegistry.LAVA, 100), 64000)), new FluidTankList(false)); // accept any fluid this time diff --git a/src/test/java/gregtech/common/metatileentities/converter/ConverterTraitTest.java b/src/test/java/gregtech/common/metatileentities/converter/ConverterTraitTest.java index caa35b2a97a..48ef15749ab 100644 --- a/src/test/java/gregtech/common/metatileentities/converter/ConverterTraitTest.java +++ b/src/test/java/gregtech/common/metatileentities/converter/ConverterTraitTest.java @@ -6,10 +6,12 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; + import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -47,7 +49,8 @@ public void Test_FE_To_EU() { converter_1A.setFeToEu(true); IEnergyStorage storage = converter_1A.getCapability(CapabilityEnergy.ENERGY, EnumFacing.SOUTH); - IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, EnumFacing.NORTH); + IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + EnumFacing.NORTH); MatcherAssert.assertThat(storage, notNullValue()); MatcherAssert.assertThat(container, notNullValue()); @@ -71,7 +74,8 @@ public void Test_FE_To_EU_Off_Ratio() { converter_1A.setFeToEu(true); IEnergyStorage storage = converter_1A.getCapability(CapabilityEnergy.ENERGY, EnumFacing.SOUTH); - IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, EnumFacing.NORTH); + IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + EnumFacing.NORTH); MatcherAssert.assertThat(storage, notNullValue()); MatcherAssert.assertThat(container, notNullValue()); @@ -95,7 +99,8 @@ public void Test_Show_FE_Minimum() { converter_1A.setFeToEu(true); IEnergyStorage storage = converter_1A.getCapability(CapabilityEnergy.ENERGY, EnumFacing.SOUTH); - IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, EnumFacing.NORTH); + IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + EnumFacing.NORTH); MatcherAssert.assertThat(storage, notNullValue()); MatcherAssert.assertThat(container, notNullValue()); @@ -111,7 +116,8 @@ public void Test_EU_To_FE() { resetEnergyStorage(); converter_1A.setFeToEu(false); - IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, EnumFacing.SOUTH); + IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + EnumFacing.SOUTH); IEnergyStorage storage = converter_1A.getCapability(CapabilityEnergy.ENERGY, EnumFacing.NORTH); MatcherAssert.assertThat(container, notNullValue()); MatcherAssert.assertThat(storage, notNullValue()); @@ -135,7 +141,8 @@ public void Test_No_Energy_Loss() { resetEnergyStorage(); converter_1A.setFeToEu(false); - IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, EnumFacing.SOUTH); + IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + EnumFacing.SOUTH); IEnergyStorage storage = converter_1A.getCapability(CapabilityEnergy.ENERGY, EnumFacing.NORTH); MatcherAssert.assertThat(container, notNullValue()); MatcherAssert.assertThat(storage, notNullValue()); @@ -185,7 +192,8 @@ public void Test_Non_Identical_Ratio_Configuration() { ConfigHolder.compat.energy.euToFeRatio = 1; IEnergyStorage storage = converter_1A.getCapability(CapabilityEnergy.ENERGY, EnumFacing.SOUTH); - IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, EnumFacing.NORTH); + IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + EnumFacing.NORTH); MatcherAssert.assertThat(storage, notNullValue()); MatcherAssert.assertThat(container, notNullValue()); @@ -207,7 +215,8 @@ public void Test_Non_Identical_Ratio_Configuration() { } private static void resetEnergyStorage() { - ((ConverterTraitTestWrapper) converter_1A.getCapability(GregtechCapabilities.CAPABILITY_CONVERTER, null)).drainStorage(); + ((ConverterTraitTestWrapper) converter_1A.getCapability(GregtechCapabilities.CAPABILITY_CONVERTER, null)) + .drainStorage(); FEStorage.extractEnergy(Integer.MAX_VALUE, false); EUStorage.removeEnergy(Long.MAX_VALUE); } @@ -230,9 +239,11 @@ protected ConverterTrait initializeTrait() { public T getCapability(Capability capability, EnumFacing side) { if (side == null) return (T) converterTrait; if (isFeToEu()) { - return (T) (side == getFrontFacing() ? converterTrait.getEnergyEUContainer() : converterTrait.getEnergyFEContainer()); + return (T) (side == getFrontFacing() ? converterTrait.getEnergyEUContainer() : + converterTrait.getEnergyFEContainer()); } - return (T) (side == getFrontFacing() ? converterTrait.getEnergyFEContainer() : converterTrait.getEnergyEUContainer()); + return (T) (side == getFrontFacing() ? converterTrait.getEnergyFEContainer() : + converterTrait.getEnergyEUContainer()); } @Override diff --git a/src/test/java/gregtech/common/metatileentities/multiblock/PowerSubstationTest.java b/src/test/java/gregtech/common/metatileentities/multiblock/PowerSubstationTest.java index 6d8de9b7711..de9a1172121 100644 --- a/src/test/java/gregtech/common/metatileentities/multiblock/PowerSubstationTest.java +++ b/src/test/java/gregtech/common/metatileentities/multiblock/PowerSubstationTest.java @@ -3,6 +3,7 @@ import gregtech.Bootstrap; import gregtech.api.metatileentity.multiblock.IBatteryData; import gregtech.common.metatileentities.multi.electric.MetaTileEntityPowerSubstation.PowerStationEnergyBank; + import org.hamcrest.Matcher; import org.hamcrest.MatcherAssert; import org.jetbrains.annotations.NotNull; diff --git a/src/test/java/gregtech/common/metatileentities/multiblock/hpca/HPCATest.java b/src/test/java/gregtech/common/metatileentities/multiblock/hpca/HPCATest.java index 59c2cce0c07..3542313a3f0 100644 --- a/src/test/java/gregtech/common/metatileentities/multiblock/hpca/HPCATest.java +++ b/src/test/java/gregtech/common/metatileentities/multiblock/hpca/HPCATest.java @@ -3,6 +3,7 @@ import gregtech.Bootstrap; import gregtech.common.metatileentities.multi.electric.MetaTileEntityHPCA.HPCAGridHandler; import gregtech.common.metatileentities.multiblock.hpca.helper.HPCAHelper; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -38,7 +39,7 @@ public void Test_Edge_No_Computation() { assertThat(maxCWUt, is(0)); assertThat(upkeepEUt, is(32 * 4)); - assertThat(maxEUt, is (128 * 4)); + assertThat(maxEUt, is(128 * 4)); assertThat(maxCoolingDemand, is(0)); assertThat(maxCoolingAmount, is(4 * 4)); diff --git a/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAHelper.java b/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAHelper.java index 9dbfc5e14fa..aa87f9254e8 100644 --- a/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAHelper.java +++ b/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAHelper.java @@ -16,7 +16,8 @@ public static HPCAGridHandler gridBuilder(UnaryOperator b) { return b.apply(new GridHandlerBuilder()).build(); } - public static IHPCAComputationProvider getComputation(int cwuPerTick, int coolingPerTick, int upkeepEUt, int maxEUt) { + public static IHPCAComputationProvider getComputation(int cwuPerTick, int coolingPerTick, int upkeepEUt, + int maxEUt) { return new HPCAComputationProviderTestImpl(upkeepEUt, maxEUt, cwuPerTick, coolingPerTick); } diff --git a/src/test/java/gregtech/common/metatileentities/storage/QuantumChestTest.java b/src/test/java/gregtech/common/metatileentities/storage/QuantumChestTest.java index 1ed28f5ea5e..6172b07d901 100644 --- a/src/test/java/gregtech/common/metatileentities/storage/QuantumChestTest.java +++ b/src/test/java/gregtech/common/metatileentities/storage/QuantumChestTest.java @@ -4,12 +4,14 @@ import gregtech.api.GTValues; import gregtech.api.util.GTUtility; import gregtech.api.util.world.DummyWorld; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -21,6 +23,7 @@ import static org.hamcrest.MatcherAssert.assertThat; public class QuantumChestTest { + private static ItemStack GRAVEL; private static ItemStack SAND; @@ -55,7 +58,8 @@ public void Test_Single_Insertion() { insertItem(combinedInventory, GRAVEL.copy(), false); int expected = 64; stack = exportItems.getStackInSlot(0); - reason = String.format("Got %d in the export slot when it should be %d", exportItems.getStackInSlot(0).getCount(), expected); + reason = String.format("Got %d in the export slot when it should be %d", + exportItems.getStackInSlot(0).getCount(), expected); assertThat(reason, stack.getCount(), is(expected)); stack = insertItem(combinedInventory, GRAVEL.copy(), true); @@ -64,7 +68,8 @@ public void Test_Single_Insertion() { insertItem(combinedInventory, GRAVEL.copy(), false); stack = virtualInventory.getStackInSlot(0); - reason = String.format("Got %d in the virtualized inventory when it should be %d", stack.getCount(), expected); + reason = String.format("Got %d in the virtualized inventory when it should be %d", stack.getCount(), + expected); assertThat(reason, stack.getCount(), is(expected)); stack = importItems.insertItem(0, SAND.copy(), true); @@ -76,7 +81,8 @@ public void Test_Single_Insertion() { assertThat(reason, !stack.isEmpty() && stack.isItemEqual(SAND)); stack = virtualInventory.getStackInSlot(0); - reason = String.format("Got %d in the virtualized inventory when it should be %d", stack.getCount(), expected); + reason = String.format("Got %d in the virtualized inventory when it should be %d", stack.getCount(), + expected); assertThat(reason, stack.getCount(), is(expected)); } } @@ -91,12 +97,15 @@ public void Test_Stack_In_Slot() { expected = 64; int exportCount = quantumChest.getExportItems().getStackInSlot(0).getCount(); - String reason = String.format("The combined count using the chest's handler and the export slot got %d, should've been %d", exportCount, expected); + String reason = String.format( + "The combined count using the chest's handler and the export slot got %d, should've been %d", + exportCount, expected); assertThat(reason, exportCount, is(expected)); expected = 192; int virtualizedAmount = itemInventory.getStackInSlot(0).getCount(); - reason = String.format("The virtualized amount in the chest's handler got %d, should've been %d", exportCount, expected); + reason = String.format("The virtualized amount in the chest's handler got %d, should've been %d", + exportCount, expected); assertThat(reason, virtualizedAmount, is(expected)); } } @@ -114,9 +123,9 @@ public void Test_Export_Checking() { insertItem(itemHandler, GRAVEL.copy(), false); - String reason = "The virtualized stack is not the same as the export slot!"; - boolean isEqual = ItemStack.areItemsEqual(export, quantumChest.virtualItemStack) && export.getMetadata() == quantumChest.virtualItemStack.getMetadata(); + boolean isEqual = ItemStack.areItemsEqual(export, quantumChest.virtualItemStack) && + export.getMetadata() == quantumChest.virtualItemStack.getMetadata(); assertThat(reason, isEqual, is(true)); } } @@ -186,9 +195,11 @@ public void Test_Voiding() { insertItem(quantumChest.getCombinedInventory(), stack, false); // UHV qchest stores exactly Integer.MAX_VALUE, so it will be 64 items less than expected - long transferred = quantumChest.getTier() == GTValues.UHV ? quantumChest.itemsStoredInside + 64 : quantumChest.itemsStoredInside; + long transferred = quantumChest.getTier() == GTValues.UHV ? quantumChest.itemsStoredInside + 64 : + quantumChest.itemsStoredInside; - assertThat(String.format("%s voided %s too early!", quantumChest.getMetaFullName(), stack), transferred == quantumChest.maxStoredItems); + assertThat(String.format("%s voided %s too early!", quantumChest.getMetaFullName(), stack), + transferred == quantumChest.maxStoredItems); quantumChest.setVoiding(true); ItemStack remainder = insertItem(quantumChest.getItemInventory(), stack, false); @@ -209,7 +220,8 @@ public void Test_Extraction() { int extractedCount = testAllSlots(quantumChest.getExportItems(), true); int expected = 64; - String reason = String.format("Quantum chest failed to insert %d items into export slot, actually was %d!", expected, extractedCount); + String reason = String.format("Quantum chest failed to insert %d items into export slot, actually was %d!", + expected, extractedCount); assertThat(reason, extractedCount, is(expected)); quantumChest.getExportItems().extractItem(0, 64, false); @@ -232,7 +244,8 @@ private static QuantumChestWrapper[] createInstances() { QuantumChestWrapper[] quantumChests = new QuantumChestWrapper[10]; for (int i = 0; i < 5; i++) { String voltageName = GTValues.VN[i + 1].toLowerCase(); - quantumChests[i] = new QuantumChestWrapper(gregtechId("super_chest." + voltageName), i + 1, 4000000L * (int) Math.pow(2, i)); + quantumChests[i] = new QuantumChestWrapper(gregtechId("super_chest." + voltageName), i + 1, + 4000000L * (int) Math.pow(2, i)); } for (int i = 5; i < quantumChests.length; i++) { @@ -252,6 +265,7 @@ private static int testAllSlots(IItemHandler handler, boolean simulate) { } private static class QuantumChestWrapper extends MetaTileEntityQuantumChest { + public QuantumChestWrapper(ResourceLocation metaTileEntityId, int tier, long maxStoredItems) { super(metaTileEntityId, tier, maxStoredItems); } diff --git a/src/test/java/gregtech/common/metatileentities/storage/QuantumTankTest.java b/src/test/java/gregtech/common/metatileentities/storage/QuantumTankTest.java index b2ae0c6c021..f79406525e5 100644 --- a/src/test/java/gregtech/common/metatileentities/storage/QuantumTankTest.java +++ b/src/test/java/gregtech/common/metatileentities/storage/QuantumTankTest.java @@ -2,6 +2,7 @@ import gregtech.Bootstrap; import gregtech.api.GTValues; + import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; @@ -9,6 +10,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.capability.IFluidHandler; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -24,6 +26,7 @@ public class QuantumTankTest { private static FluidStack LAVA; private static ItemStack BUCKET_WATER; private static ItemStack BUCKET_LAVA; + @BeforeAll public static void bootstrap() { Bootstrap.perform(); @@ -65,7 +68,8 @@ public void Test_Voiding() { FluidStack resource = WATER.copy(); resource.amount = Integer.MAX_VALUE; int inserted = handler.fill(resource, true); - assertThat("Quantum Tank accepted too much fluid!", inserted == handler.getTankProperties()[0].getCapacity()); + assertThat("Quantum Tank accepted too much fluid!", + inserted == handler.getTankProperties()[0].getCapacity()); quantumTank.setVoiding(true); inserted = handler.fill(resource, true); @@ -100,7 +104,8 @@ private QuantumTankWrapper[] createInstances() { QuantumTankWrapper[] quantumTanks = new QuantumTankWrapper[10]; for (int i = 0; i < 5; i++) { String voltageName = GTValues.VN[i + 1].toLowerCase(); - quantumTanks[i] = new QuantumTankWrapper(gregtechId("super_tank." + voltageName), i + 1, 4000000 * (int) Math.pow(2, i)); + quantumTanks[i] = new QuantumTankWrapper(gregtechId("super_tank." + voltageName), i + 1, + 4000000 * (int) Math.pow(2, i)); } for (int i = 5; i < quantumTanks.length; i++) { @@ -141,14 +146,16 @@ private void fakeUpdate(boolean isRemote) { if (currentFluid == null) { // tank had fluid, but now is empty updatePreviousFluid(null); - } else if (previousFluid.getFluid().equals(currentFluid.getFluid()) && previousFluid.amount != currentFluid.amount) { - // tank has fluid with changed amount - previousFluid.amount = currentFluid.amount; - writeCustomData(UPDATE_FLUID_AMOUNT, buf -> buf.writeInt(currentFluid.amount)); - } else if (!previousFluid.equals(currentFluid)) { - // tank has a different fluid from before - updatePreviousFluid(currentFluid); - } + } else if (previousFluid.getFluid().equals(currentFluid.getFluid()) && + previousFluid.amount != currentFluid.amount) { + // tank has fluid with changed amount + previousFluid.amount = currentFluid.amount; + writeCustomData(UPDATE_FLUID_AMOUNT, buf -> buf.writeInt(currentFluid.amount)); + } else + if (!previousFluid.equals(currentFluid)) { + // tank has a different fluid from before + updatePreviousFluid(currentFluid); + } } } }