Merge branch 'master-1.12' into bugfix-1.12

This commit is contained in:
Mohammad-Ali Minaie
2018-10-22 08:18:09 -04:00
2593 changed files with 24513 additions and 12559 deletions

472
.idea/workspace.xml generated
View File

@@ -2,29 +2,9 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="2374d888-04b5-4300-967c-f257dee6cdd6" name="Default" comment="">
<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" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -33,33 +13,23 @@
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FUSProjectUsageTrigger">
<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">
<favorites_list name="ForgeCraft" />
</component>
<component name="FileEditorManager">
<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>
<leaf />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -72,279 +42,110 @@
<entry key="$PROJECT_DIR$/../PrimalCore" value="2962994312000" />
</map>
</option>
<option name="externalProjectsViewState">
<projects_view />
</option>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<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">
<option name="y" value="22" />
<option name="width" value="1680" />
<option name="height" value="1050" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<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>
<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>
<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>
<expand>
<path>
<item name="ForgeCraft" type="b2602c69:ProjectViewProjectNode" />
<item name="ForgeCraft" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="ForgeCraft" type="b2602c69:ProjectViewProjectNode" />
<item name="ForgeCraft" type="462c0819:PsiDirectoryNode" />
<item name="kfc" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="ForgeCraft" type="b2602c69:ProjectViewProjectNode" />
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
</path>
<path>
<item name="ForgeCraft" type="b2602c69:ProjectViewProjectNode" />
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
<item name="&lt; 1.8 &gt;" type="70bed36:NamedLibraryElementNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="FullScreen" value="true" />
</component>
<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 name="RunManager">
<configuration default="true" type="Applet" factoryName="Applet">
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<properties />
<listeners />
<method v="2">
<option name="Make" enabled="true" />
</method>
</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 />
</configuration>
<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" />
<module />
<method />
</configuration>
<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="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
<method />
</configuration>
<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" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<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 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" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
@@ -353,72 +154,57 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1482033001334</updated>
<workItem from="1538459982472" duration="37000" />
<workItem from="1538460037447" duration="7000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="44000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="0" width="1680" height="1050" extended-state="6" />
<editor active="true" />
<frame x="0" y="22" width="1680" height="1050" extended-state="0" />
<layout>
<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 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 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 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" 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="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 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 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 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 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 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="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="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 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="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 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="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 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 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="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 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 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="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 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 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 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 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 id="Structure" order="0" weight="0.25" />
<window_info id="Nl-Palette" order="1" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info id="Image Layers" order="3" />
<window_info id="Designer" order="4" />
<window_info id="UI Designer" order="5" />
<window_info id="Capture Tool" order="6" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info active="true" anchor="bottom" id="Terminal" order="7" visible="true" weight="0.47181627" />
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" weight="0.32958034" />
<window_info anchor="bottom" id="Version Control" order="9" />
<window_info anchor="bottom" id="Database Changes" order="10" show_stripe_button="false" />
<window_info anchor="right" id="Database" order="0" />
<window_info anchor="right" id="Commander" order="1" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="2" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="3" weight="0.25" />
<window_info anchor="right" id="Palette" order="4" />
<window_info anchor="right" id="Capture Analysis" order="5" />
<window_info anchor="right" id="Theme Preview" order="6" />
<window_info anchor="right" id="Properties" order="7" />
<window_info anchor="right" id="Palette&#9;" order="8" />
<window_info anchor="right" id="Maven Projects" order="9" />
<window_info anchor="right" content_ui="combo" id="Project" order="10" visible="true" weight="0.25457877" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/CommonUtils.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" />
</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>
<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" />
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java" />
</component>
</project>

BIN
exampleModifiers.xlsx Normal file

Binary file not shown.

View File

@@ -1,14 +1,15 @@
# To-Dos
## Bugs
- [ ] Texture mismatch for 4diamond 1 redstone
- [ ] ForgeHammer extend Gallagher
- [ ] Placement bug for crucible from tongs
## Current Feature
- [ ] FIX LONGBOW
- [ ] Copper Tools
- [ ] Untick Bloomery and Forge
- [ ] Craft Tweaker Support
- [ ] Config Usage
- [ ] Config for lowering fortune multiplier
- [ ] Hardened Leather Helmet Inventory Model
- [ ] Recipe Handler for Block Breaker
## Feature Musket
- [ ] Create powder charge item (copper, charcoal, gunpowder)
@@ -22,18 +23,24 @@
- [ ] Create lock assembly item
## Backlog
- [ ] Play a sound when bloomery or forge finishes
- [ ] Hardness and Resistance calculation for durability damage
- [ ] Hardened Leather Helmet Inventory Model
- [ ] Add Achievements
- [ ] Bloomery Print out
- [ ] Random Floats for hot texture
- [ ] Mass Ore Production
- [ ] Silver/Lead Production
- [ ] Sparks to forging
- [x] Move Ingot break into chunks logic out of the block and into the ForgeHammer
- [ ] Add Iron Ring Recipe
- [ ] Add chainmail recipe
- [ ] Add Iron Shield
- [ ] 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
### Tid-Bits
NonNullList<ItemStack> tempDrops = NonNullList.<ItemStack>create();
ItemStack iron_gear = RecipeHelper.getFirstDictionaryMatch("gearIron", 1);
```
sed -i -- 's/iron/steel/g' *
rm *.json--
@@ -41,6 +48,33 @@ rename s/iron/steel/ iron*
```
### Completed
- [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

View File

@@ -6,8 +6,8 @@ org.gradle.jvmargs=-Xmx3G
mod_group=nmd.primal.forgecraft
mod_name=ForgeCraft
mod_version=1.6.14
forge_version=14.23.4.2744
mod_version=1.6.31
forge_version=14.23.4.2765
mcp_mappings=snapshot_20171003
mc_version=1.12.2

View File

@@ -0,0 +1,6 @@
<?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

@@ -0,0 +1,16 @@
<?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

@@ -0,0 +1,117 @@
<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>

17
kfc/idea_backup/misc.xml Normal file
View File

@@ -0,0 +1,17 @@
<?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>

6
kfc/idea_backup/vcs.xml Normal file
View File

@@ -0,0 +1,6 @@
<?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

@@ -5,9 +5,13 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import nmd.primal.forgecraft.items.parts.BronzeToolPart;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.tools.*;
import nmd.primal.forgecraft.items.tools.CustomAxe;
import nmd.primal.forgecraft.items.tools.CustomHoe;
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
import nmd.primal.forgecraft.items.tools.CustomShovel;
import nmd.primal.forgecraft.util.ToolNBT;
/**
@@ -16,104 +20,44 @@ import nmd.primal.forgecraft.util.ToolNBT;
public class CommonEvents implements ToolNBT {
@SubscribeEvent(priority= EventPriority.LOWEST, receiveCanceled=true)
@SubscribeEvent(priority= EventPriority.HIGHEST, receiveCanceled=true)
public void onItemCrafted(PlayerEvent.ItemCraftedEvent event) {
if(!event.player.getEntityWorld().isRemote) {
if (event.crafting.getItem() instanceof CustomPickaxe || event.crafting.getItem() instanceof BronzePickaxe) {
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 CustomPickaxe) {
doToolNBT(event);
}
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
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 CustomAxe ) {
doToolNBT(event);
}
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 (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 ) {
doToolNBT(event);
}
if (event.crafting.getItem() instanceof CustomHoe || event.crafting.getItem() instanceof BronzeHoe) {
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 CustomHoe) {
doToolNBT(event);
}
if (event.crafting.getItem() instanceof ToolPart || event.crafting.getItem() instanceof BronzeToolPart) {
NBTTagCompound tempTag = new NBTTagCompound();
if (event.crafting.getItem() instanceof ToolPart) {
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 CustomAxe) {
doQuickNBT(event, i, a);
PlayerHelper.spawnItemOnPlayer(event.player.world, event.player, new ItemStack(PrimalAPI.Items.LACQUER_STICK, 1));
}
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 CustomPickaxe) {
doQuickNBT(event, i, a);
PlayerHelper.spawnItemOnPlayer(event.player.world, event.player, new ItemStack(PrimalAPI.Items.LACQUER_STICK, 1));
}
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 CustomShovel) {
doQuickNBT(event, i, a);
PlayerHelper.spawnItemOnPlayer(event.player.world, event.player, new ItemStack(PrimalAPI.Items.LACQUER_STICK, 1));
}
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);
if (a.getItem() instanceof CustomHoe) {
doQuickNBT(event, i, a);
PlayerHelper.spawnItemOnPlayer(event.player.world, event.player, new ItemStack(PrimalAPI.Items.LACQUER_STICK, 1));
}
}
}
@@ -121,5 +65,28 @@ public class CommonEvents implements ToolNBT {
}
}
private void doQuickNBT(PlayerEvent.ItemCraftedEvent event, Integer i, ItemStack a){
NBTTagCompound tempTag;
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);
}
private void doToolNBT(PlayerEvent.ItemCraftedEvent event) {
NBTTagCompound tempTag;
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) {
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());
}
}
}
}
}

View File

@@ -11,7 +11,6 @@ import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
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.init.*;
import nmd.primal.forgecraft.proxy.CommonProxy;

View File

@@ -2,8 +2,12 @@ package nmd.primal.forgecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
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.Item.ModItems;
@@ -18,7 +22,7 @@ public class ModInfo {
//public static final String MOD_PREFIX = MOD_ID + ":";
public static final String MOD_CHANNEL = MOD_ID;
public static final String MOD_VERSION = "1.6.14";
public static final String MOD_VERSION = "1.6.31";
public static final String MC_VERSIONS = "[1.12.0, 1.13.0)";
public static final String DEPENDENCIES = "required-after:forge@[14.21.1.2400,);" + "required-after:primal@[0.6.69,);";
@@ -46,13 +50,13 @@ public class ModInfo {
};
// ***************************************************************************** //
// PrimalAPI.Registries
// ForgeCraft.Registries
// ***************************************************************************** //
public static class Registries
{
// In-World Recipes
//public static final IForgeRegistry<CrucibleCrafting> CRUCIBLE_CRAFTINGS = GameRegistry.findRegistry(CrucibleCrafting.class);
public static final IForgeRegistry<CrucibleCrafting> CRUCIBLE_CRAFTING = GameRegistry.findRegistry(CrucibleCrafting.class);
public static final IForgeRegistry<WorkbenchCrafting> WORKBENCH_CRAFTING = GameRegistry.findRegistry(WorkbenchCrafting.class);
}
}

View File

@@ -1,161 +0,0 @@
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.entity.item.EntityItem;
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)
{
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();
System.out.println(dropStack);
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();
}
@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,7 +0,0 @@
package nmd.primal.forgecraft.blocks.Anvil;
/**
* Created by mminaie on 6/10/17.
*/
public class AnvilSteel {
}

View File

@@ -0,0 +1,71 @@
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.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);
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,4 +1,4 @@
package nmd.primal.forgecraft.blocks.Anvil;
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;

View File

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

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.blocks.Anvil;
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@@ -34,7 +34,6 @@ public class AnvilStone extends AnvilBase {
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)) {
@@ -55,8 +54,9 @@ public class AnvilStone extends AnvilBase {
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);
@@ -70,6 +70,7 @@ public class AnvilStone extends AnvilBase {
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);
@@ -83,6 +84,7 @@ public class AnvilStone extends AnvilBase {
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);
@@ -95,6 +97,7 @@ public class AnvilStone extends AnvilBase {
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);
@@ -109,15 +112,16 @@ public class AnvilStone extends AnvilBase {
}
}
}
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);
//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;
}
doAnvilRecipe(pItem, stack12, tempArray, world, tile, pos, player);
return true;
}
//}
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
return true;

View File

@@ -0,0 +1,472 @@
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.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.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 (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

@@ -1,10 +1,21 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.MapColor;
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.forgecraft.ModInfo;
/**
* Created by kitsu on 12/3/2016.
@@ -20,10 +31,89 @@ public abstract class CustomContainerFacing extends BlockContainer {
this.setUnlocalizedName(registryName);
this.setHardness(3.0f);
this.setResistance(4.0f);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
protected CustomContainerFacing(Material material, MapColor color)
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
super(material, color);
//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,26 +1,51 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumBlockRenderType;
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.
*/
public abstract class CustomFacing extends Block {
public abstract class CustomFacing extends BlockDirectional {
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
protected CustomFacing(Material material)
{
protected CustomFacing(Material material, String name) {
super(material);
this.setRegistryName(name);
this.setUnlocalizedName(name);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
protected CustomFacing(Material material, MapColor color)
@Override
public boolean isFullCube(IBlockState state)
{
super(material, color);
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.Crucibles;
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.ITileEntityProvider;
@@ -34,6 +34,8 @@ import nmd.primal.forgecraft.tiles.TileNBTCrucible;
import java.util.Random;
import static net.minecraft.util.EnumHand.MAIN_HAND;
/**
* Created by mminaie on 11/11/17.
@@ -58,8 +60,14 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing face, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
if(hand == player.getActiveHand()) {
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
if(hand.equals(MAIN_HAND)) {
System.out.println(player.inventory.getCurrentItem());
System.out.println(hand);
ItemStack pItem = player.inventory.getCurrentItem().copy();
pItem.setCount(1);
@@ -72,36 +80,46 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
}
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getCrucibleItem(world, pos, state, player));
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
world.markTileEntityForRemoval(tile);
return true;
}
}
}
/**SET INGREDIENT ARRAY FOR THE CRUCIBLE NOW**/
/**SET INGREDIENT ARRAY FOR THE CRUCIBLE NOW**/
if( player.inventory.getSlotFor(player.inventory.getCurrentItem()) != -1 ) {
ItemStack pItem = player.inventory.getCurrentItem().copy();
pItem.setCount(1);
if (!player.isSneaking()) {
if (!pItem.isEmpty()) {
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;
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**/
}
/**CLEARS THE INVENTORY**/
if(hand.equals(MAIN_HAND)) {
if (player.isSneaking()) {
ItemStack pItem = player.inventory.getCurrentItem().copy();
if (pItem.isEmpty()) {
if (tile.getHot()!=15) {
if (tile.getHot() != 15) {
if (!tile.getStatus()) {
for (int i = 0; i < tile.ingList.size(); i++) {
if (!tile.ingList.get(i).isEmpty()) {
@@ -119,10 +137,13 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
}
}
}
/**REMOVE COOKED ITEM**/
if (player.isSneaking() == true) {
}
/**REMOVE COOKED ITEM**/
if (player.isSneaking() == true) {
if (hand.equals(MAIN_HAND)) {
ItemStack pItem = player.inventory.getCurrentItem().copy();
if (pItem.isEmpty()) {
if (tile.getStatus() && tile.getHot()==6) {
if (tile.getStatus() && tile.getHot() == 6) {
ItemStack dropStack = tile.getDrops().copy();
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, 0), 2);
tile.setHot(0);
@@ -170,6 +191,7 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
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;
}
}
@@ -212,11 +234,9 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
if (tileentity instanceof TileNBTCrucible) {
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
if(NBTHelper.hasNBT(stack)){
NBTTagCompound tag = stack.getSubCompound("BlockEntityTag").copy();
ItemStack temp = stack.copy();
int i = temp.getItem().getMetadata(stack.getMetadata());
//TODO update this with number instead of the boolean
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, tile.getHot()), 2);
NBTTagCompound tag = stack.getTagCompound();
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, tile.getHot()), 2);
//tile.readNBT(tag);
}
}
}

View File

@@ -1,126 +0,0 @@
package nmd.primal.forgecraft.blocks.ingots;
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.PrimalAPI;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.BlockCustomBase;
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 AABBsize;
public IngotBall(Material material, String registryName, Float hardness, String size){
super(material, registryName, hardness);
this.setTickRandomly(true);
this.AABBsize = size;
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)));
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
if(this.AABBsize.equals("small")){
return boundBoxSmall;
}else
return boundBoxLarge;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
System.out.println("Print Something");
System.out.println(stack.getTagCompound());
//worldIn.setBlockState(pos, state.withProperty(PrimalAPI.States.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(PrimalAPI.States.ACTIVE)){
world.setBlockState(pos, Blocks.FLOWING_LAVA.getDefaultState().withProperty(BlockDynamicLiquid.LEVEL, 1), 3);
}
if(!state.getValue(PrimalAPI.States.ACTIVE)){
//PlayerHelper.spawnItemOnGround(world, pos, new ItemStack(this, 1));
}
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(PrimalAPI.States.ACTIVE) == false) {
i = 0;
return i;
}
if( state.getValue(PrimalAPI.States.ACTIVE) == true) {
i = 1;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false));
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(true));
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {PrimalAPI.States.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(PrimalAPI.States.ACTIVE) == true) {
world.setBlockState(pos, state.withProperty(PrimalAPI.States.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

@@ -105,13 +105,12 @@ public class BloomeryBase extends CustomContainerFacing implements ITileEntityPr
if(pItem.isEmpty()) {
if(!player.isSneaking()){
if(world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE) == true){
if(world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE)){
Integer bloomeryHeat = tile.getHeat();
String display = "\n" + "Current Temp: " + bloomeryHeat.toString() +
" Fuel Remaining: " + tileItem.getCount();
String display = "Fuel Remaining: " + tileItem.getCount() + "\n" + "Current Temp: " + bloomeryHeat.toString();
ITextComponent itextcomponent = new TextComponentString(display);
player.sendStatusMessage(itextcomponent, false);
NBTTagCompound tag = tile.getSlotStack(1).getSubCompound("BlockEntityTag");
if(tag != null) {
@@ -121,26 +120,44 @@ public class BloomeryBase extends CustomContainerFacing implements ITileEntityPr
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) {
Integer minTemp = recipe.getCookTemp();
Integer cookCounter = tile.getCookCounter();
Integer idealTime = recipe.getCookTime();
Integer remainingTime = idealTime - cookCounter;
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: " + tileItem1.getDisplayName() +
" Target Temp: " + minTemp.toString() +
" Time Left: " + remainingTime.toString();
String display2 = tileItem1.getDisplayName() + "finished.";
ITextComponent itextcomponent1 = null;
if (tileItem1.getSubCompound("BlockEntityTag").getBoolean("status")) {
itextcomponent1 = new TextComponentString(display2);
} else itextcomponent1 = new TextComponentString(display1);
player.sendStatusMessage(itextcomponent1, false);
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);
}
}
}
}

View File

@@ -19,6 +19,7 @@ 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;
@@ -49,40 +50,44 @@ public class Breaker extends CustomContainerFacing implements BreakerHandler {
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 (hand.equals(player.getActiveHand())) {
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
if(state.getValue(PrimalAPI.States.ACTIVE) == true && player.isSneaking() && pItem.isEmpty()){
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));
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(!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);
tile.setCharge(0);
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);
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;
}
}
if(pItem.getItem() instanceof Gallagher){
tile.setSlotStack(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
return false;

View File

@@ -31,7 +31,6 @@ 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.items.parts.BronzeToolPart;
import nmd.primal.forgecraft.tiles.TileCastingForm;
import nmd.primal.forgecraft.util.CastingFormHandler;
import nmd.primal.forgecraft.util.ToolNBT;
@@ -60,23 +59,27 @@ public class CastingForm extends CustomContainerFacing implements CastingFormHan
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
IItemHandler inventory = pItem.getCapability(ITEM_HANDLER, null);
ItemStack slotStack = inventory.getStackInSlot(0).copy();
if(pItem.getItem() != ModItems.slottedtongs) {
doInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
}
if(pItem.getItem().equals(ModItems.slottedtongs)){
SlottedTongs tongs = (SlottedTongs) pItem.getItem();
if(slotStack.getItem().equals(Item.getItemFromBlock(ModBlocks.nbtCrucible))) {
ItemStack tongsStack = slotStack.copy();
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];
@@ -84,57 +87,52 @@ public class CastingForm extends CustomContainerFacing implements CastingFormHan
tempArray[i] = tile.getSlotStack(i).getItem();
}
CastingCrafting casting = CastingCrafting.getRecipe(tongsStack, tempArray);
CastingCrafting casting = CastingCrafting.getRecipe(crucibleRecipe.getDropsCooked(), tempArray);
if(casting != null){
NBTTagCompound tagOutput = casting.getOutput().getTagCompound();
//System.out.println(tagOutput);
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 (tagOutput.getString("upgrades") == "emerald") {
if (crucibleOutput.getString("upgrades") == "emerald") {
setEmerald(dropStack, true);
setModifiers(dropStack, 1);
} else {
setEmerald(dropStack, false);
}
if (tagOutput.getString("upgrades") == "diamond") {
if (crucibleOutput.getString("upgrades") == "diamond") {
setDiamondLevel(dropStack, 1);
setModifiers(dropStack, 1);
} else {
setDiamondLevel(dropStack, 0);
}
if (tagOutput.getString("upgrades") == "redstone") {
if (crucibleOutput.getString("upgrades") == "redstone") {
setRedstoneLevel(dropStack, 1);
setModifiers(dropStack, 1);
} else {
setRedstoneLevel(dropStack, 0);
}
if (tagOutput.getString("upgrades") == "lapis") {
if (crucibleOutput.getString("upgrades") == "lapis") {
setLapisLevel(dropStack, 1);
setModifiers(dropStack, 1);
} else {
setLapisLevel(dropStack, 0);
}
setModifiers(dropStack, 1);
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;
}
if(tagOutput == null){
System.out.println("Tag is null");
if( !(casting.getOutput().getItem() instanceof BronzeToolPart) ){
ItemStack dropStack = casting.getOutput();
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);
return true;
}
}
}
}
}

View File

@@ -29,6 +29,7 @@ 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;
@@ -42,7 +43,7 @@ import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
/**
* Created by kitsu on 11/26/2016.
*/
public class Forge extends CustomContainerFacing implements ITileEntityProvider, ForgeHandler{
public class Forge extends CustomContainerFacing implements ITileEntityProvider, ForgeHandler, SlotHelper {
private int maxHeat;
//public static final PropertyBool PrimalAPI.States.ACTIVE = PropertyBool.create("PrimalAPI.States.ACTIVE");
@@ -97,7 +98,7 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
ItemStack fuelItem = tile.getSlotStack(0);
/***********************
FUEL SLOT CODE
FUEL SLOT REMOVAL CODE
***********************/
if (!tile.getSlotStack(0).isEmpty()) {
if (player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
@@ -107,6 +108,10 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
return true;
}
}
/***********************
TEMP PRINT OUT CODE
***********************/
if (pItem.isEmpty()) {
if (!player.isSneaking()) {
if (world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE) == true) {
@@ -119,6 +124,9 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
}
}
}
/***********************
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);
@@ -126,34 +134,49 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
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);
/***********************
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;
@@ -184,7 +207,7 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
if(state.getValue(PrimalAPI.States.ACTIVE) == true){
return 15;
return 5;
}
return 0;
}

View File

@@ -459,24 +459,4 @@ 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

@@ -0,0 +1,265 @@
package nmd.primal.forgecraft.blocks.machine;
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.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.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 (hand.equals(hand.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()) {
tile.setSlotStack(6, playerStack.splitStack(1));
//player.inventory.getCurrentItem().shrink(1);
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 (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(playerStack.getItem() instanceof Gallagher) {
if (!slot2.isEmpty() && !slot3.isEmpty() && !slot4.isEmpty() && slot5.isEmpty()) {
WorkbenchCrafting recipe = WorkbenchCrafting.getRecipe(slot2, slot3, slot4, slot5);
System.out.println(slot5);
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);
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()){
if(!slot2.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, slot2);
tile.clearSlot(2);
}
if(!slot3.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, slot3);
tile.clearSlot(3);
}
if(!slot4.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, slot4);
tile.clearSlot(4);
}
if(!slot5.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, slot5);
tile.clearSlot(5);
}
if(!slot6.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, slot6);
tile.clearSlot(6);
}
}
}
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 true;
}
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;
}
}
@Nullable
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileWorkbench();
}
}

View File

@@ -1,104 +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.crafting.AnvilCrafting;
import nmd.primal.forgecraft.crafting.CastingCrafting;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.crafting.ForgeCrafting;
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));
}
@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);
// ***************************************************************************** //
// 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.stoneanvil, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.forgecraft.anvil");
}
}

View File

@@ -1,20 +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.getCrucibleCrafting()) {
recipes.add(recipe);
}
return recipes;
}
}

View File

@@ -1,31 +0,0 @@
package nmd.primal.forgecraft.compat;
import net.minecraftforge.oredict.OreDictionary;
import nmd.primal.forgecraft.init.ModItems;
/**
* 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", 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);
}
}

View File

@@ -0,0 +1,224 @@
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,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI;
package nmd.primal.forgecraft.compat.jei;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.gui.IDrawable;

View File

@@ -0,0 +1,111 @@
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.stoneanvil, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.forgecraft.anvil");
}
}

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.anvil;
package nmd.primal.forgecraft.compat.jei.anvil;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
@@ -11,8 +11,9 @@ 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.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.parts.ToolPart;
import javax.annotation.Nonnull;
@@ -98,7 +99,11 @@ public class AnvilRecipeCategory extends AbstractCategory<AnvilRecipeWrapper>
//items.set(0, recipe.getIngredient(0));
for(int i =0; i < 25; i++){
items.set(i, recipe.getIngredient(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***/

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.anvil;
package nmd.primal.forgecraft.compat.jei.anvil;
import nmd.primal.forgecraft.crafting.AnvilCrafting;

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.anvil;
package nmd.primal.forgecraft.compat.jei.anvil;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.anvil;
package nmd.primal.forgecraft.compat.jei.anvil;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.casting;
package nmd.primal.forgecraft.compat.jei.casting;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
@@ -10,7 +10,7 @@ import net.minecraft.client.resources.I18n;
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.compat.jei.AbstractCategory;
import javax.annotation.Nonnull;

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.casting;
package nmd.primal.forgecraft.compat.jei.casting;
import nmd.primal.forgecraft.crafting.CastingCrafting;

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.casting;
package nmd.primal.forgecraft.compat.jei.casting;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.casting;
package nmd.primal.forgecraft.compat.jei.casting;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.crucible;
package nmd.primal.forgecraft.compat.jei.crucible;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
@@ -11,7 +11,7 @@ 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.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.init.ModBlocks;
import javax.annotation.Nonnull;

View File

@@ -0,0 +1,24 @@
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,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.crucible;
package nmd.primal.forgecraft.compat.jei.crucible;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.crucible;
package nmd.primal.forgecraft.compat.jei.crucible;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.forge;
package nmd.primal.forgecraft.compat.jei.forge;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
@@ -12,7 +12,7 @@ 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.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.init.ModBlocks;
import javax.annotation.Nonnull;

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.forge;
package nmd.primal.forgecraft.compat.jei.forge;
import nmd.primal.forgecraft.crafting.ForgeCrafting;

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.forge;
package nmd.primal.forgecraft.compat.jei.forge;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.compat.JEI.forge;
package nmd.primal.forgecraft.compat.jei.forge;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;

View File

@@ -0,0 +1,105 @@
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import nmd.primal.core.api.PrimalAPI;
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 "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, false, 66, 20);
ItemStack bench = new ItemStack(Item.getItemFromBlock(ModBlocks.workbench), 1);
items.set(5, bench);
items.init(6, false, 66, 1);
NonNullList<ItemStack> tempDrops = NonNullList.<ItemStack>create();
tempDrops.add(0, new ItemStack(PrimalAPI.Items.STONE_GALLAGHER, 1));
tempDrops.add(1, new ItemStack(PrimalAPI.Items.NETHER_GALLAGHER, 1));
tempDrops.add(2, new ItemStack(PrimalAPI.Items.IRON_GALLAGHER, 1));
tempDrops.add(3, new ItemStack(PrimalAPI.Items.QUARTZ_GALLAGHER, 1));
items.set(6, tempDrops);
}
}

View File

@@ -0,0 +1,24 @@
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

@@ -0,0 +1,18 @@
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

@@ -0,0 +1,55 @@
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 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.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.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

@@ -31,7 +31,6 @@ public class AnvilCrafting {
this.input = input;
this.output = output;
this.upgradeType = upgrade;
}
// ***************************************************************************** //

View File

@@ -59,7 +59,7 @@ public class CastingCrafting {
public static CastingCrafting getRecipe(ItemStack source, Item[] array)
{
for(CastingCrafting recipe : castingRecipes) {
if (source.isItemEqualIgnoreDurability(source)) {
if (source.getItem() == recipe.getSource().getItem() ) {
if (Arrays.equals(array, recipe.input))
return recipe;
}

View File

@@ -1,29 +1,40 @@
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.recipes.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 AbstractCrafting<CrucibleCrafting> {
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_CRAFTINGS;
//public static final Collection<CrucibleCrafting> RECIPES = REGISTRY.getValuesCollection();
public static final String RECIPE_PREFIX = "crucible";
public static final IForgeRegistry<CrucibleCrafting> REGISTRY = ModInfo.Registries.CRUCIBLE_CRAFTING;
public static ArrayList<CrucibleCrafting> getCrucibleCrafting() {
return crucibleCrafting;
public static Collection<CrucibleCrafting> getRECIPES() {
return RECIPES;
}
private static ArrayList<CrucibleCrafting> crucibleCrafting = new ArrayList<>();
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;
@@ -91,7 +102,7 @@ public class CrucibleCrafting { //extends AbstractCrafting<CrucibleCrafting> {
public CrucibleCrafting(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3, Ingredient i4,
ItemStack outputRaw, ItemStack outputCooked,
Integer temp, Integer cookTime, Integer coolTime){
//super();
super();
this.ing0 = i0;
this.ing1 = i1;
this.ing2 = i2;
@@ -109,16 +120,49 @@ public class CrucibleCrafting { //extends AbstractCrafting<CrucibleCrafting> {
this.coolTime = coolTime;
}
public static void addRecipe(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3, Ingredient i4,
ItemStack outputRaw, ItemStack outputCooked,
Integer temp, Integer cookTime, Integer coolTime)
{
crucibleCrafting.add(new CrucibleCrafting(i0, i1, i2, i3, i4, outputRaw, outputCooked, temp, cookTime, 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 : crucibleCrafting){
if(recipe.ing0.apply(i0) && recipe.ing1.apply(i1) && recipe.ing2.apply(i2) && recipe.ing3.apply(i3) && recipe.ing4.apply(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;
}
}
@@ -126,16 +170,32 @@ public class CrucibleCrafting { //extends AbstractCrafting<CrucibleCrafting> {
}
public static CrucibleCrafting getRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack i4){
for(CrucibleCrafting recipe : crucibleCrafting){
if(recipe.ing0.test(i0) && recipe.ing1.test(i1) && recipe.ing2.test(i2) && recipe.ing3.test(i3) && recipe.ing4.test(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 : crucibleCrafting) {
for(CrucibleCrafting recipe : RECIPES) {
if (recipe.ing0.apply(checkStack) ||
recipe.ing1.apply(checkStack) ||
recipe.ing2.apply(checkStack) ||
@@ -168,18 +228,16 @@ public class CrucibleCrafting { //extends AbstractCrafting<CrucibleCrafting> {
}
/*
/// forge registries require a unique REGISTRY_NAME ///
@Override
public String getRecipePrefix()
{
return RECIPE_PREFIX;
public Collection<CrucibleCrafting> getRecipes() {
return RECIPES;
}
@Override
public Collection<CrucibleCrafting> getRecipes()
{
return RECIPES;
public String getRecipePrefix() {
return RECIPE_PREFIX;
}
/**
@@ -187,11 +245,9 @@ public class CrucibleCrafting { //extends AbstractCrafting<CrucibleCrafting> {
* @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

@@ -57,7 +57,8 @@ public class ForgeCrafting {
public static ForgeCrafting getRecipe(Item item)
{
for(ForgeCrafting recipe : forgeRecipes) {
if (item.equals(recipe.input))
if (item.equals(recipe.getInput()))
return recipe;
}
return null;

View File

@@ -0,0 +1,199 @@
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.recipes.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 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;
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;
}
private List<Ingredient> ingredientList = new ArrayList<>();
public WorkbenchCrafting(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3 , ItemStack output){
super();
this.toolPart = i0;
this.toolHead = i1;
this.toolPin = i2;
this.takeApart = i3;
this.output = output;
}
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){
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(compare(recipe.toolPart, i0) &&
compare(recipe.toolHead, i1) &&
compare(recipe.toolPin, i2) &&
compare(recipe.takeApart, i3) ){
return true;
}
}
return false;
}
public static WorkbenchCrafting getRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3){
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(recipe.toolPart.apply(i0) && recipe.toolHead.apply(i1) && recipe.toolPin.apply(i2) && recipe.takeApart.apply(i3) ){
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;
}*/
@Override
public Collection<WorkbenchCrafting> getRecipes() {
return RECIPES;
}
@Override
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

@@ -0,0 +1,650 @@
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();
/*
ItemStack emptyAir = ItemStack.EMPTY;
NBTTagCompound newTag = new NBTTagCompound();
NBTTagCompound setHot = new NBTTagCompound();
setHot.setBoolean("hot", true);
ItemStack hotBronzeIngot = new ItemStack(ModItems.bronzeingotball, 1);
hotBronzeIngot.setTagCompound(setHot);
ItemStack hotIronIngot = new ItemStack(ModItems.ironingotball, 1);
hotIronIngot.setTagCompound(setHot);
ItemStack hotCleanIronIngot = new ItemStack(ModItems.ironcleaningotball, 1);
hotCleanIronIngot.setTagCompound(setHot);
ItemStack hotSteelIngot = new ItemStack(ModItems.steelingotball, 1);
hotSteelIngot.setTagCompound(setHot);
ItemStack hotWootzIngot = new ItemStack(ModItems.wootzingotball, 1);
hotWootzIngot.setTagCompound(setHot);
ItemStack hotBronzeChunk = new ItemStack( ModItems.bronzechunk, 1);
hotBronzeChunk.setTagCompound(setHot);
ItemStack hotChunk = new ItemStack( ModItems.wroughtironchunk, 1);
hotChunk.setTagCompound(setHot);
ItemStack hotCleanChunk = new ItemStack(ModItems.ironcleanchunk, 1);
hotCleanChunk.setTagCompound(setHot);
ItemStack hotSteelChunk = new ItemStack(ModItems.steelchunk, 1);
hotSteelChunk.setTagCompound(setHot);
ItemStack hotWootzChunk = new ItemStack(ModItems.wootzchunk, 1);
hotWootzChunk.setTagCompound(setHot);
ItemStack diamond = new ItemStack(Items.DIAMOND, 1);
ItemStack emerald = new ItemStack(Items.EMERALD, 1);
ItemStack emeraldShard = new ItemStack(PrimalAPI.Items.EMERALD_KNAPP, 1);
ItemStack diamondShard = new ItemStack(PrimalAPI.Items.DIAMOND_KNAPP, 1);
ItemStack redstone = new ItemStack(Items.REDSTONE, 1);
ItemStack lapis = new ItemStack(Items.DYE, 1, 4);
ItemStack[] toolArray = new ItemStack[24];
ItemStack[] hotToolArray = new ItemStack[16];
ItemStack bronzepickaxehead = new ItemStack(ModItems.bronzepickaxehead, 1);
bronzepickaxehead.setTagCompound(newTag);
toolArray[0] = bronzepickaxehead;
ItemStack bronzeaxehead = new ItemStack(ModItems.bronzeaxehead, 1);
bronzeaxehead.setTagCompound(newTag);
toolArray[1] = bronzeaxehead;
ItemStack bronzeshovelhead = new ItemStack(ModItems.bronzeshovelhead, 1);
bronzeshovelhead.setTagCompound(newTag);
toolArray[2] = bronzeshovelhead;
ItemStack bronzehoehead = new ItemStack(ModItems.bronzehoehead, 1);
bronzehoehead.setTagCompound(newTag);
toolArray[3] = bronzehoehead;
ItemStack pickaxehead = new ItemStack(ModItems.pickaxehead, 1);
pickaxehead.setTagCompound(newTag);
toolArray[4] = pickaxehead;
ItemStack ironaxehead = new ItemStack(ModItems.ironaxehead, 1);
ironaxehead.setTagCompound(newTag);
toolArray[5] = ironaxehead;
ItemStack ironshovelhead = new ItemStack(ModItems.ironshovelhead, 1);
ironshovelhead.setTagCompound(newTag);
toolArray[6] = ironshovelhead;
ItemStack ironhoehead = new ItemStack(ModItems.ironhoehead, 1);
ironhoehead.setTagCompound(newTag);
toolArray[7] = ironhoehead;
ItemStack cleanpickaxehead = new ItemStack(ModItems.cleanironpickaxehead, 1);
cleanpickaxehead.setTagCompound(newTag);
toolArray[8] = cleanpickaxehead;
ItemStack cleanaxehead = new ItemStack(ModItems.cleanironaxehead, 1);
cleanaxehead.setTagCompound(newTag);
toolArray[9] = cleanaxehead;
ItemStack cleanshovelhead = new ItemStack(ModItems.cleanironshovelhead, 1);
cleanshovelhead.setTagCompound(newTag);
toolArray[10] = cleanshovelhead;
ItemStack cleanhoehead = new ItemStack(ModItems.cleanironhoehead, 1);
cleanhoehead.setTagCompound(newTag);
toolArray[11] =cleanhoehead ;
ItemStack steelpickaxehead = new ItemStack(ModItems.steelpickaxehead, 1);
steelpickaxehead.setTagCompound(newTag);
toolArray[12] = steelpickaxehead;
ItemStack steelaxehead = new ItemStack(ModItems.steelaxehead, 1);
steelaxehead.setTagCompound(newTag);
toolArray[13] =steelaxehead ;
ItemStack steelshovelhead = new ItemStack(ModItems.steelshovelhead, 1);
steelshovelhead.setTagCompound(newTag);
toolArray[14] = steelshovelhead;
ItemStack steelhoehead = new ItemStack(ModItems.steelhoehead, 1);
steelhoehead.setTagCompound(newTag);
toolArray[15] =steelhoehead ;
ItemStack wootzpickaxehead = new ItemStack(ModItems.wootzpickaxehead, 1);
wootzpickaxehead.setTagCompound(newTag);
toolArray[16] = wootzpickaxehead;
ItemStack wootzaxehead = new ItemStack(ModItems.wootzaxehead, 1);
wootzaxehead.setTagCompound(newTag);
toolArray[17] = wootzaxehead;
ItemStack wootzshovelhead = new ItemStack(ModItems.wootzshovelhead, 1);
wootzshovelhead.setTagCompound(newTag);
toolArray[18] =wootzshovelhead ;
ItemStack wootzhoehead = new ItemStack(ModItems.wootzhoehead, 1);
wootzhoehead.setTagCompound(newTag);
toolArray[19] = wootzhoehead;
ItemStack copperpickaxehead = new ItemStack(ModItems.copperpickaxehead, 1);
copperpickaxehead.setTagCompound(newTag);
toolArray[20] = copperpickaxehead;
ItemStack copperaxehead = new ItemStack(ModItems.copperaxehead, 1);
copperaxehead.setTagCompound(newTag);
toolArray[21] = copperaxehead;
ItemStack coppershovelhead = new ItemStack(ModItems.coppershovelhead, 1);
coppershovelhead.setTagCompound(newTag);
toolArray[22] =coppershovelhead ;
ItemStack copperhoehead = new ItemStack(ModItems.copperhoehead, 1);
copperhoehead.setTagCompound(newTag);
toolArray[23] = copperhoehead;
ItemStack hotpickaxehead = pickaxehead.copy();
hotToolArray[0] =hotpickaxehead;
ItemStack hotironaxehead = ironaxehead.copy();
hotToolArray[1] =hotironaxehead;
ItemStack hotironshovelhead = ironshovelhead.copy();
hotToolArray[2] =hotironshovelhead;
ItemStack hotironhoehead = ironhoehead.copy();
hotToolArray[3] =hotironhoehead;
ItemStack hotcleanpickaxehead = cleanpickaxehead.copy();
hotToolArray[4] = hotcleanpickaxehead;
ItemStack hotcleanaxehead = cleanaxehead.copy();
hotToolArray[5] = hotcleanaxehead;
ItemStack hotcleanshovelhead = cleanshovelhead.copy();
hotToolArray[6] = hotcleanshovelhead;
ItemStack hotcleanhoehead = cleanhoehead.copy();
hotToolArray[7] = hotcleanhoehead;
ItemStack hotsteelpickaxehead = steelpickaxehead.copy();
hotToolArray[8] = hotsteelpickaxehead;
ItemStack hotsteelaxehead = steelaxehead.copy();
hotToolArray[9] = hotsteelaxehead;
ItemStack hotsteelshovelhead = steelshovelhead.copy();
hotToolArray[10] = hotsteelshovelhead;
ItemStack hotsteelhoehead = steelhoehead.copy();
hotToolArray[11] = hotsteelhoehead;
ItemStack hotwootzpickaxehead = wootzpickaxehead.copy();
hotToolArray[12] = hotwootzpickaxehead;
ItemStack hotwootzaxehead = wootzaxehead.copy();
hotToolArray[13] = hotwootzaxehead;
ItemStack hotwootzshovelhead = wootzshovelhead.copy();
hotToolArray[14] = hotwootzshovelhead;
ItemStack hotwootzhoehead = wootzhoehead.copy();
hotToolArray[15] = hotwootzhoehead;
for(ItemStack temp : toolArray) {
NBTTagCompound tags = temp.getTagCompound();
tags.setTag("tags", tags);
tags.getCompoundTag("tags").setBoolean("hot", false);
tags.getCompoundTag("tags").setBoolean("emerald", false);
tags.getCompoundTag("tags").setInteger("diamond", 0);
tags.getCompoundTag("tags").setInteger("redstone", 0);
tags.getCompoundTag("tags").setInteger("lapis", 0);
tags.getCompoundTag("tags").setInteger("modifiers", 0);
temp.setTagCompound(tags);
}
bronzepickaxehead = toolArray[0];
bronzeaxehead = toolArray[1];
bronzeshovelhead = toolArray[2];
bronzehoehead = toolArray[3];
pickaxehead = toolArray[4];
ironaxehead = toolArray[5];
ironshovelhead = toolArray[6];
ironhoehead = toolArray[7];
cleanpickaxehead = toolArray[8];
cleanaxehead = toolArray[9];
cleanshovelhead = toolArray[10];
cleanhoehead = toolArray[11];
steelpickaxehead = toolArray[12] ;
steelaxehead = toolArray[13] ;
steelshovelhead = toolArray[14];
steelhoehead = toolArray[15] ;
wootzpickaxehead = toolArray[16];
wootzaxehead = toolArray[17];
wootzshovelhead = toolArray[18] ;
wootzhoehead = toolArray[19];
copperpickaxehead = toolArray[20];
copperaxehead = toolArray[21];
coppershovelhead = toolArray[22];
copperhoehead = toolArray[23];
for(ItemStack temp : hotToolArray) {
//NBTTagCompound newTag = new NBTTagCompound();
NBTTagCompound tags = new NBTTagCompound();
//temp.setTagCompound(newTag);
temp.getTagCompound().setTag("tags", tags);
temp.getTagCompound().setTag("tags", tags);
temp.getSubCompound("tags").setBoolean("hot", true);
temp.getSubCompound("tags").setBoolean("emerald", false);
temp.getSubCompound("tags").setInteger("diamond", 0);
temp.getSubCompound("tags").setInteger("redstone", 0);
temp.getSubCompound("tags").setInteger("lapis", 0);
temp.getSubCompound("tags").setInteger("modifiers", 0);
}
hotpickaxehead = hotToolArray[0];
hotironaxehead = hotToolArray[1];
hotironshovelhead = hotToolArray[2];
hotironhoehead = hotToolArray[3];
hotcleanpickaxehead = hotToolArray[4];
hotcleanaxehead = hotToolArray[5];
hotcleanshovelhead = hotToolArray[6];
hotcleanhoehead = hotToolArray[7];
hotsteelpickaxehead = hotToolArray[8] ;
hotsteelaxehead = hotToolArray[9] ;
hotsteelshovelhead = hotToolArray[10];
hotsteelhoehead = hotToolArray[11] ;
hotwootzpickaxehead = hotToolArray[12];
hotwootzaxehead = hotToolArray[13];
hotwootzshovelhead = hotToolArray[14] ;
hotwootzhoehead = hotToolArray[15];
*/
//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

@@ -0,0 +1,380 @@
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;
import java.lang.reflect.WildcardType;
@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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 ItemStack(ModItems.wootzshovelhead, 1)).setRecipeName("wootzshovelsplit"));
}
}

View File

@@ -10,10 +10,11 @@ import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.blocks.Anvil.AnvilIron;
import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.blocks.Chisel;
import nmd.primal.forgecraft.blocks.YewStave;
import nmd.primal.forgecraft.blocks.AnvilStone;
import nmd.primal.forgecraft.blocks.NBTCrucible;
import nmd.primal.forgecraft.blocks.machine.*;
/**
@@ -29,6 +30,13 @@ public class ModBlocks {
public static Block blockbreaker;
public static Block castingform;
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 pistonbellowsjungle;
public static Block pistonbellowsbirch;
@@ -36,50 +44,15 @@ public class ModBlocks {
public static Block pistonbellowsdarkoak;
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 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 ironanvil;
public static Block workbench;
public static Block yewstave;
public static void init() {
//FISH_TRAP = RegistryHelper.addBlock("fish_trap", new FishTrap(), ItemFishTraps::new, "fishtrap");
nbtCrucible = new NBTCrucible(Material.ROCK, "nbtcrucible");
forge_brick = new Forge(Material.ROCK, "forge_brick", 5000);
forge_adobe = new Forge(Material.ROCK, "forge_adobe", 5000);
@@ -88,6 +61,13 @@ public class ModBlocks {
blockbreaker = new Breaker(Material.WOOD, "blockbreaker", 4.0f);
castingform = new CastingForm(Material.WOOD, "castingform");
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");
pistonbellowsjungle = new PistonBellows(Material.WOOD, "pistonbellowsjungle");
pistonbellowsbirch = new PistonBellows(Material.WOOD, "pistonbellowsbirch");
@@ -95,274 +75,11 @@ public class ModBlocks {
pistonbellowsdarkoak = new PistonBellows(Material.WOOD, "pistonbellowsdarkoak");
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");
*/
/*
ironball = new IngotBall(Material.IRON, "ironball", 5.0F, "big") {
@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();
ItemStack pstack = player.getHeldItemMainhand();
BlockPos belowPos = pos.down();
//System.out.println("Activating");
if (pItem instanceof Gallagher && 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 (pstack.isEmpty()) {
System.out.println(state);
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getItem(world, pos, state));
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 3);
return true;
}
if (pItem instanceof Gallagher || 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);
Block tempBlock = ModBlocks.ironchunk;
tempBlock.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true);
tile.setSlotStack(6, new ItemStack(tempBlock, 1));
tile.setSlotStack(7, new ItemStack(tempBlock, 1));
tile.setSlotStack(8, new ItemStack(tempBlock, 1));
tile.setSlotStack(11, new ItemStack(tempBlock, 1));
tile.setSlotStack(12, new ItemStack(tempBlock, 1));
tile.setSlotStack(13, new ItemStack(tempBlock, 1));
tile.setSlotStack(16, new ItemStack(tempBlock, 1));
tile.setSlotStack(17, new ItemStack(tempBlock, 1));
tile.setSlotStack(18, new ItemStack(tempBlock, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
};
ironcleanball = new IngotBall(Material.IRON, "ironcleanball", 5.0f,"big") {
@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 Gallagher || 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);
Block tempBlock = ModBlocks.ironcleanchunk;
tempBlock.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true);
tile.setSlotStack(6, new ItemStack(tempBlock, 1));
tile.setSlotStack(7, new ItemStack(tempBlock, 1));
tile.setSlotStack(8, new ItemStack(tempBlock, 1));
tile.setSlotStack(11, new ItemStack(tempBlock, 1));
tile.setSlotStack(12, new ItemStack(tempBlock, 1));
tile.setSlotStack(13, new ItemStack(tempBlock, 1));
tile.setSlotStack(16, new ItemStack(tempBlock, 1));
tile.setSlotStack(17, new ItemStack(tempBlock, 1));
tile.setSlotStack(18, new ItemStack(tempBlock, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
};
steelball = new IngotBall(Material.IRON, "steelball", 6.0f,"big"){
@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 Gallagher || 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);
Block tempBlock = ModBlocks.steelchunk;
tempBlock.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(tempBlock, 1));
tile.setSlotStack(7, new ItemStack(tempBlock, 1));
tile.setSlotStack(8, new ItemStack(tempBlock, 1));
tile.setSlotStack(11, new ItemStack(tempBlock, 1));
tile.setSlotStack(12, new ItemStack(tempBlock, 1));
tile.setSlotStack(13, new ItemStack(tempBlock, 1));
tile.setSlotStack(16, new ItemStack(tempBlock, 1));
tile.setSlotStack(17, new ItemStack(tempBlock, 1));
tile.setSlotStack(18, new ItemStack(tempBlock, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
};
wootzball = new IngotBall(Material.IRON, "wootzball", 6.0f,"big") {
@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 Gallagher || 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);
Block tempBlock = ModBlocks.wootzchunk;
tempBlock.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true);
tile.setSlotStack(6, new ItemStack(tempBlock, 1));
tile.setSlotStack(7, new ItemStack(tempBlock, 1));
tile.setSlotStack(8, new ItemStack(tempBlock, 1));
tile.setSlotStack(11, new ItemStack(tempBlock, 1));
tile.setSlotStack(12, new ItemStack(tempBlock, 1));
tile.setSlotStack(13, new ItemStack(tempBlock, 1));
tile.setSlotStack(16, new ItemStack(tempBlock, 1));
tile.setSlotStack(17, new ItemStack(tempBlock, 1));
tile.setSlotStack(18, new ItemStack(tempBlock, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
};
ironchunk = new IngotBall(Material.IRON, "ironchunk", 5.0F, "small");
ironcleanchunk = new IngotBall(Material.IRON, "ironcleanchunk", 5.0F, "small");
steelchunk = new IngotBall(Material.IRON, "steelchunk", 6.0f,"small");
wootzchunk = new IngotBall(Material.IRON, "wootzchunk", 6.0f,"small");
*/
stoneanvil = new AnvilStone(Material.ANVIL, "stoneanvil", 5.0f, true);
ironanvil = new AnvilIron(Material.ANVIL, "ironanvil", 6.0f, true);
//ironballitemcool = new ItemBlockIngotBall(ironball);
//ironballitemhot = new ItemBlockIngotBall(ironball);
//ironanvil = new AnvilIron(Material.ANVIL, "ironanvil", 6.0f, true);
workbench = new Workbench(Material.WOOD, "toolbench");
yewstave = new YewStave(Material.WOOD, "yewstave", 3.0F);
}
@@ -377,6 +94,13 @@ public class ModBlocks {
registerBlockWithItem(blockbreaker);
registerBlockWithItem(castingform);
registerBlockWithItem(copperchisel);
registerBlockWithItem(bronzechisel);
registerBlockWithItem(ironchisel);
registerBlockWithItem(cleanironchisel);
registerBlockWithItem(steelchisel);
registerBlockWithItem(wootzchisel);
registerBlockWithItem(pistonbellowsoak);
registerBlockWithItem(pistonbellowsjungle);
registerBlockWithItem(pistonbellowsbirch);
@@ -384,47 +108,10 @@ public class ModBlocks {
registerBlockWithItem(pistonbellowsdarkoak);
registerBlockWithItem(pistonbellowsacacia);
/*registerBlockWithItem(emptycrucible);
registerBlockWithItem(emptycruciblehot);
registerBlockWithItem(emptycruciblecracked);
registerBlockWithItem(emptycruciblecrackedhot);
registerBlockWithItem(rawbronzecrucible);
registerBlockWithItem(hotbronzecrucible);
registerBlockWithItem(hotcookedbronzecrucible);
registerBlockWithItem(rawbronzecrucible_diamond);
registerBlockWithItem(hotbronzecrucible_diamond);
registerBlockWithItem(hotcookedbronzecrucible_diamond);
registerBlockWithItem(rawbronzecrucible_emerald);
registerBlockWithItem(hotbronzecrucible_emerald);
registerBlockWithItem(hotcookedbronzecrucible_emerald);
registerBlockWithItem(rawbronzecrucible_redstone);
registerBlockWithItem(hotbronzecrucible_redstone);
registerBlockWithItem(hotcookedbronzecrucible_redstone);
registerBlockWithItem(rawbronzecrucible_lapis);
registerBlockWithItem(hotbronzecrucible_lapis);
registerBlockWithItem(hotcookedbronzecrucible_lapis);
*/
//registerBlockWithItem(ironball);
//registerBlockWithItem(ironchunk);
//registerBlockWithItem(ironcleanball);
//registerBlockWithItem(ironcleanchunk);
//registerBlockWithItem(steelball);
//registerBlockWithItem(steelchunk);
//registerBlockWithItem(wootzball);
//registerBlockWithItem(wootzchunk);
//registerBlockWithItemSubType(ironball, ironballitemcool, "ironcool");
//registerBlockWithItemSubType(ironball, ironballitemhot, "ironhot");
registerBlockWithItem(stoneanvil);
registerBlockWithItem(ironanvil);
//registerBlockWithItem(ironanvil);
registerBlockWithItem(workbench);
registerBlockWithItem(yewstave);
}
@@ -436,6 +123,13 @@ public class ModBlocks {
registerRender(forge_adobe);
registerRender(castingform);
registerRender(copperchisel);
registerRender(bronzechisel);
registerRender(ironchisel);
registerRender(cleanironchisel);
registerRender(steelchisel);
registerRender(wootzchisel);
registerRender(blockbreaker);
registerRender(pistonbellowsoak);
registerRender(pistonbellowsjungle);
@@ -446,49 +140,10 @@ public class ModBlocks {
registerRender(bloomery_brick);
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(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(ironanvil);
//registerRender(ironanvil);
registerRender(workbench);
registerRender(yewstave);

View File

@@ -1,47 +1,72 @@
package nmd.primal.forgecraft.init;
import net.minecraftforge.common.config.Config;
import nmd.primal.forgecraft.ForgeCraft;
import nmd.primal.forgecraft.ModInfo;
@Config(modid = ModInfo.MOD_ID, name = ModInfo.MOD_CONFIG, category = "")
@Config.LangKey("forgecraft.config.title")
@SuppressWarnings("unused")
public class ModConfig
public final class ModConfig
{
static {
ForgeCraft.LOGGER.info("Loading Config File: " + ModInfo.MOD_CONFIG + ".cfg");
}
//static {
// ForgeCraft.LOGGER.info("Loading Config File: " + ModInfo.MOD_CONFIG + ".cfg");
//}
/**
* Main Config Sections
*/
public static Compatibility compatibility;
public static ModConfig.Features features;
public static Features features;
/**
* Options related to compatibility with mods and vanilla features
*/
public static class Compatibility
{
@Config.Comment({"Ore Dictionary Wootz steel for compatibility with common mod steel"})
public static boolean COMPAT_DICTIONARY_WOOTZ_STEEL;
@Config.Comment({"Ore Dictionary Wrought Iron to common Iron"})
public static boolean COMPAT_DICTIONARY_WROUGHT_IRON = true;
//@Config.Comment({"Ore Dictionary Damascus Steel to common Steel"})
//public static boolean COMPAT_DICTIONARY_DAMASCUS_STEEL = true;
}
/**
* Customize main features of the mod
*/
public static class Features
{
@Config.Comment({"Smoke is produced from various forge blocks when active"})
public static boolean FEATURE_ENABLE_SMOKE = true;
// @Config.RequiresMcRestart
// @Config.Comment({"Config to allow or dissallow Copper Tools"})
// 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

@@ -0,0 +1,36 @@
package nmd.primal.forgecraft.init;
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()
{
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);
//}
}
}

View File

@@ -12,17 +12,17 @@ import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.items.*;
import nmd.primal.forgecraft.items.armor.CustomHelmet;
import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible;
import nmd.primal.forgecraft.items.parts.BronzeToolPart;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.tools.*;
import nmd.primal.forgecraft.items.weapons.CustomShield;
import nmd.primal.forgecraft.items.weapons.CustomSword;
import nmd.primal.forgecraft.items.weapons.Longbow;
import nmd.primal.forgecraft.items.weapons.SlayerSword;
import nmd.primal.forgecraft.items.tools.CustomAxe;
import nmd.primal.forgecraft.items.tools.CustomHoe;
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
import nmd.primal.forgecraft.items.tools.CustomShovel;
import nmd.primal.forgecraft.items.weapons.*;
/**
* Created by kitsu on 11/26/2016.
*/
public class ModItems {
//public static Item test;
@@ -47,6 +47,24 @@ public class ModItems {
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 ironaxehead;
public static Item ironshovelhead;
@@ -113,6 +131,7 @@ public class ModItems {
public static Item steelslayer;
public static Item wootzslayer;
public static Item brokencoppertool;
public static Item brokenbronzetool;
public static Item brokenwroughtirontool;
public static Item brokencleanirontool;
@@ -128,6 +147,7 @@ public class ModItems {
public static Item rawlongbow;
public static Item unstrunglongbow;
public static Item longbow;
public static Item wootzworkblade;
public static Item leatherhelmet;
//public static Item testleggings;
@@ -135,6 +155,7 @@ public class ModItems {
//public static Item forgingmanual;
public static void init() {
//OBJLoader.INSTANCE.addDomain(ModInfo.MOD_ID);
//pistonbellows = new ItemBellowsHandle("pistonbellows");
itemnbtcrucible = new ItemNBTCrucible("itemnbtcrucible", ModBlocks.nbtCrucible);
@@ -146,18 +167,25 @@ public class ModItems {
forgehammer = new ForgeHammer("forgehammer");
castingmud = new BaseItem("castingmud");
rawlongbow = new BaseItem("rawlongbow");
rawlongbow = new RawLongbow("rawlongbow");
unstrunglongbow = new BaseItem("unstrunglongbow");
longbow = new Longbow("longbow");
//matchlockmusket = new Musket("matchlock_musket");
wootzworkblade = new Workblade("wootzworkblade", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, -1.0F).setFireProof(true);
/**********
TOOL PARTS
**********/
bronzepickaxehead = new BronzeToolPart("bronzepickaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "pickaxe");
bronzeaxehead = new BronzeToolPart("bronzeaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "axe");
bronzeshovelhead = new BronzeToolPart("bronzeshovelhead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "shovel");
bronzehoehead = new BronzeToolPart("bronzehoehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "hoe");
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");
bronzeaxehead = new ToolPart("bronzeaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "axe");
bronzeshovelhead = new ToolPart("bronzeshovelhead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "shovel");
bronzehoehead = new ToolPart("bronzehoehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "hoe");
pickaxehead = new ToolPart("ironpickaxehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "pickaxe");
ironaxehead = new ToolPart("ironaxehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "axe");
@@ -182,30 +210,41 @@ public class ModItems {
/**********
TOOLS
**********/
bronzepickaxe = new BronzePickaxe("bronzepickaxe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzepickaxehead);
bronzeaxe = new BronzeAxe("bronzeaxe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzeaxehead);
bronzeshovel = new BronzeShovel("bronzeshovel", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzeshovelhead);
bronzehoe = new BronzeHoe("bronzehoe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzehoehead);
copperpickaxe = new CustomPickaxe("copperpickaxe", PrimalAPI.ToolMaterials.TOOL_COPPER, brokencoppertool);
copperaxe = new CustomAxe("copperaxe", PrimalAPI.ToolMaterials.TOOL_COPPER, brokencoppertool, 4, -2.6F);
coppershovel = new CustomShovel("coppershovel", PrimalAPI.ToolMaterials.TOOL_COPPER, brokencoppertool);
copperhoe = new CustomHoe("copperhoe", PrimalAPI.ToolMaterials.TOOL_COPPER, brokencoppertool);
coppersledgehammer = new SledgeHammer("coppersledgehammer", PrimalAPI.ToolMaterials.TOOL_COPPER, 12, -3.7D);
bronzepickaxe = new CustomPickaxe("bronzepickaxe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzepickaxehead);
bronzeaxe = new CustomAxe("bronzeaxe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzeaxehead, 5, -2.4f);
bronzeshovel = new CustomShovel("bronzeshovel", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzeshovelhead);
bronzehoe = new CustomHoe("bronzehoe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzehoehead);
bronzesledgehammer = new SledgeHammer("bronzesledgehammer", PrimalAPI.ToolMaterials.TOOL_BRONZE, 12, -3.7D);
ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, pickaxehead);
ironaxe = new CustomAxe("ironaxe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironaxehead);
ironaxe = new CustomAxe("ironaxe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironaxehead, 5, -3.6f);
ironshovel = new CustomShovel("ironshovel", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironshovelhead);
ironhoe = new CustomHoe("ironhoe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironhoehead);
ironsledgehammer = new SledgeHammer("ironsledgehammer", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 12, -3.7D);
cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironpickaxehead);
cleanironaxe = new CustomAxe("cleanironaxe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironaxehead);
cleanironaxe = new CustomAxe("cleanironaxe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironaxehead, 6, -3.2f);
cleanironshovel = new CustomShovel("cleanironshovel", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironshovelhead);
cleanironhoe = new CustomHoe("cleanironhoe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironhoehead);
cleanironsledgehammer = new SledgeHammer("cleanironsledgehammer", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 12, -3.7D);
steelpickaxe = new CustomPickaxe("steelpickaxe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelpickaxehead);
steelaxe = new CustomAxe("steelaxe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelaxehead);
steelaxe = new CustomAxe("steelaxe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelaxehead, 7, -2.8f);
steelshovel = new CustomShovel("steelshovel", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelshovelhead);
steelhoe = new CustomHoe("steelhoe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelhoehead);
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);
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
@@ -248,6 +287,7 @@ public class ModItems {
//forgingmanual = new ItemForgingManual();
//test = new ItemTest("ironsword");
brokencoppertool = new BaseItem("brokencoppertool");
brokenbronzetool = new BaseItem("brokenbronzetool");
brokenwroughtirontool = new BaseItem("brokenwroughtirontool");
brokencleanirontool = new BaseItem("brokencleanirontool");
@@ -269,7 +309,7 @@ public class ModItems {
ForgeRegistries.ITEMS.register(castingmud);
ForgeRegistries.ITEMS.register(bellowshandle);
ForgeRegistries.ITEMS.register(softcrucible);
//ForgeRegistries.ITEMS.register(stonetongs);
ForgeRegistries.ITEMS.register(wootzworkblade);
ForgeRegistries.ITEMS.register(forgehammer);
ForgeRegistries.ITEMS.register(bronzeingotball);
@@ -288,6 +328,12 @@ public class ModItems {
/**********
TOOL PARTS
**********/
ForgeRegistries.ITEMS.register(copperpickaxehead);
ForgeRegistries.ITEMS.register(copperaxehead);
ForgeRegistries.ITEMS.register(coppershovelhead);
ForgeRegistries.ITEMS.register(copperhoehead);
ForgeRegistries.ITEMS.register(bronzepickaxehead);
ForgeRegistries.ITEMS.register(bronzeaxehead);
ForgeRegistries.ITEMS.register(bronzeshovelhead);
@@ -316,30 +362,41 @@ public class ModItems {
/**********
TOOLS
**********/
ForgeRegistries.ITEMS.register(copperpickaxe);
ForgeRegistries.ITEMS.register(copperaxe);
ForgeRegistries.ITEMS.register(coppershovel);
ForgeRegistries.ITEMS.register(copperhoe);
ForgeRegistries.ITEMS.register(coppersledgehammer);
ForgeRegistries.ITEMS.register(bronzepickaxe);
ForgeRegistries.ITEMS.register(bronzeaxe);
ForgeRegistries.ITEMS.register(bronzeshovel);
ForgeRegistries.ITEMS.register(bronzehoe);
ForgeRegistries.ITEMS.register(bronzesledgehammer);
ForgeRegistries.ITEMS.register(ironpickaxe);
ForgeRegistries.ITEMS.register(ironaxe);
ForgeRegistries.ITEMS.register(ironshovel);
ForgeRegistries.ITEMS.register(ironhoe);
ForgeRegistries.ITEMS.register(ironsledgehammer);
ForgeRegistries.ITEMS.register(cleanironpickaxe);
ForgeRegistries.ITEMS.register(cleanironaxe);
ForgeRegistries.ITEMS.register(cleanironshovel);
ForgeRegistries.ITEMS.register(cleanironhoe);
ForgeRegistries.ITEMS.register(cleanironsledgehammer);
ForgeRegistries.ITEMS.register(steelpickaxe);
ForgeRegistries.ITEMS.register(steelaxe);
ForgeRegistries.ITEMS.register(steelshovel);
ForgeRegistries.ITEMS.register(steelhoe);
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
@@ -391,7 +448,7 @@ public class ModItems {
registerRender(bellowshandle);
registerRender(softcrucible);
registerRender(forgehammer);
registerRender(wootzworkblade);
registerRender(bronzeingotball);
registerRender(bronzechunk);
@@ -409,6 +466,12 @@ public class ModItems {
/**********
TOOL PARTS
**********/
registerRender(copperpickaxehead);
registerRender(copperaxehead);
registerRender(coppershovelhead);
registerRender(copperhoehead);
registerRender(bronzepickaxehead);
registerRender(bronzeaxehead);
registerRender(bronzeshovelhead);
@@ -437,30 +500,41 @@ public class ModItems {
/**********
TOOLS
**********/
registerRender(copperpickaxe);
registerRender(copperaxe);
registerRender(coppershovel);
registerRender(copperhoe);
registerRender(coppersledgehammer);
registerRender(bronzepickaxe);
registerRender(bronzeaxe);
registerRender(bronzeshovel);
registerRender(bronzehoe);
registerRender(bronzesledgehammer);
registerRender(ironpickaxe);
registerRender(ironaxe);
registerRender(ironshovel);
registerRender(ironhoe);
registerRender(ironsledgehammer);
registerRender(cleanironpickaxe);
registerRender(cleanironaxe);
registerRender(cleanironshovel);
registerRender(cleanironhoe);
registerRender(cleanironsledgehammer);
registerRender(steelpickaxe);
registerRender(steelaxe);
registerRender(steelshovel);
registerRender(steelhoe);
registerRender(steelsledgehammer);
registerRender(wootzpickaxe);
registerRender(wootzaxe);
registerRender(wootzshovel);
registerRender(wootzhoe);
registerRender(wootzsledgehammer);
/**********
WEAPONS

View File

@@ -1,14 +1,39 @@
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.
*/
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public class ModRegistries {
public static void registerFuels()
{
//if (ModConfig.FEATURE_ENABLE_FUELS)
//{
@SubscribeEvent
public static void customRegistries(RegistryEvent.NewRegistry event) {
PrimalAPI.logger(1, "Custom Registry", CrucibleCrafting.RECIPE_PREFIX);
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,12 +13,16 @@ public class ModSounds {
public static SoundEvent PISTON_BELLOWS;
public static SoundEvent MUSKET_SHOT;
public static SoundEvent BOW_TWANG;
public static SoundEvent CHISEL_HIT;
public static SoundEvent CHISEL_HIT_FINISHED;
public static void registerSounds()
{
PISTON_BELLOWS = registerSound("piston_bellows");
MUSKET_SHOT = registerSound("musket_shot");
BOW_TWANG = registerSound("bow_twang");
CHISEL_HIT = registerSound("chisel_hit");
CHISEL_HIT_FINISHED = registerSound("chisel_hit_finished");
}
private static SoundEvent registerSound(String name)

View File

@@ -0,0 +1,19 @@
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());
}
}

View File

@@ -17,6 +17,7 @@ public class ModTiles {
registerTileEntity(TileBreaker.class, "breaker");
registerTileEntity(TileCastingForm.class, "castingform");
registerTileEntity(TileNBTCrucible.class, "nbtcrucible");
registerTileEntity(TileWorkbench.class, "workbench");
}
private static void registerTileEntity(Class<? extends TileEntity> tile_class, String baseName) {

View File

@@ -33,22 +33,5 @@ public class CauldronRecipes
lapisBronze.getSubCompound("tags").setInteger("lapis", 1);
lapisBronze.getSubCompound("tags").setBoolean("modified", true);
/*
recipes.register(new CauldronRecipe(
5,
FluidRegistry.getFluidStack("water", 1000),
FluidRegistry.getFluidStack("water", 1000),
new ItemStack(ModItems.rawbronzegladius, 1),
new ItemStack(Items.DYE, 1, 4),
ItemStack.EMPTY,
ItemStack.EMPTY,
lapisBronze,
ItemStack.EMPTY).setRecipeName("finishedGladius")
);
*/
}
}

View File

@@ -1,186 +0,0 @@
package nmd.primal.forgecraft.init.recipes;
/**
* Created by mminaie on 9/15/18.
*/
/*
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public final class CrucibleRecipes {
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<CrucibleCrafting> event)
{
final IForgeRegistry<CrucibleCrafting> registry = event.getRegistry();
/***Default Recipe***/
/**
registry.register(new CrucibleCrafting(
).setRecipeName(""));
***/
/*
registry.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),
100,
100,
1000).setRecipeName("wroughtiron"));
registry.register(new CrucibleCrafting(
new OreIngredient("dustIron"),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CARBONATE_SLACK, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.IRON_DUST, 1),
new ItemStack(ModItems.ironcleaningotball, 1),
100,
100,
1000).setRecipeName("cleaniron"));
registry.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),
100,
100,
1000
).setRecipeName("steel"));
registry.register(new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_PURE, 1)),
Ingredient.fromStacks(new ItemStack(Blocks.LEAVES, 1, 15)),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_PURE, 1)),
Ingredient.fromStacks(new ItemStack(Blocks.LEAVES, 1, 15)),
new OreIngredient("dustMagnetite"),
new ItemStack(PrimalAPI.Blocks.ORE_MAGNETITE, 1),
new ItemStack(ModItems.wootzingotball, 1),
100,
100,
1000
).setRecipeName("damascus"));
registry.register(new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_PURE, 1)),
Ingredient.fromStacks(new ItemStack(Blocks.LEAVES, 1, 15)),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_PURE, 1)),
Ingredient.fromStacks(new ItemStack(Blocks.LEAVES, 1, 15)),
new OreIngredient("magnetite"),
new ItemStack(PrimalAPI.Blocks.ORE_MAGNETITE, 1),
new ItemStack(ModItems.wootzingotball, 1),
100,
100,
1000
).setRecipeName("damascus"));
registry.register(new CrucibleCrafting(
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustTin"),
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
new ItemStack(ModItems.bronzeingotball, 1),
100,
100,
1000
).setRecipeName("bronzebasic"));
NBTTagCompound tagBronzeDefault = new NBTTagCompound();
tagBronzeDefault.setString("upgrades", "");
ItemStack defaultBronze = new ItemStack(ModItems.bronzeingotball, 1);
defaultBronze.setTagCompound(tagBronzeDefault.copy());
registry.register(new CrucibleCrafting(
new OreIngredient("oreBronze"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
defaultBronze,
100,
100,
1000
).setRecipeName("defaultbronze"));
NBTTagCompound tag = new NBTTagCompound();
tag.setString("upgrades", "redstone");
ItemStack redBronze = new ItemStack(ModItems.bronzeingotball, 1);
registry.register(new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("dustRedstone"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
redBronze,
100,
100,
100
).setRecipeName("redbronze"));
NBTTagCompound diamondBronzeTag = new NBTTagCompound();
tag.setString("upgrades", "diamond");
ItemStack diamondBronze = new ItemStack(ModItems.bronzeingotball, 1);
diamondBronze.setTagCompound(diamondBronzeTag.copy());
registry.register(new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("dustDiamond"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
diamondBronze,
100,
100,
100
).setRecipeName("diamondbronze"));
NBTTagCompound emeraldBronzeTag = new NBTTagCompound();
tag.setString("upgrades", "emerald");
ItemStack emeraldBronze = new ItemStack(ModItems.bronzeingotball, 1);
emeraldBronze.setTagCompound(emeraldBronzeTag.copy());
registry.register(new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("dustEmerald"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
diamondBronze,
100,
100,
100
).setRecipeName("emeraldbronze"));
NBTTagCompound tagBronzeLapis = new NBTTagCompound();
tagBronzeDefault.setString("upgrades", "lapis");
ItemStack lapisBronze = new ItemStack(ModItems.bronzeingotball, 1);
lapisBronze.setTagCompound(tagBronzeLapis.copy());
registry.register(new CrucibleCrafting(
new OreIngredient("oreBronze"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
lapisBronze,
100,
100,
1000
).setRecipeName("lapisbronze"));
}
}
*/

View File

@@ -1,6 +1,5 @@
package nmd.primal.forgecraft.items;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -16,7 +15,6 @@ 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.FireHelper;
import nmd.primal.forgecraft.init.ModItems;
import javax.annotation.Nullable;
@@ -142,7 +140,7 @@ public class BaseMultiItem extends BaseItem {
{
if (item.hasTagCompound())
{
tooltip.add(ChatFormatting.GRAY + "Upgrades: " + item.getTagCompound().getString("upgrades"));
//tooltip.add(ChatFormatting.GRAY + "Upgrades: " + item.getTagCompound().getString("upgrades"));
/*
tooltip.add(ChatFormatting.GRAY + "Upgrades: " + (3 - getModifiers(item)) );
if (getEmerald(item) == true) {

View File

@@ -0,0 +1,121 @@
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.items.tools.Gallagher;
import nmd.primal.core.common.recipes.irecipe.ToolCraftingRecipe;
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

@@ -32,8 +32,8 @@ 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.Anvil.AnvilBase;
import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible;
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;
@@ -308,9 +308,11 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
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;

View File

@@ -0,0 +1,14 @@
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);
}
}

View File

@@ -3,10 +3,12 @@ package nmd.primal.forgecraft.items.blocks;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -100,15 +102,18 @@ public class ItemNBTCrucible extends ItemBlock {
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
//System.out.println("We doin it?");
if (item.hasTagCompound()) {
//item.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = item.getSubCompound("BlockEntityTag");
//item.getTagCompound().setTag("BlockEntityTag", tags);
//System.out.println(tag.getBoolean("hot"));
if (!item.hasTagCompound()) {
NonNullList<ItemStack> list = NonNullList.withSize(5, ItemStack.EMPTY);
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("BlockEntityTag", tags);
ItemStackHelper.saveAllItems(tags, list);
item.getSubCompound("BlockEntityTag").setInteger("heat", 0);
item.getSubCompound("BlockEntityTag").setInteger("hot", 0);
item.getSubCompound("BlockEntityTag").setBoolean("status", false);
}
}
}

View File

@@ -1,148 +0,0 @@
package nmd.primal.forgecraft.items.parts;
import com.mojang.realmsclient.gui.ChatFormatting;
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.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
/**
* Created by mminaie on 3/9/17.
*/
public class BronzeToolPart extends Item implements ToolNBT{
private String toolType;
public BronzeToolPart(String name, ToolMaterial material, String type) {
this.setMaxDamage(material.getMaxUses());
this.setUnlocalizedName(name);
this.setRegistryName(name);
//this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.toolType = type;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
{
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (getModifiers(item) != 0) {
if (getEmerald(item)) {
return 0.1F;
}
if (getDiamondLevel(item) == 1) {
return 0.2F;
}
if ( getRedstoneLevel(item) == 1) {
return 0.3F;
}
if (getLapisLevel(item) == 1) {
return 0.4F;
}
}
if (getModifiers(item) == 0) {
return 0.0F;
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
public String getID() {
return toolType;
}
@Override
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
}
@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();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
if(item.hasTagCompound())
{
tooltip.add(ChatFormatting.GRAY + "Upgrades");
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));
}
}
}
}

View File

@@ -16,8 +16,8 @@ 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.FireHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.util.ToolMaterialMap;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
@@ -42,194 +42,45 @@ public class ToolPart extends Item implements ToolNBT{
this.toolType = type;
this.toolMaterial = material;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
{
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
hot | emerald | diamond | redstone | lapis
X.0 | 0.X | 0.0X | 0.00X | 0.000X
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
if (getHot(item) == false) {
if (getModifiers(item) != 0) {
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.1F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.11F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.12F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.111F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.102F;
}
// ============
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.01F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.02F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 3) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.03F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 3) &&
(getLapisLevel(item) == 0)) {
return 0.003F;
}
//=========
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 1)) {
return 0.0001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2)) {
return 0.0002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 3)) {
return 0.0003F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 1)) {
return 0.0111F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 2)) {
return 0.0012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 1)) {
return 0.0021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2) ) {
return 0.0102F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 1) ) {
return 0.0011F;
}
}
Float returnFloat = 0.0F;
if(getEmerald(item)){
returnFloat += 0.1F;
}
if (getHot(item) == true) {
return 1.0F;
if(getDiamondLevel(item)>0){
returnFloat += (0.01F * getDiamondLevel(item));
}
if (getHot(item) == false) {
if (getModifiers(item) == 0) {
return 0.0F;
}
if(getRedstoneLevel(item)>0){
returnFloat += (0.001F * getRedstoneLevel(item));
}
if(getLapisLevel(item)>0){
returnFloat += (0.0001F * getLapisLevel(item));
}
if(getHot(item)){
returnFloat = 1.0F;
}
return returnFloat;
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
@@ -240,9 +91,7 @@ public class ToolPart extends Item implements ToolNBT{
}
public ToolMaterial getMaterial() {return toolMaterial;}
@Override
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
public void createDefaultNBT(ItemStack item){
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
@@ -256,25 +105,19 @@ public class ToolPart extends Item implements ToolNBT{
setLapisLevel(item, 0);
setModifiers(item, 0);
}
}
@Override
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
createDefaultNBT(item);
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
//System.out.println(item.getTagCompound());
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
createDefaultNBT(item);
if (item.hasTagCompound()) {
if (item.getSubCompound("tags").getBoolean("hot")) {
player.setFire(1);
@@ -326,8 +169,8 @@ public class ToolPart extends Item implements ToolNBT{
{
if(item.hasTagCompound())
{
tooltip.add(ChatFormatting.GRAY + "Upgrades");
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.GRAY + "Upgrades left: " + (ToolMaterialMap.materialModifiers.get(this.toolMaterial) - getModifiers(item)));
if (getEmerald(item)) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {

View File

@@ -0,0 +1,10 @@
package nmd.primal.forgecraft.items.parts;
import nmd.primal.forgecraft.items.BaseItem;
public class WeaponGuard extends BaseItem {
public WeaponGuard(String registryName) {
super(registryName);
}
}

View File

@@ -0,0 +1,10 @@
package nmd.primal.forgecraft.items.parts;
import nmd.primal.forgecraft.items.BaseItem;
public class WeaponHandle extends BaseItem {
public WeaponHandle(String registryName) {
super(registryName);
}
}

View File

@@ -0,0 +1,268 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
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.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
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.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.util.ToolMaterialMap;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
public abstract class AbstractAxe extends ItemAxe implements ToolNBT {
Item drop;
public AbstractAxe(String name, ToolMaterial material, Item damageDrop, Integer damage, Float speed) {
super(material, damage, speed);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop = damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot | emerald | diamond | redstone | lapis
X.0 | 0.X | 0.0X | 0.00X | 0.000X
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
Float returnFloat = 0.0F;
if(getEmerald(item)){
returnFloat += 0.1F;
}
if(getDiamondLevel(item)>0){
returnFloat += (0.01F * getDiamondLevel(item));
}
if(getRedstoneLevel(item)>0){
returnFloat += (0.001F * getRedstoneLevel(item));
}
if(getLapisLevel(item)>0){
returnFloat += (0.0001F * getLapisLevel(item));
}
if(getHot(item)){
returnFloat = 1.0F;
}
return returnFloat;
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
item.setItemDamage(item.getMaxDamage()-5);
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(this.drop, 1));
((EntityPlayer) player).inventory.deleteStack(item);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@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 left: " + (ToolMaterialMap.materialModifiers.get(this.toolMaterial) - getModifiers(item)));
if (getEmerald(item)) {
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 boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
if(itemstack.getItem() instanceof CustomAxe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
if( getDiamondLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
//itemstack.getItem().setHarvestLevel("pickaxe", 3);
}
if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
//System.out.println(itemstack.getEnchantmentTagList());
}
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
}
}
}
return false;
}
*/
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, attacker);
return true;
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
//stack.getTagCompound().removeTag("ench");
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;
}
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state)
{
Material material = state.getMaterial();
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
if(material != Material.WOOD && material != Material.PLANTS && material != Material.VINE){
return super.getDestroySpeed(stack, state);
} else {
return this.efficiency + ( (this.getRedstoneLevel(stack) * 1.5F ));
}
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
@Override
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -0,0 +1,249 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.state.IBlockState;
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.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
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.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.util.ToolMaterialMap;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
public abstract class AbstractHoe extends ItemHoe implements ToolNBT {
private Item drop;
public AbstractHoe(String name, ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop = damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot | emerald | diamond | redstone | lapis
X.0 | 0.X | 0.0X | 0.00X | 0.000X
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
Float returnFloat = 0.0F;
if(getEmerald(item)){
returnFloat += 0.1F;
}
if(getDiamondLevel(item)>0){
returnFloat += (0.01F * getDiamondLevel(item));
}
if(getRedstoneLevel(item)>0){
returnFloat += (0.001F * getRedstoneLevel(item));
}
if(getLapisLevel(item)>0){
returnFloat += (0.0001F * getLapisLevel(item));
}
if(getHot(item)){
returnFloat = 1.0F;
}
return returnFloat;
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(this.drop, 1));
((EntityPlayer) player).inventory.deleteStack(item);
}
}
}
@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 left: " + (ToolMaterialMap.materialModifiers.get(this.toolMaterial) - 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
protected void setBlock(ItemStack stack, EntityPlayer player, World worldIn, BlockPos pos, IBlockState state)
{
worldIn.playSound(player, pos, SoundEvents.ITEM_HOE_TILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
if (!worldIn.isRemote)
{
worldIn.setBlockState(pos, state, 11);
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, player);
} else {
ItemStack dropStack = new ItemStack(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
PlayerHelper.spawnItemOnPlayer(worldIn, player, dropStack);
player.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, attacker);
return true;
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
//stack.getTagCompound().removeTag("ench");
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
@Override
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -0,0 +1,245 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
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.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
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.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.util.ToolMaterialMap;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
public abstract class AbstractPickaxe extends ItemPickaxe implements ToolNBT {
private Item drop;
public AbstractPickaxe(String name, Item.ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
//this.toolClass = "pickaxe";
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot | emerald | diamond | redstone | lapis
X.0 | 0.X | 0.0X | 0.00X | 0.000X
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
Float returnFloat = 0.0F;
if(getEmerald(item)){
returnFloat += 0.1F;
}
if(getDiamondLevel(item)>0){
returnFloat += (0.01F * getDiamondLevel(item));
}
if(getRedstoneLevel(item)>0){
returnFloat += (0.001F * getRedstoneLevel(item));
}
if(getLapisLevel(item)>0){
returnFloat += (0.0001F * getLapisLevel(item));
}
if(getHot(item)){
returnFloat = 1.0F;
}
return returnFloat;
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
//item.setItemDamage(item.getMaxDamage()-2);
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(this.drop, 1));
((EntityPlayer) player).inventory.deleteStack(item);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
if(item.hasTagCompound())
{
tooltip.add(ChatFormatting.GRAY + "Upgrades left: " + (ToolMaterialMap.materialModifiers.get(this.toolMaterial) - getModifiers(item)));
if (getEmerald(item)) {
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 boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, attacker);
return true;
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
//stack.getTagCompound().removeTag("ench");
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
player.inventory.markDirty();
//player.inventory.inventoryChanged = true;
}
}
return true;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
@Override
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state)
{
Material material = state.getMaterial();
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
if(material != Material.IRON && material != Material.ANVIL && material != Material.ROCK){
return super.getDestroySpeed(stack, state);
} else {
return this.efficiency + ( (this.getRedstoneLevel(stack) * 1.5F ));
}
}
}

View File

@@ -0,0 +1,240 @@
package nmd.primal.forgecraft.items.tools;
import com.google.common.collect.Sets;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
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.Blocks;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
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.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.util.ToolMaterialMap;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
public class AbstractShovel extends ItemSpade implements ToolNBT {
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH});
private Item drop;
public AbstractShovel(String name, Item.ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop = damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot | emerald | diamond | redstone | lapis
X.0 | 0.X | 0.0X | 0.00X | 0.000X
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
Float returnFloat = 0.0F;
if(getEmerald(item)){
returnFloat += 0.1F;
}
if(getDiamondLevel(item)>0){
returnFloat += (0.01F * getDiamondLevel(item));
}
if(getRedstoneLevel(item)>0){
returnFloat += (0.001F * getRedstoneLevel(item));
}
if(getLapisLevel(item)>0){
returnFloat += (0.0001F * getLapisLevel(item));
}
if(getHot(item)){
returnFloat = 1.0F;
}
return returnFloat;
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(this.drop, 1));
((EntityPlayer) player).inventory.deleteStack(item);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
if(item.hasTagCompound())
{
tooltip.add(ChatFormatting.GRAY + "Upgrades left: " + (ToolMaterialMap.materialModifiers.get(this.toolMaterial) - getModifiers(item)));
if (getEmerald(item)) {
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 boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, attacker);
return true;
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
//stack.getTagCompound().removeTag("ench");
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(this.drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;
}
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state)
{
for (String type : getToolClasses(stack))
{
if (state.getBlock().isToolEffective(type, state))
return (efficiency * ( (this.getRedstoneLevel(stack) * 2 ) + 1));
}
return this.EFFECTIVE_ON.contains(state.getBlock()) ? (this.efficiency + ( (this.getRedstoneLevel(stack) * 1.25F ))) : 1.0F;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
@Override
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -1,269 +0,0 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
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.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 6/25/17.
*/
public class BronzeAxe extends ItemAxe implements ToolNBT {
Item drop;
public BronzeAxe(String name, Item.ToolMaterial material, Item damageDrop) {
super(material, 5, -2f);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (getModifiers(item) != 0) {
if (getEmerald(item)) {
return 0.1F;
}
if (getDiamondLevel(item) == 1) {
return 0.2F;
}
if ( getRedstoneLevel(item) == 1) {
return 0.3F;
}
if (getLapisLevel(item) == 1) {
return 0.4F;
}
}
if (getModifiers(item) == 0) {
return 0.0F;
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
//this.setDamage(item, this.getMaxDamage(item) -2);
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenbronzetool, 1));
((EntityPlayer) player).inventory.deleteStack(item);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@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 Left: " + (1 - 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: " + "1" );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + "5" );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
//System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof CustomAxe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
/*if( getDiamondLevel(itemstack) > 0 ){
itemstack.getItem().setHarvestLevel("pickaxe", 3);
}*/
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
}
}
}
return false;
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, attacker);
return true;
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.getTagCompound().removeTag("ench");
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;
}
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state)
{
Material material = state.getMaterial();
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
if(material != Material.WOOD && material != Material.PLANTS && material != Material.VINE){
return super.getDestroySpeed(stack, state);
} else {
return this.efficiency + 1;
}
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -1,283 +0,0 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.enchantment.Enchantment;
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.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
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.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/21/17.
*/
public class BronzeHoe extends ItemHoe implements ToolNBT {
Item drop;
public BronzeHoe(String name, ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (getModifiers(item) != 0) {
if (getEmerald(item)) {
return 0.1F;
}
if (getDiamondLevel(item) == 1) {
return 0.2F;
}
if ( getRedstoneLevel(item) == 1) {
return 0.3F;
}
if (getLapisLevel(item) == 1) {
return 0.4F;
}
}
if (getModifiers(item) == 0) {
return 0.0F;
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenbronzetool, 1));
((EntityPlayer) player).inventory.deleteStack(item);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
//tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() );
if(item.hasTagCompound())
{
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - 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: " + 1 );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + 5 );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
if(itemstack.getItem() instanceof BronzeHoe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
/*if( getDiamondLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("pickaxe", 3);
}*/
/*if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
//System.out.println(itemstack.getEnchantmentTagList());
}*/
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
}
}
}
return false;
}
@Override
protected void setBlock(ItemStack stack, EntityPlayer player, World worldIn, BlockPos pos, IBlockState state)
{
worldIn.playSound(player, pos, SoundEvents.ITEM_HOE_TILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
if (!worldIn.isRemote)
{
worldIn.setBlockState(pos, state, 11);
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, player);
} else {
ItemStack dropStack = new ItemStack(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
PlayerHelper.spawnItemOnPlayer(worldIn, player, dropStack);
player.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, attacker);
return true;
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.getTagCompound().removeTag("ench");
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -1,270 +0,0 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
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.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/14/17.
*/
public class BronzePickaxe extends ItemPickaxe implements ToolNBT{
private Item drop;
public BronzePickaxe(String name, ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
//this.toolClass = "pickaxe";
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (getModifiers(item) != 0) {
if (getEmerald(item)) {
return 0.1F;
}
if (getDiamondLevel(item) == 1) {
return 0.2F;
}
if ( getRedstoneLevel(item) == 1) {
return 0.3F;
}
if (getLapisLevel(item) == 1) {
return 0.4F;
}
}
if (getModifiers(item) == 0) {
return 0.0F;
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenbronzetool, 1));
((EntityPlayer) player).inventory.deleteStack(item);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
//tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() );
if(item.hasTagCompound())
{
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - 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: " + 1 );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + 5 );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
//System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof BronzePickaxe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
/*if( getDiamondLevel(itemstack) > 0 ){
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("pickaxe", 3);
}*/
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
}
}
}
return false;
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, attacker);
return true;
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.getTagCompound().removeTag("ench");
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;
}
@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 float getDestroySpeed(ItemStack stack, IBlockState state)
{
Material material = state.getMaterial();
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
if(material != Material.IRON && material != Material.ANVIL && material != Material.ROCK){
return super.getDestroySpeed(stack, state);
} else {
return this.efficiency + 1;
}
}
}

View File

@@ -1,265 +0,0 @@
package nmd.primal.forgecraft.items.tools;
import com.google.common.collect.Sets;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
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.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/21/17.
*/
public class BronzeShovel extends ItemSpade implements ToolNBT {
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH});
Item drop;
public BronzeShovel(String name, ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (getModifiers(item) != 0) {
if (getEmerald(item)) {
return 0.1F;
}
if (getDiamondLevel(item) == 1) {
return 0.2F;
}
if ( getRedstoneLevel(item) == 1) {
return 0.3F;
}
if (getLapisLevel(item) == 1) {
return 0.4F;
}
}
if (getModifiers(item) == 0) {
return 0.0F;
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenbronzetool, 1));
((EntityPlayer) player).inventory.deleteStack(item);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
//tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() );
if(item.hasTagCompound())
{
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - 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: " + 1 );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + 5 );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
if(itemstack.getItem() instanceof BronzeShovel){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
}
}
}
return false;
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, attacker);
return true;
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.getTagCompound().removeTag("ench");
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;
}
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state)
{
for (String type : getToolClasses(stack))
{
if (state.getBlock().isToolEffective(type, state))
return efficiency;
}
return this.efficiency + 1;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -1,426 +1,44 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
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.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/20/17.
*/
public class CustomAxe extends ItemAxe implements ToolNBT {
public class CustomAxe extends AbstractAxe implements ToolNBT {
Item drop;
public CustomAxe(String name, Item.ToolMaterial material, Item damageDrop) {
super(material, 6, -3.1f);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop = damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
if (getHot(item) != true) {
if (getModifiers(item) != 0) {
if ((getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.1F;
}
if ((getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.11F;
}
if ((getEmerald(item) == true) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.12F;
}
if ((getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.111F;
}
if ((getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.102F;
}
// ============
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.01F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.02F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 3) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.03F;
}
//=======
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.001F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.002F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 3) &&
(getLapisLevel(item) == 0)) {
return 0.003F;
}
//=========
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 1)) {
return 0.0001F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2)) {
return 0.0002F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 3)) {
return 0.0003F;
}
//=======
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 1)) {
return 0.0111F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.021F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.012F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 2)) {
return 0.0012F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 1)) {
return 0.0021F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2)) {
return 0.0102F;
}
}
}
if (getHot(item) == true) {
return 1.0F;
}
if (getHot(item) == false) {
if (getModifiers(item) == 0) {
return 0.0F;
}
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
item.setItemDamage(item.getMaxDamage()-5);
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenwroughtirontool, 1));
}
if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokencleanirontool, 1));
}
if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokensteeltool, 1));
}
((EntityPlayer) player).inventory.deleteStack(item);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@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 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() );
}
}
public CustomAxe(String name, Item.ToolMaterial material, Item damageDrop, Integer damage, Float speed) {
super(name, material, damageDrop, damage, speed);
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
if(itemstack.getItem() instanceof CustomAxe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
if( getDiamondLevel(itemstack) > 0 ){
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("pickaxe", 3);
itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
//itemstack.getItem().setHarvestLevel("pickaxe", 3);
}
/*if( getRedstoneLevel(itemstack) > 0 ){
if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
//System.out.println(itemstack.getEnchantmentTagList());
}*/
}
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
}
}
}
return false;
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, attacker);
return true;
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.getTagCompound().removeTag("ench");
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;
}
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state)
{
Material material = state.getMaterial();
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
if(material != Material.WOOD && material != Material.PLANTS && material != Material.VINE){
return super.getDestroySpeed(stack, state);
} else {
return this.efficiency * ( (this.getRedstoneLevel(stack) * 2 ) + 1);
}
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -1,314 +1,21 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.enchantment.Enchantment;
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.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
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.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/21/17.
*/
public class CustomHoe extends ItemHoe implements ToolNBT {
public class CustomHoe extends AbstractHoe implements ToolNBT {
private Item drop;
public CustomHoe(String name, Item.ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop = damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
if (getHot(item) == false) {
if (getModifiers(item) != 0) {
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.1F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.11F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.12F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.111F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.102F;
}
// ============
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.01F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.02F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 3) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.03F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 3) &&
(getLapisLevel(item) == 0)) {
return 0.003F;
}
//=========
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 1)) {
return 0.0001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2)) {
return 0.0002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 3)) {
return 0.0003F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 1)) {
return 0.0111F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 2)) {
return 0.0012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 1)) {
return 0.0021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2) ) {
return 0.0102F;
}
}
}
if (getHot(item) == true) {
return 1.0F;
}
if (getHot(item) == false) {
if (getModifiers(item) == 0) {
return 0.0F;
}
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenwroughtirontool, 1));
}
if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokencleanirontool, 1));
}
if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokensteeltool, 1));
}
((EntityPlayer) player).inventory.deleteStack(item);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
if(item.hasTagCompound())
{
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() );
}
super(name, material, damageDrop);
}
@@ -316,20 +23,18 @@ public class CustomHoe extends ItemHoe implements ToolNBT {
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
if(itemstack.getItem() instanceof CustomHoe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
/*if( getDiamondLevel(itemstack) > 0 ){
if( getDiamondLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("pickaxe", 3);
}*/
/*if( getRedstoneLevel(itemstack) > 0 ){
//itemstack.getItem().setHarvestLevel("pickaxe", 3);
}
if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
//System.out.println(itemstack.getEnchantmentTagList());
}*/
}
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
}
@@ -339,95 +44,4 @@ public class CustomHoe extends ItemHoe implements ToolNBT {
return false;
}
@Override
protected void setBlock(ItemStack stack, EntityPlayer player, World worldIn, BlockPos pos, IBlockState state)
{
worldIn.playSound(player, pos, SoundEvents.ITEM_HOE_TILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
if (!worldIn.isRemote)
{
worldIn.setBlockState(pos, state, 11);
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, player);
} else {
ItemStack dropStack = new ItemStack(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
PlayerHelper.spawnItemOnPlayer(worldIn, player, dropStack);
player.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, attacker);
return true;
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.getTagCompound().removeTag("ench");
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -1,339 +1,39 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
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.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/14/17.
*/
public class CustomPickaxe extends ItemPickaxe implements ToolNBT{
public class CustomPickaxe extends AbstractPickaxe implements ToolNBT{
private Item drop;
public CustomPickaxe(String name, Item.ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
//this.toolClass = "pickaxe";
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
if (getHot(item) == false) {
if (getModifiers(item) != 0) {
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.1F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.11F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.12F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.111F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.102F;
}
// ============
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.01F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.02F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 3) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.03F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 3) &&
(getLapisLevel(item) == 0)) {
return 0.003F;
}
//=========
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 1)) {
return 0.0001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2)) {
return 0.0002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 3)) {
return 0.0003F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 1)) {
return 0.0111F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 2)) {
return 0.0012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 1)) {
return 0.0021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2) ) {
return 0.0102F;
}
}
}
if (getHot(item) == true) {
return 1.0F;
}
if (getHot(item) == false) {
if (getModifiers(item) == 0) {
return 0.0F;
}
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
//item.setItemDamage(item.getMaxDamage()-2);
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
//this.setDamage(item, this.getMaxDamage(item) -2);
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenwroughtirontool, 1));
}
if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokencleanirontool, 1));
}
if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokensteeltool, 1));
}
((EntityPlayer) player).inventory.deleteStack(item);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
//tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() );
if(item.hasTagCompound())
{
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() );
}
super(name, material, damageDrop);
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
//System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof CustomPickaxe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
if( getDiamondLevel(itemstack) > 0 ){
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("pickaxe", 3);
}
/*if( getRedstoneLevel(itemstack) > 0 ){
if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
//System.out.println(itemstack.getEnchantmentTagList());
}*/
}
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
}
@@ -343,87 +43,4 @@ public class CustomPickaxe extends ItemPickaxe implements ToolNBT{
return false;
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, attacker);
return true;
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.getTagCompound().removeTag("ench");
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
player.inventory.markDirty();
//player.inventory.inventoryChanged = true;
}
}
return true;
}
@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 float getDestroySpeed(ItemStack stack, IBlockState state)
{
Material material = state.getMaterial();
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
if(material != Material.IRON && material != Material.ANVIL && material != Material.ROCK){
return super.getDestroySpeed(stack, state);
} else {
return this.efficiency * ( (this.getRedstoneLevel(stack) * 2 ) + 1);
}
}
}

View File

@@ -1,338 +1,38 @@
package nmd.primal.forgecraft.items.tools;
import com.google.common.collect.Sets;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
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.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/21/17.
*/
public class CustomShovel extends ItemSpade implements ToolNBT {
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH});
private Item drop;
public class CustomShovel extends AbstractShovel implements ToolNBT {
public CustomShovel(String name, Item.ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
if (getHot(item) == false) {
if (getModifiers(item) != 0) {
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.1F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.11F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.12F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.111F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.102F;
}
// ============
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.01F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.02F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 3) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.03F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 3) &&
(getLapisLevel(item) == 0)) {
return 0.003F;
}
//=========
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 1)) {
return 0.0001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2)) {
return 0.0002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 3)) {
return 0.0003F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 1)) {
return 0.0111F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 2)) {
return 0.0012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 1)) {
return 0.0021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2) ) {
return 0.0102F;
}
}
}
if (getHot(item) == true) {
return 1.0F;
}
if (getHot(item) == false) {
if (getModifiers(item) == 0) {
return 0.0F;
}
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenwroughtirontool, 1));
}
if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokencleanirontool, 1));
}
if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokensteeltool, 1));
}
((EntityPlayer) player).inventory.deleteStack(item);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
if(item.hasTagCompound())
{
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() );
}
super(name, material, damageDrop);
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
if(itemstack.getItem() instanceof CustomShovel){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
if( getDiamondLevel(itemstack) > 0 ){
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("shovel", 3);
itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
//itemstack.getItem().setHarvestLevel("shovel", 3);
}
/*if( getRedstoneLevel(itemstack) > 0 ){
if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
//System.out.println(itemstack.getEnchantmentTagList());
}*/
}
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
}
@@ -342,82 +42,4 @@ public class CustomShovel extends ItemSpade implements ToolNBT {
return false;
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.damageItem(1, attacker);
return true;
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
stack.getTagCompound().removeTag("ench");
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
NBTTagCompound copyNBT = stack.getTagCompound();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;
}
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state)
{
for (String type : getToolClasses(stack))
{
if (state.getBlock().isToolEffective(type, state))
return efficiency;
}
return this.EFFECTIVE_ON.contains(state.getBlock()) ? (this.efficiency * ( (this.getRedstoneLevel(stack) * 2 ) + 1)) : 1.0F;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -1,5 +1,8 @@
package nmd.primal.forgecraft.items.weapons;
import com.google.common.collect.ImmutableMap;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -7,105 +10,69 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Enchantments;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.ItemArrow;
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
import net.minecraft.stats.StatList;
import net.minecraft.util.*;
import net.minecraft.world.World;
import net.minecraftforge.common.animation.ITimeValue;
import net.minecraftforge.common.animation.TimeValues;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.model.animation.CapabilityAnimation;
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.init.ModSounds;
import nmd.primal.forgecraft.items.BaseItem;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
/**
* Created by mminaie on 7/2/17.
*/
public class Longbow extends BaseItem {
int mod=15;
int time=0;
public class Longbow extends ItemBow {
public Longbow(String name) {
super(name);
this.setMaxDamage(9000);
this.setMaxStackSize(1);
this.setNoRepair();
this.setRegistryName(name);
this.setUnlocalizedName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter()
{
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase playerin) {
if (time < 1 * mod) {
return 0.0F;
}
if (time >= 1 * mod && time < 2 * mod) {
return 0.1F;
}
if (time >= 2 * mod && time < 3 * mod) {
return 0.2F;
}
if (time >= 3 * mod && time < 4 * mod) {
return 0.3F;
}
if (time >= 4 * mod && time < 5 * mod) {
return 0.4F;
}
if (time >= 5 * mod && time < 6 * mod) {
return 0.5F;
}
if (time >= 6 * mod && time < 7 * mod) {
return 0.6F;
}
if (time >= 7 * mod && time < 8 * mod) {
return 0.7F;
}
if (time >= 8 * mod && time < 72000) {
return 0.8F;
}
return 0.0f;
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (entityIn == null)
{
return 0.0F;
}
else
{
return entityIn.getActiveItemStack().getItem() != ModItems.longbow? 0.0F : (float)(stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 75.0F;
}
}
});
}
@Override
public void onUpdate(ItemStack item, World world, Entity playerin, int itemSlot, boolean isSelected) {
EntityPlayer player = (EntityPlayer) playerin;
if(player.inventory.getCurrentItem().getItem() == ModItems.longbow) {
time = item.getMaxItemUseDuration() - player.getItemInUseCount();
}
}
private ItemStack findAmmo(EntityPlayer player)
{
for (int i = 0; i < player.inventory.getSizeInventory(); ++i)
this.addPropertyOverride(new ResourceLocation("pulling"), new IItemPropertyGetter()
{
ItemStack itemstack = player.inventory.getStackInSlot(i);
if (this.isArrow(itemstack))
@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
return itemstack;
return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F;
}
}
return ItemStack.EMPTY;
});
}
protected boolean isArrow(ItemStack stack)
{
return stack.getItem() instanceof ItemArrow;
public String getName() {
return this.getRegistryName().toString();
}
/**
* Called when the player stops using an Item (stops holding the right mouse button).
*/
@@ -140,9 +107,11 @@ public class Longbow extends BaseItem {
{
ItemArrow itemarrow = (ItemArrow)((ItemArrow)(itemstack.getItem() instanceof ItemArrow ? itemstack.getItem() : Items.ARROW));
EntityArrow entityarrow = itemarrow.createArrow(worldIn, itemstack, entityplayer);
entityarrow.shoot(entityplayer, entityplayer.rotationPitch, entityplayer.rotationYaw, 0.0F, f * 6.0F, 1.0F);
System.out.println(f);
entityarrow.setDamage(entityarrow.getDamage()+(entityarrow.getDamage()*f));
entityarrow.shoot(entityplayer, entityplayer.rotationPitch, entityplayer.rotationYaw, 0.0F, f * 6.0F, 0.5F);
if (f >= 1.0F)
if (f >= 0.5F)
{
entityarrow.setIsCritical(true);
}
@@ -173,47 +142,10 @@ public class Longbow extends BaseItem {
}
}
/**
* Gets the velocity of the arrow entity from the bow's charge
*/
public static float getArrowVelocity(int charge)
{
float f = (float)charge / 5.0F;
f = (f * f + f * 2.0F);
if (f > 1.0F)
{
f = 1.0F;
}
return f;
}
/**
* How long it takes to use or consume an item
*/
@Override
public int getMaxItemUseDuration(ItemStack stack)
{
return 72000;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
@Override
public EnumAction getItemUseAction(ItemStack stack)
{
return EnumAction.BOW;
}
/**
* Called when the equipped item is right clicked.
*/
@Override
/*@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
{
ItemStack itemstack = playerIn.getHeldItem(handIn);
@@ -231,6 +163,42 @@ public class Longbow extends BaseItem {
playerIn.setActiveHand(handIn);
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
}*/
/*
private ItemStack findAmmo(EntityPlayer player)
{
for (int i = 0; i < player.inventory.getSizeInventory(); ++i)
{
ItemStack itemstack = player.inventory.getStackInSlot(i);
if (this.isArrow(itemstack))
{
return itemstack;
}
}
return ItemStack.EMPTY;
}
/*
/**
* Gets the velocity of the arrow entity from the bow's charge
*/
public static float getArrowVelocity(int charge)
{
float f = (float)charge / 60;
if (f > 1.0F)
{
f = 1.0F;
}
if(f < 0.1){
f =0.1f;
}
return f;
}
@Override
@@ -238,4 +206,39 @@ public class Longbow extends BaseItem {
{
return 0;
}
private ItemStack findAmmo(EntityPlayer player)
{
if (this.isArrow(player.getHeldItem(EnumHand.OFF_HAND)))
{
return player.getHeldItem(EnumHand.OFF_HAND);
}
else if (this.isArrow(player.getHeldItem(EnumHand.MAIN_HAND)))
{
return player.getHeldItem(EnumHand.MAIN_HAND);
}
else
{
for (int i = 0; i < player.inventory.getSizeInventory(); ++i)
{
ItemStack itemstack = player.inventory.getStackInSlot(i);
if (this.isArrow(itemstack))
{
return itemstack;
}
}
return ItemStack.EMPTY;
}
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
if(!stack.isEmpty()) {
tooltip.add(ChatFormatting.GRAY + "The longbow will increase the damage and the velocity of the arrow it shoots relative to how far its drawn.");
}
}
}

View File

@@ -0,0 +1,28 @@
package nmd.primal.forgecraft.items.weapons;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.items.BaseItem;
import javax.annotation.Nullable;
import java.util.List;
public class RawLongbow extends BaseItem {
public RawLongbow(String registryName) {
super(registryName);
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.add(ChatFormatting.GRAY + "Stack two Yew Staves in-world and right-click the bottom Yew Stave with a Work Blade");
}
}

View File

@@ -2,12 +2,10 @@ package nmd.primal.forgecraft.proxy;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.item.Item;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.init.ModTileRenders;
import nmd.primal.forgecraft.models.ModelPlateHelmet;
import nmd.primal.forgecraft.renders.blocks.*;
import nmd.primal.forgecraft.tiles.*;
import java.util.HashMap;
import java.util.Map;
@@ -38,12 +36,7 @@ public class ClientProxy implements CommonProxy {
//@Override
public void registerTileRendering()
{
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());
ModTileRenders.init();
}
public void registerModels(){

View File

@@ -13,8 +13,8 @@ import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.blocks.Anvil.AnvilBase;
import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
import nmd.primal.forgecraft.blocks.AnvilBase;
import nmd.primal.forgecraft.blocks.AnvilStone;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.BaseMultiItem;
import nmd.primal.forgecraft.tiles.TileAnvil;

View File

@@ -0,0 +1,381 @@
package nmd.primal.forgecraft.renders.blocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import nmd.primal.forgecraft.blocks.machine.Workbench;
import nmd.primal.forgecraft.tiles.TileWorkbench;
import org.lwjgl.opengl.GL11;
/**
* Created by kitsu on 12/4/2016.
*/
public class TileWorkbenchRender extends TileEntitySpecialRenderer<TileWorkbench>
{
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
@Override
public void render(TileWorkbench tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha)
{
BlockPos pos = tile.getPos();
IBlockState state = this.getWorld().getBlockState(pos);
if (state.getBlock() instanceof Workbench) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
//GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float prevLGTX = OpenGlHelper.lastBrightnessX;
float prevLGTY = OpenGlHelper.lastBrightnessY;
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
ItemStack stack0 = tile.getSlotStack(0);
ItemStack stack1 = tile.getSlotStack(1);
ItemStack stack2 = tile.getSlotStack(2);
ItemStack stack3 = tile.getSlotStack(3);
ItemStack stack4 = tile.getSlotStack(4);
ItemStack stack5 = tile.getSlotStack(5);
ItemStack stack6 = tile.getSlotStack(6);
if (state.getValue(Workbench.FACING) == EnumFacing.NORTH) {
if (!stack0.isEmpty()) {
boolean is_block = stack0.getItem() instanceof ItemBlock;
float scale = is_block ? 0.5F : 0.3F;
double trans = is_block ? 0.3125D : 0.3125D;
double yTrans = is_block ? 0.3D : 0.3D;
GL11.glPushMatrix();
GL11.glTranslated(trans, yTrans, 0.25D);
GL11.glScalef(scale, scale, scale);
GL11.glRotated(180.0F, 0.0F, 1.0F, 0.0F);
renderItem.renderItem(stack0, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (!stack1.isEmpty()) {
boolean is_block = stack1.getItem() instanceof ItemBlock;
float scale = is_block ? 0.5F : 0.3F;
double trans = is_block ? 0.3125D : 0.3125D;
double yTrans = is_block ? 0.3D : 0.3D;
GL11.glPushMatrix();
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(trans+0.375D, yTrans, 0.25D);
GL11.glScalef(scale, scale, scale);
GL11.glRotated(180.0F, 0.0F, 1.0F, 0.0F);
renderItem.renderItem(stack1, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(!stack2.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.4375, 0.71875D, 0.26D);
GL11.glScalef(0.7F, 1F, 0.55F);
GL11.glRotated(-45.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack2, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(!stack3.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.37D, 0.27D, 0.21D);
GL11.glScalef(1F, 1F, 1F);
GL11.glRotated(-90.0F, 0.0F, 1.0F, 0.0F);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack3, ItemCameraTransforms.TransformType.HEAD);
GL11.glPopMatrix();
}
if(!stack4.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.85, 0.71875D, 0.25D);
GL11.glScalef(0.3F, 0.3F, 0.3F);
GL11.glRotated(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack4, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(!stack5.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.48D, 0.3D, -0.15D);
GL11.glScalef(1F, 1F, 1F);
GL11.glRotated(-90.0F, 0.0F, 1.0F, 0.0F);
//GL11.glRotated(-90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack5, ItemCameraTransforms.TransformType.HEAD);
GL11.glPopMatrix();
}
}
if (state.getValue(Workbench.FACING) == EnumFacing.SOUTH) {
if (!stack0.isEmpty()) {
boolean is_block = stack0.getItem() instanceof ItemBlock;
float scale = is_block ? 0.5F : 0.3F;
double trans = is_block ? 0.3125D : 0.3125D;
double yTrans = is_block ? 0.3D : 0.3D;
GL11.glPushMatrix();
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(trans+0.375D, yTrans, 0.75D);
GL11.glScalef(scale, scale, scale);
renderItem.renderItem(stack0, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (!stack1.isEmpty()) {
boolean is_block = stack1.getItem() instanceof ItemBlock;
float scale = is_block ? 0.5F : 0.3F;
double trans = is_block ? 0.3125D : 0.3125D;
double yTrans = is_block ? 0.3D : 0.3D;
GL11.glPushMatrix();
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(trans, yTrans, 0.75D);
GL11.glScalef(scale, scale, scale);
renderItem.renderItem(stack1, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(!stack2.isEmpty()){
GL11.glPushMatrix();
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.5625, 0.71875D, 0.7925D);
GL11.glScalef(0.7F, 1F, 0.55F);
GL11.glRotated(-45.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack2, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(!stack3.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.55, 0.27D, 0.77D);
GL11.glScalef(1F, 1F, 1F);
GL11.glRotated(90.0F, 0.0F, 1.0F, 0.0F);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack3, ItemCameraTransforms.TransformType.HEAD);
GL11.glPopMatrix();
}
if(!stack4.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.175, 0.71875D, 0.78D);
GL11.glScalef(0.3F, 0.3F, 0.3F);
GL11.glRotated(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack4, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(!stack5.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.52D, 0.3D, 1.15D);
GL11.glScalef(1F, 1F, 1F);
GL11.glRotated(90.0F, 0.0F, 1.0F, 0.0F);
//GL11.glRotated(-90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack5, ItemCameraTransforms.TransformType.HEAD);
GL11.glPopMatrix();
}
}
if (state.getValue(Workbench.FACING) == EnumFacing.EAST) {
if (!stack0.isEmpty()) {
boolean is_block = stack0.getItem() instanceof ItemBlock;
float scale = is_block ? 0.5F : 0.3F;
double trans = is_block ? 0.3125D : 0.3125D;
double yTrans = is_block ? 0.3D : 0.3D;
GL11.glPushMatrix();
GL11.glTranslated(0.75D, yTrans, trans);
GL11.glScalef(scale, scale, scale);
GL11.glRotated(90F, 0.0F, 1.0F, 0.0F);
renderItem.renderItem(stack0, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (!stack1.isEmpty()) {
boolean is_block = stack1.getItem() instanceof ItemBlock;
float scale = is_block ? 0.5F : 0.3F;
double trans = is_block ? 0.3125D : 0.3125D;
double yTrans = is_block ? 0.3D : 0.3D;
GL11.glPushMatrix();
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.75D, yTrans, trans+0.375D);
GL11.glScalef(scale, scale, scale);
GL11.glRotated(90F, 0.0F, 1.0F, 0.0F);
renderItem.renderItem(stack1, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(!stack2.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.7925D, 0.71875D, 0.4375);
GL11.glScalef(0.55F, 1F, 0.7F);
GL11.glRotated(45F, 0.0F, 1.0F, 0.0F);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack2, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(!stack3.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.75, 0.27D, 0.4D);
GL11.glScalef(1F, 1F, 1F);
GL11.glRotated(180.0F, 0.0F, 1.0F, 0.0F);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack3, ItemCameraTransforms.TransformType.HEAD);
GL11.glPopMatrix();
}
if(!stack4.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.755, 0.71875D, 0.8D);
GL11.glScalef(0.3F, 0.3F, 0.3F);
GL11.glRotated(-45.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack4, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(!stack5.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(1.15D, 0.3D, 0.485D);
GL11.glScalef(1F, 1F, 1F);
GL11.glRotated(180.0F, 0.0F, 1.0F, 0.0F);
//GL11.glRotated(-90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack5, ItemCameraTransforms.TransformType.HEAD);
GL11.glPopMatrix();
}
}
if (state.getValue(Workbench.FACING) == EnumFacing.WEST) {
if (!stack0.isEmpty()) {
boolean is_block = stack0.getItem() instanceof ItemBlock;
float scale = is_block ? 0.5F : 0.3F;
double trans = is_block ? 0.3125D : 0.3125D;
double yTrans = is_block ? 0.3D : 0.3D;
GL11.glPushMatrix();
GL11.glTranslated(0.25D, yTrans, trans+0.375D);
GL11.glScalef(scale, scale, scale);
GL11.glRotated(-90F, 0.0F, 1.0F, 0.0F);
renderItem.renderItem(stack0, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (!stack1.isEmpty()) {
boolean is_block = stack1.getItem() instanceof ItemBlock;
float scale = is_block ? 0.5F : 0.3F;
double trans = is_block ? 0.3125D : 0.3125D;
double yTrans = is_block ? 0.3D : 0.3D;
GL11.glPushMatrix();
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.25D, yTrans, trans);
GL11.glScalef(scale, scale, scale);
GL11.glRotated(-90F, 0.0F, 1.0F, 0.0F);
renderItem.renderItem(stack1, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(!stack2.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.255D, 0.71875D, 0.565);
GL11.glScalef(0.55F, 1F, 0.7F);
GL11.glRotated(45F, 0.0F, 1.0F, 0.0F);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack2, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(!stack3.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.235, 0.27D, 0.6D);
GL11.glScalef(1F, 1F, 1F);
//GL11.glRotated(-180.0F, 0.0F, 1.0F, 0.0F);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack3, ItemCameraTransforms.TransformType.HEAD);
GL11.glPopMatrix();
}
if(!stack4.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.2175, 0.71875D, 0.185D);
GL11.glScalef(0.3F, 0.3F, 0.3F);
GL11.glRotated(-45.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack4, ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(!stack5.isEmpty()){
GL11.glPushMatrix();
//System.out.println(stack2);
//GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(-0.138D, 0.3D, 0.52D);
GL11.glScalef(1F, 1F, 1F);
//GL11.glRotated(180.0F, 0.0F, 1.0F, 0.0F);
//GL11.glRotated(-90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack5, ItemCameraTransforms.TransformType.HEAD);
GL11.glPopMatrix();
}
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
GL11.glPopMatrix();
}
}
}

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