1 Commits

Author SHA1 Message Date
Mohammad-Ali Minaie
bd5329f3ce was fixing something 2017-09-15 15:54:30 -04:00
2940 changed files with 20436 additions and 42595 deletions

449
.idea/workspace.xml generated
View File

@@ -2,7 +2,26 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="2374d888-04b5-4300-967c-f257dee6cdd6" name="Default" comment=""> <list default="true" id="2374d888-04b5-4300-967c-f257dee6cdd6" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/CommonUtils.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/CommonUtils.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/ForgeCraft.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/ForgeCraft.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/ModInfo.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/ModInfo.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/compat/FuelHandler.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/compat/FuelHandler.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModItems.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModItems.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModRegistries.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModRegistries.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModTiles.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModTiles.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/items/BaseItem.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/items/BaseItem.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/items/ItemTest.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/items/ItemTest.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/proxy/ClientProxy.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/proxy/ClientProxy.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/renders/TileFireboxRender.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/renders/TileFireboxRender.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/renders/TilePistonBellowsRender.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/renders/TilePistonBellowsRender.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/BaseTile.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/BaseTile.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileBaseSlot.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileBaseSlot.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileFirebox.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileFirebox.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/TilePistonBellows.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/TilePistonBellows.java" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
@@ -14,23 +33,33 @@
<component name="CreatePatchCommitExecutor"> <component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" /> <option name="PATCH_PATH" value="" />
</component> </component>
<component name="FUSProjectUsageTrigger"> <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<session id="1807367187">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="2" />
<entry key="project.open.time.0" value="1" />
<entry key="project.open.time.4" value="1" />
<entry key="project.opened" value="2" />
</counts>
</usages-collector>
</session>
</component>
<component name="FavoritesManager"> <component name="FavoritesManager">
<favorites_list name="ForgeCraft" /> <favorites_list name="ForgeCraft" />
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf /> <leaf>
<file leaf-file-name="PistonBellows.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Firebox.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-510">
<caret line="42" column="77" lean-forward="true" selection-start-line="42" selection-start-column="4" selection-end-line="42" selection-end-column="77" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -43,114 +72,251 @@
<entry key="$PROJECT_DIR$/../PrimalCore" value="2962994312000" /> <entry key="$PROJECT_DIR$/../PrimalCore" value="2962994312000" />
</map> </map>
</option> </option>
<option name="externalProjectsViewState">
<projects_view />
</option>
</component> </component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" /> <component name="ProjectFrameBounds">
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="y" value="22" />
<option name="width" value="1680" /> <option name="width" value="1680" />
<option name="height" value="1050" /> <option name="height" value="1050" />
</component> </component>
<component name="ProjectView"> <component name="ProjectView">
<navigator proportions="" version="1"> <navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<expand> <PATH>
<path> <PATH_ELEMENT>
<item name="ForgeCraft" type="b2602c69:ProjectViewProjectNode" /> <option name="myItemId" value="ForgeCraft" />
<item name="ForgeCraft" type="462c0819:PsiDirectoryNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</path> </PATH_ELEMENT>
<path> <PATH_ELEMENT>
<item name="ForgeCraft" type="b2602c69:ProjectViewProjectNode" /> <option name="myItemId" value="ForgeCraft" />
<item name="ForgeCraft" type="462c0819:PsiDirectoryNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
<item name="kfc" type="462c0819:PsiDirectoryNode" /> </PATH_ELEMENT>
</path> </PATH>
<path> <PATH>
<item name="ForgeCraft" type="b2602c69:ProjectViewProjectNode" /> <PATH_ELEMENT>
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" /> <option name="myItemId" value="ForgeCraft" />
</path> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
<path> </PATH_ELEMENT>
<item name="ForgeCraft" type="b2602c69:ProjectViewProjectNode" /> <PATH_ELEMENT>
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" /> <option name="myItemId" value="ForgeCraft" />
<item name="&lt; 1.8 &gt;" type="70bed36:NamedLibraryElementNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</path> </PATH_ELEMENT>
</expand> <PATH_ELEMENT>
<select /> <option name="myItemId" value="1.11" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="1.11" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="1.11" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="nmd" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="primal" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="forgecraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="1.11" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="nmd" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="primal" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="forgecraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="blocks" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="1.11" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane> </subPane>
</pane> </pane>
<pane id="PackagesPane" />
<pane id="Scope" /> <pane id="Scope" />
<pane id="AndroidView" /> <pane id="Scratches" />
<pane id="PackagesPane" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/kfc/build.gradle" />
<property name="project.structure.last.edited" value="Project" /> <property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.0" /> <property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" /> <property name="project.structure.side.proportion" value="0.0" />
</component> <property name="FullScreen" value="true" />
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component> </component>
<component name="RunManager"> <component name="RunManager">
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
<option name="PROGRAM_PARAMETERS" />
<predefined_log_file id="idea.log" enabled="true" />
<method />
</configuration>
<configuration default="true" type="Applet" factoryName="Applet"> <configuration default="true" type="Applet" factoryName="Applet">
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" /> <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<method> <module />
<option name="Make" enabled="true" /> <method />
</method>
</configuration> </configuration>
<configuration default="true" type="Application" factoryName="Application"> <configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<method> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="Make" enabled="true" /> <option name="ALTERNATIVE_JRE_PATH" />
</method> <option name="ENABLE_SWING_INSPECTOR" value="false" />
</configuration> <option name="ENV_VARIABLES" />
<configuration name="build" type="GroovyScriptRunConfiguration" factoryName="Groovy" temporary="true"> <option name="PASS_PARENT_ENVS" value="true" />
<module name="ForgeCraft" /> <module name="" />
<setting name="path" value="file://$PROJECT_DIR$/kfc/build.gradle" /> <envs />
<setting name="vmparams" value="" /> <method />
<setting name="params" value="" />
<setting name="workDir" value="file://$PROJECT_DIR$/kfc" />
<setting name="debug" value="false" />
</configuration> </configuration>
<configuration default="true" type="JUnit" factoryName="JUnit"> <configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" /> <option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" /> <option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" /> <option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" /> <option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" /> <option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" /> <option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" /> <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" /> <option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE"> <option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" /> <value defaultName="singleModule" />
</option> </option>
<envs />
<patterns /> <patterns />
<method> <method />
<option name="Make" enabled="true" /> </configuration>
</method> <configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
<method />
</configuration> </configuration>
<configuration default="true" type="TestNG" factoryName="TestNG"> <configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" /> <option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" /> <option name="SUITE_NAME" />
@@ -159,39 +325,26 @@
<option name="METHOD_NAME" /> <option name="METHOD_NAME" />
<option name="GROUP_NAME" /> <option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" /> <option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" /> <option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" /> <option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" /> <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="OUTPUT_DIRECTORY" /> <option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" /> <option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE"> <option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" /> <value defaultName="singleModule" />
</option> </option>
<option name="USE_DEFAULT_REPORTERS" value="false" /> <option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" /> <option name="PROPERTIES_FILE" />
<envs />
<properties /> <properties />
<listeners /> <listeners />
<method> <method />
<option name="Make" enabled="true" />
</method>
</configuration> </configuration>
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
<option name="PROGRAM_PARAMETERS" />
<predefined_log_file id="idea.log" enabled="true" />
<method>
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Groovy.build" />
</list>
</recent_temporary>
</component> </component>
<component name="SvnConfiguration"> <component name="ShelveChangesManager" show_recycled="false">
<configuration /> <option name="remove_strategy" value="false" />
</component> </component>
<component name="TaskManager"> <component name="TaskManager">
<task active="true" id="Default" summary="Default task"> <task active="true" id="Default" summary="Default task">
@@ -200,58 +353,72 @@
<option name="number" value="Default" /> <option name="number" value="Default" />
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1482033001334</updated> <updated>1482033001334</updated>
<workItem from="1538459982472" duration="37000" />
<workItem from="1538460037447" duration="7000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="44000" />
</component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-8" y="-8" width="2576" height="1416" extended-state="6" /> <frame x="0" y="0" width="1680" height="1050" extended-state="6" />
<editor active="true" />
<layout> <layout>
<window_info anchor="right" id="Palette" order="4" /> <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info anchor="bottom" id="TODO" order="6" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info anchor="bottom" id="Messages" /> <window_info id="Nl-Palette" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info anchor="right" id="Palette&#9;" order="8" /> <window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" order="3" /> <window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info anchor="right" id="Capture Analysis" order="5" /> <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" weight="0.32958034" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32958034" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info anchor="right" id="Maven Projects" order="9" /> <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info anchor="bottom" id="Run" order="2" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info anchor="bottom" id="Version Control" order="9" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info active="true" anchor="bottom" id="Terminal" order="7" visible="true" weight="0.33386454" /> <window_info id="Properties" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" order="6" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Designer" order="4" /> <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info anchor="right" content_ui="combo" id="Project" order="10" visible="true" weight="0.16613673" /> <window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" order="0" side_tool="true" weight="0.25" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info anchor="right" id="Ant Build" order="2" weight="0.25" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" order="5" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info anchor="right" id="Theme Preview" order="6" /> <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> <window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" order="2" side_tool="true" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="3" weight="0.25" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Nl-Palette" order="1" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info anchor="right" id="Commander" order="1" weight="0.4" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info anchor="right" id="Properties" order="7" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info anchor="right" id="Database" order="0" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info anchor="bottom" id="Database Changes" order="10" show_stripe_button="false" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Find" order="1" />
</layout> </layout>
</component> </component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="VcsContentAnnotationSettings"> <component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" /> <option name="myLimit" value="2678400000" />
</component> </component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/CommonUtils.java" /> <entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/CommonUtils.java">
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java" /> <provider selected="true" editor-type-id="text-editor">
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java" /> <state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-510">
<caret line="42" column="77" lean-forward="true" selection-start-line="42" selection-start-column="4" selection-end-line="42" selection-end-column="77" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</component> </component>
</project> </project>

Binary file not shown.

View File

@@ -1,20 +1,14 @@
# To-Dos To-Dos
## Bugs *** Bugs ***
- [ ] Placement bug for crucible from tongs
- [ ] Wootz shovel not rendering (NORTH)
- [ ] Damascus Rendering in tongs
## Current Feature *** Current Feature ***
- [ ] Damascus Workblade Recipe - [x] BlockBreaker Support for copper dust and tin dust
- [ ] Untick Bloomery and Forge - [x] picking up raw bronze crucible returns some other shit
- [ ] Craft Tweaker Support - [x] Tool breaking should return tool head
- [ ] Recipe Handler for Block Breaker
- [ ] Mass Ore Production
## Feature Musket *** Feature Musket ***
- [ ] Create powder charge item (copper, charcoal, gunpowder) - [ ] Create powder charge item (copper, charcoal, gunpowder)
- [ ] Create musket round item (lead or iron nugget) - [ ] Create musket round item (lead or iron nugget)
- [ ] Create wadding item (paper) - [ ] Create wadding item (paper)
@@ -25,104 +19,23 @@
- [ ] Create stock item - [ ] Create stock item
- [ ] Create lock assembly item - [ ] Create lock assembly item
## Backlog *** Backlog ***
- [ ] Hardened Leather Helmet Inventory Model - [ ] Move Ingot break into chunks logic out of the block and into the ForgeHammer
- [ ] Add Achievements
- [ ] Random Floats for hot texture
- [ ] Silver/Lead Production
- [ ] Sparks to forging
- [ ] Add Iron Ring Recipe - [ ] Add Iron Ring Recipe
- [ ] Add chainmail recipe - [ ] Add chainmail recipe
- [ ] Add Iron Shield - [ ] Add Iron Shield
- [ ] Gold Smelting - [ ] Gold Smelting
- [ ] Create a method which adds the types of NBT upgrades and creates a unique float instead of using magic numbers
- [ ] Add forgehammer to oreDict - [ ] Add forgehammer to oreDict
- [ ] WeaponHead recipes
### Tid-Bits
NonNullList<ItemStack> tempDrops = NonNullList.<ItemStack>create(); *** Tid-Bits ***
ItemStack iron_gear = RecipeHelper.getFirstDictionaryMatch("gearIron", 1);
```
sed -i -- 's/iron/steel/g' * sed -i -- 's/iron/steel/g' *
rm *.json-- rm *.json--
rename s/iron/steel/ iron* rename s/iron/steel/ iron*
```
### Completed *** Completed ***
- [x] weapon upgrades
- [x] Grinding Bench
- [x] Repair ToolHead
- [x] Grinding Wheel Crafting Slack, Clay, Sand
- [x] Grinding Bench Recipe
- [x] Dissasemble recipes for weapons
- [x] Chisel Pickup
- [x] WorkBench
- [x] Longbow change NBT management
- [x] Check dict name for cluster
- [x] Check block break code for NBTCrucible
- [x] Cooldown for sledgehammer not working
- [x] tune volume down on sledgehammer
- [x] when placing crucibles on the side of a block it replaces the block above
- [x] Check on disable for soft crucible in bloomery
- [x] Correct Tooltip for RawLongbow
- [x] Add tooltip to Chisel and SledgeHammer
- [x] Damascus workblade
- [x] Config to map only wrought iron to vanilla iron or wrought iron to another iron
- [x] Config to map damascus steel to generic mod steel
- [x] If blockbreaker charge is 0 shift right click will remove the gallagher
- [x] drop a tool handle when crafting
- [x] Hot Crucible block form missing texture
- [x] Soft Crucible drop from tongs
- [x] Pickaxe upgrades printout
- [x] Can't put a crucible straight from creative inventory into bloomery and pull with tongs
- [x] SledgeHammer and Chisel item and blocks
- [x] ToolTip rawLongbow
- [x] Update Recipes with oreDict for slackLime
- [x] Chisel Bounding Box changes
- [x] SledgeHammer Supid Damage Modifier
- [x] SledgeHammer and Chisel crafting
- [x] SledgeHammer and Chisel assets
- [x] SoftCrucible Color Issues
- [x] Apply Forge turn off logic to Bloomery
- [x] Soft Crucible Hibachi Recipe
- [x] Fix Plate Crafting
- [x] Longbow animation
- [x] Fix Forge Cool Down
- [x] Fix Forge StackTagCompound management
- [x] ForgeHammer Recipes
- [x] Bronze Plate Cast
- [x] JEI Support
- [x] Update SoftCrucible Model
- [x] Crucibles were returning input ingredients even after cooked
- [x] Hot Crucible doesn't have hot molten layer
- [x] Can't add upgrades to the anvil
- [x] Steel Plate Recipe #37
- [x] Damascus Recipes
- [x] Damascus Weapons
- [x] Need Recipe for Soft Crucible
- [x] Make Wootz Weapons
- [x] Crucible is not resetting after iron is removed.
- [x] Chunk and Ball stacking
- [x] Delete unused models, blockstates, and textures
- [x] Inventory version of balls have the same texture
- [x] Wootz Chunk Model
- [x] Casting Mud Texture
- [x] Adobe Bloomery Texture
- [x] Adobe Forge Texture
- [x] Update nbt Crucible Models with open top
- [x] Update all slotted tong models
- [x] Inventory model for nbtCrucible
- [x] Tongs hot Texture
- [x] Casting Block line 103
- [x] Bloomery rendering all messed up
- [x] Update Casting recipes to use new slotted tongs and nbtCrucible
- [x] NBT Crucible
- [x] NBT Crucible Recipes
- [x] Slotted Tongs
- [x] Item Crucible
- [x] NBTCrucible to ItemCrucible transformer
- [x] StoneTongs ItemCrucible to NBTCrucible transformer
- [x] BlockBreaker Support for copper dust and tin dust
- [x] picking up raw bronze crucible returns some other shit
- [x] Tool breaking should return tool head
- [x] Casting Table - [x] Casting Table
- [x] Block - [x] Block
- [x] Gui - [x] Gui
@@ -222,3 +135,47 @@ rename s/iron/steel/ iron*
- [x] Tongs Extract from bloomery for Hot Iron - [x] Tongs Extract from bloomery for Hot Iron
- [x] Tongs Extract from bloomery for Hot Iron Finished - [x] Tongs Extract from bloomery for Hot Iron Finished
- [x] Crafting Recipes - [x] Crafting Recipes
0 | Default StoneTongs
1 | Empty Crucible Hot
2 | Empty Crucible Cracked Hot
================================
3 | Hot Iron Crucible
4 | Hot Cooked Iron Crucible
5 | Hot Failed Iron Crucible
6 | Hot Iron Ingot
7 | Hot Iron Chunk
--------------------------------
8 | Hot Iron Pickaxe Head
9 | Hot Iron Axe Head
10 | Hot Iron Shovel Head
11 | Hot Iron Hoe Head
================================
12 | Hot Clean Iron Crucible
13 | Hot Cooked Clean Iron Crucible
14 | Hot Failed Clean Iron Crucible
15 | Hot Clean Iron Ball
16 | Hot Clean Iron Chunk
--------------------------------
17 | Hot Clean Iron Pickaxe Head
18 | Hot Clean Iron Axe Head
19 | Hot Clean Iron Shovel Head
20 | Hot Clean Iron Hoe Head
================================
21 | Hot Steel Crucible
22 | Hot Cooked Steel Crucible
23 | Hot Failed Steel Crucible
24 | Hot Steel Ingot
25 | Hot Steel Chunk
--------------------------------
26 | Hot Steel Pickaxe Head
27 | Hot Steel Axe Head
28 | Hot Steel Shovel Head
29 | Hot Steel Hoe Head

View File

@@ -1,11 +1,9 @@
// -Dhttps.protocols=TLSv1.2
//org.gradle.jvmargs="-Dhttps.protocols=TLSv1.2"
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
maven { maven {
name = "forge" name = "forge"
url = "https://files.minecraftforge.net/maven" url = "http://files.minecraftforge.net/maven"
} }
maven { maven {
name = "sonatype" name = "sonatype"
@@ -13,79 +11,107 @@ buildscript {
} }
} }
dependencies { dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
} }
} }
repositories { repositories {
maven {
name = "jei"
url "http://dvs1.progwml6.com/files/maven"
}
maven {
name = "mobius"
url "http://mobiusstrip.eu/maven"
}
maven { maven {
name = "primal" name = "primal"
url "https://maven.nmd.so" url "https://maven.nmd.so"
} }
maven {
name = "jei"
url "https://dvs1.progwml6.com/files/maven"
}
maven {
name "CraftTweaker"
url "http://maven.blamejared.com/"
}
} }
apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'java' apply plugin: 'java'
compileJava { compileJava {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
} }
group = "${mod_group}" group = "${mod_group}"
version = "${mod_version}" version = "${mod_version}"
archivesBaseName = "${mod_name}" archivesBaseName = "${mod_name}"
idea { module { inheritOutputDirs = true } } idea { module { inheritOutputDirs = true } }
minecraft { minecraft {
version = "${mc_version}" + "-" + "${forge_version}" version = "${mc_version}" + "-" + "${forge_version}"
runDir = "run" runDir = "run"
mappings = "${mcp_mappings}" mappings = "${mcp_mappings}"
// JEI // JEI
useDepAts = true //useDepAts = true
// Replace // Replace
replace "@VERSION@", project.mod_version replace "@VERSION@", project.mod_version
} }
dependencies { dependencies {
// PrimalCore // you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/ddependency_management.html
// JEI
// https://github.com/mezz/JustEnoughItems
// http://minecraft.curseforge.com/projects/just-enough-items-jei/files
// <MINECRAFT-VERSION> and <JEI-VERSION> can be found on CurseForge, check the file name of the version you want.
//
// compile against the JEI API
deobfCompile "nmd.primal.core:PrimalCore:${mc_version}-${primal_version}:dev" deobfCompile "nmd.primal.core:PrimalCore:${mc_version}-${primal_version}:dev"
//runtime "mezz.jei:jei_${mc_version}:${jei_version}"
// JEI deobfCompile "nmd.primal.core:PrimalCore:${mc_version}-${primal_version}:dev"
//runtime "mezz.jei:jei_${mc_version}:${jei_version}" //runtime "nmd.primal.core:PrimalCore:${primal_version}"
deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}:api"
// CraftTweaker
//compile "CraftTweaker2:CraftTweaker2-MC1120-Main:${craftweaker_version}"
//compile "CraftTweaker2:CraftTweaker2-API:${craftweaker_version}"
//compile "CraftTweaker2:CraftTweaker2-MC1120-Main:${mc_major_version}-${craftweaker_version}"
//compile "CraftTweaker2:CraftTweaker2-API:${craftweaker_version}"
} }
processResources { processResources {
// this will ensure that this task is redone when the versions change. // this will ensure that this task is redone when the versions change.
inputs.property "version", "${mod_version}" inputs.property "version", "${mod_version}"
inputs.property "mcversion", "${mc_version}" inputs.property "mcversion", "${mc_version}"
// replace stuff in mcmod.info, nothing else // replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info' include 'mcmod.info'
// replace version and mcversion // replace version and mcversion
expand 'version':"${mod_version}", 'mcversion':"${mc_version}" expand 'version':"${mod_version}", 'mcversion':"${mc_version}"
} }
// copy everything else, thats not the mcmod.info // copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info' exclude 'mcmod.info'
} }
} }
// end // // end //

View File

@@ -5,15 +5,12 @@ org.gradle.jvmargs=-Xmx3G
mod_group=nmd.primal.forgecraft mod_group=nmd.primal.forgecraft
mod_name=ForgeCraft mod_name=ForgeCraft
mod_version=1.2.74
forge_version=13.20.1.2388
mcp_mappings=snapshot_20170610
mc_version=1.11.2
mod_version=1.6.51 primal_version=0.4+
forge_version=14.23.5.2806 jei_version=4.3+
mcp_mappings=snapshot_20171003
mc_version=1.12.2
mc_major_version=1.12
primal_version=0.6+
jei_version=4.12+
waila_version=1.7.0-B3 waila_version=1.7.0-B3
apple_version=2.1+ apple_version=2.1+
craftweaker_version=4.1.6.465

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExcludeFromValidation">
<file url="file://$PROJECT_DIR$/src/main/java/nmd/primal/forgecraft/blocks/Chisel.java" />
</component>
</project>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View File

@@ -1,117 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidElementNotAllowed" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintByteOrderMark" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintContentDescription" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintCustomError" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintCustomWarning" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintEnforceUTF8" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintExtraTranslation" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintHardcodedText" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintImpliedQuantity" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintLabelFor" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintMissingQuantity" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintMissingTranslation" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintPluralsCandidate" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintRelativeOverlap" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintRtlCompat" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintRtlEnabled" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintRtlHardcoded" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintRtlSymmetry" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintSetTextI18n" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintStringFormatCount" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintStringFormatInvalid" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintStringFormatMatches" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintTypos" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintUnusedQuantity" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidMissingOnClickHandler" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidNonConstantResIdsInSwitch" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidUnknownAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AntDuplicateTargetsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AntMissingPropertiesFileInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AntResolveInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CheckDtdRefs" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CheckEmptyScriptTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CheckNodeTest" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CheckTagEmptyBody" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CheckValidXmlInScriptTagBody" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CheckXmlFileWithXercesValidator" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ConceptInspectionProvider" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="DeprecatedClassUsageInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HardwiredNamespacePrefix" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlExtraClosingTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlUnknownAnchorTarget" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlUnknownAttribute" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myValues">
<value>
<list size="0" />
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="HtmlUnknownBooleanAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlUnknownTag" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myValues">
<value>
<list size="6">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
<item index="3" class="java.lang.String" itemvalue="noscript" />
<item index="4" class="java.lang.String" itemvalue="embed" />
<item index="5" class="java.lang.String" itemvalue="script" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="HtmlUnknownTarget" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ImplicitTypeConversion" enabled="false" level="WARNING" enabled_by_default="false">
<option name="BITS" value="1720" />
<option name="FLAG_EXPLICIT_CONVERSION" value="true" />
<option name="IGNORE_NODESET_TO_BOOLEAN_VIA_STRING" value="true" />
</inspection_tool>
<inspection_tool class="IndexZeroUsage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxColorRgb" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxDefaultTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxEventHandler" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxRedundantPropertyValue" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxResourcePropertyValue" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxUnresolvedFxIdReference" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxUnusedImports" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LossyEncoding" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PatternNotApplicable" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="PatternOverriddenByNonAnnotatedMethod" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PatternValidation" enabled="false" level="WARNING" enabled_by_default="false">
<option name="CHECK_NON_CONSTANT_VALUES" value="true" />
</inspection_tool>
<inspection_tool class="RedundantTypeConversion" enabled="false" level="WARNING" enabled_by_default="false">
<option name="CHECK_ANY" value="false" />
</inspection_tool>
<inspection_tool class="RequiredAttributes" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myAdditionalRequiredHtmlAttributes" value="" />
</inspection_tool>
<inspection_tool class="ResourceType" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SimplifiableIfStatement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpecInspectionProvider" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
<inspection_tool class="XmlDuplicatedId" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XmlHighlighting" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XmlInvalidId" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XmlPathReference" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XmlUnboundNsPrefix" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XmlUnusedNamespaceDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XmlWrongFileType" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XmlWrongRootElement" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XsltDeclarations" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XsltTemplateInvocation" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XsltUnusedDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XsltVariableShadowing" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="3">
<item index="0" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.Mod" />
<item index="1" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.Mod.EventHandler" />
<item index="2" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.eventhandler.SubscribeEvent" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="PreferredVcsStorage">
<preferredVcsName>ApexVCS</preferredVcsName>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@@ -1,78 +1,119 @@
package nmd.primal.forgecraft; package nmd.primal.forgecraft;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import nmd.primal.core.api.events.CauldronRecipeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import nmd.primal.core.common.crafting.handlers.tile.CauldronRecipe; import nmd.primal.forgecraft.items.parts.BronzeToolPart;
import nmd.primal.core.common.helper.RecipeHelper; import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.core.common.tiles.machines.TileCauldron; import nmd.primal.forgecraft.items.tools.*;
import nmd.primal.forgecraft.items.parts.WeaponPart; import nmd.primal.forgecraft.util.ToolNBT;
import nmd.primal.forgecraft.util.WeaponNBT;
/** /**
* Created by mminaie on 3/15/17. * Created by mminaie on 3/15/17.
*/ */
public class CommonEvents implements WeaponNBT { public class CommonEvents implements ToolNBT {
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onItemCrafted(CauldronRecipeEvent.Pre event){
CauldronRecipe recipe = event.getRecipe(); @SubscribeEvent(priority= EventPriority.LOWEST, receiveCanceled=true)
if (recipe.matches("forgecraft:cauldron_item.rawcoppergladiussmite", "forgecraft:cauldron_item.rawcoppergladiusbane", "forgecraft:cauldron_item.rawcoppergladiusfire", "forgecraft:cauldron_item.rawcoppergladiusfortune", public void onItemCrafted(PlayerEvent.ItemCraftedEvent event) {
"forgecraft:cauldron_item.rawbronzegladiussmite", "forgecraft:cauldron_item.rawbronzegladiusbane", "forgecraft:cauldron_item.rawbronzegladiusfire", "forgecraft:cauldron_item.rawbronzegladiusfortune",
"forgecraft:cauldron_item.rawwroughtirongladiussmite", "forgecraft:cauldron_item.rawwroughtirongladiusbane", "forgecraft:cauldron_item.rawwroughtirongladiusfire", "forgecraft:cauldron_item.rawwroughtirongladiusfortune",
"forgecraft:cauldron_item.rawclearnirongladiussmite", "forgecraft:cauldron_item.rawclearnirongladiusbane", "forgecraft:cauldron_item.rawclearnirongladiusfire", "forgecraft:cauldron_item.rawclearnirongladiusfortune",
"forgecraft:cauldron_item.rawsteelgladiussmite", "forgecraft:cauldron_item.rawsteelgladiusbane", "forgecraft:cauldron_item.rawsteelgladiusfire", "forgecraft:cauldron_item.rawsteelgladiusfortune",
"forgecraft:cauldron_item.rawwootzgladiussmite", "forgecraft:cauldron_item.rawwootzgladiusbane", "forgecraft:cauldron_item.rawwootzgladiusfire", "forgecraft:cauldron_item.rawwootzgladiusfortune",
"forgecraft:cauldron_item.rawcleanironlongswordsmite", "forgecraft:cauldron_item.rawcleanironlongswordbane", "forgecraft:cauldron_item.rawcleanironlongswordfire", "forgecraft:cauldron_item.rawcleanironlongswordfortune",
"forgecraft:cauldron_item.rawsteellongswordsmite", "forgecraft:cauldron_item.rawsteellongswordbane", "forgecraft:cauldron_item.rawsteellongswordfire", "forgecraft:cauldron_item.rawsteellongswordfortune",
"forgecraft:cauldron_item.rawwootzlongswordsmite", "forgecraft:cauldron_item.rawwootzlongswordbane", "forgecraft:cauldron_item.rawwootzlongswordfire", "forgecraft:cauldron_item.rawwootzlongswordfortune",
"forgecraft:cauldron_item.rawironslayersmite", "forgecraft:cauldron_item.rawironslayerbane", "forgecraft:cauldron_item.rawironslayerfire", "forgecraft:cauldron_item.rawironslayerfortune",
"forgecraft:cauldron_item.rawcleanironslayersmite", "forgecraft:cauldron_item.rawcleanironslayerbane", "forgecraft:cauldron_item.rawcleanironslayerfire", "forgecraft:cauldron_item.rawcleanironslayerfortune",
"forgecraft:cauldron_item.rawsteelslayersmite", "forgecraft:cauldron_item.rawsteelslayerbane", "forgecraft:cauldron_item.rawsteelslayerfire", "forgecraft:cauldron_item.rawsteelslayerfortune",
"forgecraft:cauldron_item.rawwootzslayersmite", "forgecraft:cauldron_item.rawwootzslayerbane", "forgecraft:cauldron_item.rawwootzslayerfire", "forgecraft:cauldron_item.rawwootzslayerfortune"
)){
NonNullList<ItemStack> inputList = NonNullList.<ItemStack>withSize(6, ItemStack.EMPTY); if(!event.player.getEntityWorld().isRemote) {
inputList.set(0, event.getTile().getInputHandler().getStackInSlot(0));
inputList.set(1, event.getTile().getInputHandler().getStackInSlot(1));
inputList.set(2, event.getTile().getInputHandler().getStackInSlot(2));
inputList.set(3, event.getTile().getInputHandler().getStackInSlot(3));
inputList.set(4, event.getTile().getInputHandler().getStackInSlot(4));
inputList.set(5, event.getTile().getInputHandler().getStackInSlot(5));
TileCauldron tile = event.getTile(); if (event.crafting.getItem() instanceof CustomPickaxe || event.crafting.getItem() instanceof BronzePickaxe) {
ItemStack inputStack = tile.getInputStack(event.getOutputs().get(0)); NBTTagCompound tempTag = new NBTTagCompound();
Item inputStackItem = null; for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if(inputStack.getItem() instanceof WeaponPart){
inputStackItem = inputStack.getItem(); if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
} }
ItemStack modStack = ItemStack.EMPTY; }
ItemStack outputStack = event.getOutputs().get(0); }
}
if (event.crafting.getItem() instanceof CustomAxe || event.crafting.getItem() instanceof BronzeAxe) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
modStack = getOppositeStack(inputList, inputStack); if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
}
}
}
}
if (event.crafting.getItem() instanceof CustomShovel || event.crafting.getItem() instanceof BronzeShovel) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if(inputStackItem != null) { if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
if (inputStack.hasTagCompound()) { ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (WeaponNBT.getModifiers(inputStack) < WeaponNBT.materialModifiers.get(((WeaponPart) outputStack.getItem()).getMaterial()) ) { if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
if (RecipeHelper.isOreName(modStack, "dustSilver")) { tempTag = a.getSubCompound("tags").copy();
WeaponNBT.setSmiteLevel(outputStack, WeaponNBT.getSmiteLevel(inputStack) + 1); event.crafting.getTagCompound().setTag("tags", tempTag);
WeaponNBT.setModifiers(outputStack, WeaponNBT.getModifiers(inputStack) + 1); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
} }
if (RecipeHelper.isOreName(modStack, "foodPoison")) {
WeaponNBT.setBaneLevel(outputStack, WeaponNBT.getBaneLevel(inputStack) + 1);
WeaponNBT.setModifiers(outputStack, WeaponNBT.getModifiers(inputStack) + 1);
} }
if (RecipeHelper.isOreName(modStack, "dustBlaze")) {
WeaponNBT.setFireLevel(outputStack, WeaponNBT.getFireLevel(inputStack) + 1);
WeaponNBT.setModifiers(outputStack, WeaponNBT.getModifiers(inputStack) + 1);
} }
if (RecipeHelper.isOreName(modStack, "gemLapis")) { }
WeaponNBT.setFortuneLevel(outputStack, WeaponNBT.getFortuneLevel(inputStack) + 1); if (event.crafting.getItem() instanceof CustomHoe || event.crafting.getItem() instanceof BronzeHoe) {
WeaponNBT.setModifiers(outputStack, WeaponNBT.getModifiers(inputStack) + 1); NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
}
}
}
}
if (event.crafting.getItem() instanceof ToolPart || event.crafting.getItem() instanceof BronzeToolPart) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof CustomAxe || a.getItem() instanceof BronzeAxe) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
if (a.getItem() instanceof CustomPickaxe || a.getItem() instanceof BronzePickaxe) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
if (a.getItem() instanceof CustomShovel || a.getItem() instanceof BronzeShovel) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
if (a.getItem() instanceof CustomHoe || a.getItem() instanceof BronzeHoe) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
} }
} }
} }
@@ -80,15 +121,5 @@ public class CommonEvents implements WeaponNBT {
} }
} }
private ItemStack getOppositeStack(NonNullList<ItemStack> inputList, ItemStack inputStack){
ItemStack modStack = ItemStack.EMPTY;
for (int i = 0; i < inputList.size(); i++) {
if(inputList.get(i) != ItemStack.EMPTY && !(inputList.get(i).getItem() instanceof WeaponPart) ){
modStack = inputList.get(i);
}
}
return modStack;
}
} }

View File

@@ -7,10 +7,9 @@ import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import nmd.primal.forgecraft.commands.CommandShowWiki; import nmd.primal.forgecraft.compat.ModDictionary;
import nmd.primal.forgecraft.gui.GuiHandler; import nmd.primal.forgecraft.gui.GuiHandler;
import nmd.primal.forgecraft.init.*; import nmd.primal.forgecraft.init.*;
import nmd.primal.forgecraft.proxy.CommonProxy; import nmd.primal.forgecraft.proxy.CommonProxy;
@@ -52,11 +51,10 @@ public class ForgeCraft
ModBlocks.register(); ModBlocks.register();
ModItems.init(); ModItems.init();
ModItems.register(); ModItems.register();
ModDictionary.registerDictionaryNames();
ModTiles.registerTileEntities(); ModTiles.registerTileEntities();
ModSounds.registerSounds(); ModSounds.registerSounds();
ModCrafting.register(); ModEvents.registerCommonEvents();
//ModEvents.registerClientEvents(); //ModEvents.registerClientEvents();
// ModItems.registerRenders(); // ModItems.registerRenders();
proxy.preInit(); proxy.preInit();
@@ -68,8 +66,8 @@ public class ForgeCraft
{ {
//this.proxy.init(event); //this.proxy.init(event);
proxy.init(); proxy.init();
ModDictionary.registerDictionaryNames();
ModCrafting.register();
//proxy.registerModelBakeryVariants(); //proxy.registerModelBakeryVariants();
} }
@@ -77,13 +75,7 @@ public class ForgeCraft
@EventHandler @EventHandler
public void postInit(FMLPostInitializationEvent event) public void postInit(FMLPostInitializationEvent event)
{ {
ModEvents.registerCommonEvents(); //this.proxy.postInit(event);
}
@EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
event.registerServerCommand(new CommandShowWiki());
} }
} }

View File

@@ -2,12 +2,8 @@ package nmd.primal.forgecraft;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.init.ModItems;
//import nmd.primal.forgecraft.Item.ModItems; //import nmd.primal.forgecraft.Item.ModItems;
@@ -21,10 +17,9 @@ public class ModInfo {
public static final String MOD_CONFIG = "primal/" + MOD_ID; public static final String MOD_CONFIG = "primal/" + MOD_ID;
//public static final String MOD_PREFIX = MOD_ID + ":"; //public static final String MOD_PREFIX = MOD_ID + ":";
public static final String MOD_CHANNEL = MOD_ID; public static final String MOD_CHANNEL = MOD_ID;
public static final String MOD_VERSION = "1.2.74";
public static final String MOD_VERSION = "1.6.51"; public static final String MC_VERSIONS = "[1.11.0, 1.12.0)";
public static final String MC_VERSIONS = "[1.12.0, 1.13.0)"; public static final String DEPENDENCIES = "required-after:forge@[13.20.1.2388,);" + "required-after:primal@[0.4,);";
public static final String DEPENDENCIES = "required-after:forge@[14.21.1.2400,);" + "required-after:primal@[0.6.69,);";
/** Mod Structures **/ /** Mod Structures **/
public static final String SERVER_PROXY = "nmd.primal.forgecraft.proxy.ServerProxy"; public static final String SERVER_PROXY = "nmd.primal.forgecraft.proxy.ServerProxy";
@@ -35,28 +30,10 @@ public class ModInfo {
/** Creative Tabs **/ /** Creative Tabs **/
public static CreativeTabs TAB_FORGECRAFT = new CreativeTabs(MOD_ID) public static CreativeTabs TAB_FORGECRAFT = new CreativeTabs(MOD_ID)
{ {
/*@Override
@SideOnly(Side.CLIENT)
public ItemStack createIcon() {
return new ItemStack(ModItems.forgehammer);
}*/
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public ItemStack getTabIconItem() { public ItemStack getTabIconItem() {
return new ItemStack(ModItems.forgehammer); return new ItemStack(ModItems.forgehammer);
} }
}; };
// ***************************************************************************** //
// ForgeCraft.Registries
// ***************************************************************************** //
public static class Registries
{
// In-World Recipes
public static final IForgeRegistry<CrucibleCrafting> CRUCIBLE_CRAFTING = GameRegistry.findRegistry(CrucibleCrafting.class);
public static final IForgeRegistry<WorkbenchCrafting> WORKBENCH_CRAFTING = GameRegistry.findRegistry(WorkbenchCrafting.class);
}
} }

View File

@@ -0,0 +1,142 @@
package nmd.primal.forgecraft.blocks.Anvil;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.tiles.TileAnvil;
import nmd.primal.forgecraft.util.AnvilHandler;
/**
* Created by mminaie on 6/11/17.
*/
public abstract class AnvilBase extends CustomContainerFacing implements AnvilHandler{
private boolean anvil;
public AnvilBase(Material material, String registryName, Float hardness, Boolean anvil) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setHardness(hardness);
this.setIsAnvil(anvil);
}
public boolean isAnvil() {
return anvil;
}
public void setIsAnvil(boolean anvil) {
anvil = anvil;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
AnvilHandler.doDrops(world, pos);
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileAnvil();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.blocks; package nmd.primal.forgecraft.blocks.Anvil;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@@ -8,7 +8,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import nmd.primal.core.common.items.tools.Gallagher; import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.tiles.TileAnvil; import nmd.primal.forgecraft.tiles.TileAnvil;
import nmd.primal.forgecraft.util.AnvilHandler; import nmd.primal.forgecraft.util.AnvilHandler;
@@ -32,12 +32,11 @@ public class AnvilIron extends AnvilBase implements AnvilHandler {
if (!world.isRemote) { if (!world.isRemote) {
ItemStack pItem = player.inventory.getCurrentItem(); ItemStack pItem = player.inventory.getCurrentItem();
TileAnvil tile = (TileAnvil) world.getTileEntity(pos); TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
ItemStack stack12 = tile.getSlotStack(12).copy();
if (tile != null) { if (tile != null) {
if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) { if ((pItem.getItem() instanceof WorkMallet) || (pItem.getItem() == ModItems.forgehammer)) {
ItemStack[] tempArray = new ItemStack[25]; String[] tempArray = new String[25];
for (int i = 0; i < 25; i++) { for (int i = 0; i < 25; i++) {
tempArray[i] = tile.getSlotStack(i); tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
} }
/*for (int i = 0; i < 25; i++) { /*for (int i = 0; i < 25; i++) {
if (tile.getSlotStack(i).getItem() instanceof BaseMultiItem) { if (tile.getSlotStack(i).getItem() instanceof BaseMultiItem) {
@@ -52,7 +51,7 @@ public class AnvilIron extends AnvilBase implements AnvilHandler {
} }
} }
}*/ }*/
doAnvilRecipe(pItem, stack12, tempArray, world, tile, pos, player); doAnvilRecipe(pItem, tempArray, world, tile, pos, player);
return true; return true;
} }
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player); doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);

View File

@@ -0,0 +1,7 @@
package nmd.primal.forgecraft.blocks.Anvil;
/**
* Created by mminaie on 6/10/17.
*/
public class AnvilSteel {
}

View File

@@ -0,0 +1,65 @@
package nmd.primal.forgecraft.blocks.Anvil;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import nmd.primal.core.api.PrimalItems;
import nmd.primal.core.api.PrimalMaterials;
import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.BaseMultiItem;
import nmd.primal.forgecraft.tiles.TileAnvil;
/**
* Created by mminaie on 3/4/17.
*/
public class AnvilStone extends AnvilBase {
public AnvilStone(Material material, String registryName, Float hardness, Boolean anvil) {
super(material, registryName, hardness, anvil);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
/******************************************************************************
Crafting AnvilStone Recipes
*****************************************************************************/
if (!world.isRemote) {
ItemStack pItem = player.inventory.getCurrentItem();
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
if (tile != null) {
if ((pItem.getItem() instanceof WorkMallet) || (pItem.getItem() == ModItems.forgehammer)) {
String[] tempArray = new String[25];
for (int i = 0; i < 25; i++) {
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
}
for (int i = 0; i < 25; i++) {
if (tile.getSlotStack(i).getItem() instanceof BaseMultiItem) {
if (((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_WROUGHT_IRON) {
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(PrimalItems.ROCK_STONE, 3));
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.ironball, 1));
this.breakBlock(world, pos, state);
return true;
}
}
}
doAnvilRecipe(pItem, tempArray, world, tile, pos, player);
return true;
}
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
return true;
}
}
return false;
}
}

View File

@@ -1,70 +0,0 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import nmd.primal.forgecraft.tiles.TileAnvil;
import nmd.primal.forgecraft.util.AnvilHandler;
/**
* Created by mminaie on 6/11/17.
*/
public abstract class AnvilBase extends CustomContainerFacing implements AnvilHandler{
private boolean anvil;
public AnvilBase(Material material, String registryName, Float hardness, Boolean anvil) {
super(material, registryName);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setHardness(hardness);
this.setIsAnvil(anvil);
}
public boolean isAnvil() {
return anvil;
}
public void setIsAnvil(boolean anvil) {
anvil = anvil;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops")) {
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
if (tile != null) {
for (ItemStack stack : tile.getSlotList()) {
if (stack != ItemStack.EMPTY) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
stack.setCount(1);
ItemStack dropStack = stack.copy();
dropStack.setCount(1);
EntityItem itemDrop = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, dropStack);
itemDrop.setDefaultPickupDelay();
world.spawnEntity(itemDrop);
}
}
}
}
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileAnvil();
}
}

View File

@@ -1,7 +0,0 @@
package nmd.primal.forgecraft.blocks;
/**
* Created by mminaie on 6/10/17.
*/
public class AnvilSteel {
}

View File

@@ -1,132 +0,0 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import nmd.primal.core.common.items.tools.Gallagher;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.tiles.TileAnvil;
/**
* Created by mminaie on 3/4/17.
*/
public class AnvilStone extends AnvilBase {
public AnvilStone(Material material, String registryName, Float hardness, Boolean anvil) {
super(material, registryName, hardness, anvil);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
/******************************************************************************
Crafting AnvilStone Recipes
*****************************************************************************/
ItemStack pItem = player.inventory.getCurrentItem();
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
ItemStack stack12 = tile.getSlotStack(12).copy();
if (!world.isRemote) {
if (hand.equals(hand.MAIN_HAND)) {
if (!stack12.isEmpty()) {
if (tile != null) {
if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) {
NBTTagCompound tempTag = new NBTTagCompound();
ItemStack tempironchunk = new ItemStack(ModItems.wroughtironchunk, 1);
tempironchunk.setTagCompound(tempTag);
tempironchunk.getTagCompound().setBoolean("hot", true);
ItemStack tempironcleanchunk = new ItemStack(ModItems.ironcleanchunk, 1);
tempironcleanchunk.setTagCompound(tempTag);
tempironcleanchunk.getTagCompound().setBoolean("hot", true);
ItemStack tempsteelchunk = new ItemStack(ModItems.steelchunk, 1);
tempsteelchunk.setTagCompound(tempTag);
tempsteelchunk.getTagCompound().setBoolean("hot", true);
ItemStack tempwootzchunk = new ItemStack(ModItems.wootzchunk, 1);
tempwootzchunk.setTagCompound(tempTag);
tempwootzchunk.getTagCompound().setBoolean("hot", true);
world.playEvent(1031, pos, 0);
if (stack12.getItem().equals(ModItems.ironingotball) && stack12.getTagCompound().getBoolean("hot")) {
world.playEvent(1031, pos, 0);
tile.setSlotStack(6, tempironchunk);
tile.setSlotStack(7, tempironchunk);
tile.setSlotStack(8, tempironchunk);
tile.setSlotStack(11, tempironchunk);
tile.setSlotStack(12, tempironchunk);
tile.setSlotStack(13, tempironchunk);
tile.setSlotStack(16, tempironchunk);
tile.setSlotStack(17, tempironchunk);
tile.setSlotStack(18, tempironchunk);
world.playEvent(1031, pos, 0);
return true;
}
if (stack12.getItem().equals(ModItems.ironcleaningotball) && stack12.getTagCompound().getBoolean("hot")) {
world.playEvent(1031, pos, 0);
tile.setSlotStack(6, tempironcleanchunk);
tile.setSlotStack(7, tempironcleanchunk);
tile.setSlotStack(8, tempironcleanchunk);
tile.setSlotStack(11, tempironcleanchunk);
tile.setSlotStack(12, tempironcleanchunk);
tile.setSlotStack(13, tempironcleanchunk);
tile.setSlotStack(16, tempironcleanchunk);
tile.setSlotStack(17, tempironcleanchunk);
tile.setSlotStack(18, tempironcleanchunk);
world.playEvent(1031, pos, 0);
return true;
}
if (stack12.getItem().equals(ModItems.steelingotball) && stack12.getTagCompound().getBoolean("hot")) {
world.playEvent(1031, pos, 0);
tile.setSlotStack(6, tempsteelchunk);
tile.setSlotStack(7, tempsteelchunk);
tile.setSlotStack(8, tempsteelchunk);
tile.setSlotStack(11, tempsteelchunk);
tile.setSlotStack(12, tempsteelchunk);
tile.setSlotStack(13, tempsteelchunk);
tile.setSlotStack(16, tempsteelchunk);
tile.setSlotStack(17, tempsteelchunk);
tile.setSlotStack(18, tempsteelchunk);
return true;
}
if (stack12.getItem().equals(ModItems.wootzingotball) && stack12.getTagCompound().getBoolean("hot")) {
world.playEvent(1031, pos, 0);
tile.setSlotStack(6, tempwootzchunk);
tile.setSlotStack(7, tempwootzchunk);
tile.setSlotStack(8, tempwootzchunk);
tile.setSlotStack(11, tempwootzchunk);
tile.setSlotStack(12, tempwootzchunk);
tile.setSlotStack(13, tempwootzchunk);
tile.setSlotStack(16, tempwootzchunk);
tile.setSlotStack(17, tempwootzchunk);
tile.setSlotStack(18, tempwootzchunk);
return true;
}
}
}
}
//if(! (pItem.getItem() instanceof SledgeHammer) ) {
if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) {
ItemStack[] tempArray = new ItemStack[25];
for (int i = 0; i < 25; i++) {
tempArray[i] = tile.getSlotStack(i);
}
doAnvilRecipe(pItem, stack12, tempArray, world, tile, pos, player);
return true;
}
//}
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,422 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.crafting.FireSource;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
import nmd.primal.forgecraft.tiles.TileBloomery;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 6/11/17.
*/
public class BloomeryBase extends CustomContainerFacing implements ITileEntityProvider {
//public static final PropertyBool COVERED = PropertyBool.create("covered");
private int maxHeat;
public AxisAlignedBB AABB = new AxisAlignedBB(5/32D, 0.0D, 5/32D, 27/32D, 12/16D, 27/32D);
public BloomeryBase(Material material, String registryName, Integer maxHeat) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f);
setResistance(5.0f);
this.maxHeat=maxHeat;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return AABB;
}
public int getMaxHeat() {
return maxHeat;
}
public void setMaxHeat(int maxHeat) {
this.maxHeat = maxHeat;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBloomery();
}
/*@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if(state.getValue(PrimalStates.ACTIVE) == true) {
FireHelper.makeSmoke(world, pos, 50);
}
}
}*/
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (world.isRemote)
return true;
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile != null) {
ItemStack pItem = player.inventory.getCurrentItem();
ItemStack tileItem = tile.getSlotStack(0);
ItemStack tileItem1 = tile.getSlotStack(1);
if(pItem.isEmpty()) {
if(!player.isSneaking()){
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true){
Integer bloomeryHeat = tile.getHeat();
String display = "\n" + "Current Temp: " + bloomeryHeat.toString() +
" Fuel Remaining: " + tileItem.getCount();
ITextComponent itextcomponent = new TextComponentString(display);
player.sendStatusMessage(itextcomponent, false);
BloomeryCrafting recipe = BloomeryCrafting.getRecipe(tile.getSlotStack(1));
if(recipe != null) {
Integer minTemp = recipe.getHeatThreshold();
Integer cookCounter = tile.getCookCounter();
Integer idealTime = recipe.getIdealTime();
Integer remainingTime = idealTime - cookCounter;
String display1 =
"Cooking: " + tileItem1.getDisplayName() +
" Target Temp: " + minTemp.toString() +
" Time Left: " + remainingTime.toString();
ITextComponent itextcomponent1 = new TextComponentString(display1);
player.sendStatusMessage(itextcomponent1, false);
}
return true;
}
}
}
if(tile.getSlotStack(0) != ItemStack.EMPTY) {
if((FireSource.useSource(world, pos, player, pItem, hand, facing, hitX, hitY, hitZ))) {
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, true), 2);
tile.setHeat(100);
tile.markDirty();
tile.updateBlock();
return true;
}
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
if (!tileItem.isEmpty()){
if(pItem.getItem() == tileItem.getItem()){
if(tileItem.getCount() < 64){
if(tileItem.getCount() + pItem.getCount() <= 64){
tileItem.grow(pItem.getCount());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
if(tileItem.getCount() + pItem.getCount() > 64){
pItem.setCount(64-pItem.getCount());
tileItem.setCount(64);
tile.markDirty();
tile.updateBlock();
return true;
}
}
}
}
if(tileItem.isEmpty()) {
tile.setSlotStack(0, pItem);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(1, pItem)) {
if (!tileItem1.isEmpty()) {
return false;
}
if(tileItem1.isEmpty()){
ItemStack tempItem = new ItemStack(pItem.getItem(), 1);
tile.setSlotStack(1, tempItem);
pItem.shrink(1);
return true;
}
}
if (player.isSneaking()) {
if (!tile.getSlotStack(0).isEmpty()) {
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
ItemStack returnStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
tile.clearSlot(0);
return true;
}
}
}
}
return false;
}
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
int lightState =0;
if(state.getValue(PrimalStates.ACTIVE) == true){
lightState = 10;
}
return lightState;
}
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return 0;
}
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return true;
}
@Override
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{
if(!world.isRemote){
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE)==true){
return true;
}
}
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{
if(ent instanceof EntityPlayer){
if(state.getValue(PrimalStates.ACTIVE) == true){
ent.setFire(1);
}
}
}
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == false){
i = 0;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == false){
i = 1;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == false){
i = 2;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == false){
i = 3;
return i;
}
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == true){
i = 4;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == true){
i = 5;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == true){
i = 6;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == true){
i = 7;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing enumfacing;
Boolean active;
switch (meta & 7)
{
case 0:
enumfacing = EnumFacing.EAST;
active = false;
break;
case 1:
enumfacing = EnumFacing.WEST;
active = false;
break;
case 2:
enumfacing = EnumFacing.SOUTH;
active = false;
break;
case 3:
enumfacing = EnumFacing.NORTH;
active = false;
break;
case 4:
enumfacing = EnumFacing.EAST;
active = true;
break;
case 5:
enumfacing = EnumFacing.WEST;
active = true;
break;
case 6:
enumfacing = EnumFacing.SOUTH;
active = true;
break;
case 7:
enumfacing = EnumFacing.NORTH;
active = true;
break;
default:
enumfacing = EnumFacing.NORTH;
active = false;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(active));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalStates.ACTIVE});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
if(state.getValue(PrimalStates.ACTIVE) == true)
{
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.2D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.075, 0.35);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.0, 0.075);
if (rand.nextDouble() < 0.1D)
{
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
}
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
}
}
}

View File

@@ -0,0 +1,236 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileBreaker;
import nmd.primal.forgecraft.util.BreakerHandler;
/**
* Created by mminaie on 4/9/17.
*/
public class Breaker extends CustomContainerFacing implements BreakerHandler {
public AxisAlignedBB AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 6/16D, 1.0D);
public Breaker(Material material, String registryName, Float hardness) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, false));
setHardness(hardness);
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return AABB;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if(!world.isRemote){
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
if(state.getValue(PrimalStates.ACTIVE) == true && player.isSneaking() && pItem.isEmpty()){
doBreaking(world, state, pos, tile);
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalStates.ACTIVE, false));
tile.setCharge(0);
return true;
}
if(!player.isSneaking() && pItem.isEmpty()) {
if (!state.getValue(PrimalStates.ACTIVE)) {
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalStates.ACTIVE, true), 2);
return true;
}
if(state.getValue(PrimalStates.ACTIVE)) {
if (tile.getCharge() < 181) {
tile.setCharge(tile.getCharge() + 2.0f);
tile.updateBlock();
//System.out.println(tile.charge);
return true;
}
}
}
if(pItem.getItem() instanceof WorkMallet){
tile.setSlotStack(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
return false;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBreaker();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, false), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if(state.getValue(PrimalStates.ACTIVE ) == false) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 2;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 3;
return i;
}
}
if(state.getValue(PrimalStates.ACTIVE)) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 4;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 5;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 6;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 7;
return i;
}
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, false);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, false);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, false);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, false);
}
if (meta == 4){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, true);
}
if (meta == 5) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, true);
}
if (meta == 6) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, true);
}
if (meta == 7) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, true);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {PrimalStates.ACTIVE, FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,689 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.casting.CastingPart;
import nmd.primal.forgecraft.tiles.TileCastingBlock;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 6/24/17.
*/
public class CastingBlock extends CustomContainerFacing {
protected static AxisAlignedBB bound = new AxisAlignedBB(0/16D, 0.0D, 0/16D, 16/16D, 5.5/16D, 16/16D);
public CastingBlock(Material material, String registryName) {
super(material, registryName);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
private void makeEmbers(World world, BlockPos pos, Random rand){
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.2D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.066, 0.33);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.05, 0.20);
if(rand.nextInt(3) == 0){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
}
if(rand.nextInt(3) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
}
if(rand.nextInt(3) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
}
if(rand.nextInt(3) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
}
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if (!world.isRemote) {
TileCastingBlock tile = (TileCastingBlock) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
if(player.isSneaking()) {
if(!tile.getSlotStack(0).isEmpty()){
ItemStack copyStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, copyStack);
tile.setSlotStack(0, ItemStack.EMPTY);
tile.updateBlock();
return true;
}
}
if(pItem.getItem() instanceof CastingPart){
if(!player.isSneaking()) {
if (tile.getSlotStack(0).isEmpty()) {
ItemStack copyStack = pItem.copy();
copyStack.setCount(1);
pItem.shrink(1);
tile.setSlotStack(0, copyStack);
tile.updateBlock();
return true;
}
}
}
if(pItem.getItem() == ModItems.stonetongs ){
ItemStack dropCrucible = new ItemStack(ModBlocks.emptycrucible);
if(pItem.getTagCompound().getInteger("type") == 40){
if(tile.getSlotStack(0).getItem() == ModItems.cast_hoe){
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
//makeEmbers(world, pos, world.rand);
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe){
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_axe){
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_shovel){
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_gladius){
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
/***************************
* Bronze *
*
46 | Hot Cooked Bronze Crucible Emerald
48 | Hot Cooked Bronze Crucible Diamond
50 | Hot Cooked Bronze Crucible Redstone
52 | Hot Cooked Bronze Crucible Lapis
***************************/
if(pItem.getTagCompound().getInteger("type") == 46){
if(tile.getSlotStack(0).getItem() == ModItems.cast_hoe){
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", true);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe){
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", true);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_axe){
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", true);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_shovel){
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", true);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_gladius){
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
if(pItem.getTagCompound().getInteger("type") == 48) {
if (tile.getSlotStack(0).getItem() == ModItems.cast_hoe) {
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 1);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe) {
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 1);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_axe) {
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 1);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_shovel) {
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 1);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_gladius) {
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
if(pItem.getTagCompound().getInteger("type") == 50) {
if (tile.getSlotStack(0).getItem() == ModItems.cast_hoe) {
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 1);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe) {
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 1);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_axe) {
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 1);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_shovel) {
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 1);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_gladius) {
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
if(pItem.getTagCompound().getInteger("type") == 52) {
if (tile.getSlotStack(0).getItem() == ModItems.cast_hoe) {
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 1);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe) {
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 1);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_axe) {
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 1);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_shovel) {
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 1);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_gladius) {
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
}
}
return false;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileCastingBlock tile = (TileCastingBlock) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileCastingBlock();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return bound;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,192 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileCastingForm;
import nmd.primal.forgecraft.util.CastingFormHandler;
import java.util.Random;
/**
* Created by mminaie on 6/19/17.
*/
public class CastingForm extends CustomContainerFacing implements CastingFormHandler{
protected static AxisAlignedBB bound = new AxisAlignedBB(0/16D, 0.0D, 0/16D, 16/16D, 3/16D, 16/16D);
public CastingForm(Material material, String registryName) {
super(material, registryName);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setTickRandomly(true);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if (!world.isRemote) {
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
doInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
return false;
}
return false;
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random random)
{
if (!world.isRemote) {
if(CommonUtils.randomCheck(4)) {
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
String[] tempArray = new String[25];
for (int i = 0; i < 25; i++) {
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
}
doCraftingformCrafting(tempArray, world, tile, pos);
}
}
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileCastingForm();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return bound;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,481 +0,0 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.MobEffects;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.init.ModSounds;
import nmd.primal.forgecraft.items.SledgeHammer;
import nmd.primal.forgecraft.util.ToolMaterialMap;
import javax.annotation.Nullable;
public class Chisel extends CustomFacing implements ToolMaterialMap {
private AxisAlignedBB boundBoxDown = new AxisAlignedBB(
0.4375D, 0.0D, 0.4375D,
0.5625D, 0.875D, 0.5625D);
private AxisAlignedBB boundBoxDownActive = new AxisAlignedBB(
0.4375D, 0.0D, 0.4375D,
0.5625D, 0.375D, 0.5625D);
private AxisAlignedBB boundBoxUp = new AxisAlignedBB(
0.4375D, 0.125D, 0.4375D,
0.5625D, 1.0, 0.5625D);
private AxisAlignedBB boundBoxUpActive = new AxisAlignedBB
(0.4375D, 0.625D, 0.4375D,
0.5625D, 1.0D, 0.5625D);
private AxisAlignedBB boundBoxEast = new AxisAlignedBB(
0.125D, 0.4375D, 0.4375D,
1.0D, 0.5625D, 0.5625D);
private AxisAlignedBB boundBoxEastActive = new AxisAlignedBB(
0.625D, 0.4375D, 0.4375D,
1.0D, 0.5625D, 0.5625D);
private AxisAlignedBB boundBoxWest = new AxisAlignedBB(
0.0D, 0.4375D, 0.4375D,
0.875D, 0.5625D, 0.5625D);
private AxisAlignedBB boundBoxWestActive = new AxisAlignedBB(
0.0D, 0.4375D, 0.4375D,
0.375D, 0.5625D, 0.5625D);
private AxisAlignedBB boundBoxNorth = new AxisAlignedBB(
0.4375D, 0.4375D, 0.0D,
0.5625D, 0.5625D, 0.875D);
private AxisAlignedBB boundBoxNorthActive = new AxisAlignedBB(
0.4375D, 0.4375D, 0.0D,
0.5625D, 0.5625D, 0.375D);
private AxisAlignedBB boundBoxSouth = new AxisAlignedBB(
0.4375D, 0.4375D, 0.125D,
0.5625D, 0.5625D, 1.0D);
private AxisAlignedBB boundBoxSouthActive = new AxisAlignedBB(
0.4375D, 0.4375D, 0.625D,
0.5625D, 0.5625D, 1.0D);
private Item.ToolMaterial realMaterial;
public Chisel(Material material, String name, Item.ToolMaterial realMaterial) {
super(material, name);
this.setHardness(8.0f);
this.setResistance(8.0f);
this.realMaterial = realMaterial;
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.DOWN).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)));
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
if(state.getValue(FACING)==EnumFacing.UP && !state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxUp;
}
if(state.getValue(FACING)==EnumFacing.UP && state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxUpActive;
}
if(state.getValue(FACING)==EnumFacing.DOWN && !state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxDown;
}
if(state.getValue(FACING)==EnumFacing.DOWN && state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxDownActive;
}
if(state.getValue(FACING)==EnumFacing.EAST && !state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxEast;
}
if(state.getValue(FACING)==EnumFacing.EAST && state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxEastActive;
}
if(state.getValue(FACING)==EnumFacing.WEST && !state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxWest;
}
if(state.getValue(FACING)==EnumFacing.WEST && state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxWestActive;
}
if(state.getValue(FACING)==EnumFacing.NORTH && !state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxNorth;
}
if(state.getValue(FACING)==EnumFacing.NORTH && state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxNorthActive;
}
if(state.getValue(FACING)==EnumFacing.SOUTH && !state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxSouth;
}
if(state.getValue(FACING)==EnumFacing.SOUTH && state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxSouthActive;
}
return boundBoxDown;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
if(!world.isRemote) {
world.setBlockState(pos, state.withProperty(FACING, EnumFacing.getFacingFromVector((float)placer.getLookVec().x, (float)placer.getLookVec().y, (float)placer.getLookVec().z)).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
}
}
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalAPI.States.ACTIVE});
}
public Item.ToolMaterial getRealMaterial() {
return realMaterial;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if(!world.isRemote){
ItemStack playerStack = player.inventory.getCurrentItem();
ItemStack offStack = player.inventory.offHandInventory.get(0);
int toolHarvestLevel = playerStack.getItem().getHarvestLevel(playerStack, "pickaxe", player, state);
if(player.getActiveItemStack().isEmpty()){
if(player.isSneaking()){
PlayerHelper.spawnItemOnPlayer(world, player, new ItemStack(Item.getItemFromBlock(state.getBlock()), 1));
world.setBlockToAir(pos);
return true;
}
}
if (hand.equals(hand.MAIN_HAND) && offStack == ItemStack.EMPTY) {
if(!player.isSwingInProgress) {
if(player.getActivePotionEffect(MobEffects.MINING_FATIGUE ) == null){
if (playerStack.getItem() instanceof SledgeHammer) {
SledgeHammer playerItem = (SledgeHammer) playerStack.getItem();
world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.CHISEL_HIT, SoundCategory.BLOCKS, (float) (PrimalAPI.getRandom().nextDouble(0.5D, 0.8D)), (float) (PrimalAPI.getRandom().nextDouble(0.3D, 1.0D)));
playerStack.damageItem(1, player);
player.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, (100 - ((materialModifiers.get(playerItem.getMaterial()) * 8) + (materialModifiers.get(this.getRealMaterial()) * 8))), 100));
if (PrimalAPI.getRandom().nextInt(1, 10) != 1) {
if (state.getValue(FACING) == EnumFacing.UP) {
if (state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (1), (i - 1));
IBlockState breakState = world.getBlockState(movePos);
if (state.getValue(PrimalAPI.States.ACTIVE)) {
doBreaking(world, movePos, breakState, player);
}
}
}
doMoving(world, pos, toolHarvestLevel, state, state.getValue(FACING));
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (1), (i - 1));
if (!(world.getBlockState(movePos).getBlock() instanceof Chisel)) {
IBlockState breakState = world.getBlockState(movePos);
doDamaging(world, movePos, breakState, player);
}
}
}
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
}
if (state.getValue(FACING) == EnumFacing.DOWN) {
if (state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (-1), (i - 1));
IBlockState breakState = world.getBlockState(movePos);
if (state.getValue(PrimalAPI.States.ACTIVE)) {
doBreaking(world, movePos, breakState, player);
}
}
}
doMoving(world, pos, toolHarvestLevel, state, state.getValue(FACING));
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (-1), (i - 1));
if (!(world.getBlockState(movePos).getBlock() instanceof Chisel)) {
IBlockState breakState = world.getBlockState(movePos);
doDamaging(world, movePos, breakState, player);
}
}
}
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
if (state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (i - 1), (1));
IBlockState breakState = world.getBlockState(movePos);
if (state.getValue(PrimalAPI.States.ACTIVE)) {
doBreaking(world, movePos, breakState, player);
}
}
}
doMoving(world, pos, toolHarvestLevel, state, state.getValue(FACING));
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (i - 1), (1));
if (!(world.getBlockState(movePos).getBlock() instanceof Chisel)) {
IBlockState breakState = world.getBlockState(movePos);
doDamaging(world, movePos, breakState, player);
}
}
}
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
if (state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (i - 1), (-1));
IBlockState breakState = world.getBlockState(movePos);
if (state.getValue(PrimalAPI.States.ACTIVE)) {
doBreaking(world, movePos, breakState, player);
}
}
}
doMoving(world, pos, toolHarvestLevel, state, state.getValue(FACING));
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (i - 1), (-1));
if (!(world.getBlockState(movePos).getBlock() instanceof Chisel)) {
IBlockState breakState = world.getBlockState(movePos);
doDamaging(world, movePos, breakState, player);
}
}
}
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
}
if (state.getValue(FACING) == EnumFacing.EAST) {
if (state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((1), (i - 1), (a - 1));
IBlockState breakState = world.getBlockState(movePos);
if (state.getValue(PrimalAPI.States.ACTIVE)) {
doBreaking(world, movePos, breakState, player);
}
}
}
doMoving(world, pos, toolHarvestLevel, state, state.getValue(FACING));
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((1), (i - 1), (a - 1));
if (!(world.getBlockState(movePos).getBlock() instanceof Chisel)) {
IBlockState breakState = world.getBlockState(movePos);
doDamaging(world, movePos, breakState, player);
}
}
}
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
}
if (state.getValue(FACING) == EnumFacing.WEST) {
if (state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((-1), (i - 1), (a - 1));
IBlockState breakState = world.getBlockState(movePos);
if (state.getValue(PrimalAPI.States.ACTIVE)) {
doBreaking(world, movePos, breakState, player);
}
}
}
doMoving(world, pos, toolHarvestLevel, state, state.getValue(FACING));
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((-1), (i - 1), (a - 1));
if (!(world.getBlockState(movePos).getBlock() instanceof Chisel)) {
IBlockState breakState = world.getBlockState(movePos);
doDamaging(world, movePos, breakState, player);
}
}
}
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
}
}
}
}
}
}
if(offStack != ItemStack.EMPTY) {
String printout = "Is your offhand empty?";
ITextComponent text = new TextComponentString(printout);
player.sendStatusMessage(text, true);
return false;
}
}
return false;
}
/**
* Convert the given metadata into a BlockState for this Block
*/
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(FACING, getFacing(meta)).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf((meta & 8) > 0));
}
@Nullable
public static EnumFacing getFacing(int meta)
{
int i = meta & 7;
return i > 5 ? null : EnumFacing.getFront(i);
}
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(IBlockState state)
{
int i = 0;
i = i | ((EnumFacing)state.getValue(FACING)).getIndex();
if (((Boolean)state.getValue(PrimalAPI.States.ACTIVE)).booleanValue())
{
i |= 8;
}
return i;
}
private EnumFacing reverseFacing(EnumFacing facing){
if(facing == EnumFacing.UP){
return EnumFacing.DOWN;
}
if(facing == EnumFacing.DOWN){
return EnumFacing.UP;
}
if(facing == EnumFacing.NORTH){
return EnumFacing.SOUTH;
}
if(facing == EnumFacing.SOUTH){
return EnumFacing.NORTH;
}
if(facing == EnumFacing.EAST){
return EnumFacing.WEST;
}
if(facing == EnumFacing.WEST){
return EnumFacing.EAST;
}
return null;
}
@SideOnly(Side.CLIENT)
public boolean hasCustomBreakingProgress(IBlockState state)
{
return true;
}
private void doMoving(World world, BlockPos pos, int toolHarvestLevel, IBlockState state, EnumFacing facing){
if( (world.getBlockState(pos.offset(facing, 2)).getBlock() != Blocks.AIR) ) {
if ((compareHarvestLevel(toolHarvestLevel, world.getBlockState(pos.offset(facing, 1)).getBlock().getHarvestLevel(world.getBlockState(pos.offset(facing, 1))))) &&
(world.getBlockState(pos.offset(facing, 1)).getBlock() == Blocks.AIR)) {
world.setBlockState(pos.offset(facing, 1), state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
world.setBlockToAir(pos);
}
} else {
world.destroyBlock(pos, true);
}
}
private void doBreaking(World world, BlockPos movePos, IBlockState state, EntityPlayer player){
if (!(state.getBlock().equals(Blocks.AIR))) {
if(world.getBlockState(movePos).getBlock().getBlockHardness(state, world, movePos)>0) {
ItemStack playerStack = player.inventory.getCurrentItem();
int toolHarvestLevel = playerStack.getItem().getHarvestLevel(playerStack, "pickaxe", player, state);
world.destroyBlock(movePos, compareHarvestLevel(toolHarvestLevel, state.getBlock().getHarvestLevel(state)));
world.sendBlockBreakProgress(player.getEntityId()+PrimalAPI.getRandom().nextInt(100), movePos, 0);
}
}
}
private void doDamaging(World world, BlockPos movePos, IBlockState state, EntityPlayer player){
if (!(state.getBlock().equals(Blocks.AIR))) {
if(world.getBlockState(movePos).getBlock().blockHardness>0) {
world.sendBlockBreakProgress(player.getEntityId() - PrimalAPI.getRandom().nextInt(100), movePos, PrimalAPI.getRandom().nextInt(3,10));
}
}
}
private boolean compareHarvestLevel(int inputLevel, int compareHarvest){
if(inputLevel >= compareHarvest && inputLevel >=0){
return true;
} else return false;
}
private void makeParticles(World world, BlockPos pos, EnumParticleTypes particle, EnumFacing facing){
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.5D;
double d2 = (double)pos.getZ() + 0.5D;
double xVelocity = 0.0D;
double yVelocity = 0.0D;
double zVelocity = 0.0D;
double d4 = PrimalAPI.getRandom().nextDouble(0.066, 0.33);
if(facing == EnumFacing.NORTH){
d0 += 0.5D;
}
if(facing == EnumFacing.DOWN){
d1 += 0.5D;
yVelocity += 0.1D;
}
if(facing == EnumFacing.UP){
d1 -= 0.5D;
}
//if(PrimalAPI.getRandom().nextInt(3) == 0){
world.spawnParticle(particle, d0, d1, d2, 0.0D + xVelocity, 0.0 + yVelocity, 0.0D + zVelocity, new int[1]);
world.spawnParticle(particle, d0, d1, d2, 0.0D + xVelocity, 0.0 + yVelocity, 0.0D + zVelocity, new int[1]);
//}
//double ySpeed = ThreadLocalRandom.current().nextDouble(0.05, 0.20);
}
}

View File

@@ -0,0 +1,190 @@
package nmd.primal.forgecraft.blocks.Crucibles;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalItems;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks;
import org.apache.commons.lang3.StringUtils;
import java.util.Random;
import static nmd.primal.forgecraft.CommonUtils.spawnItemEntityFromWorld;
/**
* Created by mminaie on 1/24/17.
*/
public class Crucible extends Block {
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
//public static final PropertyInteger SIZE = PropertyInteger.create("size", 0, 3);
public Crucible(Material material, String registryName) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setHardness(3.0f);
//this.blockState.getBaseState().withProperty(SIZE, Integer.valueOf(0));
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
ItemStack pItem = player.inventory.getCurrentItem();
if(pItem.isEmpty()){
CommonUtils.spawnItemEntity(world, player, new ItemStack(this, 1));
world.setBlockToAir(pos);
return true;
}
if(Block.getBlockFromItem(pItem.getItem()) == this){
CommonUtils.spawnItemEntity(world, player, new ItemStack(this, 1));
world.setBlockToAir(pos);
return true;
}
}
return false;
}
/*@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
ret.add(0, new ItemStack(ModBlocks.emptycrucible, 1));
if(this.getUnlocalizedName()=="tile.coolironcrucible"){
ret.add(1, new ItemStack(Items.IRON_INGOT, 1));
}
return ret;
}*/
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
{
if(!world.isRemote){
if(this.getUnlocalizedName().equals("tile.emptycruciblecracked")){} else spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.emptycrucible, 1));
if(StringUtils.isEmpty(this.getUnlocalizedName()) == false) {
if(checkDrops(this.getUnlocalizedName()) != null) {
if (checkDrops(this.getUnlocalizedName()).equals(this.getUnlocalizedName())) {
spawnItemEntityFromWorld(world, pos, new ItemStack(getItemFromName(this.getUnlocalizedName()), 1));
}
}
}
}
}
private String checkDrops(String name){
String string = null;
if(name.equals("tile.coolironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.coolcleanironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawcleanironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.coolsteelcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawsteelcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.coolwootzcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawwootzcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.emptycruciblecracked")){
string = this.getUnlocalizedName();
}
return string;
}
private Item getItemFromName(String name){
if(name.equals("tile.coolironcrucible")){
return Item.getItemFromBlock(ModBlocks.ironball);
} else if (name.equals("tile.rawironcrucible")){
return Item.getItemFromBlock(Blocks.IRON_ORE);
} else if (name.equals("tile.coolcleanironcrucible")){
return Item.getItemFromBlock(ModBlocks.ironcleanball);
} else if (name.equals("tile.rawcleanironcrucible")){
return PrimalItems.IRON_DUST;
} else if (name.equals("tile.coolsteelcrucible")){
return Item.getItemFromBlock(ModBlocks.steelball);
} else if (name.equals("tile.rawsteelcrucible")){
return Item.getItemFromBlock(ModBlocks.ironcleanball);
} else if (name.equals("tile.coolwootzcrucible")){
return Item.getItemFromBlock(ModBlocks.wootzball);
} else if (name.equals("tile.rawcleanironcrucible")){
return PrimalItems.GOLDEN_STICK;
}else if (name.equals("tile.emptycruciblecracked")){
return Items.CLAY_BALL;
}
else return Items.AIR;
}
@Override
public int quantityDropped(Random random)
{
return 0;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,101 @@
package nmd.primal.forgecraft.blocks.Crucibles;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileBaseCrucible;
import java.util.Random;
/**
* Created by mminaie on 2/4/17.
*/
public class CrucibleHot extends Block implements ITileEntityProvider {
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
//public static final PropertyInteger SIZE = PropertyInteger.create("size", 0, 3);
public CrucibleHot(Material material, String registryName) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setHardness(3.0f);
//this.blockState.getBaseState().withProperty(SIZE, Integer.valueOf(0));
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
return false;
}
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
{
if(!world.isRemote){
world.setBlockState(pos, Blocks.FLOWING_LAVA.getDefaultState().withProperty(BlockDynamicLiquid.LEVEL, 1), 3);
}
}
@Override
public int quantityDropped(Random random)
{
return 0;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBaseCrucible();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,21 +1,10 @@
package nmd.primal.forgecraft.blocks; package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
/** /**
* Created by kitsu on 12/3/2016. * Created by kitsu on 12/3/2016.
@@ -31,89 +20,10 @@ public abstract class CustomContainerFacing extends BlockContainer {
this.setUnlocalizedName(registryName); this.setUnlocalizedName(registryName);
this.setHardness(3.0f); this.setHardness(3.0f);
this.setResistance(4.0f); this.setResistance(4.0f);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
} }
@Override protected CustomContainerFacing(Material material, MapColor color)
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{ {
//if(!worldIn.isRemote) { super(material, color);
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
} }
} }

View File

@@ -1,138 +0,0 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by kitsu on 12/3/2016.
*/
public abstract class CustomContainerFacingActive extends BlockContainer {
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
protected CustomContainerFacingActive(Material material, String registryName)
{
super(material);
this.setRegistryName(registryName);
this.setUnlocalizedName(registryName);
this.setHardness(3.0f);
this.setResistance(4.0f);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, false), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if(!state.getValue(PrimalAPI.States.ACTIVE)) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 2;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 3;
return i;
}
}
if(state.getValue(PrimalAPI.States.ACTIVE)) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 4;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 5;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 6;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 7;
return i;
}
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalAPI.States.ACTIVE});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,51 +1,26 @@
package nmd.primal.forgecraft.blocks; package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockDirectional; import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
/** /**
* Created by mminaie on 1/1/17. * Created by mminaie on 1/1/17.
*/ */
public abstract class CustomFacing extends BlockDirectional { public abstract class CustomFacing extends Block {
protected CustomFacing(Material material, String name) { public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
protected CustomFacing(Material material)
{
super(material); super(material);
this.setRegistryName(name);
this.setUnlocalizedName(name);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
} }
@Override protected CustomFacing(Material material, MapColor color)
public boolean isFullCube(IBlockState state)
{ {
return false; super(material, color);
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
} }
} }

View File

@@ -0,0 +1,488 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.crafting.FireSource;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.tiles.TileForge;
import javax.annotation.Nullable;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
//import nmd.primal.core.api.PrimalBlocks;
/**
* Created by kitsu on 11/26/2016.
*/
public class Forge extends CustomContainerFacing implements ITileEntityProvider{
private int maxHeat;
//public static final PropertyBool PrimalStates.ACTIVE = PropertyBool.create("PrimalStates.ACTIVE");
protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D);
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
public Forge(Material material, String name, Integer maxHeat) {
super(material, name);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f);
setResistance(5.0f);
this.maxHeat=maxHeat;
}
public int getMaxHeat() {
return maxHeat;
}
public void setMaxHeat(int maxHeat) {
this.maxHeat = maxHeat;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileForge();
}
@Nullable
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
{
return collideBox;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (!world.isRemote) {
TileForge tile = (TileForge) world.getTileEntity(pos);
if (tile != null) {
ItemStack pItem = player.inventory.getCurrentItem();
ItemStack fuelItem = tile.getSlotStack(0);
//System.out.println(pItem.getItem().getRegistryName().toString());
/***********************
FUEL SLOT CODE
***********************/
if (player.isSneaking()) {
if (!tile.getSlotStack(0).isEmpty()) {
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
ItemStack returnStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
tile.clearSlot(0);
return true;
}
}
}
if(pItem.isEmpty()) {
if(!player.isSneaking()){
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true){
Integer tempInt = tile.getHeat();
String tempString = tempInt.toString();
ITextComponent itextcomponent = new TextComponentString(tempString);
player.sendStatusMessage(itextcomponent, true);
//System.out.println(pos);
return true;
}
}
}
if((FireSource.useSource(world, pos, player, pItem, hand, facing, hitX, hitY, hitZ))) {
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, true), 2);
tile.setHeat(100);
tile.markDirty();
tile.updateBlock();
return true;
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
if (!fuelItem.isEmpty()){
if(pItem.getItem() == fuelItem.getItem()){
if(fuelItem.getCount() < 64){
if(fuelItem.getCount() + pItem.getCount() <= 64){
fuelItem.grow(pItem.getCount());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
if(fuelItem.getCount() + pItem.getCount() > 64){
pItem.setCount(64-pItem.getCount());
fuelItem.setCount(64);
tile.markDirty();
tile.updateBlock();
return true;
}
}
}
}
if(fuelItem.isEmpty()) {
tile.setSlotStack(0, pItem);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
/***********************
FORGING SLOTS CODE
***********************/
//REMOVE COOL INGOT
if(facing == EnumFacing.UP ) {
/*if (pItem.isEmpty()) {
for (int i = 2; i < tile.getSlotListSize(); i++) {
//System.out.println(i);
if (!tile.getSlotStack(i).isEmpty()) {
if (Block.getBlockFromItem(tile.getSlotStack(i).getItem()) instanceof IngotBall) {
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
tile.setSlotStack(i, ItemStack.EMPTY);
return true;
}
if(tile.getSlotStack(i).hasTagCompound() == true){
if (tile.getSlotStack(i).getTagCompound().getBoolean("hot") == false) {
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
tile.setSlotStack(i, ItemStack.EMPTY);
return true;
}
}
}
}
}*/
if (Block.getBlockFromItem(pItem.getItem()) instanceof IngotBall) {
//System.out.println("Activating");
for (int i = 2; i <= tile.getSlotListSize(); i++) {
if (tile.getSlotStack(i).isEmpty()) {
tile.setSlotStack(i, new ItemStack(pItem.getItem(), 1));
pItem.shrink(1);
return true;
}
}
}
//Needs Ore Dictionary Compat
if (pItem.getItem().equals(new ItemStack(Items.IRON_INGOT).getItem())) {
for (int i = 2; i < 7; i++) {
if (tile.getSlotStack(i).isEmpty()) {
tile.setSlotStack(i, new ItemStack(Items.IRON_INGOT, 1));
pItem.shrink(1);
return true;
}
}
}
if(pItem.getItem() instanceof ToolPart){
if(tile.getSlotStack(4).isEmpty()){
//System.out.println("Adding player Item to slot");
tile.setSlotStack(4, pItem);
//System.out.println(tile.getSlotStack(4));
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
}
}
//System.out.println(tile.getSlotStack(0));
//System.out.println(tile.getSlotStack(1));
//System.out.println(tile.getSlotStack(2));
//System.out.println(tile.getSlotStack(3));
//System.out.println(tile.getSlotStack(4));
//System.out.println(tile.getSlotStack(5));
//System.out.println(tile.getSlotStack(6));
}
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{
//if (!world.isRemote){
if(ent instanceof EntityPlayer){
if(state.getValue(PrimalStates.ACTIVE) == true){
ent.setFire(1);
}
}
//}
}
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
}
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
if(state.getValue(PrimalStates.ACTIVE) == true){
return 15;
}
return 0;
}
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return 0;
}
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return true;
}
@Override
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{
if (side == EnumFacing.UP)
{
if(!world.isRemote){
TileForge tile = (TileForge) world.getTileEntity(pos);
if(tile.getSlotStack(0) != ItemStack.EMPTY){
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE)==true){
return true;
}
}
}
}
return false;
}
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileForge tile = (TileForge) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
/*@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
IBlockState state = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
return state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false));
}*/
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == false){
i = 0;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == false){
i = 1;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == false){
i = 2;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == false){
i = 3;
return i;
}
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == true){
i = 4;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == true){
i = 5;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == true){
i = 6;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == true){
i = 7;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing enumfacing;
Boolean active;
switch (meta & 7)
{
case 0:
enumfacing = EnumFacing.EAST;
active = false;
break;
case 1:
enumfacing = EnumFacing.WEST;
active = false;
break;
case 2:
enumfacing = EnumFacing.SOUTH;
active = false;
break;
case 3:
enumfacing = EnumFacing.NORTH;
active = false;
break;
case 4:
enumfacing = EnumFacing.EAST;
active = true;
break;
case 5:
enumfacing = EnumFacing.WEST;
active = true;
break;
case 6:
enumfacing = EnumFacing.SOUTH;
active = true;
break;
case 7:
enumfacing = EnumFacing.NORTH;
active = true;
break;
default:
enumfacing = EnumFacing.NORTH;
active = false;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(active));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalStates.ACTIVE});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if(state.getValue(PrimalStates.ACTIVE) == true) {
makeSmoke(world, pos);
}
}
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
if(state.getValue(PrimalStates.ACTIVE) == true)
{
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.96D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.075, 0.35);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.0, 0.075);
if (rand.nextDouble() < 0.1D)
{
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
}
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
}
}
}

View File

@@ -0,0 +1,119 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import nmd.primal.core.api.PrimalStates;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 2/6/17.
*/
public class IngotBall extends BlockCustomBase {
protected static AxisAlignedBB boundBoxLarge = new AxisAlignedBB(6/16D, 0.0D, 6/16D, 10/16D, 4/16D, 10/16D);
protected static AxisAlignedBB boundBoxSmall = new AxisAlignedBB(7/16D, 0.0D, 7/16D, 9/16D, 2/16D, 9/16D);
//public static final PropertyBool ACTIVE = PropertyBool.create("active");
private String type;
public IngotBall(Material material, String registryName, Float hardness, String type){
super(material, registryName, hardness);
this.type = type;
this.setTickRandomly(true);
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
if(this.type.equals("chunk")){
return boundBoxSmall;
}else
return boundBoxLarge;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//System.out.println(stack.getItemDamage());
worldIn.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
//System.out.println(state.getValue(ACTIVE));
}
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
{
if(!world.isRemote){
if(state.getValue(PrimalStates.ACTIVE)){
world.setBlockState(pos, Blocks.FLOWING_LAVA.getDefaultState().withProperty(BlockDynamicLiquid.LEVEL, 1), 3);
}
if(!state.getValue(PrimalStates.ACTIVE)){
//PlayerHelper.spawnItemOnGround(world, pos, new ItemStack(this, 1));
}
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(PrimalStates.ACTIVE) == false) {
i = 0;
return i;
}
if( state.getValue(PrimalStates.ACTIVE) == true) {
i = 1;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false));
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true));
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {PrimalStates.ACTIVE});
}
@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if ( ThreadLocalRandom.current().nextInt(0,4) == 0) {
if(state.getValue(PrimalStates.ACTIVE) == true) {
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
world.playSound((EntityPlayer) null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, world.rand.nextFloat() * 0.4F + 0.8F);
}
}
}
}
}

View File

@@ -1,432 +0,0 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.ItemHandlerHelper;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.NBTHelper;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.items.SlottedTongs;
import nmd.primal.forgecraft.tiles.TileNBTCrucible;
import javax.swing.plaf.basic.BasicComboBoxUI;
import java.util.Random;
import static net.minecraft.util.EnumHand.MAIN_HAND;
/**
* Created by mminaie on 11/11/17.
*/
public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
//private Ingredient crucibleIngredients;
public NBTCrucible(Material material, String registryName) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setHardness(3.0f);
setDefaultState(this.blockState.getBaseState().withProperty(PrimalAPI.States.LAYERS, Integer.valueOf(0)));
//setDefaultState(this.blockState.getBaseState().withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)));
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hands, EnumFacing face, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
if(player.getActiveHand().equals(EnumHand.MAIN_HAND)) {
ItemStack playerStackStart = player.getHeldItemMainhand().copy();
/**PICKS UP THE CRUCIBLE**/
if (playerStackStart.isEmpty()) {
if (!player.isSneaking()) {
//System.out.println(tile.getHot());
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(tile.ingList.get(0), tile.ingList.get(1), tile.ingList.get(2), tile.ingList.get(3), tile.ingList.get(4));
if (recipe != null) {
System.out.println(tile.getDrops());
//tile.setDrops(recipe.getDropsRaw());
}
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getCrucibleItem(world, pos, state, player));
//ItemHandlerHelper.giveItemToPlayer(player, this.getCrucibleItem(world, pos, state, player));
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
world.markTileEntityForRemoval(tile);
//System.out.println(player.getHeldItemMainhand().getTagCompound());
return true;
}
}
/**SET INGREDIENT ARRAY FOR THE CRUCIBLE NOW**/
if (!player.isSneaking()) {
ItemStack pItem = player.inventory.getCurrentItem().copy();
pItem.setCount(1);
if (!pItem.isEmpty()) {
if (!tile.getStatus() || tile.getHot() == 15 || tile.getHot() == 6) {
if (pItem.getItem() instanceof SlottedTongs) {
return false;
} else {
pItem.setCount(1);
for (int i = 1; i < tile.ingList.size() + 1; i++) {
if (tile.ingList.get(i - 1).isEmpty()) {
tile.ingList.set(i - 1, pItem);
tile.setHot(i);
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, i), 2);
player.inventory.getCurrentItem().shrink(1);
tile.update();
tile.markDirty();
return true;
}
}
}
}
}
}
/**CLEARS THE INVENTORY**/
if (player.isSneaking()) {
ItemStack pItem = player.inventory.getCurrentItem().copy();
if (pItem.isEmpty()) {
if (tile.getHot() != 15) {
if (!tile.getStatus()) {
for (int i = 0; i < tile.ingList.size(); i++) {
if (!tile.ingList.get(i).isEmpty()) {
PlayerHelper.spawnItemOnPlayer(world, player, tile.ingList.get(i));
tile.ingList.set(i, ItemStack.EMPTY);
}
}
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, 0), 2);
tile.setHot(0);
tile.setStatus(false);
tile.update();
tile.markDirty();
return true;
}
}
}
}
/**REMOVE COOKED ITEM**/
if (player.isSneaking()) {
ItemStack pItem = player.inventory.getCurrentItem().copy();
if (pItem.isEmpty()) {
//TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
if (tile.getStatus() && tile.getHot() == 6) {
System.out.println(tile.getDrops());
ItemStack dropStack = tile.getDrops().copy();
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, 0), 2);
tile.setHot(0);
tile.setStatus(false);
tile.setDrops(ItemStack.EMPTY);
tile.ingList.clear();
EntityItem entityitem = new EntityItem(world, player.posX, player.posY, player.posZ, dropStack); // ? player.posY - 1.0D
world.spawnEntity(entityitem);
tile.update();
tile.markDirty();
return true;
}
}
}
}
}
return true;
}
private IBlockState getReplacementBlock(World world, BlockPos pos, IBlockState state)
{
return Blocks.AIR.getDefaultState();
}
@Override
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
{
this.onBlockHarvested(world, pos, state, player);
return this.destroyBlock(world, pos, state, EnumFacing.UP, player);
}
public ItemStack getCrucibleItem(World world, BlockPos pos, IBlockState state, EntityPlayer player)
{
return NBTHelper.getStackBlockNBT(world, pos, state, super.getPickBlock(state, null, world, pos, player));
}
public boolean destroyBlock(World world, BlockPos pos, IBlockState state, EnumFacing face, EntityPlayer player)
{
if (!world.isRemote) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileNBTCrucible) {
//PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getCrucibleItem(world, pos, state, player));
ItemStack dropStack = new ItemStack(ModBlocks.nbtCrucible, 1);
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
world.markTileEntityForRemoval(tile);
return true;
}
}
return false;
}
@Override
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player)
{
if (!world.isRemote) {
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(tile.ingList.get(0), tile.ingList.get(1), tile.ingList.get(2), tile.ingList.get(3), tile.ingList.get(4));
if(recipe != null && tile.getStatus() && tile.getHot() == 6){
if(tile.getDrops() != null) {
PlayerHelper.spawnItemOnPlayer(world, player, recipe.getDropsCooked());
} else {
PlayerHelper.spawnItemOnPlayer(world, player, recipe.getDropsRaw());
}
}
if(recipe != null && tile.getStatus() && tile.getHot() == 15){
PlayerHelper.spawnItemOnPlayer(world, player, recipe.getDropsRaw());
}
if(!tile.getStatus() && tile.getHot() != 15 && tile.getHot() != 6){
PlayerHelper.spawnItemOnPlayer(world, player, tile.ingList);
}
}
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
// see above onBlockHarvested
return null;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
TileEntity tileentity = world.getTileEntity(pos);
if (tileentity instanceof TileNBTCrucible) {
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
if(NBTHelper.hasNBT(stack)){
NBTTagCompound tag = stack.getTagCompound();
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, tile.getHot()), 2);
//tile.readNBT(tag);
}
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(PrimalAPI.States.LAYERS) == 0){
i = 0;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 1){
i = 1;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 2){
i = 2;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 3){
i = 3;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 4){
i = 4;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 5){
i = 5;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 6){
i = 6;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 7){
i = 7;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 8){
i = 8;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 9){
i = 9;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 10){
i = 10;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 11){
i = 11;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 12){
i = 12;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 13){
i = 13;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 14){
i = 14;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 15){
i = 15;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 0);
}
if (meta == 1){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 1);
}
if (meta == 2){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 2);
}
if (meta == 3){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 3);
}
if (meta == 4){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 4);
}
if (meta == 5){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 5);
}
if (meta == 6){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 6);
}
if (meta == 7){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 7);
}
if (meta == 8){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 8);
}
if (meta == 9){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 9);
}
if (meta == 10){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 10);
}
if (meta == 11){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 11);
}
if (meta == 12){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 12);
}
if (meta == 13){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 13);
}
if (meta == 14){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 14);
}
if (meta == 15){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 15);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {PrimalAPI.States.LAYERS});
}
@Override
public int quantityDropped(Random random)
{
return 1;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileNBTCrucible();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.blocks.machine; package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
@@ -15,9 +15,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.init.ModSounds; import nmd.primal.forgecraft.init.ModSounds;
import nmd.primal.forgecraft.tiles.TileBloomery; import nmd.primal.forgecraft.tiles.TileBloomery;
import nmd.primal.forgecraft.tiles.TileForge; import nmd.primal.forgecraft.tiles.TileForge;
@@ -26,12 +24,14 @@ import nmd.primal.forgecraft.tiles.TilePistonBellows;
import java.util.Random; import java.util.Random;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import static nmd.primal.core.api.PrimalStates.ACTIVE;
/** /**
* Created by mminaie on 1/1/17. * Created by mminaie on 1/1/17.
*/ */
public class PistonBellows extends CustomContainerFacing { public class PistonBellows extends CustomContainerFacing {
//public static final PropertyBool PrimalAPI.States.ACTIVE = PropertyBool.create("active"); //public static final PropertyBool ACTIVE = PropertyBool.create("active");
//protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D); //protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D);
protected static final AxisAlignedBB boundBoxNorth = new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 12 / 16D, 1.0D); protected static final AxisAlignedBB boundBoxNorth = new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 12 / 16D, 1.0D);
protected static final AxisAlignedBB boundBoxSouth = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 12 / 16D, 1.0D); protected static final AxisAlignedBB boundBoxSouth = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 12 / 16D, 1.0D);
@@ -41,7 +41,7 @@ public class PistonBellows extends CustomContainerFacing {
public PistonBellows(Material material, String registryName) { public PistonBellows(Material material, String registryName) {
super(material, registryName); super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT); setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false))); setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f); setHardness(3.0f);
} }
@@ -57,7 +57,7 @@ public class PistonBellows extends CustomContainerFacing {
TilePistonBellows tile = (TilePistonBellows) worldIn.getTileEntity(pos); TilePistonBellows tile = (TilePistonBellows) worldIn.getTileEntity(pos);
if (tile != null) { if (tile != null) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2); worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(ACTIVE, Boolean.valueOf(false)), 2);
} }
} }
@@ -66,8 +66,8 @@ public class PistonBellows extends CustomContainerFacing {
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if(!world.isRemote){ if(!world.isRemote){
//System.out.println(state.getValue(PistonBellows.FACING)); //System.out.println(state.getValue(PistonBellows.FACING));
if(state.getValue(PrimalAPI.States.ACTIVE) == false) { if(state.getValue(ACTIVE) == false) {
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2); world.setBlockState(pos, state.withProperty(ACTIVE, true), 2);
//world.playSound(pos, ForgecraftSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f); //world.playSound(pos, ForgecraftSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f);
//world.playSound((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), ModSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f, true); //world.playSound((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), ModSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f, true);
world.playSound(null, pos, ModSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 0.25F, 0.8F); world.playSound(null, pos, ModSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 0.25F, 0.8F);
@@ -78,7 +78,7 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()); BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() instanceof Forge) { if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos); TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) { if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) {
if (tile != null) { if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50); tile.setHeat(tile.getHeat() + 50);
@@ -90,7 +90,7 @@ public class PistonBellows extends CustomContainerFacing {
} }
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) { if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.EAST)) { && (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.EAST)) {
if (tile != null) { if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
@@ -106,7 +106,7 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ()); BlockPos tempPos = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() instanceof Forge) { if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos); TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) { if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) {
if (tile != null) { if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50); tile.setHeat(tile.getHeat() + 50);
@@ -118,7 +118,7 @@ public class PistonBellows extends CustomContainerFacing {
} }
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) { if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.WEST)) { && (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.WEST)) {
if (tile != null) { if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
@@ -134,7 +134,7 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1); BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1);
if (world.getBlockState(tempPos).getBlock() instanceof Forge) { if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos); TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) { if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) {
if (tile != null) { if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50); tile.setHeat(tile.getHeat() + 50);
@@ -146,7 +146,7 @@ public class PistonBellows extends CustomContainerFacing {
} }
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) { if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.SOUTH)) { && (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.SOUTH)) {
if (tile != null) { if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
@@ -162,7 +162,7 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1); BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1);
if (world.getBlockState(tempPos).getBlock() instanceof Forge) { if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos); TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) { if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) {
if (tile != null) { if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50); tile.setHeat(tile.getHeat() + 50);
@@ -174,7 +174,7 @@ public class PistonBellows extends CustomContainerFacing {
} }
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) { if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.NORTH)) { && (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.NORTH)) {
if (tile != null) { if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
@@ -244,35 +244,35 @@ public class PistonBellows extends CustomContainerFacing {
public int getMetaFromState(IBlockState state) { public int getMetaFromState(IBlockState state) {
int i = 0; int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalAPI.States.ACTIVE) == false){ if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(ACTIVE) == false){
i = 0; i = 0;
return i; return i;
} }
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalAPI.States.ACTIVE) == false){ if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(ACTIVE) == false){
i = 1; i = 1;
return i; return i;
} }
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalAPI.States.ACTIVE) == false){ if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(ACTIVE) == false){
i = 2; i = 2;
return i; return i;
} }
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalAPI.States.ACTIVE) == false){ if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(ACTIVE) == false){
i = 3; i = 3;
return i; return i;
} }
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalAPI.States.ACTIVE) == true){ if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(ACTIVE) == true){
i = 4; i = 4;
return i; return i;
} }
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalAPI.States.ACTIVE) == true){ if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(ACTIVE) == true){
i = 5; i = 5;
return i; return i;
} }
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalAPI.States.ACTIVE) == true){ if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(ACTIVE) == true){
i = 6; i = 6;
return i; return i;
} }
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalAPI.States.ACTIVE) == true){ if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(ACTIVE) == true){
i = 7; i = 7;
return i; return i;
} }
@@ -326,12 +326,12 @@ public class PistonBellows extends CustomContainerFacing {
active = false; active = false;
} }
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(active)); return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(ACTIVE, Boolean.valueOf(active));
} }
@Override @Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalAPI.States.ACTIVE}); return new BlockStateContainer(this, new IProperty[] {FACING, ACTIVE});
} }
//return new ExtendedBlockState(this, new IProperty[] { BotaniaStateProps.CARDINALS, Properties.StaticProperty }, new IUnlistedProperty[] { Properties.AnimationProperty }); //return new ExtendedBlockState(this, new IProperty[] { BotaniaStateProps.CARDINALS, Properties.StaticProperty }, new IUnlistedProperty[] { Properties.AnimationProperty });
@@ -363,18 +363,18 @@ public class PistonBellows extends CustomContainerFacing {
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{ {
if(state.getValue(PrimalAPI.States.ACTIVE) == Boolean.TRUE) { if(state.getValue(ACTIVE) == Boolean.TRUE) {
if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) { if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) {
BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()); BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() instanceof Forge) { if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos); TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) { if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) {
makeEmbers(world, tempPos, world.rand); makeEmbers(world, tempPos, world.rand);
} }
} }
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) { if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.EAST)) { if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.EAST)) {
makeEmbers(world, tempPos, world.rand); makeEmbers(world, tempPos, world.rand);
} }
} }
@@ -385,13 +385,13 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ()); BlockPos tempPos = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() instanceof Forge) { if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos); TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) { if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) {
makeEmbers(world, tempPos, world.rand); makeEmbers(world, tempPos, world.rand);
} }
} }
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) { if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.WEST)) { if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.WEST)) {
makeEmbers(world, tempPos, world.rand); makeEmbers(world, tempPos, world.rand);
} }
} }
@@ -402,13 +402,13 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1); BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1);
if (world.getBlockState(tempPos).getBlock() instanceof Forge) { if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos); TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) { if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) {
makeEmbers(world, tempPos, world.rand); makeEmbers(world, tempPos, world.rand);
} }
} }
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) { if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.SOUTH)) { if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.SOUTH)) {
makeEmbers(world, tempPos, world.rand); makeEmbers(world, tempPos, world.rand);
} }
} }
@@ -419,13 +419,13 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1); BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1);
if (world.getBlockState(tempPos).getBlock() instanceof Forge) { if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos); TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) { if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) {
makeEmbers(world, tempPos, world.rand); makeEmbers(world, tempPos, world.rand);
} }
} }
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) { if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.NORTH)) { if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.NORTH)) {
makeEmbers(world, tempPos, world.rand); makeEmbers(world, tempPos, world.rand);
} }
} }
@@ -460,3 +460,23 @@ public class PistonBellows extends CustomContainerFacing {
} }
/*
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
}
*/

View File

@@ -4,6 +4,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHand;
@@ -12,12 +13,12 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import nmd.primal.core.api.PrimalAPI; import nmd.primal.core.api.PrimalSounds;
import nmd.primal.core.common.helper.PlayerHelper; import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.core.common.items.tools.WorkBlade; import nmd.primal.core.common.items.tools.WorkBlade;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.init.ModSounds;
import static nmd.primal.core.api.PrimalAPI.randomCheck;
/** /**
* Created by mminaie on 7/2/17. * Created by mminaie on 7/2/17.
@@ -48,8 +49,8 @@ public class YewStave extends BlockCustomBase {
if(pItem.getItem() instanceof WorkBlade){ if(pItem.getItem() instanceof WorkBlade){
if(world.getBlockState(pos.up()).getBlock() instanceof YewStave ) { if(world.getBlockState(pos.up()).getBlock() instanceof YewStave ) {
//world.playSound(player, player.posX, player.posY, player.posZ, PrimalSounds.TOOL_BLADE_SCRAPE, SoundCategory.PLAYERS, 1.0F, 1F); //world.playSound(player, player.posX, player.posY, player.posZ, PrimalSounds.TOOL_BLADE_SCRAPE, SoundCategory.PLAYERS, 1.0F, 1F);
world.playSound(null, pos, PrimalAPI.Sounds.SOUND_TOOL_BLADE_SCRAPE, SoundCategory.PLAYERS, 1.0F, 1.0F); world.playSound(null, pos, PrimalSounds.TOOL_BLADE_SCRAPE, SoundCategory.PLAYERS, 1.0F, 1.0F);
if(randomCheck(3) ) { if(CommonUtils.randomCheck(3) ) {
PlayerHelper.spawnItemOnGround(world, pos, new ItemStack(ModItems.rawlongbow, 1)); PlayerHelper.spawnItemOnGround(world, pos, new ItemStack(ModItems.rawlongbow, 1));
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(pos.up(), Blocks.AIR.getDefaultState(), 2); world.setBlockState(pos.up(), Blocks.AIR.getDefaultState(), 2);

View File

@@ -1,27 +0,0 @@
package nmd.primal.forgecraft.blocks.fluids;
import net.minecraft.block.material.Material;
import net.minecraftforge.fluids.Fluid;
import nmd.primal.core.common.fluids.AbstractFluidBlock;
import nmd.primal.forgecraft.ModInfo;
public class BasicFluidBlockKFC extends AbstractFluidBlock {
private boolean isSolidTexture;
private boolean isBurning;
public BasicFluidBlockKFC(Fluid fluid, Material material, boolean isSolidTexture, boolean isBurning)
{
super(fluid, material);
this.isSolidTexture = isSolidTexture;
this.isBurning = isBurning;
}
public BasicFluidBlockKFC(Fluid fluid, Material material)
{
this(fluid, material, false, false);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
}

View File

@@ -1,506 +0,0 @@
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandler;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.crafting.handlers.inworld.FireSource;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.items.SlottedTongs;
import nmd.primal.forgecraft.tiles.TileBloomery;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import static nmd.primal.forgecraft.items.SlottedTongs.ITEM_HANDLER;
/**
* Created by mminaie on 6/11/17.
*/
public class BloomeryBase extends CustomContainerFacing implements ITileEntityProvider {
//public static final PropertyBool COVERED = PropertyBool.create("covered");
private int maxHeat;
public AxisAlignedBB AABB = new AxisAlignedBB(5/32D, 0.0D, 5/32D, 27/32D, 12/16D, 27/32D);
public BloomeryBase(Material material, String registryName, Integer maxHeat) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f);
setResistance(5.0f);
this.maxHeat=maxHeat;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return AABB;
}
public int getMaxHeat() {
return maxHeat;
}
public void setMaxHeat(int maxHeat) {
this.maxHeat = maxHeat;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBloomery();
}
/*@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if(state.getValue(PrimalAPI.States.ACTIVE) == true) {
FireHelper.makeSmoke(world, pos, 50);
}
}
}*/
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (world.isRemote)
return true;
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile != null) {
ItemStack pItem = player.inventory.getCurrentItem();
ItemStack tileItem = tile.getSlotStack(0);
ItemStack tileItem1 = tile.getSlotStack(1);
if(pItem.isEmpty()) {
if(!player.isSneaking()){
if(world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE)){
Integer bloomeryHeat = tile.getHeat();
String display = "Fuel Remaining: " + tileItem.getCount() + "\n" + "Current Temp: " + bloomeryHeat.toString();
ITextComponent itextcomponent = new TextComponentString(display);
NBTTagCompound tag = tile.getSlotStack(1).getSubCompound("BlockEntityTag");
if(tag != null) {
NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
NonNullList<ItemStack> dropList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
ItemStackHelper.loadAllItems(tag, ingList);
ItemStackHelper.loadAllItems(tag, dropList);
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
if (recipe != null) {
if(!recipe.isHidden()) {
if (!recipe.isDisabled()) {
Integer minTemp = recipe.getCookTemp();
Integer cookCounter = tile.getCookCounter();
Integer idealTime = recipe.getCookTime();
Integer remainingTime = idealTime - cookCounter;
String display1 = "Cooking: " + recipe.getDropsCooked().getItem().getItemStackDisplayName(recipe.getDropsCooked());
String display2 = "Target Temp: " + minTemp.toString();
String display3 = "Time Left: " + remainingTime.toString() + "\n";
String display4 = "Finished";
//String display5 = "Current Temp: " + tile.getHeat();
ITextComponent cookingText = new TextComponentString(display1);
ITextComponent targetTempText = new TextComponentString(display2);
ITextComponent timeLeftText = new TextComponentString(display3);
ITextComponent finishedText = new TextComponentString(display4);
//ITextComponent itextcomponent5 = new TextComponentString(display5);
if (tileItem1.getSubCompound("BlockEntityTag").getBoolean("status")) {
player.sendMessage(finishedText);
} else {
player.sendMessage(cookingText);
player.sendMessage(itextcomponent);
player.sendMessage(targetTempText);
player.sendMessage(timeLeftText);
}
}
}
}
return true;
}
else {
String noRecipe = "Fuel Remaining: " + tileItem.getCount() + "\n" + "Current Temp: " + bloomeryHeat.toString() + "\n";
ITextComponent noRecipeText = new TextComponentString(noRecipe);
player.sendMessage(noRecipeText);
}
}
}
}
if(tile.getSlotStack(0) != ItemStack.EMPTY) {
if((FireSource.useSource(world, pos, facing, player, hand, pItem, hitX, hitY, hitZ))) {
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2);
tile.setHeat(100);
tile.markDirty();
tile.updateBlock();
return true;
}
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
if (!tileItem.isEmpty()){
if(pItem.getItem() == tileItem.getItem()){
if(tileItem.getCount() < 64){
if(tileItem.getCount() + pItem.getCount() <= 64){
tileItem.grow(pItem.getCount());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
if(tileItem.getCount() + pItem.getCount() > 64){
pItem.setCount(64-pItem.getCount());
tileItem.setCount(64);
tile.markDirty();
tile.updateBlock();
return true;
}
}
}
}
if(tileItem.isEmpty()) {
tile.setSlotStack(0, pItem);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(1, pItem)) {
if (!tileItem1.isEmpty()) {
return false;
}
if(tileItem1.isEmpty()){
ItemStack place_stack = pItem.copy();
//if (tile.putStack(slot, place_stack))
tile.setSlotStack(1, place_stack);
pItem.shrink(1);
return true;
}
}
/***SLOTTED TONGS CODE TO PLACE THE ITEMS***/
if(pItem.getItem() instanceof SlottedTongs) {
IItemHandler inventory = pItem.getCapability(ITEM_HANDLER, null);
ItemStack slotStack = inventory.getStackInSlot(0).copy();
SlottedTongs itemstackItem = (SlottedTongs) pItem.getItem();
//SlottedTongs temp = (SlottedTongs) pItem.getItem();
if (!pItem.isEmpty() && tile.isItemValidForSlot(1, slotStack)) {
if (!tileItem1.isEmpty()) {
return false;
}
if(tileItem1.isEmpty()){
ItemStack place_stack = slotStack.copy();
//if (tile.putStack(slot, place_stack))
tile.setSlotStack(1, inventory.extractItem(0, 1, false));
itemstackItem.markDirty(pItem);
return true;
}
}
}
/***SLOTTED TONGS CODE TO REMOVE THE ITEMS***/
if(pItem.getItem() instanceof SlottedTongs) {
IItemHandler inventory = pItem.getCapability(ITEM_HANDLER, null);
ItemStack slotStack = inventory.getStackInSlot(0).copy();
SlottedTongs itemstackItem = (SlottedTongs) pItem.getItem();
//SlottedTongs temp = (SlottedTongs) pItem.getItem();
if (!pItem.isEmpty() && inventory.getStackInSlot(0).isEmpty()) {
if (tileItem1.isEmpty()) {
return false;
}
if(!tileItem1.isEmpty()){
ItemStack place_stack = tileItem1.copy();
if(inventory.getStackInSlot(0).isEmpty()){
inventory.insertItem(0, place_stack, false);
tile.setSlotStack(1, ItemStack.EMPTY);
itemstackItem.markDirty(pItem);
return true;
}
}
}
}
if (!tile.getSlotStack(0).isEmpty()) {
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
ItemStack returnStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
tile.clearSlot(0);
return true;
}
}
}
return false;
}
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
int lightState =0;
if(state.getValue(PrimalAPI.States.ACTIVE) == true){
lightState = 10;
}
return lightState;
}
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return 0;
}
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return true;
}
@Override
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{
if(!world.isRemote){
if(world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE)==true){
return true;
}
}
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{
if(ent instanceof EntityPlayer){
if(state.getValue(PrimalAPI.States.ACTIVE) == true){
ent.setFire(1);
}
}
}
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 0;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 1;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 2;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 3;
return i;
}
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 4;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 5;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 6;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 7;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing enumfacing;
Boolean active;
switch (meta & 7)
{
case 0:
enumfacing = EnumFacing.EAST;
active = false;
break;
case 1:
enumfacing = EnumFacing.WEST;
active = false;
break;
case 2:
enumfacing = EnumFacing.SOUTH;
active = false;
break;
case 3:
enumfacing = EnumFacing.NORTH;
active = false;
break;
case 4:
enumfacing = EnumFacing.EAST;
active = true;
break;
case 5:
enumfacing = EnumFacing.WEST;
active = true;
break;
case 6:
enumfacing = EnumFacing.SOUTH;
active = true;
break;
case 7:
enumfacing = EnumFacing.NORTH;
active = true;
break;
default:
enumfacing = EnumFacing.NORTH;
active = false;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(active));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalAPI.States.ACTIVE});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
if(state.getValue(PrimalAPI.States.ACTIVE) == true)
{
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.2D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.075, 0.35);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.0, 0.075);
if (rand.nextDouble() < 0.1D)
{
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
}
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
}
}
}

View File

@@ -1,243 +0,0 @@
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.core.common.items.tools.Gallagher;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.tiles.TileBreaker;
import nmd.primal.forgecraft.util.BreakerHandler;
/**
* Created by mminaie on 4/9/17.
*/
public class Breaker extends CustomContainerFacing implements BreakerHandler {
public AxisAlignedBB AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 6/16D, 1.0D);
public Breaker(Material material, String registryName, Float hardness) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalAPI.States.ACTIVE, false));
setHardness(hardness);
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return AABB;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if(!world.isRemote){
if (hand.equals(player.getActiveHand())) {
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
if (state.getValue(PrimalAPI.States.ACTIVE) && player.isSneaking() && pItem.isEmpty()) {
doBreaking(world, state, pos, tile);
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, false));
tile.setCharge(0);
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE) && player.isSneaking() && pItem.isEmpty() && tile.getCharge() == 0) {
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotStack(0));
tile.setSlotStack(0, ItemStack.EMPTY);
return true;
}
if (!player.isSneaking() && pItem.isEmpty()) {
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
if (state.getValue(PrimalAPI.States.ACTIVE)) {
if (tile.getCharge() < 181) {
tile.setCharge(tile.getCharge() + 2.0f);
tile.updateBlock();
//System.out.println(tile.charge);
return true;
}
}
}
if (pItem.getItem() instanceof Gallagher) {
tile.setSlotStack(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
}
return false;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBreaker();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, false), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if(state.getValue(PrimalAPI.States.ACTIVE ) == false) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 2;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 3;
return i;
}
}
if(state.getValue(PrimalAPI.States.ACTIVE)) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 4;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 5;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 6;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 7;
return i;
}
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalAPI.States.ACTIVE, false);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalAPI.States.ACTIVE, false);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalAPI.States.ACTIVE, false);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalAPI.States.ACTIVE, false);
}
if (meta == 4){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalAPI.States.ACTIVE, true);
}
if (meta == 5) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalAPI.States.ACTIVE, true);
}
if (meta == 6) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalAPI.States.ACTIVE, true);
}
if (meta == 7) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalAPI.States.ACTIVE, true);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {PrimalAPI.States.ACTIVE, FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,267 +0,0 @@
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandler;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.crafting.CastingCrafting;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.SlottedTongs;
import nmd.primal.forgecraft.tiles.TileCastingForm;
import nmd.primal.forgecraft.util.CastingFormHandler;
import nmd.primal.forgecraft.util.ToolNBT;
import static nmd.primal.forgecraft.items.SlottedTongs.ITEM_HANDLER;
/**
* Created by mminaie on 6/19/17.
*/
public class CastingForm extends CustomContainerFacing implements CastingFormHandler, ToolNBT {
protected static AxisAlignedBB bound = new AxisAlignedBB(0/16D, 0.0D, 0/16D, 16/16D, 3/16D, 16/16D);
public CastingForm(Material material, String registryName) {
super(material, registryName);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setTickRandomly(true);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if (!world.isRemote) {
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
if(pItem.getItem() != ModItems.slottedtongs) {
doInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
}
if(pItem.getItem().equals(ModItems.slottedtongs)){
IItemHandler inventory = pItem.getCapability(ITEM_HANDLER, null);
SlottedTongs itemstackItem = (SlottedTongs) pItem.getItem();
ItemStack tongsStack = inventory.getStackInSlot(0).copy();
//SlottedTongs tongs = (SlottedTongs) pItem.getItem();
if(tongsStack.getItem().equals(Item.getItemFromBlock(ModBlocks.nbtCrucible))) {
NBTTagCompound tag = tongsStack.getTagCompound().copy();
if(tag != null){
NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
NonNullList<ItemStack> ingListEmpty = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
ItemStackHelper.loadAllItems(tag.getCompoundTag("BlockEntityTag"), ingList);
CrucibleCrafting crucibleRecipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
if(crucibleRecipe != null){
if(tag.getCompoundTag("BlockEntityTag").getBoolean("status") && tag.getCompoundTag("BlockEntityTag").getInteger("hot") == 15){
Item[] tempArray = new Item[25];
for(int i=0; i<25; i++){
tempArray[i] = tile.getSlotStack(i).getItem();
}
CastingCrafting casting = CastingCrafting.getRecipe(crucibleRecipe.getDropsCooked(), tempArray);
if(casting != null){
NBTTagCompound tagOutput = casting.getOutput().getOrCreateSubCompound("tags");
NBTTagCompound crucibleOutput = crucibleRecipe.getDropsCooked().getTagCompound();
if(tagOutput != null) {
ItemStack dropStack = casting.getOutput();
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
setHot(dropStack, false);
if (crucibleOutput.getString("upgrades") == "emerald") {
setEmerald(dropStack, true);
setModifiers(dropStack, 1);
} else {
setEmerald(dropStack, false);
}
if (crucibleOutput.getString("upgrades") == "diamond") {
setDiamondLevel(dropStack, 1);
setModifiers(dropStack, 1);
} else {
setDiamondLevel(dropStack, 0);
}
if (crucibleOutput.getString("upgrades") == "redstone") {
setRedstoneLevel(dropStack, 1);
setModifiers(dropStack, 1);
} else {
setRedstoneLevel(dropStack, 0);
}
if (crucibleOutput.getString("upgrades") == "lapis") {
setLapisLevel(dropStack, 1);
setModifiers(dropStack, 1);
} else {
setLapisLevel(dropStack, 0);
}
CommonUtils.spawnItemEntityFromWorld(world, pos, dropStack);
tag.getCompoundTag("BlockEntityTag").setBoolean("status", false);
tag.getCompoundTag("BlockEntityTag").setInteger("hot", 0);
ItemStackHelper.saveAllItems(tag.getCompoundTag("BlockEntityTag"), ingListEmpty);
inventory.getStackInSlot(0).setTagCompound(tag);
itemstackItem.markDirty(pItem);
return true;
}
}
}
}
}
}
}
return false;
}
return false;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileCastingForm();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return bound;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,446 +0,0 @@
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.crafting.handlers.inworld.FireSource;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.tiles.TileForge;
import nmd.primal.forgecraft.util.ForgeHandler;
import nmd.primal.forgecraft.util.SlotHelper;
import javax.annotation.Nullable;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
//import nmd.primal.core.api.PrimalBlocks;
/**
* Created by kitsu on 11/26/2016.
*/
public class Forge extends CustomContainerFacing implements ITileEntityProvider, ForgeHandler, SlotHelper {
private int maxHeat;
//public static final PropertyBool PrimalAPI.States.ACTIVE = PropertyBool.create("PrimalAPI.States.ACTIVE");
protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D);
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
public Forge(Material material, String name, Integer maxHeat) {
super(material, name);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f);
setResistance(5.0f);
this.maxHeat=maxHeat;
}
public int getMaxHeat() {
return maxHeat;
}
public void setMaxHeat(int maxHeat) {
this.maxHeat = maxHeat;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileForge();
}
@Nullable
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
{
return collideBox;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (!world.isRemote) {
TileForge tile = (TileForge) world.getTileEntity(pos);
if (tile != null) {
if (hand.equals(player.getActiveHand())) {
ItemStack pItem = player.inventory.getCurrentItem();
ItemStack fuelItem = tile.getSlotStack(0);
/***********************
FUEL SLOT REMOVAL CODE
***********************/
if (!tile.getSlotStack(0).isEmpty()) {
if (player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
ItemStack returnStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
tile.clearSlot(0);
return true;
}
}
/***********************
TEMP PRINT OUT CODE
***********************/
if (pItem.isEmpty()) {
if (!player.isSneaking()) {
if (world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE) == true) {
Integer tempInt = tile.getHeat();
String tempString = tempInt.toString();
ITextComponent itextcomponent = new TextComponentString(tempString);
player.sendStatusMessage(itextcomponent, true);
//System.out.println(pos);
return true;
}
}
}
/***********************
Forge Activation Code
***********************/
if ((FireSource.useSource(world, pos, facing, player, hand, pItem, hitX, hitY, hitZ))) {
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2);
tile.setHeat(100);
tile.markDirty();
tile.updateBlock();
return true;
}
/***********************
FUEL SLOT MANAGEMENT Code
***********************/
/***********************
FUEL SLOT IS EMPTYT
***********************/
if (tile.getSlotStack(0).isEmpty()) {
if(tile.isItemValidForSlot(0, player.inventory.getCurrentItem())) {
tile.setSlotStack(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
}
/***********************
FUEL SLOT HAS STUFF
***********************/
if(ItemStack.areItemsEqual(player.inventory.getCurrentItem(), tile.getSlotStack(0)) && !tile.getSlotStack(0).isEmpty()) {
if (tile.getSlotStack(0).getCount() < 64) {
if (tile.getSlotStack(0).getCount() + player.inventory.getCurrentItem().getCount() <= 64) {
tile.getSlotStack(0).grow(pItem.getCount());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
if (tile.getSlotStack(0).getCount() + player.inventory.getCurrentItem().getCount() > 64) {
int count = 64 - tile.getSlotStack(0).getCount();
tile.getSlotStack(0).grow(count);
pItem.shrink(count);
tile.markDirty();
tile.updateBlock();
return true;
}
}
}
if (facing == EnumFacing.UP) {
doForgeInventoryManager(pItem, world, tile, pos, hitX, hitY, hitZ, state, player);
return true;
}
}
}
}
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{
//if (!world.isRemote){
if(ent instanceof EntityPlayer){
if(state.getValue(PrimalAPI.States.ACTIVE) == true){
ent.setFire(1);
}
}
//}
}
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
}
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
if(state.getValue(PrimalAPI.States.ACTIVE) == true){
return 5;
}
return 0;
}
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return 0;
}
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return true;
}
@Override
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{
if (side == EnumFacing.UP)
{
if(!world.isRemote){
TileForge tile = (TileForge) world.getTileEntity(pos);
if(tile.getSlotStack(0) != ItemStack.EMPTY){
if(world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE)==true){
return true;
}
}
}
}
return false;
}
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileForge tile = (TileForge) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
/*@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
IBlockState state = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
return state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false));
}*/
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
//System.out.println(placer.getHorizontalFacing());
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 0;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 1;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 2;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 3;
return i;
}
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 4;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 5;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 6;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 7;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing enumfacing;
Boolean active;
switch (meta & 7)
{
case 0:
enumfacing = EnumFacing.EAST;
active = false;
break;
case 1:
enumfacing = EnumFacing.WEST;
active = false;
break;
case 2:
enumfacing = EnumFacing.SOUTH;
active = false;
break;
case 3:
enumfacing = EnumFacing.NORTH;
active = false;
break;
case 4:
enumfacing = EnumFacing.EAST;
active = true;
break;
case 5:
enumfacing = EnumFacing.WEST;
active = true;
break;
case 6:
enumfacing = EnumFacing.SOUTH;
active = true;
break;
case 7:
enumfacing = EnumFacing.NORTH;
active = true;
break;
default:
enumfacing = EnumFacing.NORTH;
active = false;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(active));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalAPI.States.ACTIVE});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if(state.getValue(PrimalAPI.States.ACTIVE) == true) {
makeSmoke(world, pos);
}
}
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
if(state.getValue(PrimalAPI.States.ACTIVE) == true)
{
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.96D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.075, 0.35);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.0, 0.075);
if (rand.nextDouble() < 0.1D)
{
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
}
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
}
}
}

View File

@@ -1,185 +0,0 @@
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.blocks.CustomContainerFacingActive;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.parts.WeaponPart;
import nmd.primal.forgecraft.items.weapons.CustomSword;
import nmd.primal.forgecraft.items.weapons.SlayerSword;
import nmd.primal.forgecraft.tiles.TileSharpBench;
import nmd.primal.forgecraft.util.WeaponNBT;
import javax.annotation.Nullable;
public class SharpBench extends CustomContainerFacingActive {
protected static final AxisAlignedBB boundBoxNorth = new AxisAlignedBB(0.28125D, 0.0D, 1/16D, 0.71875D, 11 / 16D, 11 / 16D);
protected static final AxisAlignedBB boundBoxSouth = new AxisAlignedBB(0.28125D, 0.0D, 5/16D, 0.71875D, 11 / 16D, 15 / 16D);
protected static final AxisAlignedBB boundBoxEast = new AxisAlignedBB(5/16D, 0.0D, 0.28125D, 15/16D, 11 / 16D, 0.71875D);
protected static final AxisAlignedBB boundBoxWest = new AxisAlignedBB(1/16D, 0.0D, 0.28125D, 11/16D, 11 / 16D, 0.71875D);
public SharpBench(Material material, String registryName) {
super(material, registryName);
this.setHardness(4.0f);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
if(player.getActiveHand().equals(EnumHand.MAIN_HAND)) {
TileSharpBench tile = (TileSharpBench) world.getTileEntity(pos);
if(player.getHeldItemMainhand().isEmpty()) {
if(tile.getSlotStack(0).getItem().equals(ModItems.grindingwheel)) {
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2);
if (tile.getCharge() < 15) {
tile.setCharge(tile.getCharge() + 1);
return true;
}
}
}
if(player.getHeldItemMainhand().getItem().equals(ModItems.grindingwheel)) {
tile.setSlotStack(0, player.getHeldItemMainhand().copy());
player.getHeldItemMainhand().shrink(1);
return true;
}
if(player.getHeldItemMainhand().isEmpty()) {
if(player.isSneaking()){
if(tile.getSlotStack(0).getItem().equals(ModItems.grindingwheel)){
PlayerHelper.spawnItemOnGround(world, pos, tile.getSlotStack(0));
tile.clearSlot(0);
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, false), 2);
}
}
}
}
}
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{
if(ent instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer) ent;
TileSharpBench tile = (TileSharpBench) world.getTileEntity(pos);
if(state.getValue(PrimalAPI.States.ACTIVE) && tile.getSlotStack(0).getItem().equals(ModItems.grindingwheel)){
ItemStack playerStack = player.inventory.getCurrentItem();
if(
playerStack.getItem() instanceof CustomSword ||
playerStack.getItem() instanceof ToolPart
){
if(playerStack.getItemDamage() > 0){
if (!world.isRemote) {
if (PrimalAPI.getRandom().nextInt(1, 3) == 1) {
playerStack.setItemDamage(playerStack.getItemDamage() - 1);
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 1);
if(tile.getSlotStack(0).getItemDamage()>= tile.getSlotStack(0).getMaxDamage()){
tile.clearSlot(0);
}
if(playerStack.getItem() instanceof CustomSword) {
WeaponNBT.removeAndSetEnchantsForStack(playerStack);
}
}
}
if (world.isRemote) {
makeSparks(world, pos, state);
}
}
}
}
}
}
@Nullable
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileSharpBench();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
state = state.getActualState(source, pos);
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
switch (enumfacing)
{
case EAST:
default:
return boundBoxEast;
case SOUTH:
return boundBoxSouth;
case WEST:
return boundBoxWest;
case NORTH:
return boundBoxNorth;
}
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileSharpBench tile = (TileSharpBench) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
private void makeSparks(World world, BlockPos pos, IBlockState state){
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.75D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
//double d4 = PrimalAPI.getRandom().nextDouble(0.066, 0.33);
double ySpeed = PrimalAPI.getRandom().nextDouble(0.05, 0.20);
double zSpeed = PrimalAPI.getRandom().nextDouble(0.05, 0.20);
if(state.getValue(FACING) == EnumFacing.NORTH) {
world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, d0, d1, d2, 0.0D, ySpeed, -zSpeed, new int[0]);
}
if(state.getValue(FACING) == EnumFacing.SOUTH) {
world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, d0, d1, d2, 0.0D, ySpeed, zSpeed, new int[0]);
}
if(state.getValue(FACING) == EnumFacing.EAST) {
world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, d0, d1, d2, zSpeed, ySpeed, 0.0D, new int[0]);
}
if(state.getValue(FACING) == EnumFacing.WEST) {
world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, d0, d1, d2, -zSpeed, ySpeed, 0.0D, new int[0]);
}
}
}

View File

@@ -1,304 +0,0 @@
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.core.common.items.tools.Gallagher;
import nmd.primal.core.common.items.tools.WorkBlade;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
import nmd.primal.forgecraft.tiles.TileWorkbench;
import javax.annotation.Nullable;
public class Workbench extends CustomContainerFacing {
protected static final AxisAlignedBB boundBoxNorth = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 10 / 16D, 8/16D);
protected static final AxisAlignedBB boundBoxSouth = new AxisAlignedBB(0.0D, 0.0D, 8/16D, 1.0D, 10 / 16D, 1.0D);
protected static final AxisAlignedBB boundBoxEast = new AxisAlignedBB(8/16D, 0.0D, 0.0D, 1.0D, 10 / 16D, 1.0D);
protected static final AxisAlignedBB boundBoxWest = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 8/16D, 10 / 16D, 1.0D);
public Workbench(Material material, String registryName) {
super(material, registryName);
this.setHardness(4.0f);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
if(player.getActiveHand().equals(EnumHand.MAIN_HAND)) {
TileWorkbench tile = (TileWorkbench) world.getTileEntity(pos);
ItemStack playerStack = player.inventory.getCurrentItem();
if (tile != null) {
ItemStack slot0 = tile.getSlotStack(0);
ItemStack slot1 = tile.getSlotStack(1);
ItemStack slot2 = tile.getSlotStack(2);
ItemStack slot3 = tile.getSlotStack(3);
ItemStack slot4 = tile.getSlotStack(4);
ItemStack slot5 = tile.getSlotStack(5);
ItemStack slot6 = tile.getSlotStack(6);
if (hitY > 0.5D) {
if (!player.isSneaking()) {
if (tile.isItemValidForSlot(6, playerStack)) {
if (slot6.isEmpty()) {
if (slot2.isEmpty() && slot3.isEmpty() && slot4.isEmpty() && slot5.isEmpty()) {
ItemStack tempStack = player.inventory.getCurrentItem().copy();
tempStack.setCount(1);
tile.setSlotStack(6, tempStack);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
}
if(! (playerStack.getItem() instanceof Gallagher)) {
if (slot4.isEmpty() && slot3.isEmpty() && slot2.isEmpty()) {
if (tile.isItemValidForSlot(5, playerStack)) {
if (slot5.isEmpty()) {
tile.setSlotStack(5, playerStack.splitStack(1));
//player.inventory.getCurrentItem().shrink(1);
return true;
}
}
}
if(slot5.isEmpty()) {
if (tile.isItemValidForSlot(4, playerStack)) {
if (slot4.isEmpty()) {
tile.setSlotStack(4, playerStack.splitStack(1));
//player.inventory.getCurrentItem().shrink(1);
return true;
}
}
if (tile.isItemValidForSlot(3, playerStack)) {
if (slot3.isEmpty()) {
tile.setSlotStack(3, playerStack.splitStack(1));
//player.inventory.getCurrentItem().shrink(1);
return true;
}
}
if (tile.isItemValidForSlot(2, playerStack)) {
if (slot2.isEmpty()) {
tile.setSlotStack(2, playerStack.splitStack(1));
//player.inventory.getCurrentItem().shrink(1);
return true;
}
}
}
}
if(player.inventory.getCurrentItem().getItem() instanceof Gallagher || player.inventory.getCurrentItem().getItem() instanceof WorkBlade) {
if (slot5.isEmpty()) {
WorkbenchCrafting recipe = WorkbenchCrafting.getRecipe(slot2, slot3, slot4, slot5, player.inventory.getCurrentItem());
if (recipe != null) {
ItemStack drops = recipe.getOutput();
if (slot3.hasTagCompound()) {
drops.setTagCompound(slot3.getTagCompound());
}
PlayerHelper.spawnItemOnPlayer(world, player, drops);
tile.clearSlot(2);
tile.clearSlot(3);
tile.clearSlot(4);
tile.clearSlot(5);
playerStack.damageItem(1, player);
return true;
}
}
if (slot2.isEmpty() && slot3.isEmpty() && slot4.isEmpty() && !slot5.isEmpty()) {
WorkbenchCrafting recipe = WorkbenchCrafting.getRecipe(slot2, slot3, slot4, slot5, player.inventory.getCurrentItem());
if (recipe != null) {
ItemStack drops = recipe.getOutput();
if (slot5.hasTagCompound()) {
drops.setTagCompound(slot5.getTagCompound());
drops.setItemDamage(slot5.getItemDamage());
}
PlayerHelper.spawnItemOnPlayer(world, player, drops);
tile.clearSlot(2);
tile.clearSlot(3);
tile.clearSlot(4);
tile.clearSlot(5);
playerStack.damageItem(1, player);
return true;
}
}
}
}
if(player.isSneaking() && player.inventory.getCurrentItem().isEmpty()){
if(!slot6.isEmpty()){
PlayerHelper.spawnItemOnGround(world, pos, tile.getSlotStack(6));
tile.clearSlot(6);
return true;
}
if(!slot2.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotStack(2));
tile.clearSlot(2);
return true;
}
if(!slot3.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotStack(3));
tile.clearSlot(3);
return true;
}
if(!slot4.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotStack(4));
tile.clearSlot(4);
return true;
}
if(!slot5.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotStack(5));
tile.clearSlot(5);
return true;
}
}
}
if (hitY < 0.5D) {
if (state.getValue(FACING) == EnumFacing.NORTH) {
if (hitX < 0.5) {
return sideInventoryManager(world, player, tile, slot0, 0);
}
if (hitX > 0.5) {
return sideInventoryManager(world, player, tile, slot1, 1);
}
return true;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
if (hitX > 0.5) {
return sideInventoryManager(world, player, tile, slot0, 0);
}
if (hitX < 0.5) {
return sideInventoryManager(world, player, tile, slot1, 1);
}
return true;
}
if (state.getValue(FACING) == EnumFacing.EAST) {
if (hitZ < 0.5) {
return sideInventoryManager(world, player, tile, slot0, 0);
}
if (hitZ > 0.5) {
return sideInventoryManager(world, player, tile, slot1, 1);
}
return true;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
if (hitZ > 0.5) {
return sideInventoryManager(world, player, tile, slot0, 0);
}
if (hitZ < 0.5) {
return sideInventoryManager(world, player, tile, slot1, 1);
}
return true;
}
}
}
}
}
return false;
}
private boolean sideInventoryManager(World world, EntityPlayer player, TileWorkbench tile, ItemStack slot, int index)
{
if(!player.isSneaking()) {
ItemStack stack = player.inventory.getCurrentItem();
if (!(stack.isEmpty()) ) {
if( stack.isItemEqual(slot) ) {
if (slot.getCount() < 64) {
if (stack.getCount() + slot.getCount() > 64) {
stack.shrink(64 - slot.getCount());
slot.setCount(64);
return true;
}
if (stack.getCount() + slot.getCount() < 64) {
slot.grow(stack.getCount());
stack.shrink(stack.getCount());
return true;
}
}
}
if (slot.isEmpty()) {
tile.setSlotStack(index, stack);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
}
if(player.isSneaking()){
if(!slot.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotStack(index));
tile.clearSlot(index);
return true;
}
}
return false;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
state = state.getActualState(source, pos);
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
switch (enumfacing)
{
case EAST:
default:
return boundBoxEast;
case SOUTH:
return boundBoxSouth;
case WEST:
return boundBoxWest;
case NORTH:
return boundBoxNorth;
}
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileWorkbench tile = (TileWorkbench) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Nullable
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileWorkbench();
}
}

View File

@@ -1,287 +0,0 @@
package nmd.primal.forgecraft.capabilities;
/*
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import javax.annotation.Nullable;
import java.util.LinkedHashMap;
public class SlottedTongsHandler implements ICapabilitySerializable<NBTTagCompound>, IItemHandler {
@CapabilityInject(SlottedTongsHandler.class)
public static Capability<SlottedTongsHandler> CAP;
private IChangeCallback callback;
public final Map<ItemEntry, ItemEntryWithCount> items;
private ItemEntryWithCount[] itemsArray;
private int totalItemCount;
private NBTTagCompound cachedNetData;
public static AntibarrelData get(ItemStack stack)
{
AntibarrelData data = stack.getCapability(CAP, null);
if (BlockUtils.hasData(stack))
{
data.deserializeNBT(BlockUtils.getData(stack));
BlockUtils.removeData(stack);
}
return data;
}
public SlottedTongsHandler(@Nullable IChangeCallback c)
{
callback = c;
items = new LinkedHashMap<>();
}
public void clear()
{
items.clear();
itemsArray = null;
totalItemCount = -1;
cachedNetData = null;
}
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing)
{
return capability == CAP || capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;
}
@Override
@Nullable
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
{
return capability == CAP || capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ? (T) this : null;
}
@Override
public NBTTagCompound serializeNBT()
{
NBTTagCompound nbt = new NBTTagCompound();
NBTTagList list = new NBTTagList();
for (ItemEntryWithCount entry : items.values())
{
if (!entry.isEmpty())
{
list.appendTag(entry.serializeNBT());
}
}
if (!list.isEmpty())
{
nbt.setTag("Inv", list);
}
return nbt;
}
public NBTTagCompound serializeNBTForNet()
{
if (cachedNetData != null)
{
return cachedNetData;
}
cachedNetData = new NBTTagCompound();
NBTTagList list = new NBTTagList();
for (ItemEntryWithCount entry : items.values())
{
if (!entry.isEmpty())
{
list.appendTag(entry.serializeNBT());
}
}
if (!list.isEmpty())
{
cachedNetData.setTag("Inv", list);
}
return cachedNetData;
}
@Override
public void deserializeNBT(NBTTagCompound nbt)
{
clear();
NBTTagList list = nbt.getTagList("Inv", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
ItemEntryWithCount entryc = new ItemEntryWithCount(nbt1);
if (!entryc.isEmpty())
{
items.put(entryc.entry, entryc);
}
}
}
public void copyFrom(AntibarrelData data)
{
clear();
totalItemCount = data.totalItemCount;
for (ItemEntryWithCount entry : data.items.values())
{
items.put(entry.entry, new ItemEntryWithCount(entry.entry, entry.count));
}
}
@Override
public int getSlots()
{
return items.size() + 1;
}
@Override
public ItemStack getStackInSlot(int slot)
{
return slot <= 0 || slot > items.size() ? ItemStack.EMPTY : getItemArray()[slot - 1].getStack(false);
}
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate)
{
if (slot < 0 || slot > items.size() || stack.isEmpty() || stack.isStackable())
{
return stack;
}
ItemEntry entry = ItemEntry.get(stack);
ItemEntryWithCount entryc;
int added = 0;
if (slot == 0)
{
entryc = items.get(entry);
if (entryc != null)
{
added = Math.min(YabbaConfig.general.antibarrel_items_per_type - entryc.count, stack.getCount());
}
else if (items.size() < YabbaConfig.general.antibarrel_capacity)
{
entryc = new ItemEntryWithCount(entry, 0);
items.put(entry, entryc);
itemsArray = null;
totalItemCount = -1;
cachedNetData = null;
added = Math.min(YabbaConfig.general.antibarrel_items_per_type, stack.getCount());
}
}
else
{
entryc = getItemArray()[slot - 1];
if (entryc.entry.equalsEntry(entry))
{
added = Math.min(YabbaConfig.general.antibarrel_items_per_type - entryc.count, stack.getCount());
}
}
if (entryc != null && added > 0)
{
if (!simulate)
{
entryc.count += added;
totalItemCount = -1;
cachedNetData = null;
if (callback != null)
{
callback.onContentsChanged(false);
}
}
return added == stack.getCount() ? ItemStack.EMPTY : ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - added);
}
return stack;
}
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate)
{
if (slot <= 0 || slot > items.size() || amount < 1)
{
return ItemStack.EMPTY;
}
ItemEntryWithCount entryc = getItemArray()[slot - 1];
if (entryc.isEmpty())
{
return ItemStack.EMPTY;
}
int extracted = Math.min(amount, entryc.count);
ItemStack is = entryc.entry.getStack(extracted, true);
if (!simulate)
{
entryc.count -= extracted;
totalItemCount = -1;
cachedNetData = null;
if (callback != null)
{
callback.onContentsChanged(false);
}
}
return is;
}
private ItemEntryWithCount[] getItemArray()
{
if (itemsArray == null)
{
itemsArray = items.values().toArray(new ItemEntryWithCount[0]);
}
return itemsArray;
}
@Override
public int getSlotLimit(int slot)
{
return YabbaConfig.general.antibarrel_items_per_type;
}
public int getTotalItemCount()
{
if (totalItemCount >= 0)
{
return totalItemCount;
}
totalItemCount = 0;
for (ItemEntryWithCount entry : items.values())
{
totalItemCount += entry.count;
}
return totalItemCount;
}
}
*/

View File

@@ -1,61 +0,0 @@
package nmd.primal.forgecraft.commands;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.event.ClickEvent;
/**
* Created by mminaie on 11/5/17.
*/
public class CommandShowWiki extends CommandBase {
/**
* Check if the given ICommandSender has permission to execute this command
*/
public boolean checkPermission(MinecraftServer server, ICommandSender sender)
{
return server.isSinglePlayer() || super.checkPermission(server, sender);
}
/**
* Gets the name of the command
*/
public String getName()
{
return "ForgeCraftWiki";
}
/**
* Return the required permission level for this command.
*/
public int getRequiredPermissionLevel()
{
return 0;
}
/**
* Gets the usage string for the command.
*/
public String getUsage(ICommandSender sender)
{
return "OpenUrl";
}
/**
* Callback for when the command is executed
*/
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
String str = "https://sites.google.com/view/forgecraft/home/wiki";
ClickEvent event = new ClickEvent(ClickEvent.Action.OPEN_URL, str);
ITextComponent link = new TextComponentString("Wiki").setStyle(new Style().setClickEvent(event).setColor(TextFormatting.BLUE));
sender.sendMessage(link);
}
}

View File

@@ -0,0 +1,15 @@
package nmd.primal.forgecraft.compat;
import mezz.jei.api.BlankModPlugin;
import mezz.jei.api.IModRegistry;
/**
* Created by mminaie on 6/1/17.
*/
public class JEI extends BlankModPlugin
{
@Override
public void register(IModRegistry registry) {
}
}

View File

@@ -0,0 +1,32 @@
package nmd.primal.forgecraft.compat;
import net.minecraftforge.oredict.OreDictionary;
import nmd.primal.forgecraft.init.ModBlocks;
/**
* Created by mminaie on 2/7/17.
*/
public class ModDictionary {/*******************************************************************************
* Register Only Vanilla OreDictionary Entries Here
* Mod Items/Blocks have their names added through the respective
* registration methods as a list of comma delineated strings.
*
* EXAMPLE:
* LEATHER_CORDAGE = registerItem(new PrimalItem("leather_cordage"), "cordageGeneral, cordageLeather");
*
*/
public static void registerDictionaryNames()
{
//if (ModConfig.COMPATIBILITY_DICTIONARY_MAGMACREAM_AS_SLIME)
//OreDictionary.registerOre("clayball", Items.CLAY_BALL);
OreDictionary.registerOre("ingotIron", ModBlocks.ironball);
OreDictionary.registerOre("nuggetIron", ModBlocks.ironchunk);
OreDictionary.registerOre("ingotIron", ModBlocks.ironcleanball);
OreDictionary.registerOre("nuggetIron", ModBlocks.ironcleanchunk);
OreDictionary.registerOre("ingotSteel", ModBlocks.steelball);
OreDictionary.registerOre("nuggetSteel", ModBlocks.steelchunk);
}
}

View File

@@ -1,225 +0,0 @@
package nmd.primal.forgecraft.compat.ct;
import crafttweaker.CraftTweakerAPI;
import crafttweaker.IAction;
import crafttweaker.annotations.ModOnly;
import crafttweaker.annotations.ZenRegister;
import crafttweaker.api.item.IIngredient;
import crafttweaker.api.item.IItemStack;
import crafttweaker.api.minecraft.CraftTweakerMC;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import nmd.primal.core.common.PrimalCore;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import java.util.List;
import java.util.stream.Collectors;
@ZenClass("mods.forgecraft.NBTCrucible")
@ModOnly(ModInfo.MOD_ID)
@ZenRegister
public class CTCrucible {
static
{
PrimalCore.LOGGER.info("Registering CraftTweaker: " + CrucibleCrafting.RECIPE_PREFIX);
}
@ZenMethod
public static void addRecipe(IIngredient ing0,
IIngredient ing1,
IIngredient ing2,
IIngredient ing3,
IIngredient ing4,
IItemStack dropsRaw,
IItemStack dropsCooked,
int cookTemp,
int cookTime,
int coolTime,
String recipe_name)
{
CraftTweakerAPI.apply(new Add( ing0,
ing1,
ing2,
ing3,
ing4,
(ItemStack) dropsRaw.getInternal(),
(ItemStack) dropsCooked.getInternal(),
cookTemp, cookTime, coolTime, recipe_name) );
}
@ZenMethod
public static void removeRecipe(String recipe_name)
{
CraftTweakerAPI.apply(new Remove(recipe_name));
}
@ZenMethod
public static void removeAll()
{
CraftTweakerAPI.apply(new RemoveAll());
}
private static class Add implements IAction
{
private final String recipe_name;
private final int cookTemp;
private final int cookTime;
private final int coolTime;
private final Ingredient ing0, ing1, ing2, ing3, ing4;
private final ItemStack dropsCooked;
private final ItemStack dropsRaw;
private boolean isDisabled, isHidden;
public Add(IIngredient I0, IIngredient I1, IIngredient I2, IIngredient I3, IIngredient I4, ItemStack dropsRaw, ItemStack dropsCooked, int cookTemp, int cookTime, int coolTime, String recipe_name)
{
ItemStack[] array0 = null;
ItemStack[] array1 = null;
ItemStack[] array2 = null;
ItemStack[] array3 = null;
ItemStack[] array4 = null;
ItemStack[] emptyArray = new ItemStack[1];
emptyArray[0] = ItemStack.EMPTY;
if(I0 != null) {
Ingredient temp0 = null;
List<ItemStack> zeroIList = I0.getItems().stream().map(CraftTweakerMC::getItemStack).collect(Collectors.toList());
array0 = zeroIList.stream().toArray(ItemStack[]::new);
}
if(I0 == null) {
array0 = emptyArray;
}
if(I1 != null) {
Ingredient temp1 = null;
List<ItemStack> oneIList = I1.getItems().stream().map(CraftTweakerMC::getItemStack).collect(Collectors.toList());
array1 = oneIList.stream().toArray(ItemStack[]::new);
}
if(I1 == null) {
array1 = emptyArray;
}
if(I2 != null) {
Ingredient temp2 = null;
List<ItemStack> twoIList = I2.getItems().stream().map(CraftTweakerMC::getItemStack).collect(Collectors.toList());
array2 = twoIList.stream().toArray(ItemStack[]::new);
}
if(I2 == null) {
array2 = emptyArray;
}
if(I3 != null) {
Ingredient temp3 = null;
List<ItemStack> threeIList = I3.getItems().stream().map(CraftTweakerMC::getItemStack).collect(Collectors.toList());
array3 = threeIList.stream().toArray(ItemStack[]::new);
}
if(I3 == null) {
array3 = emptyArray;
}
if(I4 != null) {
Ingredient temp4 = null;
List<ItemStack> fourIList = I4.getItems().stream().map(CraftTweakerMC::getItemStack).collect(Collectors.toList());
array4 = fourIList.stream().toArray(ItemStack[]::new);
}
if(I4 == null) {
array4 = emptyArray;
}
this.recipe_name = recipe_name;
this.cookTemp = cookTemp;
this.cookTime = cookTime;
this.coolTime = coolTime;
this.ing0 = Ingredient.fromStacks(array0);
this.ing1 = Ingredient.fromStacks(array1);
this.ing2 = Ingredient.fromStacks(array2);
this.ing3 = Ingredient.fromStacks(array3);
this.ing4 = Ingredient.fromStacks(array4);
this.dropsCooked = dropsCooked;
this.dropsRaw = dropsRaw;
this.isDisabled = false;
this.isHidden = false;
}
@Override
public void apply()
{
PrimalCore.LOGGER.info("Add CraftTweaker Recipe: " + this.recipe_name);
CrucibleCrafting.REGISTRY.register(new CrucibleCrafting(
this.ing0,
this.ing1,
this.ing2,
this.ing3,
this.ing4,
this.dropsRaw,
this.dropsCooked,
this.cookTemp,
this.cookTime,
this.coolTime).setRecipeName(this.recipe_name));
}
@Override
public String describe()
{
return "[" + ModInfo.MOD_NAME + "] Adding Crafting Tweaker recipe for: " + CrucibleCrafting.RECIPE_PREFIX;
}
}
private static class Remove implements IAction
{
private String recipe_name;
public Remove(String recipe_name)
{
this.recipe_name = recipe_name;
}
@Override
public void apply()
{
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(recipe_name);
if (recipe != null && !recipe.isHidden())
{
PrimalCore.LOGGER.info("Remove CraftTweaker Recipe: " + recipe_name);
recipe.setDisabled(true);
}
}
@Override
public String describe()
{
return "[" + ModInfo.MOD_NAME + "] Removing Crafting Tweaker recipe for:" + CrucibleCrafting.RECIPE_PREFIX;
}
}
private static class RemoveAll implements IAction
{
public RemoveAll() { }
@Override
public void apply()
{
for (CrucibleCrafting recipe : CrucibleCrafting.RECIPES)
{
if (!recipe.isHidden())
recipe.setDisabled(true);
}
}
@Override
public String describe()
{
return "[" + ModInfo.MOD_NAME + "] Removing Crafting Tweaker recipe for:" + CrucibleCrafting.RECIPE_PREFIX;
}
}
}

View File

@@ -1,31 +0,0 @@
package nmd.primal.forgecraft.compat.jei;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import nmd.primal.forgecraft.ModInfo;
import java.util.List;
/**
* Created by mminaie on 9/13/18.
*/
public abstract class AbstractCategory<T extends IRecipeWrapper> implements IRecipeCategory<T> {
@Override
public String getModName() {
return ModInfo.MOD_NAME;
}
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
}
@Override
public IDrawable getIcon() {
// use the default icon
return null;
}
}

View File

@@ -1,112 +0,0 @@
package nmd.primal.forgecraft.compat.jei;
import mezz.jei.api.*;
import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import nmd.primal.forgecraft.compat.jei.anvil.AnvilRecipeCategory;
import nmd.primal.forgecraft.compat.jei.anvil.AnvilRecipeChecker;
import nmd.primal.forgecraft.compat.jei.anvil.AnvilRecipeHandler;
import nmd.primal.forgecraft.compat.jei.casting.CastingRecipeCategory;
import nmd.primal.forgecraft.compat.jei.casting.CastingRecipeChecker;
import nmd.primal.forgecraft.compat.jei.casting.CastingRecipeHandler;
import nmd.primal.forgecraft.compat.jei.crucible.CrucibleRecipeCategory;
import nmd.primal.forgecraft.compat.jei.crucible.CrucibleRecipeChecker;
import nmd.primal.forgecraft.compat.jei.crucible.CrucibleRecipeHandler;
import nmd.primal.forgecraft.compat.jei.forge.ForgeRecipeCategory;
import nmd.primal.forgecraft.compat.jei.forge.ForgeRecipeChecker;
import nmd.primal.forgecraft.compat.jei.forge.ForgeRecipeHandler;
import nmd.primal.forgecraft.compat.jei.workbench.WorkbenchRecipeCategory;
import nmd.primal.forgecraft.compat.jei.workbench.WorkbenchRecipeChecker;
import nmd.primal.forgecraft.compat.jei.workbench.WorkbenchRecipeHandler;
import nmd.primal.forgecraft.crafting.*;
import nmd.primal.forgecraft.init.ModBlocks;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/11/18.
*/
@JEIPlugin
public class ModJEI implements IModPlugin
{
public static IJeiHelpers jeiHelper;
public static ICraftingGridHelper craftingGridHelper;
public static IRecipeRegistry recipeRegistry;
public static IGuiHelper guiHelper;
private static final int craftOutputSlot = 0;
private static final int craftInputSlot1 = 1;
@Override
public void registerCategories(IRecipeCategoryRegistration registry)
{
final IJeiHelpers jeiHelpers = registry.getJeiHelpers();
final IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
//
// Recipe Categories
//
registry.addRecipeCategories(new ForgeRecipeCategory(guiHelper));
registry.addRecipeCategories(new CrucibleRecipeCategory(guiHelper));
registry.addRecipeCategories(new AnvilRecipeCategory(guiHelper));
registry.addRecipeCategories(new CastingRecipeCategory(guiHelper));
registry.addRecipeCategories(new WorkbenchRecipeCategory(guiHelper));
}
@Override
public void register(@Nonnull IModRegistry registry) {
jeiHelper = registry.getJeiHelpers();
guiHelper = jeiHelper.getGuiHelper();
craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot1, craftOutputSlot);
// ***************************************************************************** //
// Recipes
// ***************************************************************************** //
//
// Forging
//
registry.handleRecipes(ForgeCrafting.class, new ForgeRecipeHandler(), ForgeRecipeCategory.CATEGORY);
registry.addRecipes(ForgeRecipeChecker.getRecipes(), ForgeRecipeCategory.CATEGORY);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.forge_brick), ForgeRecipeCategory.CATEGORY);
//
// Crucible
//
registry.handleRecipes(CrucibleCrafting.class, new CrucibleRecipeHandler(), CrucibleRecipeCategory.CATEGORY);
registry.addRecipes(CrucibleRecipeChecker.getRecipes(), CrucibleRecipeCategory.CATEGORY);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.nbtCrucible), CrucibleRecipeCategory.CATEGORY);
//
// Anvil
//
registry.handleRecipes(AnvilCrafting.class, new AnvilRecipeHandler(), AnvilRecipeCategory.CATEGORY);
registry.addRecipes(AnvilRecipeChecker.getRecipes(), AnvilRecipeCategory.CATEGORY);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.stoneanvil), AnvilRecipeCategory.CATEGORY);
//
// Casting
//
registry.handleRecipes(CastingCrafting.class, new CastingRecipeHandler(), CastingRecipeCategory.CATEGORY);
registry.addRecipes(CastingRecipeChecker.getRecipes(), CastingRecipeCategory.CATEGORY);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.castingform), CastingRecipeCategory.CATEGORY);
//
// Workbench
//
registry.handleRecipes(WorkbenchCrafting.class, new WorkbenchRecipeHandler(), WorkbenchRecipeCategory.CATEGORY);
registry.addRecipes(WorkbenchRecipeChecker.getRecipes(), WorkbenchRecipeCategory.CATEGORY);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.workbench), WorkbenchRecipeCategory.CATEGORY);
// ***************************************************************************** //
// Info
// ***************************************************************************** //
//registry.addIngredientInfo(ItemStack.EMPTY, ItemStack.class, "jei.info.forgecraft.crucible");
//registry.addIngredientInfo(new ItemStack(ModBlocks.nbtCrucible, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.forgecraft.crucible");
//registry.addIngredientInfo(new OreIngredient("oreIron"), OreIngredient.class, "jei.info.forgecraft.oreiron");
registry.addIngredientInfo(new ItemStack(ModBlocks.castingform, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.forgecraft.casting");
registry.addIngredientInfo(new ItemStack(ModBlocks.sharpbench, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.forgecraft.sharpbench");
//registry.addIngredientInfo(new ItemStack(ModBlocks.stoneanvil, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.forgecraft.anvil");
}
}

View File

@@ -1,122 +0,0 @@
package nmd.primal.forgecraft.compat.jei.anvil;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.parts.ToolPart;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/16/18.
*/
public class AnvilRecipeCategory extends AbstractCategory<AnvilRecipeWrapper>
{
public static String CATEGORY = CommonUtils.prefix("anvil");
private static ResourceLocation gui_background = new ResourceLocation(ModInfo.MOD_ID,"textures/gui/jei/anvil.png");
private final IDrawable background;
public AnvilRecipeCategory(IGuiHelper guiHelper)
{
//background = guiHelper.createDrawable(gui_background, 0, 0, 134, 144, 0, 0, 0, 0);
background = guiHelper.createDrawable(gui_background, 0,0,160,96);
}
@Nonnull
@Override
public String getUid()
{
return CATEGORY;
}
@Nonnull
@Override
public String getTitle()
{
return I18n.format("jei.category.forgecraft.anvil");
}
@Nonnull
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft)
{
//progress.draw(minecraft, 67, 18);
}
@Override
public void setRecipe(IRecipeLayout layout, AnvilRecipeWrapper recipe, IIngredients ingredients)
{
IGuiItemStackGroup items = layout.getItemStacks();
/***INPUTS***/
items.init(0, true, 1, 1);
items.init(1, true, 20, 1);
items.init(2, true, 39, 1);
items.init(3, true, 58, 1);
items.init(4, true, 77, 1);
items.init(5, true, 1, 20);
items.init(6, true, 20, 20);
items.init(7, true, 39, 20);
items.init(8, true, 58, 20);
items.init(9, true, 77, 20);
items.init(10, true, 1, 39);
items.init(11, true, 20, 39);
items.init(12, true, 39, 39);
items.init(13, true, 58, 39);
items.init(14, true, 77, 39);
items.init(15, true, 1, 58);
items.init(16, true, 20, 58);
items.init(17, true, 39, 58);
items.init(18, true, 58, 58);
items.init(19, true, 77, 58);
items.init(20, true, 1, 77);
items.init(21, true, 20, 77);
items.init(22, true, 39, 77);
items.init(23, true, 58, 77);
items.init(24, true, 77, 77);
//items.set(0, recipe.getIngredient(0));
for(int i =0; i < 25; i++){
if(recipe.getIngredient(i).getItem() instanceof ToolPart) {
items.set(i, new ItemStack(recipe.getIngredient(i).getItem(), 1));
} else {
items.set(i, recipe.getIngredient(i));
}
}
/***OUTPUTS***/
items.init(25, false, 133, 40);
items.set(25, recipe.output);
/***EXTRAS***/
items.init(26, false, 105, 28);
ItemStack hammerStack = new ItemStack(ModItems.forgehammer, 1);
items.set(26, hammerStack);
//items.init(7, false, 58, 96);
//ItemStack bloomeryStack = new ItemStack(ModBlocks.bloomery_brick, 1, 0);
//items.set(7, bloomeryStack);
}
}

View File

@@ -1,20 +0,0 @@
package nmd.primal.forgecraft.compat.jei.anvil;
import nmd.primal.forgecraft.crafting.AnvilCrafting;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mminaie on 9/16/18.
*/
public class AnvilRecipeChecker {
public static List<AnvilCrafting> getRecipes() {
List<AnvilCrafting> recipes = new ArrayList<>();
for (AnvilCrafting recipe : AnvilCrafting.getAnvilRecipes()) {
recipes.add(recipe);
}
return recipes;
}
}

View File

@@ -1,18 +0,0 @@
package nmd.primal.forgecraft.compat.jei.anvil;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;
import nmd.primal.forgecraft.crafting.AnvilCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/17/18.
*/
public class AnvilRecipeHandler implements IRecipeWrapperFactory<AnvilCrafting> {
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull AnvilCrafting recipe) {
return new AnvilRecipeWrapper(recipe);
}
}

View File

@@ -1,53 +0,0 @@
package nmd.primal.forgecraft.compat.jei.anvil;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import nmd.primal.forgecraft.crafting.AnvilCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/16/18.
*/
public class AnvilRecipeWrapper implements IRecipeWrapper {
protected final AnvilCrafting recipe;
protected ItemStack[] input;
protected String upgradeType;
protected ItemStack output;
public AnvilRecipeWrapper(AnvilCrafting recipe) {
this.recipe = recipe;
this.input = recipe.getInput();
this.upgradeType = recipe.getUpgrade();
this.output = recipe.getOutput();
}
@Override
public void getIngredients(IIngredients ingredients) {
for(int i =0; i < 25; i++){
//if(this.input[i] != new ItemStack(Items.AIR, 1) {
ingredients.setInput(ItemStack.class, this.input[i]);
//}
}
ingredients.setOutput(ItemStack.class, this.output);
}
public ItemStack getIngredient(int a){
return input[a];
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
//minecraft.fontRenderer.drawString(recipe.getDropsCooked().getDisplayName() + " Recipe", 20, 5, Color.black.getRGB());
}
}

View File

@@ -1,129 +0,0 @@
package nmd.primal.forgecraft.compat.jei.casting;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.parts.WeaponPart;
import nmd.primal.forgecraft.util.ToolNBT;
import nmd.primal.forgecraft.util.WeaponNBT;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/16/18.
*/
public class CastingRecipeCategory extends AbstractCategory<CastingRecipeWrapper>
{
public static String CATEGORY = CommonUtils.prefix("casting");
private static ResourceLocation gui_background = new ResourceLocation(ModInfo.MOD_ID,"textures/gui/jei/casting.png");
private final IDrawable background;
public CastingRecipeCategory(IGuiHelper guiHelper)
{
//background = guiHelper.createDrawable(gui_background, 0, 0, 134, 144, 0, 0, 0, 0);
background = guiHelper.createDrawable(gui_background, 0,0,256,96);
}
@Nonnull
@Override
public String getUid()
{
return CATEGORY;
}
@Nonnull
@Override
public String getTitle()
{
return I18n.format("jei.category.forgecraft.casting");
}
@Nonnull
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft)
{
//progress.draw(minecraft, 67, 18);
}
@Override
public void setRecipe(IRecipeLayout layout, CastingRecipeWrapper recipe, IIngredients ingredients)
{
IGuiItemStackGroup items = layout.getItemStacks();
/***INPUTS***/
items.init(0, true, 1, 1);
items.init(1, true, 20, 1);
items.init(2, true, 39, 1);
items.init(3, true, 58, 1);
items.init(4, true, 77, 1);
items.init(5, true, 1, 20);
items.init(6, true, 20, 20);
items.init(7, true, 39, 20);
items.init(8, true, 58, 20);
items.init(9, true, 77, 20);
items.init(10, true, 1, 39);
items.init(11, true, 20, 39);
items.init(12, true, 39, 39);
items.init(13, true, 58, 39);
items.init(14, true, 77, 39);
items.init(15, true, 1, 58);
items.init(16, true, 20, 58);
items.init(17, true, 39, 58);
items.init(18, true, 58, 58);
items.init(19, true, 77, 58);
items.init(20, true, 1, 77);
items.init(21, true, 20, 77);
items.init(22, true, 39, 77);
items.init(23, true, 58, 77);
items.init(24, true, 77, 77);
//items.set(0, recipe.getIngredient(0));
for(int i =0; i < 25; i++){
items.set(i, recipe.getIngredient(i));
}
/***OUTPUTS***/
items.init(26, false, 133, 77);
if(recipe.output.getItem() instanceof WeaponPart){
ItemStack tempStack = new ItemStack(recipe.output.getItem(), 1);
WeaponNBT.setDefaultNBT(tempStack);
items.set(26, tempStack);
} else if(recipe.output.getItem() instanceof ToolPart){
ItemStack tempStack = new ItemStack(recipe.output.getItem(), 1);
ToolNBT.setDefaultNBT(tempStack);
items.set(26, tempStack);
} else {items.set(26, recipe.output);}
/***EXTRAS***/
//items.init(26, false, 105, 28);
//ItemStack hammerStack = new ItemStack(ModItems.forgehammer, 1);
//items.set(26, hammerStack);
//items.init(7, false, 58, 96);
//ItemStack bloomeryStack = new ItemStack(ModBlocks.bloomery_brick, 1, 0);
//items.set(7, bloomeryStack);
}
}

View File

@@ -1,20 +0,0 @@
package nmd.primal.forgecraft.compat.jei.casting;
import nmd.primal.forgecraft.crafting.CastingCrafting;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mminaie on 9/16/18.
*/
public class CastingRecipeChecker {
public static List<CastingCrafting> getRecipes() {
List<CastingCrafting> recipes = new ArrayList<>();
for (CastingCrafting recipe : CastingCrafting.getCastingRecipes()) {
recipes.add(recipe);
}
return recipes;
}
}

View File

@@ -1,18 +0,0 @@
package nmd.primal.forgecraft.compat.jei.casting;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;
import nmd.primal.forgecraft.crafting.CastingCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/17/18.
*/
public class CastingRecipeHandler implements IRecipeWrapperFactory<CastingCrafting> {
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull CastingCrafting recipe) {
return new CastingRecipeWrapper(recipe);
}
}

View File

@@ -1,55 +0,0 @@
package nmd.primal.forgecraft.compat.jei.casting;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import nmd.primal.forgecraft.crafting.CastingCrafting;
import javax.annotation.Nonnull;
import java.awt.*;
/**
* Created by mminaie on 9/16/18.
*/
public class CastingRecipeWrapper implements IRecipeWrapper {
protected final CastingCrafting recipe;
protected Item[] input;
protected ItemStack source;
protected ItemStack output;
public CastingRecipeWrapper(CastingCrafting recipe) {
this.recipe = recipe;
this.input = recipe.getInput();
this.output = recipe.getOutput();
this.source =recipe.getSource();
}
@Override
public void getIngredients(IIngredients ingredients) {
for(int i =0; i < 25; i++){
//if(this.input[i] != new ItemStack(Items.AIR, 1) {
ingredients.setInput(ItemStack.class, this.input[i]);
//}
}
ingredients.setOutput(ItemStack.class, this.output);
}
public ItemStack getIngredient(int a){
return new ItemStack(input[a], 1);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
String tempString = new String("To an empty crucible add: " + recipe.getSource().getDisplayName() + ". For details reference the appropriate crucible recipe. Pick up the hot crucible with Stonetongs and right click your casting block.");
minecraft.fontRenderer.drawSplitString(tempString, 97, 0, 150, Color.black.getRGB());
}
}

View File

@@ -1,95 +0,0 @@
package nmd.primal.forgecraft.compat.jei.crucible;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.init.ModBlocks;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/13/18.
*/
public class CrucibleRecipeCategory extends AbstractCategory<CrucibleRecipeWrapper>
{
public static String CATEGORY = CommonUtils.prefix("crucible");
private static ResourceLocation gui_background = new ResourceLocation(ModInfo.MOD_ID,"textures/gui/jei/crucible.png");
private final IDrawable background;
public CrucibleRecipeCategory(IGuiHelper guiHelper)
{
//background = guiHelper.createDrawable(gui_background, 0, 0, 134, 144, 0, 0, 0, 0);
background = guiHelper.createDrawable(gui_background, 0,0,160,134);
}
@Nonnull
@Override
public String getUid()
{
return CATEGORY;
}
@Nonnull
@Override
public String getTitle()
{
return I18n.format("jei.category.forgecraft.crucible");
}
@Nonnull
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft)
{
//progress.draw(minecraft, 67, 18);
}
@Override
public void setRecipe(IRecipeLayout layout, CrucibleRecipeWrapper recipe, IIngredients ingredients)
{
IGuiItemStackGroup items = layout.getItemStacks();
/***INPUTS***/
items.init(0, true, 1, 77);
items.init(1, true, 1, 58);
items.init(2, true, 1, 39);
items.init(3, true, 1, 20);
items.init(4, true, 1, 1);
//items.set(0, recipe.getIngredient(0));
items.set(0, recipe.getIngredient(0));
items.set(1, recipe.getIngredient(1));
items.set(2, recipe.getIngredient(2));
items.set(3, recipe.getIngredient(3));
items.set(4, recipe.getIngredient(4));
/***OUTPUTS***/
items.init(5, false, 115, 96);
items.set(5, recipe.dropsCooked);
/***EXTRAS***/
items.init(6, false, 1, 96);
ItemStack crucibleStack = new ItemStack(ModBlocks.nbtCrucible, 1, 0);
items.set(6, crucibleStack);
items.init(7, false, 58, 96);
ItemStack bloomeryStack = new ItemStack(ModBlocks.bloomery_brick, 1, 0);
items.set(7, bloomeryStack);
}
}

View File

@@ -1,24 +0,0 @@
package nmd.primal.forgecraft.compat.jei.crucible;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mminaie on 9/13/18.
*/
public class CrucibleRecipeChecker {
public static List<CrucibleCrafting> getRecipes() {
List<CrucibleCrafting> recipes = new ArrayList<>();
for (CrucibleCrafting recipe : CrucibleCrafting.getRECIPES()) {
if(!recipe.isDisabled()) {
if(!recipe.isHidden()) {
recipes.add(recipe);
}
}
}
return recipes;
}
}

View File

@@ -1,20 +0,0 @@
package nmd.primal.forgecraft.compat.jei.crucible;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/13/18.
*/
public class CrucibleRecipeHandler implements IRecipeWrapperFactory<CrucibleCrafting>
{
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull CrucibleCrafting recipe)
{
return new CrucibleRecipeWrapper(recipe);
}
}

View File

@@ -1,86 +0,0 @@
package nmd.primal.forgecraft.compat.jei.crucible;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import javax.annotation.Nonnull;
import java.awt.*;
import java.util.Arrays;
import java.util.List;
/**
* Created by mminaie on 9/13/18.
*/
public class CrucibleRecipeWrapper implements IRecipeWrapper
{
protected final CrucibleCrafting recipe;
//protected final List<Ingredient> ;
protected final int cookTemp;
protected final int cookTime;
protected final int coolTime;
protected final ItemStack dropsCooked;
protected final ItemStack dropsRaw;
protected Ingredient ing0;
protected Ingredient ing1;
protected Ingredient ing2;
protected Ingredient ing3;
protected Ingredient ing4;
protected List<Ingredient> ingredientList;
protected List crucibleCrafting;
public CrucibleRecipeWrapper(CrucibleCrafting recipe)
{
this.recipe = recipe;
this.cookTemp = recipe.getCookTemp();
this.cookTime = recipe.getCookTime();
this.coolTime = recipe.getCoolTime();
this.dropsCooked = recipe.getDropsCooked();
this.dropsRaw = recipe.getDropsRaw();
this.ing0 = recipe.getIng0();
this.ing1 = recipe.getIng1();
this.ing2 = recipe.getIng2();
this.ing3 = recipe.getIng3();
this.ing4 = recipe.getIng4();
this.ingredientList = recipe.getIngredientList();
this.crucibleCrafting = recipe.getIngredientList();
}
@Override
public void getIngredients(IIngredients ingredients)
{
//ingredients.setInputs(Ingredient.class, this.crucibleCrafting);
ingredients.setInput(ItemStack.class, this.ing0);
ingredients.setInput(ItemStack.class, this.ing1);
ingredients.setInput(ItemStack.class, this.ing2);
ingredients.setInput(ItemStack.class, this.ing3);
ingredients.setInput(ItemStack.class, this.ing4);
ingredients.setOutput(ItemStack.class, this.dropsCooked);
}
public List<ItemStack> getIngredient(int a){
ItemStack[] tempArray = this.ingredientList.get(a).getMatchingStacks();
List<ItemStack> stackList = Arrays.asList(tempArray);
return stackList;
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
minecraft.fontRenderer.drawString(String.valueOf(cookTemp) + "\u00b0", 58, 120, Color.red.getRGB());
minecraft.fontRenderer.drawString(String.valueOf(cookTime + " ticks"), 58, 86, Color.blue.getRGB());
minecraft.fontRenderer.drawString(recipe.getDropsCooked().getDisplayName() + " Recipe", 20, 5, Color.black.getRGB());
}
}

View File

@@ -1,85 +0,0 @@
package nmd.primal.forgecraft.compat.jei.forge;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.init.ModBlocks;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/16/18.
*/
public class ForgeRecipeCategory extends AbstractCategory<ForgeRecipeWrapper>
{
public static String CATEGORY = CommonUtils.prefix("forging");
private static ResourceLocation gui_background = new ResourceLocation(ModInfo.MOD_ID,"textures/gui/jei/forging.png");
private final IDrawable background;
public ForgeRecipeCategory(IGuiHelper guiHelper)
{
//background = guiHelper.createDrawable(gui_background, 0, 0, 134, 144, 0, 0, 0, 0);
background = guiHelper.createDrawable(gui_background, 0,0,77,58);
}
@Nonnull
@Override
public String getUid()
{
return CATEGORY;
}
@Nonnull
@Override
public String getTitle()
{
return I18n.format("jei.category.forgecraft.forging");
}
@Nonnull
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft)
{
//progress.draw(minecraft, 67, 18);
}
@Override
public void setRecipe(IRecipeLayout layout, ForgeRecipeWrapper recipe, IIngredients ingredients)
{
IGuiItemStackGroup items = layout.getItemStacks();
/***INPUTS***/
items.init(0, true, 1, 1);
items.set(0, new ItemStack(recipe.input, 1));
/***OUTPUTS***/
items.init(1, false, 58, 20);
items.set(1, recipe.output);
/***EXTRAS***/
items.init(3, false, 1, 20);
ItemStack forgeStack = new ItemStack(Item.getItemFromBlock(ModBlocks.forge_brick), 1);
items.set(3, forgeStack);
//items.init(7, false, 58, 96);
//ItemStack bloomeryStack = new ItemStack(ModBlocks.bloomery_brick, 1, 0);
//items.set(7, bloomeryStack);
}
}

View File

@@ -1,20 +0,0 @@
package nmd.primal.forgecraft.compat.jei.forge;
import nmd.primal.forgecraft.crafting.ForgeCrafting;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mminaie on 9/16/18.
*/
public class ForgeRecipeChecker {
public static List<ForgeCrafting> getRecipes() {
List<ForgeCrafting> recipes = new ArrayList<>();
for (ForgeCrafting recipe : ForgeCrafting.getForgeRecipes()) {
recipes.add(recipe);
}
return recipes;
}
}

View File

@@ -1,18 +0,0 @@
package nmd.primal.forgecraft.compat.jei.forge;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;
import nmd.primal.forgecraft.crafting.ForgeCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/17/18.
*/
public class ForgeRecipeHandler implements IRecipeWrapperFactory<ForgeCrafting> {
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull ForgeCrafting recipe) {
return new ForgeRecipeWrapper(recipe);
}
}

View File

@@ -1,57 +0,0 @@
package nmd.primal.forgecraft.compat.jei.forge;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import nmd.primal.forgecraft.crafting.ForgeCrafting;
import javax.annotation.Nonnull;
import java.awt.*;
/**
* Created by mminaie on 9/16/18.
*/
public class ForgeRecipeWrapper implements IRecipeWrapper {
protected final ForgeCrafting recipe;
protected Item input;
protected ItemStack output;
protected int heat_threshold;
protected int ideal_time;
protected int cooldown;
public ForgeRecipeWrapper(ForgeCrafting recipe) {
this.recipe = recipe;
this.input = recipe.getInput();
this.output = recipe.getOutput();
this.heat_threshold = recipe.getHeatThreshold();
this.ideal_time = recipe.getIdealTime();
this.cooldown = recipe.getCooldown();
}
@Override
public void getIngredients(IIngredients ingredients) {
ingredients.setInput(ItemStack.class, this.input);
ingredients.setOutput(ItemStack.class, this.output);
}
public ItemStack getIngredient(){
return new ItemStack(this.input, 1);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
//String tempString = new String("To an empty crucible add: " + recipe.getSource().getDisplayName() + ". For details reference the appropriate crucible recipe. Pick up the hot crucible with Stonetongs and right click your casting block.");
//minecraft.fontRenderer.drawSplitString(tempString, 97, 0, 150, Color.black.getRGB());
minecraft.fontRenderer.drawString(String.valueOf(recipe.getHeatThreshold() + "\u00b0"), 24, 36, Color.red.getRGB());
minecraft.fontRenderer.drawString(String.valueOf(recipe.getIdealTime()), 26, 13, Color.green.getRGB());
}
}

View File

@@ -1,100 +0,0 @@
package nmd.primal.forgecraft.compat.jei.workbench;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.init.ModBlocks;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.List;
/**
* Created by mminaie on 9/16/18.
*/
public class WorkbenchRecipeCategory extends AbstractCategory<WorkbenchRecipeWrapper>
{
public static String CATEGORY = CommonUtils.prefix("workbench");
private static ResourceLocation gui_background = new ResourceLocation(ModInfo.MOD_ID,"textures/gui/jei/workbench.png");
private final IDrawable background;
public WorkbenchRecipeCategory(IGuiHelper guiHelper)
{
//background = guiHelper.createDrawable(gui_background, 0, 0, 134, 144, 0, 0, 0, 0);
background = guiHelper.createDrawable(gui_background, 0,0,115,39);
}
@Nonnull
@Override
public String getUid()
{
return CATEGORY;
}
@Nonnull
@Override
public String getTitle()
{
return I18n.format("jei.category.forgecraft.workbench");
}
@Nonnull
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft)
{
//progress.draw(minecraft, 67, 18);
}
@Override
public void setRecipe(IRecipeLayout layout, WorkbenchRecipeWrapper recipe, IIngredients ingredients)
{
IGuiItemStackGroup items = layout.getItemStacks();
/***INPUTS***/
items.init(0, true, 1, 1);
List<ItemStack> slot0 = Arrays.asList( recipe.toolPart.getMatchingStacks());
items.set(0,slot0);
items.init(1, true, 20, 1);
List<ItemStack> slot1 = Arrays.asList( recipe.toolHead.getMatchingStacks());
items.set(1,slot1);
items.init(2, true, 39, 1);
List<ItemStack> slot2 = Arrays.asList( recipe.toolPin.getMatchingStacks());
items.set(2,slot2);
items.init(3, true, 39, 20);
List<ItemStack> slot3 = Arrays.asList( recipe.takeApart.getMatchingStacks());
items.set(3,slot3);
/***OUTPUTS***/
items.init(4, false, 96, 11);
items.set(4, recipe.output);
/***EXTRAS***/
items.init(5, true, 66, 20);
ItemStack bench = new ItemStack(Item.getItemFromBlock(ModBlocks.workbench), 1);
items.set(5, bench);
items.init(6, false, 66, 1);
List<ItemStack> tool = Arrays.asList( recipe.tool.getMatchingStacks());
items.set(6, tool);
}
}

View File

@@ -1,24 +0,0 @@
package nmd.primal.forgecraft.compat.jei.workbench;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mminaie on 9/16/18.
*/
public class WorkbenchRecipeChecker {
public static List<WorkbenchCrafting> getRecipes() {
List<WorkbenchCrafting> recipes = new ArrayList<>();
for (WorkbenchCrafting recipe : WorkbenchCrafting.getRECIPES()) {
if(!recipe.isDisabled()) {
if(!recipe.isHidden()) {
recipes.add(recipe);
}
}
}
return recipes;
}
}

View File

@@ -1,18 +0,0 @@
package nmd.primal.forgecraft.compat.jei.workbench;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/17/18.
*/
public class WorkbenchRecipeHandler implements IRecipeWrapperFactory<WorkbenchCrafting> {
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull WorkbenchCrafting recipe) {
return new WorkbenchRecipeWrapper(recipe);
}
}

View File

@@ -1,58 +0,0 @@
package nmd.primal.forgecraft.compat.jei.workbench;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/16/18.
*/
public class WorkbenchRecipeWrapper implements IRecipeWrapper {
protected final WorkbenchCrafting recipe;
protected Ingredient toolPart;
protected Ingredient toolHead;
protected Ingredient toolPin;
protected Ingredient takeApart;
protected Ingredient tool;
protected ItemStack output;
public WorkbenchRecipeWrapper(WorkbenchCrafting recipe) {
this.recipe = recipe;
this.toolPart = recipe.getToolPart();
this.toolHead = recipe.getToolHead();
this.toolPin = recipe.getToolPin();
this.takeApart = recipe.getTakeApart();
this.tool = recipe.getCraftingTool();
this.output = recipe.getOutput();
}
@Override
public void getIngredients(IIngredients ingredients) {
ingredients.setInput(ItemStack.class, this.toolPart);
ingredients.setInput(ItemStack.class, this.toolHead);
ingredients.setInput(ItemStack.class, this.toolPin);
ingredients.setInput(ItemStack.class, this.takeApart);
ingredients.setInput(ItemStack.class, this.tool);
ingredients.setOutput(ItemStack.class, this.output);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
//String tempString = new String("To an empty crucible add: " + recipe.getSource().getDisplayName() + ". For details reference the appropriate crucible recipe. Pick up the hot crucible with Stonetongs and right click your casting block.");
//minecraft.fontRenderer.drawSplitString(tempString, 97, 0, 150, Color.black.getRGB());
//minecraft.fontRenderer.drawString(String.valueOf(recipe.getHeatThreshold() + "\u00b0"), 24, 36, Color.red.getRGB());
//minecraft.fontRenderer.drawString(String.valueOf(recipe.getIdealTime()), 26, 13, Color.green.getRGB());
}
}

View File

@@ -14,70 +14,53 @@ public class AnvilCrafting {
// Recipe Handler AnvilCrafting // Recipe Handler AnvilCrafting
// ***************************************************************************** // // ***************************************************************************** //
public static ArrayList<AnvilCrafting> getAnvilRecipes() {
return anvilRecipes;
}
private static ArrayList<AnvilCrafting> anvilRecipes = new ArrayList<>(); private static ArrayList<AnvilCrafting> anvilRecipes = new ArrayList<>();
private ItemStack[] input = new ItemStack[25]; private String[] input = new String[25];
private String upgradeType; private String upgradeType;
private ItemStack output; private ItemStack output;
public AnvilCrafting(ItemStack[] input, ItemStack output, String upgrade){ public AnvilCrafting(String[] input, ItemStack output, String upgrade){
this.input = input; this.input = input;
this.output = output; this.output = output;
this.upgradeType = upgrade; this.upgradeType = upgrade;
} }
// ***************************************************************************** // // ***************************************************************************** //
// Recipe Methods // Recipe Methods
// ***************************************************************************** // // ***************************************************************************** //
public static void addRecipe(ItemStack[] input, ItemStack output, String upgrade) public static void addRecipe(String[] input, ItemStack output, String upgrade)
{ {
anvilRecipes.add(new AnvilCrafting(input, output, upgrade)); anvilRecipes.add(new AnvilCrafting(input, output, upgrade));
} }
public static boolean isRecipe(ItemStack[] array) public static boolean isRecipe(String[] array)
{ {
for(AnvilCrafting recipe : anvilRecipes) { for(AnvilCrafting recipe : anvilRecipes) {
if (Arrays.equals(array, recipe.input)) if (Arrays.equals(array, recipe.input))
return true; return true;
} }
return false; return false;
} }
public static AnvilCrafting getRecipe(ItemStack[] array) public static AnvilCrafting getRecipe(String[] array)
{ {
for(AnvilCrafting recipe : anvilRecipes) { for(AnvilCrafting recipe : anvilRecipes) {
if(checkArrays(recipe.getInput(), array)){ if (Arrays.equals(array, recipe.input))
return recipe; return recipe;
} }
}
return null; return null;
} }
public static boolean checkArrays (ItemStack[] leftArray, ItemStack[] rightArray){ public String[] getInput() {return this.input;}
int a =0;
for(int i=0; i<leftArray.length; i++){
if( (leftArray[i].isEmpty() && rightArray[i].isEmpty()) ||
((leftArray[i].isItemEqualIgnoreDurability(rightArray[i]))) ) {
a++;
}
if(a == 25){
return true;
}
}
return false;
}
public ItemStack[] getInput() {return this.input;} public ItemStack getOutput() {return this.output;}
public ItemStack getOutput() {return this.output.copy();}
public String getUpgrade() {return this.upgradeType; } public String getUpgrade() {return this.upgradeType; }

View File

@@ -0,0 +1,135 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
/**
* Created by mminaie on 1/24/17.
*/
public class BloomeryCrafting {
// ***************************************************************************** //
// Recipe Handler Bloomery
// ***************************************************************************** //
private static ArrayList<BloomeryCrafting> bloomeryRecipes = new ArrayList<>();
private ItemStack input;
private ItemStack output;
private ItemStack output_failed;
private ItemStack cool_output;
private int heat_threshold;
private int ideal_time;
private int cooldown;
private float heat_variance;
private float time_variance;
public BloomeryCrafting(ItemStack input, ItemStack output, ItemStack output_failed, ItemStack cool_output, int heat_threshold, int ideal_time, int cooldown,float heat_variance, float time_variance)
{
this.input = input;
this.output = output;
this.output_failed = output_failed;
this.cool_output = cool_output;
this.heat_threshold = heat_threshold;
this.ideal_time = ideal_time;
this.cooldown = cooldown;
this.heat_variance = heat_variance;
this.time_variance = time_variance;
}
// ***************************************************************************** //
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(ItemStack input, ItemStack output, ItemStack failed, ItemStack cool, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
{
bloomeryRecipes.add(new BloomeryCrafting(input, output, failed, cool, heat_threshold, ideal_time, cooldown, heat_variance, time_variance));
}
public static boolean isRecipeItem(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.input))
return true;
}
return false;
}
public static boolean isOutputItem(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.output))
return true;
}
return false;
}
public static boolean isCoolItem(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.cool_output))
return true;
}
return false;
}
public static BloomeryCrafting getRecipe(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.input))
return recipe;
}
return null;
}
public static BloomeryCrafting getRecipeFromOutput(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.output))
return recipe;
}
return null;
}
public ItemStack getInput()
{
return this.input;
}
public ItemStack getOutput()
{
return this.output;
}
public ItemStack getOutputFailed()
{
return this.output_failed;
}
public ItemStack getCoolOutput()
{
return this.cool_output;
}
public int getHeatThreshold()
{
return this.heat_threshold;
}
public int getIdealTime()
{
return this.ideal_time;
}
public int getCooldown(){ return this.cooldown;}
public float getHeatVariance(){return this.heat_variance; }
public float getTimeVariance(){return this.time_variance; }
///
// end
///
}

View File

@@ -1,74 +0,0 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by mminaie on 6/22/17.
*/
public class CastingCrafting {
// ***************************************************************************** //
// Recipe Handler AnvilCrafting
// ***************************************************************************** //
private static ArrayList<CastingCrafting> castingRecipes = new ArrayList<>();
private Item[] input = new Item[25];
private ItemStack output;
public ItemStack getSource() {
return source;
}
private ItemStack source;
public CastingCrafting(ItemStack source, Item[] input, ItemStack output){
this.input = input;
this.output = output;
this.source = source;
}
// ***************************************************************************** //
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(ItemStack source, Item[] input, ItemStack output)
{
castingRecipes.add(new CastingCrafting(source, input, output));
}
public static ArrayList<CastingCrafting> getCastingRecipes() {
return castingRecipes;
}
public static boolean isRecipe(Item[] array)
{
for(CastingCrafting recipe : castingRecipes) {
if (Arrays.equals(array, recipe.input))
return true;
}
return false;
}
public static CastingCrafting getRecipe(ItemStack source, Item[] array)
{
for(CastingCrafting recipe : castingRecipes) {
if (source.getItem() == recipe.getSource().getItem() ) {
if (Arrays.equals(array, recipe.input))
return recipe;
}
}
return null;
}
public Item[] getInput() {return this.input;}
public ItemStack getOutput() {return this.output;}
}

View File

@@ -0,0 +1,62 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by mminaie on 6/22/17.
*/
public class CastingformCrafting {
// ***************************************************************************** //
// Recipe Handler AnvilCrafting
// ***************************************************************************** //
private static ArrayList<CastingformCrafting> castingRecipes = new ArrayList<>();
private String[] input = new String[25];
private ItemStack output;
public CastingformCrafting(String[] input, ItemStack output){
this.input = input;
this.output = output;
}
// ***************************************************************************** //
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(String[] input, ItemStack output)
{
castingRecipes.add(new CastingformCrafting(input, output));
}
public static boolean isRecipe(String[] array)
{
for(CastingformCrafting recipe : castingRecipes) {
if (Arrays.equals(array, recipe.input))
return true;
}
return false;
}
public static CastingformCrafting getRecipe(String[] array)
{
for(CastingformCrafting recipe : castingRecipes) {
if (Arrays.equals(array, recipe.input))
return recipe;
}
return null;
}
public String[] getInput() {return this.input;}
public ItemStack getOutput() {return this.output;}
}

View File

@@ -1,250 +0,0 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.common.crafting.AbstractRecipe;
import nmd.primal.forgecraft.ModInfo;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* Created by mminaie on 11/11/17.
*/
public class CrucibleCrafting extends AbstractRecipe<CrucibleCrafting> { //extends AbstractCrafting<CrucibleCrafting> {
// ***************************************************************************** //
// Recipe Handler CrucibleHandler
// ***************************************************************************** //
public static final String RECIPE_PREFIX = "crucible";
public static final IForgeRegistry<CrucibleCrafting> REGISTRY = ModInfo.Registries.CRUCIBLE_CRAFTING;
public static Collection<CrucibleCrafting> getRECIPES() {
return RECIPES;
}
public static final Collection<CrucibleCrafting> RECIPES = REGISTRY.getValuesCollection();
//public static ArrayList<CrucibleCrafting> getCrucibleCrafting() {
//return crucibleCrafting;
//}
//private static ArrayList<CrucibleCrafting> crucibleCrafting = new ArrayList<>();
private int cookTemp;
private int cookTime;
private int coolTime;
public Ingredient getIng0() {
return ing0;
}
public void setIng0(Ingredient ing0) {
this.ing0 = ing0;
}
public Ingredient getIng1() {
return ing1;
}
public void setIng1(Ingredient ing1) {
this.ing1 = ing1;
}
public Ingredient getIng2() {
return ing2;
}
public void setIng2(Ingredient ing2) {
this.ing2 = ing2;
}
public Ingredient getIng3() {
return ing3;
}
public void setIng3(Ingredient ing3) {
this.ing3 = ing3;
}
public Ingredient getIng4() {
return ing4;
}
public void setIng4(Ingredient ing4) {
this.ing4 = ing4;
}
private Ingredient ing0;
private Ingredient ing1;
private Ingredient ing2;
private Ingredient ing3;
private Ingredient ing4;
private ItemStack dropsCooked;
private ItemStack dropsRaw;
public List<Ingredient> getIngredientList() {
return ingredientList;
}
public void setIngredientList(List<Ingredient> ingredientList) {
this.ingredientList = ingredientList;
}
private List<Ingredient> ingredientList = new ArrayList<>();
public CrucibleCrafting(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3, Ingredient i4,
ItemStack outputRaw, ItemStack outputCooked,
Integer temp, Integer cookTime, Integer coolTime){
super();
this.ing0 = i0;
this.ing1 = i1;
this.ing2 = i2;
this.ing3 = i3;
this.ing4 = i4;
this.ingredientList.add(0, i0);
this.ingredientList.add(1, i1);
this.ingredientList.add(2, i2);
this.ingredientList.add(3, i3);
this.ingredientList.add(4, i4);
this.dropsRaw = outputRaw;
this.dropsCooked = outputCooked;
this.cookTemp = temp;
this.cookTime = cookTime;
this.coolTime = coolTime;
}
public static boolean compare(Ingredient ingredient, ItemStack stack){
if(stack == null){
stack = new ItemStack(Items.AIR, 1);
}
if(ingredient == null && stack.isEmpty()) {
return true;
}
if (ingredient.test(ItemStack.EMPTY)) {
if (stack.isEmpty()) {
return true;
}
}
if(ingredient.apply(stack)){
return true;
}
return false;
}
public static boolean isRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack i4){
for(CrucibleCrafting recipe : RECIPES){
if(i0 == null){
i0 = ItemStack.EMPTY;
}
if(i1 == null){
i1 = ItemStack.EMPTY;
}
if(i2 == null){
i2 = ItemStack.EMPTY;
}
if(i3 == null){
i3 = ItemStack.EMPTY;
}
if(i4 == null){
i4 = ItemStack.EMPTY;
}
if(compare(recipe.ing0, i0) &&
compare(recipe.ing1, i1) &&
compare(recipe.ing2, i2) &&
compare(recipe.ing3, i3) &&
compare(recipe.ing4, i4) ){
return true;
}
}
return false;
}
public static CrucibleCrafting getRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack i4){
for(CrucibleCrafting recipe : RECIPES){
if(i0 == null){
i0 = ItemStack.EMPTY;
}
if(i1 == null){
i1 = ItemStack.EMPTY;
}
if(i2 == null){
i2 = ItemStack.EMPTY;
}
if(i3 == null){
i3 = ItemStack.EMPTY;
}
if(i4 == null){
i4 = ItemStack.EMPTY;
}
if(recipe.ing0.apply(i0) && recipe.ing1.apply(i1) && recipe.ing2.apply(i2) && recipe.ing3.apply(i3) && recipe.ing4.apply(i4) ){
return recipe;
}
}
return null;
}
public static boolean isValidIngredient(ItemStack checkStack){
for(CrucibleCrafting recipe : RECIPES) {
if (recipe.ing0.apply(checkStack) ||
recipe.ing1.apply(checkStack) ||
recipe.ing2.apply(checkStack) ||
recipe.ing3.apply(checkStack) ||
recipe.ing4.apply(checkStack)) {
return true;
}
}
return false;
}
public int getCookTemp() {
return cookTemp;
}
public int getCookTime() {
return cookTime;
}
public int getCoolTime() {
return coolTime;
}
public ItemStack getDropsCooked() {
return dropsCooked;
}
public ItemStack getDropsRaw() {
return dropsRaw;
}
public Collection<CrucibleCrafting> getRecipes() {
return RECIPES;
}
public String getRecipePrefix() {
return RECIPE_PREFIX;
}
/**
* Shim for getting a recipe directly from correctly formatted name
* @param recipe_name basic recipe name, no prefix or mod id
* @return Recipe object
*/
@Nullable
public static CrucibleCrafting getRecipe(String recipe_name)
{
return REGISTRY.getValue(getFullRecipeName(RECIPE_PREFIX, recipe_name));
}
}

View File

@@ -10,10 +10,6 @@ import java.util.ArrayList;
*/ */
public class ForgeCrafting { public class ForgeCrafting {
public static ArrayList<ForgeCrafting> getForgeRecipes() {
return forgeRecipes;
}
// ***************************************************************************** // // ***************************************************************************** //
// Recipe Handler ForgeCrafting // Recipe Handler ForgeCrafting
// ***************************************************************************** // // ***************************************************************************** //
@@ -57,8 +53,7 @@ public class ForgeCrafting {
public static ForgeCrafting getRecipe(Item item) public static ForgeCrafting getRecipe(Item item)
{ {
for(ForgeCrafting recipe : forgeRecipes) { for(ForgeCrafting recipe : forgeRecipes) {
if (item.equals(recipe.input))
if (item.equals(recipe.getInput()))
return recipe; return recipe;
} }
return null; return null;

View File

@@ -1,212 +0,0 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.common.crafting.AbstractRecipe;
import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.forgecraft.ModInfo;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static nmd.primal.core.common.crafting.AbstractRecipe.getFullRecipeName;
/**
* Created by mminaie on 11/11/17.
*/
public class WorkbenchCrafting extends AbstractRecipe<WorkbenchCrafting> { //extends AbstractCrafting<CrucibleCrafting> {
// ***************************************************************************** //
// Recipe Handler CrucibleHandler
// ***************************************************************************** //
public static final String RECIPE_PREFIX = "workbench";
public static final IForgeRegistry<WorkbenchCrafting> REGISTRY = ModInfo.Registries.WORKBENCH_CRAFTING;
public static Collection<WorkbenchCrafting> getRECIPES() {
return RECIPES;
}
public static final Collection<WorkbenchCrafting> RECIPES = REGISTRY.getValuesCollection();
private Ingredient toolPart;
private Ingredient toolHead;
private Ingredient toolPin;
private Ingredient takeApart;
private ItemStack output;
private Ingredient craftingTool;
public Ingredient getTakeApart() {
return takeApart;
}
public void setTakeApart(Ingredient takeApart) {
this.takeApart = takeApart;
}
public Ingredient getToolPart() {
return toolPart;
}
public void setToolPart(Ingredient toolPart) {
this.toolPart = toolPart;
}
public Ingredient getToolHead() {
return toolHead;
}
public void setToolHead(Ingredient toolHead) {
this.toolHead = toolHead;
}
public Ingredient getToolPin() {
return toolPin;
}
public void setToolPin(Ingredient toolPin) {
this.toolPin = toolPin;
}
public ItemStack getOutput() {
return output;
}
public void setOutput(ItemStack output) {
this.output = output;
}
public List<Ingredient> getIngredientList() {
return ingredientList;
}
public void setIngredientList(List<Ingredient> ingredientList) {
this.ingredientList = ingredientList;
}
public Ingredient getCraftingTool() {
return craftingTool;
}
private List<Ingredient> ingredientList = new ArrayList<>();
public WorkbenchCrafting(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3 , Ingredient craftingTool, ItemStack output){
super();
this.toolPart = i0;
this.toolHead = i1;
this.toolPin = i2;
this.takeApart = i3;
this.output = output;
this.craftingTool = craftingTool;
}
public static boolean compare(Ingredient ingredient, ItemStack stack){
if(stack == null){
stack = new ItemStack(Items.AIR, 1);
}
if(ingredient == null && stack.isEmpty()) {
return true;
}
if (ingredient.test(ItemStack.EMPTY)) {
if (stack.isEmpty()) {
return true;
}
}
ItemStack[] testArray = ingredient.getMatchingStacks();
List<ItemStack> testList = RecipeHelper.buildList(testArray);
if(testList.contains(stack)){
return true;
}
return false;
}
public static boolean isRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack cTool){
for(WorkbenchCrafting recipe : RECIPES){
if(i0 == null){
i0 = ItemStack.EMPTY;
}
if(i1 == null){
i1 = ItemStack.EMPTY;
}
if(i2 == null){
i2 = ItemStack.EMPTY;
}
if(i3 == null){
i3 = ItemStack.EMPTY;
}
if(cTool == null){
cTool = ItemStack.EMPTY;
}
if(compare(recipe.toolPart, i0) &&
compare(recipe.toolHead, i1) &&
compare(recipe.toolPin, i2) &&
compare(recipe.takeApart, i3) &&
compare(recipe.craftingTool, cTool)){
return true;
}
}
return false;
}
public static WorkbenchCrafting getRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack cTool){
for(WorkbenchCrafting recipe : RECIPES){
if(i0 == null){
i0 = ItemStack.EMPTY;
}
if(i1 == null){
i1 = ItemStack.EMPTY;
}
if(i2 == null){
i2 = ItemStack.EMPTY;
}
if(i3 == null){
i3 = ItemStack.EMPTY;
}
if(cTool == null){
cTool = ItemStack.EMPTY;
}
if(recipe.toolPart.apply(i0) && recipe.toolHead.apply(i1) && recipe.toolPin.apply(i2) && recipe.takeApart.apply(i3) && recipe.craftingTool.apply(cTool) ){
return recipe;
}
}
return null;
}
/*public static boolean isValidIngredient(ItemStack checkStack){
for(WorkbenchCrafting recipe : RECIPES) {
if (recipe.ing0.apply(checkStack) ||
recipe.ing1.apply(checkStack) ||
recipe.ing2.apply(checkStack) ||
recipe.ing3.apply(checkStack) ||
recipe.ing4.apply(checkStack)) {
return true;
}
}
return false;
}*/
public Collection<WorkbenchCrafting> getRecipes() {
return RECIPES;
}
public String getRecipePrefix() {
return RECIPE_PREFIX;
}
/**
* Shim for getting a recipe directly from correctly formatted name
* @param recipe_name basic recipe name, no prefix or mod id
* @return Recipe object
*/
@Nullable
public static WorkbenchCrafting getRecipe(String recipe_name)
{
return REGISTRY.getValue(getFullRecipeName(RECIPE_PREFIX, recipe_name));
}
}

View File

@@ -1,413 +0,0 @@
package nmd.primal.forgecraft.crafting.registery;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreIngredient;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.init.ModItems;
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public final class RecipesCrucible {
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<CrucibleCrafting> event) {
PrimalAPI.logger(7, "Registering Recipes: " + CrucibleCrafting.RECIPE_PREFIX);
final IForgeRegistry<CrucibleCrafting> recipes = event.getRegistry();
//RecipeHandler.addSmelting(ModItems.softcrucible, new ItemStack(ModBlocks.nbtCrucible, 1));
/***********************/
/***CRUCIBLE CRAFTING***/
/***********************/
recipes.register (new CrucibleCrafting(
new OreIngredient("oreIron"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(Blocks.IRON_ORE, 1),
new ItemStack(ModItems.ironingotball, 1),
1400,
1200,
800).setRecipeName("wroughtIron1"));
recipes.register (new CrucibleCrafting(
new OreIngredient("dustIron"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(Blocks.IRON_ORE, 1),
new ItemStack(ModItems.ironingotball, 1),
1250,
1100,
800).setRecipeName("wroughtIron2"));
recipes.register (new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(ModItems.brokenwroughtirontool, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
new ItemStack(ModItems.ironingotball, 1),
1250,
1100,
800).setRecipeName("wroughtIron3"));
recipes.register (new CrucibleCrafting(
new OreIngredient("dustIron"),
new OreIngredient("slackLime"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.IRON_DUST, 1),
new ItemStack(ModItems.ironcleaningotball, 1),
1550,
1200,
800).setRecipeName("cleanIron1"));
recipes.register (new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(ModItems.brokencleanirontool, 1)),
new OreIngredient("nuggetIron"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
new ItemStack(ModItems.ironcleaningotball, 1),
1550,
1200,
800).setRecipeName("cleanIron2"));
recipes.register (new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(ModItems.ironcleaningotball, 1)),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_HIGH, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(ModItems.ironcleaningotball, 1),
new ItemStack(ModItems.steelingotball, 1),
2100,
1500,
1000).setRecipeName("steel1"));
recipes.register (new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(ModItems.brokensteeltool, 1)),
new OreIngredient("nuggetSteel"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
new ItemStack(ModItems.steelingotball, 1),
2100,
1500,
1000).setRecipeName("steel2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("oreClusterMagnetite"),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_PURE, 1)),
new OreIngredient("oreClusterMagnetite"),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_PURE, 1)),
new OreIngredient("specialCarbon"),
new ItemStack(PrimalAPI.Items.ORE_CLUSTER_MAGNETITE, 1),
new ItemStack(ModItems.wootzingotball, 1),
2100,
1800,
1500).setRecipeName("wootz2"));
recipes.register (new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(ModItems.brokenwootztool, 1)),
new OreIngredient("nuggetWootz"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
new ItemStack(ModItems.wootzingotball, 1),
2100,
1800,
1500).setRecipeName("wootz3"));
/***BRONZE***/
NBTTagCompound tagBronzeDefault = new NBTTagCompound();
tagBronzeDefault.setString("upgrades", "");
tagBronzeDefault.setBoolean("hot", false);
ItemStack defaultBronze = new ItemStack(ModItems.bronzeingotball, 1);
defaultBronze.setTagCompound(tagBronzeDefault.copy());
recipes.register (new CrucibleCrafting(
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustTin"),
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
defaultBronze,
1100,
800,
600).setRecipeName("bronze1"));
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotBronze"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
defaultBronze,
1100,
800,
600).setRecipeName("bronze2"));
ItemStack redBronze = defaultBronze.copy();
redBronze.getTagCompound().setString("upgrades", "redstone");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("dustRedstone"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
redBronze,
1100,
800,
600).setRecipeName("redBronze1"));
ItemStack diamondBronze = defaultBronze.copy();
diamondBronze.getTagCompound().setString("upgrades", "diamond");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("flakeDiamond"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
diamondBronze,
1100,
800,
600).setRecipeName("diamondBronze1"));
ItemStack emeraldBronze = defaultBronze.copy();
emeraldBronze.getTagCompound().setString("upgrades", "emerald");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("flakeEmerald"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
emeraldBronze,
1100,
800,
600).setRecipeName("emeraldBronze1"));
ItemStack lapisBronze = defaultBronze.copy();
lapisBronze.getTagCompound().setString("upgrades", "lapis");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("gemLapis"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
lapisBronze,
1100,
800,
600).setRecipeName("lapisBronze1"));
recipes.register (new CrucibleCrafting(
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustTin"),
new OreIngredient("dustRedstone"),
new ItemStack(PrimalAPI.Items.SLAG, 1),
redBronze,
1100,
800,
600).setRecipeName("redBronze2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustTin"),
new OreIngredient("flakeDiamond"),
new ItemStack(PrimalAPI.Items.SLAG, 1),
diamondBronze,
1100,
800,
600).setRecipeName("diamondBronze2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustTin"),
new OreIngredient("flakeEmerald"),
new ItemStack(PrimalAPI.Items.SLAG, 1),
emeraldBronze,
1100,
800,
600).setRecipeName("emeraldBronze2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustTin"),
new OreIngredient("gemLapis"),
new ItemStack(PrimalAPI.Items.SLAG, 1),
lapisBronze,
1100,
800,
600).setRecipeName("lapisBronze2"));
/***COPPER***/
NBTTagCompound tagCopperDefault = new NBTTagCompound();
tagCopperDefault.setString("upgrades", "");
tagCopperDefault.setBoolean("hot", false);
ItemStack defaultCopper = new ItemStack(PrimalAPI.Items.COPPER_INGOT, 1);
defaultCopper.setTagCompound(tagCopperDefault.copy());
recipes.register (new CrucibleCrafting(
new OreIngredient("oreCopper"),
new OreIngredient("slackLime"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
defaultCopper,
900,
800,
600).setRecipeName("copper1"));
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotCopper"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
defaultCopper,
900,
750,
550).setRecipeName("copper2"));
ItemStack redCopper = defaultCopper.copy();
redCopper.getTagCompound().setString("upgrades", "redstone");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotCopper"),
new OreIngredient("dustRedstone"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
redCopper,
900,
750,
550).setRecipeName("redCopper1"));
ItemStack diamondCopper = defaultCopper.copy();
diamondCopper.getTagCompound().setString("upgrades", "diamond");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotCopper"),
new OreIngredient("flakeDiamond"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
diamondCopper,
900,
750,
550).setRecipeName("diamondCopper1"));
ItemStack emeraldCopper = defaultCopper.copy();
emeraldCopper.getTagCompound().setString("upgrades", "emerald");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotCopper"),
new OreIngredient("flakeEmerald"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
emeraldCopper,
900,
750,
550).setRecipeName("emeraldCopper1"));
ItemStack lapisCopper = defaultCopper.copy();
lapisCopper.getTagCompound().setString("upgrades", "lapis");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotCopper"),
new OreIngredient("gemLapis"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
lapisCopper,
900,
750,
550).setRecipeName("lapisCopper1"));
recipes.register (new CrucibleCrafting(
new OreIngredient("oreCopper"),
new OreIngredient("slackLime"),
new OreIngredient("dustRedstone"),
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
redCopper,
900,
750,
550).setRecipeName("redCopper2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("oreCopper"),
new OreIngredient("slackLime"),
new OreIngredient("flakeDiamond"),
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
diamondCopper,
900,
750,
550).setRecipeName("diamondCopper2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("oreCopper"),
new OreIngredient("slackLime"),
new OreIngredient("flakeEmerald"),
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
emeraldCopper,
900,
750,
550).setRecipeName("emeraldCopper2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("oreCopper"),
new OreIngredient("slackLime"),
new OreIngredient("gemLapis"),
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
lapisCopper,
900,
750,
550).setRecipeName("lapisCopper2"));
}
}

View File

@@ -1,638 +0,0 @@
package nmd.primal.forgecraft.crafting.registery;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.OreIngredient;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
import nmd.primal.forgecraft.init.ModItems;
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public final class RecipesWorkbench {
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<WorkbenchCrafting> event) {
PrimalAPI.logger(7, "Registering Recipes: " + WorkbenchCrafting.RECIPE_PREFIX);
final IForgeRegistry<WorkbenchCrafting> recipes = event.getRegistry();
/***COPPER***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.copperaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.copperaxe, 1)).setRecipeName("copperaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.copperaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.copperaxehead, 1)).setRecipeName("copperaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.copperhoehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.copperhoe, 1)).setRecipeName("copperhoe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.copperhoe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.copperhoehead, 1)).setRecipeName("copperhoesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.copperpickaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.copperpickaxe, 1)).setRecipeName("copperpickaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.copperpickaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.copperpickaxehead, 1)).setRecipeName("copperpickaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.coppershovelhead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.coppershovel, 1)).setRecipeName("coppershovel"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.coppershovel, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.coppershovelhead, 1)).setRecipeName("coppershovelsplit"));
/***BRONZE***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.bronzeaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzeaxe, 1)).setRecipeName("bronzeaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.bronzeaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzeaxehead, 1)).setRecipeName("bronzeaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.bronzehoehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzehoe, 1)).setRecipeName("bronzehoe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.bronzehoe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzehoehead, 1)).setRecipeName("bronzehoesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.bronzepickaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzepickaxe, 1)).setRecipeName("bronzepickaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.bronzepickaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzepickaxehead, 1)).setRecipeName("bronzepickaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.bronzeshovelhead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzeshovel, 1)).setRecipeName("bronzeshovel"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.bronzeshovel, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzeshovelhead, 1)).setRecipeName("bronzeshovelsplit"));
/***iron***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.ironaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironaxe, 1)).setRecipeName("ironaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.ironaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironaxehead, 1)).setRecipeName("ironaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.ironhoehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironhoe, 1)).setRecipeName("ironhoe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.ironhoe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironhoehead, 1)).setRecipeName("ironhoesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.pickaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironpickaxe, 1)).setRecipeName("ironpickaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.ironpickaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.pickaxehead, 1)).setRecipeName("ironpickaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.ironshovelhead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironshovel, 1)).setRecipeName("ironshovel"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.ironshovel, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironshovelhead, 1)).setRecipeName("ironshovelsplit"));
/***cleaniron***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.cleanironaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironaxe, 1)).setRecipeName("cleanironaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanironaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironaxehead, 1)).setRecipeName("cleanironaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.cleanironhoehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironhoe, 1)).setRecipeName("cleanironhoe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanironhoe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironhoehead, 1)).setRecipeName("cleanironhoesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.cleanironpickaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironpickaxe, 1)).setRecipeName("cleanironpickaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanironpickaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironpickaxehead, 1)).setRecipeName("cleanironpickaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.cleanironshovelhead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironshovel, 1)).setRecipeName("cleanironshovel"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanironshovel, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironshovelhead, 1)).setRecipeName("cleanironshovelsplit"));
/***steel***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.steelaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelaxe, 1)).setRecipeName("steelaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steelaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelaxehead, 1)).setRecipeName("steelaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.steelhoehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelhoe, 1)).setRecipeName("steelhoe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steelhoe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelhoehead, 1)).setRecipeName("steelhoesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.steelpickaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelpickaxe, 1)).setRecipeName("steelpickaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steelpickaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelpickaxehead, 1)).setRecipeName("steelpickaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.steelshovelhead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelshovel, 1)).setRecipeName("steelshovel"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steelshovel, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelshovelhead, 1)).setRecipeName("steelshovelsplit"));
/***wootz***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.wootzaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzaxe, 1)).setRecipeName("wootzaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzaxehead, 1)).setRecipeName("wootzaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.wootzhoehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzhoe, 1)).setRecipeName("wootzhoe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzhoe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzhoehead, 1)).setRecipeName("wootzhoesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.wootzpickaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzpickaxe, 1)).setRecipeName("wootzpickaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzpickaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzpickaxehead, 1)).setRecipeName("wootzpickaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.wootzshovelhead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzshovel, 1)).setRecipeName("wootzshovel"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzshovel, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzshovelhead, 1)).setRecipeName("wootzshovelsplit"));
/*********WEAPONS********/
/***GLADIUS***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawcoppergladius, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.coppergladius, 1)).setRecipeName("coppergladius"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.coppergladius, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawcoppergladius, 1)).setRecipeName("rawcoppergladius"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawbronzegladius, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.bronzegladius, 1)).setRecipeName("bronzegladius"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.bronzegladius, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawbronzegladius, 1)).setRecipeName("rawbronzegladius"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawwroughtirongladius, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.wroughtirongladius, 1)).setRecipeName("wroughtirongladius"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wroughtirongladius, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawwroughtirongladius, 1)).setRecipeName("rawwroughtirongladius"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawcleanirongladius, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.cleanirongladius, 1)).setRecipeName("cleanirongladius"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanirongladius, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawcleanirongladius, 1)).setRecipeName("rawcleanirongladius"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawsteelgladius, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.steelgladius, 1)).setRecipeName("steelgladius"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steelgladius, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawsteelgladius, 1)).setRecipeName("rawsteelgladius"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawwootzgladius, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.wootzgladius, 1)).setRecipeName("wootzgladius"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzgladius, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawwootzgladius, 1)).setRecipeName("rawwootzgladius"));
/***LONGSWORD***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawcleanironlongsword, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.cleanironlongsword, 1)).setRecipeName("cleanironlongsword"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanironlongsword, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawcleanironlongsword, 1)).setRecipeName("rawcleanironlongsword"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawsteellongsword, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.steellongsword, 1)).setRecipeName("steellongsword"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steellongsword, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawsteellongsword, 1)).setRecipeName("rawsteellongsword"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawwootzlongsword, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.wootzlongsword, 1)).setRecipeName("wootzlongsword"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzlongsword, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawwootzlongsword, 1)).setRecipeName("rawwootzlongsword"));
/***SLAYER***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawironslayer, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.wroughtironslayer, 1)).setRecipeName("ironslayer"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wroughtironslayer, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawironslayer, 1)).setRecipeName("rawironslayer"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawcleanironslayer, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.cleanironslayer, 1)).setRecipeName("cleanironslayer"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanironslayer, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawcleanironslayer, 1)).setRecipeName("rawcleanironslayer"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawsteelslayer, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.steelslayer, 1)).setRecipeName("steelslayer"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steelslayer, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawsteelslayer, 1)).setRecipeName("rawsteelslayer"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawwootzslayer, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.wootzslayer, 1)).setRecipeName("wootzslayer"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzslayer, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawwootzslayer, 1)).setRecipeName("rawwootzslayer"));
}
}

View File

@@ -2,40 +2,44 @@ package nmd.primal.forgecraft.init;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI; import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.blocks.AnvilStone; import nmd.primal.forgecraft.blocks.Anvil.AnvilBase;
import nmd.primal.forgecraft.blocks.Chisel; import nmd.primal.forgecraft.blocks.Anvil.AnvilIron;
import nmd.primal.forgecraft.blocks.NBTCrucible; import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
import nmd.primal.forgecraft.blocks.YewStave; import nmd.primal.forgecraft.blocks.*;
import nmd.primal.forgecraft.blocks.machine.*; import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
import nmd.primal.forgecraft.blocks.Crucibles.CrucibleHot;
import nmd.primal.forgecraft.items.ForgeHammer;
import nmd.primal.forgecraft.tiles.TileAnvil;
/** /**
* Created by kitsu on 11/26/2016. * Created by kitsu on 11/26/2016.
*/ */
public class ModBlocks { public class ModBlocks {
public static Block nbtCrucible;
public static Block forge_brick; public static Block forge_brick;
public static Block forge_adobe; public static Block forge_adobe;
public static Block bloomery_brick; public static Block bloomery_brick;
public static Block bloomery_adobe; public static Block bloomery_adobe;
public static Block blockbreaker; public static Block blockbreaker;
public static Block castingform; public static Block castingform;
public static Block castingblock;
public static Block bronzechisel;
public static Block copperchisel;
public static Block ironchisel;
public static Block cleanironchisel;
public static Block steelchisel;
public static Block wootzchisel;
public static Block pistonbellowsoak; public static Block pistonbellowsoak;
public static Block pistonbellowsjungle; public static Block pistonbellowsjungle;
@@ -44,30 +48,83 @@ public class ModBlocks {
public static Block pistonbellowsdarkoak; public static Block pistonbellowsdarkoak;
public static Block pistonbellowsacacia; public static Block pistonbellowsacacia;
public static Block emptycrucible;
public static Block emptycruciblehot;
public static Block emptycruciblecracked;
public static Block emptycruciblecrackedhot;
public static Block rawbronzecrucible;
public static Block hotbronzecrucible;
public static Block hotcookedbronzecrucible;
public static Block rawbronzecrucible_redstone;
public static Block hotbronzecrucible_redstone;
public static Block hotcookedbronzecrucible_redstone;
public static Block rawbronzecrucible_lapis;
public static Block hotbronzecrucible_lapis;
public static Block hotcookedbronzecrucible_lapis;
public static Block rawbronzecrucible_diamond;
public static Block hotbronzecrucible_diamond;
public static Block hotcookedbronzecrucible_diamond;
public static Block rawbronzecrucible_emerald;
public static Block hotbronzecrucible_emerald;
public static Block hotcookedbronzecrucible_emerald;
public static Block rawironcrucible;
public static Block hotironcrucible;
public static Block hotcookedironcrucible;
public static Block coolironcrucible;
public static Block failedironcrucible;
public static Block failedironcruciblehot;
public static Block rawcleanironcrucible;
public static Block hotcleanironcrucible;
public static Block hotcookedcleanironcrucible;
public static Block coolcleanironcrucible;
public static Block failedcleanironcrucible;
public static Block failedcleanironcruciblehot;
public static Block rawsteelcrucible;
public static Block hotsteelcrucible;
public static Block hotcookedsteelcrucible;
public static Block coolsteelcrucible;
public static Block failedsteelcrucible;
public static Block failedsteelcruciblehot;
public static Block rawwootzcrucible;
public static Block hotwootzcrucible;
public static Block hotcookedwootzcrucible;
public static Block coolwootzcrucible;
public static Block failedwootzcrucible;
public static Block failedwootzcruciblehot;
public static Block ironball;
public static Block ironchunk;
public static Block ironcleanball;
public static Block ironcleanchunk;
public static Block steelball;
public static Block steelchunk;
public static Block wootzball;
public static Block wootzchunk;
public static Block stoneanvil; public static Block stoneanvil;
public static Block ironanvil; public static Block ironanvil;
public static Block workbench;
public static Block sharpbench;
public static Block yewstave; public static Block yewstave;
public static void init() { public static void init() {
nbtCrucible = new NBTCrucible(Material.ROCK, "nbtcrucible");
forge_brick = new Forge(Material.ROCK, "forge_brick", 5000); forge_brick = new Forge(Material.ROCK, "forge_brick", 5000);
forge_adobe = new Forge(Material.ROCK, "forge_adobe", 5000); forge_adobe = new Forge(Material.ROCK, "forge_adobe", 5000);
bloomery_brick = new BloomeryBase(Material.ROCK, "bloomery_brick", 5000); bloomery_brick = new BloomeryBase(Material.ROCK, "bloomery_brick", 5000);
bloomery_adobe = new BloomeryBase(Material.ROCK, "bloomery_adobe", 5000); bloomery_adobe = new BloomeryBase(Material.ROCK, "bloomery_adobe", 5000);
blockbreaker = new Breaker(Material.WOOD, "blockbreaker", 4.0f); blockbreaker = new Breaker(Material.WOOD, "blockbreaker", 4.0f);
castingform = new CastingForm(Material.WOOD, "castingform"); castingform = new CastingForm(Material.WOOD, "castingform");
castingblock = new CastingBlock(Material.ROCK, "castingblock");
copperchisel = new Chisel(Material.IRON, "copperchisel", PrimalAPI.ToolMaterials.TOOL_COPPER);
bronzechisel = new Chisel(Material.IRON, "bronzechisel", PrimalAPI.ToolMaterials.TOOL_BRONZE);
ironchisel = new Chisel(Material.IRON, "ironchisel", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
cleanironchisel = new Chisel(Material.IRON, "cleanironchisel", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON);
steelchisel = new Chisel(Material.IRON, "steelchisel", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL);
wootzchisel = new Chisel(Material.IRON, "wootzchisel", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL);
pistonbellowsoak = new PistonBellows(Material.WOOD, "pistonbellowsoak"); pistonbellowsoak = new PistonBellows(Material.WOOD, "pistonbellowsoak");
pistonbellowsjungle = new PistonBellows(Material.WOOD, "pistonbellowsjungle"); pistonbellowsjungle = new PistonBellows(Material.WOOD, "pistonbellowsjungle");
@@ -76,62 +133,386 @@ public class ModBlocks {
pistonbellowsdarkoak = new PistonBellows(Material.WOOD, "pistonbellowsdarkoak"); pistonbellowsdarkoak = new PistonBellows(Material.WOOD, "pistonbellowsdarkoak");
pistonbellowsacacia = new PistonBellows(Material.WOOD, "pistonbellowsacacia"); pistonbellowsacacia = new PistonBellows(Material.WOOD, "pistonbellowsacacia");
emptycrucible = new Crucible(Material.ROCK, "emptycrucible");
emptycruciblehot = new CrucibleHot(Material.ROCK, "emptycruciblehot");
emptycruciblecracked = new Crucible(Material.ROCK, "emptycruciblecracked");
emptycruciblecrackedhot = new CrucibleHot(Material.ROCK, "emptycruciblecrackedhot");
rawbronzecrucible = new Crucible(Material.ROCK, "rawbronzecrucible");
hotbronzecrucible = new CrucibleHot(Material.ROCK, "hotbronzecrucible");
hotcookedbronzecrucible = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible");
rawbronzecrucible_redstone = new Crucible(Material.ROCK, "rawbronzecrucible_redstone");
hotbronzecrucible_redstone = new CrucibleHot(Material.ROCK, "hotbronzecrucible_redstone");
hotcookedbronzecrucible_redstone = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_redstone");
rawbronzecrucible_diamond = new Crucible(Material.ROCK, "rawbronzecrucible_diamond");
hotbronzecrucible_diamond = new CrucibleHot(Material.ROCK, "hotbronzecrucible_diamond");
hotcookedbronzecrucible_diamond = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_diamond");
rawbronzecrucible_lapis = new Crucible(Material.ROCK, "rawbronzecrucible_lapis");
hotbronzecrucible_lapis = new CrucibleHot(Material.ROCK, "hotbronzecrucible_lapis");
hotcookedbronzecrucible_lapis = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_lapis");
rawbronzecrucible_emerald = new Crucible(Material.ROCK, "rawbronzecrucible_emerald");
hotbronzecrucible_emerald = new CrucibleHot(Material.ROCK, "hotbronzecrucible_emerald");
hotcookedbronzecrucible_emerald = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_emerald");
rawironcrucible = new Crucible(Material.ROCK, "rawironcrucible");
hotironcrucible = new CrucibleHot(Material.ROCK, "hotironcrucible");
hotcookedironcrucible = new CrucibleHot(Material.ROCK, "hotcookedironcrucible");
coolironcrucible = new Crucible(Material.ROCK, "coolironcrucible");
failedironcrucible = new Crucible(Material.ROCK, "failedironcrucible");
failedironcruciblehot = new CrucibleHot(Material.ROCK, "failedironcruciblehot");
rawcleanironcrucible = new Crucible(Material.ROCK, "rawcleanironcrucible");
hotcleanironcrucible = new CrucibleHot(Material.ROCK, "hotcleanironcrucible");
hotcookedcleanironcrucible = new CrucibleHot(Material.ROCK, "hotcookedcleanironcrucible");
coolcleanironcrucible = new Crucible(Material.ROCK, "coolcleanironcrucible");
failedcleanironcrucible = new Crucible(Material.ROCK, "failedcleanironcrucible");
failedcleanironcruciblehot = new Crucible(Material.ROCK, "failedcleanironcruciblehot");
rawsteelcrucible = new Crucible(Material.ROCK, "rawsteelcrucible");
hotsteelcrucible = new CrucibleHot(Material.ROCK, "hotsteelcrucible");
hotcookedsteelcrucible = new CrucibleHot(Material.ROCK, "hotcookedsteelcrucible");
coolsteelcrucible = new Crucible(Material.ROCK, "coolsteelcrucible");
failedsteelcrucible = new Crucible(Material.ROCK, "failedsteelcrucible");
failedsteelcruciblehot = new Crucible(Material.ROCK, "failedsteelcruciblehot");
rawwootzcrucible = new Crucible(Material.ROCK, "rawwootzcrucible");
hotwootzcrucible = new CrucibleHot(Material.ROCK, "hotwootzcrucible");
hotcookedwootzcrucible = new CrucibleHot(Material.ROCK, "hotcookedwootzcrucible");
coolwootzcrucible = new Crucible(Material.ROCK, "coolwootzcrucible");
failedwootzcrucible = new Crucible(Material.ROCK, "failedwootzcrucible");
failedwootzcruciblehot = new Crucible(Material.ROCK, "failedwootzcruciblehot");
ironball = new IngotBall(Material.IRON, "ironball", 5.0F, "ingot") {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
{
if(!world.isRemote){
Item pItem = player.getHeldItem(hand).getItem();
BlockPos belowPos = pos.down();
//System.out.println("Activating");
if (pItem instanceof WorkMallet && world.getBlockState(belowPos).getBlock().equals(Blocks.STONE)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.stoneanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}
/*if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}*/
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
if (tile.getSlotStack(6).isEmpty() &&
tile.getSlotStack(7).isEmpty() &&
tile.getSlotStack(8).isEmpty() &&
tile.getSlotStack(11).isEmpty() &&
tile.getSlotStack(12).isEmpty() &&
tile.getSlotStack(13).isEmpty() &&
tile.getSlotStack(16).isEmpty() &&
tile.getSlotStack(17).isEmpty() &&
tile.getSlotStack(18).isEmpty()
) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(7, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(8, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(11, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(12, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(13, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(16, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(17, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(18, new ItemStack(ModItems.ironchunkhot, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
};
ironcleanball = new IngotBall(Material.IRON, "ironcleanball", 5.0f, "ingot") {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
{
//System.out.println("Level 0");
if(!world.isRemote){
Item pItem = player.getHeldItem(hand).getItem();
BlockPos belowPos = pos.down();
//System.out.println("Activating1");
if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//System.out.println("Activating");
return true;
}
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
if (tile.getSlotStack(6).isEmpty() &&
tile.getSlotStack(7).isEmpty() &&
tile.getSlotStack(8).isEmpty() &&
tile.getSlotStack(11).isEmpty() &&
tile.getSlotStack(12).isEmpty() &&
tile.getSlotStack(13).isEmpty() &&
tile.getSlotStack(16).isEmpty() &&
tile.getSlotStack(17).isEmpty() &&
tile.getSlotStack(18).isEmpty()
) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(7, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(8, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(11, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(12, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(13, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(16, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(17, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(18, new ItemStack(ModItems.ironcleanchunkhot, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
}; // clean_iron_ingot ironcleanball.json ironcleanballhot.json - done
steelball = new IngotBall(Material.IRON, "steelball", 6.0f, "ingot"){
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
{
if(!world.isRemote){
Item pItem = player.getHeldItem(hand).getItem();
BlockPos belowPos = pos.down();
//System.out.println("Activating");
if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
if (tile.getSlotStack(6).isEmpty() &&
tile.getSlotStack(7).isEmpty() &&
tile.getSlotStack(8).isEmpty() &&
tile.getSlotStack(11).isEmpty() &&
tile.getSlotStack(12).isEmpty() &&
tile.getSlotStack(13).isEmpty() &&
tile.getSlotStack(16).isEmpty() &&
tile.getSlotStack(17).isEmpty() &&
tile.getSlotStack(18).isEmpty()
) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(7, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(8, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(11, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(12, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(13, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(16, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(17, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(18, new ItemStack(ModItems.steelchunkhot, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
}; // steel_ingot steelball.json steelballhot.json
wootzball = new IngotBall(Material.IRON, "wootzball", 6.0f, "ingot") {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
{
if(!world.isRemote){
Item pItem = player.getHeldItem(hand).getItem();
BlockPos belowPos = pos.down();
//System.out.println("Activating");
if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
if (tile.getSlotStack(6).isEmpty() &&
tile.getSlotStack(7).isEmpty() &&
tile.getSlotStack(8).isEmpty() &&
tile.getSlotStack(11).isEmpty() &&
tile.getSlotStack(12).isEmpty() &&
tile.getSlotStack(13).isEmpty() &&
tile.getSlotStack(16).isEmpty() &&
tile.getSlotStack(17).isEmpty() &&
tile.getSlotStack(18).isEmpty()
) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(7, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(8, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(11, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(12, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(13, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(16, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(17, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(18, new ItemStack(ModItems.wootzchunkhot, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
}; //wootz_ingot wootzball.json wootzballhot.json
ironchunk = new IngotBall(Material.IRON, "ironchunk", 5.0F, "chunk");
ironcleanchunk = new IngotBall(Material.IRON, "ironcleanchunk", 5.0F, "chunk"); //Lyle to make assets clean_iron_ingot, blockstate\ironcleanchunk.json, item\ironcleanchunk.json, item\ironcleanchunkhot.json - done
steelchunk = new IngotBall(Material.IRON, "steelchunk", 6.0f, "chunk"); //steel_ingot steelchunk.json steelchunkhot.json - done
wootzchunk = new IngotBall(Material.IRON, "wootzchunk", 6.0f, "chunk"); //wootz_ingot wootzchunk.json wootzchunkhot.json - done
stoneanvil = new AnvilStone(Material.ANVIL, "stoneanvil", 5.0f, true); stoneanvil = new AnvilStone(Material.ANVIL, "stoneanvil", 5.0f, true);
//ironanvil = new AnvilIron(Material.ANVIL, "ironanvil", 6.0f, true); ironanvil = new AnvilIron(Material.ANVIL, "ironanvil", 6.0f, true);
//ironballitemcool = new ItemBlockIngotBall(ironball);
workbench = new Workbench(Material.WOOD, "toolbench"); //ironballitemhot = new ItemBlockIngotBall(ironball);
sharpbench = new SharpBench(Material.WOOD, "sharpbench");
yewstave = new YewStave(Material.WOOD, "yewstave", 3.0F); yewstave = new YewStave(Material.WOOD, "yewstave", 3.0F);
} }
public static void register() { public static void register() {
registerBlock(nbtCrucible); registerBlock(forge_brick);
registerBlockWithItem(forge_brick); registerBlock(forge_adobe);
registerBlockWithItem(forge_adobe); registerBlock(bloomery_brick);
registerBlockWithItem(bloomery_brick); registerBlock(bloomery_adobe);
registerBlockWithItem(bloomery_adobe); registerBlock(blockbreaker);
registerBlockWithItem(blockbreaker); registerBlock(castingform);
registerBlockWithItem(castingform); registerBlock(castingblock);
registerBlockWithItem(copperchisel); registerBlock(pistonbellowsoak);
registerBlockWithItem(bronzechisel); registerBlock(pistonbellowsjungle);
registerBlockWithItem(ironchisel); registerBlock(pistonbellowsbirch);
registerBlockWithItem(cleanironchisel); registerBlock(pistonbellowsspruce);
registerBlockWithItem(steelchisel); registerBlock(pistonbellowsdarkoak);
registerBlockWithItem(wootzchisel); registerBlock(pistonbellowsacacia);
registerBlockWithItem(pistonbellowsoak); registerBlock(emptycrucible);
registerBlockWithItem(pistonbellowsjungle); registerBlock(emptycruciblehot);
registerBlockWithItem(pistonbellowsbirch); registerBlock(emptycruciblecracked);
registerBlockWithItem(pistonbellowsspruce); registerBlock(emptycruciblecrackedhot);
registerBlockWithItem(pistonbellowsdarkoak);
registerBlockWithItem(pistonbellowsacacia);
registerBlockWithItem(stoneanvil); registerBlock(rawbronzecrucible);
//registerBlockWithItem(ironanvil); registerBlock(hotbronzecrucible);
registerBlock(hotcookedbronzecrucible);
registerBlockWithItem(workbench); registerBlock(rawbronzecrucible_diamond);
registerBlockWithItem(sharpbench); registerBlock(hotbronzecrucible_diamond);
registerBlock(hotcookedbronzecrucible_diamond);
registerBlockWithItem(yewstave); registerBlock(rawbronzecrucible_emerald);
registerBlock(hotbronzecrucible_emerald);
registerBlock(hotcookedbronzecrucible_emerald);
registerBlock(rawbronzecrucible_redstone);
registerBlock(hotbronzecrucible_redstone);
registerBlock(hotcookedbronzecrucible_redstone);
registerBlock(rawbronzecrucible_lapis);
registerBlock(hotbronzecrucible_lapis);
registerBlock(hotcookedbronzecrucible_lapis);
registerBlock(rawironcrucible);
registerBlock(hotironcrucible);
registerBlock(hotcookedironcrucible);
registerBlock(coolironcrucible);
registerBlock(failedironcrucible);
registerBlock(failedironcruciblehot);
registerBlock(rawcleanironcrucible);
registerBlock(hotcleanironcrucible);
registerBlock(hotcookedcleanironcrucible);
registerBlock(coolcleanironcrucible);
registerBlock(failedcleanironcrucible);
registerBlock(failedcleanironcruciblehot);
registerBlock(rawsteelcrucible);
registerBlock(hotsteelcrucible);
registerBlock(hotcookedsteelcrucible);
registerBlock(coolsteelcrucible);
registerBlock(failedsteelcrucible);
registerBlock(failedsteelcruciblehot);
registerBlock(rawwootzcrucible);
registerBlock(hotwootzcrucible);
registerBlock(hotcookedwootzcrucible);
registerBlock(coolwootzcrucible);
registerBlock(failedwootzcrucible);
registerBlock(failedwootzcruciblehot);
registerBlock(ironball);
registerBlock(ironchunk);
registerBlock(ironcleanball);
registerBlock(ironcleanchunk);
registerBlock(steelball);
registerBlock(steelchunk);
registerBlock(wootzball);
registerBlock(wootzchunk);
//registerBlockSubType(ironball, ironballitemcool, "ironcool");
//registerBlockSubType(ironball, ironballitemhot, "ironhot");
registerBlock(stoneanvil);
registerBlock(ironanvil);
registerBlock(yewstave);
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public static void registerRenders() { public static void registerRenders() {
//registerRender(nbtCrucible);
registerRender(forge_brick); registerRender(forge_brick);
registerRender(forge_adobe); registerRender(forge_adobe);
registerRender(castingform); registerRender(castingform);
registerRender(castingblock);
registerRender(copperchisel);
registerRender(bronzechisel);
registerRender(ironchisel);
registerRender(cleanironchisel);
registerRender(steelchisel);
registerRender(wootzchisel);
registerRender(blockbreaker); registerRender(blockbreaker);
registerRender(pistonbellowsoak); registerRender(pistonbellowsoak);
@@ -144,57 +525,99 @@ public class ModBlocks {
registerRender(bloomery_brick); registerRender(bloomery_brick);
registerRender(bloomery_adobe); registerRender(bloomery_adobe);
registerRender(emptycrucible);
registerRender(emptycruciblehot);
registerRender(emptycruciblecracked);
registerRender(emptycruciblecrackedhot);
registerRender(rawbronzecrucible);
registerRender(hotbronzecrucible);
registerRender(hotcookedbronzecrucible);
registerRender(rawbronzecrucible_diamond);
registerRender(hotbronzecrucible_diamond);
registerRender(hotcookedbronzecrucible_diamond);
registerRender(rawbronzecrucible_emerald);
registerRender(hotbronzecrucible_emerald);
registerRender(hotcookedbronzecrucible_emerald);
registerRender(rawbronzecrucible_redstone);
registerRender(hotbronzecrucible_redstone);
registerRender(hotcookedbronzecrucible_redstone);
registerRender(rawbronzecrucible_lapis);
registerRender(hotbronzecrucible_lapis);
registerRender(hotcookedbronzecrucible_lapis);
registerRender(rawironcrucible);
registerRender(hotironcrucible);
registerRender(hotcookedironcrucible);
registerRender(coolironcrucible);
registerRender(failedironcrucible);
registerRender(failedironcruciblehot);
registerRender(rawcleanironcrucible);
registerRender(hotcleanironcrucible);
registerRender(hotcookedcleanironcrucible);
registerRender(coolcleanironcrucible);
registerRender(failedcleanironcrucible);
registerRender(failedcleanironcruciblehot);
registerRender(rawsteelcrucible);
registerRender(hotsteelcrucible);
registerRender(hotcookedsteelcrucible);
registerRender(coolsteelcrucible);
registerRender(failedsteelcrucible);
registerRender(failedsteelcruciblehot);
registerRender(rawwootzcrucible);
registerRender(hotwootzcrucible);
registerRender(hotcookedwootzcrucible);
registerRender(coolwootzcrucible);
registerRender(failedwootzcrucible);
registerRender(failedwootzcruciblehot);
registerRender(ironball);
registerRender(ironchunk);
registerRender(ironcleanball);
registerRender(ironcleanchunk);
registerRender(steelball);
registerRender(steelchunk);
registerRender(wootzball);
registerRender(wootzchunk);
//registerRenderCustom(ironballitemcool, 0, new ModelResourceLocation(ironballitemcool.getUnlocalizedName()));
//registerRenderCustom(ironballitemhot, 1, new ModelResourceLocation(ironballitemhot.getUnlocalizedName()));
registerRender(stoneanvil); registerRender(stoneanvil);
//registerRender(ironanvil); registerRender(ironanvil);
registerRender(workbench);
registerRender(sharpbench);
registerRender(yewstave); registerRender(yewstave);
} }
private static void registerBlockWithItem(Block block) private static void registerBlock(Block block) {
{ GameRegistry.register(block);
ForgeRegistries.BLOCKS.register(block);
//GameRegistry.register(block);
ItemBlock item = new ItemBlock(block); ItemBlock item = new ItemBlock(block);
item.setRegistryName(block.getRegistryName()); item.setRegistryName(block.getRegistryName());
GameRegistry.register(item);
ForgeRegistries.ITEMS.register(item);
//GameRegistry.register(item);
} }
private static void registerBlock(Block block) private static void registerBlockSubType(Block block, ItemBlock itemBlock, String registryName){
{ GameRegistry.register(block);
ForgeRegistries.BLOCKS.register(block); ItemBlock item = itemBlock;
//GameRegistry.register(block);
//ItemBlock item = new ItemBlock(block);
//item.setRegistryName(block.getRegistryName());
//ForgeRegistries.ITEMS.register(item);
//GameRegistry.register(item);
}
private static void registerBlockSubType(Block block, ItemBlock item, String registryName)
{
ForgeRegistries.BLOCKS.register(block);
//GameRegistry.register(block);
item.setRegistryName(registryName); item.setRegistryName(registryName);
GameRegistry.register(item);
ForgeRegistries.ITEMS.register(item);
//GameRegistry.register(item);
} }
private static void registerRender(Block block) private static void registerRender(Block block) {
{
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
} }
private static void registerRenderCustom(ItemBlock item, Integer meta, ModelResourceLocation model) private static void registerRenderCustom(ItemBlock item, Integer meta, ModelResourceLocation model){
{
ModelLoader.setCustomModelResourceLocation(item, meta, model); ModelLoader.setCustomModelResourceLocation(item, meta, model);
} }

View File

@@ -1,72 +1,47 @@
package nmd.primal.forgecraft.init; package nmd.primal.forgecraft.init;
import net.minecraftforge.common.config.Config; import net.minecraftforge.common.config.Config;
import nmd.primal.forgecraft.ForgeCraft;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
@Config(modid = ModInfo.MOD_ID, name = ModInfo.MOD_CONFIG, category = "") @Config(modid = ModInfo.MOD_ID, name = ModInfo.MOD_CONFIG, category = "")
@Config.LangKey("forgecraft.config.title") @Config.LangKey("forgecraft.config.title")
@SuppressWarnings("unused")
public class ModConfig
public final class ModConfig
{ {
//static { static {
// ForgeCraft.LOGGER.info("Loading Config File: " + ModInfo.MOD_CONFIG + ".cfg"); ForgeCraft.LOGGER.info("Loading Config File: " + ModInfo.MOD_CONFIG + ".cfg");
//} }
/** /**
* Main Config Sections * Main Config Sections
*/ */
public static Compatibility compatibility; public static Compatibility compatibility;
public static Features features; public static ModConfig.Features features;
/** /**
* Options related to compatibility with mods and vanilla features * Options related to compatibility with mods and vanilla features
*/ */
public static class Compatibility public static class Compatibility
{ {
@Config.Comment({"Ore Dictionary Wrought Iron to common Iron"}) @Config.Comment({"Ore Dictionary Wootz steel for compatibility with common mod steel"})
public static boolean COMPAT_DICTIONARY_WROUGHT_IRON = true; public static boolean COMPAT_DICTIONARY_WOOTZ_STEEL;
//@Config.Comment({"Ore Dictionary Damascus Steel to common Steel"})
//public static boolean COMPAT_DICTIONARY_DAMASCUS_STEEL = true;
} }
/** /**
* Customize main features of the mod * Customize main features of the mod
*/ */
public static class Features public static class Features
{ {
// @Config.RequiresMcRestart @Config.Comment({"Smoke is produced from various forge blocks when active"})
// @Config.Comment({"Config to allow or dissallow Copper Tools"}) public static boolean FEATURE_ENABLE_SMOKE = true;
// public static boolean ENABLE_COPPER_TOOLS = false;
@Config.RequiresMcRestart
@Config.Comment({"Various forge blocks will set fire to their surroundings when active"})
public static boolean FEATURE_ENABLE_FIRE = true;
@Config.Comment({"Sample config for a numeric range"})
@Config.RangeInt(min = 0, max = 1000)
public static int FEATURE_HEAT_RANGE = 0;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,40 +0,0 @@
package nmd.primal.forgecraft.init;
import net.minecraft.init.Items;
import net.minecraftforge.oredict.OreDictionary;
import static nmd.primal.forgecraft.init.ModConfig.Compatibility.COMPAT_DICTIONARY_WROUGHT_IRON;
/**
* Created by mminaie on 2/7/17.
*/
public class ModDictionary {/*******************************************************************************
* Register Only Vanilla OreDictionary Entries Here
* Mod Items/Blocks have their names added through the respective
* registration methods as a list of comma delineated strings.
*
* EXAMPLE:
* LEATHER_CORDAGE = registerItem(new PrimalItem("leather_cordage"), "cordageGeneral, cordageLeather");
*
*/
public static void registerDictionaryNames()
{
OreDictionary.registerOre("ingotBronze", ModItems.bronzeingotball);
OreDictionary.registerOre("nuggetBronze", ModItems.bronzechunk);
if(COMPAT_DICTIONARY_WROUGHT_IRON) {
OreDictionary.registerOre("ingotIron", ModItems.ironingotball);
OreDictionary.registerOre("nuggetIron", ModItems.wroughtironchunk);
}
OreDictionary.registerOre("ingotIron", ModItems.ironcleaningotball);
OreDictionary.registerOre("nuggetIron", ModItems.ironcleanchunk);
OreDictionary.registerOre("ingotSteel", ModItems.steelingotball);
OreDictionary.registerOre("nuggetSteel", ModItems.steelchunk);
OreDictionary.registerOre("ingotBronze", ModItems.bronzeingotball);
OreDictionary.registerOre("nuggetBronze", ModItems.bronzechunk);
//if(COMPAT_DICTIONARY_DAMASCUS_STEEL) {
OreDictionary.registerOre("ingotWootz", ModItems.wootzingotball);
OreDictionary.registerOre("nuggetWootz", ModItems.wootzchunk);
//}
OreDictionary.registerOre("dustBlaze", Items.BLAZE_POWDER);
}
}

View File

@@ -1,78 +0,0 @@
package nmd.primal.forgecraft.init;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.fluids.BasicFluidBlockKFC;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function;
import static nmd.primal.core.common.helper.RegistryHelper.registerFluidBlock;
import static nmd.primal.core.common.helper.RegistryHelper.registerFluidItems;
public class ModFluids {
public static Fluid HOLY_WATER;
public static final Set<IFluidBlock> FLUID_BLOCKS = new HashSet<>();
// ***************************************************************************** //
// Fluid Registration
// ***************************************************************************** //
@Mod.EventBusSubscriber(modid= ModInfo.MOD_ID)
public static class RegistrationHandler
{
/**
* Register this mod's fluid {@link Block}s.
* @param event The event
*/
@SubscribeEvent
public static void registryFluidBlocks(final RegistryEvent.Register<Block> event)
{
final IForgeRegistry<Block> registry = event.getRegistry();
/*registerFluidBlock(registry,
HOLY_WATER = createFluid("holy_water", 0xFFEDF1F5, true,
fluid -> fluid.setDensity(1000).setViscosity(1000).setTemperature(100).setLuminosity(5).setGaseous(false),
fluid -> new BasicFluidBlockKFC(fluid, Material.WATER)));
*/
}
/**
* Register this mod's fluid {@link ItemBlock}s.
* @param event The event
*/
// Use EventPriority.LOWEST so this is called after the RegistryEvent.Register<Item> handler in ModBlocks where
// the ItemBlock for ModBlocks.FLUID_TANK is registered.
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void registryFluidItems(final RegistryEvent.Register<Item> event)
{
final IForgeRegistry<Item> registry = event.getRegistry();
registerFluidItems(registry, FLUID_BLOCKS);
}
}
// ***************************************************************************** //
// Registry Overrides
// ***************************************************************************** //
private static <T extends Block & IFluidBlock> Fluid createFluid(String name, int color, boolean hasFlowIcon, Consumer<Fluid> fluidPropertyApplier, Function<Fluid, T> blockFactory)
{
return nmd.primal.core.common.helper.RegistryHelper.createFluid(name, ModInfo.MOD_ID, FLUID_BLOCKS, color, hasFlowIcon, fluidPropertyApplier, blockFactory);
}
}

View File

@@ -1,70 +1,58 @@
package nmd.primal.forgecraft.init; package nmd.primal.forgecraft.init;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI; import nmd.primal.core.api.PrimalMaterials;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.items.*; import nmd.primal.forgecraft.items.*;
import nmd.primal.forgecraft.items.armor.CustomHelmet; import nmd.primal.forgecraft.items.armor.CustomLeggings;
import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible; import nmd.primal.forgecraft.items.casting.CastingPart;
import nmd.primal.forgecraft.items.parts.BronzeToolPart;
import nmd.primal.forgecraft.items.parts.ToolPart; import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.parts.WeaponPart; import nmd.primal.forgecraft.items.tools.*;
import nmd.primal.forgecraft.items.tools.CustomAxe; import nmd.primal.forgecraft.items.weapons.CustomShield;
import nmd.primal.forgecraft.items.tools.CustomHoe; import nmd.primal.forgecraft.items.weapons.CustomSword;
import nmd.primal.forgecraft.items.tools.CustomPickaxe; import nmd.primal.forgecraft.items.weapons.Longbow;
import nmd.primal.forgecraft.items.tools.CustomShovel; import nmd.primal.forgecraft.items.weapons.SlayerSword;
import nmd.primal.forgecraft.items.weapons.*;
/** /**
* Created by kitsu on 11/26/2016. * Created by kitsu on 11/26/2016.
*/ */
public class ModItems { public class ModItems {
//public static Item test; //public static Item test;
public static Item itemnbtcrucible;
public static Item slottedtongs;
// public static Item itemcrucible;
public static Item bellowshandle; public static Item bellowshandle;
public static Item forgehammer; public static Item forgehammer;
public static Item softcrucible; public static Item softcrucible;
//public static Item stonetongs; public static Item stonetongs;
public static Item castingmud; public static Item castingmud;
public static Item grindingwheel;
public static Item ironingotballhot;
public static Item ironchunkhot;
public static Item ironcleaningotballhot;
public static Item ironcleanchunkhot;
public static Item steelingotballhot;
public static Item steelchunkhot;
public static Item wootzingotballhot;
public static Item wootzchunkhot;
public static Item bronzeingotball; public static Item cast_axe;
public static Item bronzechunk; public static Item cast_gladius;
public static Item ironingotball; public static Item cast_hoe;
public static Item wroughtironchunk; public static Item cast_pickaxe;
public static Item ironcleaningotball; public static Item cast_shovel;
public static Item ironcleanchunk;
public static Item steelingotball;
public static Item steelchunk;
public static Item wootzingotball;
public static Item wootzchunk;
public static Item ironsledgehammer;
public static Item coppersledgehammer;
public static Item bronzesledgehammer;
public static Item cleanironsledgehammer;
public static Item steelsledgehammer;
public static Item wootzsledgehammer;
public static Item copperpickaxehead;
public static Item copperaxehead;
public static Item coppershovelhead;
public static Item copperhoehead;
public static Item copperpickaxe;
public static Item copperaxe;
public static Item coppershovel;
public static Item copperhoe;
public static Item pickaxehead; public static Item pickaxehead;
@@ -118,39 +106,18 @@ public class ModItems {
public static Item wootzshovel; public static Item wootzshovel;
public static Item wootzhoe; public static Item wootzhoe;
public static Item rawbronzegladius;
public static Item rawcoppergladius;
public static Item rawwroughtirongladius;
public static Item rawcleanirongladius;
public static Item rawsteelgladius;
public static Item rawwootzgladius;
public static Item rawcleanironlongsword ;
public static Item rawsteellongsword;
public static Item rawwootzlongsword;
public static Item rawironslayer;
public static Item rawcleanironslayer;
public static Item rawsteelslayer;
public static Item rawwootzslayer;
public static Item coppergladius;
public static Item bronzegladius; public static Item bronzegladius;
public static Item wroughtirongladius; public static Item wroughtirongladius;
public static Item cleanirongladius; public static Item cleanirongladius;
public static Item steelgladius; public static Item steelgladius;
public static Item wootzgladius;
public static Item cleanironlongsword; public static Item cleanironlongsword;
public static Item steellongsword; public static Item steellongsword;
public static Item wootzlongsword;
public static Item wroughtironslayer; public static Item wroughtironslayer;
public static Item cleanironslayer; public static Item cleanironslayer;
public static Item steelslayer; public static Item steelslayer;
public static Item wootzslayer;
public static Item brokencoppertool;
public static Item brokenbronzetool; public static Item brokenbronzetool;
public static Item brokenwroughtirontool; public static Item brokenwroughtirontool;
public static Item brokencleanirontool; public static Item brokencleanirontool;
@@ -166,163 +133,124 @@ public class ModItems {
public static Item rawlongbow; public static Item rawlongbow;
public static Item unstrunglongbow; public static Item unstrunglongbow;
public static Item longbow; public static Item longbow;
public static Item wootzworkblade;
public static Item leatherhelmet;
//public static Item testleggings; //public static Item testleggings;
//public static Item forgingmanual; //public static Item forgingmanual;
public static void init() { public static void init() {
//OBJLoader.INSTANCE.addDomain(ModInfo.MOD_ID); //OBJLoader.INSTANCE.addDomain(ModInfo.MOD_ID);
//pistonbellows = new ItemBellowsHandle("pistonbellows"); //pistonbellows = new ItemBellowsHandle("pistonbellows");
itemnbtcrucible = new ItemNBTCrucible("itemnbtcrucible", ModBlocks.nbtCrucible);
slottedtongs = new SlottedTongs("slottedtongs");
//itemcrucible = new ItemCrucible("itemcrucible");
bellowshandle = new BaseItem("bellowshandle"); bellowshandle = new BaseItem("bellowshandle");
softcrucible = new ItemSoftCrucible("softcrucible"); softcrucible = new ItemSoftCrucible("softcrucible");
//stonetongs = new ItemStoneTongs("stonetongs"); stonetongs = new ItemStoneTongs("stonetongs");
forgehammer = new ForgeHammer("forgehammer"); forgehammer = new ForgeHammer("forgehammer");
castingmud = new BaseItem("castingmud"); castingmud = new BaseItem("castingmud");
rawlongbow = new RawLongbow("rawlongbow"); rawlongbow = new BaseItem("rawlongbow");
unstrunglongbow = new BaseItem("unstrunglongbow"); unstrunglongbow = new BaseItem("unstrunglongbow");
longbow = new Longbow("longbow"); longbow = new Longbow("longbow");
//matchlockmusket = new Musket("matchlock_musket"); //matchlockmusket = new Musket("matchlock_musket");
wootzworkblade = new Workblade("wootzworkblade", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, -1.0F).setFireProof(true);
grindingwheel = new BaseSingleItem("grindingwheel", 9000);
/**********
CASTING PARTS
**********/
cast_axe = new CastingPart("cast_axe");
cast_gladius = new CastingPart("cast_gladius");
cast_hoe = new CastingPart("cast_hoe");
cast_pickaxe = new CastingPart("cast_pickaxe");
cast_shovel = new CastingPart("cast_shovel");
/********** /**********
TOOL PARTS TOOL PARTS
**********/ **********/
copperpickaxehead = new ToolPart("copperpickaxehead", PrimalAPI.ToolMaterials.TOOL_COPPER, "pickaxe");
copperaxehead = new ToolPart("copperaxehead", PrimalAPI.ToolMaterials.TOOL_COPPER, "axe");
coppershovelhead= new ToolPart("coppershovelhead", PrimalAPI.ToolMaterials.TOOL_COPPER, "shovel");
copperhoehead = new ToolPart("copperhoehead", PrimalAPI.ToolMaterials.TOOL_COPPER, "hoe");
bronzepickaxehead = new ToolPart("bronzepickaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "pickaxe"); bronzepickaxehead = new BronzeToolPart("bronzepickaxehead", PrimalMaterials.TOOL_BRONZE, 41);
bronzeaxehead = new ToolPart("bronzeaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "axe"); bronzeaxehead = new BronzeToolPart("bronzeaxehead", PrimalMaterials.TOOL_BRONZE, 42);
bronzeshovelhead = new ToolPart("bronzeshovelhead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "shovel"); bronzeshovelhead = new BronzeToolPart("bronzeshovelhead", PrimalMaterials.TOOL_BRONZE, 43);
bronzehoehead = new ToolPart("bronzehoehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "hoe"); bronzehoehead = new BronzeToolPart("bronzehoehead", PrimalMaterials.TOOL_BRONZE, 44);
pickaxehead = new ToolPart("ironpickaxehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "pickaxe"); pickaxehead = new ToolPart("ironpickaxehead", PrimalMaterials.TOOL_WROUGHT_IRON, 8);
ironaxehead = new ToolPart("ironaxehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "axe"); ironaxehead = new ToolPart("ironaxehead", PrimalMaterials.TOOL_WROUGHT_IRON, 9);
ironshovelhead = new ToolPart("ironshovelhead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "shovel"); ironshovelhead = new ToolPart("ironshovelhead", PrimalMaterials.TOOL_WROUGHT_IRON, 10);
ironhoehead = new ToolPart("ironhoehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "hoe"); ironhoehead = new ToolPart("ironhoehead", PrimalMaterials.TOOL_WROUGHT_IRON, 11);
cleanironpickaxehead = new ToolPart("cleanironpickaxehead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, "pickaxe"); cleanironpickaxehead = new ToolPart("cleanironpickaxehead", PrimalMaterials.TOOL_CLEAN_IRON, 17);
cleanironaxehead = new ToolPart("cleanironaxehead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, "axe"); cleanironaxehead = new ToolPart("cleanironaxehead", PrimalMaterials.TOOL_CLEAN_IRON, 18);
cleanironshovelhead = new ToolPart("cleanironshovelhead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, "shovel"); cleanironshovelhead = new ToolPart("cleanironshovelhead", PrimalMaterials.TOOL_CLEAN_IRON, 19);
cleanironhoehead = new ToolPart("cleanironhoehead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, "hoe"); cleanironhoehead = new ToolPart("cleanironhoehead", PrimalMaterials.TOOL_CLEAN_IRON, 20);
steelpickaxehead = new ToolPart("steelpickaxehead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, "pickaxe"); steelpickaxehead = new ToolPart("steelpickaxehead", PrimalMaterials.TOOL_BASIC_STEEL, 26);
steelaxehead = new ToolPart("steelaxehead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, "axe"); steelaxehead = new ToolPart("steelaxehead", PrimalMaterials.TOOL_BASIC_STEEL, 27);
steelshovelhead = new ToolPart("steelshovelhead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, "shovel"); steelshovelhead = new ToolPart("steelshovelhead", PrimalMaterials.TOOL_BASIC_STEEL, 28);
steelhoehead = new ToolPart("steelhoehead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, "hoe"); steelhoehead = new ToolPart("steelhoehead", PrimalMaterials.TOOL_BASIC_STEEL, 29);
wootzpickaxehead = new ToolPart("wootzpickaxehead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, "pickaxe");
wootzaxehead = new ToolPart("wootzaxehead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, "axe");
wootzshovelhead = new ToolPart("wootzshovelhead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, "shovel");
wootzhoehead = new ToolPart("wootzhoehead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, "hoe");
wootzpickaxehead = new ToolPart("wootzpickaxehead", PrimalMaterials.TOOL_WOOTZ_STEEL, 35);
wootzaxehead = new ToolPart("wootzaxehead", PrimalMaterials.TOOL_WOOTZ_STEEL, 36);
wootzshovelhead = new ToolPart("wootzshovelhead", PrimalMaterials.TOOL_WOOTZ_STEEL, 37);
wootzhoehead = new ToolPart("wootzhoehead", PrimalMaterials.TOOL_WOOTZ_STEEL, 38);
/********** /**********
TOOLS TOOLS
**********/ **********/
copperpickaxe = new CustomPickaxe("copperpickaxe", PrimalAPI.ToolMaterials.TOOL_COPPER, brokencoppertool); bronzepickaxe = new BronzePickaxe("bronzepickaxe", PrimalMaterials.TOOL_BRONZE, bronzepickaxehead);
copperaxe = new CustomAxe("copperaxe", PrimalAPI.ToolMaterials.TOOL_COPPER, brokencoppertool, 4, -2.6F); bronzeaxe = new BronzeAxe("bronzeaxe", PrimalMaterials.TOOL_BRONZE, bronzeaxehead);
coppershovel = new CustomShovel("coppershovel", PrimalAPI.ToolMaterials.TOOL_COPPER, brokencoppertool); bronzeshovel = new BronzeShovel("bronzeshovel", PrimalMaterials.TOOL_BRONZE, bronzeshovelhead);
copperhoe = new CustomHoe("copperhoe", PrimalAPI.ToolMaterials.TOOL_COPPER, brokencoppertool); bronzehoe = new BronzeHoe("bronzehoe", PrimalMaterials.TOOL_BRONZE, bronzehoehead);
coppersledgehammer = new SledgeHammer("coppersledgehammer", PrimalAPI.ToolMaterials.TOOL_COPPER, 12, -3.7D);
bronzepickaxe = new CustomPickaxe("bronzepickaxe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzepickaxehead); ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalMaterials.TOOL_WROUGHT_IRON, pickaxehead);
bronzeaxe = new CustomAxe("bronzeaxe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzeaxehead, 5, -2.4f); ironaxe = new CustomAxe("ironaxe", PrimalMaterials.TOOL_WROUGHT_IRON, ironaxehead);
bronzeshovel = new CustomShovel("bronzeshovel", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzeshovelhead); ironshovel = new CustomShovel("ironshovel", PrimalMaterials.TOOL_WROUGHT_IRON, ironshovelhead);
bronzehoe = new CustomHoe("bronzehoe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzehoehead); ironhoe = new CustomHoe("ironhoe", PrimalMaterials.TOOL_WROUGHT_IRON, ironhoehead);
bronzesledgehammer = new SledgeHammer("bronzesledgehammer", PrimalAPI.ToolMaterials.TOOL_BRONZE, 12, -3.7D);
ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, pickaxehead); cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalMaterials.TOOL_CLEAN_IRON, cleanironpickaxehead);
ironaxe = new CustomAxe("ironaxe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironaxehead, 5, -3.6f); cleanironaxe = new CustomAxe("cleanironaxe", PrimalMaterials.TOOL_CLEAN_IRON, cleanironaxehead);
ironshovel = new CustomShovel("ironshovel", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironshovelhead); cleanironshovel = new CustomShovel("cleanironshovel", PrimalMaterials.TOOL_CLEAN_IRON, cleanironshovelhead);
ironhoe = new CustomHoe("ironhoe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironhoehead); cleanironhoe = new CustomHoe("cleanironhoe", PrimalMaterials.TOOL_CLEAN_IRON, cleanironhoehead);
ironsledgehammer = new SledgeHammer("ironsledgehammer", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 12, -3.7D);
cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironpickaxehead); steelpickaxe = new CustomPickaxe("steelpickaxe", PrimalMaterials.TOOL_BASIC_STEEL, steelpickaxehead);
cleanironaxe = new CustomAxe("cleanironaxe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironaxehead, 6, -3.2f); steelaxe = new CustomAxe("steelaxe", PrimalMaterials.TOOL_BASIC_STEEL, steelaxehead);
cleanironshovel = new CustomShovel("cleanironshovel", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironshovelhead); steelshovel = new CustomShovel("steelshovel", PrimalMaterials.TOOL_BASIC_STEEL, steelshovelhead);
cleanironhoe = new CustomHoe("cleanironhoe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironhoehead); steelhoe = new CustomHoe("steelhoe", PrimalMaterials.TOOL_BASIC_STEEL, steelhoehead);
cleanironsledgehammer = new SledgeHammer("cleanironsledgehammer", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 12, -3.7D);
steelpickaxe = new CustomPickaxe("steelpickaxe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelpickaxehead); wootzpickaxe = new CustomPickaxe("wootzpickaxe", PrimalMaterials.TOOL_WOOTZ_STEEL, wootzpickaxehead);
steelaxe = new CustomAxe("steelaxe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelaxehead, 7, -2.8f); wootzaxe = new CustomAxe("wootzaxe", PrimalMaterials.TOOL_WOOTZ_STEEL, wootzaxehead);
steelshovel = new CustomShovel("steelshovel", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelshovelhead); wootzshovel = new CustomShovel("wootzshovel", PrimalMaterials.TOOL_WOOTZ_STEEL, wootzshovelhead);
steelhoe = new CustomHoe("steelhoe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelhoehead); wootzhoe = new CustomHoe("wootzhoe", PrimalMaterials.TOOL_WOOTZ_STEEL, wootzhoehead);
steelsledgehammer = new SledgeHammer("steelsledgehammer", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, 12, -3.5D);
wootzpickaxe = new CustomPickaxe("wootzpickaxe", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzpickaxehead);
wootzaxe = new CustomAxe("wootzaxe", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzaxehead, 8, -2.4f);
wootzshovel = new CustomShovel("wootzshovel", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzshovelhead);
wootzhoe = new CustomHoe("wootzhoe", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzhoehead);
wootzsledgehammer = new SledgeHammer("wootzsledgehammer", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, 12, -3.4D);
/********** /**********
WEAPONS WEAPONS
**********/ **********/
bronzegladius = new CustomSword("bronzegladius", PrimalMaterials.TOOL_BRONZE, 5D, 2D);
wroughtirongladius = new CustomSword("wroughtirongladius", PrimalMaterials.TOOL_WROUGHT_IRON, 4.5D, -1.85D);
cleanirongladius = new CustomSword("cleanirongladius", PrimalMaterials.TOOL_CLEAN_IRON, 5D, -1.85D);
steelgladius = new CustomSword("steelgladius", PrimalMaterials.TOOL_BASIC_STEEL,6D, -1.85D);
rawbronzegladius = new WeaponPart("rawbronzegladius", PrimalAPI.ToolMaterials.TOOL_BRONZE); cleanironlongsword = new CustomSword("cleanironlongsword", PrimalMaterials.TOOL_CLEAN_IRON, 7D, -2.5D);
rawcoppergladius= new WeaponPart("rawcoppergladius", PrimalAPI.ToolMaterials.TOOL_COPPER); steellongsword = new CustomSword("steellongsword", PrimalMaterials.TOOL_BASIC_STEEL,8D, -2.25D);
rawwroughtirongladius= new WeaponPart("rawwroughtirongladius", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
rawcleanirongladius= new WeaponPart("rawcleanirongladius", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON);
rawsteelgladius= new WeaponPart("rawsteelgladius", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL);
rawwootzgladius= new WeaponPart("rawwootzgladius", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL);
rawcleanironlongsword = new WeaponPart("rawcleanironlongsword", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON); wroughtironslayer = new SlayerSword("wroughtironslayer", PrimalMaterials.TOOL_WROUGHT_IRON, 11.5D, -3.7D);
rawsteellongsword = new WeaponPart("rawsteellongsword", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL); cleanironslayer = new SlayerSword("cleanironslayer", PrimalMaterials.TOOL_CLEAN_IRON, 10D, -3.5D);
rawwootzlongsword = new WeaponPart("rawwootzlongsword", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL); steelslayer = new SlayerSword("steelslayer", PrimalMaterials.TOOL_BASIC_STEEL,11D, -3.3D);
rawironslayer = new WeaponPart("rawironslayer", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON); wroughtironshield = new CustomShield("wroughtironshield", PrimalMaterials.TOOL_WROUGHT_IRON);
rawcleanironslayer = new WeaponPart("rawcleanironslayer", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON);
rawsteelslayer = new WeaponPart("rawsteelslayer", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL);
rawwootzslayer = new WeaponPart("rawwootzslayer", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL);
coppergladius = new CustomSword("coppergladius", PrimalAPI.ToolMaterials.TOOL_COPPER, 5D, 2D);
bronzegladius = new CustomSword("bronzegladius", PrimalAPI.ToolMaterials.TOOL_BRONZE, 5.5D, 2D);
wroughtirongladius = new CustomSword("wroughtirongladius", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 4.5D, -1.85D);
cleanirongladius = new CustomSword("cleanirongladius", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 5D, -1.85D);
steelgladius = new CustomSword("steelgladius", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL,6D, -1.85D);
wootzgladius = new CustomSword("wootzgladius", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, 7D, -1.75D);
cleanironlongsword = new CustomSword("cleanironlongsword", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 7D, -2.5D);
steellongsword = new CustomSword("steellongsword", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL,8D, -2.25D);
wootzlongsword = new CustomSword("wootzlongsword", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL,9D, -2D);
wroughtironslayer = new SlayerSword("wroughtironslayer", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 11.5D, -3.7D);
cleanironslayer = new SlayerSword("cleanironslayer", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 10D, -3.5D);
steelslayer = new SlayerSword("steelslayer", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL,11D, -3.3D);
wootzslayer = new SlayerSword("wootzslayer", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL,11D, -3.1D);
wroughtironshield = new CustomShield("wroughtironshield", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
/********** /**********
INGOTS AND CHUNKS INGOTS AND CHUNKS
**********/ **********/
ironingotballhot = new BaseMultiItem("ironingothot", PrimalMaterials.TOOL_WROUGHT_IRON, 6);
bronzeingotball = new BaseMultiItem("bronzeingotball", PrimalAPI.ToolMaterials.TOOL_BRONZE); ironchunkhot = new BaseMultiItem("ironchunkhot", PrimalMaterials.TOOL_WROUGHT_IRON, 7);
bronzechunk = new BaseMultiItem("bronzechunk", PrimalAPI.ToolMaterials.TOOL_BRONZE); ironcleaningotballhot= new BaseMultiItem("ironcleaningotballhot", PrimalMaterials.TOOL_CLEAN_IRON, 15);
ironingotball = new BaseMultiItem("ironingotball", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON); ironcleanchunkhot= new BaseMultiItem("ironcleanchunkhot", PrimalMaterials.TOOL_CLEAN_IRON, 16);
wroughtironchunk = new BaseMultiItem("wroughtironchunk", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON); steelingotballhot= new BaseMultiItem("steelingotballhot", PrimalMaterials.TOOL_BASIC_STEEL, 24);
ironcleaningotball= new BaseMultiItem("ironcleaningotball", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON); steelchunkhot= new BaseMultiItem("steelchunkhot", PrimalMaterials.TOOL_BASIC_STEEL, 25);
ironcleanchunk= new BaseMultiItem("ironcleanchunk", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON); wootzingotballhot= new BaseMultiItem("wootzingotballhot", PrimalMaterials.TOOL_WOOTZ_STEEL, 33);
steelingotball= new BaseMultiItem("steelingotball", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL); wootzchunkhot= new BaseMultiItem("wootzchunkhot", PrimalMaterials.TOOL_WOOTZ_STEEL, 34);
steelchunk= new BaseMultiItem("steelchunk", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL);
wootzingotball= new BaseMultiItem("wootzingotball", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL);
wootzchunk= new BaseMultiItem("wootzchunk", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL);
//forgingmanual = new ItemForgingManual(); //forgingmanual = new ItemForgingManual();
//test = new ItemTest("ironsword"); //test = new ItemTest("ironsword");
brokencoppertool = new BaseItem("brokencoppertool");
brokenbronzetool = new BaseItem("brokenbronzetool"); brokenbronzetool = new BaseItem("brokenbronzetool");
brokenwroughtirontool = new BaseItem("brokenwroughtirontool"); brokenwroughtirontool = new BaseItem("brokenwroughtirontool");
brokencleanirontool = new BaseItem("brokencleanirontool"); brokencleanirontool = new BaseItem("brokencleanirontool");
@@ -332,201 +260,153 @@ public class ModItems {
/********** /**********
ARMOR ARMOR
**********/ **********/
leatherhelmet=new CustomHelmet(PrimalAPI.ArmorMaterials.ARMOR_HIDE, 0, EntityEquipmentSlot.HEAD, "leatherhelmet"); //testleggings=new CustomLeggings(PrimalMaterials.ARMOR_ADAMANT, 3, EntityEquipmentSlot.LEGS, "testleggings");
//testleggings=new CustomHelmet(PrimalAPI.ToolMaterials.ARMOR_ADAMANT, 3, EntityEquipmentSlot.LEGS, "testleggings");
//registerItem(312, "diamond_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 3, EntityEquipmentSlot.LEGS)).setUnlocalizedName("leggingsDiamond")); //registerItem(312, "diamond_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 3, EntityEquipmentSlot.LEGS)).setUnlocalizedName("leggingsDiamond"));
} }
public static void register() { public static void register() {
//ForgeRegistries.ITEMS.register(); GameRegistry.register(castingmud);
GameRegistry.register(bellowshandle);
GameRegistry.register(softcrucible);
GameRegistry.register(stonetongs);
GameRegistry.register(forgehammer);
GameRegistry.register(ironingotballhot);
GameRegistry.register(ironchunkhot);
GameRegistry.register(ironcleaningotballhot);
GameRegistry.register(ironcleanchunkhot);
GameRegistry.register(steelingotballhot);
GameRegistry.register(steelchunkhot);
GameRegistry.register(wootzingotballhot);
GameRegistry.register(wootzchunkhot);
//GameRegistry.register(test);
ForgeRegistries.ITEMS.register(itemnbtcrucible); /**********
ForgeRegistries.ITEMS.register(slottedtongs); CASTING PARTS
//ForgeRegistries.ITEMS.register(itemcrucible); **********/
ForgeRegistries.ITEMS.register(castingmud); GameRegistry.register(cast_axe);
ForgeRegistries.ITEMS.register(bellowshandle); GameRegistry.register(cast_gladius);
ForgeRegistries.ITEMS.register(softcrucible); GameRegistry.register(cast_hoe);
ForgeRegistries.ITEMS.register(wootzworkblade); GameRegistry.register(cast_pickaxe);
ForgeRegistries.ITEMS.register(forgehammer); GameRegistry.register(cast_shovel);
ForgeRegistries.ITEMS.register(grindingwheel);
ForgeRegistries.ITEMS.register(bronzeingotball);
ForgeRegistries.ITEMS.register(bronzechunk);
ForgeRegistries.ITEMS.register(ironingotball);
ForgeRegistries.ITEMS.register(wroughtironchunk);
ForgeRegistries.ITEMS.register(ironcleaningotball);
ForgeRegistries.ITEMS.register(ironcleanchunk);
ForgeRegistries.ITEMS.register(steelingotball);
ForgeRegistries.ITEMS.register(steelchunk);
ForgeRegistries.ITEMS.register(wootzingotball);
ForgeRegistries.ITEMS.register(wootzchunk);
//ForgeRegistries.ITEMS.register(test);
/********** /**********
TOOL PARTS TOOL PARTS
**********/ **********/
GameRegistry.register(bronzepickaxehead);
GameRegistry.register(bronzeaxehead);
GameRegistry.register(bronzeshovelhead);
GameRegistry.register(bronzehoehead);
ForgeRegistries.ITEMS.register(copperpickaxehead); GameRegistry.register(pickaxehead);
ForgeRegistries.ITEMS.register(copperaxehead); GameRegistry.register(ironaxehead);
ForgeRegistries.ITEMS.register(coppershovelhead); GameRegistry.register(ironshovelhead);
ForgeRegistries.ITEMS.register(copperhoehead); GameRegistry.register(ironhoehead);
ForgeRegistries.ITEMS.register(bronzepickaxehead); GameRegistry.register(cleanironpickaxehead);
ForgeRegistries.ITEMS.register(bronzeaxehead); GameRegistry.register(cleanironaxehead);
ForgeRegistries.ITEMS.register(bronzeshovelhead); GameRegistry.register(cleanironshovelhead);
ForgeRegistries.ITEMS.register(bronzehoehead); GameRegistry.register(cleanironhoehead);
ForgeRegistries.ITEMS.register(pickaxehead); GameRegistry.register(steelpickaxehead);
ForgeRegistries.ITEMS.register(ironaxehead); GameRegistry.register(steelaxehead);
ForgeRegistries.ITEMS.register(ironshovelhead); GameRegistry.register(steelshovelhead);
ForgeRegistries.ITEMS.register(ironhoehead); GameRegistry.register(steelhoehead);
ForgeRegistries.ITEMS.register(cleanironpickaxehead); GameRegistry.register(wootzpickaxehead);
ForgeRegistries.ITEMS.register(cleanironaxehead); GameRegistry.register(wootzaxehead);
ForgeRegistries.ITEMS.register(cleanironshovelhead); GameRegistry.register(wootzshovelhead);
ForgeRegistries.ITEMS.register(cleanironhoehead); GameRegistry.register(wootzhoehead);
ForgeRegistries.ITEMS.register(steelpickaxehead);
ForgeRegistries.ITEMS.register(steelaxehead);
ForgeRegistries.ITEMS.register(steelshovelhead);
ForgeRegistries.ITEMS.register(steelhoehead);
ForgeRegistries.ITEMS.register(wootzpickaxehead);
ForgeRegistries.ITEMS.register(wootzaxehead);
ForgeRegistries.ITEMS.register(wootzshovelhead);
ForgeRegistries.ITEMS.register(wootzhoehead);
/********** /**********
TOOLS TOOLS
**********/ **********/
ForgeRegistries.ITEMS.register(copperpickaxe); GameRegistry.register(bronzepickaxe);
ForgeRegistries.ITEMS.register(copperaxe); GameRegistry.register(bronzeaxe);
ForgeRegistries.ITEMS.register(coppershovel); GameRegistry.register(bronzeshovel);
ForgeRegistries.ITEMS.register(copperhoe); GameRegistry.register(bronzehoe);
ForgeRegistries.ITEMS.register(coppersledgehammer);
ForgeRegistries.ITEMS.register(bronzepickaxe); GameRegistry.register(ironpickaxe);
ForgeRegistries.ITEMS.register(bronzeaxe); GameRegistry.register(ironaxe);
ForgeRegistries.ITEMS.register(bronzeshovel); GameRegistry.register(ironshovel);
ForgeRegistries.ITEMS.register(bronzehoe); GameRegistry.register(ironhoe);
ForgeRegistries.ITEMS.register(bronzesledgehammer);
ForgeRegistries.ITEMS.register(ironpickaxe); GameRegistry.register(cleanironpickaxe);
ForgeRegistries.ITEMS.register(ironaxe); GameRegistry.register(cleanironaxe);
ForgeRegistries.ITEMS.register(ironshovel); GameRegistry.register(cleanironshovel);
ForgeRegistries.ITEMS.register(ironhoe); GameRegistry.register(cleanironhoe);
ForgeRegistries.ITEMS.register(ironsledgehammer);
ForgeRegistries.ITEMS.register(cleanironpickaxe); GameRegistry.register(steelpickaxe);
ForgeRegistries.ITEMS.register(cleanironaxe); GameRegistry.register(steelaxe);
ForgeRegistries.ITEMS.register(cleanironshovel); GameRegistry.register(steelshovel);
ForgeRegistries.ITEMS.register(cleanironhoe); GameRegistry.register(steelhoe);
ForgeRegistries.ITEMS.register(cleanironsledgehammer);
ForgeRegistries.ITEMS.register(steelpickaxe); GameRegistry.register(wootzpickaxe);
ForgeRegistries.ITEMS.register(steelaxe); GameRegistry.register(wootzaxe);
ForgeRegistries.ITEMS.register(steelshovel); GameRegistry.register(wootzshovel);
ForgeRegistries.ITEMS.register(steelhoe); GameRegistry.register(wootzhoe);
ForgeRegistries.ITEMS.register(steelsledgehammer);
ForgeRegistries.ITEMS.register(wootzpickaxe);
ForgeRegistries.ITEMS.register(wootzaxe);
ForgeRegistries.ITEMS.register(wootzshovel);
ForgeRegistries.ITEMS.register(wootzhoe);
ForgeRegistries.ITEMS.register(wootzsledgehammer);
/********** /**********
WEAPONS WEAPONS
**********/ **********/
GameRegistry.register(wroughtirongladius);
GameRegistry.register(bronzegladius);
GameRegistry.register(cleanirongladius);
GameRegistry.register(steelgladius);
ForgeRegistries.ITEMS.register(rawbronzegladius); GameRegistry.register(cleanironlongsword);
ForgeRegistries.ITEMS.register(rawcoppergladius); GameRegistry.register(steellongsword);
ForgeRegistries.ITEMS.register(rawwroughtirongladius);
ForgeRegistries.ITEMS.register(rawcleanirongladius);
ForgeRegistries.ITEMS.register(rawsteelgladius);
ForgeRegistries.ITEMS.register(rawwootzgladius);
ForgeRegistries.ITEMS.register(rawcleanironlongsword); GameRegistry.register(wroughtironslayer);
ForgeRegistries.ITEMS.register(rawsteellongsword); GameRegistry.register(cleanironslayer);
ForgeRegistries.ITEMS.register(rawwootzlongsword); GameRegistry.register(steelslayer);
ForgeRegistries.ITEMS.register(rawironslayer); GameRegistry.register(rawlongbow);
ForgeRegistries.ITEMS.register(rawcleanironslayer); GameRegistry.register(unstrunglongbow);
ForgeRegistries.ITEMS.register(rawsteelslayer); GameRegistry.register(longbow);
ForgeRegistries.ITEMS.register(rawwootzslayer); //GameRegistry.register(matchlockmusket);
ForgeRegistries.ITEMS.register(coppergladius); GameRegistry.register(brokenbronzetool);
ForgeRegistries.ITEMS.register(wroughtirongladius); GameRegistry.register(brokenwroughtirontool);
ForgeRegistries.ITEMS.register(bronzegladius); GameRegistry.register(brokencleanirontool);
ForgeRegistries.ITEMS.register(cleanirongladius); GameRegistry.register(brokensteeltool);
ForgeRegistries.ITEMS.register(steelgladius); GameRegistry.register(brokenwootztool);
ForgeRegistries.ITEMS.register(wootzgladius);
ForgeRegistries.ITEMS.register(cleanironlongsword);
ForgeRegistries.ITEMS.register(steellongsword);
ForgeRegistries.ITEMS.register(wootzlongsword);
ForgeRegistries.ITEMS.register(wroughtironslayer);
ForgeRegistries.ITEMS.register(cleanironslayer);
ForgeRegistries.ITEMS.register(steelslayer);
ForgeRegistries.ITEMS.register(wootzslayer);
ForgeRegistries.ITEMS.register(rawlongbow);
ForgeRegistries.ITEMS.register(unstrunglongbow);
ForgeRegistries.ITEMS.register(longbow);
//ForgeRegistries.ITEMS.register(matchlockmusket);
ForgeRegistries.ITEMS.register(brokenbronzetool);
ForgeRegistries.ITEMS.register(brokenwroughtirontool);
ForgeRegistries.ITEMS.register(brokencleanirontool);
ForgeRegistries.ITEMS.register(brokensteeltool);
ForgeRegistries.ITEMS.register(brokenwootztool);
/********** /**********
ARMOR ARMOR
**********/ **********/
ForgeRegistries.ITEMS.register(leatherhelmet); //GameRegistry.register(testleggings);
//ForgeRegistries.ITEMS.register(testleggings);
//ForgeRegistries.ITEMS.register(forgingmanual); //GameRegistry.register(forgingmanual);
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public static void registerRenders() { public static void registerRenders() {
registerRender(itemnbtcrucible);
registerRender(slottedtongs);
registerRender(castingmud); registerRender(castingmud);
registerRender(bellowshandle); registerRender(bellowshandle);
registerRender(softcrucible); registerRender(softcrucible);
registerRender(forgehammer); registerRender(forgehammer);
registerRender(wootzworkblade); registerRender(ironingotballhot);
registerRender(grindingwheel); registerRender(ironchunkhot);
registerRender(ironcleaningotballhot);
registerRender(bronzeingotball); registerRender(ironcleanchunkhot);
registerRender(bronzechunk); registerRender(steelingotballhot);
registerRender(ironingotball); registerRender(steelchunkhot);
registerRender(wroughtironchunk);
registerRender(ironcleaningotball);
registerRender(ironcleanchunk);
registerRender(steelingotball);
registerRender(steelchunk);
registerRender(wootzingotball);
registerRender(wootzchunk);
//registerRender(test); //registerRender(test);
/**********
CASTING PARTS
**********/
registerRender(cast_axe);
registerRender(cast_gladius);
registerRender(cast_hoe);
registerRender(cast_pickaxe);
registerRender(cast_shovel);
/********** /**********
TOOL PARTS TOOL PARTS
**********/ **********/
registerRender(copperpickaxehead);
registerRender(copperaxehead);
registerRender(coppershovelhead);
registerRender(copperhoehead);
registerRender(bronzepickaxehead); registerRender(bronzepickaxehead);
registerRender(bronzeaxehead); registerRender(bronzeaxehead);
registerRender(bronzeshovelhead); registerRender(bronzeshovelhead);
@@ -555,82 +435,47 @@ public class ModItems {
/********** /**********
TOOLS TOOLS
**********/ **********/
registerRender(copperpickaxe);
registerRender(copperaxe);
registerRender(coppershovel);
registerRender(copperhoe);
registerRender(coppersledgehammer);
registerRender(bronzepickaxe); registerRender(bronzepickaxe);
registerRender(bronzeaxe); registerRender(bronzeaxe);
registerRender(bronzeshovel); registerRender(bronzeshovel);
registerRender(bronzehoe); registerRender(bronzehoe);
registerRender(bronzesledgehammer);
registerRender(ironpickaxe); registerRender(ironpickaxe);
registerRender(ironaxe); registerRender(ironaxe);
registerRender(ironshovel); registerRender(ironshovel);
registerRender(ironhoe); registerRender(ironhoe);
registerRender(ironsledgehammer);
registerRender(cleanironpickaxe); registerRender(cleanironpickaxe);
registerRender(cleanironaxe); registerRender(cleanironaxe);
registerRender(cleanironshovel); registerRender(cleanironshovel);
registerRender(cleanironhoe); registerRender(cleanironhoe);
registerRender(cleanironsledgehammer);
registerRender(steelpickaxe); registerRender(steelpickaxe);
registerRender(steelaxe); registerRender(steelaxe);
registerRender(steelshovel); registerRender(steelshovel);
registerRender(steelhoe); registerRender(steelhoe);
registerRender(steelsledgehammer);
registerRender(wootzpickaxe); registerRender(wootzpickaxe);
registerRender(wootzaxe); registerRender(wootzaxe);
registerRender(wootzshovel); registerRender(wootzshovel);
registerRender(wootzhoe); registerRender(wootzhoe);
registerRender(wootzsledgehammer);
/**********
WEAPON PARTS
**********/
//registerRender(wroughtironshield);
registerRender(rawbronzegladius);
registerRender(rawcoppergladius);
registerRender(rawwroughtirongladius);
registerRender(rawcleanirongladius);
registerRender(rawsteelgladius);
registerRender(rawwootzgladius);
registerRender(rawcleanironlongsword);
registerRender(rawsteellongsword);
registerRender(rawwootzlongsword);
registerRender(rawironslayer);
registerRender(rawcleanironslayer);
registerRender(rawsteelslayer);
registerRender(rawwootzslayer);
/********** /**********
WEAPONS WEAPONS
**********/ **********/
registerRender(wroughtironshield);
registerRender(coppergladius);
registerRender(bronzegladius); registerRender(bronzegladius);
registerRender(wroughtirongladius); registerRender(wroughtirongladius);
registerRender(cleanirongladius); registerRender(cleanirongladius);
registerRender(steelgladius); registerRender(steelgladius);
registerRender(wootzgladius);
registerRender(cleanironlongsword); registerRender(cleanironlongsword);
registerRender(steellongsword); registerRender(steellongsword);
registerRender(wootzlongsword);
registerRender(wroughtironslayer); registerRender(wroughtironslayer);
registerRender(cleanironslayer); registerRender(cleanironslayer);
registerRender(steelslayer); registerRender(steelslayer);
registerRender(wootzslayer);
registerRender(rawlongbow); registerRender(rawlongbow);
registerRender(unstrunglongbow); registerRender(unstrunglongbow);
@@ -649,10 +494,190 @@ public class ModItems {
/********** /**********
ARMOR ARMOR
**********/ **********/
registerRender(leatherhelmet); //registerRender(testleggings);
} }
@SideOnly(Side.CLIENT)
public static void registerCustomRenders(){
ModelBakery.registerItemVariants(ModItems.stonetongs, ModItems.stonetongs.getRegistryName(),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_default"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_emptyhot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_emptyhotcracked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotiron"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotironcooked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotironfailed"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_ingot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_chunk"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_pickaxe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_axe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_shovel_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hoe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotcleaniron"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotcleanironcooked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotcleanironfailed"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleanironingot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleanironchunk"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_pickaxe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_axe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_shovel_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_hoe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotsteel"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotsteelcooked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotsteelfailed"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steelingot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steelchunk"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_pickaxe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_axe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_shovel_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_hoe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_lapis"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_lapis"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_redstone"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_redstone"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_emerald"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_emerald"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_diamond"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_diamond")
);
ModelLoader.setCustomMeshDefinition(ModItems.stonetongs, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
if (stack.hasTagCompound()) {
if (stack.getTagCompound().getInteger("type") == 0 ){
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_default", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 1 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_emptyhot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 2 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_emptyhotcracked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 3 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotiron", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 4 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotironcooked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 5 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotironfailed", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 6 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_ingot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 7 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_chunk", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 8 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_pickaxe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 9 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_axe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 10 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_shovel_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 11 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hoe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 12 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotcleaniron", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 13 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotcleanironcooked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 14 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotcleanironfailed", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 15 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleanironingot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 16 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleanironchunk", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 17 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_pickaxe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 18 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_axe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 19 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_shovel_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 20 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_hoe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 21 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotsteel", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 22 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotsteelcooked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 23 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotsteelfailed", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 24 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steelingot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 25 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steelchunk", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 26 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_pickaxe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 27 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_axe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 28 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_shovel_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 29 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_hoe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 39 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 40 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 45 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_emerald", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 46 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_emerald", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 47 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_diamond", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 48 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_diamond", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 49 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_redstone", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 50 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_redstone", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 51 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_lapis", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 52 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_lapis", "inventory");
}
else return new ModelResourceLocation(stack.getItem().getRegistryName(), "inventory");
}
return new ModelResourceLocation(stack.getItem().getRegistryName(), "inventory");
}
});
}
private static void registerRender(Item item) { private static void registerRender(Item item) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
} }

View File

@@ -1,39 +1,14 @@
package nmd.primal.forgecraft.init; package nmd.primal.forgecraft.init;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.registries.RegistryBuilder;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
/** /**
* Created by kitsu on 12/3/2016. * Created by kitsu on 12/3/2016.
*/ */
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public class ModRegistries { public class ModRegistries {
@SubscribeEvent public static void registerFuels()
public static void customRegistries(RegistryEvent.NewRegistry event) { {
PrimalAPI.logger(1, "Custom Registry", CrucibleCrafting.RECIPE_PREFIX); //if (ModConfig.FEATURE_ENABLE_FUELS)
RegistryBuilder registryCrucible = new RegistryBuilder(); //{
registryCrucible.setType(CrucibleCrafting.class);
registryCrucible.setName(new ResourceLocation(ModInfo.MOD_ID, "recipes_" + CrucibleCrafting.RECIPE_PREFIX));
registryCrucible.setIDRange(0, 1000);
registryCrucible.create();
PrimalAPI.logger(1, "Custom Registry", WorkbenchCrafting.RECIPE_PREFIX);
RegistryBuilder registryWorkbench = new RegistryBuilder();
registryWorkbench.setType(WorkbenchCrafting.class);
registryWorkbench.setName(new ResourceLocation(ModInfo.MOD_ID, "recipes_" + WorkbenchCrafting.RECIPE_PREFIX));
registryWorkbench.setIDRange(0, 1000);
registryWorkbench.create();
} }
} }

View File

@@ -13,16 +13,12 @@ public class ModSounds {
public static SoundEvent PISTON_BELLOWS; public static SoundEvent PISTON_BELLOWS;
public static SoundEvent MUSKET_SHOT; public static SoundEvent MUSKET_SHOT;
public static SoundEvent BOW_TWANG; public static SoundEvent BOW_TWANG;
public static SoundEvent CHISEL_HIT;
public static SoundEvent CHISEL_HIT_FINISHED;
public static void registerSounds() public static void registerSounds()
{ {
PISTON_BELLOWS = registerSound("piston_bellows"); PISTON_BELLOWS = registerSound("piston_bellows");
MUSKET_SHOT = registerSound("musket_shot"); MUSKET_SHOT = registerSound("musket_shot");
BOW_TWANG = registerSound("bow_twang"); BOW_TWANG = registerSound("bow_twang");
CHISEL_HIT = registerSound("chisel_hit");
CHISEL_HIT_FINISHED = registerSound("chisel_hit_finished");
} }
private static SoundEvent registerSound(String name) private static SoundEvent registerSound(String name)

View File

@@ -1,20 +0,0 @@
package nmd.primal.forgecraft.init;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import nmd.primal.forgecraft.renders.blocks.*;
import nmd.primal.forgecraft.tiles.*;
public class ModTileRenders {
public static void init(){
ClientRegistry.bindTileEntitySpecialRenderer(TileForge.class, new TileForgeRender());
ClientRegistry.bindTileEntitySpecialRenderer(TilePistonBellows.class, new TilePistonBellowsRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileBloomery.class, new TileBloomeryRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileAnvil.class, new TileAnvilRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileBreaker.class, new TileBreakerRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileCastingForm.class, new TileCastingformRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileWorkbench.class, new TileWorkbenchRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileSharpBench.class, new TileSharpBenchRender());
}
}

View File

@@ -13,12 +13,11 @@ public class ModTiles {
registerTileEntity(TileForge.class, "firebox"); registerTileEntity(TileForge.class, "firebox");
registerTileEntity(TilePistonBellows.class, "pistonbellows"); registerTileEntity(TilePistonBellows.class, "pistonbellows");
registerTileEntity(TileBloomery.class, "bloomery"); registerTileEntity(TileBloomery.class, "bloomery");
registerTileEntity(TileBaseCrucible.class, "basecrucible");
registerTileEntity(TileAnvil.class, "anvil"); registerTileEntity(TileAnvil.class, "anvil");
registerTileEntity(TileBreaker.class, "breaker"); registerTileEntity(TileBreaker.class, "breaker");
registerTileEntity(TileCastingForm.class, "castingform"); registerTileEntity(TileCastingForm.class, "castingform");
registerTileEntity(TileNBTCrucible.class, "nbtcrucible"); registerTileEntity(TileCastingBlock.class, "castingblock");
registerTileEntity(TileWorkbench.class, "workbench");
registerTileEntity(TileSharpBench.class, "sharpbench");
} }
private static void registerTileEntity(Class<? extends TileEntity> tile_class, String baseName) { private static void registerTileEntity(Class<? extends TileEntity> tile_class, String baseName) {

View File

@@ -1,141 +0,0 @@
package nmd.primal.forgecraft.init.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.crafting.handlers.tile.CauldronRecipe;
import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import java.util.List;
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public class CauldronRecipes
{
@SubscribeEvent
public static void registerCauldronRecipes(RegistryEvent.Register<CauldronRecipe> event)
{
final IForgeRegistry<CauldronRecipe> recipes = event.getRegistry();
ItemStack defaultBronzeGladius = new ItemStack(ModItems.rawbronzegladius, 1);
ItemStack defaultCopperGladius = new ItemStack(ModItems.rawcoppergladius, 1);
ItemStack defaultWroughtIronGladius = new ItemStack(ModItems.rawwroughtirongladius, 1);
ItemStack defaultCleanIronGladius = new ItemStack(ModItems.rawcleanirongladius, 1);
ItemStack defaultSteelGladius = new ItemStack(ModItems.rawsteelgladius, 1);
ItemStack defaultWootzGladius = new ItemStack(ModItems.rawwootzgladius, 1);
ItemStack defaultCleanIronLongsword = new ItemStack(ModItems.rawcleanironlongsword, 1);
ItemStack defaultSteelLongsword = new ItemStack(ModItems.rawsteellongsword, 1);
ItemStack defaultWootzLongsword = new ItemStack(ModItems.rawwootzlongsword, 1);
ItemStack defaultIronSlayer = new ItemStack(ModItems.rawironslayer, 1);
ItemStack defaultCleanIronSlayer = new ItemStack(ModItems.rawcleanironslayer, 1);
ItemStack defaultSteelSlayer = new ItemStack(ModItems.rawsteelslayer, 1);
ItemStack defaultWootzSlayer = new ItemStack(ModItems.rawwootzslayer, 1);
List<ItemStack> recipeList = RecipeHelper.buildList(defaultBronzeGladius, defaultCopperGladius, defaultWroughtIronGladius, defaultCleanIronGladius, defaultSteelGladius, defaultWootzGladius,
defaultCleanIronLongsword, defaultSteelLongsword, defaultWootzLongsword,
defaultIronSlayer, defaultCleanIronSlayer, defaultSteelSlayer, defaultWootzSlayer);
for(ItemStack s : recipeList){
setDefaultNBT(s);
}
genRecipesForList(recipeList, recipes);
recipes.register(new CauldronRecipe(
5,
new FluidStack(FluidRegistry.WATER, 500),
null,
RecipeHelper.getOreStack("sand", 1),
RecipeHelper.getOreStack("slackLime", 4),
RecipeHelper.getOreStack("clayball", 2),
new ItemStack(ModItems.grindingwheel, 1),
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, ModItems.grindingwheel.getUnlocalizedName().toString()));
}
static void setDefaultNBT(ItemStack stack){
stack.getOrCreateSubCompound("tags");
stack.getSubCompound("tags").setInteger("smite", 0);
stack.getSubCompound("tags").setInteger("bane", 0);
stack.getSubCompound("tags").setInteger("fire", 0);
stack.getSubCompound("tags").setInteger("fortune", 0);
stack.getSubCompound("tags").setInteger("leech", 0);
stack.getSubCompound("tags").setInteger("sweeping", 0);
stack.getSubCompound("tags").setInteger("sharpness", 0);
stack.getSubCompound("tags").setBoolean("hot", false);
}
static CauldronRecipe genSmiteRecipe(ItemStack stack) {
return new CauldronRecipe(
8,
new FluidStack(PrimalAPI.Fluids.BRINE, 1000),
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
RecipeHelper.getOreStack("dustSilver", 2),
RecipeHelper.buildList(stack),
stack,
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, stack.getUnlocalizedName().toString().concat("smite"));
}
static CauldronRecipe genBaneRecipe(ItemStack stack) {
return new CauldronRecipe(
8,
new FluidStack(PrimalAPI.Fluids.BRINE, 1000),
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
RecipeHelper.getOreStack("foodPoison", 2),
RecipeHelper.buildList(stack),
stack,
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, stack.getUnlocalizedName().toString().concat("bane"));
}
static CauldronRecipe genFireRecipe(ItemStack stack) {
return new CauldronRecipe(
8,
new FluidStack(PrimalAPI.Fluids.BRINE, 1000),
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
RecipeHelper.getOreStack("dustBlaze", 2),
RecipeHelper.buildList(stack),
stack,
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, stack.getUnlocalizedName().toString().concat("fire"));
}
static CauldronRecipe genFortuneRecipe(ItemStack stack) {
return new CauldronRecipe(
8,
new FluidStack(PrimalAPI.Fluids.BRINE, 1000),
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
RecipeHelper.getOreStack("gemLapis", 2),
RecipeHelper.buildList(stack),
stack,
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, stack.getUnlocalizedName().toString().concat("fortune"));
}
/*static CauldronRecipe genLeechRecipe(ItemStack stack) {
return new CauldronRecipe(
5,
new FluidStack(FluidRegistry.WATER, 1000),
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
RecipeHelper.getOreStack("dustWitheredBone", 1),
RecipeHelper.buildList(stack),
stack,
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, stack.getUnlocalizedName().toString().concat("leech"));
}*/
static void genRecipesForList(List<ItemStack> list, IForgeRegistry<CauldronRecipe> recipes){
for(ItemStack s : list){
recipes.register(genSmiteRecipe(s));
recipes.register(genBaneRecipe(s));
recipes.register(genFireRecipe(s));
recipes.register(genFortuneRecipe(s));
}
}
}

View File

@@ -1,29 +0,0 @@
package nmd.primal.forgecraft.init.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.common.crafting.handlers.tile.DryingRecipe;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public class DryingRecipes
{
@SubscribeEvent
public static void registerDryingRecipes(RegistryEvent.Register<DryingRecipe> event)
{
final IForgeRegistry<DryingRecipe> recipes = event.getRegistry();
recipes.register(new DryingRecipe(
20,
new ItemStack(ModItems.softcrucible),
new ItemStack(ModBlocks.nbtCrucible)
).setRecipeName(ModInfo.MOD_ID + "_soft_crucible"));
}
}

View File

@@ -1,29 +0,0 @@
package nmd.primal.forgecraft.init.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.common.crafting.handlers.tile.HibachiRecipe;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public class HibachiRecipes
{
@SubscribeEvent
public static void registerHibachiRecipes(RegistryEvent.Register<HibachiRecipe> event)
{
final IForgeRegistry<HibachiRecipe> recipes = event.getRegistry();
recipes.register(new HibachiRecipe(
12,
new ItemStack(ModItems.softcrucible),
new ItemStack(ModBlocks.nbtCrucible)
).setRecipeName(ModInfo.MOD_ID + "_soft_crucible"));
}
}

View File

@@ -1,15 +1,12 @@
package nmd.primal.forgecraft.items; package nmd.primal.forgecraft.items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import nmd.primal.core.api.interfaces.crafting.IDictionaryName;
import nmd.primal.core.common.helper.RegistryHelper;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
/** /**
* Created by kitsu on 11/26/2016. * Created by kitsu on 11/26/2016.
*/ */
public class BaseItem extends Item implements IDictionaryName<Item> public class BaseItem extends Item
{ {
public BaseItem(String registryName) public BaseItem(String registryName)
{ {
@@ -27,30 +24,4 @@ public class BaseItem extends Item implements IDictionaryName<Item>
return false; return false;
} }
// ***************************************************************************** //
// IDictionaryName
// ***************************************************************************** //
private String[] dictionary_names;
@Override
public Item setDictionaryNames(String... strings)
{
this.dictionary_names = strings;
return this;
}
@Override
public String[] getDictionaryNames()
{
return this.dictionary_names;
}
@Override
public void registerDictionaryNames()
{
for (String name : this.getDictionaryNames())
//RegistryHelper.registerDictionaryNames(new ItemStack(this, 1, OreDictionary.WILDCARD_VALUE), REGISTRY_NAME);
RegistryHelper.registerDictionaryNames(new ItemStack(this), name);
}
} }

View File

@@ -1,24 +1,6 @@
package nmd.primal.forgecraft.items; package nmd.primal.forgecraft.items;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.init.ModItems;
import javax.annotation.Nullable;
import java.util.List;
/** /**
* Created by mminaie on 2/19/17. * Created by mminaie on 2/19/17.
@@ -26,205 +8,20 @@ import java.util.List;
public class BaseMultiItem extends BaseItem { public class BaseMultiItem extends BaseItem {
private Item.ToolMaterial mat; private Item.ToolMaterial mat;
private int ID;
public BaseMultiItem( String name, Item.ToolMaterial material) { public BaseMultiItem( String registryName, Item.ToolMaterial material, Integer ID) {
super(name); super(registryName);
mat = material; mat = material;
//this.setMaxStackSize(1); this.ID = ID;
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
BaseMultiItem item = (BaseMultiItem) stack.getItem();
Item itemStack = stack.getItem();
//TODO get the item name
if (stack.getItem() instanceof BaseMultiItem) {
if(stack.getTagCompound() != null) {
/***INGOTS***/
if(itemStack.equals(ModItems.ironingotball)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.0f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.01f;
}
}
if(itemStack.equals(ModItems.bronzeingotball)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.02f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.03f;
}
}
if(itemStack.equals(ModItems.ironcleaningotball)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.04f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.05f;
}
}
if(itemStack.equals(ModItems.steelingotball)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.06f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.07f;
}
}
if(itemStack.equals(ModItems.wootzingotball)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.08f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.09f;
}
}
/***CHUNKS***/
if(itemStack.equals(ModItems.wroughtironchunk)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.10f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.11f;
}
}
if(itemStack.equals(ModItems.bronzechunk)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.12f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.13f;
}
}
if(itemStack.equals(ModItems.ironcleanchunk)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.14f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.15f;
}
}
if(itemStack.equals(ModItems.steelchunk)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.16f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.17f;
}
}
if(itemStack.equals(ModItems.wootzchunk)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.18f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.19f;
}
}
}
}
return 0.0f;
}
});
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
if(!item.isEmpty())
{
if (item.hasTagCompound())
{
//tooltip.add(ChatFormatting.GRAY + "Upgrades: " + item.getTagCompound().getString("upgrades"));
/*
tooltip.add(ChatFormatting.GRAY + "Upgrades: " + (3 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
*/
}
}
} }
public Item.ToolMaterial getMaterial(Item item){ public Item.ToolMaterial getMaterial(Item item){
return mat; return mat;
} }
@Override public int getID() {
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) { return ID;
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
item.getTagCompound().setBoolean("hot", false);
} }
}
@Override
public void onUpdate(ItemStack stack, World world, Entity player, int itemSlot, boolean isSelected) {
//System.out.println(item.getTagCompound());
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setBoolean("hot", false);
}
if (stack.hasTagCompound()) {
if (stack.getTagCompound().getBoolean("hot")) {
if (stack.getTagCompound().getBoolean("hot")) {
player.setFire(1);
}
if (PrimalAPI.randomCheck(10)) {
stack.getTagCompound().setBoolean("hot", false);
player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.AMBIENT, 1.0F, PrimalAPI.getRandom().nextFloat() * 0.4F + 0.8F);
}
}
}
}
@Override
public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem)
{
if(!entityItem.getEntityWorld().isRemote) {
if (entityItem.getItem().hasTagCompound()) {
if (entityItem.isWet()) {
if (entityItem.getItem().getTagCompound().getBoolean("hot")) {
entityItem.getItem().getTagCompound().setBoolean("hot", false);
entityItem.getEntityWorld().playSound(null, entityItem.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.AMBIENT, 1.0F, PrimalAPI.getRandom().nextFloat() * 0.4F + 0.8F);
return true;
}
}
/*
if (!entityItem.isWet()) {
if (entityItem.getItem().getTagCompound().getBoolean("hot")) {
FireHelper.setFire(entityItem.getEntityWorld(), entityItem.getPosition());
return true;
}
}
*/
if (PrimalAPI.randomCheck(10)) {
if (entityItem.getItem().getTagCompound().getBoolean("hot")) {
entityItem.getItem().getTagCompound().setBoolean("hot", false);
entityItem.getEntityWorld().playSound(null, entityItem.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.AMBIENT, 1.0F, PrimalAPI.getRandom().nextFloat() * 0.4F + 0.8F);
return true;
}
}
}
}
return false;
}
} }

View File

@@ -1,57 +0,0 @@
package nmd.primal.forgecraft.items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import nmd.primal.core.api.interfaces.crafting.IDictionaryName;
import nmd.primal.core.common.helper.RegistryHelper;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by kitsu on 11/26/2016.
*/
public class BaseSingleItem extends BaseItem implements IDictionaryName<Item>
{
public BaseSingleItem(String registryName, int damage)
{
super(registryName);
this.setMaxStackSize(1);
this.canRepair = false;
this.setMaxDamage(damage);
}
public String getName() {
return this.getRegistryName().toString();
}
public static boolean isHidden()
{
return false;
}
// ***************************************************************************** //
// IDictionaryName
// ***************************************************************************** //
private String[] dictionary_names;
@Override
public Item setDictionaryNames(String... strings)
{
this.dictionary_names = strings;
return this;
}
@Override
public String[] getDictionaryNames()
{
return this.dictionary_names;
}
@Override
public void registerDictionaryNames()
{
for (String name : this.getDictionaryNames())
//RegistryHelper.registerDictionaryNames(new ItemStack(this, 1, OreDictionary.WILDCARD_VALUE), REGISTRY_NAME);
RegistryHelper.registerDictionaryNames(new ItemStack(this), name);
}
}

View File

@@ -1,51 +0,0 @@
package nmd.primal.forgecraft.items;
import net.minecraft.item.Item;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by mminaie on 11/11/17.
*/
public class ItemCrucible extends Item {
public ItemCrucible(String unlocalizedName) {
setUnlocalizedName(unlocalizedName);
this.setRegistryName(unlocalizedName);
this.setMaxStackSize(1);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
}
/*@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
if(!item.isEmpty())
{
if (item.hasTagCompound())
{
NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
NBTTagCompound nbtTag = item.getSubCompound("Items");
ItemStackHelper.loadAllItems(nbtTag, ingList);
tooltip.add(ChatFormatting.BLUE + "Items:" + ingList.get(0));
/*tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
}*/
}

View File

@@ -0,0 +1,897 @@
package nmd.primal.forgecraft.items;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.BloomeryBase;
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
import nmd.primal.forgecraft.blocks.Crucibles.CrucibleHot;
import nmd.primal.forgecraft.blocks.Forge;
import nmd.primal.forgecraft.blocks.IngotBall;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.tiles.TileBaseCrucible;
import nmd.primal.forgecraft.tiles.TileBloomery;
import nmd.primal.forgecraft.tiles.TileForge;
import java.util.List;
/**
* Created by mminaie on 1/23/17.
*/
public class ItemStoneTongs extends Item {
public ItemStoneTongs(String unlocalizedName) {
setUnlocalizedName(unlocalizedName);
this.setRegistryName(unlocalizedName);
//this.setMaxDamage(0);
//this.setHasSubtypes(true); //This just says the item has metadata
this.setMaxStackSize(1);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
//this.setDamage(item, 1000);
item.getTagCompound().setInteger("type", 0);
item.getTagCompound().setInteger("cooldown", 0);
item.getTagCompound().setTag("tags", tags);
item.getSubCompound("tags").setBoolean("hot", false);
item.getSubCompound("tags").setBoolean("emerald", false);
item.getSubCompound("tags").setInteger("diamond", 0);
item.getSubCompound("tags").setInteger("redstone", 0);
item.getSubCompound("tags").setInteger("lapis", 0);
item.getSubCompound("tags").setInteger("modifiers", 0);
}
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
/*
0 | Default StoneTongs
1 | Empty Crucible Hot
2 | Empty Crucible Cracked Hot
================================
3 | Hot Iron Crucible
4 | Hot Cooked Iron Crucible
5 | Hot Failed Iron Crucible
6 | Hot Iron Ingot
7 | Hot Iron Chunk
--------------------------------
8 | Hot Iron Pickaxe Head
9 | Hot Iron Axe Head
10 | Hot Iron Shovel Head
11 | Hot Iron Hoe Head
================================
12 | Hot Clean Iron Crucible
13 | Hot Cooked Clean Iron Crucible
14 | Hot Failed Clean Iron Crucible
15 | Hot Clean Iron Ball
16 | Hot Clean Iron Chunk
--------------------------------
17 | Hot Clean Iron Pickaxe Head
18 | Hot Clean Iron Axe Head
19 | Hot Clean Iron Shovel Head
20 | Hot Clean Iron Hoe Head
================================
21 | Hot Steel Crucible
22 | Hot Cooked Steel Crucible
23 | Hot Failed Steel Crucible
24 | Hot Steel Ingot
25 | Hot Steel Chunk
--------------------------------
26 | Hot Steel Pickaxe Head
27 | Hot Steel Axe Head
28 | Hot Steel Shovel Head
29 | Hot Steel Hoe Head
================================
30 | Hot Wootz Crucible
31 | Hot Cooked Wootz Crucible
32 | Hot Failed Wootz Crucible
33 | Hot Wootz Ingot
34 | Hot Wootz Chunk
--------------------------------
35 | Hot Wootz Pickaxe Head
36 | Hot Wootz Axe Head
37 | Hot Wootz Shovel Head
38 | Hot Wootz Hoe Head
================================
39 | Hot Bronze Crucible
40 | Hot Cooked Bronze Crucible
41 | Bronze Pickaxe Head
42 | Bronze Axe Head
43 | Bronze Shovel Head
44 | Bronze Hoe Head
45 | Hot Bronze Crucible Emerald
46 | Hot Cooked Bronze Crucible Emerald
47 | Hot Bronze Crucible Diamond
48 | Hot Cooked Bronze Crucible Diamond
49 | Hot Bronze Crucible Redstone
50 | Hot Cooked Bronze Crucible Redstone
51 | Hot Bronze Crucible Lapis
52 | Hot Cooked Bronze Crucible Lapis
*/
if(!world.isRemote) {
ItemStack itemstack = player.getHeldItem(hand);
//System.out.println(itemstack.getTagCompound().getInteger("type"));
//System.out.println(itemstack.getSubCompound("tags"));
/*****
Picks Up Hot Ingots from the Ground
*****/
if (world.getBlockState(pos).getBlock() instanceof BloomeryBase == false) {
if (world.getBlockState(pos).getBlock() instanceof IngotBall) {
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true) {
if (world.getBlockState(pos).getBlock() == ModBlocks.ironball) {
itemstack.getTagCompound().setInteger("type", 6);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.ironchunk) {
itemstack.getTagCompound().setInteger("type", 7);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.ironcleanball) {
itemstack.getTagCompound().setInteger("type", 15);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.ironcleanchunk) {
itemstack.getTagCompound().setInteger("type", 16);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.steelball) {
itemstack.getTagCompound().setInteger("type", 24);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.steelchunk) {
itemstack.getTagCompound().setInteger("type", 25);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/* TODO Wootz */
}
}
}
/*****
Picks Up Hot Crucibles from the Ground
*****/
if (world.getBlockState(pos).getBlock() instanceof BloomeryBase == false) {
if(world.getBlockState(pos).getBlock() instanceof CrucibleHot) {
TileBaseCrucible tileCrucible = (TileBaseCrucible) world.getTileEntity(pos);
/***************************
* Crucibles *
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.emptycruciblehot) {
itemstack.getTagCompound().setInteger("type", 1);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.emptycruciblecrackedhot) {
itemstack.getTagCompound().setInteger("type", 2);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/***************************
* Iron *
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.hotironcrucible) {
itemstack.getTagCompound().setInteger("type", 3);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedironcrucible) {
itemstack.getTagCompound().setInteger("type", 4);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.failedironcruciblehot) {
itemstack.getTagCompound().setInteger("type", 5);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/***************************
* Clean Iron *
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcleanironcrucible) {
itemstack.getTagCompound().setInteger("type", 12);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedcleanironcrucible) {
itemstack.getTagCompound().setInteger("type", 13);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.failedcleanironcruciblehot) {
itemstack.getTagCompound().setInteger("type", 14);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/***************************
* Steel *
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.hotsteelcrucible) {
itemstack.getTagCompound().setInteger("type", 21);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedsteelcrucible) {
itemstack.getTagCompound().setInteger("type", 22);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.failedsteelcruciblehot) {
itemstack.getTagCompound().setInteger("type", 23);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/* TODO Wootz */
/***************************
* Bronze *
*
45 | Hot Bronze Crucible Emerald
46 | Hot Cooked Bronze Crucible Emerald
47 | Hot Bronze Crucible Diamond
48 | Hot Cooked Bronze Crucible Diamond
49 | Hot Bronze Crucible Redstone
50 | Hot Cooked Bronze Crucible Redstone
51 | Hot Bronze Crucible Lapis
52 | Hot Cooked Bronze Crucible Lapis
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible) {
itemstack.getTagCompound().setInteger("type", 39);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible) {
itemstack.getTagCompound().setInteger("type", 40);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_emerald) {
itemstack.getTagCompound().setInteger("type", 45);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_emerald) {
itemstack.getTagCompound().setInteger("type", 46);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_diamond) {
itemstack.getTagCompound().setInteger("type", 47);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_diamond) {
itemstack.getTagCompound().setInteger("type", 48);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_redstone) {
itemstack.getTagCompound().setInteger("type", 49);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_redstone) {
itemstack.getTagCompound().setInteger("type", 50);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_lapis) {
itemstack.getTagCompound().setInteger("type", 51);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_lapis) {
itemstack.getTagCompound().setInteger("type", 52);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
}
/*****
Places the content from the Tongs to the World
*****/
if ((world.getBlockState(pos).getBlock() instanceof Crucible) || (world.getBlockState(pos).getBlock() instanceof CrucibleHot)) {
return EnumActionResult.FAIL;
} else if (world.getBlockState(pos).getMaterial() == Material.ROCK ||
world.getBlockState(pos).getMaterial() == Material.SAND ||
world.getBlockState(pos).getMaterial() == Material.IRON ||
world.getBlockState(pos).getMaterial() == Material.ANVIL )
{
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ());
if (world.getBlockState(tempPos).getBlock() == Blocks.AIR) {
switch (itemstack.getTagCompound().getInteger("type")) {
case 0:
break;
case 1:
world.setBlockState(tempPos, ModBlocks.emptycruciblehot.getDefaultState(), 2);
TileBaseCrucible tileCrucible1 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible1.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 2:
world.setBlockState(tempPos, ModBlocks.emptycruciblecrackedhot.getDefaultState(), 2);
TileBaseCrucible tileCrucible2 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible2.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 3:
world.setBlockState(tempPos, ModBlocks.hotironcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible3 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible3.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 4:
world.setBlockState(tempPos, ModBlocks.hotcookedironcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible4 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible4.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 5:
world.setBlockState(tempPos, ModBlocks.failedironcruciblehot.getDefaultState(), 2);
TileBaseCrucible tileCrucible5 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible5.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 6:
world.setBlockState(tempPos, ModBlocks.ironball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 2);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 7:
world.setBlockState(tempPos, ModBlocks.ironchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 2);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 8:
return EnumActionResult.FAIL;
case 9:
return EnumActionResult.FAIL;
case 10:
return EnumActionResult.FAIL;
case 11:
return EnumActionResult.FAIL;
case 12:
world.setBlockState(tempPos, ModBlocks.hotcleanironcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible12 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible12.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 13:
world.setBlockState(tempPos, ModBlocks.hotcookedcleanironcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible13 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible13.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 14:
world.setBlockState(tempPos, ModBlocks.failedcleanironcruciblehot.getDefaultState(), 2);
TileBaseCrucible tileCrucible14 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible14.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 15:
world.setBlockState(tempPos, ModBlocks.ironcleanball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 2);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 16:
world.setBlockState(tempPos, ModBlocks.ironcleanchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 2);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 17:
return EnumActionResult.FAIL;
case 18:
return EnumActionResult.FAIL;
case 19:
return EnumActionResult.FAIL;
case 20:
return EnumActionResult.FAIL;
case 21:
world.setBlockState(tempPos, ModBlocks.hotsteelcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible21 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible21.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 22:
world.setBlockState(tempPos, ModBlocks.hotcookedsteelcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible22 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible22.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 23:
world.setBlockState(tempPos, ModBlocks.failedsteelcruciblehot.getDefaultState(), 2);
TileBaseCrucible tileCrucible23 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible23.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 24:
world.setBlockState(tempPos, ModBlocks.steelball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 2);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 25:
world.setBlockState(tempPos, ModBlocks.steelchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 2);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 29:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible39 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible39.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 40:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible40 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible40.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
/***************************
* Bronze *
*
45 | Hot Bronze Crucible Emerald
46 | Hot Cooked Bronze Crucible Emerald
47 | Hot Bronze Crucible Diamond
48 | Hot Cooked Bronze Crucible Diamond
49 | Hot Bronze Crucible Redstone
50 | Hot Cooked Bronze Crucible Redstone
51 | Hot Bronze Crucible Lapis
52 | Hot Cooked Bronze Crucible Lapis
***************************/
case 45:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_emerald.getDefaultState(), 2);
TileBaseCrucible tileCrucible45 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible45.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 46:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_emerald.getDefaultState(), 2);
TileBaseCrucible tileCrucible46 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible46.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 47:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_diamond.getDefaultState(), 2);
TileBaseCrucible tileCrucible47 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible47.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 48:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_diamond.getDefaultState(), 2);
TileBaseCrucible tileCrucible48 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible48.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 49:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_redstone.getDefaultState(), 2);
TileBaseCrucible tileCrucible49 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible49.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 50:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_redstone.getDefaultState(), 2);
TileBaseCrucible tileCrucible50 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible50.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 51:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_lapis.getDefaultState(), 2);
TileBaseCrucible tileCrucible51 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible51.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 52:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_lapis.getDefaultState(), 2);
TileBaseCrucible tileCrucible52 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible52.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
}
}
}
}
/*****
Pulls the crucible from the Bloomery
*****/
if (world.getBlockState(pos).getBlock() instanceof BloomeryBase) {
if (itemstack.getTagCompound().getInteger("type") == 0) {
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.emptycruciblehot))) {
itemstack.getTagCompound().setInteger("type", 1);
itemstack.getTagCompound().setInteger("cooldown", 0);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.emptycruciblecrackedhot))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 2);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 3);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 4);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedironcruciblehot))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 5);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcleanironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 12);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedcleanironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 13);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedcleanironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 14);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotsteelcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 21);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedsteelcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 22);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedsteelcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 23);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 39);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 40);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
/***************************
* Bronze *
*
45 | Hot Bronze Crucible Emerald
46 | Hot Cooked Bronze Crucible Emerald
47 | Hot Bronze Crucible Diamond
48 | Hot Cooked Bronze Crucible Diamond
49 | Hot Bronze Crucible Redstone
50 | Hot Cooked Bronze Crucible Redstone
51 | Hot Bronze Crucible Lapis
52 | Hot Cooked Bronze Crucible Lapis
***************************/
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_emerald))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 45);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_emerald))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 46);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_diamond))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 47);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_diamond))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 48);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_redstone))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 49);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_redstone))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 50);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_lapis))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 51);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_lapis))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 52);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
}
/*****
Pulls the Tool Parts from the Forge
*****/
if(itemstack.getTagCompound().getInteger("type") == 0){
if (world.getBlockState(pos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(pos);
for (int i = 2; i < tile.getSlotListSize(); i++) {
if (tile.getSlotStack(i).getItem().equals(ModItems.ironchunkhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 7);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironingotballhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 6);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.pickaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 8);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 9);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironshovelhead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 10);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironhoehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 11);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironcleanchunkhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 16);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironcleaningotballhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 15);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironpickaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 17);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 18);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironshovelhead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 19);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironhoehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 20);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelchunkhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 25);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelingotballhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 24);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelpickaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 26);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 27);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelshovelhead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 28);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelhoehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 29);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
}
}
}
else return EnumActionResult.FAIL;
//System.out.println(itemstack.getTagCompound().getInteger("type"));
}
//System.out.println(player.getHeldItem(hand).getTagCompound().getInteger("type"));
return EnumActionResult.SUCCESS;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
//tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags"));
//tooltip.add(ChatFormatting.RED + "NBT: " + item.getTagCompound().getInteger("type"));
}
}

View File

@@ -1,121 +0,0 @@
package nmd.primal.forgecraft.items;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.crafting.handlers.irecipe.ToolCraftingRecipe;
import nmd.primal.core.common.items.tools.Gallagher;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.util.ToolMaterialMap;
import javax.annotation.Nullable;
import java.util.List;
public class SledgeHammer extends Gallagher implements ToolMaterialMap {
private int attack;
private double speed;
private ToolMaterial material;
public SledgeHammer(String name, Item.ToolMaterial material, Integer attack, Double speed) {
super(material, ToolCraftingRecipe.EnumToolType.MALLET_METAL);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setMaxDamage(material.getMaxUses()*3);
this.setHarvestLevel("pickaxe" , material.getHarvestLevel());
this.material=material;
this.attack = attack;
this.speed = speed;
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
/*@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
if(!world.isRemote){
EntityPlayer player = (EntityPlayer) entity;
if(player.inventory.getCurrentItem().getItem().equals(stack.getItem())) {
if(player.isPotionActive(MobEffects.MINING_FATIGUE)) {
if (!player.isSwingInProgress) {
player.removeActivePotionEffect(MobEffects.MINING_FATIGUE);
}
}
}
}
if(isSelected){
entity.setSprinting(false);
}
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitx, float hity, float hitz)
{
if(!world.isRemote) {
IBlockState state = world.getBlockState(pos);
Block block = world.getBlockState(pos).getBlock();
if(!(block instanceof AnvilBase)) {
if (!player.isSwingInProgress) {
int tempInt = 0;
player.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, (100 - ((materialModifiers.get(this.getMaterial()) * 13) + tempInt)), 100));
player.swingArm(hand);
return EnumActionResult.SUCCESS;
}
}
}
return EnumActionResult.FAIL;
}*/
public ToolMaterial getMaterial() {
return material;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
@Override
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
{
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
{
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", this.attack, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.speed, 0));
}
return multimap;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.add(ChatFormatting.GRAY + "Place a chisel and right click it");
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}

View File

@@ -1,580 +0,0 @@
package nmd.primal.forgecraft.items;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.api.interfaces.IPickup;
import nmd.primal.core.common.helper.NBTHelper;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.core.common.tiles.AbstractTileTank;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.AnvilBase;
import nmd.primal.forgecraft.blocks.NBTCrucible;
import nmd.primal.forgecraft.blocks.machine.Forge;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.tiles.TileNBTCrucible;
import nmd.primal.forgecraft.util.AnvilHandler;
import javax.annotation.Nullable;
import java.util.List;
/**
* Created by mminaie on 12/30/17.
*/
public class SlottedTongs extends Item implements IPickup, AnvilHandler{
@CapabilityInject(IItemHandler.class)
public static Capability<IItemHandler> ITEM_HANDLER;
public SlottedTongs(String unlocalizedName) {
this.setUnlocalizedName(unlocalizedName);
this.setRegistryName(unlocalizedName);
this.setMaxStackSize(1);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
NonNullList<ItemStack> renderList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
if(stack.getTagCompound() != null){
ItemStackHelper.loadAllItems(stack.getTagCompound(), renderList);
ItemStack slotStack = renderList.get(0);
if (stack.getItem() instanceof SlottedTongs) {
if (slotStack.getItem() instanceof ItemNBTCrucible) {
/***Render Empty Crucible***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 0) {
return 0.99f;
}
/***Render Level 1***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 1) {
return 0.011f;
}
/***Render Level 2***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 2) {
return 0.012f;
}
/***Render Level 3***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 3) {
return 0.013f;
}
/***Render Level 4***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 4) {
return 0.014f;
}
/***Render Level 5***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 5) {
return 0.015f;
}
/***Render Level Cooked***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 6) {
return 0.016f;
}
/***Render Failed***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 7) {
return 0.017f;
}
/***Render Hot***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 15) {
return 0.025f;
}
}
if (slotStack.getItem() instanceof ToolPart) {
ToolPart toolPart = (ToolPart) slotStack.getItem();
if (toolPart.getID() == "pickaxe") {
if (slotStack.getSubCompound("tags") != null) {
if (slotStack.getSubCompound("tags").getBoolean("hot")) {
return 0.03f;
}
if (!slotStack.getSubCompound("tags").getBoolean("hot")) {
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON) {
return 0.04f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON) {
return 0.05f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL) {
return 0.06f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL) {
return 0.07f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BRONZE) {
return 0.08f;
}
}
}
}
if (toolPart.getID() == "axe") {
if (slotStack.getSubCompound("tags") != null) {
if (slotStack.getSubCompound("tags").getBoolean("hot")) {
return 0.09f;
}
if (!slotStack.getSubCompound("tags").getBoolean("hot")) {
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON) {
return 0.10f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON) {
return 0.11f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL) {
return 0.12f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL) {
return 0.13f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BRONZE) {
return 0.14f;
}
}
}
}
if (toolPart.getID() == "shovel") {
if (slotStack.getSubCompound("tags") != null) {
if (slotStack.getSubCompound("tags").getBoolean("hot")) {
return 0.15f;
}
if (!slotStack.getSubCompound("tags").getBoolean("hot")) {
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON) {
return 0.16f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON) {
return 0.17f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL) {
return 0.18f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL) {
return 0.19f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BRONZE) {
return 0.20f;
}
}
}
}
if (toolPart.getID() == "hoe") {
if (slotStack.getSubCompound("tags") != null) {
if (slotStack.getSubCompound("tags").getBoolean("hot")) {
return 0.21f;
}
if (!slotStack.getSubCompound("tags").getBoolean("hot")) {
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON) {
return 0.22f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON) {
return 0.23f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL) {
return 0.24f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL) {
return 0.25f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BRONZE) {
return 0.26f;
}
}
}
}
}
if (slotStack.getItem() instanceof BaseMultiItem) {
Item slotItem = slotStack.getItem();
if (slotStack.getTagCompound() != null) {
if (!slotStack.getTagCompound().getBoolean("hot")) {
if (slotItem.equals(ModItems.bronzeingotball)) {
return 0.27f;
}
if (slotItem.equals(ModItems.ironingotball)) {
return 0.28f;
}
if (slotItem.equals(ModItems.ironcleaningotball)) {
return 0.29f;
}
if (slotItem.equals(ModItems.steelingotball)) {
return 0.30f;
}
if (slotItem.equals(ModItems.wootzingotball)) {
return 0.31f;
}
if (slotItem.equals(ModItems.bronzechunk)) {
return 0.32f;
}
if (slotItem.equals(ModItems.wroughtironchunk)) {
return 0.33f;
}
if (slotItem.equals(ModItems.ironcleanchunk)) {
return 0.34f;
}
if (slotItem.equals(ModItems.steelchunk)) {
return 0.35f;
}
if (slotItem.equals(ModItems.wootzchunk)) {
return 0.36f;
}
}
if (slotStack.getTagCompound().getBoolean("hot")) {
if (slotItem.equals(ModItems.bronzeingotball)) {
return 0.37f;
}
if (slotItem.equals(ModItems.ironingotball)) {
return 0.38f;
}
if (slotItem.equals(ModItems.ironcleaningotball)) {
return 0.39f;
}
if (slotItem.equals(ModItems.steelingotball)) {
return 0.40f;
}
if (slotItem.equals(ModItems.wootzingotball)) {
return 0.41f;
}
if (slotItem.equals(ModItems.bronzechunk)) {
return 0.42f;
}
if (slotItem.equals(ModItems.wroughtironchunk)) {
return 0.43f;
}
if (slotItem.equals(ModItems.ironcleanchunk)) {
return 0.44f;
}
if (slotItem.equals(ModItems.steelchunk)) {
return 0.45f;
}
if (slotItem.equals(ModItems.wootzchunk)) {
return 0.46f;
}
}
}
}
}
}
return 0.0F;
}
});
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitx, float hity, float hitz)
{
if(!world.isRemote) {
if (hand.equals(player.getActiveHand())) {
IBlockState state = world.getBlockState(pos);
Block block = world.getBlockState(pos).getBlock();
ItemStack itemstack = player.getHeldItem(hand);
SlottedTongs itemstackItem = (SlottedTongs) itemstack.getItem();
IItemHandler inventory = itemstack.getCapability(ITEM_HANDLER, null);
ItemStack slotStack = inventory.getStackInSlot(0).copy();
if (!(block instanceof AnvilBase)) {
if (!(block instanceof Forge)) {
if (slotStack.isEmpty()) {
if (block instanceof NBTCrucible) {
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
ItemStack tempStack = takeBlock(world, pos, state, face, player, block).copy();
inventory.insertItem(0, tempStack, false);
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
world.markTileEntityForRemoval(tile);
//itemstack.getItem().updateItemStackNBT(itemstack.getTagCompound());
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
}
if (!slotStack.isEmpty()) {
if (slotStack.getItem() instanceof ItemNBTCrucible) {
NBTTagCompound tag = slotStack.getSubCompound("BlockEntityTag").copy();
if (tag != null) {
ItemBlock temp = (ItemBlock) slotStack.getItem();
int i = this.getMetadata(slotStack.getMetadata());
IBlockState iblockstate1 = temp.getBlock().getStateForPlacement(world, pos, face, hitx, hity, hitz, i, player, hand);
temp.placeBlockAt(slotStack, player, world, pos.up(1), face, hitx, hity, hitz, iblockstate1);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
}
}
/*****
DROPS the ToolParts into the World
*****/
if (!slotStack.isEmpty()) {
if (slotStack.getItem() instanceof ToolPart) {
ItemStack tempStack = slotStack;
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
}
/*****
Cools the Ingots on the Tongs
*****/
if (!slotStack.isEmpty()) {
if (world.getBlockState(pos).getBlock() == PrimalAPI.Blocks.BARREL) {
AbstractTileTank tileTank = (AbstractTileTank) world.getTileEntity(pos);
if (slotStack.getTagCompound().getBoolean("hot")) {
if (tileTank.getContainedFluid().getFluid().equals(FluidRegistry.WATER) ||
tileTank.getContainedFluid().getFluid().equals(PrimalAPI.Fluids.RAIN_WATER)
) {
ItemStack tempStack = slotStack.copy();
tempStack.getTagCompound().setBoolean("hot", false);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
world.playSound(null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.AMBIENT, 1.0F, PrimalAPI.getRandom().nextFloat() * 0.4F + 0.8F);
return EnumActionResult.SUCCESS;
}
}
}
}
/*****
DROPS the Ingots into the World
*****/
if (!slotStack.isEmpty()) {
if (slotStack.getItem() instanceof BaseMultiItem) {
ItemStack tempStack = slotStack.copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
if (!(slotStack.getItem() instanceof BaseMultiItem)) {
if (RecipeHelper.isOreName(slotStack.getItem(), "ingotIron")) {
ItemStack tempStack = slotStack.copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
if (RecipeHelper.isOreName(slotStack.getItem(), "nuggetIron")) {
ItemStack tempStack = slotStack.copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
if (RecipeHelper.isOreName(slotStack.getItem(), "ingotSteel")) {
ItemStack tempStack = slotStack.copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
if (RecipeHelper.isOreName(slotStack.getItem(), "nuggetSteel")) {
ItemStack tempStack = slotStack.copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
}
}
}
}
}
}
return EnumActionResult.FAIL;
}
public ItemStack getItem(World world, BlockPos pos, IBlockState state, Block block)
{
block = world.getBlockState(pos).getBlock();
return NBTHelper.getStackBlockNBT(world, pos, state, new ItemStack(Item.getItemFromBlock(block), 1, block.damageDropped(state)));
}
public ItemStack takeBlock(World world, BlockPos pos, IBlockState state, EnumFacing face, EntityPlayer player, Block block)
{
if (!world.isRemote) {
block = world.getBlockState(pos).getBlock();
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileNBTCrucible) {
return this.getItem(world, pos, state, block);
//PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, this.getItem(world, pos, state, block));
//world.updateComparatorOutputLevel(pos, state.getBlock());
}
}
return ItemStack.EMPTY;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
/*if(!stack.isEmpty())
{
IItemHandler inventory = stack.getCapability(ITEM_HANDLER, null);
ItemStack slotStack = inventory.getStackInSlot(0).copy();
if (!slotStack.isEmpty())
{
tooltip.add(ChatFormatting.GRAY + "Holding: " + slotStack.getItem().getUnlocalizedName());
/*
tooltip.add(ChatFormatting.GRAY + "Upgrades: " + (3 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
*/
}
@Override
public ICapabilityProvider initCapabilities(final ItemStack stack, NBTTagCompound nbt)
{
return new ICapabilitySerializable<NBTTagCompound>()
{
@Override
public NBTTagCompound serializeNBT() {
return itemHandler .serializeNBT();
}
@Override
public void deserializeNBT(NBTTagCompound nbt) {
itemHandler.deserializeNBT(nbt);
}
final ItemStackHandler itemHandler = new ItemStackHandler(1);
private NBTTagCompound cachedNetData;
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing)
{
if (capability == ITEM_HANDLER)
return true;
return false;
}
@SuppressWarnings("unchecked")
@Nullable
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
{
if (capability == ITEM_HANDLER)
return (T) itemHandler;
return null;
}
};
}
/**
* Update this with what you need to send to the client
*/
@Override
public NBTTagCompound getNBTShareTag(ItemStack stack)
{
ItemStackHandler h = (ItemStackHandler)stack.getCapability(ITEM_HANDLER, null);
if(stack.getTagCompound() != null) {
NBTTagCompound tag = stack.getTagCompound().copy();
tag.setTag("Inventory", h.serializeNBT());
tag.removeTag("changeNumber");
return tag;
}
return null;
}
/**
* What does the item do when it receives nbt Info
*/
@Override
public void readNBTShareTag(ItemStack stack, @Nullable NBTTagCompound nbt)
{
if (nbt != null)
{
ItemStackHandler h = (ItemStackHandler)stack.getCapability(ITEM_HANDLER, null);
h.deserializeNBT(nbt.getCompoundTag("Inventory"));
//nbt.removeTag("Inventory");
stack.setTagCompound(nbt);
}
}
@Override
public boolean getShareTag()
{
return true;
}
@Override
public boolean updateItemStackNBT(NBTTagCompound nbt)
{
return true;
}
public void markDirty(ItemStack stack) {
NBTTagCompound tag = stack.getTagCompound();
IItemHandler inventory = stack.getCapability(ITEM_HANDLER, null);
NonNullList<ItemStack> sendList = NonNullList.<ItemStack>withSize(1, inventory.getStackInSlot(0));
if (stack.getTagCompound() != null) {
stack.getTagCompound().setInteger("changeNumber", tag.getInteger("changeNumber") + 1);
ItemStackHelper.saveAllItems(stack.getTagCompound(), sendList);
} else {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setInteger("changeNumber", 0);
ItemStackHelper.saveAllItems(tagCompound, sendList);
stack.setTagCompound(tagCompound);
}
}
}

View File

@@ -1,14 +0,0 @@
package nmd.primal.forgecraft.items;
import nmd.primal.core.common.items.tools.WorkBlade;
import nmd.primal.forgecraft.ModInfo;
public class Workblade extends WorkBlade {
public Workblade(String name, ToolMaterial material, float speed) {
super(material, speed);
this.setRegistryName(name);
this.setUnlocalizedName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
}

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