Compare commits
62 Commits
v0.56.1
...
rv3.alpha.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 15993eb3c7 | |||
| 48d1a5aa88 | |||
| 3826b3b51f | |||
| 7833ff5eab | |||
| 6f5a2888c0 | |||
| 1a38e5ba94 | |||
| ff3e51018f | |||
| 65c47d4c4e | |||
| d7486fec3c | |||
| 796b6dc7a2 | |||
| 67b261cc7c | |||
| 3fb3f70392 | |||
| 49321d72c1 | |||
| 62fb0dc7f7 | |||
| e9e9535f2a | |||
| ab9f4e7fd7 | |||
| 1080b65404 | |||
| c823e1464b | |||
| 4ba722cb51 | |||
| 91b8d30a15 | |||
| 3e6231492e | |||
| 1c2df4f380 | |||
| 3f013c8d1d | |||
| 4e46dc08af | |||
| f5e3ae8949 | |||
| b2c31e20b2 | |||
| cd0aec123d | |||
| 3844f3af87 | |||
| 1cc118c927 | |||
| afd1d4e21e | |||
| 77597973e7 | |||
| 4acec30a66 | |||
| ab32b2b357 | |||
| 8b7aea9f14 | |||
| db4a6c6cc0 | |||
| c6383f21c5 | |||
| 85de600d16 | |||
| 944f434993 | |||
| 6b47bf3ce8 | |||
| 60aa74d19f | |||
| e5f59e0a00 | |||
| 2ba4f312d4 | |||
| 2274ca79e4 | |||
| a75dee0d08 | |||
| 349ac7e0a0 | |||
| b5d0db493b | |||
| 256c0258bb | |||
| 73ffbb268a | |||
| 69299a6b1d | |||
| d1e4ea6579 | |||
| f0bf72bc34 | |||
| 7fc538fc99 | |||
| acc3bb6a29 | |||
| 71ce42f26a | |||
| cb013cf55b | |||
| 57836848ae | |||
| 53c4529d7a | |||
| e3a0b34767 | |||
| 5aaaeb6d42 | |||
| e1ff0fe5ef | |||
| 86e5d6f5da | |||
| 05f90760f2 |
@@ -100,6 +100,7 @@ sourceSets {
|
||||
srcDir "src/main/resources/"
|
||||
include "assets/appliedenergistics2/recipes/*.recipe",
|
||||
"assets/appliedenergistics2/recipes/README.html",
|
||||
"assets/appliedenergistics2/oredict/*.oredict",
|
||||
"assets/appliedenergistics2/lang/*.lang",
|
||||
"assets/appliedenergistics2/textures/blocks/*",
|
||||
"assets/appliedenergistics2/textures/guis/*",
|
||||
|
||||
Binary file not shown.
@@ -1,10 +0,0 @@
|
||||
#Organize Import Order
|
||||
#Thu Oct 09 12:52:21 CEST 2014
|
||||
6=
|
||||
5=cpw
|
||||
4=net
|
||||
3=io
|
||||
2=org
|
||||
1=com
|
||||
0=java
|
||||
7=appeng
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles version="12">
|
||||
<profile kind="CodeFormatterProfile" name="Algo" version="12">
|
||||
<profile kind="CodeFormatterProfile" name="AE2" version="12">
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="do not insert"/>
|
||||
@@ -22,7 +22,7 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||
@@ -37,13 +37,13 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||
@@ -72,14 +72,14 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||
@@ -96,7 +96,7 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="0"/>
|
||||
@@ -106,7 +106,7 @@
|
||||
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||
@@ -122,13 +122,13 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="insert"/>
|
||||
@@ -138,7 +138,7 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line"/>
|
||||
@@ -147,7 +147,7 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||
@@ -182,7 +182,7 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line"/>
|
||||
@@ -215,7 +215,7 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="insert"/>
|
||||
@@ -231,7 +231,7 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="insert"/>
|
||||
@@ -267,8 +267,8 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="insert"/>
|
||||
@@ -283,13 +283,13 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="160"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="do not insert"/>
|
||||
</profile>
|
||||
</profiles>
|
||||
@@ -0,0 +1,11 @@
|
||||
#Organize Import Order
|
||||
#Sat Jun 13 15:22:41 CEST 2015
|
||||
8=appeng
|
||||
7=
|
||||
6=cpw
|
||||
5=net
|
||||
4=io
|
||||
3=org
|
||||
2=com
|
||||
1=javax
|
||||
0=java
|
||||
+11
-11
@@ -1,5 +1,5 @@
|
||||
aeversion=rv2
|
||||
aechannel=stable
|
||||
aeversion=rv3
|
||||
aechannel=alpha
|
||||
aebuild=0
|
||||
aegroup=appeng
|
||||
aebasename=appliedenergistics2
|
||||
@@ -8,15 +8,15 @@ aebasename=appliedenergistics2
|
||||
# Versions #
|
||||
#########################################################
|
||||
minecraft_version=1.7.10
|
||||
forge_version=10.13.2.1291
|
||||
forge_version=10.13.4.1448-1.7.10
|
||||
|
||||
#########################################################
|
||||
# Installable #
|
||||
#########################################################
|
||||
waila_version=1.5.10
|
||||
jabba_version=1.2.1a
|
||||
enderstorage_version=1.4.7.33
|
||||
translocator_version=1.1.1.14
|
||||
enderstorage_version=1.4.7.36
|
||||
translocator_version=1.1.2.15
|
||||
ic2_version=2.2.717
|
||||
enderio_version=2.3.0.375_beta
|
||||
#cofhlib_version=1.0.1-157
|
||||
@@ -29,12 +29,12 @@ invtweaks_version=1.58
|
||||
#########################################################
|
||||
# Provided APIs #
|
||||
#########################################################
|
||||
fmp_version=1.1.1.324
|
||||
code_chicken_lib_version=1.1.3.127
|
||||
code_chicken_core_version=1.0.4.35
|
||||
nei_version=1.0.4.90
|
||||
bc_version=6.4.6
|
||||
opencomputers_version=1.5.9.21
|
||||
fmp_version=1.2.0.345
|
||||
code_chicken_lib_version=1.1.3.138
|
||||
code_chicken_core_version=1.0.7.46
|
||||
nei_version=1.0.5.111
|
||||
bc_version=7.0.9
|
||||
opencomputers_version=1.5.12.26
|
||||
|
||||
#########################################################
|
||||
# Self Compiled APIs #
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
@@ -55,6 +56,11 @@ repositories {
|
||||
url = "http://maven.cil.li/"
|
||||
}
|
||||
|
||||
ivy {
|
||||
name "BuildCraft"
|
||||
artifactPattern "http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision]-[classifier].[ext]"
|
||||
}
|
||||
|
||||
// CurseForge DNS for TE is not available or I am just being unlucky, code part can stay since this is applicable to any other curseforge mod though
|
||||
// ivy {
|
||||
// name = "CoFHLib"
|
||||
|
||||
@@ -1,11 +1,34 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 - 2015 AlgorithmX2
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.definitions;
|
||||
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
public interface IItemDefinition extends IComparableDefinition
|
||||
{
|
||||
@@ -18,4 +41,9 @@ public interface IItemDefinition extends IComparableDefinition
|
||||
* @return an {@link ItemStack} with specified quantity of this item.
|
||||
*/
|
||||
Optional<ItemStack> maybeStack( int stackSize );
|
||||
|
||||
/**
|
||||
* @return <tt>true</tt> if definition is enabled
|
||||
*/
|
||||
boolean isEnabled();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
package appeng.api.features;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
@@ -12,22 +17,26 @@ import net.minecraft.item.ItemStack;
|
||||
* Lets you manipulate Inscriber Recipes, by adding or editing existing ones.
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @version rv3
|
||||
* @since rv2
|
||||
*/
|
||||
public interface IInscriberRegistry
|
||||
{
|
||||
/**
|
||||
* Current list of registered recipes, you can modify this if you want too.
|
||||
* Will never contain a null recipe
|
||||
* An immutable copy of currently registered recipes.
|
||||
*
|
||||
* Use the provided methods to actually modify the inscriber recipes.
|
||||
*
|
||||
* @see IInscriberRegistry#addRecipe(IInscriberRecipe)
|
||||
* @see IInscriberRegistry#removeRecipe(IInscriberRecipe)
|
||||
*
|
||||
* @return currentlyRegisteredRecipes
|
||||
*/
|
||||
@Nonnull
|
||||
List<IInscriberRecipe> getRecipes();
|
||||
Collection<IInscriberRecipe> getRecipes();
|
||||
|
||||
/**
|
||||
* Optional items which are used in the top or bottom slot
|
||||
* Optional items which are used in the top or bottom slot.
|
||||
*
|
||||
* @return set of all optional items
|
||||
*/
|
||||
@@ -35,7 +44,7 @@ public interface IInscriberRegistry
|
||||
Set<ItemStack> getOptionals();
|
||||
|
||||
/**
|
||||
* Get all registered items which are valid inputs
|
||||
* Get all registered items which are valid inputs.
|
||||
*
|
||||
* @return set of all input items
|
||||
*/
|
||||
@@ -43,7 +52,7 @@ public interface IInscriberRegistry
|
||||
Set<ItemStack> getInputs();
|
||||
|
||||
/**
|
||||
* Extensible way to create an inscriber recipe
|
||||
* Extensible way to create an inscriber recipe.
|
||||
*
|
||||
* @return builder for inscriber recipes
|
||||
*/
|
||||
@@ -61,9 +70,10 @@ public interface IInscriberRegistry
|
||||
void addRecipe( IInscriberRecipe recipe );
|
||||
|
||||
/**
|
||||
* Removes a recipe from the registry
|
||||
* Removes all equal recipes from the registry.
|
||||
*
|
||||
* @param toBeRemovedRecipe to be removed recipe, can be null, makes just no sense
|
||||
* @param toBeRemovedRecipe to be removed recipe, can be null, makes just no sense.
|
||||
*/
|
||||
void removeRecipe( IInscriberRecipe toBeRemovedRecipe );
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
* Copyright (c) 2013 - 2015 AlgorithmX2
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -24,10 +24,12 @@
|
||||
package appeng.api.features;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
|
||||
/**
|
||||
* Maintains a save specific list of userids and username combinations this greatly simplifies storage internally and
|
||||
@@ -55,5 +57,6 @@ public interface IPlayerRegistry
|
||||
*
|
||||
* @return PlayerEntity, or null if the player could not be found.
|
||||
*/
|
||||
@Nullable
|
||||
EntityPlayer findPlayer( int playerID );
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
* Copyright (c) 2013 - 2015 AlgorithmX2
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -94,7 +94,7 @@ public interface IFacadePart
|
||||
|
||||
int getItemDamage();
|
||||
|
||||
boolean isBC();
|
||||
boolean notAEFacade();
|
||||
|
||||
void setThinFacades( boolean useThinFacades );
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
* Copyright (c) 2013 - 2015 AlgorithmX2
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -24,6 +24,8 @@
|
||||
package appeng.api.parts;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
//@formatter:off
|
||||
@@ -63,5 +65,6 @@ public interface IPartItem
|
||||
*
|
||||
* @return part from item
|
||||
*/
|
||||
@Nullable
|
||||
IPart createPartFromItemStack( ItemStack is );
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ import appeng.client.texture.FlippableIcon;
|
||||
import appeng.client.texture.MissingIcon;
|
||||
import appeng.core.features.AEBlockFeatureHandler;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.FeatureNameExtractor;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
|
||||
@@ -50,8 +50,10 @@ import appeng.api.implementations.items.MemoryCardMessages;
|
||||
import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AETileBlockFeatureHandler;
|
||||
import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
@@ -88,8 +90,6 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
|
||||
protected void setTileEntity( Class<? extends TileEntity> c )
|
||||
{
|
||||
this.tileEntityType = c;
|
||||
|
||||
AEBaseTile.registerTileItem( c, new ItemStackSrc( this, 0 ) );
|
||||
this.isInventory = IInventory.class.isAssignableFrom( c );
|
||||
this.setTileProvider( this.hasBlockTileEntity() );
|
||||
}
|
||||
@@ -288,7 +288,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
|
||||
return false;
|
||||
}
|
||||
|
||||
if( is.getItem() instanceof IMemoryCard )
|
||||
if( is.getItem() instanceof IMemoryCard && !( this instanceof BlockCableBus ) )
|
||||
{
|
||||
final IMemoryCard memoryCard = (IMemoryCard) is.getItem();
|
||||
if( player.isSneaking() )
|
||||
|
||||
@@ -38,7 +38,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderQuartzTorch;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
@@ -53,7 +52,6 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
{
|
||||
super( Material.circuits );
|
||||
|
||||
this.setLightLevel( 0.9375F );
|
||||
this.setLightOpacity( 0 );
|
||||
this.isFullSize = false;
|
||||
this.isOpaque = false;
|
||||
|
||||
@@ -25,14 +25,12 @@ import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
@@ -41,7 +39,6 @@ import appeng.client.render.effects.LightningFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.MetaRotation;
|
||||
import appeng.tile.misc.TileQuartzGrowthAccelerator;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -144,14 +141,14 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* TODO: remove with 1.8 or later
|
||||
*
|
||||
* @Deprecated no longer true, only kept to prevent missing blocks.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean usesMetadata()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable( final IBlockAccess w, final int x, final int y, final int z )
|
||||
{
|
||||
return new MetaRotation( w, x, y, z );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -43,8 +43,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.helpers.LocationRotation;
|
||||
import appeng.helpers.NullRotation;
|
||||
import appeng.util.Platform;
|
||||
@@ -118,7 +118,7 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock
|
||||
super.onBlockAdded( w, x, y, z );
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
WorldSettings.getInstance().getCompass().updateArea( w, x, y, z );
|
||||
WorldData.instance().compassData().service().updateArea( w, x, y, z );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock
|
||||
super.breakBlock( w, x, y, z, b, metadata );
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
WorldSettings.getInstance().getCompass().updateArea( w, x, y, z );
|
||||
WorldData.instance().compassData().service().updateArea( w, x, y, z );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -21,7 +21,6 @@ package appeng.block.solids;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -30,7 +29,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
@@ -63,12 +61,6 @@ public class OreQuartz extends AEBaseBlock
|
||||
return RenderQuartzOre.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( this ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMixedBrightnessForBlock( IBlockAccess par1iBlockAccess, int par2, int par3, int par4 )
|
||||
{
|
||||
|
||||
@@ -76,8 +76,8 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
private final static int CANCEL_HEIGHT = 20;
|
||||
private final static int CANCEL_WIDTH = 50;
|
||||
|
||||
private final static int ETA_TOP_OFFSET = 165;
|
||||
private final static int ETA_LEFT_OFFSET = 8;
|
||||
private final static int TITLE_TOP_OFFSET = 7;
|
||||
private final static int TITLE_LEFT_OFFSET = 8;
|
||||
|
||||
private final static int ITEMSTACK_LEFT_OFFSET = 9;
|
||||
private final static int ITEMSTACK_TOP_OFFSET = 22;
|
||||
@@ -192,18 +192,18 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
@Override
|
||||
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
|
||||
{
|
||||
ReadableNumberConverter converter = ReadableNumberConverter.INSTANCE;
|
||||
final ReadableNumberConverter converter = ReadableNumberConverter.INSTANCE;
|
||||
String title = this.getGuiDisplayName( GuiText.CraftingStatus.getLocal() );
|
||||
|
||||
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.CraftingStatus.getLocal() ), 8, 7, TEXT_COLOR );
|
||||
|
||||
if( this.craftingCpu.eta > 0 )
|
||||
if( this.craftingCpu.eta > 0 && !this.visual.isEmpty() )
|
||||
{
|
||||
final String etaText = this.getGuiDisplayName( GuiText.ETA.getLocal() );
|
||||
final long etaInMilliseconds = TimeUnit.MILLISECONDS.convert( this.craftingCpu.eta, TimeUnit.NANOSECONDS );
|
||||
final String etaTimeText = DurationFormatUtils.formatDuration( etaInMilliseconds, this.getGuiDisplayName( GuiText.ETAFormat.getLocal() ) );
|
||||
this.fontRendererObj.drawString( String.format( etaText, etaTimeText ), ETA_LEFT_OFFSET, ETA_TOP_OFFSET, TEXT_COLOR );
|
||||
final String etaTimeText = DurationFormatUtils.formatDuration( etaInMilliseconds, GuiText.ETAFormat.getLocal() );
|
||||
title += " - " + etaTimeText;
|
||||
}
|
||||
|
||||
this.fontRendererObj.drawString( title, TITLE_LEFT_OFFSET, TITLE_TOP_OFFSET, TEXT_COLOR );
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
final int viewStart = this.myScrollBar.getCurrentScroll() * 3;
|
||||
|
||||
@@ -45,7 +45,7 @@ import appeng.client.me.ClientDCInternalInv;
|
||||
import appeng.client.me.SlotDisconnected;
|
||||
import appeng.container.implementations.ContainerInterfaceTerminal;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.parts.reporting.PartMonitor;
|
||||
import appeng.parts.reporting.PartInterfaceTerminal;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
|
||||
private boolean refreshList = false;
|
||||
private MEGuiTextField searchField;
|
||||
|
||||
public GuiInterfaceTerminal( InventoryPlayer inventoryPlayer, PartMonitor te )
|
||||
public GuiInterfaceTerminal( InventoryPlayer inventoryPlayer, PartInterfaceTerminal te )
|
||||
{
|
||||
super( new ContainerInterfaceTerminal( inventoryPlayer, te ) );
|
||||
this.myScrollBar = new GuiScrollbar();
|
||||
|
||||
@@ -62,6 +62,7 @@ import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.parts.reporting.AbstractPartTerminal;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
import appeng.tile.misc.TileSecurity;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
@@ -139,7 +140,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
{
|
||||
this.myName = GuiText.Chest;
|
||||
}
|
||||
else if( te instanceof PartTerminal )
|
||||
else if( te instanceof AbstractPartTerminal )
|
||||
{
|
||||
this.myName = GuiText.Terminal;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -21,6 +21,7 @@ package appeng.client.render;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -164,6 +165,7 @@ public class BusRenderer implements IItemRenderer
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IPart getRenderer( ItemStack is, IPartItem c )
|
||||
{
|
||||
int id = ( Item.getIdFromItem( is.getItem() ) << Platform.DEF_OFFSET ) | is.getItemDamage();
|
||||
|
||||
@@ -20,6 +20,7 @@ package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -73,7 +74,7 @@ public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, Tile
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/models/compass.png" );
|
||||
@@ -167,7 +168,7 @@ public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, Tile
|
||||
this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
|
||||
}
|
||||
|
||||
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
|
||||
@@ -192,8 +193,9 @@ public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, Tile
|
||||
return;
|
||||
}
|
||||
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
GL11.glCullFace( GL11.GL_FRONT );
|
||||
|
||||
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/models/compass.png" );
|
||||
|
||||
@@ -234,7 +236,8 @@ public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, Tile
|
||||
this.model.renderAll( ( now / 500000.0f ) * (float) Math.PI * 500.0f );
|
||||
}
|
||||
|
||||
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glCullFace( GL11.GL_BACK );
|
||||
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
|
||||
|
||||
@@ -99,8 +99,6 @@ public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
|
||||
@Override
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
BlockQuartzTorch blk = (BlockQuartzTorch) block;
|
||||
|
||||
IOrientable te = ( (IOrientableBlock) block ).getOrientable( world, x, y, z );
|
||||
|
||||
float Point2 = 6.0f / 16.0f;
|
||||
@@ -149,19 +147,19 @@ public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
}
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( Blocks.hopper.getIcon( 0, 0 ) );
|
||||
block.getRendererInstance().setTemporaryRenderIcon( Blocks.hopper.getIcon( 0, 0 ) );
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff );
|
||||
boolean out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
boolean out = renderer.renderStandardBlock( block, x, y, z );
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point12 + zOff, Point13 + xOff, top + yOff, Point13 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point3 + zOff, Point3 + xOff, top + yOff, Point12 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
|
||||
renderer.setRenderBounds( Point12 + xOff, bottom + yOff, Point3 + zOff, Point13 + xOff, top + yOff, Point12 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
|
||||
if( te != null )
|
||||
{
|
||||
@@ -170,46 +168,46 @@ public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
|
||||
{
|
||||
case EAST:
|
||||
renderer.setRenderBounds( 0, bottom + yOff, bottom + zOff, Point2 + xOff, top + yOff, top + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
break;
|
||||
case WEST:
|
||||
renderer.setRenderBounds( Point13 + xOff, bottom + yOff, bottom + zOff, 1.0, top + yOff, top + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.setRenderBounds( bottom + xOff, bottom + yOff, Point13 + zOff, top + xOff, top + yOff, 1.0 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.setRenderBounds( bottom + xOff, bottom + yOff, 0, top + xOff, top + yOff, Point2 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
break;
|
||||
case UP:
|
||||
renderer.setRenderBounds( Point2, 0, Point2, Point3, bottom + yOff, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
renderer.setRenderBounds( Point2, 0, Point12, Point3, bottom + yOff, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
renderer.setRenderBounds( Point12, 0, Point2, Point13, bottom + yOff, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
renderer.setRenderBounds( Point12, 0, Point12, Point13, bottom + yOff, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.setRenderBounds( Point2, top + yOff, Point2, Point3, 1.0, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
renderer.setRenderBounds( Point2, top + yOff, Point12, Point3, 1.0, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
renderer.setRenderBounds( Point12, top + yOff, Point2, Point13, 1.0, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
renderer.setRenderBounds( Point12, top + yOff, Point12, Point13, 1.0, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -47,13 +47,13 @@ public enum CableBusTextures
|
||||
|
||||
PartPatternTerm_Bright( "PartPatternTerm_Bright" ), PartPatternTerm_Colored( "PartPatternTerm_Colored" ), PartPatternTerm_Dark( "PartPatternTerm_Dark" ),
|
||||
|
||||
PartConversionMonitor_Bright( "PartConversionMonitor_Bright" ), PartConversionMonitor_Colored( "PartConversionMonitor_Colored" ), PartConversionMonitor_Dark( "PartConversionMonitor_Dark" ),
|
||||
PartConversionMonitor_Bright( "PartConversionMonitor_Bright" ), PartConversionMonitor_Colored( "PartConversionMonitor_Colored" ), PartConversionMonitor_Dark( "PartConversionMonitor_Dark" ), PartConversionMonitor_Dark_Locked( "PartConversionMonitor_Dark_Locked" ),
|
||||
|
||||
PartInterfaceTerm_Bright( "PartInterfaceTerm_Bright" ), PartInterfaceTerm_Colored( "PartInterfaceTerm_Colored" ), PartInterfaceTerm_Dark( "PartInterfaceTerm_Dark" ),
|
||||
|
||||
PartCraftingTerm_Bright( "PartCraftingTerm_Bright" ), PartCraftingTerm_Colored( "PartCraftingTerm_Colored" ), PartCraftingTerm_Dark( "PartCraftingTerm_Dark" ), //
|
||||
|
||||
PartStorageMonitor_Bright( "PartStorageMonitor_Bright" ), PartStorageMonitor_Colored( "PartStorageMonitor_Colored" ), PartStorageMonitor_Dark( "PartStorageMonitor_Dark" ),
|
||||
PartStorageMonitor_Bright( "PartStorageMonitor_Bright" ), PartStorageMonitor_Colored( "PartStorageMonitor_Colored" ), PartStorageMonitor_Dark( "PartStorageMonitor_Dark" ), PartStorageMonitor_Colored_Locked( "PartStorageMonitor_Colored_Locked" ),
|
||||
|
||||
PartTerminal_Bright( "PartTerminal_Bright" ), PartTerminal_Colored( "PartTerminal_Colored" ), PartTerminal_Dark( "PartTerminal_Dark" ),
|
||||
|
||||
|
||||
@@ -140,6 +140,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
{
|
||||
this.monitor = null;
|
||||
this.cpuName = "";
|
||||
this.eta = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import appeng.helpers.IInterfaceHost;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.parts.misc.PartInterface;
|
||||
import appeng.parts.reporting.PartMonitor;
|
||||
import appeng.parts.reporting.PartInterfaceTerminal;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
@@ -67,7 +67,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
IGrid grid;
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
public ContainerInterfaceTerminal( InventoryPlayer ip, PartMonitor anchor )
|
||||
public ContainerInterfaceTerminal( InventoryPlayer ip, PartInterfaceTerminal anchor )
|
||||
{
|
||||
super( ip, anchor );
|
||||
|
||||
@@ -419,7 +419,6 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class PatternInvSlot extends WrapperInvSlot
|
||||
{
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ import appeng.core.crash.ModCrashEnhancement;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.server.AECommand;
|
||||
@@ -187,16 +188,16 @@ public final class AppEng
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void serverStopping( FMLServerStoppingEvent event )
|
||||
private void serverAboutToStart( FMLServerAboutToStartEvent evt )
|
||||
{
|
||||
WorldSettings.getInstance().shutdown();
|
||||
TickHandler.INSTANCE.shutdown();
|
||||
WorldData.onServerAboutToStart();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void serverAboutToStart( FMLServerAboutToStartEvent evt )
|
||||
private void serverStopping( FMLServerStoppingEvent event )
|
||||
{
|
||||
WorldSettings.getInstance().init();
|
||||
WorldData.instance().onServerStopping();
|
||||
TickHandler.INSTANCE.shutdown();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.google.common.base.Preconditions;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import appeng.api.recipes.IRecipeHandler;
|
||||
import appeng.api.recipes.IRecipeLoader;
|
||||
import appeng.recipes.loader.ConfigLoader;
|
||||
import appeng.recipes.loader.JarLoader;
|
||||
import appeng.recipes.loader.RecipeResourceCopier;
|
||||
@@ -68,7 +69,11 @@ public class RecipeLoader implements Runnable
|
||||
final File readmeGenDest = new File( generatedRecipesDir, "README.html" );
|
||||
final File readmeUserDest = new File( userRecipesDir, "README.html" );
|
||||
|
||||
// generates generated and user recipes dir
|
||||
final IRecipeLoader oreDictLoader = new JarLoader("/assets/appliedenergistics2/oredict/");
|
||||
this.handler.parseRecipes(oreDictLoader, "vanilla.oredict" );
|
||||
this.handler.parseRecipes(oreDictLoader, "ae2.oredict" );
|
||||
|
||||
// generates generated and user recipes dir
|
||||
// will clean the generated every time to keep it up to date
|
||||
// copies over the recipes in the jar over to the generated folder
|
||||
// copies over the readmes
|
||||
|
||||
@@ -1,490 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNewStorageDimension;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.hooks.TickHandler.PlayerColor;
|
||||
import appeng.me.GridStorage;
|
||||
import appeng.me.GridStorageSearch;
|
||||
import appeng.services.CompassService;
|
||||
|
||||
|
||||
public class WorldSettings extends Configuration
|
||||
{
|
||||
private static final String SPAWNDATA_FOLDER = "spawndata";
|
||||
private static final String COMPASS_FOLDER = "compass";
|
||||
|
||||
private static WorldSettings instance;
|
||||
private final List<Integer> storageCellDims = new ArrayList<Integer>();
|
||||
private final File spawnDataFolder;
|
||||
private final CompassService compass;
|
||||
private final PlayerMappings mappings;
|
||||
private final Map<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap<GridStorageSearch, WeakReference<GridStorageSearch>>();
|
||||
private long lastGridStorage;
|
||||
private int lastPlayer;
|
||||
|
||||
public WorldSettings( File aeFolder )
|
||||
{
|
||||
super( new File( aeFolder.getPath(), "settings.cfg" ) );
|
||||
this.spawnDataFolder = new File( aeFolder, SPAWNDATA_FOLDER );
|
||||
this.compass = new CompassService( aeFolder );
|
||||
|
||||
for( int dimID : this.get( "DimensionManager", "StorageCells", new int[0] ).getIntList() )
|
||||
{
|
||||
this.storageCellDims.add( dimID );
|
||||
DimensionManager.registerDimension( dimID, AEConfig.instance.storageProviderID );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.lastGridStorage = Long.parseLong( this.get( "Counters", "lastGridStorage", 0 ).getString() );
|
||||
this.lastPlayer = this.get( "Counters", "lastPlayer", 0 ).getInt();
|
||||
}
|
||||
catch( NumberFormatException err )
|
||||
{
|
||||
this.lastGridStorage = 0;
|
||||
this.lastPlayer = 0;
|
||||
}
|
||||
|
||||
final ConfigCategory playerList = this.getCategory( "players" );
|
||||
this.mappings = new PlayerMappings( playerList, AELog.INSTANCE );
|
||||
}
|
||||
|
||||
public static WorldSettings getInstance()
|
||||
{
|
||||
if( instance == null )
|
||||
{
|
||||
File world = DimensionManager.getCurrentSaveRootDirectory();
|
||||
|
||||
File aeBaseFolder = new File( world.getPath(), "AE2" );
|
||||
|
||||
if( !aeBaseFolder.isDirectory() && !aeBaseFolder.mkdir() )
|
||||
{
|
||||
throw new IllegalStateException( "Failed to create " + aeBaseFolder.getAbsolutePath() );
|
||||
}
|
||||
|
||||
File compass = new File( aeBaseFolder, COMPASS_FOLDER );
|
||||
if( !compass.isDirectory() && !compass.mkdir() )
|
||||
{
|
||||
throw new IllegalStateException( "Failed to create " + compass.getAbsolutePath() );
|
||||
}
|
||||
|
||||
File spawnData = new File( aeBaseFolder, SPAWNDATA_FOLDER );
|
||||
if( !spawnData.isDirectory() && !spawnData.mkdir() )
|
||||
{
|
||||
throw new IllegalStateException( "Failed to create " + spawnData.getAbsolutePath() );
|
||||
}
|
||||
|
||||
instance = new WorldSettings( aeBaseFolder );
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public Collection<NBTTagCompound> getNearByMeteorites( int dim, int chunkX, int chunkZ )
|
||||
{
|
||||
Collection<NBTTagCompound> ll = new LinkedList<NBTTagCompound>();
|
||||
|
||||
synchronized( WorldSettings.class )
|
||||
{
|
||||
for( int x = -1; x <= 1; x++ )
|
||||
{
|
||||
for( int z = -1; z <= 1; z++ )
|
||||
{
|
||||
int cx = x + ( chunkX >> 4 );
|
||||
int cz = z + ( chunkZ >> 4 );
|
||||
|
||||
NBTTagCompound data = this.loadSpawnData( dim, cx << 4, cz << 4 );
|
||||
|
||||
if( data != null )
|
||||
{
|
||||
// edit.
|
||||
int size = data.getInteger( "num" );
|
||||
for( int s = 0; s < size; s++ )
|
||||
{
|
||||
ll.add( data.getCompoundTag( String.valueOf( s ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ll;
|
||||
}
|
||||
|
||||
NBTTagCompound loadSpawnData( int dim, int chunkX, int chunkZ )
|
||||
{
|
||||
if( !Thread.holdsLock( WorldSettings.class ) )
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Request" );
|
||||
}
|
||||
|
||||
NBTTagCompound data = null;
|
||||
File file = new File( this.spawnDataFolder, dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
|
||||
|
||||
if( file.isFile() )
|
||||
{
|
||||
FileInputStream fileInputStream = null;
|
||||
|
||||
try
|
||||
{
|
||||
fileInputStream = new FileInputStream( file );
|
||||
data = CompressedStreamTools.readCompressed( fileInputStream );
|
||||
}
|
||||
catch( Throwable e )
|
||||
{
|
||||
data = new NBTTagCompound();
|
||||
AELog.error( e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
if( fileInputStream != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
fileInputStream.close();
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
data = new NBTTagCompound();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public boolean hasGenerated( int dim, int chunkX, int chunkZ )
|
||||
{
|
||||
synchronized( WorldSettings.class )
|
||||
{
|
||||
NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
|
||||
return data.getBoolean( chunkX + "," + chunkZ );
|
||||
}
|
||||
}
|
||||
|
||||
public void setGenerated( int dim, int chunkX, int chunkZ )
|
||||
{
|
||||
synchronized( WorldSettings.class )
|
||||
{
|
||||
NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
|
||||
|
||||
// edit.
|
||||
data.setBoolean( chunkX + "," + chunkZ, true );
|
||||
|
||||
this.writeSpawnData( dim, chunkX, chunkZ, data );
|
||||
}
|
||||
}
|
||||
|
||||
void writeSpawnData( int dim, int chunkX, int chunkZ, NBTTagCompound data )
|
||||
{
|
||||
if( !Thread.holdsLock( WorldSettings.class ) )
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Request" );
|
||||
}
|
||||
|
||||
File file = new File( this.spawnDataFolder, dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
|
||||
FileOutputStream fileOutputStream = null;
|
||||
|
||||
try
|
||||
{
|
||||
fileOutputStream = new FileOutputStream( file );
|
||||
CompressedStreamTools.writeCompressed( data, fileOutputStream );
|
||||
}
|
||||
catch( Throwable e )
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
if( fileOutputStream != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
fileOutputStream.close();
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean addNearByMeteorites( int dim, int chunkX, int chunkZ, NBTTagCompound newData )
|
||||
{
|
||||
synchronized( WorldSettings.class )
|
||||
{
|
||||
NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
|
||||
|
||||
// edit.
|
||||
int size = data.getInteger( "num" );
|
||||
data.setTag( String.valueOf( size ), newData );
|
||||
data.setInteger( "num", size + 1 );
|
||||
|
||||
this.writeSpawnData( dim, chunkX, chunkZ, data );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
this.save();
|
||||
|
||||
for( Integer dimID : this.storageCellDims )
|
||||
{
|
||||
DimensionManager.unregisterDimension( dimID );
|
||||
}
|
||||
|
||||
this.storageCellDims.clear();
|
||||
|
||||
this.compass.kill();
|
||||
instance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
// populate new data
|
||||
for( GridStorageSearch gs : this.loadedStorage.keySet() )
|
||||
{
|
||||
GridStorage thisStorage = gs.gridStorage.get();
|
||||
if( thisStorage != null && thisStorage.getGrid() != null && !thisStorage.getGrid().isEmpty() )
|
||||
{
|
||||
String value = thisStorage.getValue();
|
||||
this.get( "gridstorage", String.valueOf( thisStorage.getID() ), value ).set( value );
|
||||
}
|
||||
}
|
||||
|
||||
// save to files
|
||||
if( this.hasChanged() )
|
||||
{
|
||||
super.save();
|
||||
}
|
||||
}
|
||||
|
||||
public void addStorageCellDim( int newDim )
|
||||
{
|
||||
this.storageCellDims.add( newDim );
|
||||
DimensionManager.registerDimension( newDim, AEConfig.instance.storageProviderID );
|
||||
|
||||
NetworkHandler.instance.sendToAll( new PacketNewStorageDimension( newDim ) );
|
||||
|
||||
String[] values = new String[this.storageCellDims.size()];
|
||||
|
||||
for( int x = 0; x < values.length; x++ )
|
||||
{
|
||||
values[x] = String.valueOf( this.storageCellDims.get( x ) );
|
||||
}
|
||||
|
||||
this.get( "DimensionManager", "StorageCells", new int[0] ).set( values );
|
||||
this.save();
|
||||
}
|
||||
|
||||
public CompassService getCompass()
|
||||
{
|
||||
return this.compass;
|
||||
}
|
||||
|
||||
public void sendToPlayer( NetworkManager manager )
|
||||
{
|
||||
if( manager != null )
|
||||
{
|
||||
for( int newDim : this.get( "DimensionManager", "StorageCells", new int[0] ).getIntList() )
|
||||
{
|
||||
manager.scheduleOutboundPacket( ( new PacketNewStorageDimension( newDim ) ).getProxy() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( PlayerColor pc : TickHandler.INSTANCE.getPlayerColors().values() )
|
||||
{
|
||||
NetworkHandler.instance.sendToAll( pc.getPacket() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
this.save();
|
||||
}
|
||||
|
||||
public WorldCoord getStoredSize( int dim )
|
||||
{
|
||||
int x = this.get( "StorageCell" + dim, "scaleX", 0 ).getInt();
|
||||
int y = this.get( "StorageCell" + dim, "scaleY", 0 ).getInt();
|
||||
int z = this.get( "StorageCell" + dim, "scaleZ", 0 ).getInt();
|
||||
return new WorldCoord( x, y, z );
|
||||
}
|
||||
|
||||
public void setStoredSize( int dim, int targetX, int targetY, int targetZ )
|
||||
{
|
||||
this.get( "StorageCell" + dim, "scaleX", 0 ).set( targetX );
|
||||
this.get( "StorageCell" + dim, "scaleY", 0 ).set( targetY );
|
||||
this.get( "StorageCell" + dim, "scaleZ", 0 ).set( targetZ );
|
||||
this.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* lazy loading, can load any id, even ones that don't exist anymore.
|
||||
*
|
||||
* @param storageID ID of grid storage
|
||||
*
|
||||
* @return corresponding grid storage
|
||||
*/
|
||||
public GridStorage getGridStorage( long storageID )
|
||||
{
|
||||
GridStorageSearch gss = new GridStorageSearch( storageID );
|
||||
WeakReference<GridStorageSearch> result = this.loadedStorage.get( gss );
|
||||
|
||||
if( result == null || result.get() == null )
|
||||
{
|
||||
String id = String.valueOf( storageID );
|
||||
String Data = this.get( "gridstorage", id, "" ).getString();
|
||||
GridStorage thisStorage = new GridStorage( Data, storageID, gss );
|
||||
gss.gridStorage = new WeakReference<GridStorage>( thisStorage );
|
||||
this.loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
|
||||
return thisStorage;
|
||||
}
|
||||
|
||||
return result.get().gridStorage.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new storage
|
||||
*/
|
||||
public GridStorage getNewGridStorage()
|
||||
{
|
||||
long storageID = this.nextGridStorage();
|
||||
GridStorageSearch gss = new GridStorageSearch( storageID );
|
||||
GridStorage newStorage = new GridStorage( storageID, gss );
|
||||
gss.gridStorage = new WeakReference<GridStorage>( newStorage );
|
||||
this.loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
|
||||
return newStorage;
|
||||
}
|
||||
|
||||
private long nextGridStorage()
|
||||
{
|
||||
long r = this.lastGridStorage;
|
||||
this.lastGridStorage++;
|
||||
this.get( "Counters", "lastGridStorage", this.lastGridStorage ).set( Long.toString( this.lastGridStorage ) );
|
||||
return r;
|
||||
}
|
||||
|
||||
public void destroyGridStorage( long id )
|
||||
{
|
||||
String stringID = String.valueOf( id );
|
||||
this.getCategory( "gridstorage" ).remove( stringID );
|
||||
}
|
||||
|
||||
public int getNextOrderedValue( String name )
|
||||
{
|
||||
Property p = this.get( "orderedValues", name, 0 );
|
||||
int myValue = p.getInt();
|
||||
p.set( myValue + 1 );
|
||||
return myValue;
|
||||
}
|
||||
|
||||
public int getPlayerID( GameProfile profile )
|
||||
{
|
||||
ConfigCategory playerList = this.getCategory( "players" );
|
||||
|
||||
if( playerList == null || profile == null || !profile.isComplete() )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
String uuid = profile.getId().toString();
|
||||
|
||||
Property prop = playerList.get( uuid );
|
||||
if( prop != null && prop.isIntValue() )
|
||||
{
|
||||
return prop.getInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
playerList.put( uuid, prop = new Property( uuid, String.valueOf( this.nextPlayer() ), Property.Type.INTEGER ) );
|
||||
this.mappings.put( prop.getInt(), profile.getId() ); // add to reverse map
|
||||
this.save();
|
||||
return prop.getInt();
|
||||
}
|
||||
}
|
||||
|
||||
private long nextPlayer()
|
||||
{
|
||||
long r = this.lastPlayer;
|
||||
this.lastPlayer++;
|
||||
this.get( "Counters", "lastPlayer", this.lastPlayer ).set( this.lastPlayer );
|
||||
return r;
|
||||
}
|
||||
|
||||
public EntityPlayer getPlayerFromID( int playerID )
|
||||
{
|
||||
Optional<UUID> maybe = this.mappings.get( playerID );
|
||||
|
||||
if( maybe.isPresent() )
|
||||
{
|
||||
final UUID uuid = maybe.get();
|
||||
for( EntityPlayer player : CommonHelper.proxy.getPlayers() )
|
||||
{
|
||||
if( player.getUniqueID().equals( uuid ) )
|
||||
{
|
||||
return player;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.api.definitions;
|
||||
|
||||
|
||||
@@ -10,6 +28,7 @@ import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.core.FeatureHandlerRegistry;
|
||||
import appeng.core.FeatureRegistry;
|
||||
import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.ColoredItemDefinition;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
@@ -76,7 +95,9 @@ public class DefinitionConstructor
|
||||
{
|
||||
for( AEColor color : AEColor.VALID_COLORS )
|
||||
{
|
||||
definition.add( color, new ItemStackSrc( targetItem, offset + color.ordinal() ) );
|
||||
final ActivityState state = ActivityState.from( target.isEnabled() );
|
||||
|
||||
definition.add( color, new ItemStackSrc( targetItem, offset + color.ordinal(), state ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -82,6 +83,7 @@ public final class AETileBlockFeatureHandler implements IFeatureHandler
|
||||
GameRegistry.registerBlock( this.featured, null, registryName );
|
||||
GameRegistry.registerItem( this.definition.maybeItem().get(), registryName );
|
||||
GameRegistry.registerTileEntity( this.featured.getTileEntityClass(), this.featured.toString() );
|
||||
AEBaseTile.registerTileItem( this.featured.getTileEntityClass(), new BlockStackSrc( this.featured, 0, ActivityState.from( this.isFeatureAvailable() ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,38 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
public enum ActivityState
|
||||
{
|
||||
Enabled, Disabled
|
||||
Enabled,
|
||||
Disabled;
|
||||
|
||||
public static ActivityState from( boolean enabled )
|
||||
{
|
||||
if( enabled )
|
||||
{
|
||||
return ActivityState.Enabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ActivityState.Disabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.core.features;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
@@ -37,8 +38,8 @@ import appeng.block.AEBaseBlock;
|
||||
|
||||
public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
{
|
||||
private final Block block;
|
||||
private final boolean enabled;
|
||||
private static final ItemBlockTransformer ITEMBLOCK_TRANSFORMER = new ItemBlockTransformer();
|
||||
private final Optional<Block> block;
|
||||
|
||||
public BlockDefinition( Block block, ActivityState state )
|
||||
{
|
||||
@@ -47,8 +48,14 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
Preconditions.checkNotNull( block );
|
||||
Preconditions.checkNotNull( state );
|
||||
|
||||
this.block = block;
|
||||
this.enabled = state == ActivityState.Enabled;
|
||||
if( state == ActivityState.Enabled )
|
||||
{
|
||||
this.block = Optional.of( block );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.block = Optional.absent();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +99,7 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
*
|
||||
* TODO: throw an exception instead of returning null? As this could cause issue later on.
|
||||
*
|
||||
* @param block the block to create the {@link ItemBlock} from
|
||||
* @param block the block to create the {@link ItemBlock} from
|
||||
* @param itemclass the class used to construct it.
|
||||
*
|
||||
* @return an {@link Item} for the block. Actually always a sub type of {@link ItemBlock}
|
||||
@@ -121,38 +128,51 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
@Override
|
||||
public final Optional<Block> maybeBlock()
|
||||
{
|
||||
return Optional.of( this.block );
|
||||
return this.block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Optional<ItemBlock> maybeItemBlock()
|
||||
{
|
||||
if( this.enabled )
|
||||
{
|
||||
return Optional.of( new ItemBlock( this.block ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return Optional.absent();
|
||||
}
|
||||
return this.block.transform( ITEMBLOCK_TRANSFORMER );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Optional<ItemStack> maybeStack( int stackSize )
|
||||
{
|
||||
if( this.enabled )
|
||||
{
|
||||
return Optional.of( new ItemStack( this.block ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return Optional.absent();
|
||||
}
|
||||
return this.block.transform( new ItemStackTransformer( stackSize ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isSameAs( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return this.enabled && world.getBlock( x, y, z ) == this.block;
|
||||
return this.isEnabled() && world.getBlock( x, y, z ) == this.block.get();
|
||||
}
|
||||
|
||||
private static class ItemBlockTransformer implements Function<Block, ItemBlock>
|
||||
{
|
||||
@Override
|
||||
public ItemBlock apply( Block input )
|
||||
{
|
||||
return new ItemBlock( input );
|
||||
}
|
||||
}
|
||||
|
||||
private static class ItemStackTransformer implements Function<Block, ItemStack>
|
||||
{
|
||||
private final int stackSize;
|
||||
|
||||
public ItemStackTransformer( int stackSize )
|
||||
{
|
||||
Preconditions.checkArgument( stackSize > 0 );
|
||||
|
||||
this.stackSize = stackSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack apply( Block input )
|
||||
{
|
||||
return new ItemStack( input, this.stackSize );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
public class BlockStackSrc implements IStackSrc
|
||||
{
|
||||
|
||||
public final Block block;
|
||||
public final int damage;
|
||||
private final boolean enabled;
|
||||
|
||||
public BlockStackSrc( Block block, int damage, ActivityState state )
|
||||
{
|
||||
Preconditions.checkNotNull( block );
|
||||
Preconditions.checkArgument( damage >= 0 );
|
||||
Preconditions.checkNotNull( state );
|
||||
Preconditions.checkArgument( state == ActivityState.Enabled || state == ActivityState.Disabled );
|
||||
|
||||
this.block = block;
|
||||
this.damage = damage;
|
||||
this.enabled = state == ActivityState.Enabled;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack stack( int i )
|
||||
{
|
||||
return new ItemStack( this.block, i, this.damage );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamage()
|
||||
{
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return this.enabled;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -54,7 +54,7 @@ public final class ColoredItemDefinition implements AEColoredItemDefinition
|
||||
return null;
|
||||
}
|
||||
|
||||
return is.item;
|
||||
return is.getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,6 +97,6 @@ public final class ColoredItemDefinition implements AEColoredItemDefinition
|
||||
return false;
|
||||
}
|
||||
|
||||
return comparableItem.getItem() == is.item && comparableItem.getItemDamage() == is.damage;
|
||||
return comparableItem.getItem() == is.getItem() && comparableItem.getItemDamage() == is.damage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -21,6 +21,7 @@ package appeng.core.features;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
@@ -33,27 +34,39 @@ import appeng.api.definitions.IItemDefinition;
|
||||
|
||||
public final class DamagedItemDefinition implements IItemDefinition
|
||||
{
|
||||
private final IStackSrc source;
|
||||
private static final ItemTransformer ITEM_TRANSFORMER = new ItemTransformer();
|
||||
private final Optional<IStackSrc> source;
|
||||
|
||||
public DamagedItemDefinition( @Nonnull IStackSrc source )
|
||||
{
|
||||
this.source = Preconditions.checkNotNull( source );
|
||||
Preconditions.checkNotNull( source );
|
||||
|
||||
if( source.isEnabled() )
|
||||
{
|
||||
this.source = Optional.of( source );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.source = Optional.absent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Item> maybeItem()
|
||||
{
|
||||
final Item item = this.source.getItem();
|
||||
|
||||
return Optional.fromNullable( item );
|
||||
return this.source.transform( ITEM_TRANSFORMER );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ItemStack> maybeStack( int stackSize )
|
||||
{
|
||||
final ItemStack stack = this.source.stack( stackSize );
|
||||
return this.source.transform( new ItemStackTransformer( stackSize ) );
|
||||
}
|
||||
|
||||
return Optional.fromNullable( stack );
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return this.source.isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,7 +77,7 @@ public final class DamagedItemDefinition implements IItemDefinition
|
||||
return false;
|
||||
}
|
||||
|
||||
return comparableStack.getItem() == this.source.getItem() && comparableStack.getItemDamage() == this.source.getDamage();
|
||||
return this.isEnabled() && comparableStack.getItem() == this.source.get().getItem() && comparableStack.getItemDamage() == this.source.get().getDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,4 +85,31 @@ public final class DamagedItemDefinition implements IItemDefinition
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class ItemTransformer implements Function<IStackSrc, Item>
|
||||
{
|
||||
@Override
|
||||
public Item apply( IStackSrc input )
|
||||
{
|
||||
return input.getItem();
|
||||
}
|
||||
}
|
||||
|
||||
private static class ItemStackTransformer implements Function<IStackSrc, ItemStack>
|
||||
{
|
||||
private final int stackSize;
|
||||
|
||||
public ItemStackTransformer( int stackSize )
|
||||
{
|
||||
Preconditions.checkArgument( stackSize > 0 );
|
||||
|
||||
this.stackSize = stackSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack apply( IStackSrc input )
|
||||
{
|
||||
return input.stack( this.stackSize );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -31,4 +31,6 @@ public interface IStackSrc
|
||||
Item getItem();
|
||||
|
||||
int getDamage();
|
||||
|
||||
boolean isEnabled();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
@@ -32,41 +33,45 @@ import appeng.util.Platform;
|
||||
|
||||
public class ItemDefinition implements IItemDefinition
|
||||
{
|
||||
private final Item item;
|
||||
private final boolean enabled;
|
||||
private final Optional<Item> item;
|
||||
|
||||
public ItemDefinition( Item item, ActivityState state )
|
||||
{
|
||||
Preconditions.checkNotNull( item );
|
||||
Preconditions.checkNotNull( state );
|
||||
|
||||
this.item = item;
|
||||
this.enabled = state == ActivityState.Enabled;
|
||||
if( state == ActivityState.Enabled )
|
||||
{
|
||||
this.item = Optional.of( item );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.item = Optional.absent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Optional<Item> maybeItem()
|
||||
{
|
||||
return Optional.of( this.item );
|
||||
return this.item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ItemStack> maybeStack( int stackSize )
|
||||
{
|
||||
if( this.enabled )
|
||||
{
|
||||
return Optional.of( new ItemStack( this.item ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return Optional.absent();
|
||||
}
|
||||
return this.item.transform( new ItemStackTransformer( stackSize ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return this.item.isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isSameAs( ItemStack comparableStack )
|
||||
{
|
||||
return this.enabled && Platform.isSameItemType( comparableStack, this.maybeStack( 1 ).get() );
|
||||
return this.isEnabled() && Platform.isSameItemType( comparableStack, this.maybeStack( 1 ).get() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,4 +79,22 @@ public class ItemDefinition implements IItemDefinition
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class ItemStackTransformer implements Function<Item, ItemStack>
|
||||
{
|
||||
private final int stackSize;
|
||||
|
||||
public ItemStackTransformer( int stackSize )
|
||||
{
|
||||
Preconditions.checkArgument( stackSize > 0 );
|
||||
|
||||
this.stackSize = stackSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack apply( Item input )
|
||||
{
|
||||
return new ItemStack( input, this.stackSize );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -21,7 +21,8 @@ package appeng.core.features;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -29,39 +30,27 @@ import net.minecraft.item.ItemStack;
|
||||
public class ItemStackSrc implements IStackSrc
|
||||
{
|
||||
|
||||
public final Item item;
|
||||
public final Block block;
|
||||
private final Item item;
|
||||
public final int damage;
|
||||
private final boolean enabled;
|
||||
|
||||
public ItemStackSrc( Item i, int dmg )
|
||||
public ItemStackSrc( Item item, int damage, ActivityState state )
|
||||
{
|
||||
this.block = null;
|
||||
this.item = i;
|
||||
this.damage = dmg;
|
||||
}
|
||||
Preconditions.checkNotNull( item );
|
||||
Preconditions.checkArgument( damage >= 0 );
|
||||
Preconditions.checkNotNull( state );
|
||||
Preconditions.checkArgument( state == ActivityState.Enabled || state == ActivityState.Disabled );
|
||||
|
||||
public ItemStackSrc( Block b, int dmg )
|
||||
{
|
||||
this.item = null;
|
||||
this.block = b;
|
||||
this.damage = dmg;
|
||||
this.item = item;
|
||||
this.damage = damage;
|
||||
this.enabled = state == ActivityState.Enabled;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack stack( int i )
|
||||
{
|
||||
if( this.block != null )
|
||||
{
|
||||
return new ItemStack( this.block, i, this.damage );
|
||||
}
|
||||
|
||||
if( this.item != null )
|
||||
{
|
||||
return new ItemStack( this.item, i, this.damage );
|
||||
}
|
||||
|
||||
return null;
|
||||
return new ItemStack( this.item, i, this.damage );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,4 +64,10 @@ public class ItemStackSrc implements IStackSrc
|
||||
{
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return this.enabled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -19,6 +19,8 @@
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -27,12 +29,11 @@ import appeng.items.materials.MaterialType;
|
||||
|
||||
public class MaterialStackSrc implements IStackSrc
|
||||
{
|
||||
|
||||
final MaterialType src;
|
||||
private final MaterialType src;
|
||||
|
||||
public MaterialStackSrc( MaterialType src )
|
||||
{
|
||||
assert src != null;
|
||||
Preconditions.checkNotNull( src );
|
||||
|
||||
this.src = src;
|
||||
}
|
||||
@@ -54,4 +55,10 @@ public class MaterialStackSrc implements IStackSrc
|
||||
{
|
||||
return this.src.damageValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
@@ -30,7 +31,8 @@ import appeng.block.AEBaseTileBlock;
|
||||
|
||||
public final class TileDefinition extends BlockDefinition implements ITileDefinition
|
||||
{
|
||||
private final AEBaseTileBlock block;
|
||||
private static final TileEntityTransformer TILEENTITY_TRANSFORMER = new TileEntityTransformer();
|
||||
private final Optional<AEBaseTileBlock> block;
|
||||
|
||||
public TileDefinition( AEBaseTileBlock block, ActivityState state )
|
||||
{
|
||||
@@ -40,14 +42,30 @@ public final class TileDefinition extends BlockDefinition implements ITileDefini
|
||||
Preconditions.checkNotNull( state );
|
||||
Preconditions.checkNotNull( block.getTileEntityClass() );
|
||||
|
||||
this.block = block;
|
||||
if( state == ActivityState.Enabled )
|
||||
{
|
||||
this.block = Optional.of( block );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.block = Optional.absent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<? extends Class<? extends TileEntity>> maybeEntity()
|
||||
{
|
||||
final Class<? extends TileEntity> entity = this.block.getTileEntityClass();
|
||||
return this.block.transform( TILEENTITY_TRANSFORMER );
|
||||
}
|
||||
|
||||
return Optional.of( entity );
|
||||
private static class TileEntityTransformer implements Function<AEBaseTileBlock, Class<? extends TileEntity>>
|
||||
{
|
||||
@Override
|
||||
public Class<? extends TileEntity> apply( AEBaseTileBlock input )
|
||||
{
|
||||
final Class<? extends TileEntity> entity = input.getTileEntityClass();
|
||||
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -77,6 +77,12 @@ public final class WrappedDamageItemDefinition implements ITileDefinition
|
||||
return this.definition.maybeBlock().transform( new BlockTransformFunction( stackSize, this.damage ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return this.definition.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameAs( ItemStack comparableStack )
|
||||
{
|
||||
|
||||
@@ -1,8 +1,27 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -21,12 +40,12 @@ import appeng.core.features.registries.entries.InscriberRecipe;
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @version rv3
|
||||
* @since rv2
|
||||
*/
|
||||
public final class InscriberRegistry implements IInscriberRegistry
|
||||
{
|
||||
private final List<IInscriberRecipe> recipes;
|
||||
private final Set<IInscriberRecipe> recipes;
|
||||
private final Set<ItemStack> optionals;
|
||||
private final Set<ItemStack> inputs;
|
||||
|
||||
@@ -34,14 +53,14 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
{
|
||||
this.inputs = new HashSet<ItemStack>();
|
||||
this.optionals = new HashSet<ItemStack>();
|
||||
this.recipes = new ArrayList<IInscriberRecipe>();
|
||||
this.recipes = new HashSet<IInscriberRecipe>();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<IInscriberRecipe> getRecipes()
|
||||
public Collection<IInscriberRecipe> getRecipes()
|
||||
{
|
||||
return this.recipes;
|
||||
return Collections.unmodifiableCollection( this.recipes );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -168,11 +187,11 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
{
|
||||
throw new IllegalStateException( "Output must be defined." );
|
||||
}
|
||||
if ( this.topOptional == null && this.bottomOptional == null )
|
||||
if( this.topOptional == null && this.bottomOptional == null )
|
||||
{
|
||||
throw new IllegalStateException( "One optional must be defined." );
|
||||
}
|
||||
if ( this.type == null )
|
||||
if( this.type == null )
|
||||
{
|
||||
throw new IllegalStateException( "Process type must be defined." );
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -19,12 +19,14 @@
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import appeng.api.features.IPlayerRegistry;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
|
||||
|
||||
public class PlayerRegistry implements IPlayerRegistry
|
||||
@@ -33,18 +35,24 @@ public class PlayerRegistry implements IPlayerRegistry
|
||||
@Override
|
||||
public int getID( GameProfile username )
|
||||
{
|
||||
return WorldSettings.getInstance().getPlayerID( username );
|
||||
if( username == null || !username.isComplete() )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return WorldData.instance().playerData().getPlayerID( username );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID( EntityPlayer player )
|
||||
{
|
||||
return WorldSettings.getInstance().getPlayerID( player.getGameProfile() );
|
||||
return this.getID( player.getGameProfile() );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public EntityPlayer findPlayer( int playerID )
|
||||
{
|
||||
return WorldSettings.getInstance().getPlayerFromID( playerID );
|
||||
return WorldData.instance().playerData().getPlayerFromID( playerID );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,8 @@ import appeng.parts.automation.PartFormationPlane;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
import appeng.parts.misc.PartStorageBus;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.parts.reporting.PartMonitor;
|
||||
import appeng.parts.reporting.PartInterfaceTerminal;
|
||||
import appeng.parts.reporting.PartPanel;
|
||||
import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
@@ -187,7 +188,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
|
||||
GUI_CRAFTING_CONFIRM( ContainerCraftConfirm.class, ITerminalHost.class, GuiHostType.ITEM_OR_WORLD, SecurityPermissions.CRAFT ),
|
||||
|
||||
GUI_INTERFACE_TERMINAL( ContainerInterfaceTerminal.class, PartMonitor.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
|
||||
GUI_INTERFACE_TERMINAL( ContainerInterfaceTerminal.class, PartInterfaceTerminal.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
|
||||
|
||||
GUI_CRAFTING_STATUS( ContainerCraftingStatus.class, ITerminalHost.class, GuiHostType.ITEM_OR_WORLD, SecurityPermissions.CRAFT );
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -31,8 +31,8 @@ import cpw.mods.fml.common.network.FMLNetworkEvent.ServerConnectionFromClientEve
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
|
||||
|
||||
public class NetworkHandler
|
||||
@@ -83,7 +83,7 @@ public class NetworkHandler
|
||||
@SubscribeEvent
|
||||
public void newConnection( ServerConnectionFromClientEvent ev )
|
||||
{
|
||||
WorldSettings.getInstance().sendToPlayer( ev.manager );
|
||||
WorldData.instance().dimensionData().sendToPlayer( ev.manager );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -91,7 +91,7 @@ public class NetworkHandler
|
||||
{
|
||||
if( loginEvent.player instanceof EntityPlayerMP )
|
||||
{
|
||||
WorldSettings.getInstance().sendToPlayer( null );
|
||||
WorldData.instance().dimensionData().sendToPlayer( null );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -26,10 +26,10 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.services.compass.ICompassCallback;
|
||||
|
||||
|
||||
@@ -79,6 +79,6 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba
|
||||
this.talkBackTo = player;
|
||||
|
||||
DimensionalCoord loc = new DimensionalCoord( player.worldObj, this.cx << 4, this.cdy << 5, this.cz << 4 );
|
||||
WorldSettings.getInstance().getCompass().getCompassDirection( loc, 174, this );
|
||||
WorldData.instance().compassData().service().getCompassDirection( loc, 174, this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import appeng.services.CompassService;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
final class CompassData implements IWorldCompassData, IOnWorldStoppable
|
||||
{
|
||||
@Nonnull
|
||||
private final CompassService service;
|
||||
|
||||
public CompassData( @Nonnull final File compassDirectory, @Nonnull final CompassService service )
|
||||
{
|
||||
Preconditions.checkNotNull( compassDirectory );
|
||||
Preconditions.checkNotNull( service );
|
||||
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompassService service()
|
||||
{
|
||||
return this.service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldStop()
|
||||
{
|
||||
this.service.kill();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNewStorageDimension;
|
||||
import appeng.hooks.TickHandler;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
final class DimensionData implements IWorldDimensionData, IOnWorldStartable, IOnWorldStoppable
|
||||
{
|
||||
private static final String CONFIG_CATEGORY = "DimensionManager";
|
||||
private static final String CONFIG_KEY = "StorageCells";
|
||||
private static final int[] STORAGE_CELLS_DEFAULT = new int[0];
|
||||
|
||||
private static final String STORAGE_CELL_CATEGORY = "StorageCell";
|
||||
|
||||
private static final String STORAGE_CELL_SCALE_X_KEY = "scaleX";
|
||||
private static final String STORAGE_CELL_SCALE_Y_KEY = "scaleY";
|
||||
private static final String STORAGE_CELL_SCALE_Z_KEY = "scaleZ";
|
||||
|
||||
private static final String PACKAGE_DEST_CATEGORY = "DimensionManager";
|
||||
private static final String PACKAGE_KEY_CATEGORY = "StorageCells";
|
||||
private static final int[] PACKAGE_DEF_CATEGORY = new int[0];
|
||||
|
||||
private final Configuration config;
|
||||
private final List<Integer> storageCellDimensionIDs;
|
||||
|
||||
DimensionData( @Nonnull final File parentFile, @Nonnull final String configVersion )
|
||||
{
|
||||
Preconditions.checkNotNull( parentFile );
|
||||
Preconditions.checkNotNull( configVersion );
|
||||
Preconditions.checkArgument( !configVersion.isEmpty() );
|
||||
|
||||
this.config = new Configuration( parentFile, configVersion );
|
||||
|
||||
final int[] storageCellIDs = this.storageCellIDsProperty().getIntList();
|
||||
|
||||
this.storageCellDimensionIDs = Lists.newArrayList();
|
||||
for( int storageCellID : storageCellIDs )
|
||||
{
|
||||
this.storageCellDimensionIDs.add( storageCellID );
|
||||
}
|
||||
}
|
||||
|
||||
private Property storageCellIDsProperty()
|
||||
{
|
||||
return this.config.get( CONFIG_CATEGORY, CONFIG_KEY, STORAGE_CELLS_DEFAULT );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldStart()
|
||||
{
|
||||
for( Integer storageCellDimID : this.storageCellDimensionIDs )
|
||||
{
|
||||
DimensionManager.registerDimension( storageCellDimID, AEConfig.instance.storageProviderID );
|
||||
}
|
||||
|
||||
this.config.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldStop()
|
||||
{
|
||||
this.config.save();
|
||||
|
||||
for( Integer storageCellDimID : this.storageCellDimensionIDs )
|
||||
{
|
||||
DimensionManager.unregisterDimension( storageCellDimID );
|
||||
}
|
||||
|
||||
this.storageCellDimensionIDs.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStorageCell( int newStorageCellID )
|
||||
{
|
||||
this.storageCellDimensionIDs.add( newStorageCellID );
|
||||
DimensionManager.registerDimension( newStorageCellID, AEConfig.instance.storageProviderID );
|
||||
|
||||
NetworkHandler.instance.sendToAll( new PacketNewStorageDimension( newStorageCellID ) );
|
||||
|
||||
String[] values = new String[this.storageCellDimensionIDs.size()];
|
||||
|
||||
for( int x = 0; x < values.length; x++ )
|
||||
{
|
||||
values[x] = String.valueOf( this.storageCellDimensionIDs.get( x ) );
|
||||
}
|
||||
|
||||
this.storageCellIDsProperty().set( values );
|
||||
this.config.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldCoord getStoredSize( int dim )
|
||||
{
|
||||
final String category = STORAGE_CELL_CATEGORY + dim;
|
||||
|
||||
final int x = this.config.get( category, STORAGE_CELL_SCALE_X_KEY, 0 ).getInt();
|
||||
final int y = this.config.get( category, STORAGE_CELL_SCALE_Y_KEY, 0 ).getInt();
|
||||
final int z = this.config.get( category, STORAGE_CELL_SCALE_Z_KEY, 0 ).getInt();
|
||||
|
||||
return new WorldCoord( x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStoredSize( int dim, int targetX, int targetY, int targetZ )
|
||||
{
|
||||
final String category = STORAGE_CELL_CATEGORY + dim;
|
||||
|
||||
this.config.get( category, STORAGE_CELL_SCALE_X_KEY, 0 ).set( targetX );
|
||||
this.config.get( category, STORAGE_CELL_SCALE_Y_KEY, 0 ).set( targetY );
|
||||
this.config.get( category, STORAGE_CELL_SCALE_Z_KEY, 0 ).set( targetZ );
|
||||
|
||||
this.config.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendToPlayer( @Nullable final NetworkManager manager )
|
||||
{
|
||||
if( manager != null )
|
||||
{
|
||||
for( int newDim : this.config.get( PACKAGE_DEST_CATEGORY, PACKAGE_KEY_CATEGORY, PACKAGE_DEF_CATEGORY ).getIntList() )
|
||||
{
|
||||
manager.scheduleOutboundPacket( ( new PacketNewStorageDimension( newDim ) ).getProxy() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( TickHandler.PlayerColor pc : TickHandler.INSTANCE.getPlayerColors().values() )
|
||||
{
|
||||
NetworkHandler.instance.sendToAll( pc.getPacket() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
public interface IOnWorldStartable
|
||||
{
|
||||
void onWorldStart();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
public interface IOnWorldStoppable
|
||||
{
|
||||
void onWorldStop();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import appeng.services.CompassService;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
public interface IWorldCompassData
|
||||
{
|
||||
CompassService service();
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
public interface IWorldData
|
||||
{
|
||||
void onServerStopping();
|
||||
|
||||
@Nonnull
|
||||
IWorldGridStorageData storageData();
|
||||
|
||||
@Nonnull
|
||||
IWorldPlayerData playerData();
|
||||
|
||||
@Nonnull
|
||||
IWorldDimensionData dimensionData();
|
||||
|
||||
@Nonnull
|
||||
IWorldCompassData compassData();
|
||||
|
||||
@Nonnull
|
||||
IWorldSpawnData spawnData();
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.network.NetworkManager;
|
||||
|
||||
import appeng.api.util.WorldCoord;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
public interface IWorldDimensionData
|
||||
{
|
||||
void addStorageCell( int newStorageCellID );
|
||||
|
||||
WorldCoord getStoredSize( int dim );
|
||||
|
||||
void setStoredSize( int dim, int targetX, int targetY, int targetZ );
|
||||
|
||||
void sendToPlayer( @Nullable NetworkManager manager );
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.me.GridStorage;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
public interface IWorldGridStorageData
|
||||
{
|
||||
@Nullable
|
||||
GridStorage getGridStorage( long storageID );
|
||||
|
||||
@Nonnull
|
||||
GridStorage getNewGridStorage();
|
||||
|
||||
long nextGridStorage();
|
||||
|
||||
void destroyGridStorage( long id );
|
||||
|
||||
int getNextOrderedValue( String name );
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
public interface IWorldPlayerData
|
||||
{
|
||||
@Nullable
|
||||
EntityPlayer getPlayerFromID( int playerID );
|
||||
|
||||
int getPlayerID( GameProfile profile );
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
public interface IWorldPlayerMapping
|
||||
{
|
||||
/**
|
||||
* Tries to retrieve the UUID of a player.
|
||||
* Might not be stored inside of the map.
|
||||
* Should not happen though.
|
||||
*
|
||||
* @param id ID of the to be searched player
|
||||
*
|
||||
* @return maybe the UUID of the searched player
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<UUID> get( int id );
|
||||
|
||||
/**
|
||||
* Put in new players when they join the server
|
||||
*
|
||||
* @param id id of new player
|
||||
* @param uuid UUID of new player
|
||||
*/
|
||||
void put( int id, @Nonnull UUID uuid );
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
public interface IWorldSpawnData
|
||||
{
|
||||
void setGenerated( int dim, int chunkX, int chunkZ );
|
||||
|
||||
boolean hasGenerated( int dim, int chunkX, int chunkZ );
|
||||
|
||||
boolean addNearByMeteorites( int dim, int chunkX, int chunkZ, NBTTagCompound newData );
|
||||
|
||||
Collection<NBTTagCompound> getNearByMeteorites( int dim, int chunkX, int chunkZ );
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
|
||||
/**
|
||||
* encodes data into a common name
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv3 - 05.06.2015
|
||||
* @since rv3 05.06.2015
|
||||
*/
|
||||
public class MeteorDataNameEncoder
|
||||
{
|
||||
private static final char DATA_SEPARATOR = '_';
|
||||
private static final char BASE_EXTENSION_SEPARATOR = '.';
|
||||
private static final String FILE_EXTENSION = "dat";
|
||||
|
||||
private final char dataSeparator;
|
||||
@Nonnull
|
||||
private final String fileExtension;
|
||||
private final char baseExtSeparator;
|
||||
private final int bitScale;
|
||||
|
||||
/**
|
||||
* @param bitScale how often the coordinates will be shifted right (will scale coordinates down)
|
||||
*/
|
||||
public MeteorDataNameEncoder( final int bitScale )
|
||||
{
|
||||
this( DATA_SEPARATOR, BASE_EXTENSION_SEPARATOR, FILE_EXTENSION, bitScale );
|
||||
}
|
||||
|
||||
private MeteorDataNameEncoder( char dataSeparator, char baseExtSeparator, @Nonnull final String fileExtension, final int bitScale )
|
||||
{
|
||||
Preconditions.checkNotNull( fileExtension );
|
||||
Preconditions.checkArgument( !fileExtension.isEmpty() );
|
||||
Preconditions.checkArgument( bitScale >= 0 );
|
||||
|
||||
this.dataSeparator = dataSeparator;
|
||||
this.baseExtSeparator = baseExtSeparator;
|
||||
this.fileExtension = fileExtension;
|
||||
this.bitScale = bitScale;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dimension ID of the processed dimension. Can be any integer
|
||||
* @param chunkX X coordinate of the chunk. Can be any integer
|
||||
* @param chunkZ Z coordinate of the chunk. Can be any integer
|
||||
*
|
||||
* @return encoded file name suggestion in form of <tt>dim_x_y.dat</tt> where <tt>x</tt> and <tt>y</tt> will be shifted to stay conform with the vanilla chunk system
|
||||
*
|
||||
* @since rv3 05.06.2015
|
||||
*/
|
||||
public String encode( int dimension, int chunkX, int chunkZ )
|
||||
{
|
||||
final int shiftedX = chunkX >> this.bitScale;
|
||||
final int shiftedZ = chunkZ >> this.bitScale;
|
||||
|
||||
return String.format( "%d%c%d%c%d%c%s", dimension, this.dataSeparator, shiftedX, this.dataSeparator, shiftedZ, this.baseExtSeparator, this.fileExtension );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.CommonHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Handles the matching between UUIDs and internal IDs for security systems.
|
||||
* This whole system could be replaced by storing directly the UUID,
|
||||
* using a lot more traffic though
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
final class PlayerData implements IWorldPlayerData, IOnWorldStartable, IOnWorldStoppable
|
||||
{
|
||||
private static final String LAST_PLAYER_CATEGORY = "Counters";
|
||||
private static final String LAST_PLAYER_KEY = "lastPlayer";
|
||||
private static final int LAST_PLAYER_DEFAULT = 0;
|
||||
|
||||
private final Configuration config;
|
||||
private final IWorldPlayerMapping playerMapping;
|
||||
|
||||
private int lastPlayerID;
|
||||
|
||||
public PlayerData( @Nonnull final File configFile, @Nonnull final String configVersion )
|
||||
{
|
||||
Preconditions.checkNotNull( configFile );
|
||||
Preconditions.checkNotNull( configVersion );
|
||||
Preconditions.checkArgument( !configVersion.isEmpty() );
|
||||
|
||||
this.config = new Configuration( configFile, configVersion );
|
||||
|
||||
final ConfigCategory playerList = this.config.getCategory( "players" );
|
||||
this.playerMapping = new PlayerMapping( playerList, AELog.INSTANCE );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public EntityPlayer getPlayerFromID( int playerID )
|
||||
{
|
||||
final Optional<UUID> maybe = this.playerMapping.get( playerID );
|
||||
|
||||
if( maybe.isPresent() )
|
||||
{
|
||||
final UUID uuid = maybe.get();
|
||||
for( EntityPlayer player : CommonHelper.proxy.getPlayers() )
|
||||
{
|
||||
if( player.getUniqueID().equals( uuid ) )
|
||||
{
|
||||
return player;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerID( @Nonnull final GameProfile profile )
|
||||
{
|
||||
Preconditions.checkNotNull( profile );
|
||||
Preconditions.checkNotNull( this.config.getCategory( "players" ) );
|
||||
Preconditions.checkState( profile.isComplete() );
|
||||
|
||||
final ConfigCategory players = this.config.getCategory( "players" );
|
||||
final String uuid = profile.getId().toString();
|
||||
final Property maybePlayerID = players.get( uuid );
|
||||
|
||||
if( maybePlayerID != null && maybePlayerID.isIntValue() )
|
||||
{
|
||||
return maybePlayerID.getInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
final int newPlayerID = this.nextPlayer();
|
||||
final Property newPlayer = new Property( uuid, String.valueOf( newPlayerID ), Property.Type.INTEGER );
|
||||
players.put( uuid, newPlayer );
|
||||
this.playerMapping.put( newPlayerID, profile.getId() ); // add to reverse map
|
||||
this.config.save();
|
||||
|
||||
return newPlayerID;
|
||||
}
|
||||
}
|
||||
|
||||
private int nextPlayer()
|
||||
{
|
||||
final int r = this.lastPlayerID;
|
||||
this.lastPlayerID++;
|
||||
this.config.get( LAST_PLAYER_CATEGORY, LAST_PLAYER_KEY, this.lastPlayerID ).set( this.lastPlayerID );
|
||||
return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldStart()
|
||||
{
|
||||
this.lastPlayerID = this.config.get( LAST_PLAYER_CATEGORY, LAST_PLAYER_KEY, LAST_PLAYER_DEFAULT ).getInt( LAST_PLAYER_DEFAULT );
|
||||
|
||||
this.config.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldStop()
|
||||
{
|
||||
this.config.save();
|
||||
|
||||
this.lastPlayerID = 0;
|
||||
}
|
||||
}
|
||||
+12
-20
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -16,13 +16,15 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core;
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
|
||||
@@ -34,7 +36,7 @@ import cpw.mods.fml.relauncher.FMLRelaunchLog;
|
||||
* Will grant access to a pre initialized player map
|
||||
* based on the "players" category in the settings.cfg
|
||||
*/
|
||||
public class PlayerMappings
|
||||
final class PlayerMapping implements IWorldPlayerMapping
|
||||
{
|
||||
/**
|
||||
* View of player mappings, is not immutable,
|
||||
@@ -43,22 +45,15 @@ public class PlayerMappings
|
||||
*/
|
||||
private final Map<Integer, UUID> mappings;
|
||||
|
||||
public PlayerMappings( ConfigCategory category, FMLRelaunchLog log )
|
||||
public PlayerMapping( ConfigCategory category, FMLRelaunchLog log )
|
||||
{
|
||||
final PlayerMappingsInitializer init = new PlayerMappingsInitializer( category, log );
|
||||
|
||||
this.mappings = init.getPlayerMappings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to retrieve the UUID of a player.
|
||||
* Might not be stored inside of the map.
|
||||
* Should not happen though.
|
||||
*
|
||||
* @param id ID of the to be searched player
|
||||
*
|
||||
* @return maybe the UUID of the searched player
|
||||
*/
|
||||
@Nonnull
|
||||
@Override
|
||||
public Optional<UUID> get( int id )
|
||||
{
|
||||
final UUID maybe = this.mappings.get( id );
|
||||
@@ -66,14 +61,11 @@ public class PlayerMappings
|
||||
return Optional.fromNullable( maybe );
|
||||
}
|
||||
|
||||
/**
|
||||
* Put in new players when they join the server
|
||||
*
|
||||
* @param id id of new player
|
||||
* @param uuid UUID of new player
|
||||
*/
|
||||
public void put( int id, UUID uuid )
|
||||
@Override
|
||||
public void put( int id, @Nonnull UUID uuid )
|
||||
{
|
||||
Preconditions.checkNotNull( uuid );
|
||||
|
||||
this.mappings.put( id, uuid );
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core;
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -28,13 +28,14 @@ import net.minecraftforge.common.config.Property;
|
||||
|
||||
import cpw.mods.fml.relauncher.FMLRelaunchLog;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import appeng.util.UUIDMatcher;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a map of ID to UUID from the player list in the settings.cfg
|
||||
*/
|
||||
public class PlayerMappingsInitializer
|
||||
class PlayerMappingsInitializer
|
||||
{
|
||||
/**
|
||||
* Internal immutable mapping
|
||||
@@ -52,7 +53,7 @@ public class PlayerMappingsInitializer
|
||||
* @param playerList the category for the player list, generally extracted using the "players" tag
|
||||
* @param log the logger used to warn the server or user of faulty entries
|
||||
*/
|
||||
public PlayerMappingsInitializer( ConfigCategory playerList, FMLRelaunchLog log )
|
||||
PlayerMappingsInitializer( ConfigCategory playerList, FMLRelaunchLog log )
|
||||
{
|
||||
// Matcher for UUIDs
|
||||
final UUIDMatcher matcher = new UUIDMatcher();
|
||||
@@ -71,9 +72,9 @@ public class PlayerMappingsInitializer
|
||||
|
||||
if( matcher.isUUID( maybeUUID ) )
|
||||
{
|
||||
final UUID UUIDString = UUID.fromString( maybeUUID );
|
||||
final UUID uuidString = UUID.fromString( maybeUUID );
|
||||
|
||||
this.playerMappings.put( id, UUIDString );
|
||||
this.playerMappings.put( id, uuidString );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import appeng.core.AELog;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
final class SpawnData implements IWorldSpawnData
|
||||
{
|
||||
@Nonnull
|
||||
private final File spawnDirectory;
|
||||
@Nonnull
|
||||
private final MeteorDataNameEncoder encoder;
|
||||
|
||||
public SpawnData( @Nonnull final File spawnDirectory )
|
||||
{
|
||||
Preconditions.checkNotNull( spawnDirectory );
|
||||
|
||||
this.spawnDirectory = spawnDirectory;
|
||||
this.encoder = new MeteorDataNameEncoder( 4 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGenerated( int dim, int chunkX, int chunkZ ) {
|
||||
synchronized( SpawnData.class )
|
||||
{
|
||||
NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
|
||||
|
||||
// edit.
|
||||
data.setBoolean( chunkX + "," + chunkZ, true );
|
||||
|
||||
this.writeSpawnData( dim, chunkX, chunkZ, data );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGenerated( int dim, int chunkX, int chunkZ )
|
||||
{
|
||||
synchronized( SpawnData.class )
|
||||
{
|
||||
NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
|
||||
return data.getBoolean( chunkX + "," + chunkZ );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addNearByMeteorites( int dim, int chunkX, int chunkZ, NBTTagCompound newData )
|
||||
{
|
||||
synchronized( SpawnData.class )
|
||||
{
|
||||
NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
|
||||
|
||||
// edit.
|
||||
int size = data.getInteger( "num" );
|
||||
data.setTag( String.valueOf( size ), newData );
|
||||
data.setInteger( "num", size + 1 );
|
||||
|
||||
this.writeSpawnData( dim, chunkX, chunkZ, data );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<NBTTagCompound> getNearByMeteorites( int dim, int chunkX, int chunkZ )
|
||||
{
|
||||
Collection<NBTTagCompound> ll = new LinkedList<NBTTagCompound>();
|
||||
|
||||
synchronized( SpawnData.class )
|
||||
{
|
||||
for( int x = -1; x <= 1; x++ )
|
||||
{
|
||||
for( int z = -1; z <= 1; z++ )
|
||||
{
|
||||
int cx = x + ( chunkX >> 4 );
|
||||
int cz = z + ( chunkZ >> 4 );
|
||||
|
||||
NBTTagCompound data = this.loadSpawnData( dim, cx << 4, cz << 4 );
|
||||
|
||||
if( data != null )
|
||||
{
|
||||
// edit.
|
||||
int size = data.getInteger( "num" );
|
||||
for( int s = 0; s < size; s++ )
|
||||
{
|
||||
ll.add( data.getCompoundTag( String.valueOf( s ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ll;
|
||||
}
|
||||
|
||||
private NBTTagCompound loadSpawnData( int dim, int chunkX, int chunkZ )
|
||||
{
|
||||
if( !Thread.holdsLock( SpawnData.class ) )
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Request" );
|
||||
}
|
||||
|
||||
NBTTagCompound data = null;
|
||||
final String fileName = this.encoder.encode( dim, chunkX, chunkZ );
|
||||
final File file = new File( this.spawnDirectory, fileName );
|
||||
|
||||
if( file.isFile() )
|
||||
{
|
||||
FileInputStream fileInputStream = null;
|
||||
|
||||
try
|
||||
{
|
||||
fileInputStream = new FileInputStream( file );
|
||||
data = CompressedStreamTools.readCompressed( fileInputStream );
|
||||
}
|
||||
catch( Throwable e )
|
||||
{
|
||||
data = new NBTTagCompound();
|
||||
AELog.error( e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
if( fileInputStream != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
fileInputStream.close();
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
data = new NBTTagCompound();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private void writeSpawnData( int dim, int chunkX, int chunkZ, NBTTagCompound data )
|
||||
{
|
||||
if( !Thread.holdsLock( SpawnData.class ) )
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Request" );
|
||||
}
|
||||
|
||||
final String fileName = this.encoder.encode( dim, chunkX, chunkZ );
|
||||
final File file = new File( this.spawnDirectory, fileName );
|
||||
FileOutputStream fileOutputStream = null;
|
||||
|
||||
try
|
||||
{
|
||||
fileOutputStream = new FileOutputStream( file );
|
||||
CompressedStreamTools.writeCompressed( data, fileOutputStream );
|
||||
}
|
||||
catch( Throwable e )
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
if( fileOutputStream != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
fileOutputStream.close();
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import appeng.me.GridStorage;
|
||||
import appeng.me.GridStorageSearch;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOnWorldStoppable
|
||||
{
|
||||
private static final String LAST_GRID_STORAGE_CATEGORY = "Counters";
|
||||
private static final String LAST_GRID_STORAGE_KEY = "lastGridStorage";
|
||||
private static final int LAST_GRID_STORAGE_DEFAULT = 0;
|
||||
|
||||
private static final String GRID_STORAGE_CATEGORY = "gridstorage";
|
||||
|
||||
private final Map<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap<GridStorageSearch, WeakReference<GridStorageSearch>>( 10 );
|
||||
private final Configuration config;
|
||||
|
||||
private long lastGridStorage;
|
||||
|
||||
public StorageData( @Nonnull final File settingsFile, @Nonnull final String version )
|
||||
{
|
||||
Preconditions.checkNotNull( settingsFile );
|
||||
Preconditions.checkNotNull( version );
|
||||
Preconditions.checkArgument( !version.isEmpty() );
|
||||
|
||||
this.config = new Configuration( settingsFile, version );
|
||||
}
|
||||
|
||||
/**
|
||||
* lazy loading, can load any id, even ones that don't exist anymore.
|
||||
*
|
||||
* @param storageID ID of grid storage
|
||||
*
|
||||
* @return corresponding grid storage
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public GridStorage getGridStorage( long storageID )
|
||||
{
|
||||
GridStorageSearch gss = new GridStorageSearch( storageID );
|
||||
WeakReference<GridStorageSearch> result = this.loadedStorage.get( gss );
|
||||
|
||||
if( result == null || result.get() == null )
|
||||
{
|
||||
String id = String.valueOf( storageID );
|
||||
String data = this.config.get( "gridstorage", id, "" ).getString();
|
||||
GridStorage thisStorage = new GridStorage( data, storageID, gss );
|
||||
gss.gridStorage = new WeakReference<GridStorage>( thisStorage );
|
||||
this.loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
|
||||
return thisStorage;
|
||||
}
|
||||
|
||||
return result.get().gridStorage.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new storage
|
||||
*/
|
||||
@Nonnull
|
||||
@Override
|
||||
public GridStorage getNewGridStorage()
|
||||
{
|
||||
long storageID = this.nextGridStorage();
|
||||
GridStorageSearch gss = new GridStorageSearch( storageID );
|
||||
GridStorage newStorage = new GridStorage( storageID, gss );
|
||||
gss.gridStorage = new WeakReference<GridStorage>( newStorage );
|
||||
this.loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
|
||||
|
||||
return newStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long nextGridStorage()
|
||||
{
|
||||
long r = this.lastGridStorage;
|
||||
this.lastGridStorage++;
|
||||
this.config.get( "Counters", "lastGridStorage", this.lastGridStorage ).set( Long.toString( this.lastGridStorage ) );
|
||||
return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyGridStorage( long id )
|
||||
{
|
||||
String stringID = String.valueOf( id );
|
||||
this.config.getCategory( "gridstorage" ).remove( stringID );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextOrderedValue( String name )
|
||||
{
|
||||
Property p = this.config.get( "orderedValues", name, 0 );
|
||||
int myValue = p.getInt();
|
||||
p.set( myValue + 1 );
|
||||
return myValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldStart()
|
||||
{
|
||||
final String lastString = this.config.get( LAST_GRID_STORAGE_CATEGORY, LAST_GRID_STORAGE_KEY, LAST_GRID_STORAGE_DEFAULT ).getString();
|
||||
|
||||
try
|
||||
{
|
||||
this.lastGridStorage = Long.parseLong( lastString );
|
||||
}
|
||||
catch( NumberFormatException err )
|
||||
{
|
||||
AELog.warning( "The config contained a value which was not represented as a Long: %s", lastString );
|
||||
|
||||
this.lastGridStorage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldStop()
|
||||
{
|
||||
// populate new data
|
||||
for( GridStorageSearch gs : this.loadedStorage.keySet() )
|
||||
{
|
||||
GridStorage thisStorage = gs.gridStorage.get();
|
||||
if( thisStorage != null && thisStorage.getGrid() != null && !thisStorage.getGrid().isEmpty() )
|
||||
{
|
||||
String value = thisStorage.getValue();
|
||||
this.config.get( GRID_STORAGE_CATEGORY, String.valueOf( thisStorage.getID() ), value ).set( value );
|
||||
}
|
||||
}
|
||||
|
||||
this.config.save();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.worlddata;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.services.CompassService;
|
||||
import appeng.services.compass.CompassThreadFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Singleton access to anything related to world-based data.
|
||||
*
|
||||
* Data will change depending which world is loaded. Will probably not affect SMP at all since only one world is loaded, but SSP more, cause they play on
|
||||
* different worlds.
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
public final class WorldData implements IWorldData
|
||||
{
|
||||
private static final String AE2_DIRECTORY_NAME = "AE2";
|
||||
private static final String SETTING_FILE_NAME = "settings.cfg";
|
||||
private static final String SPAWNDATA_DIR_NAME = "spawndata";
|
||||
private static final String COMPASS_DIR_NAME = "compass";
|
||||
|
||||
@Nullable
|
||||
private static IWorldData instance;
|
||||
|
||||
private final IWorldPlayerData playerData;
|
||||
private final IWorldDimensionData dimensionData;
|
||||
private final IWorldGridStorageData storageData;
|
||||
private final IWorldCompassData compassData;
|
||||
private final IWorldSpawnData spawnData;
|
||||
|
||||
private final List<IOnWorldStartable> startables;
|
||||
private final List<IOnWorldStoppable> stoppables;
|
||||
|
||||
private final File ae2directory;
|
||||
private final File spawnDirectory;
|
||||
private final File compassDirectory;
|
||||
|
||||
private WorldData( @Nonnull final File worldDirectory )
|
||||
{
|
||||
Preconditions.checkNotNull( worldDirectory );
|
||||
Preconditions.checkArgument( worldDirectory.isDirectory() );
|
||||
|
||||
this.ae2directory = new File( worldDirectory, AE2_DIRECTORY_NAME );
|
||||
this.spawnDirectory = new File( this.ae2directory, SPAWNDATA_DIR_NAME );
|
||||
this.compassDirectory = new File( this.ae2directory, COMPASS_DIR_NAME );
|
||||
|
||||
final File settingsFile = new File( this.ae2directory, SETTING_FILE_NAME );
|
||||
|
||||
final PlayerData playerData = new PlayerData( settingsFile, AEConfig.VERSION );
|
||||
final DimensionData dimensionData = new DimensionData( settingsFile, AEConfig.VERSION );
|
||||
final StorageData storageData = new StorageData( settingsFile, AEConfig.VERSION );
|
||||
|
||||
final ThreadFactory compassThreadFactory = new CompassThreadFactory();
|
||||
final CompassService compassService = new CompassService( this.compassDirectory, compassThreadFactory );
|
||||
final CompassData compassData = new CompassData( this.compassDirectory, compassService );
|
||||
|
||||
final IWorldSpawnData spawnData = new SpawnData( this.spawnDirectory );
|
||||
|
||||
this.playerData = playerData;
|
||||
this.dimensionData = dimensionData;
|
||||
this.storageData = storageData;
|
||||
this.compassData = compassData;
|
||||
this.spawnData = spawnData;
|
||||
|
||||
this.startables = Lists.<IOnWorldStartable>newArrayList( playerData, dimensionData, storageData );
|
||||
this.stoppables = Lists.<IOnWorldStoppable>newArrayList( playerData, dimensionData, storageData, compassData );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ae2 data related to a specific world
|
||||
*
|
||||
* @deprecated do not use singletons which are dependent on specific world state
|
||||
*/
|
||||
@Deprecated
|
||||
@Nonnull
|
||||
public static IWorldData instance()
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires to start up from external from here
|
||||
*
|
||||
* drawback of the singleton build style
|
||||
*/
|
||||
public static void onServerAboutToStart()
|
||||
{
|
||||
final File worldDirectory = DimensionManager.getCurrentSaveRootDirectory();
|
||||
final WorldData newInstance = new WorldData( worldDirectory );
|
||||
|
||||
instance = newInstance;
|
||||
newInstance.onServerStarting();
|
||||
}
|
||||
|
||||
private void onServerStarting()
|
||||
{
|
||||
// check if ae2 folder already exists, else create
|
||||
if( !this.ae2directory.isDirectory() && !this.ae2directory.mkdir() )
|
||||
{
|
||||
throw new IllegalStateException( "Failed to create " + this.ae2directory.getAbsolutePath() );
|
||||
}
|
||||
|
||||
// check if compass folder already exists, else create
|
||||
if( !this.compassDirectory.isDirectory() && !this.compassDirectory.mkdir() )
|
||||
{
|
||||
throw new IllegalStateException( "Failed to create " + this.compassDirectory.getAbsolutePath() );
|
||||
}
|
||||
|
||||
// check if spawn data dir already exists, else create
|
||||
if( !this.spawnDirectory.isDirectory() && !this.spawnDirectory.mkdir() )
|
||||
{
|
||||
throw new IllegalStateException( "Failed to create " + this.spawnDirectory.getAbsolutePath() );
|
||||
}
|
||||
|
||||
for( IOnWorldStartable startable : this.startables )
|
||||
{
|
||||
startable.onWorldStart();
|
||||
}
|
||||
|
||||
this.startables.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServerStopping()
|
||||
{
|
||||
Preconditions.checkNotNull( instance );
|
||||
|
||||
for( IOnWorldStoppable stoppable : this.stoppables )
|
||||
{
|
||||
stoppable.onWorldStop();
|
||||
}
|
||||
|
||||
this.stoppables.clear();
|
||||
|
||||
instance = null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IWorldGridStorageData storageData()
|
||||
{
|
||||
return this.storageData;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IWorldPlayerData playerData()
|
||||
{
|
||||
return this.playerData;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IWorldDimensionData dimensionData()
|
||||
{
|
||||
return this.dimensionData;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IWorldCompassData compassData()
|
||||
{
|
||||
return this.compassData;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IWorldSpawnData spawnData()
|
||||
{
|
||||
return this.spawnData;
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBC;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import appeng.parts.CableBusStorage;
|
||||
|
||||
@@ -137,11 +137,13 @@ public class FacadeContainer implements IFacadeContainer
|
||||
boolean isBC = ids[0] < 0;
|
||||
ids[0] = Math.abs( ids[0] );
|
||||
|
||||
if( isBC && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
|
||||
if( isBC && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
final IFacadePart created = bc.createFacadePart( (Block) Block.blockRegistry.getObjectById( ids[0] ), ids[1], side );
|
||||
changed = changed || this.storage.getFacade( x ) == null;
|
||||
this.storage.setFacade( x, bc.createFacadePart( (Block) Block.blockRegistry.getObjectById( ids[0] ), ids[1], side ) );
|
||||
|
||||
this.storage.setFacade( x, created );
|
||||
}
|
||||
else if( !isBC )
|
||||
{
|
||||
@@ -187,9 +189,9 @@ public class FacadeContainer implements IFacadeContainer
|
||||
}
|
||||
else
|
||||
{
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
if( bc.isFacade( is ) )
|
||||
{
|
||||
this.storage.setFacade( x, bc.createFacadePart( is, ForgeDirection.getOrientation( x ) ) );
|
||||
@@ -221,7 +223,7 @@ public class FacadeContainer implements IFacadeContainer
|
||||
{
|
||||
int itemID = Item.getIdFromItem( part.getItem() );
|
||||
int dmgValue = part.getItemDamage();
|
||||
out.writeInt( itemID * ( part.isBC() ? -1 : 1 ) );
|
||||
out.writeInt( itemID * ( part.notAEFacade() ? -1 : 1 ) );
|
||||
out.writeInt( dmgValue );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ package appeng.facade;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -53,7 +54,7 @@ import appeng.client.render.RenderBlocksWorkaround;
|
||||
import appeng.core.AELog;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBC;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -131,10 +132,10 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
}
|
||||
|
||||
IIcon myIcon = null;
|
||||
if( this.isBC() )
|
||||
if( this.notAEFacade() && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
myIcon = bc.getFacadeTexture();
|
||||
IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
myIcon = bc.getCobbleStructurePipeTexture();
|
||||
}
|
||||
|
||||
if( myIcon == null )
|
||||
@@ -144,7 +145,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
|
||||
instance.setTexture( myIcon );
|
||||
|
||||
if( this.isBC() )
|
||||
if( this.notAEFacade() )
|
||||
{
|
||||
instance.setBounds( 6, 6, 10, 10, 10, 15 );
|
||||
}
|
||||
@@ -342,6 +343,124 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( IPartRenderHelper instance, RenderBlocks renderer )
|
||||
{
|
||||
if( this.facade != null )
|
||||
{
|
||||
IFacadeItem fi = (IFacadeItem) this.facade.getItem();
|
||||
|
||||
try
|
||||
{
|
||||
if( fi != null )
|
||||
{
|
||||
ItemStack randomItem = fi.getTextureItem( this.facade );
|
||||
|
||||
instance.setTexture( this.facade.getIconIndex() );
|
||||
instance.setBounds( 7, 7, 4, 9, 9, 14 );
|
||||
instance.renderInventoryBox( renderer );
|
||||
instance.setTexture( null );
|
||||
|
||||
if( randomItem != null )
|
||||
{
|
||||
if( randomItem.getItem() instanceof ItemBlock )
|
||||
{
|
||||
ItemBlock ib = (ItemBlock) randomItem.getItem();
|
||||
Block blk = Block.getBlockFromItem( ib );
|
||||
|
||||
try
|
||||
{
|
||||
int color = ib.getColorFromItemStack( randomItem, 0 );
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
|
||||
instance.setInvColor( color );
|
||||
}
|
||||
catch( Throwable error )
|
||||
{
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
|
||||
instance.setInvColor( 0xffffff );
|
||||
}
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
Tessellator.instance.setColorOpaque_F( 1, 1, 1 );
|
||||
instance.setTexture( blk.getIcon( this.side.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );
|
||||
|
||||
instance.setBounds( 0, 0, 14, 16, 16, 16 );
|
||||
instance.renderInventoryBox( renderer );
|
||||
|
||||
instance.setTexture( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getSide()
|
||||
{
|
||||
return this.side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getPrimaryBox()
|
||||
{
|
||||
return Platform.getPrimaryBox( this.side, this.thickness );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem()
|
||||
{
|
||||
ItemStack is = this.getTexture();
|
||||
if( is == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return is.getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemDamage()
|
||||
{
|
||||
ItemStack is = this.getTexture();
|
||||
if( is == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return is.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean notAEFacade()
|
||||
{
|
||||
return !( this.facade.getItem() instanceof IFacadeItem );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThinFacades( boolean useThinFacades )
|
||||
{
|
||||
this.thickness = useThinFacades ? 1 : 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransparent()
|
||||
{
|
||||
if( AEApi.instance().partHelper().getCableRenderMode().transparentFacades )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack is = this.getTexture();
|
||||
Block blk = Block.getBlockFromItem( is.getItem() );
|
||||
|
||||
return !blk.isOpaqueCube();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
ItemStack getTexture()
|
||||
{
|
||||
final Item maybeFacade = this.facade.getItem();
|
||||
@@ -353,9 +472,9 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
|
||||
return facade.getTextureItem( this.facade );
|
||||
}
|
||||
else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
|
||||
else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
|
||||
return bc.getTextureForFacade( this.facade );
|
||||
}
|
||||
@@ -484,120 +603,6 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( IPartRenderHelper instance, RenderBlocks renderer )
|
||||
{
|
||||
if( this.facade != null )
|
||||
{
|
||||
IFacadeItem fi = (IFacadeItem) this.facade.getItem();
|
||||
|
||||
try
|
||||
{
|
||||
ItemStack randomItem = fi.getTextureItem( this.facade );
|
||||
|
||||
instance.setTexture( this.facade.getIconIndex() );
|
||||
instance.setBounds( 7, 7, 4, 9, 9, 14 );
|
||||
instance.renderInventoryBox( renderer );
|
||||
instance.setTexture( null );
|
||||
|
||||
if( randomItem != null )
|
||||
{
|
||||
if( randomItem.getItem() instanceof ItemBlock )
|
||||
{
|
||||
ItemBlock ib = (ItemBlock) randomItem.getItem();
|
||||
Block blk = Block.getBlockFromItem( ib );
|
||||
|
||||
try
|
||||
{
|
||||
int color = ib.getColorFromItemStack( randomItem, 0 );
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
|
||||
instance.setInvColor( color );
|
||||
}
|
||||
catch( Throwable error )
|
||||
{
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
|
||||
instance.setInvColor( 0xffffff );
|
||||
}
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
Tessellator.instance.setColorOpaque_F( 1, 1, 1 );
|
||||
instance.setTexture( blk.getIcon( this.side.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );
|
||||
|
||||
instance.setBounds( 0, 0, 14, 16, 16, 16 );
|
||||
instance.renderInventoryBox( renderer );
|
||||
|
||||
instance.setTexture( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getSide()
|
||||
{
|
||||
return this.side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getPrimaryBox()
|
||||
{
|
||||
return Platform.getPrimaryBox( this.side, this.thickness );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem()
|
||||
{
|
||||
ItemStack is = this.getTexture();
|
||||
if( is == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return is.getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemDamage()
|
||||
{
|
||||
ItemStack is = this.getTexture();
|
||||
if( is == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return is.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBC()
|
||||
{
|
||||
return !( this.facade.getItem() instanceof IFacadeItem );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThinFacades( boolean useThinFacades )
|
||||
{
|
||||
this.thickness = useThinFacades ? 1 : 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransparent()
|
||||
{
|
||||
if( AEApi.instance().partHelper().getCableRenderMode().transparentFacades )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack is = this.getTexture();
|
||||
Block blk = Block.getBlockFromItem( is.getItem() );
|
||||
|
||||
return !blk.isOpaqueCube();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes( IPartCollisionHelper bch )
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -44,7 +44,7 @@ import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.lib.raytracer.IndexedCuboid6;
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.multipart.IRedstonePart;
|
||||
import codechicken.multipart.IMaskedRedstonePart;
|
||||
import codechicken.multipart.JCuboidPart;
|
||||
import codechicken.multipart.JNormalOcclusion;
|
||||
import codechicken.multipart.NormalOcclusionTest;
|
||||
@@ -83,24 +83,41 @@ import appeng.util.Platform;
|
||||
*
|
||||
* TSlottedPart,ISidedHollowConnect
|
||||
*/
|
||||
public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IRedstonePart, AEMultiTile
|
||||
public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IMaskedRedstonePart, AEMultiTile
|
||||
{
|
||||
|
||||
public static final ThreadLocal<Boolean> DISABLE_FACADE_OCCLUSION = new ThreadLocal<Boolean>();
|
||||
|
||||
private static final double SHORTER = 6.0 / 16.0;
|
||||
private static final double LONGER = 10.0 / 16.0;
|
||||
private static final double MIN_DIRECTION = 0;
|
||||
private static final double MAX_DIRECTION = 1.0;
|
||||
private static final Cuboid6[] SIDE_TESTS = new Cuboid6[] {
|
||||
|
||||
new Cuboid6( 6.0 / 16.0, 0, 6.0 / 16.0, 10.0 / 16.0, 6.0 / 16.0, 10.0 / 16.0 ), // DOWN(0, -1, 0),
|
||||
// DOWN(0, -1, 0),
|
||||
new Cuboid6( SHORTER, MIN_DIRECTION, SHORTER, LONGER, SHORTER, LONGER ),
|
||||
|
||||
new Cuboid6( 6.0 / 16.0, 10.0 / 16.0, 6.0 / 16.0, 10.0 / 16.0, 1.0, 10.0 / 16.0 ), // UP(0, 1, 0),
|
||||
// UP(0, 1, 0),
|
||||
new Cuboid6( SHORTER, LONGER, SHORTER, LONGER, MAX_DIRECTION, LONGER ),
|
||||
|
||||
new Cuboid6( 6.0 / 16.0, 6.0 / 16.0, 0.0, 10.0 / 16.0, 10.0 / 16.0, 6.0 / 16.0 ),// NORTH(0, 0, -1),
|
||||
// NORTH(0, 0, -1),
|
||||
new Cuboid6( SHORTER, SHORTER, MIN_DIRECTION, LONGER, LONGER, SHORTER ),
|
||||
|
||||
new Cuboid6( 6.0 / 16.0, 6.0 / 16.0, 10.0 / 16.0, 10.0 / 16.0, 10.0 / 16.0, 1.0 ),// SOUTH(0, 0, 1),
|
||||
// SOUTH(0, 0, 1),
|
||||
new Cuboid6( SHORTER, SHORTER, LONGER, LONGER, LONGER, MAX_DIRECTION ),
|
||||
|
||||
new Cuboid6( 0.0, 6.0 / 16.0, 6.0 / 16.0, 6.0 / 16.0, 10.0 / 16.0, 10.0 / 16.0 ),// WEST(-1, 0, 0),
|
||||
// WEST(-1, 0, 0),
|
||||
new Cuboid6( MIN_DIRECTION, SHORTER, SHORTER, SHORTER, LONGER, LONGER ),
|
||||
|
||||
new Cuboid6( 10.0 / 16.0, 6.0 / 16.0, 6.0 / 16.0, 1.0, 10.0 / 16.0, 10.0 / 16.0 ),// EAST(1, 0, 0),
|
||||
// EAST(1, 0, 0),
|
||||
new Cuboid6( LONGER, SHORTER, SHORTER, MAX_DIRECTION, LONGER, LONGER ),
|
||||
};
|
||||
|
||||
/**
|
||||
* Mask for {@link IMaskedRedstonePart#getConnectionMask(int)}
|
||||
*
|
||||
* the bits are derived from the rotation, where 4 is the center
|
||||
*/
|
||||
private static final int CONNECTION_MASK = 0x000010;
|
||||
public CableBusContainer cb = new CableBusContainer( this );
|
||||
boolean canUpdate = false;
|
||||
|
||||
@@ -497,12 +514,15 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
||||
is = is.copy();
|
||||
is.stackSize = 1;
|
||||
|
||||
IPart bp = bi.createPartFromItemStack( is );
|
||||
final IPart bp = bi.createPartFromItemStack( is );
|
||||
if( !( side == null || side == ForgeDirection.UNKNOWN || this.tile() == null ) )
|
||||
{
|
||||
List<AxisAlignedBB> boxes = new ArrayList<AxisAlignedBB>();
|
||||
IPartCollisionHelper bch = new BusCollisionHelper( boxes, side, null, true );
|
||||
bp.getBoxes( bch );
|
||||
if( bp != null )
|
||||
{
|
||||
bp.getBoxes( bch );
|
||||
}
|
||||
for( AxisAlignedBB bb : boxes )
|
||||
{
|
||||
if( !this.tile().canAddPart( new NormallyOccludedPart( new Cuboid6( bb ) ) ) )
|
||||
@@ -559,15 +579,6 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
||||
public void clearContainer()
|
||||
{
|
||||
this.cb = new CableBusContainer( this );
|
||||
} @Override
|
||||
public Iterable<Cuboid6> getCollisionBoxes()
|
||||
{
|
||||
LinkedList<Cuboid6> l = new LinkedList<Cuboid6>();
|
||||
for( AxisAlignedBB b : this.cb.getSelectedBoundingBoxesFromPool( false, true, null, true ) )
|
||||
{
|
||||
l.add( new Cuboid6( b.minX, b.minY, b.minZ, b.maxX, b.maxY, b.maxZ ) );
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -579,7 +590,11 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
||||
}
|
||||
|
||||
DISABLE_FACADE_OCCLUSION.set( true );
|
||||
boolean blocked = !this.tile().canAddPart( new NormallyOccludedPart( SIDE_TESTS[side.ordinal()] ) );
|
||||
|
||||
final int ordinal = side.ordinal();
|
||||
final Cuboid6 sideTest = SIDE_TESTS[ordinal];
|
||||
final NormallyOccludedPart occludedPart = new NormallyOccludedPart( sideTest );
|
||||
boolean blocked = !this.tile().canAddPart( occludedPart );
|
||||
DISABLE_FACADE_OCCLUSION.remove();
|
||||
|
||||
return blocked;
|
||||
@@ -627,15 +642,6 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
||||
public Set<LayerFlags> getLayerFlags()
|
||||
{
|
||||
return this.cb.getLayerFlags();
|
||||
} @Override
|
||||
public Iterable<IndexedCuboid6> getSubParts()
|
||||
{
|
||||
LinkedList<IndexedCuboid6> l = new LinkedList<IndexedCuboid6>();
|
||||
for( Cuboid6 c : this.getCollisionBoxes() )
|
||||
{
|
||||
l.add( new IndexedCuboid6( 0, c ) );
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -664,7 +670,31 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
||||
return this.cb.isInWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Cuboid6> getCollisionBoxes()
|
||||
{
|
||||
LinkedList<Cuboid6> l = new LinkedList<Cuboid6>();
|
||||
for( AxisAlignedBB b : this.cb.getSelectedBoundingBoxesFromPool( false, true, null, true ) )
|
||||
{
|
||||
l.add( new Cuboid6( b.minX, b.minY, b.minZ, b.maxX, b.maxY, b.maxZ ) );
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<IndexedCuboid6> getSubParts()
|
||||
{
|
||||
LinkedList<IndexedCuboid6> l = new LinkedList<IndexedCuboid6>();
|
||||
for( Cuboid6 c : this.getCollisionBoxes() )
|
||||
{
|
||||
l.add( new IndexedCuboid6( 0, c ) );
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getConnectionMask( int side )
|
||||
{
|
||||
return CONNECTION_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -21,6 +21,7 @@ package appeng.integration;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -98,6 +99,7 @@ public enum IntegrationRegistry
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Object getInstance( IntegrationType name )
|
||||
{
|
||||
for( IntegrationNode node : this.modules )
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -27,7 +27,11 @@ public enum IntegrationType
|
||||
|
||||
RC( IntegrationSide.BOTH, "Railcraft", "Railcraft" ),
|
||||
|
||||
BC( IntegrationSide.BOTH, "BuildCraft", "BuildCraft|Silicon" ),
|
||||
BuildCraftCore( IntegrationSide.BOTH, "BuildCraft Core", "BuildCraft|Core" ),
|
||||
|
||||
BuildCraftTransport( IntegrationSide.BOTH, "BuildCraft Transport", "BuildCraft|Transport"),
|
||||
|
||||
BuildCraftBuilder( IntegrationSide.BOTH, "BuildCraft Builders", "BuildCraft|Builders"),
|
||||
|
||||
RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", "CoFHAPI" ),
|
||||
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.abstraction;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.parts.IFacadePart;
|
||||
|
||||
|
||||
public interface IBC
|
||||
{
|
||||
boolean isWrench( Item eq );
|
||||
|
||||
boolean canWrench( Item i, EntityPlayer p, int x, int y, int z );
|
||||
|
||||
void wrenchUsed( Item i, EntityPlayer p, int x, int y, int z );
|
||||
|
||||
boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
|
||||
|
||||
boolean addItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
|
||||
|
||||
boolean isFacade( ItemStack is );
|
||||
|
||||
boolean isPipe( TileEntity te, ForgeDirection dir );
|
||||
|
||||
void addFacade( ItemStack item );
|
||||
|
||||
void registerPowerP2P();
|
||||
|
||||
void registerItemP2P();
|
||||
|
||||
void registerLiquidsP2P();
|
||||
|
||||
IFacadePart createFacadePart( Block blk, int meta, ForgeDirection side );
|
||||
|
||||
IFacadePart createFacadePart( ItemStack held, ForgeDirection side );
|
||||
|
||||
ItemStack getTextureForFacade( ItemStack facade );
|
||||
|
||||
IIcon getFacadeTexture();
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.abstraction;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
|
||||
/**
|
||||
* Contains wrench behaviour
|
||||
*
|
||||
* and registers the engines as P2P attunements for RF tunnels
|
||||
* (since BC 7, they are part of BC Core)
|
||||
* The attunement is currently not public anymore,
|
||||
* because it was only used internally
|
||||
*
|
||||
* @author AlgorithmX2
|
||||
* @version rv3
|
||||
* @since rv0
|
||||
*/
|
||||
public interface IBuildCraftCore
|
||||
{
|
||||
/**
|
||||
* @param eq to be checked item, can be {@code null}
|
||||
*
|
||||
* @return {@code true} if it is an {@link buildcraft.api.tools.IToolWrench}
|
||||
*/
|
||||
boolean isWrench( @Nullable Item eq );
|
||||
|
||||
/**
|
||||
* @param wrench to be checked item, must be an {@link buildcraft.api.tools.IToolWrench}
|
||||
* @param wrencher wrenching player, can be probably {@code null}, but not sure
|
||||
* @param x x pos
|
||||
* @param y y pos
|
||||
* @param z z pos
|
||||
*
|
||||
* @return {@code true} if player can wrench with that {@code wrench}
|
||||
*
|
||||
* @throws NullPointerException if {@code wrench} is {@code null}
|
||||
* @throws ClassCastException if {@code wrench} is not an {@link buildcraft.api.tools.IToolWrench}
|
||||
*/
|
||||
boolean canWrench( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z );
|
||||
|
||||
/**
|
||||
* @param wrench to be checked item, must be an {@link buildcraft.api.tools.IToolWrench}
|
||||
* @param wrencher wrenching player, can be probably {@code null}, but not sure
|
||||
* @param x x pos
|
||||
* @param y y pos
|
||||
* @param z z pos
|
||||
*
|
||||
* @throws NullPointerException if {@code wrench} is {@code null}
|
||||
* @throws ClassCastException if {@code wrench} is not an {@link buildcraft.api.tools.IToolWrench}
|
||||
*/
|
||||
void wrenchUsed( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z );
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.abstraction;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.parts.IFacadePart;
|
||||
|
||||
|
||||
/**
|
||||
* Contains facade logic to interchange BC facades with AE facades,
|
||||
*
|
||||
* pipe logic to interact between storage buses and pipes
|
||||
*
|
||||
* and using pipes for attunements
|
||||
* The attunement is currently not public anymore,
|
||||
* because it was only used internally
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv3 - 12.06.2015
|
||||
* @since rv3 12.06.2015
|
||||
*/
|
||||
public interface IBuildCraftTransport
|
||||
{
|
||||
/**
|
||||
* @param is to be checked item
|
||||
*
|
||||
* @return {@code true} if the checked item is a {@link buildcraft.api.facades.IFacadeItem}
|
||||
*/
|
||||
boolean isFacade( @Nullable ItemStack is );
|
||||
|
||||
/**
|
||||
* @param blk block used for the ae facade
|
||||
* @param meta meta of the block
|
||||
* @param side side of the ae facade
|
||||
*
|
||||
* @return ae facade through bc facade system
|
||||
*/
|
||||
@Nullable
|
||||
IFacadePart createFacadePart( @Nullable Block blk, int meta, @Nonnull ForgeDirection side );
|
||||
|
||||
/**
|
||||
* @param held create facade for that item
|
||||
* @param side on which side should the part be rendered, should rather be not {@code null}
|
||||
*
|
||||
* @return new instance using the {@code held} and side as direct argument, no logic in between
|
||||
*
|
||||
* @throws IllegalArgumentException if {@code held} is {@code null}
|
||||
*/
|
||||
IFacadePart createFacadePart( @Nonnull ItemStack held, @Nonnull ForgeDirection side );
|
||||
|
||||
/**
|
||||
* @param facade buildcraft facade
|
||||
*
|
||||
* @return item with the block and metadata based on the facade or {@code null} if {@code facade} was not a facade
|
||||
*
|
||||
* @throws NullPointerException if {@code facade} is {@code null}
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack getTextureForFacade( @Nonnull ItemStack facade );
|
||||
|
||||
/**
|
||||
* @return texture of buildcraft cobblestone structure pipe or null if something bad happens
|
||||
*/
|
||||
@Nullable
|
||||
IIcon getCobbleStructurePipeTexture();
|
||||
|
||||
/**
|
||||
* @param te the to be checked {@link TileEntity}
|
||||
* @param dir direction of the {@link TileEntity}
|
||||
*
|
||||
* @return {@code true} if {@code te} is a buildcraft pipe, but not plugged
|
||||
*
|
||||
* @throws NullPointerException if {@code dir} is {@code null}
|
||||
*/
|
||||
boolean isPipe( @Nullable TileEntity te, @Nonnull ForgeDirection dir );
|
||||
|
||||
/**
|
||||
* checks weather if the {@code te} is injectable and simulates to inject the item
|
||||
*
|
||||
* @param te preferred something like a buildcraft injectable, can handle anything, just fails that way
|
||||
* @param is to be injected item
|
||||
* @param dir direction of the pipe
|
||||
*
|
||||
* @return {@code true} if items were simulated successfully being added
|
||||
*/
|
||||
boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
|
||||
|
||||
/**
|
||||
* checks weather if the {@code te} is injectable, simulates the inject and tries to inject the item
|
||||
*
|
||||
* @param te preferred something like a buildcraft injectable, can handle anything, just fails that way
|
||||
* @param is to be injected item
|
||||
* @param dir direction of the pipe
|
||||
*
|
||||
* @return {@code true} if items were added to the buildcraft pipe
|
||||
*/
|
||||
boolean addItemsToPipe( @Nullable TileEntity te, @Nullable ItemStack is, @Nonnull ForgeDirection dir );
|
||||
}
|
||||
@@ -1,373 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
|
||||
import buildcraft.BuildCraftEnergy;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.blueprints.BuilderAPI;
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.ISchematicRegistry;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
import buildcraft.api.blueprints.SchematicTile;
|
||||
import buildcraft.api.facades.IFacadeItem;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import buildcraft.api.transport.IInjectable;
|
||||
import buildcraft.api.transport.IPipeConnection;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.transport.ItemFacade;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.facade.FacadePart;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IBC;
|
||||
import appeng.integration.modules.BCHelpers.AECableSchematicTile;
|
||||
import appeng.integration.modules.BCHelpers.AEGenericSchematicTile;
|
||||
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
|
||||
import appeng.integration.modules.BCHelpers.BCPipeHandler;
|
||||
|
||||
|
||||
public final class BC extends BaseModule implements IBC
|
||||
{
|
||||
|
||||
public static BC instance;
|
||||
|
||||
public BC()
|
||||
{
|
||||
this.testClassExistence( BuildCraftEnergy.class );
|
||||
this.testClassExistence( BuildCraftTransport.class );
|
||||
this.testClassExistence( BuilderAPI.class );
|
||||
this.testClassExistence( IBuilderContext.class );
|
||||
this.testClassExistence( ISchematicRegistry.class );
|
||||
this.testClassExistence( IFacadeItem.class );
|
||||
this.testClassExistence( IToolWrench.class );
|
||||
this.testClassExistence( IInjectable.class );
|
||||
this.testClassExistence( IPipeConnection.class );
|
||||
this.testClassExistence( IPipeTile.class );
|
||||
this.testClassExistence( ItemFacade.class );
|
||||
this.testClassExistence( PipeIconProvider.class );
|
||||
this.testClassExistence( SchematicTile.class );
|
||||
this.testClassExistence( SchematicBlock.class );
|
||||
this.testClassExistence( IPipeTile.PipeType.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrench( Item eq )
|
||||
{
|
||||
return eq instanceof IToolWrench;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrench( Item i, EntityPlayer p, int x, int y, int z )
|
||||
{
|
||||
return ( (IToolWrench) i ).canWrench( p, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrenchUsed( Item i, EntityPlayer p, int x, int y, int z )
|
||||
{
|
||||
( (IToolWrench) i ).wrenchUsed( p, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir )
|
||||
{
|
||||
if( is != null && te != null && te instanceof IInjectable )
|
||||
{
|
||||
IInjectable pt = (IInjectable) te;
|
||||
if( pt.canInjectItems( dir ) )
|
||||
{
|
||||
int amt = pt.injectItem( is, false, dir, null );
|
||||
if( amt == is.stackSize )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir )
|
||||
{
|
||||
if( is != null && te != null && te instanceof IInjectable )
|
||||
{
|
||||
IInjectable pt = (IInjectable) te;
|
||||
if( pt.canInjectItems( dir ) )
|
||||
{
|
||||
int amt = pt.injectItem( is, false, dir, null );
|
||||
if( amt == is.stackSize )
|
||||
{
|
||||
pt.injectItem( is, true, dir, null );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFacade( ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return is.getItem() instanceof IFacadeItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPipe( TileEntity te, ForgeDirection dir )
|
||||
{
|
||||
if( te instanceof IPipeTile )
|
||||
{
|
||||
final IPipeTile pipeTile = (IPipeTile) te;
|
||||
return !pipeTile.hasPipePluggable( dir.getOpposite() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFacade( ItemStack item )
|
||||
{
|
||||
if( item != null )
|
||||
{
|
||||
FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", item );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPowerP2P()
|
||||
{
|
||||
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 0 ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 1 ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 2 ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerCobblestone ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerDiamond ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerGold ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerQuartz ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerStone ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerWood ), TunnelType.RF_POWER );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItemP2P()
|
||||
{
|
||||
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsWood ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsVoid ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsSandstone ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsQuartz ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsObsidian ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsIron ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsGold ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsEmerald ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsDiamond ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsStone ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsCobblestone ), TunnelType.ITEM );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerLiquidsP2P()
|
||||
{
|
||||
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsCobblestone ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsEmerald ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsGold ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsIron ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsSandstone ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsStone ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsVoid ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsWood ), TunnelType.FLUID );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFacadePart createFacadePart( Block blk, int meta, ForgeDirection side )
|
||||
{
|
||||
try
|
||||
{
|
||||
final ItemFacade.FacadeState state = ItemFacade.FacadeState.create( blk, meta );
|
||||
final ItemStack facade = ItemFacade.getFacade( state );
|
||||
|
||||
return new FacadePart( facade, side );
|
||||
}
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFacadePart createFacadePart( ItemStack fs, ForgeDirection side )
|
||||
{
|
||||
return new FacadePart( fs, side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getTextureForFacade( ItemStack facade )
|
||||
{
|
||||
final Item maybeFacadeItem = facade.getItem();
|
||||
|
||||
if( maybeFacadeItem instanceof buildcraft.api.facades.IFacadeItem )
|
||||
{
|
||||
final buildcraft.api.facades.IFacadeItem facadeItem = (buildcraft.api.facades.IFacadeItem) maybeFacadeItem;
|
||||
|
||||
final Block[] blocks = facadeItem.getBlocksForFacade( facade );
|
||||
final int[] metas = facadeItem.getMetaValuesForFacade( facade );
|
||||
|
||||
if( blocks.length > 0 && metas.length > 0 )
|
||||
{
|
||||
return new ItemStack( blocks[0], 1, metas[0] );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getFacadeTexture()
|
||||
{
|
||||
try
|
||||
{
|
||||
return BuildCraftTransport.instance.pipeIconProvider.getIcon( PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal() ); // Structure
|
||||
}
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
}
|
||||
return null;
|
||||
// Pipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
final IAppEngApi api = AEApi.instance();
|
||||
|
||||
api.partHelper().registerNewLayer( "appeng.parts.layers.LayerIPipeConnection", "buildcraft.api.transport.IPipeConnection" );
|
||||
api.registries().externalStorage().addExternalStorageInterface( new BCPipeHandler() );
|
||||
|
||||
final IBlocks blocks = api.definitions().blocks();
|
||||
|
||||
this.addFacadeStack( blocks.fluix() );
|
||||
this.addFacadeStack( blocks.quartz() );
|
||||
this.addFacadeStack( blocks.quartzChiseled() );
|
||||
this.addFacadeStack( blocks.quartzPillar() );
|
||||
|
||||
try
|
||||
{
|
||||
this.initBuilderSupport();
|
||||
}
|
||||
catch( Throwable builderSupport )
|
||||
{
|
||||
// not supported?
|
||||
}
|
||||
|
||||
for( Block skyStoneBlock : blocks.skyStone().maybeBlock().asSet() )
|
||||
{
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 0 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 1 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 2 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 3 ) );
|
||||
}
|
||||
}
|
||||
|
||||
private void addFacadeStack( IBlockDefinition definition )
|
||||
{
|
||||
for( ItemStack facadeStack : definition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
this.addFacade( facadeStack );
|
||||
}
|
||||
}
|
||||
|
||||
private void initBuilderSupport()
|
||||
{
|
||||
final ISchematicRegistry schematicRegistry = BuilderAPI.schematicRegistry;
|
||||
|
||||
final IBlocks blocks = AEApi.instance().definitions().blocks();
|
||||
final IBlockDefinition maybeMultiPart = blocks.multiPart();
|
||||
|
||||
for( Method blockDefinition : blocks.getClass().getMethods() )
|
||||
{
|
||||
AEItemDefinition def;
|
||||
try
|
||||
{
|
||||
def = (AEItemDefinition) blockDefinition.invoke( blocks );
|
||||
|
||||
Block myBlock = def.block();
|
||||
if( myBlock instanceof IOrientableBlock && ( (IOrientableBlock) myBlock ).usesMetadata() && def.entity() == null )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( myBlock, AERotatableBlockSchematic.class );
|
||||
}
|
||||
else if( maybeMultiPart.isSameAs( new ItemStack( myBlock ) ) )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class );
|
||||
}
|
||||
else if( def.entity() != null )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class );
|
||||
}
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
this.registerPowerP2P();
|
||||
this.registerItemP2P();
|
||||
this.registerLiquidsP2P();
|
||||
}
|
||||
|
||||
private void registerOrientableBlocks()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -26,7 +26,9 @@ import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.integration.modules.BC;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
|
||||
|
||||
public class BCPipeHandler implements IExternalStorageHandler
|
||||
@@ -35,7 +37,14 @@ public class BCPipeHandler implements IExternalStorageHandler
|
||||
@Override
|
||||
public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc )
|
||||
{
|
||||
return chan == StorageChannel.ITEMS && BC.instance.isPipe( te, d );
|
||||
if ( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
|
||||
return chan == StorageChannel.ITEMS && bc.isPipe( te, d );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -28,7 +28,9 @@ import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.integration.modules.BC;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
|
||||
|
||||
public class BCPipeInventory implements IMEInventory<IAEItemStack>
|
||||
@@ -46,19 +48,25 @@ public class BCPipeInventory implements IMEInventory<IAEItemStack>
|
||||
@Override
|
||||
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
|
||||
{
|
||||
if( mode == Actionable.SIMULATE )
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
if( BC.instance.canAddItemsToPipe( this.te, input.getItemStack(), this.direction ) )
|
||||
final IBuildCraftTransport registry = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
if( registry.canAddItemsToPipe( this.te, input.getItemStack(), this.direction ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
if( registry.addItemsToPipe( this.te, input.getItemStack(), this.direction ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
if( BC.instance.addItemsToPipe( this.te, input.getItemStack(), this.direction ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.abstraction.IBetterStorage;
|
||||
import appeng.integration.modules.helpers.BSCrateHandler;
|
||||
@@ -30,11 +31,16 @@ import appeng.integration.modules.helpers.BSCrateStorageAdaptor;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
|
||||
|
||||
public class BetterStorage implements IIntegrationModule, IBetterStorage
|
||||
public class BetterStorage extends BaseModule implements IIntegrationModule, IBetterStorage
|
||||
{
|
||||
|
||||
public static BetterStorage instance;
|
||||
|
||||
public BetterStorage()
|
||||
{
|
||||
this.testClassExistence( net.mcft.copy.betterstorage.api.crate.ICrateStorage.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageCrate( Object te )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import buildcraft.api.blueprints.BuilderAPI;
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.ISchematicRegistry;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
import buildcraft.api.blueprints.SchematicTile;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.core.AELog;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.modules.BCHelpers.AECableSchematicTile;
|
||||
import appeng.integration.modules.BCHelpers.AEGenericSchematicTile;
|
||||
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
|
||||
|
||||
|
||||
/**
|
||||
* The builder has no interface, because it provides no functionality
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv3 - 12.06.2015
|
||||
* @since rv3 12.06.2015
|
||||
*/
|
||||
@Reflected
|
||||
public class BuildCraftBuilder extends BaseModule
|
||||
{
|
||||
@Reflected
|
||||
public static BuildCraftBuilder instance;
|
||||
|
||||
@Reflected
|
||||
public BuildCraftBuilder()
|
||||
{
|
||||
this.testClassExistence( BuilderAPI.class );
|
||||
this.testClassExistence( IBuilderContext.class );
|
||||
this.testClassExistence( ISchematicRegistry.class );
|
||||
this.testClassExistence( SchematicTile.class );
|
||||
this.testClassExistence( SchematicBlock.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
try
|
||||
{
|
||||
this.initBuilderSupport();
|
||||
}
|
||||
catch( Exception builderSupport )
|
||||
{
|
||||
// not supported?
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void initBuilderSupport()
|
||||
{
|
||||
final ISchematicRegistry schematicRegistry = BuilderAPI.schematicRegistry;
|
||||
|
||||
final IBlocks blocks = AEApi.instance().definitions().blocks();
|
||||
final IBlockDefinition maybeMultiPart = blocks.multiPart();
|
||||
|
||||
for( Method blockDefinition : blocks.getClass().getMethods() )
|
||||
{
|
||||
try
|
||||
{
|
||||
final IBlockDefinition def = (IBlockDefinition) blockDefinition.invoke( blocks );
|
||||
final Optional<Block> maybeBlock = def.maybeBlock();
|
||||
if( !maybeBlock.isPresent() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Block block = maybeBlock.get();
|
||||
if( block instanceof IOrientableBlock && ( (IOrientableBlock) block ).usesMetadata() && !( def instanceof ITileDefinition ) )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( block, AERotatableBlockSchematic.class );
|
||||
}
|
||||
else if( maybeMultiPart.isSameAs( new ItemStack( block ) ) )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( block, AECableSchematicTile.class );
|
||||
}
|
||||
else if( def instanceof ITileDefinition )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( block, AEGenericSchematicTile.class );
|
||||
}
|
||||
}
|
||||
catch( InvocationTargetException ignore )
|
||||
{
|
||||
AELog.warning( "Encountered problems while initializing the BuildCraft Builder support. Can not invoke the method %s", blockDefinition );
|
||||
}
|
||||
catch( IllegalAccessException ignore )
|
||||
{
|
||||
AELog.warning( "Encountered problems while initializing the BuildCraft Builder support. Can not access the method %s", blockDefinition );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IBuildCraftCore;
|
||||
|
||||
|
||||
@Reflected
|
||||
public final class BuildCraftCore extends BaseModule implements IBuildCraftCore
|
||||
{
|
||||
@Reflected
|
||||
public static BuildCraftCore instance;
|
||||
|
||||
@Reflected
|
||||
public BuildCraftCore()
|
||||
{
|
||||
this.testClassExistence( buildcraft.BuildCraftCore.class );
|
||||
this.testClassExistence( BuildCraftTransport.class );
|
||||
this.testClassExistence( IToolWrench.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrench( Item eq )
|
||||
{
|
||||
return eq instanceof IToolWrench;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrench( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z )
|
||||
{
|
||||
return ( (IToolWrench) wrench ).canWrench( wrencher, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrenchUsed( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z )
|
||||
{
|
||||
( (IToolWrench) wrench ).wrenchUsed( wrencher, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
this.registerPowerP2P();
|
||||
}
|
||||
|
||||
private void registerPowerP2P()
|
||||
{
|
||||
final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel();
|
||||
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftCore.engineBlock, 1, 0 ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftCore.engineBlock, 1, 1 ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftCore.engineBlock, 1, 2 ), TunnelType.RF_POWER );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 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.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
|
||||
import buildcraft.api.facades.IFacadeItem;
|
||||
import buildcraft.api.transport.IInjectable;
|
||||
import buildcraft.api.transport.IPipeConnection;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.transport.ItemFacade;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.facade.FacadePart;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
import appeng.integration.modules.BCHelpers.BCPipeHandler;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 12.06.2015
|
||||
* @since rv3 12.06.2015
|
||||
*/
|
||||
@Reflected
|
||||
public class BuildCraftTransport extends BaseModule implements IBuildCraftTransport
|
||||
{
|
||||
@Reflected
|
||||
public static BuildCraftTransport instance;
|
||||
|
||||
@Reflected
|
||||
public BuildCraftTransport()
|
||||
{
|
||||
this.testClassExistence( buildcraft.BuildCraftTransport.class );
|
||||
this.testClassExistence( IFacadeItem.class );
|
||||
this.testClassExistence( IInjectable.class );
|
||||
this.testClassExistence( IPipeConnection.class );
|
||||
this.testClassExistence( IPipeTile.class );
|
||||
this.testClassExistence( ItemFacade.class );
|
||||
this.testClassExistence( PipeIconProvider.class );
|
||||
this.testClassExistence( IPipeTile.PipeType.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFacade( ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return is.getItem() instanceof IFacadeItem;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IFacadePart createFacadePart( Block blk, int meta, @Nonnull ForgeDirection side )
|
||||
{
|
||||
try
|
||||
{
|
||||
final ItemFacade.FacadeState state = ItemFacade.FacadeState.create( blk, meta );
|
||||
final ItemStack facade = ItemFacade.getFacade( state );
|
||||
|
||||
return new FacadePart( facade, side );
|
||||
}
|
||||
catch( Exception ignored )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFacadePart createFacadePart( @Nonnull ItemStack fs, @Nonnull ForgeDirection side )
|
||||
{
|
||||
return new FacadePart( fs, side );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getTextureForFacade( @Nonnull ItemStack facade )
|
||||
{
|
||||
final Item maybeFacadeItem = facade.getItem();
|
||||
|
||||
if( maybeFacadeItem instanceof IFacadeItem )
|
||||
{
|
||||
final IFacadeItem facadeItem = (IFacadeItem) maybeFacadeItem;
|
||||
|
||||
final Block[] blocks = facadeItem.getBlocksForFacade( facade );
|
||||
final int[] metas = facadeItem.getMetaValuesForFacade( facade );
|
||||
|
||||
if( blocks.length > 0 && metas.length > 0 )
|
||||
{
|
||||
return new ItemStack( blocks[0], 1, metas[0] );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IIcon getCobbleStructurePipeTexture()
|
||||
{
|
||||
try
|
||||
{
|
||||
return buildcraft.BuildCraftTransport.instance.pipeIconProvider.getIcon( PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal() ); // Structure
|
||||
}
|
||||
catch( Exception ignored )
|
||||
{
|
||||
}
|
||||
return null;
|
||||
// Pipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPipe( TileEntity te, @Nonnull ForgeDirection dir )
|
||||
{
|
||||
if( te instanceof IPipeTile )
|
||||
{
|
||||
final IPipeTile pipeTile = (IPipeTile) te;
|
||||
return !pipeTile.hasPipePluggable( dir.getOpposite() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir )
|
||||
{
|
||||
if( is != null && te != null && te instanceof IInjectable )
|
||||
{
|
||||
IInjectable pt = (IInjectable) te;
|
||||
if( pt.canInjectItems( dir ) )
|
||||
{
|
||||
int amt = pt.injectItem( is, false, dir, null );
|
||||
if( amt == is.stackSize )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addItemsToPipe( @Nullable TileEntity te, @Nullable ItemStack is, @Nonnull ForgeDirection dir )
|
||||
{
|
||||
if( is != null && te != null && te instanceof IInjectable )
|
||||
{
|
||||
IInjectable pt = (IInjectable) te;
|
||||
if( pt.canInjectItems( dir ) )
|
||||
{
|
||||
int amt = pt.injectItem( is, false, dir, null );
|
||||
if( amt == is.stackSize )
|
||||
{
|
||||
pt.injectItem( is, true, dir, null );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void addFacade( ItemStack item )
|
||||
{
|
||||
if( item != null )
|
||||
{
|
||||
FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", item );
|
||||
}
|
||||
}
|
||||
|
||||
private void registerPowerP2P()
|
||||
{
|
||||
final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel();
|
||||
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerCobblestone ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerDiamond ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerGold ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerQuartz ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerStone ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerWood ), TunnelType.RF_POWER );
|
||||
}
|
||||
|
||||
private void registerItemP2P()
|
||||
{
|
||||
final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel();
|
||||
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsWood ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsVoid ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsSandstone ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsQuartz ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsObsidian ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsIron ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsGold ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsEmerald ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsDiamond ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsStone ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsCobblestone ), TunnelType.ITEM );
|
||||
}
|
||||
|
||||
private void registerLiquidsP2P()
|
||||
{
|
||||
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsCobblestone ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsEmerald ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsGold ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsIron ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsSandstone ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsStone ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsVoid ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsWood ), TunnelType.FLUID );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
this.initPipeConnection();
|
||||
this.initFacades();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
this.registerPowerP2P();
|
||||
this.registerItemP2P();
|
||||
this.registerLiquidsP2P();
|
||||
}
|
||||
|
||||
private void initPipeConnection()
|
||||
{
|
||||
final IAppEngApi api = AEApi.instance();
|
||||
|
||||
api.partHelper().registerNewLayer( "appeng.parts.layers.LayerIPipeConnection", "buildcraft.api.transport.IPipeConnection" );
|
||||
api.registries().externalStorage().addExternalStorageInterface( new BCPipeHandler() );
|
||||
}
|
||||
|
||||
private void initFacades()
|
||||
{
|
||||
final IAppEngApi api = AEApi.instance();
|
||||
final IBlocks blocks = api.definitions().blocks();
|
||||
|
||||
this.addFacadeStack( blocks.fluix() );
|
||||
this.addFacadeStack( blocks.quartz() );
|
||||
this.addFacadeStack( blocks.quartzChiseled() );
|
||||
this.addFacadeStack( blocks.quartzPillar() );
|
||||
|
||||
for( Block skyStoneBlock : blocks.skyStone().maybeBlock().asSet() )
|
||||
{
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 0 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 1 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 2 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 3 ) );
|
||||
}
|
||||
}
|
||||
|
||||
private void addFacadeStack( IItemDefinition definition )
|
||||
{
|
||||
for( ItemStack facadeStack : definition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
this.addFacade( facadeStack );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -21,8 +21,10 @@ package appeng.integration.modules;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
@@ -32,95 +34,173 @@ import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import uristqwerty.CraftGuide.CraftGuideLog;
|
||||
import uristqwerty.CraftGuide.DefaultRecipeTemplate;
|
||||
import uristqwerty.CraftGuide.RecipeGeneratorImplementation;
|
||||
import uristqwerty.CraftGuide.api.ChanceSlot;
|
||||
import uristqwerty.CraftGuide.api.CraftGuideAPIObject;
|
||||
import uristqwerty.CraftGuide.api.CraftGuideRecipe;
|
||||
import uristqwerty.CraftGuide.api.ItemSlot;
|
||||
import uristqwerty.CraftGuide.api.RecipeGenerator;
|
||||
import uristqwerty.CraftGuide.api.RecipeProvider;
|
||||
import uristqwerty.CraftGuide.api.RecipeTemplate;
|
||||
import uristqwerty.CraftGuide.api.Slot;
|
||||
import uristqwerty.CraftGuide.api.SlotType;
|
||||
import uristqwerty.CraftGuide.api.StackInfo;
|
||||
import uristqwerty.CraftGuide.api.StackInfoSource;
|
||||
import uristqwerty.gui_craftguide.texture.DynamicTexture;
|
||||
import uristqwerty.gui_craftguide.texture.TextureClip;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
|
||||
|
||||
public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModule, RecipeProvider, StackInfoSource, RecipeGenerator
|
||||
public final class CraftGuide extends CraftGuideAPIObject implements IIntegrationModule, RecipeProvider
|
||||
{
|
||||
private static final int SLOT_SIZE = 16;
|
||||
private static final int TEXTURE_WIDTH = 79;
|
||||
private static final int TEXTURE_HEIGHT = 58;
|
||||
private static final int GRINDER_RATIO = 10000;
|
||||
|
||||
private static final Slot[] GRINDER_SLOTS = new ItemSlot[] {
|
||||
new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 41, 21, SLOT_SIZE, SLOT_SIZE, true ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ),
|
||||
new ChanceSlot( 59, 12, SLOT_SIZE, SLOT_SIZE, true ).setRatio( GRINDER_RATIO ).setFormatString( " (%1$.2f%% chance)" ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ),
|
||||
new ChanceSlot( 59, 30, SLOT_SIZE, SLOT_SIZE, true ).setRatio( GRINDER_RATIO ).setFormatString( " (%1$.2f%% chance)" ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ),
|
||||
new ItemSlot( 22, 12, SLOT_SIZE, SLOT_SIZE ).setSlotType( SlotType.MACHINE_SLOT ),
|
||||
new ItemSlot( 22, 30, SLOT_SIZE, SLOT_SIZE ).setSlotType( SlotType.MACHINE_SLOT )
|
||||
};
|
||||
private static final Slot[] INSCRIBER_SLOTS = new ItemSlot[] {
|
||||
new ItemSlot( 12, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 50, 21, SLOT_SIZE, SLOT_SIZE, true ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ),
|
||||
new ItemSlot( 31, 21, SLOT_SIZE, SLOT_SIZE ).setSlotType( SlotType.MACHINE_SLOT )
|
||||
};
|
||||
private static final Slot[] SHAPELESS_CRAFTING_SLOTS = new ItemSlot[] {
|
||||
new ItemSlot( 3, 3, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 39, 3, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 21, 21, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 39, 21, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 3, 39, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 39, 39, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ),
|
||||
};
|
||||
private static final Slot[] CRAFTING_SLOTS_OWN_BG = new ItemSlot[] {
|
||||
new ItemSlot( 3, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 39, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 21, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 39, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 3, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 39, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(),
|
||||
};
|
||||
private static final Slot[] SMALL_CRAFTING_SLOTS_OWN_BG = new ItemSlot[] {
|
||||
new ItemSlot( 12, 12, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 30, 12, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 12, 30, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 30, 30, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
|
||||
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(),
|
||||
};
|
||||
private static final Slot[] CRTAFTING_SLOTS = new ItemSlot[] {
|
||||
new ItemSlot( 3, 3, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 39, 3, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 21, 21, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 39, 21, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 3, 39, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 39, 39, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ),
|
||||
};
|
||||
private static final Slot[] SMALL_CRAFTING_SLOTS = new ItemSlot[] {
|
||||
new ItemSlot( 12, 12, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 30, 12, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 12, 30, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 30, 30, SLOT_SIZE, SLOT_SIZE ),
|
||||
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ),
|
||||
};
|
||||
|
||||
@Reflected
|
||||
public static CraftGuide instance;
|
||||
|
||||
private final Slot[] shapelessCraftingSlots = new ItemSlot[] { new ItemSlot( 3, 3, 16, 16 ), new ItemSlot( 21, 3, 16, 16 ), new ItemSlot( 39, 3, 16, 16 ), new ItemSlot( 3, 21, 16, 16 ), new ItemSlot( 21, 21, 16, 16 ), new ItemSlot( 39, 21, 16, 16 ), new ItemSlot( 3, 39, 16, 16 ), new ItemSlot( 21, 39, 16, 16 ), new ItemSlot( 39, 39, 16, 16 ), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
|
||||
|
||||
private final Slot[] craftingSlotsOwnBackground = new ItemSlot[] { new ItemSlot( 3, 3, 16, 16 ).drawOwnBackground(), new ItemSlot( 21, 3, 16, 16 ).drawOwnBackground(), new ItemSlot( 39, 3, 16, 16 ).drawOwnBackground(), new ItemSlot( 3, 21, 16, 16 ).drawOwnBackground(), new ItemSlot( 21, 21, 16, 16 ).drawOwnBackground(), new ItemSlot( 39, 21, 16, 16 ).drawOwnBackground(), new ItemSlot( 3, 39, 16, 16 ).drawOwnBackground(), new ItemSlot( 21, 39, 16, 16 ).drawOwnBackground(), new ItemSlot( 39, 39, 16, 16 ).drawOwnBackground(), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(), };
|
||||
|
||||
private final Slot[] smallCraftingSlotsOwnBackground = new ItemSlot[] { new ItemSlot( 12, 12, 16, 16 ).drawOwnBackground(), new ItemSlot( 30, 12, 16, 16 ).drawOwnBackground(), new ItemSlot( 12, 30, 16, 16 ).drawOwnBackground(), new ItemSlot( 30, 30, 16, 16 ).drawOwnBackground(), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(), };
|
||||
|
||||
private final Slot[] craftingSlots = new ItemSlot[] { new ItemSlot( 3, 3, 16, 16 ), new ItemSlot( 21, 3, 16, 16 ), new ItemSlot( 39, 3, 16, 16 ), new ItemSlot( 3, 21, 16, 16 ), new ItemSlot( 21, 21, 16, 16 ), new ItemSlot( 39, 21, 16, 16 ), new ItemSlot( 3, 39, 16, 16 ), new ItemSlot( 21, 39, 16, 16 ), new ItemSlot( 39, 39, 16, 16 ), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
|
||||
|
||||
private final Slot[] smallCraftingSlots = new ItemSlot[] { new ItemSlot( 12, 12, 16, 16 ), new ItemSlot( 30, 12, 16, 16 ), new ItemSlot( 12, 30, 16, 16 ), new ItemSlot( 30, 30, 16, 16 ), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
|
||||
|
||||
private final Slot[] furnaceSlots = new ItemSlot[] { new ItemSlot( 13, 21, 16, 16 ), new ItemSlot( 50, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
|
||||
RecipeGenerator parent;
|
||||
|
||||
@Override
|
||||
public String getInfo( ItemStack itemStack )
|
||||
{
|
||||
// :P
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRecipes( RecipeGenerator generator )
|
||||
{
|
||||
this.parent = generator;
|
||||
|
||||
RecipeTemplate craftingTemplate;
|
||||
RecipeTemplate smallTemplate;
|
||||
final RecipeTemplate craftingTemplate;
|
||||
final RecipeTemplate smallTemplate;
|
||||
|
||||
if( uristqwerty.CraftGuide.CraftGuide.newerBackgroundStyle )
|
||||
{
|
||||
craftingTemplate = generator.createRecipeTemplate( this.craftingSlotsOwnBackground, null );
|
||||
smallTemplate = generator.createRecipeTemplate( this.smallCraftingSlotsOwnBackground, null );
|
||||
craftingTemplate = generator.createRecipeTemplate( CRAFTING_SLOTS_OWN_BG, null );
|
||||
smallTemplate = generator.createRecipeTemplate( SMALL_CRAFTING_SLOTS_OWN_BG, null );
|
||||
}
|
||||
else
|
||||
{
|
||||
craftingTemplate = new DefaultRecipeTemplate( this.craftingSlots, RecipeGeneratorImplementation.workbench, new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 1, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 1, 79, 58 ) );
|
||||
final TextureClip craftingBG = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 1, TEXTURE_WIDTH, TEXTURE_HEIGHT );
|
||||
final TextureClip craftingSelected = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 1, TEXTURE_WIDTH, TEXTURE_HEIGHT );
|
||||
craftingTemplate = new DefaultRecipeTemplate( CRTAFTING_SLOTS, RecipeGeneratorImplementation.workbench, craftingBG, craftingSelected );
|
||||
|
||||
smallTemplate = new DefaultRecipeTemplate( this.smallCraftingSlots, RecipeGeneratorImplementation.workbench, new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 61, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 61, 79, 58 ) );
|
||||
final TextureClip smallBG = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 61, TEXTURE_WIDTH, TEXTURE_HEIGHT );
|
||||
final TextureClip smallSelected = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 61, TEXTURE_WIDTH, TEXTURE_HEIGHT );
|
||||
smallTemplate = new DefaultRecipeTemplate( SMALL_CRAFTING_SLOTS, RecipeGeneratorImplementation.workbench, smallBG, smallSelected );
|
||||
}
|
||||
|
||||
RecipeTemplate shapelessTemplate = new DefaultRecipeTemplate( this.shapelessCraftingSlots, RecipeGeneratorImplementation.workbench, new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 121, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 121, 79, 58 ) );
|
||||
final TextureClip shapelessBG = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 121, TEXTURE_WIDTH, TEXTURE_HEIGHT );
|
||||
final TextureClip shapelessSelected = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 121, TEXTURE_WIDTH, TEXTURE_HEIGHT );
|
||||
final RecipeTemplate shapelessTemplate = new DefaultRecipeTemplate( SHAPELESS_CRAFTING_SLOTS, RecipeGeneratorImplementation.workbench, shapelessBG, shapelessSelected );
|
||||
|
||||
RecipeTemplate furnaceTemplate = new DefaultRecipeTemplate( this.furnaceSlots, new ItemStack( Blocks.furnace ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 181, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 181, 79, 58 ) );
|
||||
this.addCraftingRecipes( craftingTemplate, smallTemplate, shapelessTemplate, generator );
|
||||
|
||||
this.addCraftingRecipes( craftingTemplate, smallTemplate, shapelessTemplate, this );
|
||||
this.addGrinderRecipes( furnaceTemplate, this );
|
||||
this.addInscriberRecipes( furnaceTemplate, this );
|
||||
final IAppEngApi api = AEApi.instance();
|
||||
final IBlocks aeBlocks = api.definitions().blocks();
|
||||
final Optional<ItemStack> grindstone = aeBlocks.grindStone().maybeStack( 1 );
|
||||
final Optional<ItemStack> inscriber = aeBlocks.inscriber().maybeStack( 1 );
|
||||
|
||||
if( grindstone.isPresent() )
|
||||
{
|
||||
this.addGrinderRecipes( api, grindstone.get(), generator );
|
||||
}
|
||||
|
||||
if( inscriber.isPresent() )
|
||||
{
|
||||
this.addInscriberRecipes( api, inscriber.get(), generator );
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private List<IRecipe> getUncheckedRecipes()
|
||||
{
|
||||
return (List<IRecipe>) CraftingManager.getInstance().getRecipeList();
|
||||
}
|
||||
|
||||
private void addCraftingRecipes( RecipeTemplate template, RecipeTemplate templateSmall, RecipeTemplate templateShapeless, RecipeGenerator generator )
|
||||
{
|
||||
List recipes = CraftingManager.getInstance().getRecipeList();
|
||||
final List<IRecipe> recipes = this.getUncheckedRecipes();
|
||||
|
||||
int errCount = 0;
|
||||
|
||||
for( Object o : recipes )
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
try
|
||||
{
|
||||
IRecipe recipe = (IRecipe) o;
|
||||
|
||||
Object[] items = generator.getCraftingRecipe( recipe, true );
|
||||
final Object[] items = this.getCraftingRecipe( recipe, true );
|
||||
|
||||
if( items == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if( items.length == 5 )
|
||||
{
|
||||
generator.addRecipe( templateSmall, items );
|
||||
@@ -138,8 +218,7 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
{
|
||||
if( errCount >= 5 )
|
||||
{
|
||||
CraftGuideLog.log( "CraftGuide DefaultRecipeProvider: Stack trace limit reached, further stack traces from this invocation will not be logged to the console. They will still be logged to (.minecraft)/config/CraftGuide/CraftGuide.log", true );
|
||||
errCount = -1;
|
||||
CraftGuideLog.log( "AppEng CraftGuide integration: Stack trace limit reached, further stack traces from this invocation will not be logged to the console. They will still be logged to (.minecraft)/config/CraftGuide/CraftGuide.log", true );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -152,61 +231,49 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
}
|
||||
}
|
||||
|
||||
private void addGrinderRecipes( RecipeTemplate template, RecipeGenerator generator )
|
||||
private void addGrinderRecipes( IAppEngApi api, ItemStack grindstone, RecipeGenerator generator )
|
||||
{
|
||||
final ItemStack handle = api.definitions().blocks().crankHandle().maybeStack( 1 ).orNull();
|
||||
final RecipeTemplate grinderTemplate = generator.createRecipeTemplate( GRINDER_SLOTS, grindstone );
|
||||
|
||||
for( IGrinderEntry recipe : api.registries().grinder().getRecipes() )
|
||||
{
|
||||
generator.addRecipe( grinderTemplate, new Object[] {
|
||||
recipe.getInput(),
|
||||
recipe.getOutput(),
|
||||
new Object[] {
|
||||
recipe.getOptionalOutput(),
|
||||
(int) ( recipe.getOptionalChance() * GRINDER_RATIO )
|
||||
},
|
||||
new Object[] {
|
||||
recipe.getSecondOptionalOutput(),
|
||||
(int) ( recipe.getOptionalChance() * GRINDER_RATIO )
|
||||
},
|
||||
handle,
|
||||
grindstone
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
private void addInscriberRecipes( RecipeTemplate template, RecipeGenerator generator )
|
||||
private void addInscriberRecipes( IAppEngApi api, ItemStack inscriber, RecipeGenerator generator )
|
||||
{
|
||||
final RecipeTemplate inscriberTemplate = generator.createRecipeTemplate( INSCRIBER_SLOTS, inscriber );
|
||||
|
||||
for( IInscriberRecipe recipe : api.registries().inscriber().getRecipes() )
|
||||
{
|
||||
generator.addRecipe( inscriberTemplate, new Object[] {
|
||||
recipe.getInputs(),
|
||||
recipe.getTopOptional().orNull(),
|
||||
recipe.getBottomOptional().orNull(),
|
||||
recipe.getOutput(),
|
||||
inscriber
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeTemplate createRecipeTemplate( Slot[] slots, ItemStack craftingType )
|
||||
private Object[] getCraftingShapelessRecipe( List<?> items, ItemStack recipeOutput )
|
||||
{
|
||||
return this.parent.createRecipeTemplate( slots, craftingType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeTemplate createRecipeTemplate( Slot[] slots, ItemStack craftingType, String backgroundTexture, int backgroundX, int backgroundY, int backgroundSelectedX, int backgroundSelectedY )
|
||||
{
|
||||
return this.parent.createRecipeTemplate( slots, craftingType, backgroundTexture, backgroundX, backgroundY, backgroundSelectedX, backgroundSelectedY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeTemplate createRecipeTemplate( Slot[] slots, ItemStack craftingType, String bgTexture, int bgX, int bgY, String selectedBGTexture, int selectedBGX, int selectedBGY )
|
||||
{
|
||||
return this.parent.createRecipeTemplate( slots, craftingType, bgTexture, bgX, bgY, selectedBGTexture, selectedBGX, selectedBGY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe( RecipeTemplate template, Object[] crafting )
|
||||
{
|
||||
this.parent.addRecipe( template, crafting );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe( CraftGuideRecipe recipe, ItemStack craftingType )
|
||||
{
|
||||
this.parent.addRecipe( recipe, craftingType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultTypeVisibility( ItemStack type, boolean visible )
|
||||
{
|
||||
this.parent.setDefaultTypeVisibility( type, visible );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getCraftingRecipe( IRecipe recipe )
|
||||
{
|
||||
return this.getCraftingRecipe( recipe, true );
|
||||
}
|
||||
|
||||
Object[] getCraftingShapelessRecipe( List items, ItemStack recipeOutput )
|
||||
{
|
||||
Object[] output = new Object[10];
|
||||
final Object[] output = new Object[10];
|
||||
|
||||
for( int i = 0; i < items.size(); i++ )
|
||||
{
|
||||
@@ -235,18 +302,19 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
}
|
||||
|
||||
output[9] = recipeOutput;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
Object[] getSmallShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput )
|
||||
private Object[] getSmallShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput )
|
||||
{
|
||||
Object[] output = new Object[5];
|
||||
final Object[] output = new Object[5];
|
||||
|
||||
for( int y = 0; y < height; y++ )
|
||||
{
|
||||
for( int x = 0; x < width; x++ )
|
||||
{
|
||||
int i = y * 2 + x;
|
||||
final int i = y * 2 + x;
|
||||
output[i] = items[y * width + x];
|
||||
|
||||
if( output[i] instanceof ItemStack[] )
|
||||
@@ -273,18 +341,19 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
}
|
||||
|
||||
output[4] = recipeOutput;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
Object[] getCraftingShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput )
|
||||
private Object[] getCraftingShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput )
|
||||
{
|
||||
Object[] output = new Object[10];
|
||||
final Object[] output = new Object[10];
|
||||
|
||||
for( int y = 0; y < height; y++ )
|
||||
{
|
||||
for( int x = 0; x < width; x++ )
|
||||
{
|
||||
int i = y * 3 + x;
|
||||
final int i = y * 3 + x;
|
||||
output[i] = items[y * width + x];
|
||||
|
||||
if( output[i] instanceof ItemStack[] )
|
||||
@@ -311,12 +380,13 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
}
|
||||
|
||||
output[9] = recipeOutput;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private Object toCG( ItemStack[] itemStackSet )
|
||||
{
|
||||
List<ItemStack> list = Arrays.asList( itemStackSet );
|
||||
final List<ItemStack> list = Arrays.asList( itemStackSet );
|
||||
|
||||
for( int x = 0; x < list.size(); x++ )
|
||||
{
|
||||
@@ -330,19 +400,20 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getCraftingRecipe( IRecipe recipe, boolean allowSmallGrid )
|
||||
@Nullable
|
||||
private Object[] getCraftingRecipe( IRecipe recipe, boolean allowSmallGrid )
|
||||
{
|
||||
if( recipe instanceof ShapelessRecipe )
|
||||
{
|
||||
List items = ReflectionHelper.getPrivateValue( ShapelessRecipe.class, (ShapelessRecipe) recipe, "input" );
|
||||
final List<Object> items = ReflectionHelper.getPrivateValue( ShapelessRecipe.class, (ShapelessRecipe) recipe, "input" );
|
||||
|
||||
return this.getCraftingShapelessRecipe( items, recipe.getRecipeOutput() );
|
||||
}
|
||||
else if( recipe instanceof ShapedRecipe )
|
||||
{
|
||||
int width = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "width" );
|
||||
int height = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "height" );
|
||||
Object[] items = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "input" );
|
||||
final int width = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "width" );
|
||||
final int height = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "height" );
|
||||
final Object[] items = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "input" );
|
||||
|
||||
if( allowSmallGrid && width < 3 && height < 3 )
|
||||
{
|
||||
@@ -360,7 +431,6 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
StackInfo.addSource( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -24,6 +24,7 @@ import java.util.List;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -83,14 +84,26 @@ public abstract class AEBaseItem extends Item implements IAEFeature
|
||||
this.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public final void getSubItems( Item sameItem, CreativeTabs creativeTab, List itemStacks )
|
||||
{
|
||||
this.getCheckedSubItems( sameItem, creativeTab, itemStacks );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookEnchantable( ItemStack itemstack1, ItemStack itemstack2 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
protected void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
{
|
||||
super.addInformation( stack, player, lines, displayMoreInfo );
|
||||
}
|
||||
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
{
|
||||
super.getSubItems( sameItem, creativeTab, itemStacks );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -291,7 +291,7 @@ public final class ItemMultiMaterial extends AEBaseItem implements IStorageCompo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems( Item par1, CreativeTabs par2CreativeTabs, List cList )
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
{
|
||||
List<MaterialType> types = Arrays.asList( MaterialType.values() );
|
||||
Collections.sort( types, new Comparator<MaterialType>()
|
||||
@@ -308,7 +308,7 @@ public final class ItemMultiMaterial extends AEBaseItem implements IStorageCompo
|
||||
{
|
||||
if( mat.damageValue >= 0 && mat.isRegistered() && mat.itemInstance == this )
|
||||
{
|
||||
cList.add( new ItemStack( this, 1, mat.damageValue ) );
|
||||
itemStacks.add( new ItemStack( this, 1, mat.damageValue ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,21 +310,21 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems( Item i, CreativeTabs t, List l )
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
{
|
||||
// lvl 0
|
||||
l.add( newStyle( new ItemStack( this, 1, CERTUS ) ) );
|
||||
l.add( newStyle( new ItemStack( this, 1, NETHER ) ) );
|
||||
l.add( newStyle( new ItemStack( this, 1, FLUIX ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, CERTUS ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, NETHER ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, FLUIX ) ) );
|
||||
|
||||
// lvl 1
|
||||
l.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET + CERTUS ) ) );
|
||||
l.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET + NETHER ) ) );
|
||||
l.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET + FLUIX ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET + CERTUS ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET + NETHER ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET + FLUIX ) ) );
|
||||
|
||||
// lvl 2
|
||||
l.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + CERTUS ) ) );
|
||||
l.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + NETHER ) ) );
|
||||
l.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + FLUIX ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + CERTUS ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + NETHER ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + FLUIX ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -79,13 +79,13 @@ public class ItemPaintBall extends AEBaseItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems( Item i, CreativeTabs ct, List l )
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
{
|
||||
for( AEColor c : AEColor.values() )
|
||||
{
|
||||
if( c != AEColor.Transparent )
|
||||
{
|
||||
l.add( new ItemStack( this, 1, c.ordinal() ) );
|
||||
itemStacks.add( new ItemStack( this, 1, c.ordinal() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ItemPaintBall extends AEBaseItem
|
||||
{
|
||||
if( c != AEColor.Transparent )
|
||||
{
|
||||
l.add( new ItemStack( this, 1, DAMAGE_THRESHOLD + c.ordinal() ) );
|
||||
itemStacks.add( new ItemStack( this, 1, DAMAGE_THRESHOLD + c.ordinal() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -103,17 +103,17 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems( Item number, CreativeTabs tab, List list )
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
{
|
||||
this.calculateSubTypes();
|
||||
list.addAll( this.subTypes );
|
||||
itemStacks.addAll( this.subTypes );
|
||||
}
|
||||
|
||||
private void calculateSubTypes()
|
||||
{
|
||||
if( this.subTypes == null )
|
||||
{
|
||||
this.subTypes = new ArrayList<ItemStack>();
|
||||
this.subTypes = new ArrayList<ItemStack>( 1000 );
|
||||
for( Object blk : Block.blockRegistry )
|
||||
{
|
||||
Block b = (Block) blk;
|
||||
@@ -121,7 +121,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
{
|
||||
Item item = Item.getItemFromBlock( b );
|
||||
|
||||
List<ItemStack> tmpList = new ArrayList<ItemStack>();
|
||||
List<ItemStack> tmpList = new ArrayList<ItemStack>( 100 );
|
||||
b.getSubBlocks( item, b.getCreativeTabToDisplayOn(), tmpList );
|
||||
for( ItemStack l : tmpList )
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -21,6 +21,7 @@ package appeng.items.parts;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumSet;
|
||||
@@ -29,7 +30,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -47,6 +47,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
import appeng.api.implementations.items.IItemGroup;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
@@ -54,6 +55,7 @@ import appeng.api.parts.IPartItem;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.core.features.NameResolver;
|
||||
import appeng.core.localization.GuiText;
|
||||
@@ -64,19 +66,18 @@ import appeng.items.AEBaseItem;
|
||||
|
||||
public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
{
|
||||
private static final int INITIAL_REGISTERED_CAPACITY = PartType.values().length;
|
||||
private static final Comparator<Entry<Integer, PartTypeWithVariant>> REGISTERED_COMPARATOR = new RegisteredComparator();
|
||||
|
||||
|
||||
public static ItemMultiPart instance;
|
||||
private final NameResolver nameResolver;
|
||||
private final Map<Integer, PartTypeWithVariant> registered;
|
||||
private final Map<Integer, PartTypeWithVariant> unregistered;
|
||||
|
||||
public ItemMultiPart( IPartHelper partHelper )
|
||||
{
|
||||
Preconditions.checkNotNull( partHelper );
|
||||
|
||||
this.registered = new HashMap<Integer, PartTypeWithVariant>();
|
||||
this.unregistered = new HashMap<Integer, PartTypeWithVariant>();
|
||||
this.registered = new HashMap<Integer, PartTypeWithVariant>( INITIAL_REGISTERED_CAPACITY );
|
||||
|
||||
this.nameResolver = new NameResolver( this.getClass() );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
@@ -132,7 +133,8 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
}
|
||||
|
||||
final int partDamage = mat.baseDamage + varID;
|
||||
final ItemStackSrc output = new ItemStackSrc( this, partDamage );
|
||||
final ActivityState state = ActivityState.from( enabled );
|
||||
final ItemStackSrc output = new ItemStackSrc( this, partDamage, state );
|
||||
|
||||
final PartTypeWithVariant pti = new PartTypeWithVariant( mat, varID );
|
||||
|
||||
@@ -147,13 +149,16 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
assert mat != null;
|
||||
assert pti != null;
|
||||
|
||||
final Map<Integer, PartTypeWithVariant> reference = ( enabled ) ? this.registered : this.unregistered;
|
||||
if( reference.containsKey( partDamage ) )
|
||||
final PartTypeWithVariant registeredPartType = this.registered.get( partDamage );
|
||||
if( registeredPartType != null )
|
||||
{
|
||||
throw new IllegalStateException( "Meta Overlap detected with type " + mat + " and damage " + partDamage + ". Found " + reference.get( partDamage ) + " there already." );
|
||||
throw new IllegalStateException( "Meta Overlap detected with type " + mat + " and damage " + partDamage + ". Found " + registeredPartType + " there already." );
|
||||
}
|
||||
|
||||
reference.put( partDamage, pti );
|
||||
if( enabled )
|
||||
{
|
||||
this.registered.put( partDamage, pti );
|
||||
}
|
||||
}
|
||||
|
||||
public int getDamageByType( PartType t )
|
||||
@@ -180,12 +185,24 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
@Override
|
||||
public IIcon getIconFromDamage( int dmg )
|
||||
{
|
||||
return this.registered.get( dmg ).ico;
|
||||
final PartTypeWithVariant registeredType = this.registered.get( dmg );
|
||||
if( registeredType != null )
|
||||
{
|
||||
return registeredType.ico;
|
||||
}
|
||||
|
||||
final String formattedRegistered = Arrays.toString( this.registered.keySet().toArray() );
|
||||
throw new MissingDefinition( "Tried to get the icon from a non-existent part with damage value " + dmg + ". There were registered: " + formattedRegistered + '.' );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse( ItemStack is, EntityPlayer player, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
if( this.getTypeByStack( is ) == PartType.InvalidType )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return AEApi.instance().partHelper().placeBus( is, x, y, z, side, player, w );
|
||||
}
|
||||
|
||||
@@ -204,7 +221,12 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
{
|
||||
final AEColor[] variants = AEColor.values();
|
||||
|
||||
return super.getItemStackDisplayName( is ) + " - " + variants[this.registered.get( is.getItemDamage() ).variant].toString();
|
||||
final int itemDamage = is.getItemDamage();
|
||||
final PartTypeWithVariant registeredPartType = this.registered.get( itemDamage );
|
||||
if( registeredPartType != null )
|
||||
{
|
||||
return super.getItemStackDisplayName( is ) + " - " + variants[registeredPartType.variant].toString();
|
||||
}
|
||||
}
|
||||
|
||||
if( pt.getExtraName() != null )
|
||||
@@ -216,24 +238,24 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems( Item number, CreativeTabs tab, List cList )
|
||||
public void registerIcons( IIconRegister iconRegister )
|
||||
{
|
||||
for( Entry<Integer, PartTypeWithVariant> part : this.registered.entrySet() )
|
||||
{
|
||||
String tex = "appliedenergistics2:" + this.getName( new ItemStack( this, 1, part.getKey() ) );
|
||||
part.getValue().ico = iconRegister.registerIcon( tex );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
{
|
||||
List<Entry<Integer, PartTypeWithVariant>> types = new ArrayList<Entry<Integer, PartTypeWithVariant>>( this.registered.entrySet() );
|
||||
Collections.sort( types, REGISTERED_COMPARATOR );
|
||||
|
||||
for( Entry<Integer, PartTypeWithVariant> part : types )
|
||||
{
|
||||
cList.add( new ItemStack( this, 1, part.getKey() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons( IIconRegister par1IconRegister )
|
||||
{
|
||||
for( Entry<Integer, PartTypeWithVariant> part : this.registered.entrySet() )
|
||||
{
|
||||
String tex = "appliedenergistics2:" + this.getName( new ItemStack( this, 1, part.getKey() ) );
|
||||
part.getValue().ico = par1IconRegister.registerIcon( tex );
|
||||
itemStacks.add( new ItemStack( this, 1, part.getKey() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,21 +279,20 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
{
|
||||
return pt.part;
|
||||
}
|
||||
final PartTypeWithVariant unregisteredPartType = this.unregistered.get( is.getItemDamage() );
|
||||
if( unregisteredPartType != null )
|
||||
{
|
||||
return unregisteredPartType.part;
|
||||
}
|
||||
|
||||
throw new IllegalStateException( "ItemStack " + is + " has to be either registered or unregistered, but was not found in either." );
|
||||
return PartType.InvalidType;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Nullable
|
||||
@Override
|
||||
public IPart createPartFromItemStack( ItemStack is )
|
||||
{
|
||||
final PartType type = this.getTypeByStack( is );
|
||||
final Class<? extends IPart> part = type.getPart();
|
||||
if( part == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -302,10 +323,12 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
|
||||
public int variantOf( int itemDamage )
|
||||
{
|
||||
if( this.registered.containsKey( itemDamage ) )
|
||||
final PartTypeWithVariant registeredPartType = this.registered.get( itemDamage );
|
||||
if( registeredPartType != null )
|
||||
{
|
||||
return this.registered.get( itemDamage ).variant;
|
||||
return registeredPartType.variant;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -369,8 +392,18 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
this.part = part;
|
||||
this.variant = variant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "PartTypeWithVariant{" +
|
||||
"part=" + this.part +
|
||||
", variant=" + this.variant +
|
||||
", ico=" + this.ico +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static final class RegisteredComparator implements Comparator<Entry<Integer, PartTypeWithVariant>>
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -31,9 +31,9 @@ import appeng.integration.IntegrationType;
|
||||
import appeng.parts.automation.PartAnnihilationPlane;
|
||||
import appeng.parts.automation.PartExportBus;
|
||||
import appeng.parts.automation.PartFormationPlane;
|
||||
import appeng.parts.automation.PartIdentityAnnihilationPlane;
|
||||
import appeng.parts.automation.PartImportBus;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
import appeng.parts.automation.PartIdentityAnnihilationPlane;
|
||||
import appeng.parts.misc.PartCableAnchor;
|
||||
import appeng.parts.misc.PartInterface;
|
||||
import appeng.parts.misc.PartInvertedToggleBus;
|
||||
@@ -54,11 +54,11 @@ import appeng.parts.p2p.PartP2PRedstone;
|
||||
import appeng.parts.p2p.PartP2PTunnelME;
|
||||
import appeng.parts.reporting.PartConversionMonitor;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.parts.reporting.PartDarkMonitor;
|
||||
import appeng.parts.reporting.PartDarkPanel;
|
||||
import appeng.parts.reporting.PartInterfaceTerminal;
|
||||
import appeng.parts.reporting.PartMonitor;
|
||||
import appeng.parts.reporting.PartPanel;
|
||||
import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.parts.reporting.PartSemiDarkMonitor;
|
||||
import appeng.parts.reporting.PartSemiDarkPanel;
|
||||
import appeng.parts.reporting.PartStorageMonitor;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
|
||||
@@ -111,11 +111,11 @@ public enum PartType
|
||||
|
||||
QuartzFiber( 140, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartQuartzFiber.class ),
|
||||
|
||||
Monitor( 160, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartMonitor.class ),
|
||||
Monitor( 160, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartPanel.class ),
|
||||
|
||||
SemiDarkMonitor( 180, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartSemiDarkMonitor.class ),
|
||||
SemiDarkMonitor( 180, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartSemiDarkPanel.class ),
|
||||
|
||||
DarkMonitor( 200, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartDarkMonitor.class ),
|
||||
DarkMonitor( 200, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class ),
|
||||
|
||||
StorageBus( 220, EnumSet.of( AEFeature.StorageBus ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -33,9 +33,9 @@ import net.minecraftforge.common.DimensionManager;
|
||||
import appeng.api.implementations.TransitionResult;
|
||||
import appeng.api.implementations.items.ISpatialStorageCell;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.spatial.StorageHelper;
|
||||
import appeng.spatial.StorageWorldProvider;
|
||||
@@ -110,7 +110,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
int dim = c.getInteger( "StorageDim" );
|
||||
return WorldSettings.getInstance().getStoredSize( dim );
|
||||
return WorldData.instance().dimensionData().getStoredSize( dim );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -187,7 +187,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
NBTTagCompound c = Platform.openNbtData( is );
|
||||
int newDim = DimensionManager.getNextFreeDimId();
|
||||
c.setInteger( "StorageDim", newDim );
|
||||
WorldSettings.getInstance().addStorageCellDim( newDim );
|
||||
WorldData.instance().dimensionData().addStorageCell( newDim );
|
||||
DimensionManager.initDimension( newDim );
|
||||
return DimensionManager.getWorld( newDim );
|
||||
}
|
||||
@@ -201,7 +201,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
c.setInteger( "sizeX", targetX );
|
||||
c.setInteger( "sizeY", targetY );
|
||||
c.setInteger( "sizeZ", targetZ );
|
||||
WorldSettings.getInstance().setStoredSize( dim, targetX, targetY, targetZ );
|
||||
WorldData.instance().dimensionData().setStoredSize( dim, targetX, targetY, targetZ );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -54,7 +54,7 @@ import appeng.transformer.annotations.Integration.Interface;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = "BC" )
|
||||
@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = "BuildCraftCore" )
|
||||
public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, IToolWrench
|
||||
{
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -77,15 +77,16 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems( Item id, CreativeTabs tab, List list )
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
{
|
||||
super.getSubItems( id, tab, list );
|
||||
super.getCheckedSubItems( sameItem, creativeTab, itemStacks );
|
||||
|
||||
ItemStack charged = new ItemStack( this, 1 );
|
||||
NBTTagCompound tag = Platform.openNbtData( charged );
|
||||
final ItemStack charged = new ItemStack( this, 1 );
|
||||
final NBTTagCompound tag = Platform.openNbtData( charged );
|
||||
tag.setDouble( "internalCurrentPower", this.getAEMaxPower( charged ) );
|
||||
tag.setDouble( "internalMaxPower", this.getAEMaxPower( charged ) );
|
||||
list.add( charged );
|
||||
|
||||
itemStacks.add( charged );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -39,7 +39,7 @@ import appeng.transformer.annotations.Integration.Interface;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = "BC" )
|
||||
@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = "BuildCraftCore" )
|
||||
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWrench
|
||||
{
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -36,7 +36,7 @@ import appeng.api.networking.IMachineSet;
|
||||
import appeng.api.networking.events.MENetworkEvent;
|
||||
import appeng.api.networking.events.MENetworkPostCacheConstruction;
|
||||
import appeng.api.util.IReadOnlyCollection;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.util.ReadOnlyCollection;
|
||||
|
||||
@@ -166,7 +166,7 @@ public class Grid implements IGrid
|
||||
{
|
||||
if( this.myStorage == null )
|
||||
{
|
||||
this.myStorage = WorldSettings.getInstance().getNewGridStorage();
|
||||
this.myStorage = WorldData.instance().storageData().getNewGridStorage();
|
||||
this.myStorage.setGrid( this );
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ public class Grid implements IGrid
|
||||
}
|
||||
else if( this.myStorage == null )
|
||||
{
|
||||
this.myStorage = WorldSettings.getInstance().getNewGridStorage();
|
||||
this.myStorage = WorldData.instance().storageData().getNewGridStorage();
|
||||
this.myStorage.setGrid( this );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -49,7 +49,7 @@ import appeng.api.networking.pathing.IPathingGrid;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IReadOnlyCollection;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.me.pathfinding.IPathItem;
|
||||
import appeng.util.ReadOnlyCollection;
|
||||
@@ -71,7 +71,8 @@ public class GridNode implements IGridNode, IPathItem
|
||||
private Object visitorIterationNumber = null;
|
||||
// connection criteria
|
||||
private int compressedData = 0;
|
||||
private int channelData = 0;
|
||||
private int usedChannels = 0;
|
||||
private int lastUsedChannels = 0;
|
||||
|
||||
public GridNode( IGridBlock what )
|
||||
{
|
||||
@@ -90,7 +91,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
|
||||
public int usedChannels()
|
||||
{
|
||||
return this.channelData >> 8;
|
||||
return this.lastUsedChannels;
|
||||
}
|
||||
|
||||
public Class<? extends IGridHost> getMachineClass()
|
||||
@@ -328,7 +329,10 @@ public class GridNode implements IGridNode, IPathItem
|
||||
NBTTagCompound node = nodeData.getCompoundTag( name );
|
||||
this.playerID = node.getInteger( "p" );
|
||||
this.lastSecurityKey = node.getLong( "k" );
|
||||
this.setGridStorage( WorldSettings.getInstance().getGridStorage( node.getLong( "g" ) ) );
|
||||
|
||||
final long storageID = node.getLong( "g" );
|
||||
final GridStorage gridStorage = WorldData.instance().storageData().getGridStorage( storageID );
|
||||
this.setGridStorage( gridStorage );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -358,7 +362,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
@Override
|
||||
public boolean meetsChannelRequirements()
|
||||
{
|
||||
return ( !this.gridProxy.getFlags().contains( GridFlags.REQUIRE_CHANNEL ) || this.getUsedChannels() > 0 );
|
||||
return( !this.gridProxy.getFlags().contains( GridFlags.REQUIRE_CHANNEL ) || this.getUsedChannels() > 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -384,7 +388,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
|
||||
public int getUsedChannels()
|
||||
{
|
||||
return this.channelData & 0xff;
|
||||
return this.usedChannels;
|
||||
}
|
||||
|
||||
public void FindConnections()
|
||||
@@ -581,7 +585,8 @@ public class GridNode implements IGridNode, IPathItem
|
||||
public void setGridStorage( GridStorage s )
|
||||
{
|
||||
this.myStorage = s;
|
||||
this.channelData = 0;
|
||||
this.usedChannels = 0;
|
||||
this.lastUsedChannels = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -600,7 +605,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
{
|
||||
if( zeroOut )
|
||||
{
|
||||
this.channelData &= ~0xff;
|
||||
this.usedChannels = 0;
|
||||
}
|
||||
|
||||
int idx = this.connections.indexOf( fast );
|
||||
@@ -631,7 +636,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
@Override
|
||||
public void incrementChannelCount( int usedChannels )
|
||||
{
|
||||
this.channelData += usedChannels;
|
||||
this.usedChannels += usedChannels;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -650,8 +655,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
|
||||
if( this.getLastUsedChannels() != this.getUsedChannels() )
|
||||
{
|
||||
this.channelData &= 0xff;
|
||||
this.channelData |= this.channelData << 8;
|
||||
this.lastUsedChannels = this.usedChannels;
|
||||
|
||||
if( this.getInternalGrid() != null )
|
||||
{
|
||||
@@ -662,7 +666,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
|
||||
public int getLastUsedChannels()
|
||||
{
|
||||
return ( this.channelData >> 8 ) & 0xff;
|
||||
return lastUsedChannels;
|
||||
}
|
||||
|
||||
private static class MachineSecurityBreak implements Callable<Void>
|
||||
@@ -683,7 +687,6 @@ public class GridNode implements IGridNode, IPathItem
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class ConnectionComparator implements Comparator<IGridConnection>
|
||||
{
|
||||
private final IGridNode gn;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -31,7 +31,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridStorage;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
|
||||
|
||||
public class GridStorage implements IGridStorage
|
||||
@@ -157,6 +157,6 @@ public class GridStorage implements IGridStorage
|
||||
|
||||
public void remove()
|
||||
{
|
||||
WorldSettings.getInstance().destroyGridStorage( this.myID );
|
||||
WorldData.instance().storageData().destroyGridStorage( this.myID );
|
||||
}
|
||||
}
|
||||
|
||||
+12
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -24,6 +24,9 @@ import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
@@ -35,7 +38,7 @@ import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkSecurityChange;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.networking.security.ISecurityProvider;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.me.GridNode;
|
||||
|
||||
|
||||
@@ -149,7 +152,13 @@ public class SecurityCache implements ISecurityGrid
|
||||
@Override
|
||||
public boolean hasPermission( EntityPlayer player, SecurityPermissions perm )
|
||||
{
|
||||
return this.hasPermission( player == null ? -1 : WorldSettings.getInstance().getPlayerID( player.getGameProfile() ), perm );
|
||||
Preconditions.checkNotNull( player );
|
||||
Preconditions.checkNotNull( perm );
|
||||
|
||||
final GameProfile profile = player.getGameProfile();
|
||||
final int playerID = WorldData.instance().playerData().getPlayerID( profile );
|
||||
|
||||
return this.hasPermission( playerID, perm );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -22,6 +22,8 @@ package appeng.me.helpers;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -44,7 +46,7 @@ import appeng.api.networking.ticking.ITickManager;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.P2PCache;
|
||||
@@ -163,7 +165,10 @@ public class AENetworkProxy implements IGridBlock
|
||||
}
|
||||
else if( this.node != null && this.owner != null )
|
||||
{
|
||||
this.node.setPlayerID( WorldSettings.getInstance().getPlayerID( this.owner.getGameProfile() ) );
|
||||
final GameProfile profile = this.owner.getGameProfile();
|
||||
final int playerID = WorldData.instance().playerData().getPlayerID( profile );
|
||||
|
||||
this.node.setPlayerID( playerID );
|
||||
this.owner = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,10 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
out = this.adaptor.addItems( input.getItemStack() );
|
||||
}
|
||||
|
||||
this.onTick();
|
||||
if( type == Actionable.MODULATE )
|
||||
{
|
||||
this.onTick();
|
||||
}
|
||||
|
||||
if( out == null )
|
||||
{
|
||||
@@ -122,7 +125,10 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
IAEItemStack o = request.copy();
|
||||
o.setStackSize( out.stackSize );
|
||||
|
||||
this.onTick();
|
||||
if( type == Actionable.MODULATE )
|
||||
{
|
||||
this.onTick();
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -85,6 +87,8 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
|
||||
public AEBasePart( ItemStack is )
|
||||
{
|
||||
Preconditions.checkNotNull( is );
|
||||
|
||||
this.is = is;
|
||||
this.proxy = new AENetworkProxy( this, "part", is, this instanceof PartCable );
|
||||
this.proxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
@@ -139,7 +143,9 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
public int getInstalledUpgrades( Upgrades u )
|
||||
{
|
||||
return 0;
|
||||
} @Override
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
|
||||
{
|
||||
@@ -189,7 +195,9 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
public String getCustomName()
|
||||
{
|
||||
return this.is.getDisplayName();
|
||||
} @Override
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||
{
|
||||
@@ -208,10 +216,6 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
crashreportcategory.addCrashSection( "Part Side", this.side );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderDynamic( double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||
@@ -369,7 +373,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
/**
|
||||
* depending on the from, different settings will be accepted, don't call this with null
|
||||
*
|
||||
* @param from source of settings
|
||||
* @param from source of settings
|
||||
* @param compound compound of source
|
||||
*/
|
||||
public void uploadSettings( SettingsFrom from, NBTTagCompound compound )
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user