mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-10-25 20:32:29 +00:00
Reformat all code
This commit is contained in:
1 parent
0602aca546
commit
d6159fc5fb
238 files changed
+5452
-5699
No files matched your search
+53
-53
@@ -1,56 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles version="2">
|
||||
<profile kind="CleanUpProfile" name="ThaumicTinkererCleanup" version="2">
|
||||
<setting id="cleanup.remove_unused_private_fields" value="true"/>
|
||||
<setting id="cleanup.always_use_parentheses_in_expressions" value="false"/>
|
||||
<setting id="cleanup.never_use_blocks" value="false"/>
|
||||
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
|
||||
<setting id="cleanup.remove_unused_private_methods" value="true"/>
|
||||
<setting id="cleanup.convert_to_enhanced_for_loop" value="true"/>
|
||||
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
|
||||
<setting id="cleanup.sort_members" value="false"/>
|
||||
<setting id="cleanup.remove_unused_local_variables" value="true"/>
|
||||
<setting id="cleanup.remove_unused_private_members" value="true"/>
|
||||
<setting id="cleanup.never_use_parentheses_in_expressions" value="true"/>
|
||||
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
|
||||
<setting id="cleanup.make_parameters_final" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_field_access" value="true"/>
|
||||
<setting id="cleanup.use_blocks" value="false"/>
|
||||
<setting id="cleanup.remove_private_constructors" value="true"/>
|
||||
<setting id="cleanup.always_use_this_for_non_static_method_access" value="false"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
|
||||
<setting id="cleanup.always_use_this_for_non_static_field_access" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="true"/>
|
||||
<setting id="cleanup.add_default_serial_version_id" value="false"/>
|
||||
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.make_variable_declarations_final" value="false"/>
|
||||
<setting id="cleanup.add_missing_nls_tags" value="false"/>
|
||||
<setting id="cleanup.format_source_code" value="false"/>
|
||||
<setting id="cleanup.add_missing_override_annotations" value="true"/>
|
||||
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
|
||||
<setting id="cleanup.remove_unused_private_types" value="true"/>
|
||||
<setting id="cleanup.make_local_variable_final" value="true"/>
|
||||
<setting id="cleanup.add_missing_methods" value="false"/>
|
||||
<setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/>
|
||||
<setting id="cleanup.correct_indentation" value="false"/>
|
||||
<setting id="cleanup.remove_unused_imports" value="true"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/>
|
||||
<setting id="cleanup.make_private_fields_final" value="true"/>
|
||||
<setting id="cleanup.add_generated_serial_version_id" value="true"/>
|
||||
<setting id="cleanup.organize_imports" value="true"/>
|
||||
<setting id="cleanup.sort_members_all" value="false"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces" value="true"/>
|
||||
<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/>
|
||||
<setting id="cleanup.use_parentheses_in_expressions" value="true"/>
|
||||
<setting id="cleanup.add_missing_annotations" value="true"/>
|
||||
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/>
|
||||
<setting id="cleanup.use_this_for_non_static_method_access" value="true"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.add_serial_version_id" value="true"/>
|
||||
<setting id="cleanup.always_use_blocks" value="true"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.format_source_code_changes_only" value="false"/>
|
||||
</profile>
|
||||
<profile kind="CleanUpProfile" name="ThaumicTinkererCleanup" version="2">
|
||||
<setting id="cleanup.remove_unused_private_fields" value="true"/>
|
||||
<setting id="cleanup.always_use_parentheses_in_expressions" value="false"/>
|
||||
<setting id="cleanup.never_use_blocks" value="false"/>
|
||||
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
|
||||
<setting id="cleanup.remove_unused_private_methods" value="true"/>
|
||||
<setting id="cleanup.convert_to_enhanced_for_loop" value="true"/>
|
||||
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
|
||||
<setting id="cleanup.sort_members" value="false"/>
|
||||
<setting id="cleanup.remove_unused_local_variables" value="true"/>
|
||||
<setting id="cleanup.remove_unused_private_members" value="true"/>
|
||||
<setting id="cleanup.never_use_parentheses_in_expressions" value="true"/>
|
||||
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
|
||||
<setting id="cleanup.make_parameters_final" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_field_access" value="true"/>
|
||||
<setting id="cleanup.use_blocks" value="false"/>
|
||||
<setting id="cleanup.remove_private_constructors" value="true"/>
|
||||
<setting id="cleanup.always_use_this_for_non_static_method_access" value="false"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
|
||||
<setting id="cleanup.always_use_this_for_non_static_field_access" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="true"/>
|
||||
<setting id="cleanup.add_default_serial_version_id" value="false"/>
|
||||
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.make_variable_declarations_final" value="false"/>
|
||||
<setting id="cleanup.add_missing_nls_tags" value="false"/>
|
||||
<setting id="cleanup.format_source_code" value="false"/>
|
||||
<setting id="cleanup.add_missing_override_annotations" value="true"/>
|
||||
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
|
||||
<setting id="cleanup.remove_unused_private_types" value="true"/>
|
||||
<setting id="cleanup.make_local_variable_final" value="true"/>
|
||||
<setting id="cleanup.add_missing_methods" value="false"/>
|
||||
<setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/>
|
||||
<setting id="cleanup.correct_indentation" value="false"/>
|
||||
<setting id="cleanup.remove_unused_imports" value="true"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/>
|
||||
<setting id="cleanup.make_private_fields_final" value="true"/>
|
||||
<setting id="cleanup.add_generated_serial_version_id" value="true"/>
|
||||
<setting id="cleanup.organize_imports" value="true"/>
|
||||
<setting id="cleanup.sort_members_all" value="false"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces" value="true"/>
|
||||
<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/>
|
||||
<setting id="cleanup.use_parentheses_in_expressions" value="true"/>
|
||||
<setting id="cleanup.add_missing_annotations" value="true"/>
|
||||
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/>
|
||||
<setting id="cleanup.use_this_for_non_static_method_access" value="true"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.add_serial_version_id" value="true"/>
|
||||
<setting id="cleanup.always_use_blocks" value="true"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.format_source_code_changes_only" value="false"/>
|
||||
</profile>
|
||||
</profiles>
|
||||
+79
-23
@@ -1,24 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment"/><template autoinsert="false" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment"/><template autoinsert="false" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment"/><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ${project_name} Mod.
|
||||
*
|
||||
* ${project_name} is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ${project_name} is a Derivative Work on Thaumcraft 4.
|
||||
* Thaumcraft 4 (c) Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [${date}, ${time} (GMT)]
|
||||
*/</template><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment"/><template autoinsert="false" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment"/><template autoinsert="false" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment"/><template autoinsert="false" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment"/><template autoinsert="false" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment"/><template autoinsert="true" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">${filecomment}
|
||||
${package_declaration}
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<templates>
|
||||
<template autoinsert="false" context="gettercomment_context" deleted="false" description="Comment for getter method"
|
||||
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment"/>
|
||||
<template autoinsert="false" context="settercomment_context" deleted="false" description="Comment for setter method"
|
||||
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment"/>
|
||||
<template autoinsert="false" context="constructorcomment_context" deleted="false"
|
||||
description="Comment for created constructors" enabled="true"
|
||||
id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment"/>
|
||||
<template autoinsert="false" context="filecomment_context" deleted="false"
|
||||
description="Comment for created Java files" enabled="true"
|
||||
id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ${project_name} Mod.
|
||||
*
|
||||
* ${project_name} is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ${project_name} is a Derivative Work on Thaumcraft 4.
|
||||
* Thaumcraft 4 (c) Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [${date}, ${time} (GMT)]
|
||||
*/
|
||||
</template>
|
||||
<template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types"
|
||||
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment"/>
|
||||
<template autoinsert="false" context="fieldcomment_context" deleted="false" description="Comment for fields"
|
||||
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment"/>
|
||||
<template autoinsert="false" context="methodcomment_context" deleted="false"
|
||||
description="Comment for non-overriding methods" enabled="true"
|
||||
id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment"/>
|
||||
<template autoinsert="false" context="overridecomment_context" deleted="false"
|
||||
description="Comment for overriding methods" enabled="true"
|
||||
id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment"/>
|
||||
<template autoinsert="false" context="delegatecomment_context" deleted="false"
|
||||
description="Comment for delegate methods" enabled="true"
|
||||
id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment"/>
|
||||
<template autoinsert="true" context="newtype_context" deleted="false" description="Newly created files"
|
||||
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">${filecomment}
|
||||
${package_declaration}
|
||||
|
||||
${typecomment}
|
||||
${type_declaration}</template><template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody" name="classbody">
|
||||
</template><template autoinsert="true" context="interfacebody_context" deleted="false" description="Code in new interface type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name="interfacebody">
|
||||
</template><template autoinsert="true" context="enumbody_context" deleted="false" description="Code in new enum type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody" name="enumbody">
|
||||
</template><template autoinsert="true" context="annotationbody_context" deleted="false" description="Code in new annotation type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name="annotationbody">
|
||||
</template><template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo} Auto-generated catch block
|
||||
${exception_var}.printStackTrace();</template><template autoinsert="false" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody"/><template autoinsert="true" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}
|
||||
// ${todo} Auto-generated constructor stub</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template></templates>
|
||||
${typecomment}
|
||||
${type_declaration}
|
||||
</template>
|
||||
<template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies"
|
||||
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody" name="classbody">
|
||||
</template>
|
||||
<template autoinsert="true" context="interfacebody_context" deleted="false"
|
||||
description="Code in new interface type bodies" enabled="true"
|
||||
id="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name="interfacebody">
|
||||
</template>
|
||||
<template autoinsert="true" context="enumbody_context" deleted="false" description="Code in new enum type bodies"
|
||||
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody" name="enumbody">
|
||||
</template>
|
||||
<template autoinsert="true" context="annotationbody_context" deleted="false"
|
||||
description="Code in new annotation type bodies" enabled="true"
|
||||
id="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name="annotationbody">
|
||||
</template>
|
||||
<template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks"
|
||||
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo}
|
||||
Auto-generated catch block
|
||||
${exception_var}.printStackTrace();
|
||||
</template>
|
||||
<template autoinsert="false" context="methodbody_context" deleted="false" description="Code in created method stubs"
|
||||
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody"/>
|
||||
<template autoinsert="true" context="constructorbody_context" deleted="false"
|
||||
description="Code in created constructor stubs" enabled="true"
|
||||
id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}
|
||||
// ${todo} Auto-generated constructor stub
|
||||
</template>
|
||||
<template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters"
|
||||
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};
|
||||
</template>
|
||||
<template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters"
|
||||
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} =
|
||||
${param};
|
||||
</template>
|
||||
</templates>
|
||||
+24
-29
@@ -38,7 +38,7 @@ repositories {
|
||||
url 'http://dvs1.progwml6.com/files/maven'
|
||||
}
|
||||
}
|
||||
String changelogLoc='https://raw.github.com/Thaumic-Tinkerer/ThaumicTinkerer/changelog/web/changelog'
|
||||
String changelogLoc = 'https://raw.github.com/Thaumic-Tinkerer/ThaumicTinkerer/changelog/web/changelog'
|
||||
|
||||
//apply plugin: 'curseforge'
|
||||
apply plugin: 'forge'
|
||||
@@ -46,12 +46,12 @@ apply plugin: 'forge'
|
||||
|
||||
version = "2.3-DEV"
|
||||
if (project.hasProperty("buildnum"))
|
||||
version = "2.3-"+project.buildnum
|
||||
if(project.hasProperty("releaseType"))
|
||||
if (project.releaseType=="ALPHA")
|
||||
version="alpha-"+version
|
||||
version = "2.3-" + project.buildnum
|
||||
if (project.hasProperty("releaseType"))
|
||||
if (project.releaseType == "ALPHA")
|
||||
version = "alpha-" + version
|
||||
|
||||
group= "vazkii.tinkerer" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
group = "vazkii.tinkerer" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "ThaumicTinkerer"
|
||||
|
||||
minecraft {
|
||||
@@ -75,38 +75,33 @@ minecraft {
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dependencies {
|
||||
compile files (
|
||||
compile files(
|
||||
'TCDEOBF.jar'
|
||||
)
|
||||
compile 'javax.mail:mail:1.4'
|
||||
compile "mantle:Mantle:1.7.2-145.3a637c2:deobf"
|
||||
compile("tconstruct:TConstruct:1.7.2-1.6.0.jenkins494:deobf"){
|
||||
exclude module: 'CodeChickenCore'
|
||||
exclude module: 'Waila'
|
||||
exclude module: 'NotEnoughItems'
|
||||
}
|
||||
compile("tconstruct:TConstruct:1.7.2-1.6.0.jenkins494:deobf") {
|
||||
exclude module: 'CodeChickenCore'
|
||||
exclude module: 'Waila'
|
||||
exclude module: 'NotEnoughItems'
|
||||
}
|
||||
}
|
||||
|
||||
processResources
|
||||
{
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
// replace version and mcversion
|
||||
expand 'version':project.version, 'MCversion':project.minecraft.version
|
||||
}
|
||||
{
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
// replace version and mcversion
|
||||
expand 'version': project.version, 'MCversion': project.minecraft.version
|
||||
}
|
||||
|
||||
// copy everything else, thats not the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
}
|
||||
// copy everything else, thats not the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
}
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'FMLCorePlugin': 'vazkii.tinkerer.preloader.ThaumicTLoaderContainer'
|
||||
|
||||
@@ -1,75 +1,77 @@
|
||||
<?xml version="1.0" ?>
|
||||
<project name="ThaumicTinkerer" default="build">
|
||||
|
||||
<property file="build.properties" prefix="build"/>
|
||||
<property file="build.properties" prefix="build"/>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="${build.dir.gradle}\build\classes\main" />
|
||||
<delete file="${build.dir.gradle}\src\main\java\mcmod.info" />
|
||||
<delete dir="${build.dir.gradle}\src\main\java\vazkii" />
|
||||
<delete dir="${build.dir.gradle}\src\main\java\ic2" />
|
||||
<delete dir="${build.dir.gradle}\src\main\java\uildcraft" />
|
||||
<delete dir="${build.dir.gradle}\src\main\java\dan200" />
|
||||
<delete dir="${build.dir.gradle}\src\main\java\cofh" />
|
||||
<delete dir ="${build.dir.temp}" />
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete dir="${build.dir.gradle}\build\classes\main"/>
|
||||
<delete file="${build.dir.gradle}\src\main\java\mcmod.info"/>
|
||||
<delete dir="${build.dir.gradle}\src\main\java\vazkii"/>
|
||||
<delete dir="${build.dir.gradle}\src\main\java\ic2"/>
|
||||
<delete dir="${build.dir.gradle}\src\main\java\uildcraft"/>
|
||||
<delete dir="${build.dir.gradle}\src\main\java\dan200"/>
|
||||
<delete dir="${build.dir.gradle}\src\main\java\cofh"/>
|
||||
<delete dir="${build.dir.temp}"/>
|
||||
</target>
|
||||
|
||||
<target name="increment_build_number">
|
||||
<propertyfile file="build.properties">
|
||||
<entry key="build_number" type="int" operation="+" default="1"/>
|
||||
</propertyfile>
|
||||
</target>
|
||||
<target name="increment_build_number">
|
||||
<propertyfile file="build.properties">
|
||||
<entry key="build_number" type="int" operation="+" default="1"/>
|
||||
</propertyfile>
|
||||
</target>
|
||||
|
||||
<target name="prep">
|
||||
<mkdir dir="${build.dir.temp}" />
|
||||
<target name="prep">
|
||||
<mkdir dir="${build.dir.temp}"/>
|
||||
|
||||
<copy todir="${build.dir.temp}">
|
||||
<fileset dir="${build.dir.repo}\resources\" />
|
||||
</copy>
|
||||
<copy todir="${build.dir.temp}">
|
||||
<fileset dir="${build.dir.repo}\resources\"/>
|
||||
</copy>
|
||||
|
||||
<copy todir="${build.dir.gradle}\src\main\java">
|
||||
<fileset dir="${build.dir.repo}\MODSRC\" />
|
||||
</copy>
|
||||
</target>
|
||||
<copy todir="${build.dir.gradle}\src\main\java">
|
||||
<fileset dir="${build.dir.repo}\MODSRC\"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="replace_tokens">
|
||||
<replace dir="${build.dir.temp}" token="ANT:VERSION" value="${build.version}" />
|
||||
<replace dir="${build.dir.temp}" token="ANT:BUILD" value="${build.build_number}" />
|
||||
<target name="replace_tokens">
|
||||
<replace dir="${build.dir.temp}" token="ANT:VERSION" value="${build.version}"/>
|
||||
<replace dir="${build.dir.temp}" token="ANT:BUILD" value="${build.build_number}"/>
|
||||
|
||||
<replace dir="${build.dir.gradle}\src\main\java" token="ANT:VERSION" value="${build.version}" />
|
||||
<replace dir="${build.dir.gradle}\src\main\java" token="ANT:BUILD" value="${build.build_number}" />
|
||||
</target>
|
||||
<replace dir="${build.dir.gradle}\src\main\java" token="ANT:VERSION" value="${build.version}"/>
|
||||
<replace dir="${build.dir.gradle}\src\main\java" token="ANT:BUILD" value="${build.build_number}"/>
|
||||
</target>
|
||||
|
||||
<target name="gradle_build">
|
||||
<copy todir="${build.dir.gradle}" overwrite="true">
|
||||
<fileset file="${build.dir.repo}\build.gradle"/>
|
||||
</copy>
|
||||
<target name="gradle_build">
|
||||
<copy todir="${build.dir.gradle}" overwrite="true">
|
||||
<fileset file="${build.dir.repo}\build.gradle"/>
|
||||
</copy>
|
||||
|
||||
<exec dir="${build.dir.gradle}" executable="cmd" osfamily="windows">
|
||||
<arg line="/c gradle build" />
|
||||
</exec>
|
||||
<exec dir="${build.dir.gradle}" executable="cmd" osfamily="windows">
|
||||
<arg line="/c gradle build"/>
|
||||
</exec>
|
||||
|
||||
<exec dir="${build.dir.gradle}" executable="gradle" osfamily="unix">
|
||||
<arg value="build" />
|
||||
</exec>
|
||||
<exec dir="${build.dir.gradle}" executable="gradle" osfamily="unix">
|
||||
<arg value="build"/>
|
||||
</exec>
|
||||
|
||||
<move file="${build.dir.gradle}\build\libs\modid-1.0.jar" tofile="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar" />
|
||||
</target>
|
||||
<move file="${build.dir.gradle}\build\libs\modid-1.0.jar"
|
||||
tofile="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar"/>
|
||||
</target>
|
||||
|
||||
<target name="inject_assets">
|
||||
<jar update="true" destfile="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar">
|
||||
<fileset dir="${build.dir.temp}" excludes="**/psd/**" />
|
||||
</jar>
|
||||
<delete dir ="${build.dir.temp}" />
|
||||
</target>
|
||||
<target name="inject_assets">
|
||||
<jar update="true"
|
||||
destfile="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar">
|
||||
<fileset dir="${build.dir.temp}" excludes="**/psd/**"/>
|
||||
</jar>
|
||||
<delete dir="${build.dir.temp}"/>
|
||||
</target>
|
||||
|
||||
<target name="build">
|
||||
<antcall target="clean" />
|
||||
<antcall target="prep" />
|
||||
<antcall target="replace_tokens" />
|
||||
<antcall target="gradle_build" />
|
||||
<antcall target="inject_assets" />
|
||||
<antcall target="increment_build_number" />
|
||||
<antcall target="clean" />
|
||||
</target>
|
||||
<target name="build">
|
||||
<antcall target="clean"/>
|
||||
<antcall target="prep"/>
|
||||
<antcall target="replace_tokens"/>
|
||||
<antcall target="gradle_build"/>
|
||||
<antcall target="inject_assets"/>
|
||||
<antcall target="increment_build_number"/>
|
||||
<antcall target="clean"/>
|
||||
</target>
|
||||
</project>
|
||||
@@ -4,5 +4,5 @@ package vazkii.tinkerer.api;
|
||||
* Created by Katrina on 16/04/14.
|
||||
*/
|
||||
public class InterModCommsOperations {
|
||||
public static final String ADD_RESEARCH_BLACKLIST="AddResearchBlacklist";
|
||||
public static final String ADD_RESEARCH_BLACKLIST = "AddResearchBlacklist";
|
||||
}
|
||||
@@ -25,23 +25,24 @@ import vazkii.tinkerer.client.core.helper.ClientHelper;
|
||||
import vazkii.tinkerer.client.gui.GuiResearchPeripheral;
|
||||
import vazkii.tinkerer.common.lib.LibResearch;
|
||||
|
||||
public class ClientTickHandler {
|
||||
public class ClientTickHandler {
|
||||
|
||||
public static int elapsedTicks;
|
||||
@SubscribeEvent
|
||||
|
||||
@SubscribeEvent
|
||||
public void tickEnd(TickEvent event) {
|
||||
if(event.phase== TickEvent.Phase.END) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
if (mc.currentScreen != null && mc.currentScreen instanceof GuiResearchRecipe && !(mc.currentScreen instanceof GuiResearchPeripheral)) {
|
||||
ResearchItem research = ReflectionHelper.getPrivateValue(GuiResearchRecipe.class, (GuiResearchRecipe) mc.currentScreen, 9);
|
||||
if (research.key.equals(LibResearch.KEY_PERIPHERALS) || research.key.equals(LibResearch.KEY_GOLEMCONNECTOR))
|
||||
mc.displayGuiScreen(new GuiResearchPeripheral(research));
|
||||
}
|
||||
if (event.phase == TickEvent.Phase.END) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
if (mc.currentScreen != null && mc.currentScreen instanceof GuiResearchRecipe && !(mc.currentScreen instanceof GuiResearchPeripheral)) {
|
||||
ResearchItem research = ReflectionHelper.getPrivateValue(GuiResearchRecipe.class, (GuiResearchRecipe) mc.currentScreen, 9);
|
||||
if (research.key.equals(LibResearch.KEY_PERIPHERALS) || research.key.equals(LibResearch.KEY_GOLEMCONNECTOR))
|
||||
mc.displayGuiScreen(new GuiResearchPeripheral(research));
|
||||
}
|
||||
|
||||
ToolModeHUDHandler.clientTick();
|
||||
ToolModeHUDHandler.clientTick();
|
||||
|
||||
++elapsedTicks;
|
||||
}
|
||||
++elapsedTicks;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,24 +17,22 @@ import vazkii.tinkerer.common.item.kami.armor.ItemIchorclothArmorAdv;
|
||||
* Created by Katrina on 28/02/14.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GemArmorKeyHandler {
|
||||
public class GemArmorKeyHandler {
|
||||
|
||||
static KeyBinding SpecialAbility = new KeyBinding("ttmisc.toggleArmor", Keyboard.KEY_U,"ttmisc.keyCategory");
|
||||
public GemArmorKeyHandler()
|
||||
{
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
ClientRegistry.registerKeyBinding(SpecialAbility);
|
||||
}
|
||||
static KeyBinding SpecialAbility = new KeyBinding("ttmisc.toggleArmor", Keyboard.KEY_U, "ttmisc.keyCategory");
|
||||
|
||||
public GemArmorKeyHandler() {
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
ClientRegistry.registerKeyBinding(SpecialAbility);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void keyUp(InputEvent.KeyInputEvent event) {
|
||||
if(SpecialAbility.isPressed())
|
||||
{
|
||||
if((Minecraft.getMinecraft().thePlayer.getCurrentArmor(0) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(0).getItem() instanceof ItemIchorclothArmorAdv) || (Minecraft.getMinecraft().thePlayer.getCurrentArmor(1) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(1).getItem() instanceof ItemIchorclothArmorAdv) || (Minecraft.getMinecraft().thePlayer.getCurrentArmor(2) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(2).getItem() instanceof ItemIchorclothArmorAdv) || (Minecraft.getMinecraft().thePlayer.getCurrentArmor(3) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(3).getItem() instanceof ItemIchorclothArmorAdv)) {
|
||||
KamiArmorClientHandler.SetStatus(!ThaumicTinkerer.proxy.armorStatus(ThaumicTinkerer.proxy.getClientPlayer()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void keyUp(InputEvent.KeyInputEvent event) {
|
||||
if (SpecialAbility.isPressed()) {
|
||||
if ((Minecraft.getMinecraft().thePlayer.getCurrentArmor(0) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(0).getItem() instanceof ItemIchorclothArmorAdv) || (Minecraft.getMinecraft().thePlayer.getCurrentArmor(1) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(1).getItem() instanceof ItemIchorclothArmorAdv) || (Minecraft.getMinecraft().thePlayer.getCurrentArmor(2) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(2).getItem() instanceof ItemIchorclothArmorAdv) || (Minecraft.getMinecraft().thePlayer.getCurrentArmor(3) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(3).getItem() instanceof ItemIchorclothArmorAdv)) {
|
||||
KamiArmorClientHandler.SetStatus(!ThaumicTinkerer.proxy.armorStatus(ThaumicTinkerer.proxy.getClientPlayer()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,20 +38,20 @@ public final class HUDHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) {
|
||||
if(event.type == ElementType.HOTBAR && ClientHelper.minecraft().currentScreen == null) {
|
||||
if (event.type == ElementType.HOTBAR && ClientHelper.minecraft().currentScreen == null) {
|
||||
boolean up = !Config.dialBottom;
|
||||
int xpos = 4;
|
||||
int ypos = up ? 50 : event.resolution.getScaledHeight() - 70;
|
||||
|
||||
ItemStack item = ClientHelper.clientPlayer().getCurrentEquippedItem();
|
||||
if(item != null && item.getItem() instanceof ItemWandCasting) {
|
||||
if (item != null && item.getItem() instanceof ItemWandCasting) {
|
||||
ItemWandCasting wand = (ItemWandCasting) item.getItem();
|
||||
wand.getFocusItem(item);
|
||||
IWandFocus focus = wand.getFocus(item);
|
||||
|
||||
if(focus != null && focus instanceof ItemFocusDislocation) {
|
||||
if (focus != null && focus instanceof ItemFocusDislocation) {
|
||||
ItemStack pickedBlock = ((ItemFocusDislocation) focus).getPickedBlock(item);
|
||||
if(pickedBlock != null) {
|
||||
if (pickedBlock != null) {
|
||||
Gui.drawRect(xpos - 1, ypos - 1, xpos + 18, ypos + 18, 0x66000000);
|
||||
|
||||
FontRenderer font = ClientHelper.fontRenderer();
|
||||
@@ -64,7 +64,7 @@ public final class HUDHandler {
|
||||
font.drawStringWithShadow(name, xpos + 20, ypos, 0xFFAA00);
|
||||
|
||||
NBTTagCompound cmp = ((ItemFocusDislocation) focus).getStackTileEntity(item);
|
||||
if(cmp != null && !cmp.hasNoTags()) {
|
||||
if (cmp != null && !cmp.hasNoTags()) {
|
||||
String content = StatCollector.translateToLocal("ttmisc.focusDislocation.tooltipExtra");
|
||||
font.getStringWidth(content);
|
||||
|
||||
@@ -72,12 +72,12 @@ public final class HUDHandler {
|
||||
font.drawStringWithShadow(content, xpos + 20, ypos + 9, 0xFFAA00);
|
||||
}
|
||||
|
||||
if(new ItemStack(((ItemBlock)pickedBlock.getItem()).field_150939_a).getItem() != null)
|
||||
renderItem.renderItemIntoGUI(font, ClientHelper.minecraft().renderEngine, new ItemStack(((ItemBlock)pickedBlock.getItem()).field_150939_a), xpos, ypos);
|
||||
else {
|
||||
if (((ItemBlock)pickedBlock.getItem()).field_150939_a== Blocks.reeds)
|
||||
renderItem.renderItemIntoGUI(font, ClientHelper.minecraft().renderEngine, new ItemStack(Items.reeds), xpos, ypos);
|
||||
}
|
||||
if (new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a).getItem() != null)
|
||||
renderItem.renderItemIntoGUI(font, ClientHelper.minecraft().renderEngine, new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a), xpos, ypos);
|
||||
else {
|
||||
if (((ItemBlock) pickedBlock.getItem()).field_150939_a == Blocks.reeds)
|
||||
renderItem.renderItemIntoGUI(font, ClientHelper.minecraft().renderEngine, new ItemStack(Items.reeds), xpos, ypos);
|
||||
}
|
||||
font.setUnicodeFlag(unicode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
*/
|
||||
package vazkii.tinkerer.client.core.handler;
|
||||
|
||||
import vazkii.tinkerer.client.lib.LibResources;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import vazkii.tinkerer.client.lib.LibResources;
|
||||
|
||||
public final class LocalizationHandler {
|
||||
|
||||
public static void loadLocalizations() {
|
||||
for(String locale : LibResources.LANGS)
|
||||
for (String locale : LibResources.LANGS)
|
||||
LanguageRegistry.instance().loadLocalization(LibResources.PREFIX_LANG + locale + ".lang", locale, false);
|
||||
}
|
||||
|
||||
|
||||
+12
-15
@@ -1,28 +1,25 @@
|
||||
package vazkii.tinkerer.client.core.handler.kami;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.common.network.packet.kami.PacketToggleArmor;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
/**
|
||||
* Created by Katrina on 02/03/14.
|
||||
*/
|
||||
public class KamiArmorClientHandler {
|
||||
|
||||
public static boolean ArmorEnabled=true;
|
||||
public static boolean ArmorEnabled = true;
|
||||
|
||||
|
||||
|
||||
public static void SetStatus(boolean status)
|
||||
{
|
||||
if(FMLClientHandler.instance().getClient().currentScreen == null){
|
||||
if(status)
|
||||
ToolModeHUDHandler.setTooltip(StatCollector.translateToLocal("ttmisc.enableAllArmor"));
|
||||
else
|
||||
ToolModeHUDHandler.setTooltip(StatCollector.translateToLocal("ttmisc.disableAllArmor"));
|
||||
ArmorEnabled=status;
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketToggleArmor(status));
|
||||
}
|
||||
}
|
||||
public static void SetStatus(boolean status) {
|
||||
if (FMLClientHandler.instance().getClient().currentScreen == null) {
|
||||
if (status)
|
||||
ToolModeHUDHandler.setTooltip(StatCollector.translateToLocal("ttmisc.enableAllArmor"));
|
||||
else
|
||||
ToolModeHUDHandler.setTooltip(StatCollector.translateToLocal("ttmisc.disableAllArmor"));
|
||||
ArmorEnabled = status;
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketToggleArmor(status));
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -27,17 +27,17 @@ public final class PlacementMirrorPredictionRenderer {
|
||||
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
List<EntityPlayer> playerEntities = world.playerEntities;
|
||||
for(EntityPlayer player : playerEntities) {
|
||||
for (EntityPlayer player : playerEntities) {
|
||||
ItemStack currentStack = player.getCurrentEquippedItem();
|
||||
if(currentStack != null && currentStack.getItem() == ModItems.placementMirror && ItemPlacementMirror.getBlock(currentStack)!= Blocks.air) {
|
||||
renderPlayerLook(player, currentStack);
|
||||
}
|
||||
if (currentStack != null && currentStack.getItem() == ModItems.placementMirror && ItemPlacementMirror.getBlock(currentStack) != Blocks.air) {
|
||||
renderPlayerLook(player, currentStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderPlayerLook(EntityPlayer player, ItemStack stack) {
|
||||
ChunkCoordinates[] coords = ItemPlacementMirror.getBlocksToPlace(stack, player);
|
||||
if(ItemPlacementMirror.hasBlocks(stack, player, coords)) {
|
||||
if (ItemPlacementMirror.hasBlocks(stack, player, coords)) {
|
||||
ItemStack block = new ItemStack(ItemPlacementMirror.getBlock(stack), 1, ItemPlacementMirror.getBlockMeta(stack));
|
||||
ChunkCoordinates lastCoords = new ChunkCoordinates(0, 0, 0);
|
||||
|
||||
@@ -45,7 +45,7 @@ public final class PlacementMirrorPredictionRenderer {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
for(ChunkCoordinates coord : coords) {
|
||||
for (ChunkCoordinates coord : coords) {
|
||||
renderBlockAt(block, coord, lastCoords);
|
||||
lastCoords = coord;
|
||||
}
|
||||
@@ -54,17 +54,17 @@ public final class PlacementMirrorPredictionRenderer {
|
||||
}
|
||||
|
||||
private void renderBlockAt(ItemStack block, ChunkCoordinates pos, ChunkCoordinates last) {
|
||||
if(block.getItem()==null)
|
||||
return;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(pos.posX + 0.5 - RenderManager.renderPosX, pos.posY + 0.5 - RenderManager.renderPosY, pos.posZ + 0.5 - RenderManager.renderPosZ);
|
||||
if (block.getItem() == null)
|
||||
return;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(pos.posX + 0.5 - RenderManager.renderPosX, pos.posY + 0.5 - RenderManager.renderPosY, pos.posZ + 0.5 - RenderManager.renderPosZ);
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.6F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
blockRender.useInventoryTint = false;
|
||||
blockRender.renderBlockAsItem(Block.getBlockFromItem(block.getItem()), block.getItemDamage(), 1F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,18 +15,15 @@
|
||||
package vazkii.tinkerer.client.core.handler.kami;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.tinkerer.client.lib.LibResources;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public final class SoulHeartClientHandler {
|
||||
|
||||
@@ -39,8 +36,8 @@ public final class SoulHeartClientHandler {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void renderHealthBar(RenderGameOverlayEvent event) {
|
||||
if(event.type == ElementType.FOOD && clientPlayerHP > 0) {
|
||||
if(event instanceof RenderGameOverlayEvent.Post) {
|
||||
if (event.type == ElementType.FOOD && clientPlayerHP > 0) {
|
||||
if (event instanceof RenderGameOverlayEvent.Post) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
int x = event.resolution.getScaledWidth() / 2 + 10;
|
||||
@@ -49,9 +46,9 @@ public final class SoulHeartClientHandler {
|
||||
GL11.glTranslatef(0F, 10F, 0F);
|
||||
mc.renderEngine.bindTexture(heartsResource);
|
||||
int it = 0;
|
||||
for(int i = 0; i < clientPlayerHP; i++) {
|
||||
for (int i = 0; i < clientPlayerHP; i++) {
|
||||
boolean half = i == clientPlayerHP - 1 && clientPlayerHP % 2 != 0;
|
||||
if(half || i % 2 == 0) {
|
||||
if (half || i % 2 == 0) {
|
||||
renderHeart(x + it * 8, y, !half);
|
||||
it++;
|
||||
}
|
||||
@@ -63,7 +60,7 @@ public final class SoulHeartClientHandler {
|
||||
GL11.glTranslatef(0F, -10F, 0F);
|
||||
}
|
||||
|
||||
if(event.type == ElementType.AIR && event instanceof RenderGameOverlayEvent.Post && clientPlayerHP > 0)
|
||||
if (event.type == ElementType.AIR && event instanceof RenderGameOverlayEvent.Post && clientPlayerHP > 0)
|
||||
GL11.glTranslatef(0F, 10F, 0F);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public final class ToolModeHUDHandler {
|
||||
}
|
||||
|
||||
public static void setTooltip(String tooltip) {
|
||||
if(!tooltip.equals(currentTooltip)) {
|
||||
if (!tooltip.equals(currentTooltip)) {
|
||||
currentTooltip = tooltip;
|
||||
tooltipDisplayTicks = 400;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public final class ToolModeHUDHandler {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void clientTick() {
|
||||
if(tooltipDisplayTicks > 0)
|
||||
if (tooltipDisplayTicks > 0)
|
||||
--tooltipDisplayTicks;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,16 +14,15 @@
|
||||
*/
|
||||
package vazkii.tinkerer.client.core.helper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class ClientHelper {
|
||||
|
||||
public static Minecraft minecraft() {
|
||||
|
||||
@@ -56,7 +56,6 @@ import vazkii.tinkerer.common.core.proxy.TTCommonProxy;
|
||||
import vazkii.tinkerer.common.item.ModItems;
|
||||
import vazkii.tinkerer.common.item.kami.foci.ItemFocusShadowbeam;
|
||||
|
||||
|
||||
public class TTClientProxy extends TTCommonProxy {
|
||||
|
||||
public static EnumRarity kamiRarity;
|
||||
@@ -64,11 +63,11 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
super.preInit(event);
|
||||
//Temporarly disabled for 1.7
|
||||
//Temporarly disabled for 1.7
|
||||
//MinecraftForge.EVENT_BUS.register(new FumeTool());
|
||||
if(ConfigHandler.enableKami)
|
||||
if (ConfigHandler.enableKami)
|
||||
//kamiRarity = EnumHelperClient.addRarity("KAMI", 0x6, "Kami");
|
||||
kamiRarity = EnumHelperClient.addEnum(new Class[][]{{EnumRarity.class, EnumChatFormatting.class, String.class}},EnumRarity.class,"KAMI", EnumChatFormatting.LIGHT_PURPLE, "Kami");
|
||||
kamiRarity = EnumHelperClient.addEnum(new Class[][]{ { EnumRarity.class, EnumChatFormatting.class, String.class } }, EnumRarity.class, "KAMI", EnumChatFormatting.LIGHT_PURPLE, "Kami");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,17 +76,17 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
|
||||
LocalizationHandler.loadLocalizations();
|
||||
MinecraftForge.EVENT_BUS.register(new HUDHandler());
|
||||
ClientTickHandler cthandler=new ClientTickHandler();
|
||||
FMLCommonHandler.instance().bus().register(cthandler);
|
||||
MinecraftForge.EVENT_BUS.register(cthandler);
|
||||
MinecraftForge.EVENT_BUS.register(new GemArmorKeyHandler());
|
||||
ClientTickHandler cthandler = new ClientTickHandler();
|
||||
FMLCommonHandler.instance().bus().register(cthandler);
|
||||
MinecraftForge.EVENT_BUS.register(cthandler);
|
||||
MinecraftForge.EVENT_BUS.register(new GemArmorKeyHandler());
|
||||
registerTiles();
|
||||
registerRenderIDs();
|
||||
|
||||
if(ConfigHandler.enableKami) {
|
||||
if (ConfigHandler.enableKami) {
|
||||
MinecraftForge.EVENT_BUS.register(new SoulHeartClientHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new ToolModeHUDHandler());
|
||||
if(ConfigHandler.showPlacementMirrorBlocks)
|
||||
if (ConfigHandler.showPlacementMirrorBlocks)
|
||||
MinecraftForge.EVENT_BUS.register(new PlacementMirrorPredictionRenderer());
|
||||
}
|
||||
}
|
||||
@@ -99,8 +98,7 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileFunnel.class, new RenderTileFunnel());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileRepairer.class, new RenderTileRepairer());
|
||||
|
||||
|
||||
if(ConfigHandler.enableKami) {
|
||||
if (ConfigHandler.enableKami) {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileWarpGate.class, new RenderTileWarpGate());
|
||||
}
|
||||
}
|
||||
@@ -112,15 +110,15 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
RenderingRegistry.registerBlockHandler(new RenderRepairer());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.mobAspect, new RenderMobAspect());
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.mobDisplay,new RenderMobDisplay());
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.mobDisplay, new RenderMobDisplay());
|
||||
|
||||
if(ConfigHandler.enableKami) {
|
||||
if (ConfigHandler.enableKami) {
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.placementMirror, new RenderPlacementMirror());
|
||||
|
||||
LibRenderIDs.idWarpGate = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new RenderWarpGate());
|
||||
//KeyBindingRegistry.registerKeyBinding(new GemArmorKeyHandler());
|
||||
//KeyBindingRegistry.registerKeyBinding(new GemArmorKeyHandler());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +132,7 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
protected void initCCPeripherals() {
|
||||
try {
|
||||
super.initCCPeripherals();
|
||||
} catch(Throwable e) {
|
||||
} catch (Throwable e) {
|
||||
System.out.println("Thaumic Tinkerer: ComputerCraft not found.");
|
||||
}
|
||||
}
|
||||
@@ -143,23 +141,22 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
public boolean isClient() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean armorStatus(EntityPlayer player)
|
||||
{
|
||||
return KamiArmorClientHandler.ArmorEnabled;
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean armorStatus(EntityPlayer player) {
|
||||
return KamiArmorClientHandler.ArmorEnabled;
|
||||
|
||||
@Override
|
||||
public void setArmor(EntityPlayer player,boolean status)
|
||||
{
|
||||
super.setArmor(player,status);
|
||||
if(FMLCommonHandler.instance().getEffectiveSide()== Side.CLIENT){
|
||||
KamiArmorClientHandler.ArmorEnabled=status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void setArmor(EntityPlayer player, boolean status) {
|
||||
super.setArmor(player, status);
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
KamiArmorClientHandler.ArmorEnabled = status;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayer getClientPlayer() {
|
||||
return ClientHelper.clientPlayer();
|
||||
}
|
||||
|
||||
@@ -61,34 +61,34 @@ public class GuiAnimationTablet extends GuiContainer {
|
||||
|
||||
private void addButton(GuiButtonAT button) {
|
||||
buttonListAT.add(button);
|
||||
if(button instanceof IRadioButton)
|
||||
if (button instanceof IRadioButton)
|
||||
radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton instanceof IRadioButton)
|
||||
if (par1GuiButton instanceof IRadioButton)
|
||||
((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListAT.get(0).buttonEnabled = !buttonListAT.get(0).buttonEnabled;
|
||||
|
||||
tablet.leftClick = buttonListAT.get(1).buttonEnabled;
|
||||
tablet.redstone = buttonListAT.get(0).buttonEnabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketTabletButton(tablet));
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketTabletButton(tablet));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
String left = StatCollector.translateToLocal("ttmisc.leftClick");
|
||||
String right = StatCollector.translateToLocal("ttmisc.rightClick");
|
||||
String redstone = StatCollector.translateToLocal("ttmisc.redstoneControl");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
String left = StatCollector.translateToLocal("ttmisc.leftClick");
|
||||
String right = StatCollector.translateToLocal("ttmisc.rightClick");
|
||||
String redstone = StatCollector.translateToLocal("ttmisc.redstoneControl");
|
||||
|
||||
fontRendererObj.drawString(left, x + 48 - fontRendererObj.getStringWidth(left), y + 18, 0x999999);
|
||||
fontRendererObj.drawString(right, x + 128, y + 18, 0x999999);
|
||||
fontRendererObj.drawString(redstone, x + xSize / 2 - fontRendererObj.getStringWidth(redstone) / 2, y + 50, 0x999999);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
fontRendererObj.drawString(left, x + 48 - fontRendererObj.getStringWidth(left), y + 18, 0x999999);
|
||||
fontRendererObj.drawString(right, x + 128, y + 18, 0x999999);
|
||||
fontRendererObj.drawString(redstone, x + xSize / 2 - fontRendererObj.getStringWidth(redstone) / 2, y + 50, 0x999999);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
}
|
||||
@@ -63,21 +63,21 @@ public class GuiAspectAnalyzer extends GuiContainer {
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
ItemStack stack = analyzer.getStackInSlot(0);
|
||||
if(stack != null) {
|
||||
if (stack != null) {
|
||||
int h = ScanManager.generateItemHash(stack.getItem(), stack.getItemDamage());
|
||||
|
||||
List<String> list = Thaumcraft.proxy.getScannedObjects().get(ClientHelper.clientPlayer().getGameProfile().getName());
|
||||
if ( list != null && (list.contains("@" + h) || list.contains("#" + h))) {
|
||||
if (list != null && (list.contains("@" + h) || list.contains("#" + h))) {
|
||||
AspectList tags = ThaumcraftCraftingManager.getObjectTags(stack);
|
||||
tags = ThaumcraftCraftingManager.getBonusTags(stack, tags);
|
||||
if (tags != null) {
|
||||
int i = 0;
|
||||
for(Aspect aspect : tags.getAspectsSortedAmount()) {
|
||||
for (Aspect aspect : tags.getAspectsSortedAmount()) {
|
||||
int x = this.x + 20 + i * 18;
|
||||
int y = this.y + 58;
|
||||
UtilsFX.drawTag(x, y, aspect, tags.getAmount(aspect), 0, zLevel);
|
||||
|
||||
if(mx > x && mx < x + 16 && my > y && my < y + 16)
|
||||
if (mx > x && mx < x + 16 && my > y && my < y + 16)
|
||||
aspectHovered = aspect;
|
||||
|
||||
i++;
|
||||
@@ -89,7 +89,7 @@ public class GuiAspectAnalyzer extends GuiContainer {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mx, int my) {
|
||||
if(aspectHovered != null)
|
||||
if (aspectHovered != null)
|
||||
ClientHelper.renderTooltip(mx - x, my - y, Arrays.asList(EnumChatFormatting.AQUA + aspectHovered.getName(), EnumChatFormatting.GRAY + aspectHovered.getLocalizedDescription()));
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mx, my);
|
||||
|
||||
@@ -82,12 +82,12 @@ public class GuiEnchanting extends GuiContainer {
|
||||
buttonList.add(enchantButton);
|
||||
enchantButton.enabled = !enchanter.enchantments.isEmpty();
|
||||
|
||||
for(int i = 0; i < 16; i++) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
int z = -24;
|
||||
if (i > 7 || (enchantButtons[8]==null || !enchantButtons[8].enabled)) {
|
||||
if (i > 7 || (enchantButtons[8] == null || !enchantButtons[8].enabled)) {
|
||||
z = 0;
|
||||
}
|
||||
GuiButtonEnchantment button = new GuiButtonEnchantment(this, 1 + i, x + 34 + ((i)%8)* 16, y + 54 + z);
|
||||
GuiButtonEnchantment button = new GuiButtonEnchantment(this, 1 + i, x + 34 + ((i) % 8) * 16, y + 54 + z);
|
||||
enchantButtons[i] = button;
|
||||
buttonList.add(button);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class GuiEnchanting extends GuiContainer {
|
||||
asignEnchantButtons();
|
||||
|
||||
int i = 0;
|
||||
for(Integer enchant : enchanter.enchantments) {
|
||||
for (Integer enchant : enchanter.enchantments) {
|
||||
GuiButtonEnchantment button = new GuiButtonFramedEnchantment(this, 17 + i * 3, x + xSize + 4, y + i * 26);
|
||||
button.enchant = Enchantment.enchantmentsList[enchant];
|
||||
buttonList.add(button);
|
||||
@@ -106,61 +106,61 @@ public class GuiEnchanting extends GuiContainer {
|
||||
}
|
||||
|
||||
public void asignEnchantButtons() {
|
||||
for(int i = 0; i < 16; i++) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
enchantButtons[i].enchant = null;
|
||||
enchantButtons[i].enabled = false;
|
||||
}
|
||||
|
||||
if(currentStack == null || currentStack.isItemEnchanted())
|
||||
if (currentStack == null || currentStack.isItemEnchanted())
|
||||
return;
|
||||
|
||||
int it = 0;
|
||||
|
||||
for(int enchant : EnchantmentManager.enchantmentData.keySet()) {
|
||||
if(currentStack.getItem().getItemEnchantability()!=0 && EnchantmentManager.canApply(currentStack, Enchantment.enchantmentsList[enchant], enchanter.enchantments) && EnchantmentManager.canEnchantmentBeUsed(ClientHelper.clientPlayer().getGameProfile().getName(), Enchantment.enchantmentsList[enchant])) {
|
||||
|
||||
for (int enchant : EnchantmentManager.enchantmentData.keySet()) {
|
||||
if (currentStack.getItem().getItemEnchantability() != 0 && EnchantmentManager.canApply(currentStack, Enchantment.enchantmentsList[enchant], enchanter.enchantments) && EnchantmentManager.canEnchantmentBeUsed(ClientHelper.clientPlayer().getGameProfile().getName(), Enchantment.enchantmentsList[enchant])) {
|
||||
enchantButtons[it].enchant = Enchantment.enchantmentsList[enchant];
|
||||
enchantButtons[it].enabled = true;
|
||||
it++;
|
||||
if(it >= 16)
|
||||
if (it >= 16)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id == 0) {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterStartWorking(enchanter));
|
||||
} else if(par1GuiButton.id <= 16) {
|
||||
if (par1GuiButton.id == 0) {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterStartWorking(enchanter));
|
||||
} else if (par1GuiButton.id <= 16) {
|
||||
GuiButtonEnchantment button = enchantButtons[par1GuiButton.id - 1];
|
||||
if(button != null && button.enchant != null)
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter,button.enchant.effectId,0));
|
||||
if (button != null && button.enchant != null)
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, button.enchant.effectId, 0));
|
||||
} else {
|
||||
int type = (par1GuiButton.id - 17) % 3;
|
||||
int index = (par1GuiButton.id - 17) / 3;
|
||||
|
||||
if(index >= enchanter.enchantments.size() || index >= enchanter.levels.size())
|
||||
if (index >= enchanter.enchantments.size() || index >= enchanter.levels.size())
|
||||
return;
|
||||
|
||||
int level = enchanter.levels.get(index);
|
||||
|
||||
Enchantment enchant = Enchantment.enchantmentsList[enchanter.enchantments.get(index)];
|
||||
|
||||
switch(type) {
|
||||
case 0 : {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter,enchant.effectId,-1));
|
||||
break;
|
||||
switch (type) {
|
||||
case 0: {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, -1));
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level == 1 ? -1 : level - 1));
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 1 : {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter,enchant.effectId,level == 1 ? -1 : level - 1));
|
||||
break;
|
||||
}
|
||||
case 2 : {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter,enchant.effectId,level + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildButtonList();
|
||||
@@ -170,7 +170,7 @@ public class GuiEnchanting extends GuiContainer {
|
||||
public void updateScreen() {
|
||||
currentStack = enchanter.getStackInSlot(0);
|
||||
buildButtonList();
|
||||
if(currentStack != lastTickStack || !lastTickEnchants.equals(enchanter.enchantments) || !lastTickLevels.equals(enchanter.levels))
|
||||
if (currentStack != lastTickStack || !lastTickEnchants.equals(enchanter.enchantments) || !lastTickLevels.equals(enchanter.levels))
|
||||
buildButtonList();
|
||||
|
||||
lastTickStack = currentStack;
|
||||
@@ -186,22 +186,21 @@ public class GuiEnchanting extends GuiContainer {
|
||||
|
||||
ItemStack itemToEnchant = enchanter.getStackInSlot(0);
|
||||
if (enchantButtons[8].enabled) {
|
||||
if(itemToEnchant != null && !itemToEnchant.isItemEnchanted())
|
||||
drawTexturedModalRect(x + 30, y + 26, 0, ySize, 147, 24);
|
||||
if (itemToEnchant != null && !itemToEnchant.isItemEnchanted())
|
||||
drawTexturedModalRect(x + 30, y + 26, 0, ySize, 147, 24);
|
||||
}
|
||||
|
||||
if(itemToEnchant != null && !itemToEnchant.isItemEnchanted())
|
||||
drawTexturedModalRect(x + 30, y + 50, 0, ySize, 147, 24);
|
||||
|
||||
|
||||
if(!enchanter.enchantments.isEmpty()) {
|
||||
if (itemToEnchant != null && !itemToEnchant.isItemEnchanted())
|
||||
drawTexturedModalRect(x + 30, y + 50, 0, ySize, 147, 24);
|
||||
|
||||
if (!enchanter.enchantments.isEmpty()) {
|
||||
int x = this.x + 40;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
int xo = 15;
|
||||
int z = 50;
|
||||
if (enchantButtons[8].enabled)
|
||||
z = 26;
|
||||
for(Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
|
||||
for (Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
|
||||
drawAspectBar(aspect, x + xo, y + z, i, j);
|
||||
xo += 15;
|
||||
}
|
||||
@@ -211,7 +210,7 @@ public class GuiEnchanting extends GuiContainer {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
if(!tooltip.isEmpty())
|
||||
if (!tooltip.isEmpty())
|
||||
ClientHelper.renderTooltip(par1 - x, par2 - y, tooltip);
|
||||
tooltip.clear();
|
||||
}
|
||||
@@ -222,7 +221,7 @@ public class GuiEnchanting extends GuiContainer {
|
||||
|
||||
int size = totalCost == 0 ? 11 : 59;
|
||||
|
||||
if(totalCost == 0) {
|
||||
if (totalCost == 0) {
|
||||
drawTexturedModalRect(x, y - size, 200, 0, 10, 4);
|
||||
drawTexturedModalRect(x, y - size + 4, 200, 52, 10, 10);
|
||||
} else {
|
||||
@@ -234,7 +233,7 @@ public class GuiEnchanting extends GuiContainer {
|
||||
drawTexturedModalRect(x, y - size, 200, 0, 10, size);
|
||||
}
|
||||
|
||||
if(mx > x && mx <= x + 10 && my > y - size && my <= y) {
|
||||
if (mx > x && mx <= x + 10 && my > y - size && my <= y) {
|
||||
List<String> tooltip = new ArrayList();
|
||||
tooltip.add('\u00a7' + aspect.getChatcolor() + aspect.getName());
|
||||
tooltip.add(current + "/" + totalCost);
|
||||
|
||||
@@ -64,19 +64,19 @@ public class GuiMobMagnet extends GuiContainer {
|
||||
|
||||
private void addButton(GuiButtonMM button) {
|
||||
buttonListMM.add(button);
|
||||
if(button instanceof IRadioButton)
|
||||
if (button instanceof IRadioButton)
|
||||
radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton instanceof IRadioButton)
|
||||
if (par1GuiButton instanceof IRadioButton)
|
||||
((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListMM.get(0).enabled = !buttonListMM.get(0).enabled;
|
||||
|
||||
mobMagnet.adult = buttonListMM.get(0).enabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketMobMagnetButton(mobMagnet));
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketMobMagnetButton(mobMagnet));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,16 +90,16 @@ public class GuiMobMagnet extends GuiContainer {
|
||||
|
||||
String filter;
|
||||
|
||||
if(stack != null) {
|
||||
if (stack != null) {
|
||||
String name = ItemSoulMould.getPatternName(stack);
|
||||
if(name.isEmpty())
|
||||
if (name.isEmpty())
|
||||
filter = StatCollector.translateToLocal("ttmisc.none");
|
||||
else filter = StatCollector.translateToLocal("entity." + name + ".name");
|
||||
} else filter = StatCollector.translateToLocal("ttmisc.all");
|
||||
|
||||
fontRendererObj.drawString(filter, x + xSize / 2 - fontRendererObj.getStringWidth(filter) / 2 - 26, y + 16, 0x999999);
|
||||
fontRendererObj.drawString(adult, x + 120, y + 30, 0x999999);
|
||||
fontRendererObj.drawString(child, x + 120, y + 50, 0x999999);
|
||||
fontRendererObj.drawString(filter, x + xSize / 2 - fontRendererObj.getStringWidth(filter) / 2 - 26, y + 16, 0x999999);
|
||||
fontRendererObj.drawString(adult, x + 120, y + 30, 0x999999);
|
||||
fontRendererObj.drawString(child, x + 120, y + 50, 0x999999);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
*/
|
||||
package vazkii.tinkerer.client.gui;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.net.URI;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.client.gui.GuiResearchRecipe;
|
||||
|
||||
import java.awt.*;
|
||||
import java.net.URI;
|
||||
|
||||
public class GuiResearchPeripheral extends GuiResearchRecipe {
|
||||
|
||||
public GuiResearchPeripheral(ResearchItem research) {
|
||||
@@ -29,7 +29,7 @@ public class GuiResearchPeripheral extends GuiResearchRecipe {
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
if(par2 == 28) {
|
||||
if (par2 == 28) {
|
||||
String url = StatCollector.translateToLocal("ttresearch.webpage.peripherals");
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(url));
|
||||
|
||||
@@ -32,7 +32,7 @@ public class GuiButtonAT extends GuiButton {
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if(enabled) {
|
||||
if (enabled) {
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
int y = buttonEnabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
|
||||
@@ -28,14 +28,14 @@ public class GuiButtonATRadio extends GuiButtonAT implements IRadioButton {
|
||||
@Override
|
||||
public void enableFromClick() {
|
||||
setEnabled(true);
|
||||
for(IRadioButton button : linkedButtons)
|
||||
if(button != this)
|
||||
for (IRadioButton button : linkedButtons)
|
||||
if (button != this)
|
||||
button.updateStatus(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(IRadioButton otherButton) {
|
||||
if(otherButton.isEnabled())
|
||||
if (otherButton.isEnabled())
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
*/
|
||||
package vazkii.tinkerer.client.gui.button;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@@ -27,6 +24,9 @@ import vazkii.tinkerer.client.gui.GuiEnchanting;
|
||||
import vazkii.tinkerer.client.lib.LibResources;
|
||||
import vazkii.tinkerer.common.block.tile.TileEnchanter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiButtonEnchant extends GuiButton {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ENCHANTER);
|
||||
@@ -41,7 +41,7 @@ public class GuiButtonEnchant extends GuiButton {
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if(!enabled)
|
||||
if (!enabled)
|
||||
return;
|
||||
|
||||
final int x = 176;
|
||||
@@ -50,7 +50,7 @@ public class GuiButtonEnchant extends GuiButton {
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(xPosition, yPosition, x, y, 15, 15);
|
||||
|
||||
if(par2 >= xPosition && par2 < xPosition + 15 && par3 >= yPosition && par3 < yPosition + 15 && !enchanter.working) {
|
||||
if (par2 >= xPosition && par2 < xPosition + 15 && par3 >= yPosition && par3 < yPosition + 15 && !enchanter.working) {
|
||||
List<String> tooltip = new ArrayList();
|
||||
tooltip.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("ttmisc.startEnchant"));
|
||||
parent.tooltip = tooltip;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class GuiButtonEnchanterLevel extends GuiButton {
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if(!enabled)
|
||||
if (!enabled)
|
||||
return;
|
||||
|
||||
int x = 218 + (plus ? 7 : 0);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class GuiButtonEnchantment extends GuiButton {
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if(dontRender())
|
||||
if (dontRender())
|
||||
return;
|
||||
|
||||
EnchantmentData data = EnchantmentManager.enchantmentData.get(enchant.effectId).get(1);
|
||||
@@ -55,29 +55,28 @@ public class GuiButtonEnchantment extends GuiButton {
|
||||
drawTexturedModalRect16(xPosition, yPosition, 0, 0, 16, 16);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
if(par2 >= xPosition && par2 < xPosition + 16 && par3 >= yPosition && par3 < yPosition + 16) {
|
||||
if (par2 >= xPosition && par2 < xPosition + 16 && par3 >= yPosition && par3 < yPosition + 16) {
|
||||
List<String> tooltip = new ArrayList();
|
||||
tooltip.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal(enchant.getName()));
|
||||
for(Aspect aspect : data.aspects.getAspectsSorted())
|
||||
for (Aspect aspect : data.aspects.getAspectsSorted())
|
||||
tooltip.add(" \u00a7" + aspect.getChatcolor() + aspect.getName() + '\u00a7' + "r x " + data.aspects.getAmount(aspect) + " " + StatCollector.translateToLocal("ttmisc.baseCost"));
|
||||
if(this instanceof GuiButtonFramedEnchantment && !parent.enchanter.working)
|
||||
if (this instanceof GuiButtonFramedEnchantment && !parent.enchanter.working)
|
||||
tooltip.add(EnumChatFormatting.GRAY + "" + EnumChatFormatting.ITALIC + " " + StatCollector.translateToLocal("ttmisc.clickToRemove"));
|
||||
|
||||
parent.tooltip = tooltip;
|
||||
}
|
||||
}
|
||||
|
||||
public void drawTexturedModalRect16(int par1, int par2, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
float f = 1F / 16F;
|
||||
float f1 = 1F / 16F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(par1, par2 + par6, zLevel, (par3) * f, (par4 + par6) * f1);
|
||||
tessellator.addVertexWithUV(par1 + par5, par2 + par6, zLevel, (par3 + par5) * f, (par4 + par6) * f1);
|
||||
tessellator.addVertexWithUV(par1 + par5, par2, zLevel, (par3 + par5) * f, (par4) * f1);
|
||||
tessellator.addVertexWithUV(par1, par2, zLevel, (par3) * f, (par4) * f1);
|
||||
tessellator.draw();
|
||||
}
|
||||
public void drawTexturedModalRect16(int par1, int par2, int par3, int par4, int par5, int par6) {
|
||||
float f = 1F / 16F;
|
||||
float f1 = 1F / 16F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(par1, par2 + par6, zLevel, (par3) * f, (par4 + par6) * f1);
|
||||
tessellator.addVertexWithUV(par1 + par5, par2 + par6, zLevel, (par3 + par5) * f, (par4 + par6) * f1);
|
||||
tessellator.addVertexWithUV(par1 + par5, par2, zLevel, (par3 + par5) * f, (par4) * f1);
|
||||
tessellator.addVertexWithUV(par1, par2, zLevel, (par3) * f, (par4) * f1);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,14 +31,14 @@ public class GuiButtonFramedEnchantment extends GuiButtonEnchantment {
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if(dontRender() || parent.enchanter.enchantments.isEmpty() || parent.enchanter.levels.isEmpty())
|
||||
if (dontRender() || parent.enchanter.enchantments.isEmpty() || parent.enchanter.levels.isEmpty())
|
||||
return;
|
||||
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(xPosition - 4, yPosition - 4, 176, 0, 24, 24);
|
||||
|
||||
int index = parent.enchanter.enchantments.indexOf(enchant.effectId);
|
||||
if(index != -1) {
|
||||
if (index != -1) {
|
||||
int level = parent.enchanter.levels.get(index);
|
||||
par1Minecraft.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("enchantment.level." + level), xPosition + 26, yPosition + 8, 0xFFFFFF);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class GuiButtonMM extends GuiButton {
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if(enabled) {
|
||||
if (enabled) {
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
int y = enabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
|
||||
@@ -28,14 +28,14 @@ public class GuiButtonMMRadio extends GuiButtonMM implements IRadioButton {
|
||||
@Override
|
||||
public void enableFromClick() {
|
||||
setEnabled(true);
|
||||
for(IRadioButton button : linkedButtons)
|
||||
if(button != this)
|
||||
for (IRadioButton button : linkedButtons)
|
||||
if (button != this)
|
||||
button.updateStatus(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(IRadioButton otherButton) {
|
||||
if(otherButton.isEnabled())
|
||||
if (otherButton.isEnabled())
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class GuiButtonWG extends GuiButton {
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if(enabled) {
|
||||
if (enabled) {
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
int y = !enabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
|
||||
@@ -20,7 +20,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.tinkerer.client.lib.LibResources;
|
||||
|
||||
public class GuiIchorPouch extends GuiContainer{
|
||||
public class GuiIchorPouch extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ICHOR_POUCH);
|
||||
|
||||
@@ -32,8 +32,8 @@ public class GuiIchorPouch extends GuiContainer{
|
||||
|
||||
//Overridden to prevent a dupe
|
||||
//See issue 367
|
||||
protected boolean checkHotbarKeys(int slot){
|
||||
if (this.mc.gameSettings.keyBindsHotbar[this.mc.thePlayer.inventory.currentItem].getKeyCode()!=slot){
|
||||
protected boolean checkHotbarKeys(int slot) {
|
||||
if (this.mc.gameSettings.keyBindsHotbar[this.mc.thePlayer.inventory.currentItem].getKeyCode() != slot) {
|
||||
super.checkHotbarKeys(slot);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class GuiWarpGate extends GuiContainer {
|
||||
((GuiButtonWG) par1GuiButton).enabled = !((GuiButtonWG) par1GuiButton).enabled;
|
||||
warpGate.locked = ((GuiButtonWG) par1GuiButton).enabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketWarpGateButton(warpGate));
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketWarpGateButton(warpGate));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,9 +60,9 @@ public class GuiWarpGate extends GuiContainer {
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("ttmisc.lockedGate"), x + 20, y + 7, 0x999999);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("ttmisc.lockedGate"), x + 20, y + 7, 0x999999);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public class GuiWarpGateDestinations extends GuiScreen {
|
||||
int mx = Mouse.getX() * i / mc.displayWidth;
|
||||
int my = j - Mouse.getY() * j / mc.displayHeight - 1;
|
||||
|
||||
if(Mouse.isButtonDown(0)) {
|
||||
if (Mouse.isButtonDown(0)) {
|
||||
int deltaX = mx - lastMouseX;
|
||||
int deltaY = my - lastMouseY;
|
||||
x -= deltaX;
|
||||
@@ -84,15 +84,15 @@ public class GuiWarpGateDestinations extends GuiScreen {
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
super.keyTyped(par1, par2);
|
||||
|
||||
if(par2 == 57) { // space
|
||||
if (par2 == 57) { // space
|
||||
x = warpGate.xCoord - width / 2;
|
||||
y = warpGate.zCoord - height / 2;
|
||||
return;
|
||||
}
|
||||
if(par2 >= 2 && par2 < 12) {
|
||||
if (par2 >= 2 && par2 < 12) {
|
||||
int num = par2 - 2;
|
||||
ItemStack stack = warpGate.getStackInSlot(num);
|
||||
if(stack != null && ItemSkyPearl.isAttuned(stack) && ItemSkyPearl.getDim(stack) == warpGate.getWorldObj().provider.dimensionId) {
|
||||
if (stack != null && ItemSkyPearl.isAttuned(stack) && ItemSkyPearl.getDim(stack) == warpGate.getWorldObj().provider.dimensionId) {
|
||||
int x = ItemSkyPearl.getX(stack);
|
||||
int z = ItemSkyPearl.getZ(stack);
|
||||
|
||||
@@ -117,19 +117,19 @@ public class GuiWarpGateDestinations extends GuiScreen {
|
||||
|
||||
List<Object[]> coords = new ArrayList();
|
||||
|
||||
for(int i = 0; i < warpGate.getSizeInventory(); i++) {
|
||||
for (int i = 0; i < warpGate.getSizeInventory(); i++) {
|
||||
ItemStack stack = warpGate.getStackInSlot(i);
|
||||
if(stack != null && ItemSkyPearl.isAttuned(stack)) {
|
||||
if (stack != null && ItemSkyPearl.isAttuned(stack)) {
|
||||
int dim = ItemSkyPearl.getDim(stack);
|
||||
if(warpGate.getWorldObj().provider.dimensionId != dim)
|
||||
if (warpGate.getWorldObj().provider.dimensionId != dim)
|
||||
continue;
|
||||
|
||||
int x = ItemSkyPearl.getX(stack);
|
||||
int y = ItemSkyPearl.getY(stack);
|
||||
int z = ItemSkyPearl.getZ(stack);
|
||||
|
||||
if(y != -1)
|
||||
coords.add(new Object[] { x - this.x, z - this.y, stack, i});
|
||||
if (y != -1)
|
||||
coords.add(new Object[]{ x - this.x, z - this.y, stack, i });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class GuiWarpGateDestinations extends GuiScreen {
|
||||
GL11.glColor4f(1F, 1F, 1F, (float) ((Math.sin(ticks / 10D) + 1F) / 4F + 0.25F));
|
||||
GL11.glLineWidth(2F);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
for(Object[] coords_ : coords) {
|
||||
for (Object[] coords_ : coords) {
|
||||
int x = (Integer) coords_[0];
|
||||
int y = (Integer) coords_[1];
|
||||
|
||||
@@ -153,12 +153,12 @@ public class GuiWarpGateDestinations extends GuiScreen {
|
||||
fontRendererObj.drawStringWithShadow(EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal("ttmisc.destinations"), 3, 40, 0xFFFFFF);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawPearlAt(0, null, gateX, gateY, par1, par2);
|
||||
for(Object[] coords_ : coords)
|
||||
for (Object[] coords_ : coords)
|
||||
drawPearlAt((Integer) coords_[3], (ItemStack) coords_[2], (Integer) coords_[0], (Integer) coords_[1], par1, par2);
|
||||
|
||||
if(!tooltip.isEmpty())
|
||||
if (!tooltip.isEmpty())
|
||||
ClientHelper.renderTooltip(par1, par2, tooltip);
|
||||
|
||||
|
||||
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("ttmisc.numberKeys"), width / 2, 5, 0xFFFFFF);
|
||||
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("ttmisc.spaceToReset"), width / 2, 16, 0xFFFFFF);
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public class GuiWarpGateDestinations extends GuiScreen {
|
||||
public void drawPearlAt(int index, ItemStack stack, int xp, int yp, int mx, int my) {
|
||||
int x = xp + this.x;
|
||||
int y = yp + this.y;
|
||||
|
||||
|
||||
String destName;
|
||||
|
||||
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
@@ -175,28 +175,28 @@ public class GuiWarpGateDestinations extends GuiScreen {
|
||||
GL11.glScalef(0.5F, 0.5F, 1F);
|
||||
render.renderIcon(-8, -8, ModItems.skyPearl.getIconFromDamage(0), 16, 16);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
String destNum = " " + EnumChatFormatting.ITALIC + String.format(StatCollector.translateToLocal("ttmisc.destinationInd"), index + 1);
|
||||
if(stack != null && stack.hasDisplayName())
|
||||
if (stack != null && stack.hasDisplayName())
|
||||
destName = stack.getDisplayName();
|
||||
else destName = StatCollector.translateToLocal(stack == null ? "ttmisc.entrancePoint" : "ttmisc.destination");
|
||||
|
||||
if(stack != null)
|
||||
|
||||
if (stack != null)
|
||||
fontRendererObj.drawString((index + 1) + ": " + destName, 5, 54 + index * 11, 0xFFFFFF);
|
||||
|
||||
if(mx >= xp - 4 && mx <= xp + 4 && my >= yp - 4 && my < yp + 4) {
|
||||
if (mx >= xp - 4 && mx <= xp + 4 && my >= yp - 4 && my < yp + 4) {
|
||||
tooltip.add(EnumChatFormatting.AQUA + destName + destNum);
|
||||
|
||||
if(stack != null) {
|
||||
|
||||
if (stack != null) {
|
||||
ItemSkyPearl.addInfo(stack, warpGate.getWorldObj().provider.dimensionId, Vector3.fromTileEntity(warpGate), tooltip, true);
|
||||
tooltip.add(StatCollector.translateToLocal("ttmisc.clickToTeleport"));
|
||||
tooltip.add(StatCollector.translateToLocal("ttmisc.clickToTeleport"));
|
||||
} else {
|
||||
tooltip.add("X: " + x);
|
||||
tooltip.add("Z: " + y);
|
||||
}
|
||||
|
||||
if(Mouse.isButtonDown(0) && isShiftKeyDown() && stack != null) {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketWarpGateTeleport(warpGate,index));
|
||||
if (Mouse.isButtonDown(0) && isShiftKeyDown() && stack != null) {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketWarpGateTeleport(warpGate, index));
|
||||
mc.displayGuiScreen(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ public final class LibResources {
|
||||
public static final String MISC_REPAIR = PREFIX_MISC + "repair.png";
|
||||
public static final String MISC_REPAIR_OFF = PREFIX_MISC + "repairOff.png";
|
||||
|
||||
|
||||
public static final String MODEL_RELAY_TEXTURE = PREFIX_MODEL + "relay.png";
|
||||
public static final String MODEL_MAGNET_N = PREFIX_MODEL + "magnetN.png";
|
||||
public static final String MODEL_MAGNET_S = PREFIX_MODEL + "magnetS.png";
|
||||
@@ -96,16 +95,16 @@ public final class LibResources {
|
||||
public static final String ENCHANT_QUICK_DRAW = PREFIX_ENCHANTS + "quickDraw.png";
|
||||
|
||||
public static final String[] LANGS = {
|
||||
"en_US", "de_DE", "zh_CN", "ru_RU", "ko_KR"
|
||||
"en_US", "de_DE", "zh_CN", "ru_RU", "ko_KR"
|
||||
};
|
||||
|
||||
public static final String ENCHANT_FOCUSED_STRIKE = PREFIX_ENCHANTS + "focusedStrikes.png";
|
||||
public static final String ENCHANT_DISPERSED_STRIKE = PREFIX_ENCHANTS + "dispersedStrikes.png";
|
||||
public static final String ENCHANT_VALIANCE = PREFIX_ENCHANTS + "valiance.png";
|
||||
public static final String ENCHANT_FINAL_STRIKE = PREFIX_ENCHANTS + "finalStrike.png";
|
||||
public static final String ENCHANT_TUNNEL=PREFIX_ENCHANTS + "tunnel.png";
|
||||
public static final String ENCHANT_TUNNEL = PREFIX_ENCHANTS + "tunnel.png";
|
||||
|
||||
public static final String ENCHANT_SHATTER=PREFIX_ENCHANTS + "shatter.png";
|
||||
public static final String ENCHANT_SHOCKWAVE=PREFIX_ENCHANTS + "shockwave.png";
|
||||
public static final String ENCHANT_POUNCE=PREFIX_ENCHANTS + "pounce.png";
|
||||
public static final String ENCHANT_SHATTER = PREFIX_ENCHANTS + "shatter.png";
|
||||
public static final String ENCHANT_SHOCKWAVE = PREFIX_ENCHANTS + "shockwave.png";
|
||||
public static final String ENCHANT_POUNCE = PREFIX_ENCHANTS + "pounce.png";
|
||||
}
|
||||
@@ -17,9 +17,7 @@ package vazkii.tinkerer.client.model.kami;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.tinkerer.client.core.helper.ClientHelper;
|
||||
|
||||
public class ModelSpinningCubes extends ModelBase {
|
||||
@@ -51,13 +49,13 @@ public class ModelSpinningCubes extends ModelBase {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.025F, 0.85F, -0.025F);
|
||||
for(int i = 0; i < cubes; i++) {
|
||||
for (int i = 0; i < cubes; i++) {
|
||||
float offset = offsetPerCube * i;
|
||||
float deg = (int) (ticks / rotationModifier % 360F + offset);
|
||||
float rad = deg * (float) Math.PI / 180F;
|
||||
float radiusX = (float) (radiusBase + radiusMod * Math.sin(ticks / modifier));
|
||||
float radiusZ = (float) (radiusBase + radiusMod * Math.cos(ticks / modifier));
|
||||
float x = (float) (radiusX * Math.cos(rad));
|
||||
float x = (float) (radiusX * Math.cos(rad));
|
||||
float z = (float) (radiusZ * Math.sin(rad));
|
||||
float y = (float) Math.cos((ticks + 50 * i) / 5F) / 10F;
|
||||
|
||||
@@ -68,20 +66,20 @@ public class ModelSpinningCubes extends ModelBase {
|
||||
float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F;
|
||||
|
||||
GL11.glRotatef(deg, xRotate, yRotate, zRotate);
|
||||
if(repeat < origRepeat) {
|
||||
if (repeat < origRepeat) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.2F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
} else GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
int light = 15728880;
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
|
||||
spinningCube.render(1F / 16F);
|
||||
|
||||
if(repeat < origRepeat)
|
||||
if (repeat < origRepeat)
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
@@ -90,7 +88,7 @@ public class ModelSpinningCubes extends ModelBase {
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
if(repeat != 0)
|
||||
if (repeat != 0)
|
||||
renderSpinningCubes(cubes, repeat - 1, origRepeat);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,52 +38,52 @@ public class ModelWings extends ModelBiped {
|
||||
setRotation(Wing1, 0F, -0.6108652F, 0F);
|
||||
bipedBody.addChild(Wing1);
|
||||
|
||||
Wing2 = new ModelRenderer(this, 16, -12);
|
||||
Wing2 = new ModelRenderer(this, 16, -12);
|
||||
Wing2.addBox(0.1F, 0F, 0F, 0, 7, 12);
|
||||
Wing2.setRotationPoint(2F, 1F, 2F);
|
||||
setRotation(Wing2, 0F, 0.4468043F, 0F);
|
||||
bipedBody.addChild(Wing2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float v1, float v2, float v3, float v4, float v5, float v6) {
|
||||
setRotationAngles(v1, v2, v3, v4, v5, v6, entity);
|
||||
@Override
|
||||
public void render(Entity entity, float v1, float v2, float v3, float v4, float v5, float v6) {
|
||||
setRotationAngles(v1, v2, v3, v4, v5, v6, entity);
|
||||
|
||||
bipedHead.showModel = false;
|
||||
bipedHeadwear.showModel = false;
|
||||
bipedLeftLeg.showModel = false;
|
||||
bipedRightLeg.showModel = false;
|
||||
bipedHead.showModel = false;
|
||||
bipedHeadwear.showModel = false;
|
||||
bipedLeftLeg.showModel = false;
|
||||
bipedRightLeg.showModel = false;
|
||||
|
||||
super.render(entity, v1, v2, v3, v4, v5, v6);
|
||||
}
|
||||
super.render(entity, v1, v2, v3, v4, v5, v6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float v1, float v2, float v3, float v4, float v5, float v6, Entity entity) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
isSneak = living != null && living.isSneaking();
|
||||
if(living != null && living instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
@Override
|
||||
public void setRotationAngles(float v1, float v2, float v3, float v4, float v5, float v6, Entity entity) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
isSneak = living != null && living.isSneaking();
|
||||
if (living != null && living instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
|
||||
ItemStack itemstack = player.inventory.getCurrentItem();
|
||||
heldItemRight = itemstack != null ? 1 : 0;
|
||||
ItemStack itemstack = player.inventory.getCurrentItem();
|
||||
heldItemRight = itemstack != null ? 1 : 0;
|
||||
|
||||
if (itemstack != null && player.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = itemstack.getItemUseAction();
|
||||
if (itemstack != null && player.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = itemstack.getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.block)
|
||||
heldItemRight = 3;
|
||||
else if (enumaction == EnumAction.bow)
|
||||
aimedBow = true;
|
||||
}
|
||||
if (enumaction == EnumAction.block)
|
||||
heldItemRight = 3;
|
||||
else if (enumaction == EnumAction.bow)
|
||||
aimedBow = true;
|
||||
}
|
||||
|
||||
if(player.capabilities.isFlying) {
|
||||
Wing1.rotateAngleY = (float) ((Math.sin(entity.ticksExisted) + 1) * (Math.PI / 180F) * 15 - 0.6108652F);
|
||||
Wing2.rotateAngleY = -Wing1.rotateAngleY;
|
||||
}
|
||||
}
|
||||
if (player.capabilities.isFlying) {
|
||||
Wing1.rotateAngleY = (float) ((Math.sin(entity.ticksExisted) + 1) * (Math.PI / 180F) * 15 - 0.6108652F);
|
||||
Wing2.rotateAngleY = -Wing1.rotateAngleY;
|
||||
}
|
||||
}
|
||||
|
||||
super.setRotationAngles(v1, v2, v3, v4, v5, v6, entity);
|
||||
}
|
||||
super.setRotationAngles(v1, v2, v3, v4, v5, v6, entity);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
|
||||
@@ -14,17 +14,15 @@
|
||||
*/
|
||||
package vazkii.tinkerer.client.render.block;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.tinkerer.client.lib.LibRenderIDs;
|
||||
import vazkii.tinkerer.client.render.tile.RenderTileMagnet;
|
||||
import vazkii.tinkerer.common.block.tile.TileMagnet;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
public class RenderMagnet implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@@ -34,7 +32,7 @@ public class RenderMagnet implements ISimpleBlockRenderingHandler {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileMagnet(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileMagnet(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -43,10 +41,10 @@ public class RenderMagnet implements ISimpleBlockRenderingHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
|
||||
@@ -38,10 +38,10 @@ public class RenderRepairer implements ISimpleBlockRenderingHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
|
||||
@@ -64,10 +64,10 @@ public class RenderWarpGate extends BlockRenderer implements ISimpleBlockRenderi
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
|
||||
@@ -27,17 +27,15 @@ public class RenderMobAspect implements IItemRenderer {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
|
||||
if(ItemMobAspect.isCondensed(item)){
|
||||
if (ItemMobAspect.isCondensed(item)) {
|
||||
GL11.glColor3f(.5F, .5F, .5F);
|
||||
}
|
||||
if(ItemMobAspect.isInfused(item)){
|
||||
if (ItemMobAspect.isInfused(item)) {
|
||||
GL11.glColor3f(.7F, 0F, .7F);
|
||||
}
|
||||
|
||||
|
||||
switch(type) {
|
||||
case ENTITY : {
|
||||
switch (type) {
|
||||
case ENTITY: {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, 0F, 0F);
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
@@ -46,15 +44,15 @@ public class RenderMobAspect implements IItemRenderer {
|
||||
}
|
||||
case INVENTORY: {
|
||||
|
||||
IIcon icon = ItemMobAspect.aspectIcons[item.getItemDamage()%ItemMobAspect.aspectCount];
|
||||
IIcon icon = ItemMobAspect.aspectIcons[item.getItemDamage() % ItemMobAspect.aspectCount];
|
||||
renderItem.renderIcon(0, 0, icon, 16, 16);
|
||||
}
|
||||
case EQUIPPED : {
|
||||
case EQUIPPED: {
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
IIcon icon = ItemMobAspect.aspectIcons[item.getItemDamage()%ItemMobAspect.aspectCount];
|
||||
IIcon icon = ItemMobAspect.aspectIcons[item.getItemDamage() % ItemMobAspect.aspectCount];
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
@@ -64,11 +62,12 @@ public class RenderMobAspect implements IItemRenderer {
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
break;
|
||||
}
|
||||
case EQUIPPED_FIRST_PERSON : {
|
||||
case EQUIPPED_FIRST_PERSON: {
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
break;
|
||||
}
|
||||
default : break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -14,83 +14,85 @@ import vazkii.tinkerer.common.item.ItemMobDisplay;
|
||||
|
||||
public class RenderMobDisplay implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType itemRenderType, ItemStack itemStack, ItemRendererHelper itemRendererHelper) {
|
||||
return true;
|
||||
}
|
||||
private static RenderItem renderItem = new RenderItem();
|
||||
@Override
|
||||
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... objects) {
|
||||
ItemMobDisplay item= (ItemMobDisplay) itemStack.getItem();
|
||||
EnumMobAspect aspect=item.getEntityType(itemStack);
|
||||
Entity entity=null;
|
||||
float f1=0.4f;
|
||||
float verticalOffset=0.0f;
|
||||
if(aspect!=null) {
|
||||
entity = EnumMobAspect.getEntityFromCache(aspect, null);
|
||||
f1 = aspect.getScale();
|
||||
verticalOffset=aspect.getVerticalOffset();
|
||||
}
|
||||
switch(itemRenderType) {
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType itemRenderType, ItemStack itemStack, ItemRendererHelper itemRendererHelper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
case ENTITY:
|
||||
private static RenderItem renderItem = new RenderItem();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
EntityItem eItem= (EntityItem) objects[1];
|
||||
if(entity!=null) {
|
||||
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
|
||||
if (entity.worldObj != null) {
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
entity.setWorld(eItem.worldObj);
|
||||
entity.copyLocationAndAnglesFrom(eItem);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
//if (renderWithLighting) RenderUtils.enableLightmap();
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
@Override
|
||||
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... objects) {
|
||||
ItemMobDisplay item = (ItemMobDisplay) itemStack.getItem();
|
||||
EnumMobAspect aspect = item.getEntityType(itemStack);
|
||||
Entity entity = null;
|
||||
float f1 = 0.4f;
|
||||
float verticalOffset = 0.0f;
|
||||
if (aspect != null) {
|
||||
entity = EnumMobAspect.getEntityFromCache(aspect, null);
|
||||
f1 = aspect.getScale();
|
||||
verticalOffset = aspect.getVerticalOffset();
|
||||
}
|
||||
switch (itemRenderType) {
|
||||
|
||||
}
|
||||
entity.worldObj = null;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
case EQUIPPED:
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
if(entity!=null) {
|
||||
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
|
||||
if (entity.worldObj != null) {
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
//if (renderWithLighting) RenderUtils.enableLightmap();
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
case ENTITY:
|
||||
|
||||
}
|
||||
entity.worldObj = null;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
EntityItem eItem = (EntityItem) objects[1];
|
||||
if (entity != null) {
|
||||
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
|
||||
if (entity.worldObj != null) {
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
entity.setWorld(eItem.worldObj);
|
||||
entity.copyLocationAndAnglesFrom(eItem);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
//if (renderWithLighting) RenderUtils.enableLightmap();
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
case FIRST_PERSON_MAP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
entity.worldObj = null;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
case EQUIPPED:
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
if (entity != null) {
|
||||
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
|
||||
if (entity.worldObj != null) {
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
//if (renderWithLighting) RenderUtils.enableLightmap();
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
}
|
||||
entity.worldObj = null;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
case FIRST_PERSON_MAP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,13 @@ import vazkii.tinkerer.common.item.ModItems;
|
||||
public class RenderPlacementMirror implements IItemRenderer {
|
||||
|
||||
RenderItem render = new RenderItem();
|
||||
ItemRenderer renderer = new ItemRenderer(Minecraft.getMinecraft());
|
||||
ItemRenderer renderer = new ItemRenderer(Minecraft.getMinecraft());
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
//return type != ItemRenderType.INVENTORY && type!=ItemRenderType.ENTITY;
|
||||
//return type != ItemRenderType.INVENTORY ;
|
||||
return true;
|
||||
//return type != ItemRenderType.INVENTORY ;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -29,50 +29,49 @@ public class RenderPlacementMirror implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch(type) {
|
||||
case ENTITY : {
|
||||
switch (type) {
|
||||
case ENTITY: {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, 0F, 0F);
|
||||
renderItem(ItemRenderType.EQUIPPED,item,data);
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
GL11.glPopMatrix();
|
||||
break;
|
||||
}
|
||||
case EQUIPPED : {
|
||||
for(int i = 1; i >= 0; i--) {
|
||||
case EQUIPPED: {
|
||||
for (int i = 1; i >= 0; i--) {
|
||||
IIcon icon = ModItems.placementMirror.getIconFromDamageForRenderPass(0, i);
|
||||
if(i == 0) {
|
||||
if (i == 0) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
break;
|
||||
}
|
||||
case EQUIPPED_FIRST_PERSON : {
|
||||
case EQUIPPED_FIRST_PERSON: {
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
break;
|
||||
}
|
||||
case INVENTORY:
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(45f,0f,1f,0f);
|
||||
GL11.glScalef(1.5f,1.8f,1.8f);
|
||||
GL11.glRotatef(-45f,0f,0f,1f);
|
||||
GL11.glTranslatef(-0.46F, -0.58F, 0F);
|
||||
case INVENTORY: {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(45f, 0f, 1f, 0f);
|
||||
GL11.glScalef(1.5f, 1.8f, 1.8f);
|
||||
GL11.glRotatef(-45f, 0f, 0f, 1f);
|
||||
GL11.glTranslatef(-0.46F, -0.58F, 0F);
|
||||
|
||||
|
||||
renderItem(ItemRenderType.EQUIPPED,item,data);
|
||||
GL11.glPopMatrix();
|
||||
break;
|
||||
}
|
||||
default : break;
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
GL11.glPopMatrix();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,11 +36,11 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
private static final ResourceLocation overlayRight = new ResourceLocation(LibResources.MISC_AT_RIGHT);
|
||||
private static final ResourceLocation overlayIndent = new ResourceLocation(LibResources.MISC_AT_INDENT);
|
||||
|
||||
private static final float[][] TRANSLATIONS = new float[][] {
|
||||
{ 0F, 0F, -1F },
|
||||
{ -1F, 0F, 0F },
|
||||
{ 0F, 0F, 0F },
|
||||
{ -1F, 0F, -1F }
|
||||
private static final float[][] TRANSLATIONS = new float[][]{
|
||||
{ 0F, 0F, -1F },
|
||||
{ -1F, 0F, 0F },
|
||||
{ 0F, 0F, 0F },
|
||||
{ -1F, 0F, -1F }
|
||||
};
|
||||
|
||||
@Override
|
||||
@@ -48,7 +48,7 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
TileAnimationTablet tile = (TileAnimationTablet) tileentity;
|
||||
|
||||
int meta = tile.getBlockMetadata() & 7;
|
||||
if(meta < 2)
|
||||
if (meta < 2)
|
||||
meta = 2; // Just in case
|
||||
|
||||
int rotation = meta == 2 ? 270 : meta == 3 ? 90 : meta == 4 ? 0 : 180;
|
||||
@@ -56,7 +56,7 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
renderOverlay(tile, overlayCenter, -1, false, false, 0.65, 0.13F, 0F);
|
||||
if(tile.leftClick)
|
||||
if (tile.leftClick)
|
||||
renderOverlay(tile, overlayLeft, 1, false, true, 1, 0.13F, 0F);
|
||||
else renderOverlay(tile, overlayRight, 1, false, true, 1, 0.131F, 0F);
|
||||
renderOverlay(tile, overlayIndent, 0, false, false, 0.5F, 0.13F, rotation + 90F);
|
||||
@@ -77,21 +77,21 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
|
||||
private void renderItem(TileAnimationTablet tablet) {
|
||||
ItemStack stack = tablet.getStackInSlot(0);
|
||||
if(stack != null) {
|
||||
EntityItem entityitem = new EntityItem(tablet.getWorldObj(), 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.hoverStart = 0.0F;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, 0.55F, 0F);
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
GL11.glScalef(2.5F, 2.5F, 2.5F);
|
||||
else
|
||||
GL11.glScalef(1.5F, 1.5F, 1.5F);
|
||||
RenderItem.renderInFrame = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
|
||||
RenderItem.renderInFrame = false;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (stack != null) {
|
||||
EntityItem entityitem = new EntityItem(tablet.getWorldObj(), 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.hoverStart = 0.0F;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, 0.55F, 0F);
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
GL11.glScalef(2.5F, 2.5F, 2.5F);
|
||||
else
|
||||
GL11.glScalef(1.5F, 1.5F, 1.5F);
|
||||
RenderItem.renderInFrame = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
|
||||
RenderItem.renderInFrame = false;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private void renderOverlay(TileAnimationTablet tablet, ResourceLocation texture, int rotationMod, boolean useLighting, boolean useBlend, double size, float height, float forceDeg) {
|
||||
@@ -99,9 +99,9 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
if(!useLighting)
|
||||
if (!useLighting)
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
if(useBlend) {
|
||||
if (useBlend) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
tess.addVertexWithUV(size2, 0, size2, 0, 0);
|
||||
tess.draw();
|
||||
GL11.glDepthMask(true);
|
||||
if(!useLighting)
|
||||
if (!useLighting)
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslated(d0, d1 + 0.75, d2);
|
||||
|
||||
ItemStack item = enchanter.getStackInSlot(0);
|
||||
if(item != null) {
|
||||
if (item != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
final float scale = 0.7F;
|
||||
@@ -53,24 +53,24 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
|
||||
|
||||
int renderPass = 0;
|
||||
do {
|
||||
IIcon icon = item.getItem().getIcon(item, renderPass);
|
||||
if(icon != null) {
|
||||
Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
renderPass++;
|
||||
} while(renderPass < item.getItem().getRenderPasses(item.getItemDamage()));
|
||||
IIcon icon = item.getItem().getIcon(item, renderPass);
|
||||
if (icon != null) {
|
||||
Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
renderPass++;
|
||||
} while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
item = enchanter.getStackInSlot(1);
|
||||
if(item != null) {
|
||||
if (item != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
final float scale = 0.5F;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class RenderTileFunnel extends TileEntitySpecialRenderer {
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
TileFunnel funnel = (TileFunnel) tileentity;
|
||||
ItemStack stack = funnel.getStackInSlot(0);
|
||||
if(stack != null) {
|
||||
if (stack != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0 + 0.5, d1 + 0.365, d2 + 0.5);
|
||||
//if(Block.getBlockFromItem(stack.getItem())== ConfigBlocks.blockJar) {
|
||||
|
||||
@@ -40,39 +40,39 @@ public class RenderTileMagnet extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float)x, (float)y , (float)z);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
boolean blue = tileentity.getWorldObj() == null || (tileentity.getBlockMetadata() & 1) == 0;
|
||||
boolean mob = tileentity.getWorldObj() == null ? RenderTileMagnet.mob : (tileentity.getBlockMetadata() & 2) == 2;
|
||||
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(mob ? blue ? blueMob : redMob : blue ? RenderTileMagnet.blue : red);
|
||||
|
||||
int redstone = 0;
|
||||
if(tileentity.getWorldObj() != null) {
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, tileentity.getWorldObj().getIndirectPowerLevelTo(tileentity.xCoord + dir.offsetX, tileentity.yCoord + dir.offsetY, tileentity.zCoord + dir.offsetZ, dir.ordinal()));
|
||||
} else redstone = 15;
|
||||
int redstone = 0;
|
||||
if (tileentity.getWorldObj() != null) {
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, tileentity.getWorldObj().getIndirectPowerLevelTo(tileentity.xCoord + dir.offsetX, tileentity.yCoord + dir.offsetY, tileentity.zCoord + dir.offsetZ, dir.ordinal()));
|
||||
} else redstone = 15;
|
||||
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
model.render();
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
model.render();
|
||||
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, -0.6F);
|
||||
IIcon icon = ((ItemHoverHarness) ConfigItems.itemHoverHarness).iconLightningRing;
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, -0.6F);
|
||||
IIcon icon = ((ItemHoverHarness) ConfigItems.itemHoverHarness).iconLightningRing;
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 2; j++) {
|
||||
GL11.glScalef(1F, -1F, 1F);
|
||||
UtilsFX.renderQuadCenteredFromIcon(false, icon, redstone / 15F * 0.7F + (redstone == 0 ? 0 : 0.4F), blue ? 0F : 1F, 0F, blue ? 1F : 0F, 225, GL11.GL_ONE_MINUS_SRC_ALPHA, 0.9F);
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
GL11.glScalef(1F, -1F, 1F);
|
||||
UtilsFX.renderQuadCenteredFromIcon(false, icon, redstone / 15F * 0.7F + (redstone == 0 ? 0 : 0.4F), blue ? 0F : 1F, 0F, blue ? 1F : 0F, 225, GL11.GL_ONE_MINUS_SRC_ALPHA, 0.9F);
|
||||
}
|
||||
|
||||
GL11.glTranslated(0, 0, -(Math.cos(System.currentTimeMillis() / 500F) + 1) * 0.09 - 0.1);
|
||||
}
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glTranslated(0, 0, -(Math.cos(System.currentTimeMillis() / 500F) + 1) * 0.09 - 0.1);
|
||||
}
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class RenderTileRelay extends TileEntitySpecialRenderer {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float)x, (float)y , (float)z);
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(texture);
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
*/
|
||||
package vazkii.tinkerer.client.render.tile;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@@ -25,15 +23,15 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import vazkii.tinkerer.client.core.helper.ClientHelper;
|
||||
import vazkii.tinkerer.client.lib.LibResources;
|
||||
import vazkii.tinkerer.client.model.ModelRepairer;
|
||||
import vazkii.tinkerer.common.block.tile.TileRepairer;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class RenderTileRepairer extends TileEntitySpecialRenderer {
|
||||
|
||||
ModelRepairer model = new ModelRepairer();
|
||||
@@ -52,7 +50,7 @@ public class RenderTileRepairer extends TileEntitySpecialRenderer {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float)x, (float)y , (float)z);
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
bindTexture(modelTex);
|
||||
@@ -65,7 +63,7 @@ public class RenderTileRepairer extends TileEntitySpecialRenderer {
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
ItemStack item = ((TileRepairer) tileentity).getStackInSlot(0);
|
||||
if(item != null) {
|
||||
if (item != null) {
|
||||
GL11.glPushMatrix();
|
||||
final float scale = 0.5F;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
@@ -80,19 +78,19 @@ public class RenderTileRepairer extends TileEntitySpecialRenderer {
|
||||
|
||||
int renderPass = 0;
|
||||
do {
|
||||
IIcon icon = item.getItem().getIcon(item, renderPass);
|
||||
if(icon != null) {
|
||||
Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
renderPass++;
|
||||
} while(renderPass < item.getItem().getRenderPasses(item.getItemDamage()));
|
||||
IIcon icon = item.getItem().getIcon(item, renderPass);
|
||||
if (icon != null) {
|
||||
Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
renderPass++;
|
||||
} while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -105,12 +103,11 @@ public class RenderTileRepairer extends TileEntitySpecialRenderer {
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
renderOverlay((TileRepairer) tileentity, ((TileRepairer) tileentity).tookLastTick ? repair : repairOff , 1.25F);
|
||||
renderOverlay((TileRepairer) tileentity, ((TileRepairer) tileentity).tookLastTick ? repair : repairOff, 1.25F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
|
||||
|
||||
private void renderOverlay(TileRepairer tablet, ResourceLocation texture, double size) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
|
||||
@@ -16,9 +16,7 @@ package vazkii.tinkerer.client.render.tile.kami;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.tinkerer.client.model.kami.ModelSpinningCubes;
|
||||
|
||||
public class RenderTileWarpGate extends TileEntitySpecialRenderer {
|
||||
|
||||
@@ -49,40 +49,41 @@ public class ThaumicTinkerer {
|
||||
public static TTCommonProxy proxy;
|
||||
|
||||
public static CommonProxy tcProxy;
|
||||
public static SimpleNetworkWrapper netHandler = NetworkRegistry.INSTANCE.newSimpleChannel(LibMisc.MOD_ID + "|B");
|
||||
public static SimpleNetworkWrapper netHandler = NetworkRegistry.INSTANCE.newSimpleChannel(LibMisc.MOD_ID + "|B");
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
tcProxy= Thaumcraft.proxy;
|
||||
tcProxy = Thaumcraft.proxy;
|
||||
proxy.preInit(event);
|
||||
if(Loader.isModLoaded("Waila")) {
|
||||
if (Loader.isModLoaded("Waila")) {
|
||||
FMLInterModComms.sendMessage("Waila", "register", "vazkii.tinkerer.common.compat.TTinkererProvider.callbackRegister");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStart(FMLServerStartingEvent event)
|
||||
{
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
ICommandManager command=server.getCommandManager();
|
||||
ServerCommandManager manager = (ServerCommandManager) command;
|
||||
manager.registerCommand(new MaxResearchCommand());
|
||||
manager.registerCommand(new KamiUnlockedCommand());
|
||||
public void serverStart(FMLServerStartingEvent event) {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
ICommandManager command = server.getCommandManager();
|
||||
ServerCommandManager manager = (ServerCommandManager) command;
|
||||
manager.registerCommand(new MaxResearchCommand());
|
||||
manager.registerCommand(new KamiUnlockedCommand());
|
||||
}
|
||||
@EventHandler
|
||||
public void HandleIMCMessages(FMLInterModComms.IMCEvent messages) {
|
||||
for (FMLInterModComms.IMCMessage message : messages.getMessages()) {
|
||||
if(message.key.equalsIgnoreCase(InterModCommsOperations.ADD_RESEARCH_BLACKLIST))
|
||||
{
|
||||
String[] values=message.getStringValue().split(",");
|
||||
KamiResearchItem.Blacklist.addAll(Arrays.asList(values));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HandleIMCMessages(FMLInterModComms.IMCEvent messages) {
|
||||
for (FMLInterModComms.IMCMessage message : messages.getMessages()) {
|
||||
if (message.key.equalsIgnoreCase(InterModCommsOperations.ADD_RESEARCH_BLACKLIST)) {
|
||||
String[] values = message.getStringValue().split(",");
|
||||
KamiResearchItem.Blacklist.addAll(Arrays.asList(values));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
|
||||
|
||||
if(ConfigHandler.enableKami && ConfigHandler.bedrockDimensionID != 0){
|
||||
if (ConfigHandler.enableKami && ConfigHandler.bedrockDimensionID != 0) {
|
||||
DimensionManager.registerProviderType(ConfigHandler.bedrockDimensionID, WorldProviderBedrock.class, false);
|
||||
DimensionManager.registerDimension(ConfigHandler.bedrockDimensionID, ConfigHandler.bedrockDimensionID);
|
||||
}
|
||||
@@ -91,6 +92,6 @@ public class ThaumicTinkerer {
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit(event);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -82,60 +82,59 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
b0 = 4;
|
||||
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2);
|
||||
//TileAnimationTablet tablet = (TileAnimationTablet) par1World.getTileEntity(par2, par3, par4);
|
||||
//if(par5EntityLiving instanceof EntityPlayer) {
|
||||
// tablet.Owner = ((EntityPlayer) par5EntityLiving).username;
|
||||
//}
|
||||
//TileAnimationTablet tablet = (TileAnimationTablet) par1World.getTileEntity(par2, par3, par4);
|
||||
//if(par5EntityLiving instanceof EntityPlayer) {
|
||||
// tablet.Owner = ((EntityPlayer) par5EntityLiving).username;
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) par1World.getTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (tablet != null) {
|
||||
if(tablet.getIsBreaking()) {
|
||||
//ChunkCoordinates coords = tablet.getTargetLoc();
|
||||
//par1World.destroyBlockInWorldPartially(tablet.getFakePlayer().entityId, coords.posX, coords.posY, coords.posZ, -1);
|
||||
}
|
||||
if (tablet != null) {
|
||||
if (tablet.getIsBreaking()) {
|
||||
//ChunkCoordinates coords = tablet.getTargetLoc();
|
||||
//par1World.destroyBlockInWorldPartially(tablet.getFakePlayer().entityId, coords.posX, coords.posY, coords.posZ, -1);
|
||||
}
|
||||
|
||||
for (int j1 = 0; j1 < tablet.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = tablet.getStackInSlot(j1);
|
||||
for (int j1 = 0; j1 < tablet.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = tablet.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Look here if something breaks in 1.7
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
//Look here if something breaks in 1.7
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
|
||||
if(par1World.isRemote)
|
||||
if (par1World.isRemote)
|
||||
return;
|
||||
|
||||
boolean power = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4) || par1World.isBlockIndirectlyGettingPowered(par2, par3 + 1, par4);
|
||||
@@ -157,9 +156,9 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if(tile != null && tile instanceof TileAnimationTablet) {
|
||||
if (tile != null && tile instanceof TileAnimationTablet) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) tile;
|
||||
if(tablet.redstone && tablet.swingProgress == 0) {
|
||||
if (tablet.redstone && tablet.swingProgress == 0) {
|
||||
tablet.findEntities(tablet.getTargetLoc());
|
||||
tablet.initiateSwing();
|
||||
par1World.addBlockEvent(par2, par3, par4, ModBlocks.animationTablet, 0, 0);
|
||||
@@ -169,26 +168,26 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if(!par1World.isRemote) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if(tile != null) {
|
||||
if (tile != null) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) tile;
|
||||
if(par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
boolean activated = (meta & 8) != 0;
|
||||
if(!activated && !tablet.getIsBreaking() && tablet.swingProgress == 0) {
|
||||
if (!activated && !tablet.getIsBreaking() && tablet.swingProgress == 0) {
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta == 5 ? 2 : meta + 1, 1 | 2);
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft:tool", 0.6F, 1F);
|
||||
} else par5EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.animationTablet.notRotatable"));
|
||||
// Rare chance this might happen, but better to cope for it.
|
||||
} else
|
||||
par5EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.animationTablet.notRotatable"));
|
||||
// Rare chance this might happen, but better to cope for it.
|
||||
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
//if(tablet.Owner==null || tablet.Owner.equals(""))
|
||||
// tablet.Owner=par5EntityPlayer.username;
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_TABLET, par1World, par2, par3, par4);
|
||||
}
|
||||
} else {
|
||||
//if(tablet.Owner==null || tablet.Owner.equals(""))
|
||||
// tablet.Owner=par5EntityPlayer.username;
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_TABLET, par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -31,6 +29,8 @@ import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.common.block.tile.TileAspectAnalyzer;
|
||||
import vazkii.tinkerer.common.lib.LibGuiIDs;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockAspectAnalyzer extends BlockModContainer {
|
||||
|
||||
IIcon[] icons = new IIcon[5];
|
||||
@@ -47,9 +47,9 @@ public class BlockAspectAnalyzer extends BlockModContainer {
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if(!par1World.isRemote) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if(tile != null)
|
||||
if (tile != null)
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_ASPECT_ANALYZER, par1World, par2, par3, par4);
|
||||
}
|
||||
|
||||
@@ -57,46 +57,46 @@ public class BlockAspectAnalyzer extends BlockModContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileAspectAnalyzer analyzer = (TileAspectAnalyzer) par1World.getTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileAspectAnalyzer analyzer = (TileAspectAnalyzer) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (analyzer != null) {
|
||||
for (int j1 = 0; j1 < analyzer.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = analyzer.getStackInSlot(j1);
|
||||
if (analyzer != null) {
|
||||
for (int j1 = 0; j1 < analyzer.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = analyzer.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
for(int i = 0; i < 5; i++)
|
||||
for (int i = 0; i < 5; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,116 +33,116 @@ import java.util.List;
|
||||
|
||||
public abstract class BlockCamo extends BlockModContainer<TileCamo> {
|
||||
|
||||
static List<Integer> validRenderTypes = Arrays.asList(0, 31, 39);
|
||||
static List<Integer> validRenderTypes = Arrays.asList(0, 31, 39);
|
||||
|
||||
protected BlockCamo(Material par2Material) {
|
||||
super(par2Material);
|
||||
}
|
||||
protected BlockCamo(Material par2Material) {
|
||||
super(par2Material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
Block block = camo.camo;
|
||||
if (block != null && isValidRenderType(block.getRenderType()))
|
||||
return block.getIcon(side, camo.camoMeta);
|
||||
}
|
||||
if (tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
Block block = camo.camo;
|
||||
if (block != null && isValidRenderType(block.getRenderType()))
|
||||
return block.getIcon(side, camo.camoMeta);
|
||||
}
|
||||
|
||||
return getIconFromSideAfterCheck(tile, meta, side);
|
||||
}
|
||||
return getIconFromSideAfterCheck(tile, meta, side);
|
||||
}
|
||||
|
||||
public boolean isValidRenderType(int type) {
|
||||
return validRenderTypes.contains(type);
|
||||
}
|
||||
public boolean isValidRenderType(int type) {
|
||||
return validRenderTypes.contains(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
ItemStack currentStack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
if (tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
ItemStack currentStack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
|
||||
if(currentStack == null)
|
||||
currentStack = new ItemStack(Block.getBlockFromName("air"), 1, 0);
|
||||
if (currentStack == null)
|
||||
currentStack = new ItemStack(Block.getBlockFromName("air"), 1, 0);
|
||||
|
||||
boolean doChange = true;
|
||||
Block block = null;
|
||||
checkChange :
|
||||
{
|
||||
if (currentStack.getItem() != Item.getItemFromBlock(Block.getBlockFromName("air"))) {
|
||||
if (Item.getIdFromItem(currentStack.getItem()) == 0) {
|
||||
doChange = false;
|
||||
break checkChange;
|
||||
}
|
||||
boolean doChange = true;
|
||||
Block block = null;
|
||||
checkChange:
|
||||
{
|
||||
if (currentStack.getItem() != Item.getItemFromBlock(Block.getBlockFromName("air"))) {
|
||||
if (Item.getIdFromItem(currentStack.getItem()) == 0) {
|
||||
doChange = false;
|
||||
break checkChange;
|
||||
}
|
||||
|
||||
block = Block.getBlockFromItem(currentStack.getItem());
|
||||
if (block == null || !isValidRenderType(block.getRenderType()) || block instanceof BlockCamo || block.getMaterial() == Material.air)
|
||||
doChange = false;
|
||||
}
|
||||
}
|
||||
block = Block.getBlockFromItem(currentStack.getItem());
|
||||
if (block == null || !isValidRenderType(block.getRenderType()) || block instanceof BlockCamo || block.getMaterial() == Material.air)
|
||||
doChange = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(doChange) {
|
||||
int metadata = currentStack.getItemDamage();
|
||||
if (block instanceof BlockDirectional) {
|
||||
switch (par6) {
|
||||
case 0:
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
metadata = metadata & 12 | 2;
|
||||
break;
|
||||
case 3:
|
||||
metadata = metadata & 12;
|
||||
break;
|
||||
case 4:
|
||||
metadata = metadata & 12 | 1;
|
||||
break;
|
||||
case 5:
|
||||
metadata = metadata & 12 | 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
camo.camo = Block.getBlockFromItem(currentStack.getItem());
|
||||
camo.camoMeta = metadata;
|
||||
par1World.markBlockForUpdate(par2,par3,par4);
|
||||
if (doChange) {
|
||||
int metadata = currentStack.getItemDamage();
|
||||
if (block instanceof BlockDirectional) {
|
||||
switch (par6) {
|
||||
case 0:
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
metadata = metadata & 12 | 2;
|
||||
break;
|
||||
case 3:
|
||||
metadata = metadata & 12;
|
||||
break;
|
||||
case 4:
|
||||
metadata = metadata & 12 | 1;
|
||||
break;
|
||||
case 5:
|
||||
metadata = metadata & 12 | 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
camo.camo = Block.getBlockFromItem(currentStack.getItem());
|
||||
camo.camoMeta = metadata;
|
||||
par1World.markBlockForUpdate(par2, par3, par4);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess par1World, int par2, int par3, int par4) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
Block block = camo.camo;
|
||||
if (block != null)
|
||||
return block instanceof BlockCamo ? 0xFFFFFF : block.colorMultiplier(par1World, par2, par3, par4);
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess par1World, int par2, int par3, int par4) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
Block block = camo.camo;
|
||||
if (block != null)
|
||||
return block instanceof BlockCamo ? 0xFFFFFF : block.colorMultiplier(par1World, par2, par3, par4);
|
||||
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
public IIcon getIconFromSideAfterCheck(TileEntity tile, int meta, int side) {
|
||||
return blockIcon;
|
||||
}
|
||||
public IIcon getIconFromSideAfterCheck(TileEntity tile, int meta, int side) {
|
||||
return blockIcon;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -53,10 +53,10 @@ public class BlockEnchanter extends BlockModContainer {
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if(!par1World.isRemote) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if(tile != null) {
|
||||
par1World.markBlockForUpdate(par2,par3,par4);
|
||||
if (tile != null) {
|
||||
par1World.markBlockForUpdate(par2, par3, par4);
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_ENCHANTER, par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
@@ -65,42 +65,42 @@ public class BlockEnchanter extends BlockModContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (enchanter != null) {
|
||||
for (int j1 = 0; j1 < enchanter.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = enchanter.getStackInSlot(j1);
|
||||
if (enchanter != null) {
|
||||
for (int j1 = 0; j1 < enchanter.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = enchanter.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -118,13 +118,13 @@ public class BlockEnchanter extends BlockModContainer {
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
@@ -85,7 +85,7 @@ public class BlockFunnel extends BlockModContainer {
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
|
||||
if(par1World.getBlock(par2, par3 - 1, par4) != Block.getBlockFromName("hopper")) {
|
||||
if (par1World.getBlock(par2, par3 - 1, par4) != Block.getBlockFromName("hopper")) {
|
||||
dropBlockAsItem(par1World, par2, par3, par4, 0, 0);
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
@@ -113,12 +113,12 @@ public class BlockFunnel extends BlockModContainer {
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,22 +134,22 @@ public class BlockFunnel extends BlockModContainer {
|
||||
TileFunnel funnel = (TileFunnel) par1World.getTileEntity(par2, par3, par4);
|
||||
ItemStack stack = funnel.getStackInSlot(0);
|
||||
|
||||
if(stack == null) {
|
||||
if (stack == null) {
|
||||
ItemStack playerStack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
if(funnel.canInsertItem(0, playerStack, 1)) {
|
||||
if (funnel.canInsertItem(0, playerStack, 1)) {
|
||||
funnel.setInventorySlotContents(0, playerStack.splitStack(1));
|
||||
|
||||
if(playerStack.stackSize <= 0)
|
||||
if (playerStack.stackSize <= 0)
|
||||
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null);
|
||||
funnel.markDirty();
|
||||
funnel.markDirty();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if(!par5EntityPlayer.inventory.addItemStackToInventory(stack))
|
||||
if (!par5EntityPlayer.inventory.addItemStackToInventory(stack))
|
||||
par5EntityPlayer.dropPlayerItemWithRandomChoice(stack, false);
|
||||
|
||||
funnel.setInventorySlotContents(0, null);
|
||||
funnel.markDirty();
|
||||
funnel.markDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -26,8 +25,9 @@ import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.client.core.helper.IconHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class BlockGas extends BlockMod {
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class BlockGas extends BlockMod {
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
if(meta != 0) {
|
||||
if (meta != 0) {
|
||||
setAt(par1World, par2 - 1, par3, par4, meta - 1);
|
||||
setAt(par1World, par2 + 1, par3, par4, meta - 1);
|
||||
|
||||
@@ -73,8 +73,8 @@ public abstract class BlockGas extends BlockMod {
|
||||
}
|
||||
|
||||
private void setAt(World world, int x, int y, int z, int meta) {
|
||||
if(world.isAirBlock(x, y, z) && world.getBlock(x, y, z) != this) {
|
||||
if(!world.isRemote)
|
||||
if (world.isAirBlock(x, y, z) && world.getBlock(x, y, z) != this) {
|
||||
if (!world.isRemote)
|
||||
world.setBlock(x, y, z, this, meta, 2);
|
||||
world.scheduleBlockUpdate(x, y, z, this, 10);
|
||||
}
|
||||
@@ -90,7 +90,6 @@ public abstract class BlockGas extends BlockMod {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity e) {
|
||||
return false;
|
||||
@@ -111,7 +110,7 @@ public abstract class BlockGas extends BlockMod {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return new ArrayList(); // Empty List
|
||||
}
|
||||
@@ -121,7 +120,6 @@ public abstract class BlockGas extends BlockMod {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isAir(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
|
||||
@@ -14,24 +14,24 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGaseousLight extends BlockGas {
|
||||
|
||||
public BlockGaseousLight() {
|
||||
super();
|
||||
super();
|
||||
setLightLevel(0.85F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if(par5Random.nextFloat() < 0.0075F)
|
||||
if (par5Random.nextFloat() < 0.0075F)
|
||||
ThaumicTinkerer.tcProxy.sparkle(par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, 1F, 1, par5Random.nextFloat() / 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGaseousShadow extends BlockGas {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class BlockGaseousShadow extends BlockGas {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if(par5Random.nextFloat() < 0.0075F)
|
||||
if (par5Random.nextFloat() < 0.0075F)
|
||||
ThaumicTinkerer.tcProxy.wispFX2(par1World, par2 + 0.5, par3 + 0.5, par4 + 0.5, 0.125F, 5, true, -0.02F);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@ import vazkii.tinkerer.common.block.tile.TileGolemConnector;
|
||||
|
||||
public class BlockGolemConnector extends BlockCamo {
|
||||
|
||||
|
||||
|
||||
protected BlockGolemConnector() {
|
||||
super(Material.wood);
|
||||
}
|
||||
@@ -18,6 +16,7 @@ public class BlockGolemConnector extends BlockCamo {
|
||||
// TODO Auto-generated method stub
|
||||
return new TileGolemConnector();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return true;
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -34,8 +33,9 @@ import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.common.block.tile.TileMagnet;
|
||||
import vazkii.tinkerer.common.block.tile.TileMobMagnet;
|
||||
import vazkii.tinkerer.common.lib.LibGuiIDs;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockMagnet extends BlockModContainer {
|
||||
|
||||
@@ -53,12 +53,12 @@ public class BlockMagnet extends BlockModContainer {
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if(par5EntityPlayer.getCurrentEquippedItem() != null) {
|
||||
if(par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
if (par5EntityPlayer.getCurrentEquippedItem() != null) {
|
||||
if (par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if(tile != null && tile instanceof TileMobMagnet) {
|
||||
if (tile != null && tile instanceof TileMobMagnet) {
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_MOB_MAGNET, par1World, par2, par3, par4);
|
||||
if(!par1World.isRemote) {
|
||||
if (!par1World.isRemote) {
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft:key", 1F, 0.5F);
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class BlockMagnet extends BlockModContainer {
|
||||
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, (meta & 1) == 0 ? meta + 1 : meta - 1, 2);
|
||||
if(!par1World.isRemote) {
|
||||
if (!par1World.isRemote) {
|
||||
par1World.playSoundEffect(par2, par3, par4, "random.click", 1F, 0.5F);
|
||||
}
|
||||
return true;
|
||||
@@ -97,12 +97,12 @@ public class BlockMagnet extends BlockModContainer {
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,15 +115,15 @@ public class BlockMagnet extends BlockModContainer {
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1) {
|
||||
switch(par1) {
|
||||
case 1:
|
||||
return 0;
|
||||
case 2:
|
||||
return 1;
|
||||
case 3:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
switch (par1) {
|
||||
case 1:
|
||||
return 0;
|
||||
case 2:
|
||||
return 1;
|
||||
case 3:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,24 +14,22 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import vazkii.tinkerer.client.core.helper.IconHelper;
|
||||
import vazkii.tinkerer.common.core.handler.ModCreativeTab;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockMod extends Block {
|
||||
|
||||
public BlockMod(Material par2Material) {
|
||||
super(par2Material);
|
||||
if(registerInCreative())
|
||||
if (registerInCreative())
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
@@ -42,5 +40,4 @@ public class BlockMod extends Block {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -14,6 +14,8 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -21,14 +23,12 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.client.core.helper.IconHelper;
|
||||
import vazkii.tinkerer.common.core.handler.ModCreativeTab;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class BlockModContainer<T extends TileEntity> extends BlockContainer {
|
||||
|
||||
protected BlockModContainer(Material par2Material) {
|
||||
super(par2Material);
|
||||
if(registerInCreative())
|
||||
if (registerInCreative())
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@@ -38,12 +38,14 @@ public abstract class BlockModContainer<T extends TileEntity> extends BlockConta
|
||||
blockIcon = IconHelper.forBlock(par1IconRegister, this);
|
||||
}
|
||||
|
||||
/** Does the block register in the creative inv? **/
|
||||
/**
|
||||
* Does the block register in the creative inv? *
|
||||
*/
|
||||
boolean registerInCreative() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public abstract T createNewTileEntity(World world, int var2);
|
||||
|
||||
}
|
||||
@@ -14,17 +14,17 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.common.item.ModItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockNitorGas extends BlockGas {
|
||||
|
||||
@@ -40,45 +40,45 @@ public class BlockNitorGas extends BlockGas {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if(par5Random.nextFloat() < 0.03F)
|
||||
if (par5Random.nextFloat() < 0.03F)
|
||||
ThaumicTinkerer.tcProxy.sparkle(par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, 1F, 4, par5Random.nextFloat() / 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if(!par1World.isRemote) {
|
||||
if (!par1World.isRemote) {
|
||||
int dist = par1World.getBlockMetadata(par2, par3, par4) == 1 ? 6 : 1;
|
||||
List<EntityPlayer> players = par1World.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(par2 - dist, par3 - dist, par4 - dist, par2 + dist, par3 + dist, par4 + dist));
|
||||
if(players.isEmpty())
|
||||
if (players.isEmpty())
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
else {
|
||||
boolean has = false;
|
||||
for(EntityPlayer player : players)
|
||||
if(player.inventory.hasItem(ModItems.brightNitor) || ModItems.ichorLegsGem != null && player.getCurrentArmor(1) != null && player.getCurrentArmor(1).getItem() == ModItems.ichorLegsGem) {
|
||||
for (EntityPlayer player : players)
|
||||
if (player.inventory.hasItem(ModItems.brightNitor) || ModItems.ichorLegsGem != null && player.getCurrentArmor(1) != null && player.getCurrentArmor(1).getItem() == ModItems.ichorLegsGem) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!has)
|
||||
if (!has)
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue() {
|
||||
return 15;
|
||||
}
|
||||
@Override
|
||||
public int getLightValue() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
return world.getBlockMetadata(x, y, z) == 1 ? 15 : 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World par1World, int par2, int par3, int par4) {
|
||||
if(!par1World.isRemote)
|
||||
if (!par1World.isRemote)
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -25,6 +23,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.common.block.tile.TileCamo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockPlatform extends BlockCamo {
|
||||
|
||||
public BlockPlatform() {
|
||||
@@ -36,7 +36,7 @@ public class BlockPlatform extends BlockCamo {
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
|
||||
if(par7Entity != null && par7Entity.posY > par3 + (par7Entity instanceof EntityPlayer ? 2 : 0) && (!(par7Entity instanceof EntityPlayer) || !par7Entity.isSneaking()))
|
||||
if (par7Entity != null && par7Entity.posY > par3 + (par7Entity instanceof EntityPlayer ? 2 : 0) && (!(par7Entity instanceof EntityPlayer) || !par7Entity.isSneaking()))
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,10 +41,10 @@ public class BlockRepairer extends BlockModContainer {
|
||||
|
||||
protected BlockRepairer() {
|
||||
super(Material.iron);
|
||||
setHardness(5F);
|
||||
setResistance(10F);
|
||||
setHardness(5F);
|
||||
setResistance(10F);
|
||||
|
||||
random = new Random();
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,19 +52,19 @@ public class BlockRepairer extends BlockModContainer {
|
||||
TileRepairer repairer = (TileRepairer) par1World.getTileEntity(par2, par3, par4);
|
||||
ItemStack stack = repairer.getStackInSlot(0);
|
||||
|
||||
if(stack == null) {
|
||||
if (stack == null) {
|
||||
ItemStack playerStack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
if(repairer.canInsertItem(0, playerStack, 1)) {
|
||||
if (repairer.canInsertItem(0, playerStack, 1)) {
|
||||
repairer.setInventorySlotContents(0, playerStack.splitStack(1));
|
||||
|
||||
if(playerStack.stackSize <= 0)
|
||||
if (playerStack.stackSize <= 0)
|
||||
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null);
|
||||
|
||||
repairer.markDirty();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if(!par5EntityPlayer.inventory.addItemStackToInventory(stack))
|
||||
if (!par5EntityPlayer.inventory.addItemStackToInventory(stack))
|
||||
par5EntityPlayer.dropPlayerItemWithRandomChoice(stack, false);
|
||||
|
||||
repairer.setInventorySlotContents(0, null);
|
||||
@@ -116,25 +116,21 @@ public class BlockRepairer extends BlockModContainer {
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
int dmg;
|
||||
if(Loader.isModLoaded("TConstruct"))
|
||||
{
|
||||
if(TinkersConstructCompat.isTConstructTool(itemstack))
|
||||
{
|
||||
dmg= TinkersConstructCompat.getDamage(itemstack);
|
||||
}
|
||||
else
|
||||
dmg=itemstack.getItemDamage();
|
||||
}
|
||||
else
|
||||
dmg=itemstack.getItemDamage();
|
||||
if (Loader.isModLoaded("TConstruct")) {
|
||||
if (TinkersConstructCompat.isTConstructTool(itemstack)) {
|
||||
dmg = TinkersConstructCompat.getDamage(itemstack);
|
||||
} else
|
||||
dmg = itemstack.getItemDamage();
|
||||
} else
|
||||
dmg = itemstack.getItemDamage();
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, dmg));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,7 +141,6 @@ public class BlockRepairer extends BlockModContainer {
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
|
||||
@@ -44,6 +44,7 @@ public class BlockSummon extends Block {
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
|
||||
@@ -56,7 +56,7 @@ public final class ModBlocks {
|
||||
public static Block repairer;
|
||||
public static Block aspectAnalyzer;
|
||||
public static Block platform;
|
||||
public static Block spawner;
|
||||
public static Block spawner;
|
||||
public static Block warpGate;
|
||||
|
||||
public static Block mobilizerRelay;
|
||||
@@ -65,9 +65,9 @@ public final class ModBlocks {
|
||||
|
||||
//public static Block bedrock;
|
||||
|
||||
|
||||
public static Block portal;
|
||||
public static Block golemConnector;
|
||||
|
||||
public static void initBlocks() {
|
||||
darkQuartz = new BlockDarkQuartz().setBlockName(LibBlockNames.DARK_QUARTZ);
|
||||
darkQuartzSlab = new BlockDarkQuartzSlab(false).setBlockName(LibBlockNames.DARK_QUARTZ_SLAB);
|
||||
@@ -88,13 +88,13 @@ public final class ModBlocks {
|
||||
|
||||
mobilizerRelay = new BlockMobilizerRelay().setBlockName(LibBlockNames.MOBILIZER_RELAY);
|
||||
mobilizer = new BlockMobilizer().setBlockName(LibBlockNames.MOBILIZER);
|
||||
golemConnector=new BlockGolemConnector().setBlockName(LibBlockNames.GOLEMCONNECTOR);
|
||||
golemConnector = new BlockGolemConnector().setBlockName(LibBlockNames.GOLEMCONNECTOR);
|
||||
|
||||
spawner = new BlockSummon().setBlockName(LibBlockNames.SPAWNER);
|
||||
if(ConfigHandler.enableKami) {
|
||||
if (ConfigHandler.enableKami) {
|
||||
|
||||
warpGate = new BlockWarpGate().setBlockName(LibBlockNames.WARP_GATE);
|
||||
if(ConfigHandler.bedrockDimensionID != 0) {
|
||||
if (ConfigHandler.bedrockDimensionID != 0) {
|
||||
|
||||
portal = new BlockBedrockPortal().setBlockName(LibBlockNames.PORTAL);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public final class ModBlocks {
|
||||
GameRegistry.registerBlock(darkQuartzSlab, ItemDarkQuartzSlab.class, LibBlockNames.DARK_QUARTZ_SLAB);
|
||||
GameRegistry.registerBlock(darkQuartzSlabFull, ItemDarkQuartzSlab.class, LibBlockNames.DARK_QUARTZ_SLAB_FULL);
|
||||
GameRegistry.registerBlock(interfase, LibBlockNames.INTERFACE);
|
||||
GameRegistry.registerBlock(nitorGas, LibBlockNames.NITOR_GAS);
|
||||
GameRegistry.registerBlock(nitorGas, LibBlockNames.NITOR_GAS);
|
||||
GameRegistry.registerBlock(gaseousLight, LibBlockNames.GASEOUS_LIGHT);
|
||||
GameRegistry.registerBlock(gaseousShadow, LibBlockNames.GASEOUS_SHADOW);
|
||||
GameRegistry.registerBlock(animationTablet, LibBlockNames.ANIMATION_TABLET);
|
||||
@@ -128,11 +128,11 @@ public final class ModBlocks {
|
||||
GameRegistry.registerBlock(golemConnector, LibBlockNames.GOLEMCONNECTOR);
|
||||
|
||||
GameRegistry.registerBlock(spawner, LibBlockNames.SPAWNER);
|
||||
if(ConfigHandler.enableKami) {
|
||||
if (ConfigHandler.enableKami) {
|
||||
GameRegistry.registerBlock(warpGate, ItemBlockWarpGate.class, LibBlockNames.WARP_GATE);
|
||||
|
||||
if(ConfigHandler.bedrockDimensionID != 0) {
|
||||
// GameRegistry.registerBlock(bedrock, LanguageRegistry.instance().getStringLocalization("bedrock"));
|
||||
if (ConfigHandler.bedrockDimensionID != 0) {
|
||||
// GameRegistry.registerBlock(bedrock, LanguageRegistry.instance().getStringLocalization("bedrock"));
|
||||
|
||||
GameRegistry.registerBlock(portal, LibBlockNames.PORTAL);
|
||||
}
|
||||
@@ -140,17 +140,16 @@ public final class ModBlocks {
|
||||
}
|
||||
|
||||
private static void registerMultiparts() {
|
||||
if(Loader.isModLoaded("ForgeMultipart")) {
|
||||
if (Loader.isModLoaded("ForgeMultipart")) {
|
||||
try {
|
||||
Class clazz = Class.forName("vazkii.tinkerer.common.block.multipart.MultipartHandler");
|
||||
clazz.newInstance();
|
||||
} catch(Throwable e) {
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void initTileEntities() {
|
||||
GameRegistry.registerTileEntity(TileTransvectorInterface.class, LibBlockNames.INTERFACE);
|
||||
GameRegistry.registerTileEntity(TileAnimationTablet.class, LibBlockNames.ANIMATION_TABLET);
|
||||
@@ -163,14 +162,13 @@ public final class ModBlocks {
|
||||
GameRegistry.registerTileEntity(TileAspectAnalyzer.class, LibBlockNames.ASPECT_ANALYZER);
|
||||
GameRegistry.registerTileEntity(TileCamo.class, LibBlockNames.CAMO);
|
||||
|
||||
|
||||
GameRegistry.registerTileEntity(TileEntityMobilizer.class, LibBlockNames.MOBILIZER);
|
||||
|
||||
GameRegistry.registerTileEntity(TileEntityRelay.class, LibBlockNames.MOBILIZER_RELAY);
|
||||
GameRegistry.registerTileEntity(TileGolemConnector.class, LibBlockNames.GOLEMCONNECTOR);
|
||||
|
||||
GameRegistry.registerTileEntity(TileSummon.class, LibBlockNames.SPAWNER);
|
||||
if(ConfigHandler.enableKami) {
|
||||
if (ConfigHandler.enableKami) {
|
||||
GameRegistry.registerTileEntity(TileWarpGate.class, LibBlockNames.WARP_GATE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ public class BlockBedrockPortal extends Block {
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(World par1World, int par2, int par3, int par4) {
|
||||
return -1;
|
||||
@@ -78,12 +77,12 @@ public class BlockBedrockPortal extends Block {
|
||||
return new TileBedrockPortal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@@ -104,27 +103,28 @@ public class BlockBedrockPortal extends Block {
|
||||
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity entity) {
|
||||
super.onEntityCollidedWithBlock(par1World, par2, par3, par4, entity);
|
||||
|
||||
if(entity.worldObj.provider.isSurfaceWorld()){
|
||||
if (entity.worldObj.provider.isSurfaceWorld()) {
|
||||
|
||||
if(entity instanceof EntityPlayer && !par1World.isRemote){
|
||||
if (entity instanceof EntityPlayer && !par1World.isRemote) {
|
||||
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) entity, ConfigHandler.bedrockDimensionID, new TeleporterBedrock((WorldServer) par1World));
|
||||
|
||||
if(entity.worldObj.getBlock(par2, 251, par4) == Blocks.bedrock){
|
||||
if (entity.worldObj.getBlock(par2, 251, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 251, par4, Blocks.air);
|
||||
}
|
||||
if(entity.worldObj.getBlock(par2, 252, par4) == Blocks.bedrock){
|
||||
if (entity.worldObj.getBlock(par2, 252, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 252, par4, Blocks.air);
|
||||
}
|
||||
if(entity.worldObj.getBlock(par2, 253, par4) == Blocks.bedrock){
|
||||
if (entity.worldObj.getBlock(par2, 253, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 253, par4, Blocks.air);
|
||||
}if(entity.worldObj.getBlock(par2, 254, par4) == Blocks.bedrock){
|
||||
}
|
||||
if (entity.worldObj.getBlock(par2, 254, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 254, par4, ModBlocks.portal);
|
||||
}
|
||||
((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(par2 + 0.5, 252, par4 + 0.5, 0, 0);
|
||||
}
|
||||
}else if(entity.worldObj.provider instanceof WorldProviderBedrock){
|
||||
if(entity instanceof EntityPlayer && !par1World.isRemote){
|
||||
} else if (entity.worldObj.provider instanceof WorldProviderBedrock) {
|
||||
if (entity instanceof EntityPlayer && !par1World.isRemote) {
|
||||
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) entity, 0, new TeleporterBedrock((WorldServer) par1World));
|
||||
|
||||
@@ -133,28 +133,23 @@ public class BlockBedrockPortal extends Block {
|
||||
int x = (int) entity.posX + rand.nextInt(100);
|
||||
int z = (int) entity.posZ + rand.nextInt(100);
|
||||
|
||||
x-=50;
|
||||
z-=50;
|
||||
x -= 50;
|
||||
z -= 50;
|
||||
|
||||
int y=120;
|
||||
int y = 120;
|
||||
|
||||
while(entity.worldObj.getBlock(x, y, z) == Blocks.air || entity.worldObj.getBlock(x, y, z).isAir(par1World, x, y, z)){
|
||||
while (entity.worldObj.getBlock(x, y, z) == Blocks.air || entity.worldObj.getBlock(x, y, z).isAir(par1World, x, y, z)) {
|
||||
y--;
|
||||
}
|
||||
|
||||
|
||||
((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(x + 0.5, y + 3, z + 0.5, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void travelToDimension(int par1, Entity e)
|
||||
{
|
||||
if (!e.worldObj.isRemote && !e.isDead)
|
||||
{
|
||||
public void travelToDimension(int par1, Entity e) {
|
||||
if (!e.worldObj.isRemote && !e.isDead) {
|
||||
e.worldObj.theProfiler.startSection("changeDimension");
|
||||
MinecraftServer minecraftserver = MinecraftServer.getServer();
|
||||
int j = e.dimension;
|
||||
@@ -162,8 +157,7 @@ public class BlockBedrockPortal extends Block {
|
||||
WorldServer worldserver1 = minecraftserver.worldServerForDimension(par1);
|
||||
e.dimension = par1;
|
||||
|
||||
if (j == 1 && par1 == 1)
|
||||
{
|
||||
if (j == 1 && par1 == 1) {
|
||||
worldserver1 = minecraftserver.worldServerForDimension(0);
|
||||
e.dimension = 0;
|
||||
}
|
||||
@@ -175,15 +169,13 @@ public class BlockBedrockPortal extends Block {
|
||||
e.worldObj.theProfiler.endStartSection("reloading");
|
||||
Entity entity = EntityList.createEntityByName(EntityList.getEntityString(e), worldserver1);
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
if (entity != null) {
|
||||
entity.copyDataFrom(e, true);
|
||||
|
||||
if (j == 1 && par1 == 1)
|
||||
{
|
||||
if (j == 1 && par1 == 1) {
|
||||
ChunkCoordinates chunkcoordinates = worldserver1.getSpawnPoint();
|
||||
chunkcoordinates.posY = e.worldObj.getTopSolidOrLiquidBlock(chunkcoordinates.posX, chunkcoordinates.posZ);
|
||||
entity.setLocationAndAngles((double)chunkcoordinates.posX, (double)chunkcoordinates.posY, (double)chunkcoordinates.posZ, entity.rotationYaw, entity.rotationPitch);
|
||||
entity.setLocationAndAngles((double) chunkcoordinates.posX, (double) chunkcoordinates.posY, (double) chunkcoordinates.posZ, entity.rotationYaw, entity.rotationPitch);
|
||||
}
|
||||
|
||||
worldserver1.spawnEntityInWorld(entity);
|
||||
@@ -197,7 +189,4 @@ public class BlockBedrockPortal extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -14,7 +14,6 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.block.kami;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -49,10 +48,10 @@ public class BlockWarpGate extends BlockModContainer {
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if(!par1World.isRemote) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if(tile != null) {
|
||||
par1World.markBlockForUpdate(par2,par3,par4);
|
||||
if (tile != null) {
|
||||
par1World.markBlockForUpdate(par2, par3, par4);
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_WARP_GATE, par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
@@ -61,46 +60,46 @@ public class BlockWarpGate extends BlockModContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileWarpGate warpGate = (TileWarpGate) par1World.getTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileWarpGate warpGate = (TileWarpGate) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (warpGate != null) {
|
||||
for (int j1 = 0; j1 < warpGate.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = warpGate.getStackInSlot(j1);
|
||||
if (warpGate != null) {
|
||||
for (int j1 = 0; j1 < warpGate.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = warpGate.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world,int in) {
|
||||
public TileEntity createNewTileEntity(World world, int in) {
|
||||
return new TileWarpGate();
|
||||
}
|
||||
|
||||
@@ -111,7 +110,7 @@ public class BlockWarpGate extends BlockModContainer {
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
for(int i = 0; i < icons.length; i++)
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,16 +14,13 @@ import vazkii.tinkerer.common.block.tile.TileEntityMobilizer;
|
||||
|
||||
public class BlockMobilizer extends BlockMod {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockPreDestroy(World par1World, int par2, int par3,
|
||||
int par4, int par5) {
|
||||
TileEntity tile=par1World.getTileEntity(par2, par3, par4);
|
||||
if(tile!=null&& tile instanceof TileEntityMobilizer)
|
||||
{
|
||||
|
||||
((TileEntityMobilizer)tile).dead=true;
|
||||
int par4, int par5) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null && tile instanceof TileEntityMobilizer) {
|
||||
|
||||
((TileEntityMobilizer) tile).dead = true;
|
||||
}
|
||||
super.onBlockPreDestroy(par1World, par2, par3, par4, par5);
|
||||
}
|
||||
@@ -41,6 +38,7 @@ public class BlockMobilizer extends BlockMod {
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileEntityMobilizer();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -12,7 +12,7 @@ import vazkii.tinkerer.client.core.helper.IconHelper;
|
||||
import vazkii.tinkerer.common.block.BlockMod;
|
||||
import vazkii.tinkerer.common.block.tile.TileEntityRelay;
|
||||
|
||||
public class BlockMobilizerRelay extends BlockMod {
|
||||
public class BlockMobilizerRelay extends BlockMod {
|
||||
|
||||
public BlockMobilizerRelay() {
|
||||
super(Material.iron);
|
||||
@@ -23,7 +23,6 @@ public class BlockMobilizerRelay extends BlockMod {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileEntityRelay();
|
||||
@@ -50,5 +49,4 @@ public class BlockMobilizerRelay extends BlockMod {
|
||||
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSide;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -15,11 +15,11 @@
|
||||
|
||||
package vazkii.tinkerer.common.block.multipart;
|
||||
|
||||
import codechicken.microblock.BlockMicroMaterial;
|
||||
import codechicken.microblock.MicroMaterialRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import vazkii.tinkerer.common.block.ModBlocks;
|
||||
import codechicken.microblock.BlockMicroMaterial;
|
||||
import codechicken.microblock.MicroMaterialRegistry;
|
||||
|
||||
public class MultipartHandler {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class MultipartHandler {
|
||||
}
|
||||
|
||||
private static void registerMultipartMetadataLine(Block block, int maxMeta) {
|
||||
for(int i = 0; i < maxMeta; i++)
|
||||
for (int i = 0; i < maxMeta; i++)
|
||||
registerMultipart(block, i);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,15 +16,15 @@
|
||||
|
||||
package vazkii.tinkerer.common.block.multipart;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.multipart.IRandomDisplayTick;
|
||||
import codechicken.multipart.minecraft.McMetaPart;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
public class PartCandle extends McMetaPart implements IRandomDisplayTick {
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
|
||||
package vazkii.tinkerer.common.block.multipart;
|
||||
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.multipart.minecraft.McMetaPart;
|
||||
import net.minecraft.block.Block;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.multipart.minecraft.McMetaPart;
|
||||
|
||||
public class PartNitor extends McMetaPart {
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PartNitor extends McMetaPart {
|
||||
ThaumicTinkerer.tcProxy.wispFX3(world(), x() + 0.5F, y() + 0.5F, z() + 0.5F, x() + 0.3F + world().rand.nextFloat() * 0.4F, y() + 0.5F, z() + 0.3F + world().rand.nextFloat() * 0.4F, 0.5F, 4, true, -0.025F);
|
||||
|
||||
if (world().rand.nextInt(15 - ThaumicTinkerer.tcProxy.particleCount(5)) == 0)
|
||||
ThaumicTinkerer.tcProxy.wispFX3(world(), x() + 0.5F, y()+ 0.5F, z() + 0.5F, x() + 0.4F + world().rand.nextFloat() * 0.2F, y() + 0.5F, z() + 0.4F + world().rand.nextFloat() * 0.2F, 0.25F, 1, true, -0.02F);
|
||||
ThaumicTinkerer.tcProxy.wispFX3(world(), x() + 0.5F, y() + 0.5F, z() + 0.5F, x() + 0.4F + world().rand.nextFloat() * 0.2F, y() + 0.5F, z() + 0.4F + world().rand.nextFloat() * 0.2F, 0.25F, 1, true, -0.02F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
package vazkii.tinkerer.common.block.multipart;
|
||||
|
||||
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartConverter;
|
||||
@@ -18,8 +17,6 @@ import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// This class is used by FMP to recreate a part during loading and to convert already existing non-mutlipart blocks into multiparts.
|
||||
|
||||
// this is copied from the version FMP uses for vanilla torches
|
||||
@@ -32,7 +29,7 @@ public class RegisterBlockPart implements IPartFactory, IPartConverter {
|
||||
public RegisterBlockPart(Block block, Class<? extends TMultiPart> part) {
|
||||
//Autoloads the multi-parts name
|
||||
try {
|
||||
name = part.getConstructor().newInstance(new Object[] {}).getType();
|
||||
name = part.getConstructor().newInstance(new Object[]{ }).getType();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -62,25 +59,24 @@ public class RegisterBlockPart implements IPartFactory, IPartConverter {
|
||||
return;
|
||||
|
||||
MultiPartRegistry.registerConverter(this);
|
||||
MultiPartRegistry.registerParts(this, new String[] { name });
|
||||
MultiPartRegistry.registerParts(this, new String[]{ name });
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Block> blockTypes() {
|
||||
return Lists.newArrayList(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Block> blockTypes() {
|
||||
return Lists.newArrayList(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public TMultiPart convert(World world, BlockCoord pos) {
|
||||
Block blockInQuestion = world.getBlock(pos.x, pos.y, pos.z);
|
||||
int meta = world.getBlockMetadata(pos.x, pos.y, pos.z);
|
||||
if (blockInQuestion == block) {
|
||||
try {
|
||||
if(part.getName().equals("vazkii.tinkerer.common.block.multipart.PartNitor") && meta != 1)
|
||||
if (part.getName().equals("vazkii.tinkerer.common.block.multipart.PartNitor") && meta != 1)
|
||||
return null;
|
||||
|
||||
if(part.getDeclaredConstructor(int.class) != null)
|
||||
if (part.getDeclaredConstructor(int.class) != null)
|
||||
return part.getDeclaredConstructor(int.class).newInstance(meta);
|
||||
|
||||
return part.getConstructor().newInstance();
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.block.quartz;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -25,12 +25,12 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.client.core.helper.IconHelper;
|
||||
import vazkii.tinkerer.common.block.BlockMod;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockDarkQuartz extends BlockMod {
|
||||
|
||||
private static final String[] iconNames = new String[] {"darkQuartz0", "chiseledDarkQuartz0", "pillarDarkQuartz0", null, null};
|
||||
private static final String[] iconNames = new String[]{ "darkQuartz0", "chiseledDarkQuartz0", "pillarDarkQuartz0", null, null };
|
||||
private IIcon[] darkQuartzIcons;
|
||||
private IIcon chiseledDarkQuartzIcon;
|
||||
private IIcon pillarDarkQuartzIcon;
|
||||
@@ -44,43 +44,42 @@ public class BlockDarkQuartz extends BlockMod {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
if (par2 != 2 && par2 != 3 && par2 != 4) {
|
||||
if (par1 != 1 && (par1 != 0 || par2 != 1)) {
|
||||
if (par1 == 0)
|
||||
return darkQuartzTopIcon;
|
||||
else {
|
||||
if (par2 < 0 || par2 >= darkQuartzIcons.length)
|
||||
par2 = 0;
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
if (par2 != 2 && par2 != 3 && par2 != 4) {
|
||||
if (par1 != 1 && (par1 != 0 || par2 != 1)) {
|
||||
if (par1 == 0)
|
||||
return darkQuartzTopIcon;
|
||||
else {
|
||||
if (par2 < 0 || par2 >= darkQuartzIcons.length)
|
||||
par2 = 0;
|
||||
|
||||
return darkQuartzIcons[par2];
|
||||
}
|
||||
}
|
||||
else return par2 == 1 ? chiseledDarkQuartzIcon : darkQuartzTopIcon;
|
||||
}
|
||||
else return par2 == 2 && (par1 == 1 || par1 == 0) ? pillarDarkQuartzIcon : par2 == 3 && (par1 == 5 || par1 == 4) ? pillarDarkQuartzIcon : par2 == 4 && (par1 == 2 || par1 == 3) ? pillarDarkQuartzIcon : darkQuartzIcons[par2];
|
||||
}
|
||||
return darkQuartzIcons[par2];
|
||||
}
|
||||
} else return par2 == 1 ? chiseledDarkQuartzIcon : darkQuartzTopIcon;
|
||||
} else
|
||||
return par2 == 2 && (par1 == 1 || par1 == 0) ? pillarDarkQuartzIcon : par2 == 3 && (par1 == 5 || par1 == 4) ? pillarDarkQuartzIcon : par2 == 4 && (par1 == 2 || par1 == 3) ? pillarDarkQuartzIcon : darkQuartzIcons[par2];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) {
|
||||
if (par9 == 2) {
|
||||
switch (par5) {
|
||||
case 0:
|
||||
case 1:
|
||||
par9 = 2;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
par9 = 4;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
par9 = 3;
|
||||
}
|
||||
}
|
||||
if (par9 == 2) {
|
||||
switch (par5) {
|
||||
case 0:
|
||||
case 1:
|
||||
par9 = 2;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
par9 = 4;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
par9 = 3;
|
||||
}
|
||||
}
|
||||
|
||||
return par9;
|
||||
}
|
||||
return par9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1) {
|
||||
@@ -97,9 +96,9 @@ public class BlockDarkQuartz extends BlockMod {
|
||||
return 39;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List par3List) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List par3List) {
|
||||
par3List.add(new ItemStack(this, 1, 0));
|
||||
par3List.add(new ItemStack(this, 1, 1));
|
||||
par3List.add(new ItemStack(this, 1, 2));
|
||||
|
||||
@@ -14,20 +14,19 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.block.quartz;
|
||||
|
||||
import java.util.Random;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.tinkerer.common.block.ModBlocks;
|
||||
import vazkii.tinkerer.common.core.handler.ModCreativeTab;
|
||||
import vazkii.tinkerer.common.lib.LibBlockNames;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockDarkQuartzSlab extends BlockSlab {
|
||||
|
||||
@@ -35,7 +34,7 @@ public class BlockDarkQuartzSlab extends BlockSlab {
|
||||
super(par2, Material.rock);
|
||||
setHardness(0.8F);
|
||||
setResistance(10F);
|
||||
if(!par2) {
|
||||
if (!par2) {
|
||||
setLightOpacity(0);
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
@@ -47,17 +46,16 @@ public class BlockDarkQuartzSlab extends BlockSlab {
|
||||
return ModBlocks.darkQuartz.getBlockTextureFromSide(par1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return Item.getItemFromBlock(ModBlocks.darkQuartzSlab);
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return Item.getItemFromBlock(ModBlocks.darkQuartzSlab);
|
||||
}
|
||||
|
||||
//@Override
|
||||
//@Override
|
||||
//public int idDropped(int par1, Random par2Random, int par3) {
|
||||
// return ModBlocks.darkQuartzSlab.blockID;
|
||||
//}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack createStackedBlock(int par1) {
|
||||
return new ItemStack(ModBlocks.darkQuartzSlab);
|
||||
|
||||
@@ -39,10 +39,10 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
})
|
||||
public class TileAspectAnalyzer extends TileEntity implements IInventory,SimpleComponent, IPeripheral,IMovableTile {
|
||||
public class TileAspectAnalyzer extends TileEntity implements IInventory, SimpleComponent, IPeripheral, IMovableTile {
|
||||
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
|
||||
@@ -68,7 +68,7 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory,SimpleC
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
@@ -118,15 +118,15 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory,SimpleC
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.ASPECT_ANALYZER;
|
||||
}
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.ASPECT_ANALYZER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
@@ -138,15 +138,15 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory,SimpleC
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
@@ -160,86 +160,88 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory,SimpleC
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[] { "hasItem", "itemHasAspects", "getAspects", "getAspectCount" };
|
||||
return new String[]{ "hasItem", "itemHasAspects", "getAspects", "getAspectCount" };
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
|
||||
switch(method) {
|
||||
case 0 : return hasItemMethod();
|
||||
case 1 : return itemHasAspectsMethod();
|
||||
case 2 : return getAspectsMethod();
|
||||
case 3 : return getAspectsAmountsMethod();
|
||||
}
|
||||
switch (method) {
|
||||
case 0:
|
||||
return hasItemMethod();
|
||||
case 1:
|
||||
return itemHasAspectsMethod();
|
||||
case 2:
|
||||
return getAspectsMethod();
|
||||
case 3:
|
||||
return getAspectsAmountsMethod();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object[] hasItemMethod()
|
||||
{
|
||||
ItemStack stack = getStackInSlot(0);
|
||||
return new Object[] {stack != null};
|
||||
}
|
||||
public AspectList getAspectList()
|
||||
{
|
||||
ItemStack stack = getStackInSlot(0);
|
||||
AspectList aspects = null;
|
||||
if(stack != null) {
|
||||
public Object[] hasItemMethod() {
|
||||
ItemStack stack = getStackInSlot(0);
|
||||
return new Object[]{ stack != null };
|
||||
}
|
||||
|
||||
aspects = ThaumcraftCraftingManager.getObjectTags(stack);
|
||||
aspects = ThaumcraftCraftingManager.getBonusTags(stack, aspects);
|
||||
}
|
||||
public AspectList getAspectList() {
|
||||
ItemStack stack = getStackInSlot(0);
|
||||
AspectList aspects = null;
|
||||
if (stack != null) {
|
||||
|
||||
return aspects;
|
||||
}
|
||||
public Object[] itemHasAspectsMethod()
|
||||
{
|
||||
AspectList aspects=getAspectList();
|
||||
return new Object[] { aspects != null && aspects.size() > 0 };
|
||||
}
|
||||
public Object[] getAspectsMethod()
|
||||
{
|
||||
AspectList aspects=getAspectList();
|
||||
Map<Double,String> retVals=new HashMap<Double, String>();
|
||||
if(aspects == null)
|
||||
return new Object[] {retVals};
|
||||
double i=1;
|
||||
for(Aspect aspect : aspects.getAspectsSorted())
|
||||
retVals.put(i++,aspect.getTag());
|
||||
return new Object[]{retVals};
|
||||
}
|
||||
aspects = ThaumcraftCraftingManager.getObjectTags(stack);
|
||||
aspects = ThaumcraftCraftingManager.getBonusTags(stack, aspects);
|
||||
}
|
||||
|
||||
public Object[] getAspectsAmountsMethod()
|
||||
{
|
||||
AspectList aspects=getAspectList();
|
||||
Map<String,Double> retVals=new HashMap<String,Double>();
|
||||
if(aspects == null)
|
||||
return new Object[] {retVals};
|
||||
for(Aspect aspect : aspects.getAspectsSorted())
|
||||
retVals.put(aspect.getTag(),(double)aspects.getAmount(aspect));
|
||||
return new Object[]{retVals};
|
||||
}
|
||||
return aspects;
|
||||
}
|
||||
|
||||
public Object[] itemHasAspectsMethod() {
|
||||
AspectList aspects = getAspectList();
|
||||
return new Object[]{ aspects != null && aspects.size() > 0 };
|
||||
}
|
||||
|
||||
public Object[] getAspectsMethod() {
|
||||
AspectList aspects = getAspectList();
|
||||
Map<Double, String> retVals = new HashMap<Double, String>();
|
||||
if (aspects == null)
|
||||
return new Object[]{ retVals };
|
||||
double i = 1;
|
||||
for (Aspect aspect : aspects.getAspectsSorted())
|
||||
retVals.put(i++, aspect.getTag());
|
||||
return new Object[]{ retVals };
|
||||
}
|
||||
|
||||
public Object[] getAspectsAmountsMethod() {
|
||||
AspectList aspects = getAspectList();
|
||||
Map<String, Double> retVals = new HashMap<String, Double>();
|
||||
if (aspects == null)
|
||||
return new Object[]{ retVals };
|
||||
for (Aspect aspect : aspects.getAspectsSorted())
|
||||
retVals.put(aspect.getTag(), (double) aspects.getAmount(aspect));
|
||||
return new Object[]{ retVals };
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other) {
|
||||
return this.equals((Object)other);
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other) {
|
||||
return this.equals((Object) other);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
@@ -249,41 +251,38 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory,SimpleC
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return getType();
|
||||
}
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] greet(Context context, Arguments args) {
|
||||
return new Object[]{ String.format("Hello, %s!", args.checkString(0)) };
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] greet(Context context, Arguments args) {
|
||||
return new Object[]{String.format("Hello, %s!", args.checkString(0))};
|
||||
}
|
||||
@Callback(doc = "function():boolean -- Whether this inventory contains an item")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] hasItem(Context context, Arguments args) {
|
||||
return hasItemMethod();
|
||||
}
|
||||
|
||||
@Callback(doc ="function():boolean -- Whether this inventory contains an item")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] hasItem(Context context, Arguments args)
|
||||
{
|
||||
return hasItemMethod();
|
||||
}
|
||||
@Callback(doc = "function():boolean -- Whether the item contains aspects")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] itemHasAspects(Context context, Arguments args) {
|
||||
return itemHasAspectsMethod();
|
||||
}
|
||||
|
||||
@Callback(doc ="function():boolean -- Whether the item contains aspects")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] itemHasAspects(Context context, Arguments args)
|
||||
{
|
||||
return itemHasAspectsMethod();
|
||||
}
|
||||
@Callback(doc ="function():table -- Returns a list of all available aspects")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAspects(Context context, Arguments args)
|
||||
{
|
||||
return getAspectsMethod();
|
||||
}
|
||||
@Callback(doc ="function():table -- returns a mapping of all aspect counts")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAspectCount(Context context, Arguments args)
|
||||
{
|
||||
return getAspectsAmountsMethod();
|
||||
}
|
||||
@Callback(doc = "function():table -- Returns a list of all available aspects")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAspects(Context context, Arguments args) {
|
||||
return getAspectsMethod();
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- returns a mapping of all aspect counts")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAspectCount(Context context, Arguments args) {
|
||||
return getAspectsAmountsMethod();
|
||||
}
|
||||
}
|
||||
@@ -49,10 +49,10 @@ public class TileCamo extends TileEntity implements IMovableTile {
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
if(camo!=null){
|
||||
cmp.setString(TAG_CAMO, Block.blockRegistry.getNameForObject(camo));
|
||||
cmp.setInteger(TAG_CAMO_META, camoMeta);
|
||||
}
|
||||
if (camo != null) {
|
||||
cmp.setString(TAG_CAMO, Block.blockRegistry.getNameForObject(camo));
|
||||
cmp.setInteger(TAG_CAMO_META, camoMeta);
|
||||
}
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
@@ -71,7 +71,7 @@ public class TileCamo extends TileEntity implements IMovableTile {
|
||||
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
|
||||
super.onDataPacket(manager, packet);
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord,yCoord,zCoord,xCoord,yCoord,zCoord);
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,6 +39,7 @@ import vazkii.tinkerer.common.lib.LibFeatures;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TileEnchanter extends TileEntity implements ISidedInventory, IMovableTile {
|
||||
|
||||
private static final String TAG_ENCHANTS = "enchantsIntArray";
|
||||
@@ -90,79 +91,80 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(getStackInSlot(0) == null) {
|
||||
if (getStackInSlot(0) == null) {
|
||||
enchantments.clear();
|
||||
levels.clear();
|
||||
}
|
||||
|
||||
if(working) {
|
||||
if (working) {
|
||||
ItemStack tool = getStackInSlot(0);
|
||||
if(tool == null) {
|
||||
if (tool == null) {
|
||||
working = false;
|
||||
return;
|
||||
}
|
||||
|
||||
checkPillars();
|
||||
|
||||
if(!working) // Pillar check
|
||||
if (!working) // Pillar check
|
||||
return;
|
||||
|
||||
enchantItem : {
|
||||
for(Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
|
||||
enchantItem:
|
||||
{
|
||||
for (Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
|
||||
int currentAmount = currentAspects.getAmount(aspect);
|
||||
int totalAmount = totalAspects.getAmount(aspect);
|
||||
|
||||
if(currentAmount < totalAmount)
|
||||
if (currentAmount < totalAmount)
|
||||
break enchantItem;
|
||||
}
|
||||
}
|
||||
|
||||
working = false;
|
||||
currentAspects = new AspectList();
|
||||
totalAspects = new AspectList();
|
||||
|
||||
for(int i = 0; i < enchantments.size(); i++) {
|
||||
for (int i = 0; i < enchantments.size(); i++) {
|
||||
int enchant = enchantments.get(i);
|
||||
int level = levels.get(i);
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
if (!worldObj.isRemote)
|
||||
tool.addEnchantment(Enchantment.enchantmentsList[enchant], level);
|
||||
}
|
||||
|
||||
enchantments.clear();
|
||||
levels.clear();
|
||||
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "thaumcraft:wand", 1F, 1F);
|
||||
worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack wand = getStackInSlot(1);
|
||||
|
||||
if(wand != null && wand.getItem() instanceof ItemWandCasting && !((ItemWandCasting) wand.getItem()).isStaff(wand)) {
|
||||
if (wand != null && wand.getItem() instanceof ItemWandCasting && !((ItemWandCasting) wand.getItem()).isStaff(wand)) {
|
||||
ItemWandCasting wandItem = (ItemWandCasting) wand.getItem();
|
||||
AspectList wandAspects = wandItem.getAllVis(wand);
|
||||
|
||||
int missing, onWand;
|
||||
List<Aspect> aspectsThatCanGet = new ArrayList();
|
||||
|
||||
for(Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
|
||||
for (Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
|
||||
missing = totalAspects.getAmount(aspect) - currentAspects.getAmount(aspect);
|
||||
onWand = wandAspects.getAmount(aspect);
|
||||
|
||||
if(missing > 0 && onWand >= 100)
|
||||
if (missing > 0 && onWand >= 100)
|
||||
aspectsThatCanGet.add(aspect);
|
||||
}
|
||||
|
||||
int i = aspectsThatCanGet.isEmpty() ? 0 : worldObj.rand.nextInt(aspectsThatCanGet.size());
|
||||
Aspect aspect = aspectsThatCanGet.isEmpty() ? null : aspectsThatCanGet.get(i);
|
||||
|
||||
if(aspect != null) {
|
||||
if (aspect != null) {
|
||||
wandItem.consumeAllVisCrafting(wand, null, new AspectList().add(aspect, 1), true);
|
||||
currentAspects.add(aspect, 1);
|
||||
Tuple4Int p = pillars.get(i);
|
||||
if(worldObj.rand.nextBoolean()) {
|
||||
if (worldObj.rand.nextBoolean()) {
|
||||
Thaumcraft.proxy.blockRunes(worldObj, p.i1, p.i4 - 0.75, p.i3, 0.3F + worldObj.rand.nextFloat() * 0.7F, 0.0F, 0.3F + worldObj.rand.nextFloat() * 0.7F, 15, worldObj.rand.nextFloat() / 8F);
|
||||
Thaumcraft.proxy.blockRunes(worldObj, xCoord, yCoord + 0.25, zCoord, 0.3F + worldObj.rand.nextFloat() * 0.7F, 0.0F, 0.3F + worldObj.rand.nextFloat() * 0.7F, 15, worldObj.rand.nextFloat() / 8F);
|
||||
if(worldObj.rand.nextInt(5) == 0)
|
||||
if (worldObj.rand.nextInt(5) == 0)
|
||||
worldObj.playSoundEffect(p.i1, p.i2, p.i3, "thaumcraft:brain", 0.5F, 1F);
|
||||
}
|
||||
|
||||
@@ -173,17 +175,17 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
if(!worldObj.isRemote && !working) {
|
||||
super.markDirty();
|
||||
if (!worldObj.isRemote && !working) {
|
||||
enchantments.clear();
|
||||
levels.clear();
|
||||
worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkPillars() {
|
||||
if(pillars.isEmpty()) {
|
||||
if(assignPillars()) {
|
||||
if (pillars.isEmpty()) {
|
||||
if (assignPillars()) {
|
||||
working = false;
|
||||
currentAspects = new AspectList();
|
||||
return false;
|
||||
@@ -191,13 +193,13 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
|
||||
return true;
|
||||
}
|
||||
|
||||
for(int i = 0; i < pillars.size(); i++) {
|
||||
for (int i = 0; i < pillars.size(); i++) {
|
||||
Tuple4Int pillar = pillars.get(i);
|
||||
int pillarHeight = findPillar(pillar.i1, pillar.i2, pillar.i3);
|
||||
if(pillarHeight == -1) {
|
||||
if (pillarHeight == -1) {
|
||||
pillars.clear();
|
||||
return checkPillars();
|
||||
} else if(pillarHeight != pillar.i4)
|
||||
} else if (pillarHeight != pillar.i4)
|
||||
pillar.i4 = pillarHeight;
|
||||
}
|
||||
|
||||
@@ -206,13 +208,13 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
|
||||
|
||||
public boolean assignPillars() {
|
||||
int y = yCoord;
|
||||
for(int x = xCoord - 4; x <= xCoord + 4; x++)
|
||||
for(int z = zCoord - 4; z <= zCoord + 4; z++) {
|
||||
for (int x = xCoord - 4; x <= xCoord + 4; x++)
|
||||
for (int z = zCoord - 4; z <= zCoord + 4; z++) {
|
||||
int height = findPillar(x, y, z);
|
||||
if(height != -1)
|
||||
if (height != -1)
|
||||
pillars.add(new Tuple4Int(x, y, z, height));
|
||||
|
||||
if(pillars.size() == 6)
|
||||
if (pillars.size() == 6)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -222,18 +224,18 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
|
||||
|
||||
public int findPillar(int x, int y, int z) {
|
||||
int obsidianFound = 0;
|
||||
for(int i = 0; true; i++) {
|
||||
if(y + i >= 256)
|
||||
for (int i = 0; true; i++) {
|
||||
if (y + i >= 256)
|
||||
return -1;
|
||||
|
||||
Block id = worldObj.getBlock(x, y + i, z);
|
||||
int meta = worldObj.getBlockMetadata(x, y + i, z);
|
||||
if(id == ConfigBlocks.blockCosmeticSolid && meta == 0) {
|
||||
if (id == ConfigBlocks.blockCosmeticSolid && meta == 0) {
|
||||
++obsidianFound;
|
||||
continue;
|
||||
}
|
||||
if(id == ConfigBlocks.blockAiry && meta == 1) {
|
||||
if(obsidianFound >= 2 && obsidianFound < 13)
|
||||
if (id == ConfigBlocks.blockAiry && meta == 1) {
|
||||
if (obsidianFound >= 2 && obsidianFound < 13)
|
||||
return y + i;
|
||||
return -1;
|
||||
}
|
||||
@@ -244,12 +246,12 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
|
||||
|
||||
public void updateAspectList() {
|
||||
totalAspects = new AspectList();
|
||||
for(int i = 0; i < enchantments.size(); i++) {
|
||||
for (int i = 0; i < enchantments.size(); i++) {
|
||||
int enchant = enchantments.get(i);
|
||||
int level = levels.get(i);
|
||||
|
||||
AspectList aspects = EnchantmentManager.enchantmentData.get(enchant).get(level).aspects;
|
||||
for(Aspect aspect : aspects.getAspectsSorted())
|
||||
for (Aspect aspect : aspects.getAspectsSorted())
|
||||
totalAspects.add(aspect, aspects.getAmount(aspect));
|
||||
}
|
||||
}
|
||||
@@ -274,11 +276,11 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
|
||||
totalAspects.readFromNBT(par1NBTTagCompound.getCompoundTag(TAG_TOTAL_ASPECTS));
|
||||
|
||||
enchantments.clear();
|
||||
for(int i:par1NBTTagCompound.getIntArray(TAG_ENCHANTS))
|
||||
for (int i : par1NBTTagCompound.getIntArray(TAG_ENCHANTS))
|
||||
enchantments.add(i);
|
||||
levels.clear();
|
||||
for(int i:par1NBTTagCompound.getIntArray(TAG_LEVELS))
|
||||
levels.add(i);
|
||||
levels.clear();
|
||||
for (int i : par1NBTTagCompound.getIntArray(TAG_LEVELS))
|
||||
levels.add(i);
|
||||
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
@@ -290,32 +292,31 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
|
||||
}
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
par1NBTTagCompound.setIntArray(TAG_LEVELS, ArrayUtils.toPrimitive(levels.toArray(new Integer[levels.size()])));
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
par1NBTTagCompound.setIntArray(TAG_LEVELS, ArrayUtils.toPrimitive(levels.toArray(new Integer[levels.size()])));
|
||||
|
||||
par1NBTTagCompound.setIntArray(TAG_ENCHANTS, ArrayUtils.toPrimitive(enchantments.toArray(new Integer[enchantments.size()])));
|
||||
par1NBTTagCompound.setIntArray(TAG_ENCHANTS, ArrayUtils.toPrimitive(enchantments.toArray(new Integer[enchantments.size()])));
|
||||
|
||||
NBTTagCompound totalAspectsCmp = new NBTTagCompound();
|
||||
totalAspects.writeToNBT(totalAspectsCmp);
|
||||
|
||||
NBTTagCompound totalAspectsCmp = new NBTTagCompound();
|
||||
totalAspects.writeToNBT(totalAspectsCmp);
|
||||
NBTTagCompound currentAspectsCmp = new NBTTagCompound();
|
||||
currentAspects.writeToNBT(currentAspectsCmp);
|
||||
|
||||
NBTTagCompound currentAspectsCmp = new NBTTagCompound();
|
||||
currentAspects.writeToNBT(currentAspectsCmp);
|
||||
|
||||
par1NBTTagCompound.setBoolean(TAG_WORKING, working);
|
||||
par1NBTTagCompound.setTag(TAG_TOTAL_ASPECTS, totalAspectsCmp);
|
||||
par1NBTTagCompound.setTag(TAG_CURRENT_ASPECTS, currentAspectsCmp);
|
||||
par1NBTTagCompound.setBoolean(TAG_WORKING, working);
|
||||
par1NBTTagCompound.setTag(TAG_TOTAL_ASPECTS, totalAspectsCmp);
|
||||
par1NBTTagCompound.setTag(TAG_CURRENT_ASPECTS, currentAspectsCmp);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
@@ -359,15 +360,15 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.ENCHANTER;
|
||||
}
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.ENCHANTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
@@ -379,35 +380,34 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
super.onDataPacket(net, pkt);
|
||||
readCustomNBT(pkt.func_148857_g());
|
||||
}
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
super.onDataPacket(net, pkt);
|
||||
readCustomNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord,yCoord,zCoord,-999,nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||
return new int[0];
|
||||
|
||||
@@ -19,7 +19,7 @@ public class TileEntityMobilizer extends TileEntity {
|
||||
|
||||
public int firstRelayZ;
|
||||
public int secondRelayZ;
|
||||
public boolean dead=false;
|
||||
public boolean dead = false;
|
||||
|
||||
public ForgeDirection movementDirection;
|
||||
|
||||
@@ -50,51 +50,48 @@ public class TileEntityMobilizer extends TileEntity {
|
||||
this.secondRelayX = nbt.getInteger("SecondRelayX");
|
||||
this.secondRelayZ = nbt.getInteger("SecondRelayZ");
|
||||
|
||||
movementDirection=ForgeDirection.VALID_DIRECTIONS[nbt.getInteger("Direction")];
|
||||
movementDirection = ForgeDirection.VALID_DIRECTIONS[nbt.getInteger("Direction")];
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void verifyRelay(){
|
||||
public void verifyRelay() {
|
||||
TileEntity te = worldObj.getTileEntity(firstRelayX, yCoord, firstRelayZ);
|
||||
if(te instanceof TileEntityRelay){
|
||||
if (te instanceof TileEntityRelay) {
|
||||
((TileEntityRelay) te).verifyPartner();
|
||||
}
|
||||
if(!(linked && te instanceof TileEntityRelay && ((TileEntityRelay) te).partnerX == this.secondRelayX && ((TileEntityRelay) te).partnerZ == this.secondRelayZ)){
|
||||
linked=false;
|
||||
if (!(linked && te instanceof TileEntityRelay && ((TileEntityRelay) te).partnerX == this.secondRelayX && ((TileEntityRelay) te).partnerZ == this.secondRelayZ)) {
|
||||
linked = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateEntity(){
|
||||
public void updateEntity() {
|
||||
|
||||
//Check for ghost TEs
|
||||
if(dead)
|
||||
if (dead)
|
||||
return;
|
||||
//Make sure the relays haven't been broken
|
||||
verifyRelay();
|
||||
//Bounce
|
||||
if(linked && worldObj.getTotalWorldTime()%100==0 && !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
|
||||
if (linked && worldObj.getTotalWorldTime() % 100 == 0 && !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
//Target coordinates to check
|
||||
int targetX = xCoord+movementDirection.offsetX;
|
||||
int targetZ = zCoord+movementDirection.offsetZ;
|
||||
int targetX = xCoord + movementDirection.offsetX;
|
||||
int targetZ = zCoord + movementDirection.offsetZ;
|
||||
//Switch direction if at end of track
|
||||
if(worldObj.getBlock(targetX, yCoord, targetZ) != Block.getBlockFromName("air") || worldObj.getBlock(targetX, yCoord + 1, targetZ) != Block.getBlockFromName("air")){
|
||||
if (worldObj.getBlock(targetX, yCoord, targetZ) != Block.getBlockFromName("air") || worldObj.getBlock(targetX, yCoord + 1, targetZ) != Block.getBlockFromName("air")) {
|
||||
movementDirection = movementDirection.getOpposite();
|
||||
}
|
||||
}
|
||||
//Move
|
||||
if(linked && worldObj.getTotalWorldTime()%100==1 && !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
|
||||
if (linked && worldObj.getTotalWorldTime() % 100 == 1 && !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
//Cache coordinated
|
||||
int targetX = xCoord+movementDirection.offsetX;
|
||||
int targetZ = zCoord+movementDirection.offsetZ;
|
||||
int targetX = xCoord + movementDirection.offsetX;
|
||||
int targetZ = zCoord + movementDirection.offsetZ;
|
||||
//Check for abandoned TEs
|
||||
if(worldObj.getBlock(xCoord, yCoord, zCoord) != ModBlocks.mobilizer)
|
||||
{
|
||||
if (worldObj.getBlock(xCoord, yCoord, zCoord) != ModBlocks.mobilizer) {
|
||||
return;
|
||||
}
|
||||
//Check if the space the mobilizer will move into is empty
|
||||
if((worldObj.isAirBlock(targetX, yCoord, targetZ) || worldObj.getBlock(targetX, yCoord, targetZ).isAir(worldObj, targetX, yCoord, targetZ)
|
||||
&& (worldObj.isAirBlock(xCoord, yCoord+1, zCoord) || worldObj.isAirBlock(targetX, yCoord+1, targetZ)|| worldObj.getBlock(targetX, yCoord+1, targetZ).isAir(worldObj, targetX, yCoord+1, targetZ)))){
|
||||
if ((worldObj.isAirBlock(targetX, yCoord, targetZ) || worldObj.getBlock(targetX, yCoord, targetZ).isAir(worldObj, targetX, yCoord, targetZ)
|
||||
&& (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord) || worldObj.isAirBlock(targetX, yCoord + 1, targetZ) || worldObj.getBlock(targetX, yCoord + 1, targetZ).isAir(worldObj, targetX, yCoord + 1, targetZ)))) {
|
||||
|
||||
//Move Entities
|
||||
//List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+3, zCoord+1));
|
||||
@@ -104,56 +101,55 @@ public class TileEntityMobilizer extends TileEntity {
|
||||
//}
|
||||
|
||||
//Move the block on top of the mobilizer
|
||||
if(!worldObj.isRemote){
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
TileEntity passenger = worldObj.getTileEntity(xCoord, yCoord+1, zCoord);
|
||||
TileEntity passenger = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
|
||||
IAppEngApi api = AEApi.instance();
|
||||
|
||||
//Prevent the passenger from popping off. Not sent to clients.
|
||||
worldObj.setBlock(targetX, yCoord, targetZ, Block.getBlockFromName("stone"), 0, 0);
|
||||
//Move non-TE blocks
|
||||
Block passengerId=worldObj.getBlock(xCoord, yCoord+1, zCoord);
|
||||
Block passengerId = worldObj.getBlock(xCoord, yCoord + 1, zCoord);
|
||||
|
||||
if(worldObj.isAirBlock(xCoord, yCoord+1, zCoord) || passengerId.canPlaceBlockAt(worldObj, targetX, yCoord+1, targetZ)){
|
||||
if (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord) || passengerId.canPlaceBlockAt(worldObj, targetX, yCoord + 1, targetZ)) {
|
||||
|
||||
if(passenger==null){
|
||||
if(passengerId !=Block.getBlockFromName("bedrock") && passengerId != Block.getBlockFromName("")){
|
||||
worldObj.setBlock(targetX, yCoord+1, targetZ, passengerId, worldObj.getBlockMetadata(xCoord, yCoord+1, zCoord), 3);
|
||||
if(passengerId != Block.getBlockFromName("air") && passengerId != Block.getBlockFromName("piston_head")){
|
||||
worldObj.setBlock(xCoord, yCoord+1, zCoord, Block.getBlockFromName("air"), 0, 2);
|
||||
if (passenger == null) {
|
||||
if (passengerId != Block.getBlockFromName("bedrock") && passengerId != Block.getBlockFromName("")) {
|
||||
worldObj.setBlock(targetX, yCoord + 1, targetZ, passengerId, worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3);
|
||||
if (passengerId != Block.getBlockFromName("air") && passengerId != Block.getBlockFromName("piston_head")) {
|
||||
worldObj.setBlock(xCoord, yCoord + 1, zCoord, Block.getBlockFromName("air"), 0, 2);
|
||||
}
|
||||
}
|
||||
//If AE is installed, use its handler
|
||||
}else if(api != null){
|
||||
if(api.registries().moveable().askToMove(passenger)){
|
||||
} else if (api != null) {
|
||||
if (api.registries().moveable().askToMove(passenger)) {
|
||||
worldObj.setBlock(targetX, yCoord + 1, targetZ, worldObj.getBlock(xCoord, yCoord + 1, zCoord), worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3);
|
||||
passenger.invalidate();
|
||||
worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord);
|
||||
api.registries().moveable().getHandler(passenger).moveTile(passenger, worldObj, targetX, yCoord+1, targetZ);
|
||||
api.registries().moveable().getHandler(passenger).moveTile(passenger, worldObj, targetX, yCoord + 1, targetZ);
|
||||
api.registries().moveable().doneMoving(passenger);
|
||||
passenger.validate();
|
||||
}
|
||||
|
||||
//Handler IMovableTiles and vanilla TEs without AE
|
||||
}else if(passenger instanceof IMovableTile ||passenger.getClass().getName().startsWith("net.minecraft.tileentity")){
|
||||
boolean imovable=passenger instanceof IMovableTile;
|
||||
if(imovable)
|
||||
} else if (passenger instanceof IMovableTile || passenger.getClass().getName().startsWith("net.minecraft.tileentity")) {
|
||||
boolean imovable = passenger instanceof IMovableTile;
|
||||
if (imovable)
|
||||
((IMovableTile) passenger).prepareToMove();
|
||||
worldObj.setBlock(targetX, yCoord + 1, targetZ, worldObj.getBlock(xCoord, yCoord + 1, zCoord), worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3);
|
||||
passenger.invalidate();
|
||||
worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord);
|
||||
|
||||
//IMovableHandler default code
|
||||
Chunk c = worldObj.getChunkFromBlockCoords( targetX, targetZ );
|
||||
Chunk c = worldObj.getChunkFromBlockCoords(targetX, targetZ);
|
||||
|
||||
c.func_150812_a( targetX & 0xF, yCoord+1, targetZ & 0xF, passenger );
|
||||
c.func_150812_a(targetX & 0xF, yCoord + 1, targetZ & 0xF, passenger);
|
||||
|
||||
if ( c.isChunkLoaded )
|
||||
{
|
||||
if (c.isChunkLoaded) {
|
||||
worldObj.addTileEntity(passenger);
|
||||
worldObj.markBlockForUpdate(targetX, yCoord+1, targetZ);
|
||||
worldObj.markBlockForUpdate(targetX, yCoord + 1, targetZ);
|
||||
}
|
||||
if(imovable)
|
||||
if (imovable)
|
||||
((IMovableTile) passenger).doneMoving();
|
||||
passenger.validate();
|
||||
|
||||
@@ -165,16 +161,15 @@ public class TileEntityMobilizer extends TileEntity {
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord, Block.getBlockFromName("air"), 0, 2);
|
||||
worldObj.setBlock(targetX, yCoord, targetZ, ModBlocks.mobilizer);
|
||||
|
||||
int oldX=xCoord;
|
||||
int oldZ=zCoord;
|
||||
int oldX = xCoord;
|
||||
int oldZ = zCoord;
|
||||
|
||||
this.xCoord=targetX;
|
||||
this.zCoord=targetZ;
|
||||
this.xCoord = targetX;
|
||||
this.zCoord = targetZ;
|
||||
this.validate();
|
||||
worldObj.addTileEntity(this);
|
||||
worldObj.removeTileEntity(oldX, yCoord, oldZ);
|
||||
|
||||
|
||||
worldObj.notifyBlockChange(oldX, yCoord, oldZ, Block.getBlockFromName("air"));
|
||||
|
||||
}
|
||||
|
||||
@@ -8,15 +8,13 @@ import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
|
||||
public class TileEntityRelay extends TileEntity implements IMovableTile {
|
||||
|
||||
|
||||
public TileEntityRelay() {
|
||||
}
|
||||
|
||||
|
||||
public void verifyPartner(){
|
||||
public void verifyPartner() {
|
||||
TileEntity te = worldObj.getTileEntity(partnerX, yCoord, partnerZ);
|
||||
if(!(hasPartner && te instanceof TileEntityRelay && ((TileEntityRelay) te).partnerX == this.xCoord && ((TileEntityRelay) te).partnerZ == this.zCoord)){
|
||||
hasPartner=false;
|
||||
if (!(hasPartner && te instanceof TileEntityRelay && ((TileEntityRelay) te).partnerX == this.xCoord && ((TileEntityRelay) te).partnerZ == this.zCoord)) {
|
||||
hasPartner = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +33,10 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
hasPartner=nbt.getBoolean("HasPartner");
|
||||
hasPartner = nbt.getBoolean("HasPartner");
|
||||
|
||||
partnerX=nbt.getInteger("PartnerX");
|
||||
partnerZ=nbt.getInteger("PartnerZ");
|
||||
partnerX = nbt.getInteger("PartnerX");
|
||||
partnerZ = nbt.getInteger("PartnerZ");
|
||||
}
|
||||
|
||||
public boolean hasPartner;
|
||||
@@ -50,41 +48,41 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
|
||||
public void updateEntity() {
|
||||
|
||||
verifyPartner();
|
||||
if(hasPartner){
|
||||
int i=xCoord;
|
||||
if (hasPartner) {
|
||||
int i = xCoord;
|
||||
int j;
|
||||
do{
|
||||
j=zCoord;
|
||||
do{
|
||||
float xInc=0;
|
||||
float zInc=0;
|
||||
if(partnerZ - zCoord != 0){
|
||||
zInc = ((float) Math.copySign(.05, partnerZ-zCoord))*(worldObj.getTotalWorldTime() % 20);
|
||||
do {
|
||||
j = zCoord;
|
||||
do {
|
||||
float xInc = 0;
|
||||
float zInc = 0;
|
||||
if (partnerZ - zCoord != 0) {
|
||||
zInc = ((float) Math.copySign(.05, partnerZ - zCoord)) * (worldObj.getTotalWorldTime() % 20);
|
||||
}
|
||||
|
||||
if(partnerX - xCoord != 0){
|
||||
xInc = ((float) Math.copySign(.05, partnerX-xCoord))*(worldObj.getTotalWorldTime() % 20);
|
||||
if (partnerX - xCoord != 0) {
|
||||
xInc = ((float) Math.copySign(.05, partnerX - xCoord)) * (worldObj.getTotalWorldTime() % 20);
|
||||
}
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) (0.5 + i + xInc), (float) (yCoord+0.5), (float) (j + 0.5 + zInc), xCoord < partnerX || zCoord > partnerX ? 2 : 14);
|
||||
j+=Math.copySign(1,partnerZ-zCoord);
|
||||
}while (j < partnerZ);
|
||||
i+=Math.copySign(1, partnerX-xCoord);
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) (0.5 + i + xInc), (float) (yCoord + 0.5), (float) (j + 0.5 + zInc), xCoord < partnerX || zCoord > partnerX ? 2 : 14);
|
||||
j += Math.copySign(1, partnerZ - zCoord);
|
||||
} while (j < partnerZ);
|
||||
i += Math.copySign(1, partnerX - xCoord);
|
||||
|
||||
}while (i < partnerX);
|
||||
} while (i < partnerX);
|
||||
}
|
||||
if(worldObj.getTotalWorldTime()%40==0){
|
||||
if (worldObj.getTotalWorldTime() % 40 == 0) {
|
||||
checkForPartner();
|
||||
}
|
||||
int i=xCoord;
|
||||
if(hasPartner && worldObj.getTotalWorldTime()%40==0){
|
||||
do{
|
||||
int i = xCoord;
|
||||
if (hasPartner && worldObj.getTotalWorldTime() % 40 == 0) {
|
||||
do {
|
||||
|
||||
int j=zCoord;
|
||||
do{
|
||||
if(worldObj.getTileEntity(i, yCoord, j) instanceof TileEntityMobilizer){
|
||||
int j = zCoord;
|
||||
do {
|
||||
if (worldObj.getTileEntity(i, yCoord, j) instanceof TileEntityMobilizer) {
|
||||
TileEntityMobilizer te = (TileEntityMobilizer) worldObj.getTileEntity(i, yCoord, j);
|
||||
te.verifyRelay();
|
||||
if(!te.linked){
|
||||
if (!te.linked) {
|
||||
te.firstRelayX = xCoord;
|
||||
te.firstRelayZ = zCoord;
|
||||
|
||||
@@ -93,29 +91,29 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
|
||||
|
||||
te.linked = true;
|
||||
|
||||
if(xCoord != partnerX){
|
||||
if (xCoord != partnerX) {
|
||||
te.movementDirection = ForgeDirection.EAST;
|
||||
}else{
|
||||
} else {
|
||||
te.movementDirection = ForgeDirection.NORTH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
j+=Math.copySign(1,partnerZ-zCoord);
|
||||
}while (j < partnerZ);
|
||||
i+=Math.copySign(1, partnerX-xCoord);
|
||||
}while (i < partnerX);
|
||||
j += Math.copySign(1, partnerZ - zCoord);
|
||||
} while (j < partnerZ);
|
||||
i += Math.copySign(1, partnerX - xCoord);
|
||||
} while (i < partnerX);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkForPartner(){
|
||||
if(!hasPartner){
|
||||
for(int i=-32;i<32;i++){
|
||||
if(i!=0){
|
||||
TileEntity te = worldObj.getTileEntity(xCoord, yCoord, zCoord+i);
|
||||
public void checkForPartner() {
|
||||
if (!hasPartner) {
|
||||
for (int i = -32; i < 32; i++) {
|
||||
if (i != 0) {
|
||||
TileEntity te = worldObj.getTileEntity(xCoord, yCoord, zCoord + i);
|
||||
setPartners(te);
|
||||
|
||||
te = worldObj.getTileEntity(xCoord+i, yCoord, zCoord);
|
||||
te = worldObj.getTileEntity(xCoord + i, yCoord, zCoord);
|
||||
setPartners(te);
|
||||
}
|
||||
}
|
||||
@@ -123,14 +121,14 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
|
||||
}
|
||||
|
||||
private void setPartners(TileEntity te) {
|
||||
if(te instanceof TileEntityRelay){
|
||||
((TileEntityRelay) te).partnerX=this.xCoord;
|
||||
((TileEntityRelay) te).partnerZ=this.zCoord;
|
||||
this.partnerX=te.xCoord;
|
||||
this.partnerZ=te.zCoord;
|
||||
if (te instanceof TileEntityRelay) {
|
||||
((TileEntityRelay) te).partnerX = this.xCoord;
|
||||
((TileEntityRelay) te).partnerZ = this.zCoord;
|
||||
this.partnerX = te.xCoord;
|
||||
this.partnerZ = te.zCoord;
|
||||
|
||||
this.hasPartner=true;
|
||||
((TileEntityRelay) te).hasPartner=true;
|
||||
this.hasPartner = true;
|
||||
((TileEntityRelay) te).hasPartner = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,23 +44,23 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
ItemStack jar = getStackInSlot(0);
|
||||
if(jar != null && jar.getItem() instanceof ItemJarFilled) {
|
||||
if(!worldObj.isRemote) {
|
||||
if (jar != null && jar.getItem() instanceof ItemJarFilled) {
|
||||
if (!worldObj.isRemote) {
|
||||
ItemJarFilled item = (ItemJarFilled) jar.getItem();
|
||||
|
||||
|
||||
AspectList aspectList = item.getAspects(jar);
|
||||
if(aspectList != null && aspectList.size() == 1) {
|
||||
if (aspectList != null && aspectList.size() == 1) {
|
||||
Aspect aspect = aspectList.getAspects()[0];
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
|
||||
if(tile != null && tile instanceof TileEntityHopper) {
|
||||
if (tile != null && tile instanceof TileEntityHopper) {
|
||||
TileEntity tile1 = getHopperFacing(tile.xCoord, tile.yCoord, tile.zCoord, tile.getBlockMetadata());
|
||||
if(tile1 instanceof TileJarFillable) {
|
||||
if (tile1 instanceof TileJarFillable) {
|
||||
TileJarFillable jar1 = (TileJarFillable) tile1;
|
||||
boolean voidJar=tile1 instanceof TileJarFillableVoid;
|
||||
boolean voidJar = tile1 instanceof TileJarFillableVoid;
|
||||
AspectList aspectList1 = jar1.getAspects();
|
||||
//noinspection ConstantConditions
|
||||
if(aspectList1 != null && aspectList1.size() == 0 && (jar1.aspectFilter==null || jar1.aspectFilter==aspect) || aspectList1.getAspects()[0] == aspect && (aspectList1.getAmount(aspectList1.getAspects()[0]) < 64 || voidJar)) {
|
||||
if (aspectList1 != null && aspectList1.size() == 0 && (jar1.aspectFilter == null || jar1.aspectFilter == aspect) || aspectList1.getAspects()[0] == aspect && (aspectList1.getAmount(aspectList1.getAspects()[0]) < 64 || voidJar)) {
|
||||
jar1.addToContainer(aspect, 1);
|
||||
item.setAspects(jar, aspectList.remove(aspect, 1));
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
private TileEntity getHopperFacing(int x, int y, int z, int meta) {
|
||||
@@ -112,7 +112,7 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
@@ -128,17 +128,17 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
AspectList aspects = getAspects();
|
||||
//if(inventorySlots[i] != null && inventorySlots[i].itemID == ConfigItems.itemJarFilled.itemID && aspects == null) {
|
||||
// Aspect filter=((ItemJarFilled)inventorySlots[i].getItem()).getFilter(inventorySlots[i]);
|
||||
// inventorySlots[i] = new ItemStack(ConfigBlocks.blockJar,1,inventorySlots[i].getItemDamage());
|
||||
// if(filter!=null)
|
||||
// {
|
||||
// if(inventorySlots[i].getTagCompound()==null)
|
||||
// inventorySlots[i].setTagCompound(new NBTTagCompound());
|
||||
// inventorySlots[i].getTagCompound().setString("AspectFilter",filter.getTag());
|
||||
// }
|
||||
// onInventoryChanged();
|
||||
//}
|
||||
//if(inventorySlots[i] != null && inventorySlots[i].itemID == ConfigItems.itemJarFilled.itemID && aspects == null) {
|
||||
// Aspect filter=((ItemJarFilled)inventorySlots[i].getItem()).getFilter(inventorySlots[i]);
|
||||
// inventorySlots[i] = new ItemStack(ConfigBlocks.blockJar,1,inventorySlots[i].getItemDamage());
|
||||
// if(filter!=null)
|
||||
// {
|
||||
// if(inventorySlots[i].getTagCompound()==null)
|
||||
// inventorySlots[i].setTagCompound(new NBTTagCompound());
|
||||
// inventorySlots[i].getTagCompound().setString("AspectFilter",filter.getTag());
|
||||
// }
|
||||
// onInventoryChanged();
|
||||
//}
|
||||
|
||||
return inventorySlots[i];
|
||||
}
|
||||
@@ -175,17 +175,17 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.FUNNEL;
|
||||
}
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.FUNNEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
@@ -195,17 +195,17 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||
return var1 == ForgeDirection.DOWN.ordinal() ? new int[0] : new int[] { 0 };
|
||||
return var1 == ForgeDirection.DOWN.ordinal() ? new int[0] : new int[]{ 0 };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -245,7 +245,8 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAspects(AspectList paramAspectList) { }
|
||||
public void setAspects(AspectList paramAspectList) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerAccept(Aspect paramAspect) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package vazkii.tinkerer.common.block.tile;
|
||||
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
@@ -19,465 +18,458 @@ import vazkii.tinkerer.common.core.golems.EnumGolemCores;
|
||||
import vazkii.tinkerer.common.core.golems.EnumGolemDecorations;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
})
|
||||
public class TileGolemConnector extends TileCamo implements IPeripheral,SimpleComponent {
|
||||
private static final String TAG_UUID_MOST = "UUIDMost";
|
||||
private static final String TAG_UUID_LEAST = "UUIDLeast";
|
||||
public UUID golemConnected;
|
||||
public EntityGolemBase golem;
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void verifyGolem() {
|
||||
if (golemConnected == null)
|
||||
return;
|
||||
List list = this.worldObj.getEntitiesWithinAABB(EntityGolemBase.class,
|
||||
AxisAlignedBB.getBoundingBox(xCoord - 30, yCoord - 30,
|
||||
zCoord - 30, xCoord + 30, yCoord + 30, zCoord + 30)
|
||||
);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityGolemBase entityGolem = (EntityGolemBase) iterator.next();
|
||||
|
||||
if (entityGolem.getUniqueID().equals(golemConnected)) {
|
||||
this.golem = entityGolem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "tt_golemconnector";
|
||||
}
|
||||
|
||||
|
||||
public Object[] getGolemDecorationsImplementation() throws Exception {
|
||||
if (golem == null || golem.decoration == null || golem.decoration.length() == 0)
|
||||
return new String[]{};
|
||||
HashMap<Double, String> decorations = new HashMap<Double, String>();
|
||||
for (int i = 0; i < golem.decoration.length(); i++) {
|
||||
EnumGolemDecorations golemDec = EnumGolemDecorations.getFromChar(golem.decoration.charAt(i));
|
||||
if (golemDec == null)
|
||||
throw new Exception("Golem is wearing unknown accessory: " + golem.decoration.charAt(i));
|
||||
decorations.put((double) i, StatCollector.translateToLocal(golemDec.getName()));
|
||||
}
|
||||
|
||||
return new Object[]{decorations};
|
||||
|
||||
}
|
||||
|
||||
public String[] getGolemCoreImplementation() throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
if (golem.getCore() == -1)
|
||||
return new String[]{StatCollector.translateToLocal("item.ItemGolemCore.100.name")};
|
||||
String[] decorations = new String[1];
|
||||
EnumGolemCores golemCore = EnumGolemCores.getFromByte(golem.getCore());
|
||||
if (golemCore == null)
|
||||
throw new Exception("Golem has Unknown core: " + golem.getCore());
|
||||
decorations[0] = StatCollector.translateToLocal(golemCore.getName());
|
||||
|
||||
return decorations;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
super.writeCustomNBT(cmp);
|
||||
if (golemConnected != null) {
|
||||
cmp.setLong(TAG_UUID_MOST, golemConnected.getMostSignificantBits());
|
||||
cmp.setLong(TAG_UUID_LEAST, golemConnected.getLeastSignificantBits());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (worldObj.getTotalWorldTime() % 100 == 1) {
|
||||
verifyGolem();
|
||||
}
|
||||
}
|
||||
|
||||
public void ConnectGolem(UUID golemID) {
|
||||
golemConnected = golemID;
|
||||
if (golemID == null)
|
||||
golem = null;
|
||||
else {
|
||||
verifyGolem();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
super.readCustomNBT(cmp);
|
||||
if (cmp.hasKey(TAG_UUID_LEAST) && cmp.hasKey(TAG_UUID_MOST)) {
|
||||
golemConnected = new UUID(cmp.getLong(TAG_UUID_MOST), cmp.getLong(TAG_UUID_LEAST));
|
||||
//verifyGolem();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[]{"getDecorations", "getPosition", "getType", "getHealth", "getCore", "getHome", "setHome", "getMarkers", "setMarkers", "newMarker", "addMarker", "saveMarker", "deleteMarker", "getMarker", "getMarkerCount"};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context,
|
||||
int method, Object[] arguments) throws Exception {
|
||||
switch (method) {
|
||||
case 0:
|
||||
return getGolemDecorationsImplementation();
|
||||
case 1:
|
||||
if (golem == null)
|
||||
return new Integer[]{};
|
||||
return new Integer[]{(int) golem.posX, (int) golem.posY, (int) golem.posZ};
|
||||
case 2:
|
||||
return getGolemTypeImplementation();
|
||||
case 3:
|
||||
if (golem == null)
|
||||
return new Float[]{};
|
||||
return new Float[]{golem.getHealth()};
|
||||
case 4:
|
||||
return getGolemCoreImplementation();
|
||||
case 5:
|
||||
return getHomeImplementation();
|
||||
case 6:
|
||||
if (arguments.length != 4)
|
||||
throw new Exception("Invalid arguments");
|
||||
double x=(Double)arguments[0];
|
||||
double y=(Double)arguments[0];
|
||||
double z=(Double)arguments[0];
|
||||
double facing=(Double)arguments[0];
|
||||
return setHomeImplementation(x,y,z,facing);
|
||||
case 7:
|
||||
return getMarkersImplementation();
|
||||
case 8:
|
||||
if (arguments.length != 1)
|
||||
throw new Exception("setMarkers takes 1 argument");
|
||||
return setMarkersImplementation((HashMap<Double, HashMap<String, Object>>) arguments[0]);
|
||||
case 9:
|
||||
return newMarkerImplementation();
|
||||
case 10:
|
||||
if (arguments.length != 1)
|
||||
throw new Exception("addMarker must have 1 argument");
|
||||
return addMarkerImplementation((Map)arguments[0]);
|
||||
case 11:
|
||||
if (arguments.length != 2)
|
||||
throw new Exception("saveMarker must have 2 arguments");
|
||||
return saveMarkerImplementation((Double)arguments[0],(Map)arguments[1]);
|
||||
case 12:
|
||||
if (arguments.length != 1)
|
||||
throw new Exception("deleteMarker must have 1 argument");
|
||||
return deleteMarkerImplementation((Double) arguments[0]);
|
||||
case 13:
|
||||
if (arguments.length != 1)
|
||||
throw new Exception("getMarker must have 1 argument");
|
||||
return getMarkerImplementation((Double)arguments[0]);
|
||||
case 14:
|
||||
return getMarkerCountImplementation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object[] getMarkerCountImplementation() {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null)
|
||||
return new Object[]{ 0 };
|
||||
return new Object[]{(double) markers.size()};
|
||||
}
|
||||
|
||||
private Object[] getMarkerImplementation(Double arguments) throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null || markers.size() <= arguments)
|
||||
throw new Exception("marker " + (int) (double) arguments + " does not exist");
|
||||
Marker mark = markers.get((int) (double) arguments);
|
||||
|
||||
return new Object[]{fromMarkerImplementation(mark)};
|
||||
}
|
||||
|
||||
private Object[] deleteMarkerImplementation(double arguments) throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null || markers.size() <= arguments)
|
||||
throw new Exception("marker " + (int) (double) arguments + " does not exist");
|
||||
markers.remove((int) (double) arguments);
|
||||
golem.setMarkers(markers);
|
||||
return new String[]{};
|
||||
}
|
||||
|
||||
private Object[] saveMarkerImplementation(double markerNum,Map markerArg) throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null || markers.size() <= markerNum)
|
||||
throw new Exception("marker " + (int) (double) markerNum + " does not exist");
|
||||
Marker mark = toMarkerImplementation(markerArg);
|
||||
markers.set((int) (double) markerNum, mark);
|
||||
golem.setMarkers(markers);
|
||||
return getMarkerImplementation(markerNum);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object[] addMarkerImplementation(Map arguments) throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null)
|
||||
markers = new ArrayList<Marker>();
|
||||
Marker mark = toMarkerImplementation(arguments);
|
||||
markers.add(mark);
|
||||
golem.setMarkers(markers);
|
||||
return getMarkerImplementation((double)(markers.size() - 1));
|
||||
}
|
||||
|
||||
private Object[] newMarkerImplementation() {
|
||||
HashMap<String, Object> mark = new HashMap<String, Object>();
|
||||
mark.put("posX", xCoord);
|
||||
mark.put("posY", yCoord);
|
||||
mark.put("posZ", zCoord);
|
||||
mark.put("dim", this.worldObj.provider.dimensionId);
|
||||
mark.put("color", -1);
|
||||
mark.put("side", 1);
|
||||
return new Object[]{mark};
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object[] setMarkersImplementation(Map arguments) throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
|
||||
ArrayList<Marker> arrList = new ArrayList<Marker>();
|
||||
|
||||
for (Object map : arguments.values()) {
|
||||
Marker mark = toMarkerImplementation((Map) map);
|
||||
|
||||
arrList.add(mark);
|
||||
|
||||
}
|
||||
golem.setMarkers(arrList);
|
||||
return getMarkersImplementation();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param markerMap
|
||||
* @return
|
||||
*/
|
||||
private Marker toMarkerImplementation(Map markerMap) {
|
||||
double posX = (Double) markerMap.get("posX");
|
||||
double posY = (Double) markerMap.get("posY");
|
||||
double posZ = (Double) markerMap.get("posZ");
|
||||
double dim = (Double) markerMap.get("dim");
|
||||
double side = (Double) markerMap.get("side");
|
||||
double color = (Double) markerMap.get("color");
|
||||
return new Marker((int) posX, (int) posY, (int) posZ, (int) dim, (byte) side, (byte) color);
|
||||
}
|
||||
|
||||
private Object[] getMarkersImplementation() {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
HashMap<Integer, HashMap<String, Object>> luaMarkers = new HashMap<Integer, HashMap<String, Object>>();
|
||||
int i = 1;
|
||||
for (Marker mark : markers) {
|
||||
HashMap<String, Object> luaMarker = fromMarkerImplementation(mark);
|
||||
luaMarkers.put(i++, luaMarker);
|
||||
}
|
||||
return new Object[]{luaMarkers};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mark
|
||||
* @return
|
||||
*/
|
||||
private HashMap<String, Object> fromMarkerImplementation(Marker mark) {
|
||||
HashMap<String, Object> luaMarker = new HashMap<String, Object>();
|
||||
|
||||
luaMarker.put("posX", mark.x);
|
||||
luaMarker.put("posY", mark.y);
|
||||
luaMarker.put("posZ", mark.z);
|
||||
luaMarker.put("dim", mark.dim);
|
||||
luaMarker.put("color", mark.color);
|
||||
luaMarker.put("side", mark.side);
|
||||
return luaMarker;
|
||||
}
|
||||
|
||||
private Object[] setHomeImplementation(double x,double y,double z,double facing) throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
|
||||
golem.setHomeArea((int) x, (int) y, (int) z, 35);
|
||||
golem.homeFacing = (int) facing;
|
||||
return getHomeImplementation();
|
||||
}
|
||||
|
||||
private Object[] getHomeImplementation() {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ChunkCoordinates home = golem.getHomePosition();
|
||||
return new Integer[]{home.posX, home.posY, home.posZ, golem.homeFacing};
|
||||
}
|
||||
|
||||
private String[] getGolemTypeImplementation() throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
switch (golem.getGolemType()) {
|
||||
case CLAY:
|
||||
return new String[]{"Clay"};
|
||||
case FLESH:
|
||||
return new String[]{"Flesh"};
|
||||
case IRON:
|
||||
return new String[]{"Iron"};
|
||||
case STONE:
|
||||
return new String[]{"Stone"};
|
||||
case STRAW:
|
||||
return new String[]{"Straw"};
|
||||
case TALLOW:
|
||||
return new String[]{"Tallow"};
|
||||
case THAUMIUM:
|
||||
return new String[]{"Thaumium"};
|
||||
case WOOD:
|
||||
return new String[]{"Wood"};
|
||||
default:
|
||||
throw new Exception("Unknown Golem Type: " + golem.getGolemType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other) {
|
||||
return this.equals((Object) other);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return getType();
|
||||
}
|
||||
|
||||
|
||||
@Callback(doc = "function():table -- Returns table of current decorations on golem")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getDecorations(Context context, Arguments args) throws Exception {
|
||||
return getGolemDecorationsImplementation();
|
||||
}
|
||||
|
||||
|
||||
@Callback(doc = "function():x:number,y:number,z:number -- Returns The golems current position")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getPosition(Context context, Arguments args) {
|
||||
return new Double[]{golem.posX, golem.posY, golem.posZ};
|
||||
}
|
||||
|
||||
|
||||
@Callback(doc = "function():string -- Returns The golems type")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getType(Context context, Arguments args) throws Exception {
|
||||
return getGolemTypeImplementation();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Callback(doc = "function():number -- Returns The golems health")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getHealth(Context context, Arguments args) throws Exception {
|
||||
return new Float[]{golem.getHealth()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():string -- Returns The golems core")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCore(Context context, Arguments args) throws Exception {
|
||||
return getGolemCoreImplementation();
|
||||
}
|
||||
|
||||
|
||||
@Callback(doc = "function():x:number,y:number,z:number,facing:number -- Returns The golems home position")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getHome(Context context, Arguments args) throws Exception {
|
||||
return getHomeImplementation();
|
||||
}
|
||||
@Callback(doc = "function(x:number,y:number,z:number,facing:number):nill -- Sets The golems home position")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setHome(Context context, Arguments args) throws Exception {
|
||||
return setHomeImplementation(args.checkDouble(0),args.checkDouble(1),args.checkDouble(2),args.checkDouble(3));
|
||||
}
|
||||
|
||||
|
||||
@Callback(doc = "function():table -- Gets list of markers")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMarkers(Context context, Arguments args) throws Exception {
|
||||
return getMarkersImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function(list:table):table -- Sets list of markers")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setMarkers(Context context, Arguments args) throws Exception {
|
||||
return setMarkersImplementation(args.checkTable(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Returns a blank marker with sensible defaults")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] newMarker(Context context, Arguments args) throws Exception {
|
||||
return newMarkerImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function(marker:table):table -- Adds the marker to the end of the marker list")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] addMarker(Context context, Arguments args) throws Exception {
|
||||
return addMarkerImplementation(args.checkTable(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function(markerNum:number,marker:table):table -- saves current marker")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] saveMarker(Context context, Arguments args) throws Exception {
|
||||
return saveMarkerImplementation((double)args.checkInteger(0),args.checkTable(0));
|
||||
}
|
||||
@Callback(doc = "function(markerNum:number):table -- Deletes marker number")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] deleteMarker(Context context, Arguments args) throws Exception {
|
||||
return deleteMarkerImplementation((double)args.checkInteger(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function(markerNum:number):table -- gets a specific marker")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMarker(Context context, Arguments args) throws Exception {
|
||||
return getMarkerImplementation((double)args.checkInteger(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Returns number of markers")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMarkerCount(Context context, Arguments args) throws Exception {
|
||||
return getMarkerCountImplementation();
|
||||
}
|
||||
|
||||
}
|
||||
public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleComponent {
|
||||
private static final String TAG_UUID_MOST = "UUIDMost";
|
||||
private static final String TAG_UUID_LEAST = "UUIDLeast";
|
||||
public UUID golemConnected;
|
||||
public EntityGolemBase golem;
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void verifyGolem() {
|
||||
if (golemConnected == null)
|
||||
return;
|
||||
List list = this.worldObj.getEntitiesWithinAABB(EntityGolemBase.class,
|
||||
AxisAlignedBB.getBoundingBox(xCoord - 30, yCoord - 30,
|
||||
zCoord - 30, xCoord + 30, yCoord + 30, zCoord + 30)
|
||||
);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityGolemBase entityGolem = (EntityGolemBase) iterator.next();
|
||||
|
||||
if (entityGolem.getUniqueID().equals(golemConnected)) {
|
||||
this.golem = entityGolem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "tt_golemconnector";
|
||||
}
|
||||
|
||||
public Object[] getGolemDecorationsImplementation() throws Exception {
|
||||
if (golem == null || golem.decoration == null || golem.decoration.length() == 0)
|
||||
return new String[]{ };
|
||||
HashMap<Double, String> decorations = new HashMap<Double, String>();
|
||||
for (int i = 0; i < golem.decoration.length(); i++) {
|
||||
EnumGolemDecorations golemDec = EnumGolemDecorations.getFromChar(golem.decoration.charAt(i));
|
||||
if (golemDec == null)
|
||||
throw new Exception("Golem is wearing unknown accessory: " + golem.decoration.charAt(i));
|
||||
decorations.put((double) i, StatCollector.translateToLocal(golemDec.getName()));
|
||||
}
|
||||
|
||||
return new Object[]{ decorations };
|
||||
|
||||
}
|
||||
|
||||
public String[] getGolemCoreImplementation() throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
if (golem.getCore() == -1)
|
||||
return new String[]{ StatCollector.translateToLocal("item.ItemGolemCore.100.name") };
|
||||
String[] decorations = new String[1];
|
||||
EnumGolemCores golemCore = EnumGolemCores.getFromByte(golem.getCore());
|
||||
if (golemCore == null)
|
||||
throw new Exception("Golem has Unknown core: " + golem.getCore());
|
||||
decorations[0] = StatCollector.translateToLocal(golemCore.getName());
|
||||
|
||||
return decorations;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
super.writeCustomNBT(cmp);
|
||||
if (golemConnected != null) {
|
||||
cmp.setLong(TAG_UUID_MOST, golemConnected.getMostSignificantBits());
|
||||
cmp.setLong(TAG_UUID_LEAST, golemConnected.getLeastSignificantBits());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (worldObj.getTotalWorldTime() % 100 == 1) {
|
||||
verifyGolem();
|
||||
}
|
||||
}
|
||||
|
||||
public void ConnectGolem(UUID golemID) {
|
||||
golemConnected = golemID;
|
||||
if (golemID == null)
|
||||
golem = null;
|
||||
else {
|
||||
verifyGolem();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
super.readCustomNBT(cmp);
|
||||
if (cmp.hasKey(TAG_UUID_LEAST) && cmp.hasKey(TAG_UUID_MOST)) {
|
||||
golemConnected = new UUID(cmp.getLong(TAG_UUID_MOST), cmp.getLong(TAG_UUID_LEAST));
|
||||
//verifyGolem();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[]{ "getDecorations", "getPosition", "getType", "getHealth", "getCore", "getHome", "setHome", "getMarkers", "setMarkers", "newMarker", "addMarker", "saveMarker", "deleteMarker", "getMarker", "getMarkerCount" };
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context,
|
||||
int method, Object[] arguments) throws Exception {
|
||||
switch (method) {
|
||||
case 0:
|
||||
return getGolemDecorationsImplementation();
|
||||
case 1:
|
||||
if (golem == null)
|
||||
return new Integer[]{ };
|
||||
return new Integer[]{ (int) golem.posX, (int) golem.posY, (int) golem.posZ };
|
||||
case 2:
|
||||
return getGolemTypeImplementation();
|
||||
case 3:
|
||||
if (golem == null)
|
||||
return new Float[]{ };
|
||||
return new Float[]{ golem.getHealth() };
|
||||
case 4:
|
||||
return getGolemCoreImplementation();
|
||||
case 5:
|
||||
return getHomeImplementation();
|
||||
case 6:
|
||||
if (arguments.length != 4)
|
||||
throw new Exception("Invalid arguments");
|
||||
double x = (Double) arguments[0];
|
||||
double y = (Double) arguments[0];
|
||||
double z = (Double) arguments[0];
|
||||
double facing = (Double) arguments[0];
|
||||
return setHomeImplementation(x, y, z, facing);
|
||||
case 7:
|
||||
return getMarkersImplementation();
|
||||
case 8:
|
||||
if (arguments.length != 1)
|
||||
throw new Exception("setMarkers takes 1 argument");
|
||||
return setMarkersImplementation((HashMap<Double, HashMap<String, Object>>) arguments[0]);
|
||||
case 9:
|
||||
return newMarkerImplementation();
|
||||
case 10:
|
||||
if (arguments.length != 1)
|
||||
throw new Exception("addMarker must have 1 argument");
|
||||
return addMarkerImplementation((Map) arguments[0]);
|
||||
case 11:
|
||||
if (arguments.length != 2)
|
||||
throw new Exception("saveMarker must have 2 arguments");
|
||||
return saveMarkerImplementation((Double) arguments[0], (Map) arguments[1]);
|
||||
case 12:
|
||||
if (arguments.length != 1)
|
||||
throw new Exception("deleteMarker must have 1 argument");
|
||||
return deleteMarkerImplementation((Double) arguments[0]);
|
||||
case 13:
|
||||
if (arguments.length != 1)
|
||||
throw new Exception("getMarker must have 1 argument");
|
||||
return getMarkerImplementation((Double) arguments[0]);
|
||||
case 14:
|
||||
return getMarkerCountImplementation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object[] getMarkerCountImplementation() {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null)
|
||||
return new Object[]{ 0 };
|
||||
return new Object[]{ (double) markers.size() };
|
||||
}
|
||||
|
||||
private Object[] getMarkerImplementation(Double arguments) throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null || markers.size() <= arguments)
|
||||
throw new Exception("marker " + (int) (double) arguments + " does not exist");
|
||||
Marker mark = markers.get((int) (double) arguments);
|
||||
|
||||
return new Object[]{ fromMarkerImplementation(mark) };
|
||||
}
|
||||
|
||||
private Object[] deleteMarkerImplementation(double arguments) throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null || markers.size() <= arguments)
|
||||
throw new Exception("marker " + (int) (double) arguments + " does not exist");
|
||||
markers.remove((int) (double) arguments);
|
||||
golem.setMarkers(markers);
|
||||
return new String[]{ };
|
||||
}
|
||||
|
||||
private Object[] saveMarkerImplementation(double markerNum, Map markerArg) throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null || markers.size() <= markerNum)
|
||||
throw new Exception("marker " + (int) (double) markerNum + " does not exist");
|
||||
Marker mark = toMarkerImplementation(markerArg);
|
||||
markers.set((int) (double) markerNum, mark);
|
||||
golem.setMarkers(markers);
|
||||
return getMarkerImplementation(markerNum);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object[] addMarkerImplementation(Map arguments) throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null)
|
||||
markers = new ArrayList<Marker>();
|
||||
Marker mark = toMarkerImplementation(arguments);
|
||||
markers.add(mark);
|
||||
golem.setMarkers(markers);
|
||||
return getMarkerImplementation((double) (markers.size() - 1));
|
||||
}
|
||||
|
||||
private Object[] newMarkerImplementation() {
|
||||
HashMap<String, Object> mark = new HashMap<String, Object>();
|
||||
mark.put("posX", xCoord);
|
||||
mark.put("posY", yCoord);
|
||||
mark.put("posZ", zCoord);
|
||||
mark.put("dim", this.worldObj.provider.dimensionId);
|
||||
mark.put("color", -1);
|
||||
mark.put("side", 1);
|
||||
return new Object[]{ mark };
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object[] setMarkersImplementation(Map arguments) throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
|
||||
ArrayList<Marker> arrList = new ArrayList<Marker>();
|
||||
|
||||
for (Object map : arguments.values()) {
|
||||
Marker mark = toMarkerImplementation((Map) map);
|
||||
|
||||
arrList.add(mark);
|
||||
|
||||
}
|
||||
golem.setMarkers(arrList);
|
||||
return getMarkersImplementation();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param markerMap
|
||||
* @return
|
||||
*/
|
||||
private Marker toMarkerImplementation(Map markerMap) {
|
||||
double posX = (Double) markerMap.get("posX");
|
||||
double posY = (Double) markerMap.get("posY");
|
||||
double posZ = (Double) markerMap.get("posZ");
|
||||
double dim = (Double) markerMap.get("dim");
|
||||
double side = (Double) markerMap.get("side");
|
||||
double color = (Double) markerMap.get("color");
|
||||
return new Marker((int) posX, (int) posY, (int) posZ, (int) dim, (byte) side, (byte) color);
|
||||
}
|
||||
|
||||
private Object[] getMarkersImplementation() {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
HashMap<Integer, HashMap<String, Object>> luaMarkers = new HashMap<Integer, HashMap<String, Object>>();
|
||||
int i = 1;
|
||||
for (Marker mark : markers) {
|
||||
HashMap<String, Object> luaMarker = fromMarkerImplementation(mark);
|
||||
luaMarkers.put(i++, luaMarker);
|
||||
}
|
||||
return new Object[]{ luaMarkers };
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mark
|
||||
* @return
|
||||
*/
|
||||
private HashMap<String, Object> fromMarkerImplementation(Marker mark) {
|
||||
HashMap<String, Object> luaMarker = new HashMap<String, Object>();
|
||||
|
||||
luaMarker.put("posX", mark.x);
|
||||
luaMarker.put("posY", mark.y);
|
||||
luaMarker.put("posZ", mark.z);
|
||||
luaMarker.put("dim", mark.dim);
|
||||
luaMarker.put("color", mark.color);
|
||||
luaMarker.put("side", mark.side);
|
||||
return luaMarker;
|
||||
}
|
||||
|
||||
private Object[] setHomeImplementation(double x, double y, double z, double facing) throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
|
||||
golem.setHomeArea((int) x, (int) y, (int) z, 35);
|
||||
golem.homeFacing = (int) facing;
|
||||
return getHomeImplementation();
|
||||
}
|
||||
|
||||
private Object[] getHomeImplementation() {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ChunkCoordinates home = golem.getHomePosition();
|
||||
return new Integer[]{ home.posX, home.posY, home.posZ, golem.homeFacing };
|
||||
}
|
||||
|
||||
private String[] getGolemTypeImplementation() throws Exception {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
switch (golem.getGolemType()) {
|
||||
case CLAY:
|
||||
return new String[]{ "Clay" };
|
||||
case FLESH:
|
||||
return new String[]{ "Flesh" };
|
||||
case IRON:
|
||||
return new String[]{ "Iron" };
|
||||
case STONE:
|
||||
return new String[]{ "Stone" };
|
||||
case STRAW:
|
||||
return new String[]{ "Straw" };
|
||||
case TALLOW:
|
||||
return new String[]{ "Tallow" };
|
||||
case THAUMIUM:
|
||||
return new String[]{ "Thaumium" };
|
||||
case WOOD:
|
||||
return new String[]{ "Wood" };
|
||||
default:
|
||||
throw new Exception("Unknown Golem Type: " + golem.getGolemType());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other) {
|
||||
return this.equals((Object) other);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return getType();
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Returns table of current decorations on golem")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getDecorations(Context context, Arguments args) throws Exception {
|
||||
return getGolemDecorationsImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function():x:number,y:number,z:number -- Returns The golems current position")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getPosition(Context context, Arguments args) {
|
||||
return new Double[]{ golem.posX, golem.posY, golem.posZ };
|
||||
}
|
||||
|
||||
@Callback(doc = "function():string -- Returns The golems type")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getType(Context context, Arguments args) throws Exception {
|
||||
return getGolemTypeImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Returns The golems health")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getHealth(Context context, Arguments args) throws Exception {
|
||||
return new Float[]{ golem.getHealth() };
|
||||
}
|
||||
|
||||
@Callback(doc = "function():string -- Returns The golems core")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCore(Context context, Arguments args) throws Exception {
|
||||
return getGolemCoreImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function():x:number,y:number,z:number,facing:number -- Returns The golems home position")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getHome(Context context, Arguments args) throws Exception {
|
||||
return getHomeImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function(x:number,y:number,z:number,facing:number):nill -- Sets The golems home position")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setHome(Context context, Arguments args) throws Exception {
|
||||
return setHomeImplementation(args.checkDouble(0), args.checkDouble(1), args.checkDouble(2), args.checkDouble(3));
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Gets list of markers")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMarkers(Context context, Arguments args) throws Exception {
|
||||
return getMarkersImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function(list:table):table -- Sets list of markers")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setMarkers(Context context, Arguments args) throws Exception {
|
||||
return setMarkersImplementation(args.checkTable(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Returns a blank marker with sensible defaults")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] newMarker(Context context, Arguments args) throws Exception {
|
||||
return newMarkerImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function(marker:table):table -- Adds the marker to the end of the marker list")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] addMarker(Context context, Arguments args) throws Exception {
|
||||
return addMarkerImplementation(args.checkTable(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function(markerNum:number,marker:table):table -- saves current marker")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] saveMarker(Context context, Arguments args) throws Exception {
|
||||
return saveMarkerImplementation((double) args.checkInteger(0), args.checkTable(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function(markerNum:number):table -- Deletes marker number")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] deleteMarker(Context context, Arguments args) throws Exception {
|
||||
return deleteMarkerImplementation((double) args.checkInteger(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function(markerNum:number):table -- gets a specific marker")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMarker(Context context, Arguments args) throws Exception {
|
||||
return getMarkerImplementation((double) args.checkInteger(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Returns number of markers")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMarkerCount(Context context, Arguments args) throws Exception {
|
||||
return getMarkerCountImplementation();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,43 +34,44 @@ import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.common.core.helper.MiscHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
})
|
||||
public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile,SimpleComponent {
|
||||
public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile, SimpleComponent {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
int redstone = 0;
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()));
|
||||
|
||||
if(redstone > 0) {
|
||||
if (redstone > 0) {
|
||||
double x1 = xCoord + 0.5;
|
||||
double y1 = yCoord + 0.5;
|
||||
double z1 = zCoord + 0.5;
|
||||
|
||||
boolean blue = (getBlockMetadata() & 1) == 0;
|
||||
int speedMod = blue ? 1 : -1;
|
||||
double range = redstone / 2;
|
||||
int speedMod = blue ? 1 : -1;
|
||||
double range = redstone / 2;
|
||||
|
||||
AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x1 - range, yCoord, z1 - range, x1 + range, y1 + range, z1 + range);
|
||||
List<Entity> entities = worldObj.selectEntitiesWithinAABB(Entity.class, boundingBox, getEntitySelector());
|
||||
AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x1 - range, yCoord, z1 - range, x1 + range, y1 + range, z1 + range);
|
||||
List<Entity> entities = worldObj.selectEntitiesWithinAABB(Entity.class, boundingBox, getEntitySelector());
|
||||
|
||||
for(Entity entity : entities) {
|
||||
double x2 = entity.posX;
|
||||
double y2 = entity.posY;
|
||||
double z2 = entity.posZ;
|
||||
for (Entity entity : entities) {
|
||||
double x2 = entity.posX;
|
||||
double y2 = entity.posY;
|
||||
double z2 = entity.posZ;
|
||||
|
||||
float distanceSqrd = blue ? (float) ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2)) : 1.1F;
|
||||
float distanceSqrd = blue ? (float) ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2)) : 1.1F;
|
||||
|
||||
if(distanceSqrd > 1) {
|
||||
MiscHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), speedMod * 0.25F);
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (distanceSqrd > 1) {
|
||||
MiscHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), speedMod * 0.25F);
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IEntitySelector getEntitySelector() {
|
||||
@@ -91,57 +92,58 @@ public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile,
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[] { "isPulling", "setPulling", "getSignal" };
|
||||
return new String[]{ "isPulling", "setPulling", "getSignal" };
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
|
||||
switch(method) {
|
||||
case 0 : return new Object[] { (getBlockMetadata() & 1) == 0 };
|
||||
case 1 :
|
||||
return setPullingImplementation((Boolean)arguments[0]);
|
||||
case 2 :
|
||||
return gotSignalImplementation();
|
||||
}
|
||||
switch (method) {
|
||||
case 0:
|
||||
return new Object[]{ (getBlockMetadata() & 1) == 0 };
|
||||
case 1:
|
||||
return setPullingImplementation((Boolean) arguments[0]);
|
||||
case 2:
|
||||
return gotSignalImplementation();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object[] gotSignalImplementation() {
|
||||
int redstone = 0;
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()));
|
||||
private Object[] gotSignalImplementation() {
|
||||
int redstone = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()));
|
||||
|
||||
return new Object[] { redstone };
|
||||
}
|
||||
return new Object[]{ redstone };
|
||||
}
|
||||
|
||||
private Object[] setPullingImplementation(boolean argument) {
|
||||
int meta = (getBlockMetadata() & 2) + (argument ? 0 : 1);
|
||||
private Object[] setPullingImplementation(boolean argument) {
|
||||
int meta = (getBlockMetadata() & 2) + (argument ? 0 : 1);
|
||||
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta, 1 | 2);
|
||||
return null;
|
||||
}
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta, 1 | 2);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other) {
|
||||
return this.equals((Object)other);
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other) {
|
||||
return this.equals((Object) other);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
@@ -151,26 +153,27 @@ public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile,
|
||||
|
||||
}
|
||||
|
||||
@Callback(doc = "function():boolean -- Returns Whether magnet is pushing or pulling")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] isPulling(Context context, Arguments args) throws Exception {
|
||||
return new Object[]{(getBlockMetadata() & 1) == 0};
|
||||
}
|
||||
@Callback(doc = "function():boolean -- Returns Whether magnet is pushing or pulling")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] isPulling(Context context, Arguments args) throws Exception {
|
||||
return new Object[]{ (getBlockMetadata() & 1) == 0 };
|
||||
}
|
||||
|
||||
@Callback(doc = "function(boolean):nil -- Sets Whether magnet is pushing or pulling")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setPulling(Context context, Arguments args) throws Exception {
|
||||
setPullingImplementation(args.checkBoolean(0));
|
||||
return new Object[]{};
|
||||
}
|
||||
@Callback(doc = "function(boolean):nil -- Sets Whether magnet is pushing or pulling")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setPulling(Context context, Arguments args) throws Exception {
|
||||
setPullingImplementation(args.checkBoolean(0));
|
||||
return new Object[]{ };
|
||||
}
|
||||
|
||||
@Callback(doc = "function():boolean -- Sets Whether magnet is pushing or pulling")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getSignal(Context context, Arguments args) throws Exception {
|
||||
return gotSignalImplementation();
|
||||
}
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return this.getType();
|
||||
}
|
||||
@Callback(doc = "function():boolean -- Sets Whether magnet is pushing or pulling")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getSignal(Context context, Arguments args) throws Exception {
|
||||
return gotSignalImplementation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return this.getType();
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ import net.minecraftforge.common.util.Constants;
|
||||
import vazkii.tinkerer.common.item.ItemSoulMould;
|
||||
import vazkii.tinkerer.common.lib.LibBlockNames;
|
||||
|
||||
public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTile {
|
||||
public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTile {
|
||||
|
||||
private static final String TAG_ADULT = "adultCheck";
|
||||
|
||||
@@ -51,15 +51,15 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTi
|
||||
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity entity) {
|
||||
if(!(entity instanceof EntityLivingBase) || entity instanceof EntityPlayer)
|
||||
if (!(entity instanceof EntityLivingBase) || entity instanceof EntityPlayer)
|
||||
return false;
|
||||
|
||||
boolean can = false;
|
||||
if(entity instanceof EntityAgeable)
|
||||
if (entity instanceof EntityAgeable)
|
||||
can = adult != ((EntityAgeable) entity).isChild();
|
||||
else can = true;
|
||||
|
||||
if(can && inventorySlots[0] != null) {
|
||||
if (can && inventorySlots[0] != null) {
|
||||
String pattern = ItemSoulMould.getPatternName(inventorySlots[0]);
|
||||
String name = EntityList.getEntityString(entity);
|
||||
return name != null && name.equals(pattern);
|
||||
@@ -76,7 +76,6 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTi
|
||||
|
||||
readCustomNBT(par1NBTTagCompound);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,34 +84,33 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTi
|
||||
|
||||
writeCustomNBT(par1NBTTagCompound);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
adult = par1NBTTagCompound.getBoolean(TAG_ADULT);
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < inventorySlots.length)
|
||||
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < inventorySlots.length)
|
||||
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
par1NBTTagCompound.setBoolean(TAG_ADULT, adult);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
@@ -124,13 +122,13 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTi
|
||||
return inventorySlots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
//markDirty();
|
||||
}
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
//markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
@@ -138,14 +136,14 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTi
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
markDirty();
|
||||
markDirty();
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
markDirty();
|
||||
markDirty();
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
@@ -161,18 +159,19 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTi
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
markDirty();
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.MAGNET;
|
||||
}
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.MAGNET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
@@ -183,15 +182,16 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTi
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
@@ -199,39 +199,42 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTi
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[] { "isPulling", "setPulling", "getSignal", "getAdultSearch", "setAdultSearch" };
|
||||
return new String[]{ "isPulling", "setPulling", "getSignal", "getAdultSearch", "setAdultSearch" };
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
|
||||
switch(method) {
|
||||
case 3 : return new Object[] { adult };
|
||||
case 4 :
|
||||
return setAdultSearchImplementation((Boolean) arguments[0]);
|
||||
}
|
||||
switch (method) {
|
||||
case 3:
|
||||
return new Object[]{ adult };
|
||||
case 4:
|
||||
return setAdultSearchImplementation((Boolean) arguments[0]);
|
||||
}
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
}
|
||||
|
||||
private Object[] setAdultSearchImplementation(boolean argument) {
|
||||
private Object[] setAdultSearchImplementation(boolean argument) {
|
||||
|
||||
this.adult = argument;
|
||||
worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
|
||||
return null;
|
||||
}
|
||||
@Callback(doc = "function():boolean -- Gets Whether magnet is searching for adults")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAdultSearch(Context context, Arguments args) throws Exception {
|
||||
return new Object[]{adult};
|
||||
}
|
||||
this.adult = argument;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Callback(doc = "function(boolean):nil -- Sets Whether magnet is searching for adults")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setAdultSearch(Context context, Arguments args) throws Exception {
|
||||
setAdultSearchImplementation(args.checkBoolean(0));
|
||||
return new Object[]{};
|
||||
}
|
||||
@Override
|
||||
@Callback(doc = "function():boolean -- Gets Whether magnet is searching for adults")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAdultSearch(Context context, Arguments args) throws Exception {
|
||||
return new Object[]{ adult };
|
||||
}
|
||||
|
||||
@Callback(doc = "function(boolean):nil -- Sets Whether magnet is searching for adults")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setAdultSearch(Context context, Arguments args) throws Exception {
|
||||
setAdultSearchImplementation(args.checkBoolean(0));
|
||||
return new Object[]{ };
|
||||
}
|
||||
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
x * This class was created by <Vazkii>. It's distributed as
|
||||
x * This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
@@ -58,35 +58,32 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(++ticksExisted % 10 == 0) {
|
||||
if(Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools)
|
||||
{
|
||||
if(inventorySlots[0] != null)
|
||||
{
|
||||
if(TinkersConstructCompat.isTConstructTool(inventorySlots[0]))
|
||||
{
|
||||
int dmg=TinkersConstructCompat.getDamage(inventorySlots[0]);
|
||||
if( dmg > 0) {
|
||||
if (++ticksExisted % 10 == 0) {
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (inventorySlots[0] != null) {
|
||||
if (TinkersConstructCompat.isTConstructTool(inventorySlots[0])) {
|
||||
int dmg = TinkersConstructCompat.getDamage(inventorySlots[0]);
|
||||
if (dmg > 0) {
|
||||
int essentia = drawEssentia();
|
||||
TinkersConstructCompat.fixDamage(inventorySlots[0], essentia);
|
||||
markDirty();
|
||||
if(dmgLastTick != 0 && dmgLastTick != dmg) {
|
||||
if (dmgLastTick != 0 && dmgLastTick != dmg) {
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) (xCoord + 0.25 + Math.random() / 2F), (float) (yCoord + 1 + Math.random() / 2F), (float) (zCoord + 0.25 + Math.random() / 2F), 0);
|
||||
tookLastTick = true;
|
||||
} else tookLastTick = false;
|
||||
} else tookLastTick=false;
|
||||
} else tookLastTick = false;
|
||||
dmgLastTick = inventorySlots[0] == null ? 0 : TinkersConstructCompat.getDamage(inventorySlots[0]);
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(inventorySlots[0] != null && inventorySlots[0].getItemDamage() > 0) {
|
||||
if (inventorySlots[0] != null && inventorySlots[0].getItemDamage() > 0) {
|
||||
int essentia = drawEssentia();
|
||||
int dmg = inventorySlots[0].getItemDamage();
|
||||
inventorySlots[0].setItemDamage(Math.max(0, dmg - essentia));
|
||||
markDirty();
|
||||
|
||||
if(dmgLastTick != 0 && dmgLastTick != dmg) {
|
||||
if (dmgLastTick != 0 && dmgLastTick != dmg) {
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) (xCoord + 0.25 + Math.random() / 2F), (float) (yCoord + 1 + Math.random() / 2F), (float) (zCoord + 0.25 + Math.random() / 2F), 0);
|
||||
tookLastTick = true;
|
||||
} else tookLastTick = false;
|
||||
@@ -112,25 +109,23 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect
|
||||
|
||||
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[1];
|
||||
|
||||
if(nbttaglist.tagCount()>0)
|
||||
{
|
||||
NBTTagCompound tagList = nbttaglist.getCompoundTagAt(0);
|
||||
inventorySlots[0] = ItemStack.loadItemStackFromNBT(tagList);
|
||||
}
|
||||
inventorySlots = new ItemStack[1];
|
||||
|
||||
if (nbttaglist.tagCount() > 0) {
|
||||
NBTTagCompound tagList = nbttaglist.getCompoundTagAt(0);
|
||||
inventorySlots[0] = ItemStack.loadItemStackFromNBT(tagList);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
if (inventorySlots[0] != null)
|
||||
{
|
||||
NBTTagCompound tagList = new NBTTagCompound();
|
||||
tagList.setByte("Slot", (byte) 0);
|
||||
inventorySlots[0].writeToNBT(tagList);
|
||||
nbttaglist.appendTag(tagList);
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", nbttaglist);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
if (inventorySlots[0] != null) {
|
||||
NBTTagCompound tagList = new NBTTagCompound();
|
||||
tagList.setByte("Slot", (byte) 0);
|
||||
inventorySlots[0].writeToNBT(tagList);
|
||||
nbttaglist.appendTag(tagList);
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", nbttaglist);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,15 +170,15 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.REPAIRER;
|
||||
}
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.REPAIRER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
@@ -195,15 +190,15 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
@@ -226,21 +221,19 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||
return new int[] { 0 };
|
||||
return new int[]{ 0 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
if(Loader.isModLoaded("TConstruct")&& ConfigHandler.repairTConTools)
|
||||
{
|
||||
if(TinkersConstructCompat.isTConstructTool(itemstack))
|
||||
{
|
||||
return itemstack!=null;
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (TinkersConstructCompat.isTConstructTool(itemstack)) {
|
||||
return itemstack != null;
|
||||
}
|
||||
}
|
||||
return itemstack != null && itemstack.getItem().isRepairable();
|
||||
@@ -252,39 +245,39 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect
|
||||
}
|
||||
|
||||
int drawEssentia() {
|
||||
ForgeDirection orientation = getOrientation();
|
||||
TileEntity te = ThaumcraftApiHelper.getConnectableTile(worldObj, xCoord, yCoord, zCoord,orientation);
|
||||
ForgeDirection orientation = getOrientation();
|
||||
TileEntity te = ThaumcraftApiHelper.getConnectableTile(worldObj, xCoord, yCoord, zCoord, orientation);
|
||||
if (te != null) {
|
||||
IEssentiaTransport ic = (IEssentiaTransport)te;
|
||||
if (!ic.canOutputTo(orientation.getOpposite()))
|
||||
IEssentiaTransport ic = (IEssentiaTransport) te;
|
||||
if (!ic.canOutputTo(orientation.getOpposite()))
|
||||
return 0;
|
||||
|
||||
for(Aspect aspect : repairValues.keySet())
|
||||
if(ic.getSuctionType(orientation.getOpposite()) == aspect && ic.getSuctionAmount(orientation.getOpposite()) < getSuctionAmount(orientation) && ic.takeEssentia(aspect, 1,orientation.getOpposite()) == 1)
|
||||
for (Aspect aspect : repairValues.keySet())
|
||||
if (ic.getSuctionType(orientation.getOpposite()) == aspect && ic.getSuctionAmount(orientation.getOpposite()) < getSuctionAmount(orientation) && ic.takeEssentia(aspect, 1, orientation.getOpposite()) == 1)
|
||||
return repairValues.get(aspect);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ForgeDirection getOrientation() {
|
||||
ForgeDirection getOrientation() {
|
||||
return ForgeDirection.getOrientation(getBlockMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects() {
|
||||
ItemStack stack = inventorySlots[0];
|
||||
if(stack == null)
|
||||
if (stack == null)
|
||||
return null;
|
||||
if(Loader.isModLoaded("TConstruct")&& ConfigHandler.repairTConTools)
|
||||
{
|
||||
if(TinkersConstructCompat.isTConstructTool(stack))
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (TinkersConstructCompat.isTConstructTool(stack))
|
||||
return new AspectList().add(Aspect.ENTROPY, TinkersConstructCompat.getDamage(stack));
|
||||
}
|
||||
return new AspectList().add(Aspect.ENTROPY, stack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAspects(AspectList paramAspectList) { }
|
||||
public void setAspects(AspectList paramAspectList) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerAccept(Aspect paramAspect) {
|
||||
@@ -338,10 +331,11 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSuction(Aspect paramAspect, int paramInt) { }
|
||||
public void setSuction(Aspect paramAspect, int paramInt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int takeEssentia(Aspect paramAspect, int paramInt,ForgeDirection direction) {
|
||||
public int takeEssentia(Aspect paramAspect, int paramInt, ForgeDirection direction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -354,9 +348,9 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect
|
||||
public boolean renderExtendedTube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int addEssentia(Aspect arg0, int arg1,ForgeDirection direction) {
|
||||
public int addEssentia(Aspect arg0, int arg1, ForgeDirection direction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,26 +17,26 @@ import java.util.Arrays;
|
||||
public class TileSummon extends TileEntity {
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
if(worldObj.getTotalWorldTime()%300==0){
|
||||
public void updateEntity() {
|
||||
if (worldObj.getTotalWorldTime() % 300 == 0) {
|
||||
ArrayList<TileEntity> pedestals = new ArrayList<TileEntity>();
|
||||
for(int x=xCoord-5;x<xCoord+5;x++){
|
||||
for(int z=zCoord-5;z<zCoord+5;z++){
|
||||
for (int x = xCoord - 5; x < xCoord + 5; x++) {
|
||||
for (int z = zCoord - 5; z < zCoord + 5; z++) {
|
||||
TileEntity tile = worldObj.getTileEntity(x, yCoord, z);
|
||||
if(tile instanceof TilePedestal && ((TilePedestal) tile).getStackInSlot(0) != null && ((TilePedestal) tile).getStackInSlot(0).getItem() instanceof ItemMobAspect){
|
||||
if (tile instanceof TilePedestal && ((TilePedestal) tile).getStackInSlot(0) != null && ((TilePedestal) tile).getStackInSlot(0).getItem() instanceof ItemMobAspect) {
|
||||
pedestals.add(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<pedestals.size();i++){
|
||||
for(int j=0;j<pedestals.size();j++){
|
||||
for(int k=0;k<pedestals.size();k++){
|
||||
TilePedestal ped1= (TilePedestal) pedestals.get(i);
|
||||
TilePedestal ped2= (TilePedestal) pedestals.get(j);
|
||||
TilePedestal ped3= (TilePedestal) pedestals.get(k);
|
||||
for (int i = 0; i < pedestals.size(); i++) {
|
||||
for (int j = 0; j < pedestals.size(); j++) {
|
||||
for (int k = 0; k < pedestals.size(); k++) {
|
||||
TilePedestal ped1 = (TilePedestal) pedestals.get(i);
|
||||
TilePedestal ped2 = (TilePedestal) pedestals.get(j);
|
||||
TilePedestal ped3 = (TilePedestal) pedestals.get(k);
|
||||
|
||||
if((ped1!=ped2) && (ped2!=ped3) && (ped1!=ped3)){
|
||||
if ((ped1 != ped2) && (ped2 != ped3) && (ped1 != ped3)) {
|
||||
ArrayList<Aspect> aspects = new ArrayList<Aspect>();
|
||||
aspects.add(ModItems.mobAspect.getAspect(ped1.getStackInSlot(0)));
|
||||
|
||||
@@ -44,27 +44,27 @@ public class TileSummon extends TileEntity {
|
||||
|
||||
aspects.add(ModItems.mobAspect.getAspect(ped3.getStackInSlot(0)));
|
||||
|
||||
for(EnumMobAspect recipe:EnumMobAspect.values()){
|
||||
if(Arrays.asList(recipe.aspects).containsAll(aspects) && aspects.containsAll(Arrays.asList(recipe.aspects))){
|
||||
for (EnumMobAspect recipe : EnumMobAspect.values()) {
|
||||
if (Arrays.asList(recipe.aspects).containsAll(aspects) && aspects.containsAll(Arrays.asList(recipe.aspects))) {
|
||||
|
||||
boolean isInfused=ModItems.mobAspect.isInfused(ped1.getStackInSlot(0)) &&
|
||||
boolean isInfused = ModItems.mobAspect.isInfused(ped1.getStackInSlot(0)) &&
|
||||
ModItems.mobAspect.isInfused(ped2.getStackInSlot(0)) &&
|
||||
ModItems.mobAspect.isInfused(ped3.getStackInSlot(0));
|
||||
|
||||
if(isInfused && worldObj.getTotalWorldTime()%1200!=0){
|
||||
if (isInfused && worldObj.getTotalWorldTime() % 1200 != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isInfused){
|
||||
if (!isInfused) {
|
||||
ped1.setInventorySlotContents(0, null);
|
||||
ped2.setInventorySlotContents(0, null);
|
||||
ped3.setInventorySlotContents(0, null);
|
||||
}
|
||||
|
||||
try {
|
||||
if(!worldObj.isRemote){
|
||||
if (!worldObj.isRemote) {
|
||||
Entity spawn = (Entity) recipe.entity.getDeclaredConstructor(World.class).newInstance(worldObj);
|
||||
spawn.setLocationAndAngles(xCoord+.5, yCoord+1, zCoord+.5, 0, 0);
|
||||
spawn.setLocationAndAngles(xCoord + .5, yCoord + 1, zCoord + .5, 0, 0);
|
||||
worldObj.spawnEntityInWorld(spawn);
|
||||
}
|
||||
|
||||
@@ -82,14 +82,11 @@ public class TileSummon extends TileEntity {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,5 +96,4 @@ public class TileSummon extends TileEntity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+19
-19
@@ -41,31 +41,31 @@ public class ContainerAnimationTablet extends ContainerPlayerInv {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot)inventorySlots.get(par2);
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
if (var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
|
||||
var3 = var5.copy();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 < 1) {
|
||||
if(!mergeItemStack(var5, 1, 37, false))
|
||||
return null;
|
||||
} else if(!mergeItemStack(var5, 0, 1, false))
|
||||
return null;
|
||||
if (par2 < 1) {
|
||||
if (!mergeItemStack(var5, 1, 37, false))
|
||||
return null;
|
||||
} else if (!mergeItemStack(var5, 0, 1, false))
|
||||
return null;
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
var4.putStack(null);
|
||||
else
|
||||
var4.onSlotChanged();
|
||||
if (var5.stackSize == 0)
|
||||
var4.putStack(null);
|
||||
else
|
||||
var4.onSlotChanged();
|
||||
|
||||
if (var5.stackSize == var3.stackSize)
|
||||
return null;
|
||||
if (var5.stackSize == var3.stackSize)
|
||||
return null;
|
||||
|
||||
var4.onPickupFromSlot(par1EntityPlayer, var5);
|
||||
}
|
||||
var4.onPickupFromSlot(par1EntityPlayer, var5);
|
||||
}
|
||||
|
||||
return var3;
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -49,13 +49,13 @@ public class ContainerAspectAnalyzer extends ContainerPlayerInv {
|
||||
if (var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
|
||||
if(par2 == 0 || var5 != null && slot.isItemValid(var5)) {
|
||||
if (par2 == 0 || var5 != null && slot.isItemValid(var5)) {
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 < 1) {
|
||||
if(!mergeItemStack(var5, 1, 37, false))
|
||||
if (!mergeItemStack(var5, 1, 37, false))
|
||||
return null;
|
||||
} else if(!mergeItemStack(var5, 0, 1, false))
|
||||
} else if (!mergeItemStack(var5, 0, 1, false))
|
||||
return null;
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
|
||||
@@ -39,38 +39,38 @@ public class ContainerEnchanter extends ContainerPlayerInv {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot)inventorySlots.get(par2);
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
if (var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
|
||||
if(var5 != null && var5.getItem() == Items.book)
|
||||
return null;
|
||||
if (var5 != null && var5.getItem() == Items.book)
|
||||
return null;
|
||||
|
||||
boolean wand = ((Slot) inventorySlots.get(1)).isItemValid(var5);
|
||||
boolean wand = ((Slot) inventorySlots.get(1)).isItemValid(var5);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
var3 = var5.copy();
|
||||
//noinspection ConstantConditions
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 < 2) {
|
||||
if(!mergeItemStack(var5, 2, 38, false))
|
||||
return null;
|
||||
} else if(wand ? !mergeItemStack(var5, 1, 2, false) : var5.getItem().isItemTool(var5) && !mergeItemStack(var5, 0, 1, false))
|
||||
return null;
|
||||
if (par2 < 2) {
|
||||
if (!mergeItemStack(var5, 2, 38, false))
|
||||
return null;
|
||||
} else if (wand ? !mergeItemStack(var5, 1, 2, false) : var5.getItem().isItemTool(var5) && !mergeItemStack(var5, 0, 1, false))
|
||||
return null;
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
var4.putStack(null);
|
||||
else
|
||||
var4.onSlotChanged();
|
||||
if (var5.stackSize == 0)
|
||||
var4.putStack(null);
|
||||
else
|
||||
var4.onSlotChanged();
|
||||
|
||||
if (var5.stackSize == var3.stackSize)
|
||||
return null;
|
||||
if (var5.stackSize == var3.stackSize)
|
||||
return null;
|
||||
|
||||
var4.onPickupFromSlot(par1EntityPlayer, var5);
|
||||
}
|
||||
var4.onPickupFromSlot(par1EntityPlayer, var5);
|
||||
}
|
||||
|
||||
return var3;
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,18 +44,18 @@ public class ContainerMobMagnet extends ContainerPlayerInv {
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot)inventorySlots.get(par2);
|
||||
Slot var4 = (Slot) inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
|
||||
if(var5.getItem() instanceof ItemSoulMould) {
|
||||
if (var5.getItem() instanceof ItemSoulMould) {
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 < 1) {
|
||||
if(!mergeItemStack(var5, 1, 37, false))
|
||||
if (!mergeItemStack(var5, 1, 37, false))
|
||||
return null;
|
||||
} else if(!mergeItemStack(var5, 0, 1, false))
|
||||
} else if (!mergeItemStack(var5, 0, 1, false))
|
||||
return null;
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
|
||||
@@ -30,12 +30,12 @@ public abstract class ContainerPlayerInv extends Container {
|
||||
int ys = getInvYStart();
|
||||
int xs = getInvXStart();
|
||||
|
||||
for (int x = 0; x < 3; ++x)
|
||||
for (int y = 0; y < 9; ++y)
|
||||
addSlotToContainer(new Slot(playerInv, y + x * 9 + 9, xs + y * 18, ys + x * 18));
|
||||
for (int x = 0; x < 3; ++x)
|
||||
for (int y = 0; y < 9; ++y)
|
||||
addSlotToContainer(new Slot(playerInv, y + x * 9 + 9, xs + y * 18, ys + x * 18));
|
||||
|
||||
for (int x = 0; x < 9; ++x)
|
||||
addSlotToContainer(new Slot(playerInv, x, xs + x * 18, ys + 58));
|
||||
for (int x = 0; x < 9; ++x)
|
||||
addSlotToContainer(new Slot(playerInv, x, xs + x * 18, ys + 58));
|
||||
}
|
||||
|
||||
public int getInvYStart() {
|
||||
|
||||
+8
-11
@@ -57,15 +57,16 @@ public class ContainerIchorPouch extends ContainerPlayerInv {
|
||||
pouch = player.getCurrentEquippedItem();
|
||||
blockSlot = player.inventory.currentItem + 27 + 13 * 9;
|
||||
|
||||
for(int y = 0; y < 9; y++)
|
||||
for(int x = 0; x < 13; x++)
|
||||
for (int y = 0; y < 9; y++)
|
||||
for (int x = 0; x < 13; x++)
|
||||
addSlotToContainer(new SlotNoPouches(inv, y * 13 + x, 12 + x * 18, 8 + y * 18));
|
||||
initPlayerInv();
|
||||
|
||||
if (!player.worldObj.isRemote)
|
||||
try{
|
||||
try {
|
||||
((InventoryIchorPouch) inv).stackList = ((ItemFocusPouch) pouch.getItem()).getInventory(pouch);
|
||||
} catch (Exception e) { }
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,8 +82,7 @@ public class ContainerIchorPouch extends ContainerPlayerInv {
|
||||
if (slot < 13 * 9) {
|
||||
if (!inv.isItemValidForSlot(slot, stackInSlot) || !mergeItemStack(stackInSlot, 13 * 9, inventorySlots.size(), true))
|
||||
return null;
|
||||
}
|
||||
else if (!inv.isItemValidForSlot(slot, stackInSlot) || !mergeItemStack(stackInSlot, 0, 13 * 9, false)) {
|
||||
} else if (!inv.isItemValidForSlot(slot, stackInSlot) || !mergeItemStack(stackInSlot, 0, 13 * 9, false)) {
|
||||
return null;
|
||||
}
|
||||
if (stackInSlot.stackSize == 0)
|
||||
@@ -93,10 +93,8 @@ public class ContainerIchorPouch extends ContainerPlayerInv {
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer)
|
||||
{
|
||||
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer) {
|
||||
if (par1 == blockSlot) {
|
||||
return null;
|
||||
}
|
||||
@@ -104,8 +102,7 @@ public class ContainerIchorPouch extends ContainerPlayerInv {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer) {
|
||||
super.onContainerClosed(par1EntityPlayer);
|
||||
if (!player.worldObj.isRemote) {
|
||||
((ItemFocusPouch) pouch.getItem()).setInventory(pouch, ((InventoryIchorPouch) inv).stackList);
|
||||
|
||||
+5
-5
@@ -31,8 +31,8 @@ public class ContainerWarpGate extends ContainerPlayerInv {
|
||||
super(playerInv);
|
||||
this.gate = gate;
|
||||
|
||||
for(int y = 0; y < 2; y++)
|
||||
for(int x = 0; x < 5; x++)
|
||||
for (int y = 0; y < 2; y++)
|
||||
for (int x = 0; x < 5; x++)
|
||||
addSlotToContainer(new SlotSkyPearl(gate, y * 5 + x, 30 + x * 25, 27 + y * 25));
|
||||
|
||||
initPlayerInv();
|
||||
@@ -51,13 +51,13 @@ public class ContainerWarpGate extends ContainerPlayerInv {
|
||||
if (var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
|
||||
if(par2 < 10 || var5 != null) {
|
||||
if (par2 < 10 || var5 != null) {
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 < 10) {
|
||||
if(!mergeItemStack(var5, 10, 36, false))
|
||||
if (!mergeItemStack(var5, 10, 36, false))
|
||||
return null;
|
||||
} else if(var3.getItem() == ModItems.skyPearl&& !mergeItemStack(var5, 0, 10, false))
|
||||
} else if (var3.getItem() == ModItems.skyPearl && !mergeItemStack(var5, 0, 10, false))
|
||||
return null;
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SlotTool extends Slot {
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return !enchanter.working && par1ItemStack.getItem() != Items.book&& par1ItemStack.getItem().isItemTool(par1ItemStack);
|
||||
return !enchanter.working && par1ItemStack.getItem() != Items.book && par1ItemStack.getItem().isItemTool(par1ItemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,7 @@ public class SlotWand extends Slot {
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
if(!(par1ItemStack.getItem() instanceof ItemWandCasting) || ((ItemWandCasting) par1ItemStack.getItem()).isStaff(par1ItemStack))
|
||||
if (!(par1ItemStack.getItem() instanceof ItemWandCasting) || ((ItemWandCasting) par1ItemStack.getItem()).isStaff(par1ItemStack))
|
||||
return false;
|
||||
|
||||
ItemWandCasting wand = (ItemWandCasting) par1ItemStack.getItem();
|
||||
|
||||
@@ -3,15 +3,14 @@ package vazkii.tinkerer.common.block.tile.kami;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.common.core.handler.ConfigHandler;
|
||||
|
||||
public class TileBedrockPortal extends TileEntity{
|
||||
public class TileBedrockPortal extends TileEntity {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
for(Object e:worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1))){
|
||||
if(e instanceof Entity){
|
||||
for (Object e : worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1))) {
|
||||
if (e instanceof Entity) {
|
||||
((Entity) e).travelToDimension(ConfigHandler.bedrockDimensionID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,28 +46,28 @@ public class TileWarpGate extends TileEntity implements IInventory {
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1, zCoord, xCoord + 1, yCoord + 1.5, zCoord + 1));
|
||||
|
||||
|
||||
EntityPlayer clientPlayer = ThaumicTinkerer.proxy.getClientPlayer();
|
||||
for(EntityPlayer player : players)
|
||||
if(player != null && player == clientPlayer && player.isSneaking()) {
|
||||
player.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_WARP_GATE_DESTINATIONS, worldObj, xCoord, yCoord, zCoord);
|
||||
break;
|
||||
}
|
||||
|
||||
for (EntityPlayer player : players)
|
||||
if (player != null && player == clientPlayer && player.isSneaking()) {
|
||||
player.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_WARP_GATE_DESTINATIONS, worldObj, xCoord, yCoord, zCoord);
|
||||
break;
|
||||
}
|
||||
|
||||
teleportedThisTick = false;
|
||||
}
|
||||
|
||||
public void teleportPlayer(EntityPlayer player, int index) {
|
||||
if(teleportedThisTick)
|
||||
if (teleportedThisTick)
|
||||
return;
|
||||
|
||||
ItemStack stack = index < getSizeInventory() ? getStackInSlot(index) : null;
|
||||
if(stack != null && ItemSkyPearl.isAttuned(stack)) {
|
||||
if (stack != null && ItemSkyPearl.isAttuned(stack)) {
|
||||
int x = ItemSkyPearl.getX(stack);
|
||||
int y = ItemSkyPearl.getY(stack);
|
||||
int z = ItemSkyPearl.getZ(stack);
|
||||
|
||||
if(teleportPlayer(player, new ChunkCoordinates(x, y, z)))
|
||||
if (teleportPlayer(player, new ChunkCoordinates(x, y, z)))
|
||||
teleportedThisTick = true;
|
||||
}
|
||||
}
|
||||
@@ -78,26 +78,26 @@ public class TileWarpGate extends TileEntity implements IInventory {
|
||||
int z = coords.posZ;
|
||||
|
||||
TileEntity tile = player.worldObj.getTileEntity(x, y, z);
|
||||
if(tile != null && tile instanceof TileWarpGate) {
|
||||
if (tile != null && tile instanceof TileWarpGate) {
|
||||
TileWarpGate destGate = (TileWarpGate) tile;
|
||||
if(!destGate.locked) {
|
||||
if (!destGate.locked) {
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 1F);
|
||||
|
||||
for(int i = 0; i < 20; i++)
|
||||
ThaumicTinkerer.tcProxy.sparkle((float)player.posX + player.worldObj.rand.nextFloat() - 0.5F, (float)player.posY + player.worldObj.rand.nextFloat(), (float)player.posZ + player.worldObj.rand.nextFloat() - 0.5F, 6);
|
||||
for (int i = 0; i < 20; i++)
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) player.posX + player.worldObj.rand.nextFloat() - 0.5F, (float) player.posY + player.worldObj.rand.nextFloat(), (float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F, 6);
|
||||
|
||||
player.mountEntity(null);
|
||||
if(player instanceof EntityPlayerMP)
|
||||
if (player instanceof EntityPlayerMP)
|
||||
((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(x + 0.5, y + 1.6, z + 0.5, player.rotationYaw, player.rotationPitch);
|
||||
|
||||
for(int i = 0; i < 20; i++)
|
||||
ThaumicTinkerer.tcProxy.sparkle((float)player.posX + player.worldObj.rand.nextFloat() - 0.5F, (float)player.posY + player.worldObj.rand.nextFloat(), (float)player.posZ + player.worldObj.rand.nextFloat() - 0.5F, 6);
|
||||
for (int i = 0; i < 20; i++)
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) player.posX + player.worldObj.rand.nextFloat() - 0.5F, (float) player.posY + player.worldObj.rand.nextFloat(), (float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F, 6);
|
||||
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 0.1F);
|
||||
return true;
|
||||
} else if(!player.worldObj.isRemote)
|
||||
} else if (!player.worldObj.isRemote)
|
||||
player.addChatMessage(new ChatComponentTranslation("ttmisc.noTeleport"));
|
||||
} else if(!player.worldObj.isRemote)
|
||||
} else if (!player.worldObj.isRemote)
|
||||
player.addChatMessage(new ChatComponentTranslation("ttmisc.noDest"));
|
||||
|
||||
return false;
|
||||
@@ -130,20 +130,20 @@ public class TileWarpGate extends TileEntity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
par1NBTTagCompound.setBoolean(TAG_LOCKED, locked);
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
par1NBTTagCompound.setBoolean(TAG_LOCKED, locked);
|
||||
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
@@ -187,15 +187,15 @@ public class TileWarpGate extends TileEntity implements IInventory {
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.WARP_GATE;
|
||||
}
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.WARP_GATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
@@ -207,17 +207,15 @@ public class TileWarpGate extends TileEntity implements IInventory {
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
|
||||
+56
-66
@@ -16,83 +16,73 @@ import thaumcraft.common.tiles.TileArcaneBore;
|
||||
* Created by Katrina on 22/04/14.
|
||||
*/
|
||||
public class DriverArcaneBore extends DriverTileEntity {
|
||||
@Override
|
||||
public Class<?> getTileEntityClass() {
|
||||
return TileArcaneBore.class;
|
||||
}
|
||||
@Override
|
||||
public Class<?> getTileEntityClass() {
|
||||
return TileArcaneBore.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManagedEnvironment createEnvironment(World world, int x, int y, int z) {
|
||||
return new Enviroment((TileArcaneBore)world.getTileEntity(x,y,z));
|
||||
}
|
||||
@Override
|
||||
public ManagedEnvironment createEnvironment(World world, int x, int y, int z) {
|
||||
return new Enviroment((TileArcaneBore) world.getTileEntity(x, y, z));
|
||||
}
|
||||
|
||||
public static final class Enviroment extends ManagedTileEntityEnvironment<TileArcaneBore>
|
||||
{
|
||||
public static final class Enviroment extends ManagedTileEntityEnvironment<TileArcaneBore> {
|
||||
|
||||
public Enviroment(TileArcaneBore tileEntity) {
|
||||
super(tileEntity,"arcanebore");
|
||||
}
|
||||
public Enviroment(TileArcaneBore tileEntity) {
|
||||
super(tileEntity, "arcanebore");
|
||||
}
|
||||
|
||||
@Callback(doc = "function():boolean -- does the bore have a pickaxe")
|
||||
public Object[] hasPickaxe(final Context context, final Arguments arguments) {
|
||||
return new Object[]{ this.tileEntity.hasPickaxe };
|
||||
}
|
||||
|
||||
@Callback(doc="function():boolean -- does the bore have a pickaxe")
|
||||
public Object[] hasPickaxe(final Context context,final Arguments arguments)
|
||||
{
|
||||
return new Object[] { this.tileEntity.hasPickaxe };
|
||||
}
|
||||
@Callback(doc="function():boolean -- does the bore have a focus")
|
||||
public Object[] hasFocus(final Context context,final Arguments arguments)
|
||||
{
|
||||
return new Object[] { this.tileEntity.hasFocus };
|
||||
}
|
||||
@Callback(doc = "function():boolean -- does the bore have a focus")
|
||||
public Object[] hasFocus(final Context context, final Arguments arguments) {
|
||||
return new Object[]{ this.tileEntity.hasFocus };
|
||||
}
|
||||
|
||||
@Callback(doc="function():boolean -- is the pickaxe near broken?")
|
||||
public Object[] isPickaxeBroken(final Context context,final Arguments arguments)
|
||||
{
|
||||
ItemStack pickaxe = tileEntity.getStackInSlot(1);
|
||||
boolean nearBroken = pickaxe != null && pickaxe.getItemDamage() + 1 == pickaxe.getMaxDamage();
|
||||
return new Object[] { nearBroken };
|
||||
}
|
||||
@Callback(doc = "function():boolean -- is the pickaxe near broken?")
|
||||
public Object[] isPickaxeBroken(final Context context, final Arguments arguments) {
|
||||
ItemStack pickaxe = tileEntity.getStackInSlot(1);
|
||||
boolean nearBroken = pickaxe != null && pickaxe.getItemDamage() + 1 == pickaxe.getMaxDamage();
|
||||
return new Object[]{ nearBroken };
|
||||
}
|
||||
|
||||
@Callback(doc="function():boolean -- Is the bore working?")
|
||||
public Object[] isWorking(final Context context,final Arguments arguments)
|
||||
{
|
||||
ItemStack pickaxe = tileEntity.getStackInSlot(1);
|
||||
boolean nearBroken = pickaxe != null && pickaxe.getItemDamage() + 1 == pickaxe.getMaxDamage();
|
||||
return new Object[] { this.tileEntity.gettingPower() && this.tileEntity.hasFocus && this.tileEntity.hasPickaxe && pickaxe.isItemStackDamageable() && !nearBroken };
|
||||
}
|
||||
@Callback(doc = "function():boolean -- Is the bore working?")
|
||||
public Object[] isWorking(final Context context, final Arguments arguments) {
|
||||
ItemStack pickaxe = tileEntity.getStackInSlot(1);
|
||||
boolean nearBroken = pickaxe != null && pickaxe.getItemDamage() + 1 == pickaxe.getMaxDamage();
|
||||
return new Object[]{ this.tileEntity.gettingPower() && this.tileEntity.hasFocus && this.tileEntity.hasPickaxe && pickaxe.isItemStackDamageable() && !nearBroken };
|
||||
}
|
||||
|
||||
@Callback(doc="function():number -- Gets bore's radius")
|
||||
public Object[] getRadius(final Context context,final Arguments arguments)
|
||||
{
|
||||
return new Object[] { 1 + (tileEntity.area + tileEntity.maxRadius) * 2 };
|
||||
}
|
||||
@Callback(doc = "function():number -- Gets bore's radius")
|
||||
public Object[] getRadius(final Context context, final Arguments arguments) {
|
||||
return new Object[]{ 1 + (tileEntity.area + tileEntity.maxRadius) * 2 };
|
||||
}
|
||||
|
||||
@Callback(doc="function():number -- Gets bore's speed")
|
||||
public Object[] getSpeed(final Context context,final Arguments arguments)
|
||||
{
|
||||
return new Object[] { tileEntity.speed };
|
||||
}
|
||||
@Callback(doc = "function():number -- Gets bore's speed")
|
||||
public Object[] getSpeed(final Context context, final Arguments arguments) {
|
||||
return new Object[]{ tileEntity.speed };
|
||||
}
|
||||
|
||||
@Callback(doc="function():boolean -- Will the bore get native clusters?")
|
||||
public Object[] hasNativeClusters(final Context context,final Arguments arguments)
|
||||
{
|
||||
ItemStack pickaxe = tileEntity.getStackInSlot(1);
|
||||
return new Object[] { pickaxe != null && pickaxe.getItem() instanceof ItemElementalPickaxe};
|
||||
}
|
||||
@Callback(doc = "function():boolean -- Will the bore get native clusters?")
|
||||
public Object[] hasNativeClusters(final Context context, final Arguments arguments) {
|
||||
ItemStack pickaxe = tileEntity.getStackInSlot(1);
|
||||
return new Object[]{ pickaxe != null && pickaxe.getItem() instanceof ItemElementalPickaxe };
|
||||
}
|
||||
|
||||
@Callback(doc="function():number -- What level fortune on pick")
|
||||
public Object[] getFortune(final Context context,final Arguments arguments)
|
||||
{
|
||||
ItemStack pickaxe = tileEntity.getStackInSlot(1);
|
||||
return new Object[] { EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, pickaxe) };
|
||||
}
|
||||
@Callback(doc = "function():number -- What level fortune on pick")
|
||||
public Object[] getFortune(final Context context, final Arguments arguments) {
|
||||
ItemStack pickaxe = tileEntity.getStackInSlot(1);
|
||||
return new Object[]{ EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, pickaxe) };
|
||||
}
|
||||
|
||||
@Callback(doc="function():boolean -- Does the pick have silk touch?")
|
||||
public Object[] hasSilkTouch(final Context context,final Arguments arguments)
|
||||
{
|
||||
ItemStack pickaxe = tileEntity.getStackInSlot(1);
|
||||
return new Object[] { EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, pickaxe)>0 };
|
||||
}
|
||||
@Callback(doc = "function():boolean -- Does the pick have silk touch?")
|
||||
public Object[] hasSilkTouch(final Context context, final Arguments arguments) {
|
||||
ItemStack pickaxe = tileEntity.getStackInSlot(1);
|
||||
return new Object[]{ EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, pickaxe) > 0 };
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
-25
@@ -13,34 +13,30 @@ import vazkii.tinkerer.common.block.tile.peripheral.implementation.ArcaneEarImpl
|
||||
* Created by Katrina on 21/04/14.
|
||||
*/
|
||||
public class DriverArcaneEar extends DriverTileEntity {
|
||||
@Override
|
||||
public Class<?> getTileEntityClass() {
|
||||
return TileSensor.class;
|
||||
}
|
||||
@Override
|
||||
public Class<?> getTileEntityClass() {
|
||||
return TileSensor.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManagedEnvironment createEnvironment(World world, int x, int y, int z) {
|
||||
return new Enviroment((TileSensor)world.getTileEntity(x,y,z));
|
||||
}
|
||||
@Override
|
||||
public ManagedEnvironment createEnvironment(World world, int x, int y, int z) {
|
||||
return new Enviroment((TileSensor) world.getTileEntity(x, y, z));
|
||||
}
|
||||
|
||||
public static final class Enviroment extends ManagedTileEntityEnvironment<TileSensor>
|
||||
{
|
||||
public static final class Enviroment extends ManagedTileEntityEnvironment<TileSensor> {
|
||||
|
||||
public Enviroment(TileSensor tileEntity) {
|
||||
super(tileEntity,"ArcaneEar");
|
||||
}
|
||||
public Enviroment(TileSensor tileEntity) {
|
||||
super(tileEntity, "ArcaneEar");
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- returns the note the ear is set to")
|
||||
public Object[] getNote(final Context context, final Arguments arguments) {
|
||||
return ArcaneEarImplementation.getNote(this.tileEntity);
|
||||
}
|
||||
|
||||
@Callback(doc="function():number -- returns the note the ear is set to")
|
||||
public Object[] getNote(final Context context,final Arguments arguments)
|
||||
{
|
||||
return ArcaneEarImplementation.getNote(this.tileEntity);
|
||||
}
|
||||
|
||||
@Callback(doc="function(note:number):nil -- sets the note the ear listens for")
|
||||
public Object[] setNote(final Context context,final Arguments arguments)
|
||||
{
|
||||
return ArcaneEarImplementation.setNote(this.tileEntity,(byte)arguments.checkInteger(0));
|
||||
}
|
||||
}
|
||||
@Callback(doc = "function(note:number):nil -- sets the note the ear listens for")
|
||||
public Object[] setNote(final Context context, final Arguments arguments) {
|
||||
return ArcaneEarImplementation.setNote(this.tileEntity, (byte) arguments.checkInteger(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 238 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user