mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
560dc3d267 | ||
|
|
87639e10f1 | ||
|
|
f116039c2d | ||
|
|
fe350b1248 | ||
|
|
ee9a3b5d15 | ||
|
|
fd928438fc | ||
|
|
d4b8ad8f8e | ||
|
|
c4d699a0bf | ||
|
|
449ef424a3 | ||
|
|
6789bd3967 |
No files matched your search
@@ -3,9 +3,9 @@ name: Build and test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main, release/** ]
|
||||
branches: [ master, main ]
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
branches: [ master, main ]
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
name: Optimize images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
jobs:
|
||||
optimize-images:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||
secrets: inherit
|
||||
@@ -30,4 +30,3 @@ src/main/resources/mixins.*([!.]).json
|
||||
*.bat
|
||||
*.DS_Store
|
||||
!gradlew.bat
|
||||
layout.json
|
||||
@@ -0,0 +1,5 @@
|
||||
//version: 1707058017
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhconvention'
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
plugins {
|
||||
id("com.gtnewhorizons.gtnhconvention")
|
||||
}
|
||||
+16
-20
@@ -1,27 +1,23 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.25-GTNH:dev')
|
||||
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive=false}
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-NH:1.0.2:api')
|
||||
api('com.github.GTNewHorizons:ThaumicBoots:1.5.13:dev') {transitive=false}
|
||||
api('com.github.GTNewHorizons:Baubles:1.0.4:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-402-GTNH:api')
|
||||
|
||||
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.11.1-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.4.6:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.8.0:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.6.0:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.8.0:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.12.1-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.4.8:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenLib:1.2.1:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.11-GTNH:api') {transitive=false}
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.13.39-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.5.15:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.49:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.8.9:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.19.34:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.14.120-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:2.0.0:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.22:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.64-GTNH:api') {transitive=false}
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:api') {transitive=false}
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.54.242:dev") {exclude group: 'com.github.GTNewHorizons', module: 'ThaumicTinkerer'}
|
||||
compileOnly('curse.maven:computercraft-67504:2269339')
|
||||
compileOnly('curse.maven:cofh-lib-220333:2388748')
|
||||
compileOnly('curse.maven:cofh-core-69162:2388751')
|
||||
|
||||
// For testing purposes
|
||||
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:Electro-Magic-Tools:1.7.25:dev")
|
||||
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:AspectRecipeIndex:1.1.5:dev')
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:api') {transitive=false}
|
||||
}
|
||||
+9
-57
@@ -14,7 +14,7 @@ modId = ThaumicTinkerer
|
||||
modGroup = thaumic.tinkerer
|
||||
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# When false, com.github.GTNewHorizons is used.
|
||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
@@ -39,37 +39,13 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Enables modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||
# - modern: Native modern Java bytecode, no downgrading
|
||||
enableModernJavaSyntax = jabel
|
||||
|
||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||
# and should *not* be used in most situations. -1 disables this.
|
||||
# forceToolchainVersion = -1
|
||||
|
||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||
# downgradeTargetVersion = 8
|
||||
|
||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||
|
||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||
# - shade: Shade minimized stubs into the jar
|
||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||
# - (empty): Warning reminding you to configure stubs
|
||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||
# jvmDowngraderStubsProvider =
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = false
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = true
|
||||
enableGenericInjection = false
|
||||
|
||||
# Generate a class with a String field for the mod version named as defined below.
|
||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||
@@ -109,20 +85,13 @@ accessTransformersFile = ThaumicTinkerer_at.cfg
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = true
|
||||
|
||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
||||
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
||||
# Mixin classes will have access to "main" classes, but not the other way around.
|
||||
separateMixinSourceSet =
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = false
|
||||
usesMixinDebug = true
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. The package must exist or
|
||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||
# it must match with this or the build will fail.
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
mixinsPackage = mixins
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
@@ -148,15 +117,9 @@ minimizeShadowedDependencies = true
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
||||
# list of strings, with the acceptable keys being(case does not matter):
|
||||
# cursemaven
|
||||
# modrinth
|
||||
excludeWellKnownRepositories =
|
||||
|
||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||
@@ -177,7 +140,7 @@ modrinthProjectId =
|
||||
# type can be one of [project, version],
|
||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
@@ -186,11 +149,6 @@ modrinthRelations =
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# Comma-separated supported CurseForge environments: client, server (case-insensitive).
|
||||
# Use client or server for mods that only support one environment. Defaults to client,server.
|
||||
# These tags describe where the mod can run, not whether installation is required on both sides.
|
||||
curseForgeEnvironments = client,server
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
@@ -203,12 +161,6 @@ curseForgeRelations =
|
||||
# projects. New projects should not use this parameter.
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||
# runClientWorkingDirectory = run/client
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||
# runServerWorkingDirectory = run/server
|
||||
|
||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||
# The check is ONLY performed if the version is a git tag.
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+1
-3
@@ -1,9 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -15,12 +15,10 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# gradlew start up script for POSIX generated by Gradle.
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
@@ -29,7 +27,7 @@
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh gradlew
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
@@ -57,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -86,7 +84,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -114,6 +112,7 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -171,6 +170,7 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -203,14 +203,15 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
Vendored
+24
-14
@@ -13,18 +13,16 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem gradlew startup script for Windows
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@@ -51,7 +49,7 @@ echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
@@ -65,18 +63,30 @@ echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute gradlew
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,15 +1,4 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven {
|
||||
name = 'glease'
|
||||
url = 'https://maven.glease.net/repos/releases/'
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroup('net.glease')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name = "GTNH Maven"
|
||||
url = uri("https://nexus.gtnewhorizons.com/repository/public/")
|
||||
name "GTNH Maven"
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.gtnewhorizons.gtnhsettingsconvention") version "2.0.34"
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23'
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package thaumic.tinkerer.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
public class VisweaverRecipe {
|
||||
|
||||
private final int centivisCost;
|
||||
private final Aspect centivisType;
|
||||
private final ItemStack input;
|
||||
private final ItemStack output;
|
||||
|
||||
VisweaverRecipe(int centivisCost, Aspect centivisType, ItemStack input, ItemStack output) {
|
||||
this.centivisCost = centivisCost;
|
||||
this.centivisType = centivisType;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
public int getCentivisCost() {
|
||||
return centivisCost;
|
||||
}
|
||||
|
||||
public Aspect getCentivisType() {
|
||||
return centivisType;
|
||||
}
|
||||
|
||||
public ItemStack getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package thaumic.tinkerer.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumic.tinkerer.common.core.helper.ItemHashStrategy;
|
||||
|
||||
public class VisweaverRecipeMap {
|
||||
|
||||
/*
|
||||
* Hashmap using a hashing strategy suited to comparing items
|
||||
*/
|
||||
private static final Object2ObjectOpenCustomHashMap<ItemStack, VisweaverRecipe> recipeMap = new Object2ObjectOpenCustomHashMap<>(
|
||||
new ItemHashStrategy());
|
||||
|
||||
private VisweaverRecipeMap() {}
|
||||
|
||||
public static VisweaverRecipe lookup(ItemStack input) {
|
||||
return recipeMap.get(input);
|
||||
}
|
||||
|
||||
public static void putRecipe(int centivisCost, Aspect centivisType, ItemStack input, ItemStack output) {
|
||||
VisweaverRecipe recipe = new VisweaverRecipe(centivisCost, centivisType, input, output);
|
||||
recipeMap.put(input, recipe);
|
||||
}
|
||||
}
|
||||
+29
-19
@@ -8,6 +8,7 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
@@ -16,54 +17,63 @@ import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.item.kami.ItemPlacementMirror;
|
||||
import thaumic.tinkerer.common.registry.TTRegistry;
|
||||
|
||||
public final class PlacementMirrorPredictionRenderer {
|
||||
|
||||
private final RenderBlocks blockRender;
|
||||
|
||||
public PlacementMirrorPredictionRenderer() {
|
||||
this.blockRender = new RenderBlocks();
|
||||
blockRender.useInventoryTint = false;
|
||||
}
|
||||
RenderBlocks blockRender = new RenderBlocks();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
List<EntityPlayer> playerEntities = world.playerEntities;
|
||||
for (EntityPlayer player : playerEntities) {
|
||||
ItemStack currentStack = player.getCurrentEquippedItem();
|
||||
if (currentStack != null && currentStack.getItem() == TTRegistry.itemPlacementMirror) {
|
||||
if (currentStack != null
|
||||
&& currentStack.getItem()
|
||||
== ThaumicTinkerer.registry.getFirstItemFromClass(ItemPlacementMirror.class)
|
||||
&& ItemPlacementMirror.getBlock(currentStack) != Blocks.air) {
|
||||
renderPlayerLook(player, currentStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderPlayerLook(EntityPlayer player, ItemStack stack) {
|
||||
Block requiredBlock = ItemPlacementMirror.getBlock(stack);
|
||||
if (requiredBlock == null) return;
|
||||
int requiredMetadata = ItemPlacementMirror.getBlockMeta(stack);
|
||||
List<ChunkCoordinates> coords = ItemPlacementMirror.getBlocksToPlace(stack, player);
|
||||
if (ItemPlacementMirror.hasBlocks(player, requiredBlock, requiredMetadata, coords.size())) {
|
||||
ChunkCoordinates[] coords = ItemPlacementMirror.getBlocksToPlace(stack, player);
|
||||
if (ItemPlacementMirror.hasBlocks(stack, player, coords)) {
|
||||
ItemStack block = new ItemStack(
|
||||
ItemPlacementMirror.getBlock(stack),
|
||||
1,
|
||||
ItemPlacementMirror.getBlockMeta(stack));
|
||||
ChunkCoordinates lastCoords = new ChunkCoordinates(0, 0, 0);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.6F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
|
||||
for (ChunkCoordinates coord : coords) {
|
||||
renderBlockAt(requiredBlock, requiredMetadata, coord);
|
||||
renderBlockAt(block, coord, lastCoords);
|
||||
lastCoords = coord;
|
||||
}
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private void renderBlockAt(Block block, int metadata, ChunkCoordinates pos) {
|
||||
private void renderBlockAt(ItemStack block, ChunkCoordinates pos, ChunkCoordinates last) {
|
||||
if (block.getItem() == null) return;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(
|
||||
pos.posX + 0.5 - RenderManager.renderPosX,
|
||||
pos.posY + 0.5 - RenderManager.renderPosY,
|
||||
pos.posZ + 0.5 - RenderManager.renderPosZ);
|
||||
blockRender.renderBlockAsItem(block, metadata, 1F);
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.6F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
blockRender.useInventoryTint = false;
|
||||
blockRender.renderBlockAsItem(Block.getBlockFromItem(block.getItem()), block.getItemDamage(), 1F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -23,10 +23,9 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumic.tinkerer.client.core.handler.ClientTickHandler;
|
||||
@@ -41,6 +40,7 @@ import thaumic.tinkerer.client.lib.LibRenderIDs;
|
||||
import thaumic.tinkerer.client.render.block.RenderInfusedCrops;
|
||||
import thaumic.tinkerer.client.render.block.RenderMagnet;
|
||||
import thaumic.tinkerer.client.render.block.RenderRepairer;
|
||||
import thaumic.tinkerer.client.render.block.RenderVisweaver;
|
||||
import thaumic.tinkerer.client.render.block.kami.RenderWarpGate;
|
||||
import thaumic.tinkerer.client.render.item.RenderGenericSeeds;
|
||||
import thaumic.tinkerer.client.render.item.RenderMobDisplay;
|
||||
@@ -50,27 +50,25 @@ import thaumic.tinkerer.client.render.tile.RenderTileEnchanter;
|
||||
import thaumic.tinkerer.client.render.tile.RenderTileFunnel;
|
||||
import thaumic.tinkerer.client.render.tile.RenderTileMagnet;
|
||||
import thaumic.tinkerer.client.render.tile.RenderTileRepairer;
|
||||
import thaumic.tinkerer.client.render.tile.RenderTileVisweaver;
|
||||
import thaumic.tinkerer.client.render.tile.kami.RenderTileWarpGate;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.tile.TileEnchanter;
|
||||
import thaumic.tinkerer.common.block.tile.TileFunnel;
|
||||
import thaumic.tinkerer.common.block.tile.TileMagnet;
|
||||
import thaumic.tinkerer.common.block.tile.TileRepairer;
|
||||
import thaumic.tinkerer.common.block.tile.TileVisweaver;
|
||||
import thaumic.tinkerer.common.block.tile.kami.TileWarpGate;
|
||||
import thaumic.tinkerer.common.block.tile.tablet.TileAnimationTablet;
|
||||
import thaumic.tinkerer.common.compat.FumeTool;
|
||||
import thaumic.tinkerer.common.compat.LoadedMods;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
import thaumic.tinkerer.common.core.proxy.TTCommonProxy;
|
||||
import thaumic.tinkerer.common.item.ItemInfusedSeeds;
|
||||
import thaumic.tinkerer.common.item.ItemMobDisplay;
|
||||
import thaumic.tinkerer.common.item.kami.ItemPlacementMirror;
|
||||
import thaumic.tinkerer.common.item.kami.foci.ItemFocusShadowbeam;
|
||||
import thaumic.tinkerer.common.potion.PotionEffectHandlerClient;
|
||||
|
||||
public final class TTClientProxy extends TTCommonProxy {
|
||||
|
||||
private PotionEffectHandlerClient potionHandlerClient;
|
||||
public class TTClientProxy extends TTCommonProxy {
|
||||
|
||||
public static EntityPlayer getPlayer() {
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
@@ -79,21 +77,18 @@ public final class TTClientProxy extends TTCommonProxy {
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
super.preInit(event);
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
if (LoadedMods.computerCraftLoaded) {
|
||||
if (Loader.isModLoaded("ComputerCraft")) {
|
||||
MinecraftForge.EVENT_BUS.register(new FumeTool());
|
||||
}
|
||||
|
||||
if (ConfigHandler.enableKami) {
|
||||
if (ConfigHandler.enableKami)
|
||||
// kamiRarity = EnumHelperClient.addRarity("KAMI", 0x6, "Kami");
|
||||
|
||||
kamiRarity = EnumHelperClient.addEnum(
|
||||
new Class[][] { { EnumRarity.class, EnumChatFormatting.class, String.class } },
|
||||
EnumRarity.class,
|
||||
"KAMI",
|
||||
EnumChatFormatting.LIGHT_PURPLE,
|
||||
"Kami");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -116,28 +111,13 @@ public final class TTClientProxy extends TTCommonProxy {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) {
|
||||
this.potionHandlerClient = new PotionEffectHandlerClient();
|
||||
MinecraftForge.EVENT_BUS.register(potionHandlerClient);
|
||||
FMLCommonHandler.instance().bus().register(potionHandlerClient);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) {
|
||||
if (this.potionHandlerClient != null) {
|
||||
MinecraftForge.EVENT_BUS.unregister(potionHandlerClient);
|
||||
FMLCommonHandler.instance().bus().unregister(potionHandlerClient);
|
||||
this.potionHandlerClient = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void registerTiles() {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAnimationTablet.class, new RenderTileAnimationTablet());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileMagnet.class, new RenderTileMagnet());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEnchanter.class, new RenderTileEnchanter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileFunnel.class, new RenderTileFunnel());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileRepairer.class, new RenderTileRepairer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileVisweaver.class, new RenderTileVisweaver());
|
||||
|
||||
LibRenderIDs.idGrain = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(LibRenderIDs.idGrain, new RenderInfusedCrops());
|
||||
@@ -151,14 +131,14 @@ public final class TTClientProxy extends TTCommonProxy {
|
||||
LibRenderIDs.idMagnet = RenderingRegistry.getNextAvailableRenderId();
|
||||
LibRenderIDs.idRepairer = RenderingRegistry.getNextAvailableRenderId();
|
||||
LibRenderIDs.idFire = RenderingRegistry.getNextAvailableRenderId();
|
||||
LibRenderIDs.idVisweaver = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new RenderMagnet());
|
||||
RenderingRegistry.registerBlockHandler(new RenderRepairer());
|
||||
RenderingRegistry.registerBlockHandler(new RenderVisweaver());
|
||||
|
||||
RenderMobDisplay mobDisplayRenderer = new RenderMobDisplay();
|
||||
MinecraftForge.EVENT_BUS.register(mobDisplayRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
ThaumicTinkerer.registry.getFirstItemFromClass(ItemMobDisplay.class),
|
||||
mobDisplayRenderer);
|
||||
new RenderMobDisplay());
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
ThaumicTinkerer.registry.getFirstItemFromClass(ItemInfusedSeeds.class),
|
||||
new RenderGenericSeeds());
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package thaumic.tinkerer.client.gui;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import thaumic.tinkerer.client.core.helper.ClientHelper;
|
||||
import thaumic.tinkerer.client.lib.LibResources;
|
||||
import thaumic.tinkerer.common.block.tile.TileVisweaver;
|
||||
import thaumic.tinkerer.common.block.tile.container.ContainerVisweaver;
|
||||
|
||||
public class GUIVisweaver extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_VISWEAVER);
|
||||
public TileVisweaver visweaver;
|
||||
public List<String> tooltip = new ArrayList<>();
|
||||
int x, y;
|
||||
ItemStack lastTickStack;
|
||||
ItemStack currentStack;
|
||||
|
||||
public GUIVisweaver(TileVisweaver visweaver, InventoryPlayer inv) {
|
||||
super(new ContainerVisweaver(visweaver, inv));
|
||||
this.visweaver = visweaver;
|
||||
lastTickStack = visweaver.getStackInSlot(0);
|
||||
currentStack = visweaver.getStackInSlot(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
currentStack = visweaver.getStackInSlot(0);
|
||||
lastTickStack = currentStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
if (visweaver.isWorking()) {
|
||||
int pixels = (int) (67D * ((double) visweaver.getInternalVis() / (double) visweaver.getRequiredVis()));
|
||||
|
||||
// Draw aspect color to fill
|
||||
Color color = new Color(visweaver.getCvType().getColor());
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
drawTexturedModalRect(x + 56, y + 35, 185, 10, pixels, 8);
|
||||
}
|
||||
|
||||
// Draw aspect "container" over progressbar
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
drawTexturedModalRect(x + 49, y + 34, 178, 0, 78, 10);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
if (!tooltip.isEmpty()) ClientHelper.renderTooltip(par1 - x, par2 - y, tooltip);
|
||||
tooltip.clear();
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,7 @@ public class GuiAnimationTablet extends GuiContainer {
|
||||
int x, y;
|
||||
|
||||
TileAnimationTablet tablet;
|
||||
List<GuiButtonAT> buttonListAT = new ArrayList<>();
|
||||
List<IRadioButton> radioButtons = new ArrayList<>();
|
||||
|
||||
public GuiAnimationTablet(TileAnimationTablet tablet, InventoryPlayer playerInv) {
|
||||
@@ -50,26 +51,25 @@ public class GuiAnimationTablet extends GuiContainer {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
buttonListAT.clear();
|
||||
addButton(new GuiButtonAT(0, x + xSize / 2 - 7, y + 60, tablet.redstone));
|
||||
addButton(new GuiButtonATRadio(1, x + 52, y + 15, tablet.leftClick, radioButtons));
|
||||
addButton(new GuiButtonATRadio(2, x + 111, y + 15, !tablet.leftClick, radioButtons));
|
||||
buttonList = buttonListAT;
|
||||
}
|
||||
|
||||
private void addButton(GuiButtonAT button) {
|
||||
buttonList.add(button);
|
||||
buttonListAT.add(button);
|
||||
if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
var button0 = (GuiButtonAT) buttonList.get(0);
|
||||
if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else {
|
||||
button0.buttonEnabled = !button0.buttonEnabled;
|
||||
}
|
||||
else buttonListAT.get(0).buttonEnabled = !buttonListAT.get(0).buttonEnabled;
|
||||
|
||||
tablet.leftClick = ((GuiButtonAT) buttonList.get(1)).buttonEnabled;
|
||||
tablet.redstone = button0.buttonEnabled;
|
||||
tablet.leftClick = buttonListAT.get(1).buttonEnabled;
|
||||
tablet.redstone = buttonListAT.get(0).buttonEnabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketTabletButton(tablet));
|
||||
}
|
||||
|
||||
@@ -127,11 +127,11 @@ public class GuiEnchanting extends GuiContainer {
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton.id == 0) {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterStartWorking());
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterStartWorking(enchanter));
|
||||
} else if (par1GuiButton.id <= 16) {
|
||||
GuiButtonEnchantment button = enchantButtons[par1GuiButton.id - 1];
|
||||
if (button != null && button.enchant != null)
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(button.enchant.effectId, 0));
|
||||
if (button != null && button.enchant != null) ThaumicTinkerer.netHandler
|
||||
.sendToServer(new PacketEnchanterAddEnchant(enchanter, button.enchant.effectId, 0));
|
||||
} else {
|
||||
int type = (par1GuiButton.id - 17) % 3;
|
||||
int index = (par1GuiButton.id - 17) / 3;
|
||||
@@ -143,15 +143,20 @@ public class GuiEnchanting extends GuiContainer {
|
||||
Enchantment enchant = Enchantment.enchantmentsList[enchanter.enchantments.get(index)];
|
||||
|
||||
switch (type) {
|
||||
case 0 -> {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchant.effectId, -1));
|
||||
}
|
||||
case 1 -> {
|
||||
case 0: {
|
||||
ThaumicTinkerer.netHandler
|
||||
.sendToServer(new PacketEnchanterAddEnchant(enchant.effectId, level == 1 ? -1 : level - 1));
|
||||
.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, -1));
|
||||
break;
|
||||
}
|
||||
case 2 -> {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchant.effectId, level + 1));
|
||||
case 1: {
|
||||
ThaumicTinkerer.netHandler.sendToServer(
|
||||
new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level == 1 ? -1 : level - 1));
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
ThaumicTinkerer.netHandler
|
||||
.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,10 +37,12 @@ public class GuiMobMagnet extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_MOB_MAGNET);
|
||||
|
||||
private int x, y;
|
||||
int x, y;
|
||||
|
||||
ItemStack stack = null;
|
||||
TileMobMagnet mobMagnet;
|
||||
|
||||
List<GuiButtonMM> buttonListMM = new ArrayList<>();
|
||||
List<IRadioButton> radioButtons = new ArrayList<>();
|
||||
|
||||
public GuiMobMagnet(TileMobMagnet tile, InventoryPlayer playerInv) {
|
||||
@@ -53,24 +55,23 @@ public class GuiMobMagnet extends GuiContainer {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
buttonListMM.clear();
|
||||
addButton(new GuiButtonMMRadio(0, x + 100, y + 28, mobMagnet.adult, radioButtons));
|
||||
addButton(new GuiButtonMMRadio(1, x + 100, y + 48, !mobMagnet.adult, radioButtons));
|
||||
buttonList = buttonListMM;
|
||||
}
|
||||
|
||||
private void addButton(GuiButtonMM button) {
|
||||
buttonList.add(button);
|
||||
buttonListMM.add(button);
|
||||
if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
if (button instanceof IRadioButton rButton) {
|
||||
rButton.enableFromClick();
|
||||
} else {
|
||||
buttonList.get(0).enabled = !buttonList.get(0).enabled;
|
||||
}
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListMM.get(0).enabled = !buttonListMM.get(0).enabled;
|
||||
|
||||
mobMagnet.setAdult(buttonList.get(0).enabled);
|
||||
mobMagnet.adult = buttonListMM.get(0).enabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketMobMagnetButton(mobMagnet));
|
||||
}
|
||||
@@ -82,7 +83,7 @@ public class GuiMobMagnet extends GuiContainer {
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
String adult = StatCollector.translateToLocal("ttmisc.adult");
|
||||
String child = StatCollector.translateToLocal("ttmisc.child");
|
||||
ItemStack stack = mobMagnet.getStackInSlot(0);
|
||||
stack = mobMagnet.getStackInSlot(0);
|
||||
|
||||
String filter;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumic.tinkerer.client.gui.button.GuiButtonRP;
|
||||
import thaumic.tinkerer.client.gui.button.GuiButtonRPRadio;
|
||||
import thaumic.tinkerer.client.gui.button.IRadioButton;
|
||||
@@ -28,7 +29,9 @@ public class GuiRemotePlacer extends GuiContainer {
|
||||
|
||||
int x, y;
|
||||
List<IRadioButton> radioButtons = new ArrayList<>();
|
||||
List<GuiButtonRP> buttonListRP = new ArrayList<>();
|
||||
TileRPlacer placer;
|
||||
Aspect aspectHovered = null;
|
||||
|
||||
public GuiRemotePlacer(TileRPlacer placer, InventoryPlayer inv) {
|
||||
super(new ContainerRemotePlacer(placer, inv));
|
||||
@@ -40,24 +43,23 @@ public class GuiRemotePlacer extends GuiContainer {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
buttonListRP.clear();
|
||||
addButton(new GuiButtonRPRadio(0, x + 100, y + 0, placer.blocks == 1, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(1, x + 100, y + 13, placer.blocks == 2, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(2, x + 100, y + 26, placer.blocks == 3, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(3, x + 100, y + 39, placer.blocks == 4, radioButtons));
|
||||
buttonList = buttonListRP;
|
||||
}
|
||||
|
||||
private void addButton(GuiButtonRP button) {
|
||||
buttonList.add(button);
|
||||
buttonListRP.add(button);
|
||||
if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton instanceof IRadioButton iRadioButton) iRadioButton.enableFromClick();
|
||||
else {
|
||||
var button0 = (GuiButtonRP) buttonList.get(0);
|
||||
button0.buttonEnabled = !button0.buttonEnabled;
|
||||
}
|
||||
if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListRP.get(0).buttonEnabled = !buttonListRP.get(0).buttonEnabled;
|
||||
|
||||
placer.blocks = par1GuiButton.id + 1;
|
||||
|
||||
|
||||
@@ -21,14 +21,16 @@ public class GuiButtonMM extends GuiButton {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_MOB_MAGNET);
|
||||
|
||||
public GuiButtonMM(int buttonId, int x, int y, boolean enabled) {
|
||||
super(buttonId, x, y, 13, 13, "");
|
||||
public boolean enabled = false;
|
||||
|
||||
public GuiButtonMM(int par1, int par2, int par3, boolean enabled) {
|
||||
super(par1, par2, par3, 13, 13, "");
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (visible) {
|
||||
if (enabled) {
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
int y = enabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
|
||||
@@ -17,8 +17,8 @@ public class GuiButtonMMRadio extends GuiButtonMM implements IRadioButton {
|
||||
|
||||
List<IRadioButton> linkedButtons;
|
||||
|
||||
public GuiButtonMMRadio(int buttonId, int x, int y, boolean enabled, List<IRadioButton> linkedButtons) {
|
||||
super(buttonId, x, y, enabled);
|
||||
public GuiButtonMMRadio(int par1, int par2, int par3, boolean enabled, List<IRadioButton> linkedButtons) {
|
||||
super(par1, par2, par3, enabled);
|
||||
this.linkedButtons = linkedButtons;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,10 @@ public class GuiButtonWG extends GuiButton {
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
int y = !enabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
if (enabled) {
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
int y = !enabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class GuiWarpGate extends GuiContainer {
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
((GuiButtonWG) par1GuiButton).enabled = !((GuiButtonWG) par1GuiButton).enabled;
|
||||
warpGate.setLocked(((GuiButtonWG) par1GuiButton).enabled);
|
||||
warpGate.locked = ((GuiButtonWG) par1GuiButton).enabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketWarpGateButton(warpGate));
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import thaumic.tinkerer.common.network.packet.kami.PacketWarpGateTeleport;
|
||||
|
||||
public class GuiWarpGateDestinations extends GuiScreen {
|
||||
|
||||
private static final ResourceLocation enderField = new ResourceLocation("textures/entity/end_portal.png");
|
||||
private static ResourceLocation enderField = new ResourceLocation("textures/entity/end_portal.png");
|
||||
TileWarpGate warpGate;
|
||||
RenderItem render = new RenderItem();
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ public final class LibRenderIDs {
|
||||
|
||||
public static int idMagnet = -1;
|
||||
public static int idRepairer = -1;
|
||||
public static int idVisweaver = -1;
|
||||
|
||||
public static int idWarpGate = -1;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public final class LibResources {
|
||||
public static final String GUI_ICHOR_POUCH = PREFIX_GUI + "ichorPouch.png";
|
||||
public static final String GUI_WARP_GATE = PREFIX_GUI + "warpGate.png";
|
||||
public static final String GUI_REMOTE_PLACER = PREFIX_GUI + "remotePlacer.png";
|
||||
public static final String NEI_RECIPE_ARROW = PREFIX_GUI + "neiRecipeArrow.png";
|
||||
public static final String GUI_VISWEAVER = PREFIX_GUI + "visweaver.png";
|
||||
|
||||
public static final String MISC_R_ENCHANTING = PREFIX_MISC + "r_enchanting.png";
|
||||
public static final String MISC_AT_CENTER = PREFIX_MISC + "atCenter.png";
|
||||
@@ -55,6 +55,7 @@ public final class LibResources {
|
||||
public static final String MODEL_ARMOR_ICHOR_2 = PREFIX_MODEL + "ichor2.png";
|
||||
public static final String MODEL_ARMOR_ICHOR_GEM_1 = PREFIX_MODEL + "ichorGem1.png";
|
||||
public static final String MODEL_ARMOR_ICHOR_GEM_2 = PREFIX_MODEL + "ichorGem2.png";
|
||||
public static final String MODEL_VISWEAVER = PREFIX_MODEL + "visweaver.png";
|
||||
|
||||
public static final String ENCHANT_PROTECTION = PREFIX_ENCHANTS + "protection.png";
|
||||
public static final String ENCHANT_FIRE_PROTECTION = PREFIX_ENCHANTS + "fireProtection.png";
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
package thaumic.tinkerer.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
public class ModelVisweaver extends ModelBase {
|
||||
|
||||
public ModelRenderer base;
|
||||
public ModelRenderer top;
|
||||
public ModelRenderer pillar1;
|
||||
public ModelRenderer pillar2;
|
||||
public ModelRenderer pillar3;
|
||||
public ModelRenderer pillar4;
|
||||
public ModelRenderer orbBase;
|
||||
|
||||
public ModelRenderer orbIgnis;
|
||||
public ModelRenderer orbAqua;
|
||||
public ModelRenderer orbAer;
|
||||
public ModelRenderer orbTerra;
|
||||
public ModelRenderer orbOrdo;
|
||||
public ModelRenderer orbPerditio;
|
||||
|
||||
public ModelRenderer orbCarrier;
|
||||
|
||||
public ModelVisweaver() {
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 36;
|
||||
|
||||
this.pillar1 = new ModelRenderer(this, 0, 0);
|
||||
this.pillar1.setRotationPoint(-7.0F, 14.0F, 5.0F);
|
||||
this.pillar1.addBox(0.0F, 0.0F, 0.0F, 2, 8, 2, 0.0F);
|
||||
this.pillar2 = new ModelRenderer(this, 0, 0);
|
||||
this.pillar2.setRotationPoint(5.0F, 14.0F, 5.0F);
|
||||
this.pillar2.addBox(0.0F, 0.0F, 0.0F, 2, 8, 2, 0.0F);
|
||||
this.pillar3 = new ModelRenderer(this, 0, 0);
|
||||
this.pillar3.setRotationPoint(5.0F, 14.0F, -7.0F);
|
||||
this.pillar3.addBox(0.0F, 0.0F, 0.0F, 2, 8, 2, 0.0F);
|
||||
this.pillar4 = new ModelRenderer(this, 0, 0);
|
||||
this.pillar4.setRotationPoint(-7.0F, 14.0F, -7.0F);
|
||||
this.pillar4.addBox(0.0F, 0.0F, 0.0F, 2, 8, 2, 0.0F);
|
||||
|
||||
this.top = new ModelRenderer(this, 0, 0);
|
||||
this.top.setRotationPoint(-8.0F, 12.0F, -8.0F);
|
||||
this.top.addBox(0.0F, 0.0F, 0.0F, 16, 2, 16, 0.0F);
|
||||
|
||||
this.base = new ModelRenderer(this, 0, 18);
|
||||
this.base.setRotationPoint(-8.0F, 22.0F, -8.0F);
|
||||
this.base.addBox(0.0F, 0.0F, 0.0F, 16, 2, 16, 0.0F);
|
||||
|
||||
this.orbBase = new ModelRenderer(this, 48, 0);
|
||||
this.orbBase.setRotationPoint(0, 8, 0);
|
||||
this.orbBase.addBox(0.0F, 0.0F, 0.0F, 2, 2, 2, 0.0F);
|
||||
|
||||
this.orbIgnis = new ModelRenderer(this, 56, 4);
|
||||
this.orbIgnis.addBox(0.0F, 0.0F, 0.0F, 2, 2, 2, 0.0F);
|
||||
this.orbIgnis.setRotationPoint(0, 8, 0);
|
||||
this.orbAqua = new ModelRenderer(this, 56, 12);
|
||||
this.orbAqua.addBox(0.0F, 0.0F, 0.0F, 2, 2, 2, 0.0F);
|
||||
this.orbAqua.setRotationPoint(0, 8, 0);
|
||||
this.orbAer = new ModelRenderer(this, 56, 8);
|
||||
this.orbAer.addBox(0.0F, 0.0F, 0.0F, 2, 2, 2, 0.0F);
|
||||
this.orbAer.setRotationPoint(0, 8, 0);
|
||||
this.orbTerra = new ModelRenderer(this, 48, 8);
|
||||
this.orbTerra.addBox(0.0F, 0.0F, 0.0F, 2, 2, 2, 0.0F);
|
||||
this.orbTerra.setRotationPoint(0, 8, 0);
|
||||
this.orbOrdo = new ModelRenderer(this, 48, 12);
|
||||
this.orbOrdo.addBox(0.0F, 0.0F, 0.0F, 2, 2, 2, 0.0F);
|
||||
this.orbOrdo.setRotationPoint(0, 8, 0);
|
||||
this.orbPerditio = new ModelRenderer(this, 48, 4);
|
||||
this.orbPerditio.addBox(0.0F, 0.0F, 0.0F, 2, 2, 2, 0.0F);
|
||||
this.orbPerditio.setRotationPoint(0, 8, 0);
|
||||
|
||||
this.orbCarrier = new ModelRenderer(this);
|
||||
this.orbCarrier.addChild(this.orbBase);
|
||||
this.orbCarrier.addChild(this.orbIgnis);
|
||||
this.orbCarrier.addChild(this.orbAqua);
|
||||
this.orbCarrier.addChild(this.orbAer);
|
||||
this.orbCarrier.addChild(this.orbTerra);
|
||||
this.orbCarrier.addChild(this.orbOrdo);
|
||||
this.orbCarrier.addChild(this.orbPerditio);
|
||||
}
|
||||
|
||||
public void render(boolean isWorking, int tickCounter, Aspect cvType) {
|
||||
final float scale = 1F / 16F;
|
||||
|
||||
float xyRotate = (float) tickCounter / 20F;
|
||||
float zRotate = (float) tickCounter / 100F;
|
||||
|
||||
orbCarrier.rotationPointX = (float) Math.sin((float) tickCounter / 10.0F) * 2.0F;
|
||||
|
||||
float orbitRotation = ((float) tickCounter / 40F) % (2F * (float) Math.PI);
|
||||
setRotateAngle(orbCarrier, 0F, orbitRotation, 0F);
|
||||
|
||||
ModelRenderer toRender = getToRender(isWorking, cvType);
|
||||
setRotateAngle(toRender, xyRotate, xyRotate, zRotate);
|
||||
toRender.render(scale);
|
||||
|
||||
this.pillar3.render(scale);
|
||||
this.top.render(scale);
|
||||
this.pillar4.render(scale);
|
||||
this.base.render(scale);
|
||||
this.pillar1.render(scale);
|
||||
this.pillar2.render(scale);
|
||||
}
|
||||
|
||||
private ModelRenderer getToRender(boolean isWorking, Aspect cvType) {
|
||||
ModelRenderer toRender = orbBase;
|
||||
|
||||
if (isWorking) {
|
||||
if (cvType == Aspect.AIR) {
|
||||
toRender = orbAer;
|
||||
} else if (cvType == Aspect.FIRE) {
|
||||
toRender = orbIgnis;
|
||||
} else if (cvType == Aspect.ORDER) {
|
||||
toRender = orbOrdo;
|
||||
} else if (cvType == Aspect.ENTROPY) {
|
||||
toRender = orbPerditio;
|
||||
} else if (cvType == Aspect.WATER) {
|
||||
toRender = orbAqua;
|
||||
} else if (cvType == Aspect.EARTH) {
|
||||
toRender = orbTerra;
|
||||
}
|
||||
}
|
||||
return toRender;
|
||||
}
|
||||
|
||||
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package thaumic.tinkerer.client.nei;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import thaumic.tinkerer.common.compat.LoadedMods;
|
||||
|
||||
public class NEIConfig implements IConfigureNEI {
|
||||
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
if (!LoadedMods.aspectRecipeIndexLoaded) return;
|
||||
AspectRecipeIndexIntegration.register();
|
||||
|
||||
NEIInfusedSeedRecipeHandler seedHandler = new NEIInfusedSeedRecipeHandler();
|
||||
API.registerRecipeHandler(seedHandler);
|
||||
API.registerUsageHandler(seedHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Thaumic Tinkerer NEI";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "1.0";
|
||||
}
|
||||
|
||||
// This needs to be an inner class to prevent a NoClassDefFoundError from class loading when ARI isn't loaded.
|
||||
private static class AspectRecipeIndexIntegration {
|
||||
|
||||
public static void register() {
|
||||
TemplateRecipeHandler handler = new NEINecromancyHandler();
|
||||
GuiCraftingRecipe.craftinghandlers.add(handler);
|
||||
GuiUsageRecipe.usagehandlers.add(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,251 +0,0 @@
|
||||
package thaumic.tinkerer.client.nei;
|
||||
|
||||
import static thaumic.tinkerer.client.lib.LibResources.NEI_RECIPE_ARROW;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumic.tinkerer.common.core.helper.AspectCropLootManager;
|
||||
import thaumic.tinkerer.common.core.helper.AspectCropLootManager.LootEntry;
|
||||
import thaumic.tinkerer.common.item.ItemInfusedSeeds;
|
||||
|
||||
public class NEIInfusedSeedRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public static final String OVERLAY = "thaumictinkerer.infusedseeds";
|
||||
private static final int SLOT_NUM_X = 9;
|
||||
private static final int SLOT_TEXTURE_U = 7;
|
||||
private static final int SLOT_TEXTURE_V = 17;
|
||||
private static final DecimalFormat CHANCE_FORMAT = new DecimalFormat("#.##");
|
||||
|
||||
public static class DropInfo {
|
||||
|
||||
public final ItemStack stack;
|
||||
public final float chance;
|
||||
|
||||
public DropInfo(ItemStack stack, float chance) {
|
||||
this.stack = stack;
|
||||
this.chance = chance;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SeedDropRecipeWrapper {
|
||||
|
||||
public final ItemStack seed;
|
||||
public final List<DropInfo> drops;
|
||||
|
||||
public SeedDropRecipeWrapper(ItemStack seed, List<DropInfo> drops) {
|
||||
this.seed = seed;
|
||||
this.drops = drops;
|
||||
}
|
||||
}
|
||||
|
||||
public class CachedSeedRecipe extends CachedRecipe {
|
||||
|
||||
private final List<PositionedStack> input = new ArrayList<>();
|
||||
private final List<PositionedStack> outputs = new ArrayList<>();
|
||||
public final SeedDropRecipeWrapper wrapper;
|
||||
public int rows = 0;
|
||||
|
||||
public CachedSeedRecipe(SeedDropRecipeWrapper recipe) {
|
||||
this.wrapper = recipe;
|
||||
this.input.add(new PositionedStack(recipe.seed, 74, 4));
|
||||
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
|
||||
for (DropInfo drop : recipe.drops) {
|
||||
int xPos = 3 + 18 * col;
|
||||
int yPos = 36 + 18 * row;
|
||||
|
||||
this.outputs.add(new PositionedStack(drop.stack, xPos, yPos));
|
||||
|
||||
col++;
|
||||
if (col >= SLOT_NUM_X) {
|
||||
col = 0;
|
||||
row++;
|
||||
}
|
||||
}
|
||||
|
||||
this.rows = col == 0 ? row - 1 : row;
|
||||
if (this.rows < 0) this.rows = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
return outputs;
|
||||
}
|
||||
}
|
||||
|
||||
private List<SeedDropRecipeWrapper> getSeedRecipes() {
|
||||
List<SeedDropRecipeWrapper> recipes = new ArrayList<>();
|
||||
Map<Aspect, List<LootEntry>> allLoot = AspectCropLootManager.getAllLoot();
|
||||
|
||||
for (Map.Entry<Aspect, List<LootEntry>> entry : allLoot.entrySet()) {
|
||||
Aspect aspect = entry.getKey();
|
||||
List<LootEntry> lootList = entry.getValue();
|
||||
|
||||
if (lootList == null || lootList.isEmpty()) continue;
|
||||
|
||||
int totalWeight = 0;
|
||||
for (LootEntry loot : lootList) {
|
||||
totalWeight += loot.weight;
|
||||
}
|
||||
|
||||
List<DropInfo> drops = new ArrayList<>();
|
||||
for (LootEntry loot : lootList) {
|
||||
if (loot.stack != null) {
|
||||
float chance = ((float) loot.weight / totalWeight) * 100f;
|
||||
drops.add(new DropInfo(loot.stack.copy(), chance));
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack seedStack = ItemInfusedSeeds.getStackFromAspect(aspect);
|
||||
|
||||
recipes.add(new SeedDropRecipeWrapper(seedStack, drops));
|
||||
}
|
||||
|
||||
return recipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(73, 22, 18, 12), getOverlayIdentifier()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals(getOverlayIdentifier()) && getClass() == NEIInfusedSeedRecipeHandler.class) {
|
||||
for (SeedDropRecipeWrapper recipe : getSeedRecipes()) {
|
||||
arecipes.add(new CachedSeedRecipe(recipe));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (SeedDropRecipeWrapper recipe : getSeedRecipes()) {
|
||||
for (DropInfo drop : recipe.drops) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(result, drop.stack)) {
|
||||
arecipes.add(new CachedSeedRecipe(recipe));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if (ingredient != null && ingredient.getItem() instanceof ItemInfusedSeeds) {
|
||||
Aspect aspectIn = ItemInfusedSeeds.getAspect(ingredient);
|
||||
|
||||
if (aspectIn != null) {
|
||||
for (SeedDropRecipeWrapper recipe : getSeedRecipes()) {
|
||||
Aspect aspectRecipe = ItemInfusedSeeds.getAspect(recipe.seed);
|
||||
if (aspectIn == aspectRecipe || aspectIn.getTag().equals(aspectRecipe.getTag())) {
|
||||
arecipes.add(new CachedSeedRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeHeight(int recipeIndex) {
|
||||
return 36 + 18 * (((CachedSeedRecipe) this.arecipes.get(recipeIndex)).rows + 1) + 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipeIndex) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
|
||||
GuiDraw.drawTexturedModalRect(74, 3, SLOT_TEXTURE_U, SLOT_TEXTURE_V, 18, 18);
|
||||
|
||||
CachedSeedRecipe recipe = (CachedSeedRecipe) this.arecipes.get(recipeIndex);
|
||||
int totalDrops = recipe.outputs.size();
|
||||
|
||||
int rows = Math.max(1, (totalDrops + SLOT_NUM_X - 1) / SLOT_NUM_X);
|
||||
|
||||
int totalSlotsToDraw = rows * SLOT_NUM_X;
|
||||
|
||||
for (int i = 0; i < totalSlotsToDraw; i++) {
|
||||
int col = i % SLOT_NUM_X;
|
||||
int row = i / SLOT_NUM_X;
|
||||
int xPos = 2 + 18 * col;
|
||||
int yPos = 35 + 18 * row;
|
||||
|
||||
GuiDraw.drawTexturedModalRect(xPos, yPos, SLOT_TEXTURE_U, SLOT_TEXTURE_V, 18, 18);
|
||||
}
|
||||
|
||||
GuiDraw.changeTexture(NEI_RECIPE_ARROW);
|
||||
|
||||
GuiDraw.drawTexturedModalRect(74, 20, 0, 0, 18, 14);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack stack, List<String> currenttip, int recipeIndex) {
|
||||
CachedSeedRecipe recipe = (CachedSeedRecipe) this.arecipes.get(recipeIndex);
|
||||
|
||||
for (DropInfo drop : recipe.wrapper.drops) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(stack, drop.stack)) {
|
||||
|
||||
String chancePrefix = StatCollector.translateToLocal("tt.nei.chance");
|
||||
|
||||
String chanceStr = CHANCE_FORMAT.format(drop.chance) + "%";
|
||||
currenttip.add(EnumChatFormatting.GRAY + chancePrefix + ": " + EnumChatFormatting.YELLOW + chanceStr);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "minecraft:textures/gui/container/generic_54.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return OVERLAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHandlerId() {
|
||||
return NEIInfusedSeedRecipeHandler.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tt.nei.category.infusedseeds");
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
package thaumic.tinkerer.client.nei;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.glease.tc4tweak.api.infusionrecipe.RecipeIngredient;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.aspectrecipeindex.nei.InfusionRecipeHandler;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.core.helper.EnumMobAspect;
|
||||
import thaumic.tinkerer.common.item.ItemMobAspect;
|
||||
import thaumic.tinkerer.common.item.ItemMobDisplay;
|
||||
|
||||
public class NEINecromancyHandler extends InfusionRecipeHandler {
|
||||
|
||||
public static final String OVERLAY = "thaumictinkerer.necromancy";
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.spawner.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return OVERLAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeHeight(int recipe) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals(this.getOverlayIdentifier())) {
|
||||
for (EnumMobAspect value : EnumMobAspect.values()) {
|
||||
new NecromancyCachedRecipe(value);
|
||||
}
|
||||
} else if (outputId.equals("item")) {
|
||||
this.loadCraftingRecipes((ItemStack) results[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
if (result.getItem() instanceof ItemMobDisplay display) {
|
||||
EnumMobAspect type = display.getEntityType(result);
|
||||
for (EnumMobAspect value : EnumMobAspect.values()) {
|
||||
if (value == type) {
|
||||
new NecromancyCachedRecipe(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
loadUsageRecipes(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if (!(ingredient.getItem() instanceof ItemMobAspect)) {
|
||||
return;
|
||||
}
|
||||
Aspect target = ItemMobAspect.getAspect(ingredient);
|
||||
if (target == null) return;
|
||||
for (EnumMobAspect value : EnumMobAspect.values()) {
|
||||
for (Aspect aspect : value.aspects) {
|
||||
if (aspect == target) {
|
||||
new NecromancyCachedRecipe(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients) {
|
||||
loadCraftingRecipes(inputId, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipeIndex) {
|
||||
GL11.glPushMatrix();
|
||||
GuiDraw.changeTexture(THAUM_OVERLAYS);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glScalef(1.75F, 1.75F, 1.0F);
|
||||
GL11.glTranslatef(-0.5F, -1F, 0);
|
||||
GuiDraw.drawTexturedModalRect(27, 8, 207, 78, 42, 42); // Runic matrix drawing
|
||||
GL11.glTranslatef(0.5F, 1F, 0);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInstability(int recipeIndex) {}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipeIndex) {
|
||||
drawSeeAllRecipesLabel(2);
|
||||
}
|
||||
|
||||
protected class NecromancyCachedRecipe extends InfusionCachedRecipe {
|
||||
|
||||
public NecromancyCachedRecipe(EnumMobAspect enumMobAspect) {
|
||||
super(0, true);
|
||||
setIngredients(enumMobAspect.aspects);
|
||||
setResult(enumMobAspect);
|
||||
this.aspects = new AspectList();
|
||||
addIfValid();
|
||||
}
|
||||
|
||||
private void setResult(EnumMobAspect enumMobAspect) {
|
||||
ItemStack result = new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemMobDisplay.class));
|
||||
((ItemMobDisplay) result.getItem()).setEntityType(result, enumMobAspect);
|
||||
this.result = new PositionedStack(result, OUTPUT_X, 39, false);
|
||||
}
|
||||
|
||||
private void setIngredients(Aspect[] aspects) {
|
||||
if (aspects.length < 3) return;
|
||||
addSurroundingItems(
|
||||
Arrays.asList(
|
||||
RecipeIngredient.item(true, ItemMobAspect.getStackFromAspect(aspects[0])),
|
||||
RecipeIngredient.item(true, ItemMobAspect.getStackFromAspect(aspects[1])),
|
||||
RecipeIngredient.item(true, ItemMobAspect.getStackFromAspect(aspects[2]))));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int itemOffset() {
|
||||
return -24;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@ public class RenderInfusedCrops implements ISimpleBlockRenderingHandler {
|
||||
Aspect aspect = BlockInfusedGrain.getAspect(world, x, y, z);
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
|
||||
final Tessellator tess = Tessellator.instance;
|
||||
if (aspect != null && !aspect.isPrimal()) {
|
||||
// Hex to RGB code from vanilla tesselator
|
||||
float r = (aspect.getColor() >> 16 & 0xFF) / 255.0F;
|
||||
@@ -35,14 +34,15 @@ public class RenderInfusedCrops implements ISimpleBlockRenderingHandler {
|
||||
float b = (aspect.getColor() & 0xFF) / 255.0F;
|
||||
|
||||
GL11.glColor4f(r, g, b, 1F);
|
||||
tess.setColorRGBA_I(aspect.getColor(), 255);
|
||||
Tessellator.instance.setColorRGBA_I(aspect.getColor(), 255);
|
||||
}
|
||||
|
||||
renderer.setOverrideBlockTexture(block.getIcon(world, x, y, z, world.getBlockMetadata(x, y, z)));
|
||||
tess.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
renderer.renderBlockCropsImpl(block, world.getBlockMetadata(x, y, z), x, y - 0.0625F, z);
|
||||
renderer.clearOverrideBlockTexture();
|
||||
// tess.setColorOpaque_I(0xFFFFFF);
|
||||
// Tessellator.instance.setColorOpaque_I(0xFFFFFF);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package thaumic.tinkerer.client.render.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import thaumic.tinkerer.client.lib.LibRenderIDs;
|
||||
import thaumic.tinkerer.common.block.tile.TileVisweaver;
|
||||
|
||||
public class RenderVisweaver implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileVisweaver(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return LibRenderIDs.idVisweaver;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package thaumic.tinkerer.client.render.item;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -18,6 +19,8 @@ import thaumic.tinkerer.common.item.ItemInfusedSeeds;
|
||||
*/
|
||||
public class RenderGenericSeeds implements IItemRenderer {
|
||||
|
||||
private static RenderItem renderItem = new RenderItem();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
if (type == ItemRenderType.INVENTORY) return true;
|
||||
|
||||
@@ -1,42 +1,22 @@
|
||||
package thaumic.tinkerer.client.render.item;
|
||||
|
||||
import java.util.EnumMap;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import thaumic.tinkerer.common.core.helper.EnumMobAspect;
|
||||
import thaumic.tinkerer.common.item.ItemMobDisplay;
|
||||
|
||||
public class RenderMobDisplay implements IItemRenderer {
|
||||
|
||||
private static final int ATTRIB_MASK = GL11.GL_ENABLE_BIT | GL11.GL_CURRENT_BIT
|
||||
| GL11.GL_DEPTH_BUFFER_BIT
|
||||
| GL11.GL_COLOR_BUFFER_BIT
|
||||
| GL11.GL_LIGHTING_BIT
|
||||
| GL11.GL_TEXTURE_BIT;
|
||||
|
||||
private final EnumMap<EnumMobAspect, EntityLiving> cache = new EnumMap<>(EnumMobAspect.class);
|
||||
private World cachedWorld;
|
||||
|
||||
private void setCachedWorld(World world) {
|
||||
cache.clear();
|
||||
cachedWorld = world;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldUnload(WorldEvent.Unload event) {
|
||||
if (event.world == cachedWorld) setCachedWorld(null);
|
||||
}
|
||||
private static RenderItem renderItem = new RenderItem();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType) {
|
||||
@@ -51,34 +31,67 @@ public class RenderMobDisplay implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... objects) {
|
||||
if (!(itemStack.getItem() instanceof ItemMobDisplay item)) return;
|
||||
ItemMobDisplay item = (ItemMobDisplay) itemStack.getItem();
|
||||
EnumMobAspect aspect = item.getEntityType(itemStack);
|
||||
if (aspect == null) return;
|
||||
|
||||
final World world = Minecraft.getMinecraft().theWorld;
|
||||
if (world != cachedWorld) setCachedWorld(world);
|
||||
if (world == null) return;
|
||||
|
||||
EntityLiving entity = cache.get(aspect);
|
||||
if (entity == null || entity.worldObj != world) {
|
||||
entity = aspect.createEntity(world);
|
||||
cache.put(aspect, entity);
|
||||
Entity entity = null;
|
||||
float f1 = 0.4f;
|
||||
float verticalOffset = 0.0f;
|
||||
if (aspect != null) {
|
||||
entity = EnumMobAspect.getEntityFromCache(aspect, null);
|
||||
f1 = aspect.getScale();
|
||||
verticalOffset = aspect.getVerticalOffset();
|
||||
}
|
||||
switch (itemRenderType) {
|
||||
case ENTITY:
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
EntityItem eItem = (EntityItem) objects[1];
|
||||
if (entity != null) {
|
||||
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
|
||||
if (entity.worldObj != null) {
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
entity.setWorld(eItem.worldObj);
|
||||
entity.copyLocationAndAnglesFrom(eItem);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
// if (renderWithLighting) RenderUtils.enableLightmap();
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
entity.worldObj = null;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
case EQUIPPED:
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
if (entity != null) {
|
||||
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
|
||||
if (entity.worldObj != null) {
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
// if (renderWithLighting) RenderUtils.enableLightmap();
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
entity.worldObj = null;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
final Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
if (renderer == null || renderer.getFontRendererFromRenderManager() == null) return;
|
||||
|
||||
float scale = aspect.getScale();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(ATTRIB_MASK);
|
||||
try {
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glTranslatef(0, (-entity.height / 2) + aspect.getVerticalOffset(), 0.0F);
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
} finally {
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
case FIRST_PERSON_MAP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package thaumic.tinkerer.client.render.item.kami;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
@@ -13,6 +15,9 @@ import thaumic.tinkerer.common.item.kami.ItemPlacementMirror;
|
||||
|
||||
public class RenderPlacementMirror implements IItemRenderer {
|
||||
|
||||
RenderItem render = new RenderItem();
|
||||
ItemRenderer renderer = new ItemRenderer(Minecraft.getMinecraft());
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
@@ -64,7 +69,6 @@ public class RenderPlacementMirror implements IItemRenderer {
|
||||
break;
|
||||
}
|
||||
case INVENTORY: {
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(45f, 0f, 1f, 0f);
|
||||
GL11.glScalef(1.5f, 1.8f, 1.8f);
|
||||
@@ -73,7 +77,6 @@ public class RenderPlacementMirror implements IItemRenderer {
|
||||
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -47,18 +47,12 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
|
||||
int rotation = meta == 2 ? 270 : meta == 3 ? 90 : meta == 4 ? 0 : 180;
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
renderOverlay(tile, overlayCenter, -1, false, 0.65, 0.13F, partialTicks);
|
||||
if (tile.leftClick) renderOverlay(tile, overlayLeft, 1, true, 1, 0.13F, partialTicks);
|
||||
else renderOverlay(tile, overlayRight, 1, true, 1, 0.131F, partialTicks);
|
||||
renderIndents(tile, rotation + 90F);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(true);
|
||||
renderOverlay(tile, overlayCenter, -1, false, false, 0.65, 0.13F, 0F);
|
||||
if (tile.leftClick) renderOverlay(tile, overlayLeft, 1, false, true, 1, 0.13F, 0F);
|
||||
else renderOverlay(tile, overlayRight, 1, false, true, 1, 0.131F, 0F);
|
||||
renderOverlay(tile, overlayIndent, 0, false, false, 0.5F, 0.13F, rotation + 90F);
|
||||
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.1, 0.2 + Math.cos(System.currentTimeMillis() / 600D) / 18F, 0.5);
|
||||
@@ -66,10 +60,9 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslatef(translations[0], translations[1], translations[2]);
|
||||
GL11.glScalef(0.8F, 0.8F, 0.8F);
|
||||
GL11.glTranslatef(0.5F, 0F, 0.5F);
|
||||
float swingProgress = tile.getRenderSwingProgress(partialTicks);
|
||||
GL11.glRotatef(swingProgress, 0F, 0F, 1F);
|
||||
GL11.glRotatef(tile.swingProgress, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, 0F, -0.5F);
|
||||
GL11.glTranslatef(-swingProgress / 250F, swingProgress / 1000F, 0F);
|
||||
GL11.glTranslatef(-tile.swingProgress / 250F, tile.swingProgress / 1000F, 0F);
|
||||
GL11.glRotatef((float) Math.cos(System.currentTimeMillis() / 400F) * 5F, 1F, 0F, 1F);
|
||||
renderItem(tile);
|
||||
GL11.glPopMatrix();
|
||||
@@ -79,8 +72,6 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
ItemStack stack = tablet.getStackInSlot(0);
|
||||
if (stack != null) {
|
||||
EntityItem entityitem = new EntityItem(tablet.getWorldObj(), 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.worldObj = tablet.getWorldObj();
|
||||
int stackSize = entityitem.getEntityItem().stackSize;
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.hoverStart = 0.0F;
|
||||
GL11.glPushMatrix();
|
||||
@@ -90,24 +81,25 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
RenderItem.renderInFrame = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
|
||||
RenderItem.renderInFrame = false;
|
||||
|
||||
GL11.glPopMatrix();
|
||||
entityitem.getEntityItem().stackSize = stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderOverlay(TileAnimationTablet tablet, ResourceLocation texture, int rotationMod, boolean useBlend,
|
||||
double size, float height, float partialTicks) {
|
||||
private void renderOverlay(TileAnimationTablet tablet, ResourceLocation texture, int rotationMod,
|
||||
boolean useLighting, boolean useBlend, double size, float height, float forceDeg) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
if (!useLighting) GL11.glDisable(GL11.GL_LIGHTING);
|
||||
if (useBlend) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
GL11.glTranslatef(0.5F, height, 0.5F);
|
||||
float deg = (tablet.getTicksExisted(partialTicks) * rotationMod % 360F);
|
||||
float deg = rotationMod == 0 ? forceDeg : (float) (tablet.ticksExisted * rotationMod % 360F);
|
||||
GL11.glRotatef(deg, 0F, 1F, 0F);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
double size1 = size / 2;
|
||||
double size2 = -size1;
|
||||
@@ -117,33 +109,8 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
tess.addVertexWithUV(size1, 0, size2, 1, 0);
|
||||
tess.addVertexWithUV(size2, 0, size2, 0, 0);
|
||||
tess.draw();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderIndents(TileAnimationTablet tablet, float forceDeg) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
mc.renderEngine.bindTexture(overlayIndent);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, (float) 0.13, 0.5F);
|
||||
GL11.glRotatef(forceDeg, 0F, 1F, 0F);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
final double size1 = 0.25;
|
||||
final double size2 = -0.25;
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(size2, 0, size1, 0, 1);
|
||||
tess.addVertexWithUV(size1, 0, size1, 1, 1);
|
||||
tess.addVertexWithUV(size1, 0, size2, 1, 0);
|
||||
tess.addVertexWithUV(size2, 0, size2, 0, 0);
|
||||
tess.draw();
|
||||
int acceleration = tablet.getWorldAcceleratorBonus();
|
||||
if (acceleration != 0) {
|
||||
GL11.glRotatef(90, -1, 0, 0);
|
||||
GL11.glScalef(0.02f, -0.02f, 0.02f);
|
||||
final String s = 'x' + Integer.toString(acceleration);
|
||||
final int width = mc.fontRenderer.getStringWidth(s);
|
||||
GL11.glTranslatef(-width / 2f, 10f + mc.fontRenderer.FONT_HEIGHT / 2f, 0);
|
||||
mc.fontRenderer.drawString(s, 0, 0, 0xFFFFFF);
|
||||
}
|
||||
GL11.glDepthMask(true);
|
||||
if (!useLighting) GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.client.render.tile;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -22,7 +20,6 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import thaumcraft.client.renderers.block.BlockJarRenderer;
|
||||
import thaumcraft.client.renderers.tile.ItemJarFilledRenderer;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumic.tinkerer.common.block.tile.TileFunnel;
|
||||
|
||||
public class RenderTileFunnel extends TileEntitySpecialRenderer {
|
||||
@@ -37,12 +34,12 @@ public class RenderTileFunnel extends TileEntitySpecialRenderer {
|
||||
if (stack != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0 + 0.5, d1 + 0.365, d2 + 0.5);
|
||||
if (Block.getBlockFromItem(stack.getItem()) == ConfigBlocks.blockJar) {
|
||||
GL11.glTranslatef(0F, 0.25F, 0F);
|
||||
jarRenderer.renderInventoryBlock(ConfigBlocks.blockJar, stack.getItemDamage(), 0, new RenderBlocks());
|
||||
} else {
|
||||
jarRenderer1.renderItem(IItemRenderer.ItemRenderType.ENTITY, stack, (Object[]) null);
|
||||
}
|
||||
// if(Block.getBlockFromItem(stack.getItem())== ConfigBlocks.blockJar) {
|
||||
// GL11.glTranslatef(0F, 0.25F, 0F);
|
||||
// jarRenderer.renderInventoryBlock(ConfigBlocks.blockJar, 0, 0, new RenderBlocks());
|
||||
// }
|
||||
// else
|
||||
jarRenderer1.renderItem(IItemRenderer.ItemRenderType.ENTITY, stack, (Object[]) null);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package thaumic.tinkerer.client.render.tile;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import thaumic.tinkerer.client.core.helper.ClientHelper;
|
||||
import thaumic.tinkerer.client.lib.LibResources;
|
||||
import thaumic.tinkerer.client.model.ModelVisweaver;
|
||||
import thaumic.tinkerer.common.block.tile.TileVisweaver;
|
||||
|
||||
public class RenderTileVisweaver extends TileEntitySpecialRenderer {
|
||||
|
||||
private static final ResourceLocation modelTex = new ResourceLocation(LibResources.MODEL_VISWEAVER);
|
||||
ModelVisweaver model = new ModelVisweaver();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
|
||||
|
||||
TileVisweaver visweaver = (TileVisweaver) tileentity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(modelTex);
|
||||
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
model.render(visweaver.isWorking(), visweaver.getTickCounter(), visweaver.getCvType());
|
||||
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, -0.6F);
|
||||
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,14 @@ package thaumic.tinkerer.common;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.command.ICommandManager;
|
||||
import net.minecraft.command.ServerCommandManager;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
@@ -27,13 +31,14 @@ import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import thaumcraft.common.CommonProxy;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumic.tinkerer.api.InterModCommsOperations;
|
||||
import thaumic.tinkerer.common.compat.LoadedMods;
|
||||
import thaumic.tinkerer.common.core.commands.KamiUnlockedCommand;
|
||||
import thaumic.tinkerer.common.core.commands.MaxResearchCommand;
|
||||
import thaumic.tinkerer.common.core.commands.SetTendencyCommand;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
import thaumic.tinkerer.common.core.proxy.TTCommonProxy;
|
||||
import thaumic.tinkerer.common.dim.WorldProviderBedrock;
|
||||
@@ -63,7 +68,7 @@ public class ThaumicTinkerer {
|
||||
log = event.getModLog();
|
||||
tcProxy = Thaumcraft.proxy;
|
||||
proxy.preInit(event);
|
||||
if (LoadedMods.wailaLoaded) {
|
||||
if (Loader.isModLoaded("Waila")) {
|
||||
FMLInterModComms.sendMessage(
|
||||
"Waila",
|
||||
"register",
|
||||
@@ -71,6 +76,34 @@ public class ThaumicTinkerer {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStart(FMLServerStartingEvent event) {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
ICommandManager command = server.getCommandManager();
|
||||
ServerCommandManager manager = (ServerCommandManager) command;
|
||||
manager.registerCommand(new SetTendencyCommand());
|
||||
manager.registerCommand(new MaxResearchCommand());
|
||||
manager.registerCommand(new KamiUnlockedCommand());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HandleIMCMessages(FMLInterModComms.IMCEvent messages) {
|
||||
for (FMLInterModComms.IMCMessage message : messages.getMessages()) {
|
||||
if (message.key.equalsIgnoreCase(InterModCommsOperations.ADD_RESEARCH_BLACKLIST)) {
|
||||
String[] values = message.getStringValue().split(",");
|
||||
KamiResearchItem.Blacklist.addAll(Arrays.asList(values));
|
||||
}
|
||||
if (message.key.equalsIgnoreCase(InterModCommsOperations.ADD_CC_BLACKLIST)) {
|
||||
if (Loader.isModLoaded("ComputerCraft")) blackListCCDevices(message.getStringValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void blackListCCDevices(String classname) {
|
||||
PeripheralHandler.Blacklist.add(classname);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
@@ -84,32 +117,4 @@ public class ThaumicTinkerer {
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
proxy.serverStarting(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStopped(FMLServerStoppedEvent event) {
|
||||
proxy.serverStopped(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HandleIMCMessages(FMLInterModComms.IMCEvent messages) {
|
||||
for (FMLInterModComms.IMCMessage message : messages.getMessages()) {
|
||||
if (message.key.equalsIgnoreCase(InterModCommsOperations.ADD_RESEARCH_BLACKLIST)) {
|
||||
String[] values = message.getStringValue().split(",");
|
||||
KamiResearchItem.Blacklist.addAll(Arrays.asList(values));
|
||||
}
|
||||
if (message.key.equalsIgnoreCase(InterModCommsOperations.ADD_CC_BLACKLIST)) {
|
||||
if (LoadedMods.computerCraftLoaded) blackListCCDevices(message.getStringValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void blackListCCDevices(String classname) {
|
||||
PeripheralHandler.Blacklist.add(classname);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -43,7 +44,6 @@ import thaumic.tinkerer.common.block.tile.tablet.TileAnimationTablet;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
import thaumic.tinkerer.common.lib.LibGuiIDs;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
import thaumic.tinkerer.common.registry.TTRegistry;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererArcaneRecipe;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
|
||||
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
@@ -98,32 +98,37 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (tablet != null) {
|
||||
ItemStack itemstack = tablet.heldItem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (tablet.getIsBreaking()) {}
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World
|
||||
.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (int j1 = 0; j1 < tablet.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = tablet.getStackInSlot(j1);
|
||||
|
||||
if (k1 > itemstack.stackSize) k1 = itemstack.stackSize;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(
|
||||
par1World,
|
||||
par2 + f,
|
||||
par3 + f1,
|
||||
par4 + f2,
|
||||
new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World
|
||||
.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
if (k1 > itemstack.stackSize) k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(
|
||||
par1World,
|
||||
par2 + f,
|
||||
par3 + f1,
|
||||
par4 + f2,
|
||||
new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound()) entityitem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,8 +142,6 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
|
||||
if (par1World.isRemote) return;
|
||||
TileEntity te = par1World.getTileEntity(par2, par3, par4);
|
||||
if (!(te instanceof TileAnimationTablet tablet) || !tablet.redstone) return;
|
||||
|
||||
boolean power = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)
|
||||
|| par1World.isBlockIndirectlyGettingPowered(par2, par3 + 1, par4);
|
||||
@@ -146,10 +149,9 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
boolean on = (meta & 8) != 0;
|
||||
|
||||
if (power && !on) {
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta | 8, 4);
|
||||
} else if (!power && on) {
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta & 7, 4);
|
||||
}
|
||||
} else if (!power && on) par1World.setBlockMetadataWithNotify(par2, par3, par4, meta & 7, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,17 +159,37 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null && tile instanceof TileAnimationTablet) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) tile;
|
||||
if (tablet.redstone && tablet.swingProgress == 0) {
|
||||
tablet.findEntities(tablet.getTargetLoc());
|
||||
tablet.initiateSwing();
|
||||
par1World.addBlockEvent(
|
||||
par2,
|
||||
par3,
|
||||
par4,
|
||||
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class),
|
||||
0,
|
||||
0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer,
|
||||
int par6, float par7, float par8, float par9) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile instanceof TileAnimationTablet tablet) {
|
||||
if (tile != null) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) tile;
|
||||
if (par5EntityPlayer.getCurrentEquippedItem() != null
|
||||
&& par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
boolean activated = (meta & 8) != 0;
|
||||
if (!activated && !tablet.getIsBreaking() && tablet.isIdle()) {
|
||||
if (!activated && !tablet.getIsBreaking() && tablet.swingProgress == 0) {
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta == 5 ? 2 : meta + 1, 1 | 2);
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft:tool", 0.6F, 1F);
|
||||
} else par5EntityPlayer
|
||||
@@ -207,6 +229,11 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
return new TileAnimationTablet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ANIMATION_TABLET;
|
||||
@@ -241,9 +268,10 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
-8,
|
||||
2,
|
||||
4,
|
||||
new ItemStack(TTRegistry.dynamismTablet)).setWarp(1).setParents(LibResearch.KEY_MAGNETS).setPages(
|
||||
new ResearchPage("0"),
|
||||
ResearchHelper.arcaneRecipePage(LibResearch.KEY_ANIMATION_TABLET));
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class))).setWarp(1)
|
||||
.setParents(LibResearch.KEY_MAGNETS).setPages(
|
||||
new ResearchPage("0"),
|
||||
ResearchHelper.arcaneRecipePage(LibResearch.KEY_ANIMATION_TABLET));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -251,7 +279,7 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
return new ThaumicTinkererArcaneRecipe(
|
||||
LibResearch.KEY_ANIMATION_TABLET,
|
||||
LibResearch.KEY_ANIMATION_TABLET,
|
||||
new ItemStack(TTRegistry.dynamismTablet),
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class)),
|
||||
new AspectList().add(Aspect.AIR, 25).add(Aspect.ORDER, 15).add(Aspect.FIRE, 10),
|
||||
"GIG",
|
||||
"ICI",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -25,6 +26,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
@@ -33,7 +35,6 @@ import thaumcraft.common.config.ConfigItems;
|
||||
import thaumic.tinkerer.client.core.helper.IconHelper;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.tile.TileAspectAnalyzer;
|
||||
import thaumic.tinkerer.common.compat.LoadedMods;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
import thaumic.tinkerer.common.lib.LibGuiIDs;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
@@ -134,6 +135,11 @@ public class BlockAspectAnalyzer extends BlockModContainer {
|
||||
return new TileAspectAnalyzer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ASPECT_ANALYZER;
|
||||
@@ -141,7 +147,7 @@ public class BlockAspectAnalyzer extends BlockModContainer {
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return LoadedMods.computerCraftLoaded;
|
||||
return Loader.isModLoaded("ComputerCraft");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -152,6 +153,11 @@ public class BlockEnchanter extends BlockModContainer {
|
||||
return new TileEnchanter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ENCHANTER;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -178,6 +179,11 @@ public class BlockFunnel extends BlockModContainer {
|
||||
return new TileFunnel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.FUNNEL;
|
||||
|
||||
@@ -136,6 +136,11 @@ public abstract class BlockGas extends BlockMod implements ITTinkererBlock {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -8,6 +10,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
@@ -15,7 +18,6 @@ import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumic.tinkerer.common.block.tile.TileCamo;
|
||||
import thaumic.tinkerer.common.block.tile.TileGolemConnector;
|
||||
import thaumic.tinkerer.common.compat.LoadedMods;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererArcaneRecipe;
|
||||
@@ -46,6 +48,11 @@ public class BlockGolemConnector extends BlockCamo {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.GOLEMCONNECTOR;
|
||||
@@ -53,7 +60,7 @@ public class BlockGolemConnector extends BlockCamo {
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return LoadedMods.computerCraftLoaded;
|
||||
return Loader.isModLoaded("ComputerCraft");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockFarmland;
|
||||
@@ -52,6 +53,11 @@ public class BlockInfusedFarmland extends BlockFarmland implements ITTinkererBlo
|
||||
return new TileInfusedFarmland();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.BLOCK_INFUSED_FARMLAND;
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -38,6 +37,7 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
|
||||
public static final int BREEDING_CHANCE = 10;
|
||||
private IIcon[][] icons;
|
||||
private TileInfusedGrain tileEntity;
|
||||
|
||||
// Returns 0-5 for primal aspects, or 6 if compound aspect
|
||||
public static int getNumberFromAspectForTexture(Aspect aspect) {
|
||||
@@ -116,6 +116,10 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int metadata) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileInfusedGrain) {
|
||||
tileEntity = (TileInfusedGrain) tile;
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, metadata);
|
||||
}
|
||||
|
||||
@@ -126,11 +130,11 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
Random rand = new Random();
|
||||
int count = 1;
|
||||
for (int i = 0; i < count; i++) {
|
||||
TileEntity tileGrain = world.getTileEntity(x, y, z);
|
||||
TileInfusedGrain tileGrain = getTileEntitySafe(world, x, y, z);
|
||||
ItemStack seedStack = new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemInfusedSeeds.class));
|
||||
ItemInfusedSeeds.setAspect(seedStack, getAspectDropped(world, x, y, z, metadata));
|
||||
if (tileGrain != null) {
|
||||
ItemInfusedSeeds.setAspectTendencies(seedStack, ((TileInfusedGrain) tileGrain).primalTendencies);
|
||||
ItemInfusedSeeds.setAspectTendencies(seedStack, tileGrain.primalTendencies);
|
||||
}
|
||||
while (rand.nextInt(10000) < Math.pow(getPrimalTendencyCount(world, x, y, z, Aspect.ENTROPY), 2)) {
|
||||
seedStack.stackSize++;
|
||||
@@ -140,42 +144,27 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
}
|
||||
if (metadata >= 7) {
|
||||
do {
|
||||
Aspect aspect = getAspect(world, x, y, z);
|
||||
Aspect aspect = getAspectSafe(world, x, y, z);
|
||||
ItemStack retItem = AspectCropLootManager.getLootForAspect(aspect);
|
||||
if (retItem != null) ret.add(retItem);
|
||||
|
||||
} while (world.rand.nextInt(75) < getPrimalTendencyCount(world, x, y, z, Aspect.ORDER));
|
||||
}
|
||||
tileEntity = null;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
if (willHarvest) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.removedByPlayer(world, player, x, y, z, willHarvest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
||||
super.harvestBlock(world, player, x, y, z, meta);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
public int getPrimalTendencyCount(World world, int x, int y, int z, Aspect aspect) {
|
||||
TileEntity tileGrain = world.getTileEntity(x, y, z);
|
||||
return tileGrain instanceof TileInfusedGrain ? ((TileInfusedGrain) tileGrain).primalTendencies.getAmount(aspect)
|
||||
: 0;
|
||||
TileInfusedGrain tileGrain = getTileEntitySafe(world, x, y, z);
|
||||
return tileGrain != null ? tileGrain.primalTendencies.getAmount(aspect) : 0;
|
||||
}
|
||||
|
||||
private void fertilizeSoil(World world, int x, int y, int z, int metadata) {
|
||||
if (metadata >= 7) {
|
||||
do {
|
||||
if (world.getTileEntity(x, y - 1, z) instanceof TileInfusedFarmland) {
|
||||
Aspect currentAspect = getAspect(world, x, y, z);
|
||||
Aspect currentAspect = getAspectSafe(world, x, y, z);
|
||||
((TileInfusedFarmland) world.getTileEntity(x, y - 1, z)).aspectList.add(currentAspect, 1);
|
||||
((TileInfusedFarmland) world.getTileEntity(x, y - 1, z)).reduceSaturatedAspects();
|
||||
world.markBlockForUpdate(x, y - 1, z);
|
||||
@@ -192,7 +181,7 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
}
|
||||
|
||||
public Aspect getAspectDropped(World world, int x, int y, int z, int metadata) {
|
||||
Aspect currentAspect = getAspect(world, x, y, z);
|
||||
Aspect currentAspect = getAspectSafe(world, x, y, z);
|
||||
if (metadata >= 7 && currentAspect != null) {
|
||||
if (world.getTileEntity(x, y - 1, z) instanceof TileInfusedFarmland) {
|
||||
AspectList farmlandAspectList = ((TileInfusedFarmland) world.getTileEntity(x, y - 1, z)).aspectList;
|
||||
@@ -211,6 +200,11 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
return currentAspect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.INFUSED_GRAIN_BLOCK;
|
||||
@@ -256,4 +250,31 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
return null;
|
||||
}
|
||||
|
||||
private TileInfusedGrain getTileEntitySafe(World world, int x, int y, int z) {
|
||||
if (tileEntity != null) {
|
||||
return tileEntity;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile != null && tile instanceof TileInfusedGrain) {
|
||||
return (TileInfusedGrain) tile;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Aspect getAspectSafe(World world, int x, int y, int z) {
|
||||
if (tileEntity != null) {
|
||||
return tileEntity.aspect;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile != null && tile instanceof TileInfusedGrain) {
|
||||
return ((TileInfusedGrain) tile).aspect;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -190,6 +191,11 @@ public class BlockMagnet extends BlockModContainer implements IMultiTileEntityBl
|
||||
return (metadata & 2) == 2 ? new TileMobMagnet() : new TileMagnet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.MAGNET;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -40,6 +42,11 @@ public abstract class BlockMod extends Block implements ITTinkererBlock {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -64,6 +65,11 @@ public class BlockPlatform extends BlockCamo {
|
||||
return new TileCamo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.PLATFORM;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -82,6 +83,11 @@ public class BlockRPlacer extends BlockCamo implements IWandable {
|
||||
return new TileRPlacer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.REMOTE_PLACER;
|
||||
@@ -199,7 +205,8 @@ public class BlockRPlacer extends BlockCamo implements IWandable {
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile instanceof TileRPlacer placer) {
|
||||
if (tile != null && tile instanceof TileRPlacer) {
|
||||
TileRPlacer placer = (TileRPlacer) tile;
|
||||
placer.receiveRedstonePulse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -29,6 +30,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
@@ -38,7 +40,6 @@ import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumic.tinkerer.client.lib.LibRenderIDs;
|
||||
import thaumic.tinkerer.common.block.tile.TileRepairer;
|
||||
import thaumic.tinkerer.common.compat.LoadedMods;
|
||||
import thaumic.tinkerer.common.compat.TinkersConstructCompat;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
@@ -127,7 +128,7 @@ public class BlockRepairer extends BlockModContainer {
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
int dmg;
|
||||
if (LoadedMods.TConstructLoaded) {
|
||||
if (Loader.isModLoaded("TConstruct")) {
|
||||
if (TinkersConstructCompat.isTConstructTool(itemstack)) {
|
||||
dmg = TinkersConstructCompat.getDamage(itemstack);
|
||||
} else dmg = itemstack.getItemDamage();
|
||||
@@ -181,6 +182,11 @@ public class BlockRepairer extends BlockModContainer {
|
||||
return new TileRepairer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.REPAIRER;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -93,6 +94,11 @@ public class BlockSummon extends Block implements ITTinkererBlock {
|
||||
: par1 == ForgeDirection.DOWN.ordinal() ? Block.getBlockFromName("obsidian").getIcon(0, 0) : iconSide;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.SPAWNER;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -81,8 +81,10 @@ public class BlockTravelSlab extends BlockSlab implements ITTinkererBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block[] getMetaBlocks() {
|
||||
return new Block[] { new BlockTravelSlab(true) };
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList result = new ArrayList();
|
||||
result.add(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -30,6 +32,11 @@ public class BlockTravelStairs extends BlockStairs implements ITTinkererBlock {
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.TRAVEL_STAIRS;
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import static thaumic.tinkerer.common.lib.LibBlockNames.VISWEAVER;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumic.tinkerer.api.VisweaverRecipeMap;
|
||||
import thaumic.tinkerer.client.lib.LibRenderIDs;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.tile.TileVisweaver;
|
||||
import thaumic.tinkerer.common.item.ItemSpellCloth;
|
||||
import thaumic.tinkerer.common.lib.LibGuiIDs;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererInfusionRecipe;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
|
||||
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
import thaumic.tinkerer.common.research.ResearchHelper;
|
||||
import thaumic.tinkerer.common.research.TTResearchItem;
|
||||
|
||||
public class BlockVisweaver extends BlockModContainer {
|
||||
|
||||
IIcon iconBottom;
|
||||
IIcon iconTop;
|
||||
IIcon iconSides;
|
||||
|
||||
public BlockVisweaver() {
|
||||
super(Material.wood);
|
||||
setHardness(5F);
|
||||
setResistance(10F);
|
||||
|
||||
VisweaverRecipeMap.putRecipe(25, Aspect.FIRE, new ItemStack(Items.bed), new ItemStack(Items.spider_eye));
|
||||
VisweaverRecipeMap.putRecipe(50, Aspect.EARTH, new ItemStack(Items.brick), new ItemStack(Items.netherbrick));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileVisweaver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer,
|
||||
int par6, float par7, float par8, float par9) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null) {
|
||||
par1World.markBlockForUpdate(par2, par3, par4);
|
||||
par5EntityPlayer
|
||||
.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_VISWEAVER, par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Blocks.planks.getIcon(0, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int var2) {
|
||||
return new TileVisweaver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return VISWEAVER;
|
||||
}
|
||||
|
||||
// Only register as part of the GTNH modpack
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
// return Loader.isModLoaded("dreamcraft");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idVisweaver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(
|
||||
LibResearch.KEY_VISWEAVER,
|
||||
new AspectList().add(Aspect.FIRE, 1).add(Aspect.WATER, 1).add(Aspect.EARTH, 1).add(Aspect.AIR, 1)
|
||||
.add(Aspect.ORDER, 1).add(Aspect.ENTROPY, 1),
|
||||
-4,
|
||||
0,
|
||||
2,
|
||||
new ItemStack(this)).setParents(LibResearch.KEY_SPELL_CLOTH)
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.infusionPage(LibResearch.KEY_VISWEAVER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererInfusionRecipe(
|
||||
LibResearch.KEY_VISWEAVER,
|
||||
new ItemStack(this),
|
||||
15,
|
||||
new AspectList().add(Aspect.MAGIC, 50).add(Aspect.ENERGY, 20).add(Aspect.ELDRITCH, 20)
|
||||
.add(Aspect.VOID, 20).add(Aspect.MIND, 10),
|
||||
new ItemStack(Items.bed),
|
||||
new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1),
|
||||
new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1),
|
||||
new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1),
|
||||
new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1),
|
||||
new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1),
|
||||
new ItemStack(ConfigItems.itemResource, 1, 2),
|
||||
new ItemStack(ConfigItems.itemResource, 1, 2),
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemSpellCloth.class)));
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -88,8 +88,10 @@ public class BlockWardSlab extends BlockSlab implements ITTinkererBlock, ITileEn
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block[] getMetaBlocks() {
|
||||
return new Block[] { new BlockWardSlab(true) };
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList result = new ArrayList();
|
||||
result.add(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,7 @@ import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.WEST;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -388,6 +389,11 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
|
||||
return MapColor.tntColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
|
||||
@@ -130,16 +130,17 @@ public class BlockBedrockPortal extends BlockMod {
|
||||
(EntityPlayerMP) entity,
|
||||
ConfigHandler.bedrockDimensionID,
|
||||
new TeleporterBedrock((WorldServer) par1World));
|
||||
if (entity.worldObj.isAirBlock(par2, 249, par4)) {
|
||||
entity.worldObj.setBlock(par2, 249, par4, Blocks.stone);
|
||||
if (entity.worldObj.getBlock(par2, 250, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 250, par4, Blocks.air);
|
||||
}
|
||||
for (int i = 250; i < 254; i++) {
|
||||
Block block = entity.worldObj.getBlock(par2, i, par4);
|
||||
// something seems to be turning our bedrock to plain stone
|
||||
// let's also check that
|
||||
if (block == Blocks.stone || block == Blocks.bedrock) {
|
||||
entity.worldObj.setBlockToAir(par2, i, par4);
|
||||
}
|
||||
if (entity.worldObj.getBlock(par2, 251, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 251, par4, Blocks.air);
|
||||
}
|
||||
if (entity.worldObj.getBlock(par2, 252, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 252, par4, Blocks.air);
|
||||
}
|
||||
if (entity.worldObj.getBlock(par2, 253, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 253, par4, Blocks.air);
|
||||
}
|
||||
if (entity.worldObj.getBlock(par2, 254, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 254, par4, this);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.kami;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -150,6 +151,11 @@ public class BlockWarpGate extends BlockModContainer {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.WARP_GATE;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.quartz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -129,6 +130,11 @@ public class BlockDarkQuartz extends BlockMod {
|
||||
pillarDarkQuartzIcon = IconHelper.forName(par1IconRegister, "pillarDarkQuartz1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.DARK_QUARTZ;
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.quartz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -83,8 +83,10 @@ public class BlockDarkQuartzSlab extends BlockSlab implements ITTinkererBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block[] getMetaBlocks() {
|
||||
return new Block[] { new BlockDarkQuartzSlab(true) };
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList result = new ArrayList();
|
||||
result.add(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.quartz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -33,6 +35,11 @@ public class BlockDarkQuartzStairs extends BlockStairs implements ITTinkererBloc
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.DARK_QUARTZ_STAIRS;
|
||||
|
||||
@@ -37,8 +37,7 @@ import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
|
||||
@Optional.InterfaceList({ @Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft"),
|
||||
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2") })
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft") })
|
||||
public class TileAspectAnalyzer extends TileEntity implements IInventory, SimpleComponent, IPeripheral, IMovableTile {
|
||||
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
@@ -231,13 +230,11 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, Simple
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public void doneMoving() {}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,9 +18,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.movable.IMovableTile;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2")
|
||||
public class TileCamo extends TileEntity implements IMovableTile {
|
||||
|
||||
private static final String TAG_CAMO = "camo";
|
||||
@@ -75,12 +73,10 @@ public class TileCamo extends TileEntity implements IMovableTile {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public void doneMoving() {}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import appeng.api.movable.IMovableTile;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
@@ -42,7 +41,6 @@ import thaumic.tinkerer.common.enchantment.core.EnchantmentManager;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
import thaumic.tinkerer.common.lib.LibFeatures;
|
||||
|
||||
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2")
|
||||
public class TileEnchanter extends TileEntity implements ISidedInventory, IMovableTile {
|
||||
|
||||
private static final String TAG_ENCHANTS = "enchantsIntArray";
|
||||
@@ -496,12 +494,10 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public void doneMoving() {}
|
||||
}
|
||||
@@ -8,9 +8,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.movable.IMovableTile;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.mobilizer.BlockMobilizer;
|
||||
import thaumic.tinkerer.common.compat.LoadedMods;
|
||||
|
||||
public class TileEntityMobilizer extends TileEntity {
|
||||
|
||||
@@ -117,13 +117,16 @@ public class TileEntityMobilizer extends TileEntity {
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
TileEntity passenger = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
|
||||
IAppEngApi api = AEApi.instance();
|
||||
|
||||
// Prevent the passenger from popping off. Not sent to clients.
|
||||
worldObj.setBlock(targetX, yCoord, targetZ, Block.getBlockFromName("stone"), 0, 0);
|
||||
// Move non-TE blocks
|
||||
Block passengerId = worldObj.getBlock(xCoord, yCoord + 1, zCoord);
|
||||
|
||||
if (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord)
|
||||
|| passengerId.canPlaceBlockAt(worldObj, targetX, yCoord + 1, targetZ)) {
|
||||
|
||||
if (passenger == null) {
|
||||
if (passengerId != Block.getBlockFromName("bedrock")
|
||||
&& passengerId != Block.getBlockFromName("")) {
|
||||
@@ -140,8 +143,7 @@ public class TileEntityMobilizer extends TileEntity {
|
||||
}
|
||||
}
|
||||
// If AE is installed, use its handler
|
||||
} else if (LoadedMods.AE2Loaded) {
|
||||
IAppEngApi api = AEApi.instance();
|
||||
} else if (api != null) {
|
||||
if (api.registries().movable().askToMove(passenger)) {
|
||||
worldObj.setBlock(
|
||||
targetX,
|
||||
@@ -157,29 +159,34 @@ public class TileEntityMobilizer extends TileEntity {
|
||||
api.registries().movable().doneMoving(passenger);
|
||||
passenger.validate();
|
||||
}
|
||||
|
||||
// Handler IMovableTiles and vanilla TEs without AE
|
||||
} else if (passenger.getClass().getName().startsWith("net.minecraft.tileentity")) {
|
||||
worldObj.setBlock(
|
||||
targetX,
|
||||
yCoord + 1,
|
||||
targetZ,
|
||||
worldObj.getBlock(xCoord, yCoord + 1, zCoord),
|
||||
worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord),
|
||||
3);
|
||||
passenger.invalidate();
|
||||
worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord);
|
||||
} else if (passenger instanceof IMovableTile
|
||||
|| passenger.getClass().getName().startsWith("net.minecraft.tileentity")) {
|
||||
boolean imovable = passenger instanceof IMovableTile;
|
||||
if (imovable) ((IMovableTile) passenger).prepareToMove();
|
||||
worldObj.setBlock(
|
||||
targetX,
|
||||
yCoord + 1,
|
||||
targetZ,
|
||||
worldObj.getBlock(xCoord, yCoord + 1, zCoord),
|
||||
worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord),
|
||||
3);
|
||||
passenger.invalidate();
|
||||
worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord);
|
||||
|
||||
// IMovableHandler default code
|
||||
Chunk c = worldObj.getChunkFromBlockCoords(targetX, targetZ);
|
||||
// IMovableHandler default code
|
||||
Chunk c = worldObj.getChunkFromBlockCoords(targetX, targetZ);
|
||||
|
||||
c.func_150812_a(targetX & 0xF, yCoord + 1, targetZ & 0xF, passenger);
|
||||
c.func_150812_a(targetX & 0xF, yCoord + 1, targetZ & 0xF, passenger);
|
||||
|
||||
if (c.isChunkLoaded) {
|
||||
worldObj.addTileEntity(passenger);
|
||||
worldObj.markBlockForUpdate(targetX, yCoord + 1, targetZ);
|
||||
}
|
||||
passenger.validate();
|
||||
}
|
||||
if (c.isChunkLoaded) {
|
||||
worldObj.addTileEntity(passenger);
|
||||
worldObj.markBlockForUpdate(targetX, yCoord + 1, targetZ);
|
||||
}
|
||||
if (imovable) ((IMovableTile) passenger).doneMoving();
|
||||
passenger.validate();
|
||||
}
|
||||
}
|
||||
// Move self
|
||||
this.invalidate();
|
||||
|
||||
@@ -5,10 +5,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.movable.IMovableTile;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
|
||||
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2")
|
||||
public class TileEntityRelay extends TileEntity implements IMovableTile {
|
||||
|
||||
public boolean hasPartner;
|
||||
@@ -65,13 +63,11 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
|
||||
if (partnerX - xCoord != 0) {
|
||||
xInc = ((float) Math.copySign(.05, partnerX - xCoord)) * (worldObj.getTotalWorldTime() % 20);
|
||||
}
|
||||
if (worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) (0.5 + i + xInc),
|
||||
(float) (yCoord + 0.5),
|
||||
(float) (j + 0.5 + zInc),
|
||||
xCoord < partnerX || zCoord > partnerX ? 2 : 14);
|
||||
}
|
||||
ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) (0.5 + i + xInc),
|
||||
(float) (yCoord + 0.5),
|
||||
(float) (j + 0.5 + zInc),
|
||||
xCoord < partnerX || zCoord > partnerX ? 2 : 14);
|
||||
j += Math.copySign(1, partnerZ - zCoord);
|
||||
} while (j < partnerZ);
|
||||
i += Math.copySign(1, partnerX - xCoord);
|
||||
@@ -141,12 +137,10 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public void doneMoving() {}
|
||||
}
|
||||
@@ -17,8 +17,7 @@ public class TileForcefield extends TileEntity {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
ticks--;
|
||||
if (worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.blockSparkle(worldObj, xCoord, yCoord, zCoord, 255, 1);
|
||||
}
|
||||
|
||||
ThaumicTinkerer.tcProxy.blockSparkle(worldObj, xCoord, yCoord, zCoord, 255, 1);
|
||||
}
|
||||
}
|
||||
@@ -26,18 +26,15 @@ import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.movable.IMovableTile;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.aspects.IAspectContainer;
|
||||
import thaumcraft.api.aspects.IEssentiaContainerItem;
|
||||
import thaumcraft.common.blocks.ItemJarFilled;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.tiles.TileJarFillable;
|
||||
import thaumcraft.common.tiles.TileJarFillableVoid;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
|
||||
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2")
|
||||
public class TileFunnel extends TileEntity implements ISidedInventory, IAspectContainer, IMovableTile {
|
||||
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
@@ -54,7 +51,7 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
|
||||
Aspect aspect = aspectList.getAspects()[0];
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
|
||||
if (tile instanceof TileEntityHopper) {
|
||||
if (tile != null && tile instanceof TileEntityHopper) {
|
||||
TileEntity tile1 = getHopperFacing(
|
||||
tile.xCoord,
|
||||
tile.yCoord,
|
||||
@@ -72,18 +69,6 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
|
||||
jar1.addToContainer(aspect, 1);
|
||||
item.setAspects(jar, aspectList.remove(aspect, 1));
|
||||
}
|
||||
// "AspectFilter" is used for the jar label
|
||||
if (aspectList.getAmount(aspectList.getAspects()[0]) == 0
|
||||
&& !jar.stackTagCompound.hasKey("AspectFilter")) {
|
||||
String itemName = jar.getUnlocalizedName();
|
||||
if (itemName.equals("item.BlockJarFilledItem")) {
|
||||
setInventorySlotContents(0, new ItemStack(ConfigBlocks.blockJar));
|
||||
} else if (itemName.equals("item.BlockJarFilledItem.void")) {
|
||||
setInventorySlotContents(0, new ItemStack(ConfigBlocks.blockJar));
|
||||
getStackInSlot(0).setItemDamage(3);
|
||||
}
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,12 +277,10 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public void doneMoving() {}
|
||||
}
|
||||
@@ -34,8 +34,7 @@ import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.core.helper.MiscHelper;
|
||||
|
||||
@Optional.InterfaceList({ @Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft"),
|
||||
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2") })
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft") })
|
||||
public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile, SimpleComponent {
|
||||
|
||||
@Override
|
||||
@@ -73,9 +72,7 @@ public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile,
|
||||
|
||||
if (distanceSqrd > 1) {
|
||||
MiscHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), speedMod * 0.25F);
|
||||
if (worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
|
||||
}
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,13 +146,11 @@ public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile,
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public void doneMoving() {}
|
||||
|
||||
@Callback(doc = "function():boolean -- Returns Whether magnet is pushing or pulling")
|
||||
|
||||
@@ -34,7 +34,6 @@ import li.cil.oc.api.machine.Context;
|
||||
import thaumic.tinkerer.common.item.ItemSoulMould;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
|
||||
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2")
|
||||
public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTile {
|
||||
|
||||
private static final String TAG_ADULT = "adultCheck";
|
||||
@@ -180,12 +179,6 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTil
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setAdult(boolean adult) {
|
||||
this.adult = adult;
|
||||
this.markDirty();
|
||||
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[] { "isPulling", "setPulling", "getSignal", "getAdultSearch", "setAdultSearch" };
|
||||
@@ -204,7 +197,9 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTil
|
||||
}
|
||||
|
||||
private Object[] setAdultSearchImplementation(boolean argument) {
|
||||
setAdult(argument);
|
||||
|
||||
this.adult = argument;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -235,12 +230,10 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTil
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public void doneMoving() {}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class TileRPlacer extends TileCamo implements IInventory {
|
||||
super.readCustomNBT(cmp);
|
||||
|
||||
orientation = cmp.getInteger(TAG_ORIENTATION);
|
||||
blocks = Math.max(1, Math.min(cmp.getInteger(TAG_BLOCKS), 4));
|
||||
blocks = cmp.getInteger(TAG_BLOCKS);
|
||||
NBTTagList var2 = cmp.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
@@ -198,7 +198,7 @@ public class TileRPlacer extends TileCamo implements IInventory {
|
||||
z = this.zCoord;
|
||||
break;
|
||||
case 5:
|
||||
x = this.xCoord + this.blocks;
|
||||
x = this.xCoord - this.blocks;
|
||||
y = this.yCoord;
|
||||
z = this.zCoord;
|
||||
break;
|
||||
@@ -237,10 +237,4 @@ public class TileRPlacer extends TileCamo implements IInventory {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setDistance(int distance) {
|
||||
blocks = Math.max(1, Math.min(distance, 4));
|
||||
this.markDirty();
|
||||
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
@@ -26,24 +26,22 @@ import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.movable.IMovableTile;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.aspects.IAspectContainer;
|
||||
import thaumcraft.api.aspects.IEssentiaTransport;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.compat.LoadedMods;
|
||||
import thaumic.tinkerer.common.compat.TinkersConstructCompat;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
|
||||
/* import thaumic.tinkerer.common.compat.TinkersConstructCompat; */
|
||||
@Optional.Interface(iface = "appeng.api.movable.IMovableTile", modid = "appliedenergistics2")
|
||||
|
||||
public class TileRepairer extends TileEntity
|
||||
implements ISidedInventory, IAspectContainer, IEssentiaTransport, IMovableTile {
|
||||
|
||||
private static final String TAG_TOOK_LAST_TICK = "tookLastTick";
|
||||
private static final Map<Aspect, Integer> repairValues = new HashMap<>();
|
||||
|
||||
static {
|
||||
@@ -54,37 +52,31 @@ public class TileRepairer extends TileEntity
|
||||
|
||||
public int ticksExisted = 0;
|
||||
public boolean tookLastTick = true;
|
||||
int dmgLastTick = 0;
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (++ticksExisted % 10 == 0) {
|
||||
if (worldObj.isRemote) {
|
||||
if (tookLastTick) {
|
||||
ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) (xCoord + 0.25 + Math.random() / 2F),
|
||||
(float) (yCoord + 1 + Math.random() / 2F),
|
||||
(float) (zCoord + 0.25 + Math.random() / 2F),
|
||||
0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
boolean oldTookLastTick = tookLastTick;
|
||||
tookLastTick = false;
|
||||
|
||||
if (LoadedMods.TConstructLoaded && ConfigHandler.repairTConTools) {
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (inventorySlots[0] != null) {
|
||||
if (TinkersConstructCompat.isTConstructTool(inventorySlots[0])) {
|
||||
int dmg = TinkersConstructCompat.getDamage(inventorySlots[0]);
|
||||
if (dmg > 0) {
|
||||
int essentia = drawEssentia();
|
||||
TinkersConstructCompat.fixDamage(inventorySlots[0], essentia);
|
||||
int newDmg = TinkersConstructCompat.getDamage(inventorySlots[0]);
|
||||
tookLastTick = newDmg != dmg;
|
||||
markDirty();
|
||||
}
|
||||
if (tookLastTick != oldTookLastTick) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
if (dmgLastTick != 0 && dmgLastTick != dmg) {
|
||||
ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) (xCoord + 0.25 + Math.random() / 2F),
|
||||
(float) (yCoord + 1 + Math.random() / 2F),
|
||||
(float) (zCoord + 0.25 + Math.random() / 2F),
|
||||
0);
|
||||
tookLastTick = true;
|
||||
} else tookLastTick = false;
|
||||
} else tookLastTick = false;
|
||||
dmgLastTick = inventorySlots[0] == null ? 0
|
||||
: TinkersConstructCompat.getDamage(inventorySlots[0]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -92,12 +84,20 @@ public class TileRepairer extends TileEntity
|
||||
if (inventorySlots[0] != null && inventorySlots[0].getItemDamage() > 0) {
|
||||
int essentia = drawEssentia();
|
||||
int dmg = inventorySlots[0].getItemDamage();
|
||||
int newDmg = Math.max(0, dmg - essentia);
|
||||
inventorySlots[0].setItemDamage(newDmg);
|
||||
tookLastTick = newDmg != dmg;
|
||||
inventorySlots[0].setItemDamage(Math.max(0, dmg - essentia));
|
||||
markDirty();
|
||||
}
|
||||
if (tookLastTick != oldTookLastTick) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
|
||||
if (dmgLastTick != 0 && dmgLastTick != dmg) {
|
||||
ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) (xCoord + 0.25 + Math.random() / 2F),
|
||||
(float) (yCoord + 1 + Math.random() / 2F),
|
||||
(float) (zCoord + 0.25 + Math.random() / 2F),
|
||||
0);
|
||||
tookLastTick = true;
|
||||
} else tookLastTick = false;
|
||||
} else tookLastTick = false;
|
||||
|
||||
dmgLastTick = inventorySlots[0] == null ? 0 : inventorySlots[0].getItemDamage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,6 @@ public class TileRepairer extends TileEntity
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
tookLastTick = par1NBTTagCompound.getBoolean(TAG_TOOK_LAST_TICK);
|
||||
NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[1];
|
||||
|
||||
@@ -127,7 +126,6 @@ public class TileRepairer extends TileEntity
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
par1NBTTagCompound.setBoolean(TAG_TOOK_LAST_TICK, tookLastTick);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
if (inventorySlots[0] != null) {
|
||||
NBTTagCompound tagList = new NBTTagCompound();
|
||||
@@ -237,15 +235,20 @@ public class TileRepairer extends TileEntity
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return isRepairable(itemstack);
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (TinkersConstructCompat.isTConstructTool(itemstack)) {
|
||||
return itemstack != null;
|
||||
}
|
||||
}
|
||||
return itemstack != null && itemstack.getItem().isRepairable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return !isRepairable(itemstack);
|
||||
return true;
|
||||
}
|
||||
|
||||
private int drawEssentia() {
|
||||
int drawEssentia() {
|
||||
ForgeDirection orientation = getOrientation();
|
||||
TileEntity te = ThaumcraftApiHelper.getConnectableTile(worldObj, xCoord, yCoord, zCoord, orientation);
|
||||
if (te != null) {
|
||||
@@ -260,7 +263,7 @@ public class TileRepairer extends TileEntity
|
||||
return 0;
|
||||
}
|
||||
|
||||
private ForgeDirection getOrientation() {
|
||||
ForgeDirection getOrientation() {
|
||||
return ForgeDirection.getOrientation(getBlockMetadata());
|
||||
}
|
||||
|
||||
@@ -268,12 +271,9 @@ public class TileRepairer extends TileEntity
|
||||
public AspectList getAspects() {
|
||||
ItemStack stack = inventorySlots[0];
|
||||
if (stack == null) return null;
|
||||
if (LoadedMods.TConstructLoaded && TinkersConstructCompat.isTConstructTool(stack)) {
|
||||
if (ConfigHandler.repairTConTools) {
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (TinkersConstructCompat.isTConstructTool(stack))
|
||||
return new AspectList().add(Aspect.ENTROPY, TinkersConstructCompat.getDamage(stack));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return new AspectList().add(Aspect.ENTROPY, stack.getItemDamage());
|
||||
}
|
||||
@@ -367,7 +367,7 @@ public class TileRepairer extends TileEntity
|
||||
|
||||
@Override
|
||||
public int getSuctionAmount(ForgeDirection arg0) {
|
||||
return arg0 == getOrientation() && containsRepairableStack() ? 128 : 0;
|
||||
return arg0 == getOrientation() ? 128 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -376,27 +376,10 @@ public class TileRepairer extends TileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "appliedenergistics2")
|
||||
public void doneMoving() {}
|
||||
|
||||
private boolean containsRepairableStack() {
|
||||
return isRepairable(inventorySlots[0]);
|
||||
}
|
||||
|
||||
private boolean isRepairable(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
if (LoadedMods.TConstructLoaded && TinkersConstructCompat.isTConstructTool(stack)) {
|
||||
return ConfigHandler.repairTConTools && TinkersConstructCompat.getDamage(stack) > 0;
|
||||
}
|
||||
return stack.getItem() != null && stack.getItem().isRepairable() && stack.getItemDamage() > 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,10 +3,10 @@ package thaumic.tinkerer.common.block.tile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
@@ -19,115 +19,121 @@ public class TileSummon extends TileEntity {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (worldObj.getTotalWorldTime() % 300 != 0
|
||||
|| worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int radius = 1; radius < 6; radius++) {
|
||||
ArrayList<TilePedestal> pedestals = new ArrayList<>();
|
||||
for (int x = xCoord - radius; x <= xCoord + radius; x++) {
|
||||
for (int z = zCoord - radius; z <= zCoord + radius; z++) {
|
||||
TileEntity tile = worldObj.getTileEntity(x, yCoord, z);
|
||||
if (tile instanceof TilePedestal pedestal && pedestal.getStackInSlot(0) != null
|
||||
&& pedestal.getStackInSlot(0).getItem() instanceof ItemMobAspect) {
|
||||
pedestals.add(pedestal);
|
||||
if (worldObj.getTotalWorldTime() % 300 == 0) {
|
||||
if (worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
return;
|
||||
}
|
||||
for (int radius = 1; radius < 6; radius++) {
|
||||
ArrayList<TileEntity> pedestals = new ArrayList<>();
|
||||
for (int x = xCoord - radius; x <= xCoord + radius; x++) {
|
||||
for (int z = zCoord - radius; z <= zCoord + radius; z++) {
|
||||
TileEntity tile = worldObj.getTileEntity(x, yCoord, z);
|
||||
if (tile instanceof TilePedestal && ((TilePedestal) tile).getStackInSlot(0) != null
|
||||
&& ((TilePedestal) tile).getStackInSlot(0).getItem() instanceof ItemMobAspect) {
|
||||
pedestals.add(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < pedestals.size(); i++) {
|
||||
for (int j = 0; j < pedestals.size(); j++) {
|
||||
for (TilePedestal ped3 : pedestals) {
|
||||
TilePedestal ped1 = pedestals.get(i);
|
||||
TilePedestal ped2 = pedestals.get(j);
|
||||
for (int i = 0; i < pedestals.size(); i++) {
|
||||
for (int j = 0; j < pedestals.size(); j++) {
|
||||
for (TileEntity pedestal : pedestals) {
|
||||
TilePedestal ped1 = (TilePedestal) pedestals.get(i);
|
||||
TilePedestal ped2 = (TilePedestal) pedestals.get(j);
|
||||
TilePedestal ped3 = (TilePedestal) pedestal;
|
||||
|
||||
if ((ped1 == ped2) || (ped2 == ped3) || (ped1 == ped3)) continue;
|
||||
ArrayList<Aspect> aspects = new ArrayList<>();
|
||||
aspects.add(ItemMobAspect.getAspect(ped1.getStackInSlot(0)));
|
||||
if ((ped1 != ped2) && (ped2 != ped3) && (ped1 != ped3)) {
|
||||
ArrayList<Aspect> aspects = new ArrayList<>();
|
||||
aspects.add(ItemMobAspect.getAspect(ped1.getStackInSlot(0)));
|
||||
|
||||
aspects.add(ItemMobAspect.getAspect(ped2.getStackInSlot(0)));
|
||||
aspects.add(ItemMobAspect.getAspect(ped2.getStackInSlot(0)));
|
||||
|
||||
aspects.add(ItemMobAspect.getAspect(ped3.getStackInSlot(0)));
|
||||
aspects.add(ItemMobAspect.getAspect(ped3.getStackInSlot(0)));
|
||||
|
||||
for (EnumMobAspect recipe : EnumMobAspect.values()) {
|
||||
if (!Arrays.asList(recipe.aspects).containsAll(aspects)
|
||||
|| !aspects.containsAll(Arrays.asList(recipe.aspects))) {
|
||||
continue;
|
||||
}
|
||||
for (EnumMobAspect recipe : EnumMobAspect.values()) {
|
||||
if (Arrays.asList(recipe.aspects).containsAll(aspects)
|
||||
&& aspects.containsAll(Arrays.asList(recipe.aspects))) {
|
||||
|
||||
boolean isInfused = ItemMobAspect.isInfused(ped1.getStackInSlot(0))
|
||||
&& ItemMobAspect.isInfused(ped2.getStackInSlot(0))
|
||||
&& ItemMobAspect.isInfused(ped3.getStackInSlot(0));
|
||||
boolean isInfused = ItemMobAspect.isInfused(ped1.getStackInSlot(0))
|
||||
&& ItemMobAspect.isInfused(ped2.getStackInSlot(0))
|
||||
&& ItemMobAspect.isInfused(ped3.getStackInSlot(0));
|
||||
|
||||
if (isInfused && worldObj.getTotalWorldTime() % 1200 != 0) return;
|
||||
if (isInfused && worldObj.getTotalWorldTime() % 1200 != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isInfused) {
|
||||
ped1.setInventorySlotContents(0, null);
|
||||
ped2.setInventorySlotContents(0, null);
|
||||
ped3.setInventorySlotContents(0, null);
|
||||
}
|
||||
if (!isInfused) {
|
||||
ped1.setInventorySlotContents(0, null);
|
||||
ped2.setInventorySlotContents(0, null);
|
||||
ped3.setInventorySlotContents(0, null);
|
||||
}
|
||||
|
||||
if (!isInfused || ItemMobAspect.lastUsedTabletMatches(ped1.getStackInSlot(0), this)
|
||||
&& ItemMobAspect.lastUsedTabletMatches(ped2.getStackInSlot(0), this)
|
||||
&& ItemMobAspect.lastUsedTabletMatches(ped3.getStackInSlot(0), this)) {
|
||||
if (!isInfused || ItemMobAspect
|
||||
.lastUsedTabletMatches(ped1.getStackInSlot(0), this)
|
||||
&& ItemMobAspect.lastUsedTabletMatches(ped2.getStackInSlot(0), this)
|
||||
&& ItemMobAspect.lastUsedTabletMatches(ped3.getStackInSlot(0), this)) {
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
EntityLiving spawn = recipe.createEntity(worldObj);
|
||||
spawn.setLocationAndAngles(xCoord + .5, yCoord + 1, zCoord + .5, 0, 0);
|
||||
worldObj.spawnEntityInWorld(spawn);
|
||||
spawn.onSpawnWithEgg(null);
|
||||
if (spawn instanceof EntitySkeleton skeleton && skeleton.getSkeletonType() == 1) {
|
||||
// Needs to be done here instead of EnumMobAspect::setWither because
|
||||
// EntitySkeleton::onSpawnWithEgg sets the held item to a bow
|
||||
skeleton.setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword));
|
||||
if (!worldObj.isRemote) {
|
||||
Entity spawn = EntityList
|
||||
.createEntityByName(recipe.toString(), worldObj);
|
||||
spawn.setLocationAndAngles(xCoord + .5, yCoord + 1, zCoord + .5, 0, 0);
|
||||
if (spawn instanceof EntitySkeleton && worldObj.provider.isHellWorld) {
|
||||
((EntitySkeleton) spawn).setSkeletonType(1);
|
||||
}
|
||||
worldObj.spawnEntityInWorld(spawn);
|
||||
((EntityLiving) spawn).onSpawnWithEgg(null);
|
||||
((EntityLiving) spawn).playLivingSound();
|
||||
}
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.essentiaTrailFx(
|
||||
worldObj,
|
||||
ped1.xCoord,
|
||||
ped1.yCoord,
|
||||
ped1.zCoord,
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
20,
|
||||
aspects.get(0).getColor(),
|
||||
20);
|
||||
ThaumicTinkerer.tcProxy.essentiaTrailFx(
|
||||
worldObj,
|
||||
ped2.xCoord,
|
||||
ped2.yCoord,
|
||||
ped2.zCoord,
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
20,
|
||||
aspects.get(1).getColor(),
|
||||
20);
|
||||
ThaumicTinkerer.tcProxy.essentiaTrailFx(
|
||||
worldObj,
|
||||
ped3.xCoord,
|
||||
ped3.yCoord,
|
||||
ped3.zCoord,
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
20,
|
||||
aspects.get(2).getColor(),
|
||||
20);
|
||||
}
|
||||
}
|
||||
if (isInfused) {
|
||||
ItemMobAspect.markLastUsedTablet(ped1.getStackInSlot(0), this);
|
||||
|
||||
ItemMobAspect.markLastUsedTablet(ped2.getStackInSlot(0), this);
|
||||
|
||||
ItemMobAspect.markLastUsedTablet(ped3.getStackInSlot(0), this);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
spawn.playLivingSound();
|
||||
}
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.essentiaTrailFx(
|
||||
worldObj,
|
||||
ped1.xCoord,
|
||||
ped1.yCoord,
|
||||
ped1.zCoord,
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
20,
|
||||
aspects.get(0).getColor(),
|
||||
20);
|
||||
ThaumicTinkerer.tcProxy.essentiaTrailFx(
|
||||
worldObj,
|
||||
ped2.xCoord,
|
||||
ped2.yCoord,
|
||||
ped2.zCoord,
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
20,
|
||||
aspects.get(1).getColor(),
|
||||
20);
|
||||
ThaumicTinkerer.tcProxy.essentiaTrailFx(
|
||||
worldObj,
|
||||
ped3.xCoord,
|
||||
ped3.yCoord,
|
||||
ped3.zCoord,
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord,
|
||||
20,
|
||||
aspects.get(2).getColor(),
|
||||
20);
|
||||
}
|
||||
}
|
||||
if (isInfused) {
|
||||
ItemMobAspect.markLastUsedTablet(ped1.getStackInSlot(0), this);
|
||||
ItemMobAspect.markLastUsedTablet(ped2.getStackInSlot(0), this);
|
||||
ItemMobAspect.markLastUsedTablet(ped3.getStackInSlot(0), this);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
package thaumic.tinkerer.common.block.tile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.visnet.VisNetHandler;
|
||||
import thaumic.tinkerer.api.VisweaverRecipe;
|
||||
import thaumic.tinkerer.api.VisweaverRecipeMap;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
|
||||
public class TileVisweaver extends TileEntity implements IInventory {
|
||||
|
||||
private static final String TAG_INTERNAL_VIS = "internalVis";
|
||||
private static final String TAG_REQUIRED_VIS = "requiredVis";
|
||||
private static final String TAG_WORKING = "working";
|
||||
private static final String TAG_ASPECT = "cvType";
|
||||
private static final String TAG_INPUT = "currentInput";
|
||||
private static final String TAG_OUTPUT = "currentOutput";
|
||||
|
||||
private int tickCounter;
|
||||
private int internalVis = 0;
|
||||
private boolean working = false;
|
||||
private ItemStack currentOutput;
|
||||
private ItemStack currentInput;
|
||||
private Aspect cvType;
|
||||
private int requiredVis;
|
||||
|
||||
ItemStack[] inventorySlots = new ItemStack[2];
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
tickCounter++;
|
||||
if (worldObj.isRemote) return;
|
||||
if (working) {
|
||||
ItemStack currentStack = getStackInSlot(0);
|
||||
if (currentStack == null || currentInput == null || !currentStack.isItemEqual(currentInput)) {
|
||||
flushRecipe();
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
if (tickCounter % 20 != 0) return;
|
||||
if (!working) {
|
||||
recipeCheck();
|
||||
} else {
|
||||
internalVis += VisNetHandler.drainVis(this.worldObj, this.xCoord, this.yCoord, this.zCoord, cvType, 500);
|
||||
progressRecipe();
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
private void progressRecipe() {
|
||||
if (internalVis >= requiredVis) {
|
||||
internalVis -= requiredVis;
|
||||
finishRecipe();
|
||||
}
|
||||
}
|
||||
|
||||
private void flushRecipe() {
|
||||
internalVis = 0;
|
||||
requiredVis = 0;
|
||||
currentOutput = null;
|
||||
currentInput = null;
|
||||
cvType = null;
|
||||
working = false;
|
||||
}
|
||||
|
||||
private void recipeCheck() {
|
||||
VisweaverRecipe recipe = VisweaverRecipeMap.lookup(getStackInSlot(0));
|
||||
if (recipe != null) {
|
||||
ItemStack output = recipe.getOutput();
|
||||
if (canAddToSlot(output, 1) <= 0) return;
|
||||
cvType = recipe.getCentivisType();
|
||||
requiredVis = recipe.getCentivisCost();
|
||||
currentOutput = output;
|
||||
currentInput = recipe.getInput();
|
||||
working = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void finishRecipe() {
|
||||
decrStackSize(0, 1);
|
||||
addToSlot(currentOutput, 1);
|
||||
ItemStack input = getStackInSlot(0);
|
||||
if (input != null && currentInput.isItemEqual(input) && canAddToSlot(currentOutput, 1) > 0) {
|
||||
progressRecipe();
|
||||
} else {
|
||||
flushRecipe();
|
||||
recipeCheck();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySlots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slotIn) {
|
||||
return inventorySlots[slotIn];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
|
||||
if (inventorySlots[i].stackSize == 0) inventorySlots[i] = null;
|
||||
|
||||
}
|
||||
return stackAt;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of items from the input stack that can be stacked into this slot
|
||||
*/
|
||||
public int canAddToSlot(ItemStack input, int slot) {
|
||||
ItemStack currentStack = getStackInSlot(slot);
|
||||
if (currentStack == null) return Math.min(64, input.stackSize);
|
||||
if (!currentStack.isItemEqual(input)) return 0;
|
||||
return Math.min(input.stackSize, 64 - currentStack.stackSize);
|
||||
}
|
||||
|
||||
public void addToSlot(ItemStack stack, int slot) {
|
||||
int movable = canAddToSlot(stack, slot);
|
||||
if (movable == 0) return;
|
||||
ItemStack currentStack = getStackInSlot(slot);
|
||||
ItemStack newStack = stack.copy();
|
||||
|
||||
if (currentStack == null) {
|
||||
newStack.stackSize = movable;
|
||||
setInventorySlotContents(slot, newStack);
|
||||
} else {
|
||||
currentStack.stackSize += movable;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack stack) {
|
||||
inventorySlots[i] = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.VISWEAVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this
|
||||
&& entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
super.onDataPacket(net, pkt);
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
working = par1NBTTagCompound.getBoolean(TAG_WORKING);
|
||||
internalVis = par1NBTTagCompound.getInteger(TAG_INTERNAL_VIS);
|
||||
requiredVis = par1NBTTagCompound.getInteger(TAG_REQUIRED_VIS);
|
||||
cvType = Aspect.getAspect(par1NBTTagCompound.getString(TAG_ASPECT));
|
||||
currentInput = ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag(TAG_INPUT));
|
||||
currentOutput = ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag(TAG_OUTPUT));
|
||||
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < inventorySlots.length) inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
|
||||
NBTTagCompound input = new NBTTagCompound();
|
||||
NBTTagCompound output = new NBTTagCompound();
|
||||
|
||||
par1NBTTagCompound.setBoolean(TAG_WORKING, working);
|
||||
par1NBTTagCompound.setInteger(TAG_INTERNAL_VIS, internalVis);
|
||||
par1NBTTagCompound.setInteger(TAG_REQUIRED_VIS, requiredVis);
|
||||
|
||||
if (working) {
|
||||
par1NBTTagCompound.setString(TAG_ASPECT, cvType.getTag());
|
||||
par1NBTTagCompound.setTag(TAG_INPUT, currentInput.writeToNBT(input));
|
||||
par1NBTTagCompound.setTag(TAG_OUTPUT, currentOutput.writeToNBT(output));
|
||||
}
|
||||
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeToNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int index, ItemStack stack) {
|
||||
return index == 0;
|
||||
}
|
||||
|
||||
public boolean isWorking() {
|
||||
return working;
|
||||
}
|
||||
|
||||
public int getTickCounter() {
|
||||
return tickCounter;
|
||||
}
|
||||
|
||||
public Aspect getCvType() {
|
||||
return cvType;
|
||||
}
|
||||
|
||||
public int getInternalVis() {
|
||||
return internalVis;
|
||||
}
|
||||
|
||||
public int getRequiredVis() {
|
||||
return requiredVis;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import thaumic.tinkerer.common.block.tile.container.slot.SlotWand;
|
||||
|
||||
public class ContainerEnchanter extends ContainerPlayerInv {
|
||||
|
||||
public TileEnchanter enchanter;
|
||||
TileEnchanter enchanter;
|
||||
|
||||
public ContainerEnchanter(TileEnchanter enchanter, InventoryPlayer playerInv) {
|
||||
super(playerInv);
|
||||
@@ -38,14 +38,14 @@ public class ContainerEnchanter extends ContainerPlayerInv {
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = inventorySlots.get(par2);
|
||||
Slot var4 = (Slot) inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
|
||||
if (var5 != null && var5.getItem() == Items.book) return null;
|
||||
|
||||
boolean wand = inventorySlots.get(1).isItemValid(var5);
|
||||
boolean wand = ((Slot) inventorySlots.get(1)).isItemValid(var5);
|
||||
|
||||
// noinspection ConstantConditions
|
||||
var3 = var5.copy();
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package thaumic.tinkerer.common.block.tile.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import thaumic.tinkerer.common.block.tile.TileVisweaver;
|
||||
|
||||
public class ContainerVisweaver extends ContainerPlayerInv {
|
||||
|
||||
TileVisweaver visweaver;
|
||||
|
||||
public ContainerVisweaver(TileVisweaver visweaver, InventoryPlayer playerInv) {
|
||||
super(playerInv);
|
||||
this.visweaver = visweaver;
|
||||
|
||||
addSlotToContainer(new Slot(visweaver, 0, 20, 30));
|
||||
addSlotToContainer(new SlotVisweaverOutput(visweaver, 1, 140, 30));
|
||||
|
||||
initPlayerInv();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
itemstack = stackInSlot.copy();
|
||||
|
||||
if (index == 0 || index == 1) {
|
||||
if (!this.mergeItemStack(stackInSlot, 2, 38, true)) {
|
||||
return null;
|
||||
}
|
||||
slot.onSlotChange(stackInSlot, itemstack);
|
||||
} else {
|
||||
if (!this.mergeItemStack(stackInSlot, 0, 1, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == 0) {
|
||||
slot.putStack(null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
if (stackInSlot.stackSize == itemstack.stackSize) {
|
||||
return null;
|
||||
}
|
||||
slot.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return visweaver.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
public static class SlotVisweaverOutput extends Slot {
|
||||
|
||||
public SlotVisweaverOutput(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
|
||||
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-26
@@ -29,11 +29,13 @@ public class ContainerIchorPouch extends ContainerPlayerInv {
|
||||
ItemStack pouch;
|
||||
int blockSlot;
|
||||
|
||||
public ContainerIchorPouch(EntityPlayer player, ItemStack bag) {
|
||||
public ContainerIchorPouch(EntityPlayer player) {
|
||||
super(player.inventory);
|
||||
pouch = bag;
|
||||
|
||||
this.player = player;
|
||||
pouch = player.getCurrentEquippedItem();
|
||||
blockSlot = player.inventory.currentItem + 27 + 13 * 9;
|
||||
|
||||
for (int y = 0; y < 9; y++) for (int x = 0; x < 13; x++)
|
||||
addSlotToContainer(new SlotNoPouches(inv, y * 13 + x, 12 + x * 18, 8 + y * 18));
|
||||
initPlayerInv();
|
||||
@@ -43,30 +45,6 @@ public class ContainerIchorPouch extends ContainerPlayerInv {
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initPlayerInv() {
|
||||
int ys = getInvYStart();
|
||||
int xs = getInvXStart();
|
||||
int held = player.inventory.currentItem;
|
||||
|
||||
for (int x = 0; x < 3; ++x) for (int y = 0; y < 9; ++y)
|
||||
addSlotToContainer(new Slot(player.inventory, y + x * 9 + 9, xs + y * 18, ys + x * 18));
|
||||
|
||||
for (int x = 0; x < 9; ++x) {
|
||||
if (x == held) {
|
||||
addSlotToContainer(new Slot(player.inventory, x, xs + x * 18, ys + 58) {
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer p) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
addSlotToContainer(new Slot(player.inventory, x, xs + x * 18, ys + 58));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slot) {
|
||||
if (slot == blockSlot) return null;
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ import thaumic.tinkerer.common.item.kami.ItemSkyPearl;
|
||||
|
||||
public class ContainerWarpGate extends ContainerPlayerInv {
|
||||
|
||||
public TileWarpGate gate;
|
||||
TileWarpGate gate;
|
||||
|
||||
public ContainerWarpGate(TileWarpGate gate, InventoryPlayer playerInv) {
|
||||
super(playerInv);
|
||||
@@ -44,7 +44,7 @@ public class ContainerWarpGate extends ContainerPlayerInv {
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = inventorySlots.get(par2);
|
||||
Slot var4 = (Slot) inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.tile.kami;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -44,27 +46,27 @@ public class TileWarpGate extends TileEntity implements IInventory {
|
||||
int z = coords.posZ;
|
||||
|
||||
TileEntity tile = player.worldObj.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileWarpGate destGate) {
|
||||
if (tile != null && tile instanceof TileWarpGate) {
|
||||
TileWarpGate destGate = (TileWarpGate) tile;
|
||||
if (!destGate.locked) {
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 1F);
|
||||
|
||||
if (player.worldObj.isRemote) {
|
||||
for (int i = 0; i < 20; i++) ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) player.posX + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
(float) player.posY + player.worldObj.rand.nextFloat(),
|
||||
(float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
6);
|
||||
}
|
||||
for (int i = 0; i < 20; i++) ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) player.posX + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
(float) player.posY + player.worldObj.rand.nextFloat(),
|
||||
(float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
6);
|
||||
|
||||
player.mountEntity(null);
|
||||
if (player instanceof EntityPlayerMP) ((EntityPlayerMP) player).playerNetServerHandler
|
||||
.setPlayerLocation(x + 0.5, y + 1.6, z + 0.5, player.rotationYaw, player.rotationPitch);
|
||||
if (player.worldObj.isRemote) {
|
||||
for (int i = 0; i < 20; i++) ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) player.posX + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
(float) player.posY + player.worldObj.rand.nextFloat(),
|
||||
(float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
6);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 20; i++) ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) player.posX + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
(float) player.posY + player.worldObj.rand.nextFloat(),
|
||||
(float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
6);
|
||||
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 0.1F);
|
||||
return true;
|
||||
} else
|
||||
@@ -76,12 +78,12 @@ public class TileWarpGate extends TileEntity implements IInventory {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
final AxisAlignedBB bbox = getTeleportRange();
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(
|
||||
EntityPlayer.class,
|
||||
AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1, zCoord, xCoord + 1, yCoord + 1.5, zCoord + 1));
|
||||
|
||||
EntityPlayer player = ThaumicTinkerer.proxy.getClientPlayer();
|
||||
if (player != null && player.worldObj == this.worldObj
|
||||
&& player.isSneaking()
|
||||
&& player.boundingBox.intersectsWith(bbox)) {
|
||||
EntityPlayer clientPlayer = ThaumicTinkerer.proxy.getClientPlayer();
|
||||
for (EntityPlayer player : players) if (player != null && player == clientPlayer && player.isSneaking()) {
|
||||
player.openGui(
|
||||
ThaumicTinkerer.instance,
|
||||
LibGuiIDs.GUI_ID_WARP_GATE_DESTINATIONS,
|
||||
@@ -89,15 +91,12 @@ public class TileWarpGate extends TileEntity implements IInventory {
|
||||
xCoord,
|
||||
yCoord,
|
||||
zCoord);
|
||||
break;
|
||||
}
|
||||
|
||||
teleportedThisTick = false;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getTeleportRange() {
|
||||
return AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1, zCoord, xCoord + 1, yCoord + 1.5, zCoord + 1);
|
||||
}
|
||||
|
||||
public void teleportPlayer(EntityPlayer player, int index) {
|
||||
if (teleportedThisTick) return;
|
||||
|
||||
@@ -237,10 +236,4 @@ public class TileWarpGate extends TileEntity implements IInventory {
|
||||
super.onDataPacket(manager, packet);
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
public void setLocked(boolean locked) {
|
||||
this.locked = locked;
|
||||
this.markDirty();
|
||||
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
@@ -13,180 +13,76 @@ package thaumic.tinkerer.common.block.tile.tablet;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public final class TabletFakePlayer extends FakePlayer {
|
||||
import thaumcraft.common.lib.FakeThaumcraftPlayer;
|
||||
|
||||
private final TileAnimationTablet tablet;
|
||||
public class TabletFakePlayer extends FakeThaumcraftPlayer {
|
||||
|
||||
public TabletFakePlayer(TileAnimationTablet tablet) {
|
||||
TileAnimationTablet tablet;
|
||||
|
||||
public TabletFakePlayer(TileAnimationTablet tablet) { // ,String name) {
|
||||
super(
|
||||
(WorldServer) tablet.getWorldObj(),
|
||||
tablet.getWorldObj(),
|
||||
new GameProfile(UUID.fromString("a8f026a0-135b-11e4-9191-0800200c9a66"), "[ThaumcraftTablet]"));
|
||||
// super(tablet.getWorldObj(),"[ThaumcraftTablet]");
|
||||
this.tablet = tablet;
|
||||
this.playerNetServerHandler = new DummyNetHandlerPlayServer(MinecraftServer.getServer(), this);
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.boundingBox.setBounds(this.posX, this.posY, this.posZ, this.posX, this.posY, this.posZ);
|
||||
this.rotationPitch = -15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead() {
|
||||
inventory.clearInventory(null, -1);
|
||||
super.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.posX = tablet.xCoord + 0.5f;
|
||||
this.posY = tablet.yCoord + 0.5f;
|
||||
this.posZ = tablet.zCoord + 0.5f;
|
||||
this.inventory.currentItem = 0;
|
||||
motionX = motionY = motionZ = 0;
|
||||
capabilities.isCreativeMode = false;
|
||||
|
||||
this.capabilities.isCreativeMode = false;
|
||||
posX = tablet.xCoord + 0.5;
|
||||
posY = tablet.yCoord + 1.6;
|
||||
posZ = tablet.zCoord + 0.5;
|
||||
|
||||
if (riddenByEntity != null) riddenByEntity.ridingEntity = null;
|
||||
if (ridingEntity != null) ridingEntity.riddenByEntity = null;
|
||||
riddenByEntity = null;
|
||||
ridingEntity = null;
|
||||
|
||||
motionX = motionY = motionZ = 0;
|
||||
setHealth(20);
|
||||
isDead = false;
|
||||
|
||||
int meta = tablet.getBlockMetadata() & 7;
|
||||
int rotation = meta == 2 ? 180 : meta == 3 ? 0 : meta == 4 ? 90 : -90;
|
||||
|
||||
rotationYaw = rotationYawHead = rotation;
|
||||
// Drop everything except for held item
|
||||
for (int i = 1; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
if (stack != null) {
|
||||
entityDropItem(stack, 0);
|
||||
inventory.setInventorySlotContents(i, null);
|
||||
rotationPitch = -15;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
if (i != inventory.currentItem) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
if (stack != null) {
|
||||
entityDropItem(stack, 1.0f);
|
||||
inventory.setInventorySlotContents(i, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
syncSlots();
|
||||
}
|
||||
|
||||
public void syncSlots() {
|
||||
this.inventory.mainInventory[0] = tablet.heldItem;
|
||||
}
|
||||
|
||||
// Copied from Minecraft and PlayerControllerMP
|
||||
public boolean sendUseItem(ItemStack stack) {
|
||||
if (!ForgeEventFactory.onPlayerInteract(this, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, 0, 0, 0, -1, worldObj)
|
||||
.isCanceled()) {
|
||||
int i = stack.stackSize;
|
||||
ItemStack itemstack1 = stack.useItemRightClick(worldObj, this);
|
||||
if (itemstack1 == stack && itemstack1.stackSize == i) {
|
||||
return false;
|
||||
}
|
||||
inventory.mainInventory[0] = itemstack1;
|
||||
|
||||
if (itemstack1.stackSize <= 0) {
|
||||
inventory.mainInventory[0] = null;
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this, itemstack1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// copied from PlayerController#onPlayerRightClick
|
||||
public boolean onPlayerRightClick(ItemStack stack, int x, int y, int z, int side, float f, float f1, float f2) {
|
||||
Item item = stack.getItem();
|
||||
if (item != null && item.onItemUseFirst(stack, this, worldObj, x, y, z, side, f, f1, f2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
if (block.onBlockActivated(worldObj, x, y, z, this, side, f, f1, f2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!stack.tryPlaceItemIntoWorld(this, worldObj, x, y, z, side, f, f1, f2)) {
|
||||
return false;
|
||||
}
|
||||
if (stack.stackSize <= 0) {
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this, stack));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void addChatMessage(IChatComponent var1) {}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getPlayerCoordinates() {
|
||||
return new ChunkCoordinates(tablet.xCoord, tablet.yCoord, tablet.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isMovementBlocked() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBePushed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(double x, double y, double z) {
|
||||
// NO-OP (the position is set at creation)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead() {
|
||||
// NO-OP (this should never happen...?)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mountEntity(Entity entityIn) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHealth(float p_70606_1_) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLivingUpdate() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChatMessage(IChatComponent var1) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChatComponentMessage(IChatComponent chatmessagecomponent) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
private static final class DummyNetHandlerPlayServer extends NetHandlerPlayServer {
|
||||
|
||||
public DummyNetHandlerPlayServer(MinecraftServer server, FakePlayer player) {
|
||||
super(server, new NetworkManager(false), player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetworkTick() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPacket(Packet packetIn) {
|
||||
// NO-OP
|
||||
}
|
||||
}
|
||||
}
|
||||
+400
-423
File diff suppressed because it is too large.
Load diff
+9
-9
@@ -25,6 +25,7 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.lua.LuaException;
|
||||
@@ -40,7 +41,6 @@ import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.aspects.IAspectContainer;
|
||||
import thaumcraft.api.aspects.IEssentiaTransport;
|
||||
import thaumic.tinkerer.common.compat.IndustrialcraftUnloadHelper;
|
||||
import thaumic.tinkerer.common.compat.LoadedMods;
|
||||
import thaumic.tinkerer.common.lib.LibFeatures;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@@ -70,7 +70,7 @@ public class TileTransvectorInterface extends TileTransvector
|
||||
if (worldObj.getTotalWorldTime() % 100 == 0) {
|
||||
worldObj.notifyBlockChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
|
||||
}
|
||||
if (!addedToICEnergyNet && !worldObj.isRemote && LoadedMods.ic2Loaded) {
|
||||
if (!addedToICEnergyNet && !worldObj.isRemote && Loader.isModLoaded("IC2")) {
|
||||
|
||||
IndustrialcraftUnloadHelper.addToIC2EnergyNet(this);
|
||||
addedToICEnergyNet = true;
|
||||
@@ -84,7 +84,7 @@ public class TileTransvectorInterface extends TileTransvector
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
if (LoadedMods.ic2Loaded) {
|
||||
if (Loader.isModLoaded("IC2")) {
|
||||
IndustrialcraftUnloadHelper.removeFromIC2EnergyNet(this);
|
||||
}
|
||||
super.invalidate();
|
||||
@@ -93,7 +93,7 @@ public class TileTransvectorInterface extends TileTransvector
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
|
||||
if (LoadedMods.ic2Loaded) {
|
||||
if (Loader.isModLoaded("IC2")) {
|
||||
IndustrialcraftUnloadHelper.removeFromIC2EnergyNet(this);
|
||||
}
|
||||
}
|
||||
@@ -257,35 +257,35 @@ public class TileTransvectorInterface extends TileTransvector
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "CoFHCore")
|
||||
@Optional.Method(modid = "CoFHLib")
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IEnergyHandler ? ((IEnergyHandler) tile).receiveEnergy(from, maxReceive, simulate) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "CoFHCore")
|
||||
@Optional.Method(modid = "CoFHLib")
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IEnergyHandler ? ((IEnergyHandler) tile).extractEnergy(from, maxExtract, simulate) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "CoFHCore")
|
||||
@Optional.Method(modid = "CoFHLib")
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IEnergyHandler ? ((IEnergyHandler) tile).getEnergyStored(from) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "CoFHCore")
|
||||
@Optional.Method(modid = "CoFHLib")
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IEnergyHandler ? ((IEnergyHandler) tile).getMaxEnergyStored(from) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "CoFHCore")
|
||||
@Optional.Method(modid = "CoFHLib")
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
TileEntity tile = getTile();
|
||||
return tile instanceof IEnergyHandler ? ((IEnergyHandler) tile).canConnectEnergy(from) : false;
|
||||
|
||||
+6
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.transvector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -133,6 +134,11 @@ public class BlockTransvectorDislocator extends BlockCamo {
|
||||
return new TileTransvectorDislocator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.DISLOCATOR;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.transvector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
@@ -47,6 +49,11 @@ public class BlockTransvectorInterface extends BlockCamo {
|
||||
return new TileTransvectorInterface();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.INTERFACE;
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package thaumic.tinkerer.common.compat;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import ic2.api.item.ElectricItem;
|
||||
|
||||
public class EMTCompat {
|
||||
|
||||
public static Item electricHoe;
|
||||
|
||||
public static void init() {
|
||||
electricHoe = GameRegistry.findItem("EMT", "ElectricHoeGrowth");
|
||||
}
|
||||
|
||||
public static boolean validElectricHoe(ItemStack stack) {
|
||||
return LoadedMods.EMTLoaded && stack.getItem() == EMTCompat.electricHoe
|
||||
&& ElectricItem.manager.canUse(stack, 250);
|
||||
}
|
||||
|
||||
public static void useEnergy(ItemStack hoeOfGrowth, EntityPlayer player) {
|
||||
ElectricItem.manager.use(hoeOfGrowth, 250, player);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package thaumic.tinkerer.common.compat;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class LoadedMods {
|
||||
|
||||
public static final boolean AE2Loaded = Loader.isModLoaded("appliedenergistics2");
|
||||
public static final boolean EMTLoaded = Loader.isModLoaded("EMT");
|
||||
public static final boolean NEILoaded = Loader.isModLoaded("NotEnoughItems");
|
||||
public static final boolean TConstructLoaded = Loader.isModLoaded("TConstruct");
|
||||
public static final boolean aspectRecipeIndexLoaded = Loader.isModLoaded("aspectrecipeindex");
|
||||
public static final boolean baublesExpandedLoaded = Loader.isModLoaded("Baubles|Expanded");
|
||||
public static final boolean bloodMagicLoaded = Loader.isModLoaded("BloodMagic");
|
||||
public static final boolean botaniaLoaded = Loader.isModLoaded("Botania");
|
||||
public static final boolean computerCraftLoaded = Loader.isModLoaded("ComputerCraft");
|
||||
public static final boolean enderIOLoaded = Loader.isModLoaded("EnderIO");
|
||||
public static final boolean enderStorageLoaded = Loader.isModLoaded("EnderStorage");
|
||||
public static final boolean forgeMultipartLoaded = Loader.isModLoaded("ForgeMultipart");
|
||||
public static final boolean gt5uNHLoaded = Loader.isModLoaded("gregtech_nh");
|
||||
public static final boolean ic2Loaded = Loader.isModLoaded("IC2");
|
||||
public static final boolean openComputersLoaded = Loader.isModLoaded("OpenComputers");
|
||||
public static final boolean thaumicBootsLoaded = Loader.isModLoaded("thaumicboots");
|
||||
public static final boolean wailaLoaded = Loader.isModLoaded("Waila");
|
||||
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package thaumic.tinkerer.common.core.helper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -24,46 +22,29 @@ import thaumic.tinkerer.common.item.ItemBrightNitor;
|
||||
import thaumic.tinkerer.common.item.ItemInfusedGrain;
|
||||
|
||||
/**
|
||||
* Created by pixlepix on 8/7/14, reworked by Spaghetti on 2026-08-21 These very lines of code will cause great trouble
|
||||
* in the future. However, they have proven to be less chaotic than anticipated in the past, so they live on ... even if
|
||||
* that means nerfing them to the ground.
|
||||
* Created by pixlepix on 8/7/14.
|
||||
*/
|
||||
public class AspectCropLootManager {
|
||||
|
||||
public static class LootEntry {
|
||||
|
||||
public final ItemStack stack;
|
||||
public final int weight;
|
||||
|
||||
public LootEntry(ItemStack stack, int weight) {
|
||||
this.stack = stack;
|
||||
this.weight = weight;
|
||||
}
|
||||
}
|
||||
|
||||
private static final Random RAND = new Random();
|
||||
|
||||
private static HashMap<Aspect, List<LootEntry>> lootMap = new HashMap<>();
|
||||
private static HashMap<Aspect, HashMap<ItemStack, Integer>> lootMap = new HashMap<>();
|
||||
|
||||
public static ItemStack getLootForAspect(Aspect aspect) {
|
||||
List<LootEntry> aspectLootList = lootMap.get(aspect);
|
||||
|
||||
if (aspectLootList == null || aspectLootList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
HashMap<ItemStack, Integer> aspectHashmap = lootMap.get(aspect);
|
||||
// Find total value of the possible ItemStacks for the aspect
|
||||
if (aspectHashmap == null) return null;
|
||||
int sum = 0;
|
||||
for (LootEntry entry : aspectLootList) {
|
||||
sum += entry.weight;
|
||||
}
|
||||
|
||||
for (Integer i : aspectHashmap.values()) {
|
||||
sum += i;
|
||||
}
|
||||
if (sum > 0) {
|
||||
int randInt = RAND.nextInt(sum);
|
||||
for (LootEntry entry : aspectLootList) {
|
||||
if (randInt < entry.weight) {
|
||||
return entry.stack.copy();
|
||||
Random rand = new Random();
|
||||
int randInt = rand.nextInt(sum);
|
||||
for (Map.Entry<ItemStack, Integer> pair : aspectHashmap.entrySet()) {
|
||||
if (randInt <= 0) {
|
||||
return pair.getKey().copy();
|
||||
}
|
||||
randInt -= entry.weight;
|
||||
randInt -= pair.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -74,18 +55,22 @@ public class AspectCropLootManager {
|
||||
}
|
||||
|
||||
public static void addAspectLoot(Aspect aspect, String target) {
|
||||
|
||||
addAspectLoot(aspect, target, 1);
|
||||
for (String ore : OreDictionary.getOreNames()) {
|
||||
if (ore.contains(WordUtils.capitalizeFully(target)) || ore.contains(target)) {
|
||||
for (ItemStack stack : OreDictionary.getOres(ore)) {
|
||||
addAspectLoot(aspect, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addAspectLoot(Aspect aspect, String target, int count) {
|
||||
String capitalized = WordUtils.capitalizeFully(target);
|
||||
for (String ore : OreDictionary.getOreNames()) {
|
||||
if (ore.contains(capitalized) || ore.contains(target)) {
|
||||
if (ore.contains(WordUtils.capitalizeFully(target)) || ore.contains(target)) {
|
||||
for (ItemStack stack : OreDictionary.getOres(ore)) {
|
||||
ItemStack newStack = stack.copy();
|
||||
if (newStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
|
||||
newStack.setItemDamage(0);
|
||||
}
|
||||
newStack.stackSize = count;
|
||||
addAspectLoot(aspect, newStack);
|
||||
}
|
||||
@@ -94,21 +79,12 @@ public class AspectCropLootManager {
|
||||
}
|
||||
|
||||
public static void addAspectLoot(Aspect aspect, ItemStack stack, int power) {
|
||||
if (stack == null || stack.getItem() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
lootMap.putIfAbsent(aspect, new ArrayList<>());
|
||||
lootMap.get(aspect).add(new LootEntry(stack.copy(), power));
|
||||
}
|
||||
|
||||
public static Map<Aspect, List<LootEntry>> getAllLoot() {
|
||||
return lootMap;
|
||||
lootMap.get(aspect).put(stack, power);
|
||||
}
|
||||
|
||||
public static void populateLootMap() {
|
||||
for (Aspect a : Aspect.aspects.values()) {
|
||||
lootMap.put(a, new ArrayList<>());
|
||||
lootMap.put(a, new HashMap<>());
|
||||
}
|
||||
addAspectLoot(
|
||||
Aspect.AIR,
|
||||
@@ -135,15 +111,16 @@ public class AspectCropLootManager {
|
||||
1,
|
||||
ItemInfusedGrain.getMetaForAspect(Aspect.WATER)));
|
||||
|
||||
addAspectLoot(Aspect.ORDER, new ItemStack(Blocks.glass, 16));
|
||||
addAspectLoot(Aspect.ENTROPY, new ItemStack(Blocks.sand, 16));
|
||||
addAspectLoot(Aspect.ORDER, new ItemStack(Blocks.glass, 64));
|
||||
addAspectLoot(Aspect.ENTROPY, new ItemStack(Blocks.sand, 64));
|
||||
|
||||
addAspectLoot(Aspect.ELDRITCH, new ItemStack(Items.ender_pearl, 4), 10);
|
||||
addAspectLoot(Aspect.ELDRITCH, new ItemStack(Items.ender_eye, 4), 5);
|
||||
addAspectLoot(Aspect.ELDRITCH, "bucketEnder");
|
||||
addAspectLoot(Aspect.ELDRITCH, new ItemStack(ConfigItems.itemResource, 1, 17)); // void seed
|
||||
|
||||
addAspectLoot(Aspect.TREE, "logWood");
|
||||
// addAspectLoot(Aspect.TREE, "wood");
|
||||
|
||||
addAspectLoot(Aspect.TREE, new ItemStack(Blocks.log));
|
||||
|
||||
for (Aspect tag : Aspect.aspects.values()) {
|
||||
ItemStack i = new ItemStack(ConfigItems.itemWispEssence, 1, 0);
|
||||
@@ -151,32 +128,33 @@ public class AspectCropLootManager {
|
||||
addAspectLoot(Aspect.AURA, i);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 24; i++) {
|
||||
addAspectLoot(Aspect.BEAST, new ItemStack(Items.spawn_egg, 1, i));
|
||||
}
|
||||
|
||||
addAspectLoot(Aspect.MIND, new ItemStack(Items.paper, 64), 15);
|
||||
addAspectLoot(Aspect.MIND, new ItemStack(Items.book, 32), 10);
|
||||
addAspectLoot(Aspect.MIND, new ItemStack(Blocks.bookshelf, 16), 5);
|
||||
addAspectLoot(Aspect.MIND, new ItemStack(ConfigItems.itemResource, 4, 9), 5); // knowledge fragment
|
||||
|
||||
addAspectLoot(Aspect.FLESH, new ItemStack(ConfigItems.itemResource, 16, 5), 4);
|
||||
addAspectLoot(Aspect.FLESH, new ItemStack(ConfigItems.itemResource, 16, 5), 1);
|
||||
|
||||
addAspectLoot(Aspect.UNDEAD, new ItemStack(Items.rotten_flesh, 32));
|
||||
addAspectLoot(Aspect.UNDEAD, new ItemStack(Items.bone, 24));
|
||||
|
||||
addAspectLoot(
|
||||
Aspect.CRAFT,
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class), 32));
|
||||
addAspectLoot(Aspect.CRAFT, new ItemStack(ConfigBlocks.blockStoneDevice, 16, 0)); // alchemical furnace
|
||||
addAspectLoot(Aspect.CRAFT, new ItemStack(Blocks.crafting_table, 4));
|
||||
addAspectLoot(Aspect.CRAFT, new ItemStack(ConfigBlocks.blockStoneDevice, 16));
|
||||
|
||||
addAspectLoot(Aspect.HUNGER, new ItemStack(Items.nether_wart, 16));
|
||||
|
||||
addAspectLoot(Aspect.COLD, new ItemStack(Blocks.ice, 2));
|
||||
addAspectLoot(Aspect.COLD, new ItemStack(Items.snowball, 64));
|
||||
addAspectLoot(Aspect.COLD, new ItemStack(Blocks.snow, 32));
|
||||
addAspectLoot(Aspect.COLD, new ItemStack(Blocks.snow_layer, 8));
|
||||
addAspectLoot(Aspect.COLD, "rodBlizz", 1);
|
||||
addAspectLoot(Aspect.COLD, new ItemStack(Items.snowball, 16));
|
||||
addAspectLoot(Aspect.COLD, "rodBlizz");
|
||||
|
||||
addAspectLoot(Aspect.PLANT, "grass");
|
||||
addAspectLoot(Aspect.PLANT, "sapling");
|
||||
for (int i = 0; i < 6; i++) {
|
||||
addAspectLoot(Aspect.PLANT, new ItemStack(Blocks.sapling, 1, i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
addAspectLoot(Aspect.MAN, new ItemStack(ConfigItems.itemGolemCore, 1, i));
|
||||
@@ -192,27 +170,26 @@ public class AspectCropLootManager {
|
||||
addAspectLoot(Aspect.WEAPON, new ItemStack(ConfigItems.itemSwordThaumium));
|
||||
addAspectLoot(Aspect.TOOL, new ItemStack(ConfigItems.itemShovelThaumium));
|
||||
addAspectLoot(Aspect.TOOL, new ItemStack(ConfigItems.itemAxeThaumium));
|
||||
addAspectLoot(Aspect.TRAVEL, new ItemStack(ConfigBlocks.blockCosmeticSolid, 8, 7));
|
||||
|
||||
addAspectLoot(Aspect.SLIME, "slime", 4);
|
||||
addAspectLoot(Aspect.SLIME, new ItemStack(Items.slime_ball, 16));
|
||||
addAspectLoot(Aspect.SLIME, "slime");
|
||||
|
||||
addAspectLoot(Aspect.GREED, new ItemStack(Items.gold_ingot, 4));
|
||||
addAspectLoot(Aspect.GREED, new ItemStack(Items.emerald, 2));
|
||||
|
||||
addAspectLoot(Aspect.LIGHT, new ItemStack(Items.glowstone_dust, 16), 5);
|
||||
addAspectLoot(Aspect.LIGHT, new ItemStack(ConfigItems.itemResource, 4, 1)); // nitor
|
||||
addAspectLoot(Aspect.LIGHT, new ItemStack(ConfigItems.itemResource, 4, 1));
|
||||
addAspectLoot(
|
||||
Aspect.LIGHT,
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemBrightNitor.class)));
|
||||
|
||||
addAspectLoot(Aspect.MECHANISM, new ItemStack(Blocks.piston, 8));
|
||||
addAspectLoot(Aspect.MECHANISM, new ItemStack(Blocks.hopper, 4));
|
||||
addAspectLoot(Aspect.MECHANISM, new ItemStack(Blocks.dropper, 8));
|
||||
addAspectLoot(Aspect.MECHANISM, new ItemStack(Blocks.dispenser, 8));
|
||||
// addAspectLoot(Aspect.MECHANISM, "gear");
|
||||
|
||||
addAspectLoot(Aspect.CROP, new ItemStack(Items.wheat, 32));
|
||||
addAspectLoot(Aspect.CROP, "seed");
|
||||
|
||||
addAspectLoot(Aspect.METAL, new ItemStack(Items.iron_ingot, 4), 100);
|
||||
// addAspectLoot(Aspect.METAL, "iron");
|
||||
|
||||
addAspectLoot(Aspect.DEATH, new ItemStack(Items.bone, 32));
|
||||
|
||||
@@ -229,52 +206,36 @@ public class AspectCropLootManager {
|
||||
addAspectLoot(Aspect.EXCHANGE, "ingotCopper", 4);
|
||||
addAspectLoot(Aspect.EXCHANGE, new ItemStack(ConfigBlocks.blockCustomOre, 4));
|
||||
|
||||
addAspectLoot(Aspect.ENERGY, new ItemStack(ConfigItems.itemResource, 12)); // alumentum
|
||||
addAspectLoot(Aspect.ENERGY, new ItemStack(ConfigItems.itemResource, 12));
|
||||
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 0));
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 1));
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 2));
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 3));
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 4));
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 5));
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 6));
|
||||
addAspectLoot(Aspect.MAGIC, "materialAspectShard");
|
||||
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Items.golden_apple));
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Items.cake));
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Items.potionitem, 1, 8261));
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
addAspectLoot(Aspect.SENSES, new ItemStack(Items.dye, 1, i));
|
||||
addAspectLoot(Aspect.SENSES, new ItemStack(Blocks.stained_glass, 1, i));
|
||||
addAspectLoot(Aspect.SENSES, new ItemStack(Blocks.stained_glass_pane, 2, i));
|
||||
}
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Blocks.cake));
|
||||
|
||||
addAspectLoot(Aspect.SOUL, new ItemStack(Blocks.soul_sand, 16), 2);
|
||||
addAspectLoot(Aspect.SENSES, new ItemStack(Items.dye, 20, 4));
|
||||
|
||||
addAspectLoot(Aspect.WEATHER, "cloud", 64);
|
||||
addAspectLoot(Aspect.SOUL, new ItemStack(Blocks.soul_sand, 64), 2);
|
||||
addAspectLoot(Aspect.SOUL, new ItemStack(Blocks.netherrack, 64), 2);
|
||||
addAspectLoot(Aspect.SOUL, new ItemStack(Blocks.nether_brick));
|
||||
|
||||
addAspectLoot(Aspect.WEATHER, new ItemStack(Blocks.air));
|
||||
addAspectLoot(Aspect.WEATHER, "cloud", 100);
|
||||
|
||||
addAspectLoot(Aspect.DARKNESS, new ItemStack(Blocks.obsidian, 10));
|
||||
|
||||
addAspectLoot(Aspect.VOID, new ItemStack(Items.bucket));
|
||||
addAspectLoot(Aspect.VOID, "bucket");
|
||||
addAspectLoot(Aspect.VOID, "bowl", 4);
|
||||
addAspectLoot(Aspect.VOID, "ingotVoid", 2);
|
||||
|
||||
addAspectLoot(Aspect.POISON, new ItemStack(ConfigItems.itemResource, 16, 3)); // quicksilver
|
||||
addAspectLoot(Aspect.POISON, new ItemStack(Items.spider_eye, 8));
|
||||
addAspectLoot(Aspect.POISON, new ItemStack(ConfigItems.itemResource, 16, 3));
|
||||
|
||||
addAspectLoot(Aspect.LIFE, new ItemStack(Items.egg, 8));
|
||||
|
||||
addAspectLoot(Aspect.TRAP, new ItemStack(Blocks.web, 4));
|
||||
addAspectLoot(Aspect.TRAP, "trapdoorWood");
|
||||
addAspectLoot(Aspect.TRAP, new ItemStack(ConfigItems.itemResource, 16, 6)); // amber
|
||||
|
||||
addAspectLoot(Aspect.TRAVEL, new ItemStack(ConfigBlocks.blockCosmeticSolid, 4, 2)); // paved stone of travel
|
||||
|
||||
addAspectLoot(Aspect.TAINT, new ItemStack(ConfigItems.itemResource, 4, 11));
|
||||
|
||||
addAspectLoot(Aspect.CRYSTAL, new ItemStack(Items.diamond, 1));
|
||||
addAspectLoot(Aspect.CRYSTAL, new ItemStack(Items.quartz, 8));
|
||||
addAspectLoot(Aspect.CRYSTAL, new ItemStack(Blocks.glass, 32), 4);
|
||||
addAspectLoot(Aspect.CRYSTAL, new ItemStack(Items.diamond));
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package thaumic.tinkerer.common.core.helper;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
@@ -11,8 +8,6 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumic.tinkerer.common.block.BlockInfusedGrain;
|
||||
import thaumic.tinkerer.common.compat.EMTCompat;
|
||||
import thaumic.tinkerer.common.compat.LoadedMods;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
|
||||
/**
|
||||
@@ -31,45 +26,26 @@ public class BonemealEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isMagicHoe(ItemStack stack) {
|
||||
if (stack == null) return false;
|
||||
Item item = stack.getItem();
|
||||
return item == ConfigItems.itemHoeElemental || EMTCompat.validElectricHoe(stack);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
World world = event.world;
|
||||
if (world.isRemote) return;
|
||||
if (!(world.getBlock(event.x, event.y, event.z) instanceof BlockInfusedGrain infusedGrain)) return;
|
||||
if (!event.world.isRemote) {
|
||||
if (event.world.getBlock(event.x, event.y, event.z) instanceof BlockInfusedGrain) {
|
||||
if (event.entityPlayer != null && event.entityPlayer.getCurrentEquippedItem() != null) {
|
||||
if (event.entityPlayer.getCurrentEquippedItem().getItem() == ConfigItems.itemHoeElemental) {
|
||||
IGrowable igrowable = (IGrowable) event.world.getBlock(event.x, event.y, event.z);
|
||||
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
if (player == null) return;
|
||||
|
||||
ItemStack hoeOfGrowth = player.getCurrentEquippedItem();
|
||||
if (!isMagicHoe(hoeOfGrowth)) return;
|
||||
|
||||
if (!infusedGrain.func_149851_a(world, event.x, event.y, event.z, false)
|
||||
|| !infusedGrain.func_149852_a(world, world.rand, event.x, event.y, event.z)) {
|
||||
return;
|
||||
}
|
||||
infusedGrain.func_149853_b(world, world.rand, event.x, event.y, event.z);
|
||||
damageHoe(hoeOfGrowth, player);
|
||||
Thaumcraft.proxy.blockSparkle(world, event.x, event.y, event.z, 0, 2);
|
||||
world.playSoundEffect(
|
||||
event.x + 0.5D,
|
||||
event.y + 0.5D,
|
||||
event.z + 0.5D,
|
||||
"thaumcraft:wand",
|
||||
0.75F,
|
||||
0.9F + world.rand.nextFloat() * 0.2F);
|
||||
}
|
||||
|
||||
private static void damageHoe(ItemStack hoeOfGrowth, EntityPlayer player) {
|
||||
if (LoadedMods.EMTLoaded && hoeOfGrowth.getItem() == EMTCompat.electricHoe) {
|
||||
EMTCompat.useEnergy(hoeOfGrowth, player);
|
||||
} else {
|
||||
hoeOfGrowth.damageItem(25, player);
|
||||
if (igrowable.func_149851_a(event.world, event.x, event.y, event.z, event.world.isRemote)) {
|
||||
if (!event.world.isRemote) {
|
||||
if (igrowable.func_149852_a(event.world, event.world.rand, event.x, event.y, event.z)) {
|
||||
igrowable.func_149853_b(event.world, event.world.rand, event.x, event.y, event.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
event.entityPlayer.getCurrentEquippedItem().damageItem(25, event.entityPlayer);
|
||||
Thaumcraft.proxy.blockSparkle(event.world, event.x, event.y, event.z, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,9 @@
|
||||
package thaumic.tinkerer.common.core.helper;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.monster.EntityBlaze;
|
||||
import net.minecraft.entity.monster.EntityCaveSpider;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
@@ -37,150 +30,139 @@ import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.entity.passive.EntitySquid;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.passive.EntityWolf;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.InfusionRecipe;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.common.entities.monster.EntityBrainyZombie;
|
||||
import thaumcraft.common.entities.monster.EntityFireBat;
|
||||
import thaumcraft.common.entities.monster.EntityWisp;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.BlockSummon;
|
||||
import thaumic.tinkerer.common.item.ItemMobAspect;
|
||||
import thaumic.tinkerer.common.item.ItemMobDisplay;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
|
||||
public enum EnumMobAspect {
|
||||
|
||||
// Passive
|
||||
Chicken(EntityChicken.class, new Aspect[] { Aspect.CROP, Aspect.FLIGHT, Aspect.BEAST }, 1.0f),
|
||||
Pig(EntityPig.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.TRAVEL }),
|
||||
/// Must be before Cow because EntityMooshroom extends EntityCow
|
||||
MushroomCow(EntityMooshroom.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.CROP }, 0.9f),
|
||||
Cow(EntityCow.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.BEAST }, 0.9f),
|
||||
Sheep(EntitySheep.class, new Aspect[] { Aspect.EARTH, Aspect.CLOTH, Aspect.BEAST }, 0.9f),
|
||||
SnowMan(EntitySnowman.class, new Aspect[] { Aspect.WATER, Aspect.WATER, Aspect.MAN }),
|
||||
Bat(EntityBat.class, new Aspect[] { Aspect.AIR, Aspect.AIR, Aspect.FLIGHT }, 1.9f, -0.3f),
|
||||
Blaze(EntityBlaze.class, new Aspect[] { Aspect.FIRE, Aspect.FIRE, Aspect.FIRE }),
|
||||
BrainyZombie(EntityBrainyZombie.class, new Aspect[] { Aspect.MAGIC, Aspect.UNDEAD, Aspect.FLESH }, "Thaumcraft."),
|
||||
Firebat(EntityFireBat.class, new Aspect[] { Aspect.FLIGHT, Aspect.FIRE, Aspect.MAGIC }, 1.9f, -0.3f),
|
||||
CaveSpider(EntityCaveSpider.class, new Aspect[] { Aspect.BEAST, Aspect.POISON, Aspect.POISON }),
|
||||
Chicken(EntityChicken.class, new Aspect[] { Aspect.CROP, Aspect.FLIGHT, Aspect.BEAST }),
|
||||
Cow(EntityCow.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.BEAST }),
|
||||
Creeper(EntityCreeper.class, new Aspect[] { Aspect.MAGIC, Aspect.BEAST, Aspect.ELDRITCH }),
|
||||
Enderman(EntityEnderman.class, new Aspect[] { Aspect.ELDRITCH, Aspect.ELDRITCH, Aspect.MAN }, 0.3f, 0.0f),
|
||||
Ghast(EntityGhast.class, new Aspect[] { Aspect.FIRE, Aspect.FLIGHT, Aspect.FLIGHT }, 0.1f, 0.2f),
|
||||
EntityHorse(EntityHorse.class, new Aspect[] { Aspect.BEAST, Aspect.BEAST, Aspect.TRAVEL }),
|
||||
VillagerGolem(EntityIronGolem.class, new Aspect[] { Aspect.METAL, Aspect.METAL, Aspect.MAN }, 0.3f, 0.0f),
|
||||
LavaSlime(EntityMagmaCube.class, new Aspect[] { Aspect.FIRE, Aspect.SLIME, Aspect.SLIME }, 0.6f, 0.0f) {
|
||||
|
||||
@Override
|
||||
protected Entity createEntity(World worldObj) {
|
||||
return setSlimeSize(super.createEntity(worldObj), 1);
|
||||
}
|
||||
},
|
||||
MushroomCow(EntityMooshroom.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.CROP }),
|
||||
Ozelot(EntityOcelot.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.ELDRITCH }),
|
||||
Pig(EntityPig.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.TRAVEL }),
|
||||
PigZombie(EntityPigZombie.class, new Aspect[] { Aspect.UNDEAD, Aspect.FLESH, Aspect.FIRE }),
|
||||
Sheep(EntitySheep.class, new Aspect[] { Aspect.EARTH, Aspect.CLOTH, Aspect.BEAST }),
|
||||
Silverfish(EntitySilverfish.class, new Aspect[] { Aspect.METAL, Aspect.METAL, Aspect.EARTH }),
|
||||
Skeleton(EntitySkeleton.class, new Aspect[] { Aspect.UNDEAD, Aspect.MAN, Aspect.UNDEAD }),
|
||||
Slime(EntitySlime.class, new Aspect[] { Aspect.SLIME, Aspect.SLIME, Aspect.BEAST }, 0.6f, 0.0f) {
|
||||
|
||||
@Override
|
||||
protected Entity createEntity(World worldObj) {
|
||||
return setSlimeSize(super.createEntity(worldObj), 1);
|
||||
}
|
||||
},
|
||||
Spider(EntitySpider.class, new Aspect[] { Aspect.BEAST, Aspect.UNDEAD, Aspect.UNDEAD }),
|
||||
Squid(EntitySquid.class, new Aspect[] { Aspect.WATER, Aspect.WATER, Aspect.WATER }, 0.3f, 0.5f),
|
||||
Villager(EntityVillager.class, new Aspect[] { Aspect.MAN, Aspect.MAN, Aspect.MAN }),
|
||||
Wisp(EntityWisp.class, new Aspect[] { Aspect.AIR, Aspect.MAGIC, Aspect.MAGIC }, "Thaumcraft."),
|
||||
Witch(EntityWitch.class, new Aspect[] { Aspect.MAGIC, Aspect.UNDEAD, Aspect.ELDRITCH }, 0.35f, 0.0f),
|
||||
Wolf(EntityWolf.class, new Aspect[] { Aspect.BEAST, Aspect.BEAST, Aspect.BEAST }),
|
||||
EntityHorse(EntityHorse.class, new Aspect[] { Aspect.BEAST, Aspect.BEAST, Aspect.TRAVEL }, 0.8f),
|
||||
SnowMan(EntitySnowman.class, new Aspect[] { Aspect.WATER, Aspect.WATER, Aspect.MAN }, 0.8f),
|
||||
VillagerGolem(EntityIronGolem.class, new Aspect[] { Aspect.METAL, Aspect.METAL, Aspect.MAN }, 0.6f),
|
||||
Villager(EntityVillager.class, new Aspect[] { Aspect.MAN, Aspect.MAN, Aspect.MAN }, 0.8f),
|
||||
Squid(EntitySquid.class, new Aspect[] { Aspect.WATER, Aspect.WATER, Aspect.WATER }, 0.6f, 0.75f),
|
||||
Bat(EntityBat.class, new Aspect[] { Aspect.AIR, Aspect.AIR, Aspect.FLIGHT }, 1.9f),
|
||||
// Hostiles
|
||||
Blaze(EntityBlaze.class, new Aspect[] { Aspect.FIRE, Aspect.FIRE, Aspect.FIRE }, 0.8f),
|
||||
PigZombie(EntityPigZombie.class, new Aspect[] { Aspect.UNDEAD, Aspect.FLESH, Aspect.FIRE }, 0.8f),
|
||||
/// Must be before Slime because EntityMagmaCube extends EntitySlime
|
||||
LavaSlime(EntityMagmaCube.class, new Aspect[] { Aspect.FIRE, Aspect.SLIME, Aspect.SLIME }, 1.5f) {
|
||||
Zombie(EntityZombie.class, new Aspect[] { Aspect.FLESH, Aspect.FLESH, Aspect.UNDEAD });
|
||||
|
||||
@Override
|
||||
public EntityLiving createEntity(World worldObj) {
|
||||
return setSlimeSize(super.createEntity(worldObj), 1);
|
||||
}
|
||||
},
|
||||
Ghast(EntityGhast.class, new Aspect[] { Aspect.FIRE, Aspect.FLIGHT, Aspect.FLIGHT }, 0.2f, 0.6f),
|
||||
Firebat(EntityFireBat.class, new Aspect[] { Aspect.FLIGHT, Aspect.FIRE, Aspect.MAGIC }, 1.9f, 0f),
|
||||
/// Must be before Zombie because EntityBrainyZombie extends EntityZombie
|
||||
BrainyZombie(EntityBrainyZombie.class, new Aspect[] { Aspect.MAGIC, Aspect.UNDEAD, Aspect.FLESH }, 0.8f, 0),
|
||||
Zombie(EntityZombie.class, new Aspect[] { Aspect.FLESH, Aspect.FLESH, Aspect.UNDEAD }, 0.8f),
|
||||
Skeleton(EntitySkeleton.class, new Aspect[] { Aspect.UNDEAD, Aspect.MAN, Aspect.UNDEAD }, 0.8f) {
|
||||
public static Map<EnumMobAspect, Entity> entityCache = Maps.newHashMap();
|
||||
public Aspect[] aspects;
|
||||
public Class entity;
|
||||
public String prefix;
|
||||
private float scale;
|
||||
private float offset;
|
||||
|
||||
@Override
|
||||
public boolean matches(EntityLiving e) {
|
||||
if (e instanceof EntitySkeleton skeleton) {
|
||||
return skeleton.getSkeletonType() == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
WitherSkeleton(EntitySkeleton.class, new Aspect[] { Aspect.UNDEAD, Aspect.POISON, Aspect.FIRE }, 0.8f) {
|
||||
|
||||
@Override
|
||||
public EntityLiving createEntity(World worldObj) {
|
||||
return setWither(super.createEntity(worldObj));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(EntityLiving e) {
|
||||
if (e instanceof EntitySkeleton skeleton) {
|
||||
return skeleton.getSkeletonType() == 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
Creeper(EntityCreeper.class, new Aspect[] { Aspect.MAGIC, Aspect.BEAST, Aspect.ELDRITCH }, 0.8f),
|
||||
Witch(EntityWitch.class, new Aspect[] { Aspect.MAGIC, Aspect.UNDEAD, Aspect.ELDRITCH }, 0.8f),
|
||||
/// Must be before Spider because EntityCaveSpider extends EntitySpider
|
||||
CaveSpider(EntityCaveSpider.class, new Aspect[] { Aspect.BEAST, Aspect.POISON, Aspect.POISON }, 0.8f),
|
||||
Spider(EntitySpider.class, new Aspect[] { Aspect.BEAST, Aspect.UNDEAD, Aspect.UNDEAD }, 0.8f),
|
||||
Slime(EntitySlime.class, new Aspect[] { Aspect.SLIME, Aspect.SLIME, Aspect.BEAST }, 1.5f) {
|
||||
|
||||
@Override
|
||||
public EntityLiving createEntity(World worldObj) {
|
||||
return setSlimeSize(super.createEntity(worldObj), 1);
|
||||
}
|
||||
},
|
||||
Silverfish(EntitySilverfish.class, new Aspect[] { Aspect.METAL, Aspect.METAL, Aspect.EARTH }, 1.2f),
|
||||
Enderman(EntityEnderman.class, new Aspect[] { Aspect.ELDRITCH, Aspect.ELDRITCH, Aspect.MAN }, 0.7f),
|
||||
Wisp(EntityWisp.class, new Aspect[] { Aspect.AIR, Aspect.MAGIC, Aspect.MAGIC });
|
||||
|
||||
private static final Map<String, EnumMobAspect> LOOKUP = Arrays.stream(values())
|
||||
.collect(Collectors.toMap(Enum::name, Function.identity()));
|
||||
public final Aspect[] aspects;
|
||||
public final Class<? extends EntityLiving> entity;
|
||||
private final float scale;
|
||||
private final float offset;
|
||||
private final MethodHandle ctor;
|
||||
private String langKey;
|
||||
|
||||
EnumMobAspect(Class<? extends EntityLiving> entity, Aspect[] aspects, float scale) {
|
||||
this(entity, aspects, scale, 0);
|
||||
}
|
||||
|
||||
EnumMobAspect(Class<? extends EntityLiving> entity, Aspect[] aspects, float scale, float offset) {
|
||||
EnumMobAspect(Class entity, Aspect[] aspects, float scale, float offset) {
|
||||
this.aspects = aspects;
|
||||
this.entity = entity;
|
||||
this.scale = scale;
|
||||
this.offset = offset;
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
try {
|
||||
this.ctor = lookup.findConstructor(entity, MethodType.methodType(void.class, World.class));
|
||||
} catch (NoSuchMethodException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
EnumMobAspect(Class entity, Aspect[] aspects, float scale, float offset, String prefix) {
|
||||
this(entity, aspects, scale, offset);
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
EnumMobAspect(Class entity, Aspect[] aspects) {
|
||||
this.aspects = aspects;
|
||||
this.entity = entity;
|
||||
this.scale = 1.1f;
|
||||
this.offset = 0.0f;
|
||||
}
|
||||
|
||||
EnumMobAspect(Class entity, Aspect[] aspects, String prefix) {
|
||||
this(entity, aspects);
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public static Entity getEntityFromCache(EnumMobAspect ent, World worldObj) {
|
||||
Entity entity = entityCache.get(ent);
|
||||
if (entity == null) {
|
||||
entity = ent.createEntity(worldObj);
|
||||
entityCache.put(ent, entity);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
EnumMobAspect(Class<? extends EntityLiving> entity, Aspect[] aspects) {
|
||||
this(entity, aspects, 1.0f);
|
||||
}
|
||||
private static Entity setSlimeSize(Entity entity, int size) {
|
||||
|
||||
public static EnumMobAspect get(String name) {
|
||||
return LOOKUP.get(name);
|
||||
}
|
||||
|
||||
private static EntityLiving setSlimeSize(EntityLiving entity, int size) {
|
||||
if (entity instanceof EntitySlime slime) {
|
||||
slime.setSlimeSize(size);
|
||||
if (entity instanceof EntitySlime) {
|
||||
((EntitySlime) entity).setSlimeSize(1);
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
private static EntityLiving setWither(EntityLiving entity) {
|
||||
if (entity instanceof EntitySkeleton skeleton) {
|
||||
skeleton.setSkeletonType(1);
|
||||
skeleton.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D);
|
||||
}
|
||||
|
||||
return entity;
|
||||
public static Aspect[] getAspectsForEntity(Entity e) {
|
||||
return getAspectsForEntity(e.getClass());
|
||||
}
|
||||
|
||||
public static Aspect[] getAspectsForEntity(EntityLiving e) {
|
||||
for (EnumMobAspect aspect : EnumMobAspect.values()) {
|
||||
if (aspect.matches(e)) {
|
||||
return aspect.aspects;
|
||||
public static EnumMobAspect getMobAspectForType(String name) {
|
||||
if (name.isEmpty()) return null;
|
||||
Class clazz = (Class) EntityList.stringToClassMapping.get(name);
|
||||
for (EnumMobAspect e : EnumMobAspect.values()) {
|
||||
if (e.entity.isAssignableFrom(clazz)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean matches(EntityLiving e) {
|
||||
return this.entity.isInstance(e);
|
||||
public static Aspect[] getAspectsForEntity(Class clazz) {
|
||||
for (EnumMobAspect e : EnumMobAspect.values()) {
|
||||
if (e.entity.isAssignableFrom(clazz)) {
|
||||
return e.aspects;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public float getVerticalOffset() {
|
||||
@@ -191,19 +173,38 @@ public enum EnumMobAspect {
|
||||
return scale;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
if (langKey == null) {
|
||||
String name = EntityList.classToStringMapping.get(entity);
|
||||
langKey = "entity." + (name == null ? "generic" : name) + ".name";
|
||||
}
|
||||
return StatCollector.translateToLocal(langKey);
|
||||
public Class getEntityClass() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EntityLiving createEntity(World worldObj) {
|
||||
try {
|
||||
return (EntityLiving) ctor.invoke(worldObj);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
public Entity getEntity(World worldObj) {
|
||||
return getEntityFromCache(this, worldObj);
|
||||
}
|
||||
|
||||
protected Entity createEntity(World worldObj) {
|
||||
return EntityList.createEntityByName(toString(), worldObj);
|
||||
}
|
||||
|
||||
public ResearchPage GetRecepiePage() {
|
||||
ItemStack output = new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemMobAspect.class));
|
||||
((ItemMobDisplay) output.getItem()).setEntityType(output, toString());
|
||||
ItemStack[] inputs = new ItemStack[this.aspects.length];
|
||||
int i = 0;
|
||||
for (Aspect a : this.aspects) {
|
||||
inputs[i++] = ItemMobAspect.getStackFromAspect(a);
|
||||
}
|
||||
InfusionRecipe recepie = new InfusionRecipe(
|
||||
LibResearch.KEY_SUMMON,
|
||||
output,
|
||||
0,
|
||||
new AspectList(),
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockSummon.class)),
|
||||
inputs);
|
||||
return new ResearchPage(recepie);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return prefix == null ? super.toString() : prefix + super.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package thaumic.tinkerer.common.core.helper;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import it.unimi.dsi.fastutil.Hash;
|
||||
|
||||
/*
|
||||
* Simple hashing strategy that can properly compare items
|
||||
*/
|
||||
public class ItemHashStrategy implements Hash.Strategy<ItemStack> {
|
||||
|
||||
@Override
|
||||
public int hashCode(@Nullable ItemStack key) {
|
||||
return key == null ? 0 : Objects.hash(key.getItem(), key.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable ItemStack key, @Nullable ItemStack value) {
|
||||
if (key == null || value == null) return false;
|
||||
return key.isItemEqual(value);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,36 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as part of the ThaumicTinkerer Mod.
|
||||
* <p>
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0
|
||||
* License (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
* <p>
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 4. Thaumcraft 4 (c) Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
* <p>
|
||||
*
|
||||
* File Created @ [4 Sep 2013, 16:29:41 (GMT)]
|
||||
*/
|
||||
package thaumic.tinkerer.common.core.proxy;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.command.ICommandManager;
|
||||
import net.minecraft.command.ServerCommandManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
|
||||
import codechicken.nei.event.NEIRegisterHandlerInfosEvent;
|
||||
import codechicken.nei.recipe.HandlerInfo;
|
||||
import codechicken.nei.recipe.RecipeCatalysts;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import li.cil.oc.api.Driver;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.IEssentiaTransport;
|
||||
import thaumcraft.api.wands.WandCap;
|
||||
import thaumcraft.api.wands.WandRod;
|
||||
@@ -57,20 +47,12 @@ import thaumcraft.common.tiles.TileNode;
|
||||
import thaumcraft.common.tiles.TileSensor;
|
||||
import thaumcraft.common.tiles.TileTubeFilter;
|
||||
import thaumcraft.common.tiles.TileWandPedestal;
|
||||
import thaumic.tinkerer.client.nei.NEIInfusedSeedRecipeHandler;
|
||||
import thaumic.tinkerer.client.nei.NEINecromancyHandler;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.BlockSummon;
|
||||
import thaumic.tinkerer.common.block.tile.TileFunnel;
|
||||
import thaumic.tinkerer.common.block.tile.TileRepairer;
|
||||
import thaumic.tinkerer.common.block.tile.transvector.TileTransvectorInterface;
|
||||
import thaumic.tinkerer.common.compat.EMTCompat;
|
||||
import thaumic.tinkerer.common.compat.EnderIO;
|
||||
import thaumic.tinkerer.common.compat.FumeTool;
|
||||
import thaumic.tinkerer.common.compat.LoadedMods;
|
||||
import thaumic.tinkerer.common.core.commands.KamiUnlockedCommand;
|
||||
import thaumic.tinkerer.common.core.commands.MaxResearchCommand;
|
||||
import thaumic.tinkerer.common.core.commands.SetTendencyCommand;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
|
||||
import thaumic.tinkerer.common.core.handler.kami.DimensionalShardDropHandler;
|
||||
@@ -82,8 +64,6 @@ import thaumic.tinkerer.common.core.helper.BonemealEventHandler;
|
||||
import thaumic.tinkerer.common.core.helper.NumericAspectHelper;
|
||||
import thaumic.tinkerer.common.enchantment.ModEnchantments;
|
||||
import thaumic.tinkerer.common.enchantment.core.EnchantmentManager;
|
||||
import thaumic.tinkerer.common.item.ItemBloodSword;
|
||||
import thaumic.tinkerer.common.item.ItemInfusedSeeds;
|
||||
import thaumic.tinkerer.common.item.SpellClothCraftingHandler;
|
||||
import thaumic.tinkerer.common.item.foci.ItemFocusDeflect;
|
||||
import thaumic.tinkerer.common.item.kami.wand.CapIchor;
|
||||
@@ -108,7 +88,6 @@ import thaumic.tinkerer.common.peripheral.OpenComputers.DriverEssentiaTransport;
|
||||
import thaumic.tinkerer.common.peripheral.OpenComputers.DriverIAspectContainer;
|
||||
import thaumic.tinkerer.common.peripheral.PeripheralHandler;
|
||||
import thaumic.tinkerer.common.potion.ModPotions;
|
||||
import thaumic.tinkerer.common.potion.PotionEffectHandlerServer;
|
||||
import thaumic.tinkerer.common.research.ResearchHelper;
|
||||
|
||||
public class TTCommonProxy {
|
||||
@@ -117,7 +96,6 @@ public class TTCommonProxy {
|
||||
public WandCap capIchor;
|
||||
public WandRod rodIchor;
|
||||
public Item.ToolMaterial toolMaterialIchor;
|
||||
private PotionEffectHandlerServer potionHandlerServer;
|
||||
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
toolMaterialIchor = EnumHelper.addToolMaterial("ICHOR", 4, -1, 10F, 5F, 25);
|
||||
@@ -132,9 +110,10 @@ public class TTCommonProxy {
|
||||
|
||||
ModCreativeTab.INSTANCE.addWand();
|
||||
|
||||
if (LoadedMods.computerCraftLoaded) {
|
||||
if (Loader.isModLoaded("ComputerCraft")) {
|
||||
initCCPeripherals();
|
||||
}
|
||||
registerVersionChecker();
|
||||
|
||||
kamiRarity = EnumHelper.addEnum(
|
||||
new Class[][] { { EnumRarity.class, EnumChatFormatting.class, String.class } },
|
||||
@@ -161,14 +140,14 @@ public class TTCommonProxy {
|
||||
MinecraftForge.EVENT_BUS.register(new SoulHeartHandler());
|
||||
}
|
||||
|
||||
if (LoadedMods.openComputersLoaded) {
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
initOpenCDrivers();
|
||||
}
|
||||
if (LoadedMods.enderIOLoaded) {
|
||||
if (Loader.isModLoaded("EnderIO")) {
|
||||
InitEnderIO();
|
||||
}
|
||||
|
||||
if (LoadedMods.forgeMultipartLoaded) {
|
||||
if (Loader.isModLoaded("ForgeMultipart")) {
|
||||
ThaumicTinkerer.log.trace("Attempting to load Multiparts");
|
||||
try {
|
||||
Class<?> clazz = Class.forName("thaumic.tinkerer.common.multipart.MultipartHandler");
|
||||
@@ -179,12 +158,43 @@ public class TTCommonProxy {
|
||||
} else {
|
||||
ThaumicTinkerer.log.info("Skipping TC Multipart integration");
|
||||
}
|
||||
}
|
||||
|
||||
if (LoadedMods.NEILoaded && LoadedMods.aspectRecipeIndexLoaded) {
|
||||
MinecraftForge.EVENT_BUS.register(new NEIEventHandler());
|
||||
}
|
||||
protected void registerPackets() {
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketSoulHearts.class, PacketSoulHearts.class, 142 + 0, Side.CLIENT);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketToggleArmor.class, PacketToggleArmor.class, 142 + 1, Side.CLIENT);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketToggleArmor.class, PacketToggleArmor.class, 142 + 2, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketWarpGateButton.class, PacketWarpGateButton.class, 142 + 3, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketWarpGateTeleport.class, PacketWarpGateTeleport.class, 142 + 4, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(
|
||||
PacketEnchanterAddEnchant.class,
|
||||
PacketEnchanterAddEnchant.class,
|
||||
142 + 5,
|
||||
Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(
|
||||
PacketEnchanterStartWorking.class,
|
||||
PacketEnchanterStartWorking.class,
|
||||
142 + 6,
|
||||
Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketMobMagnetButton.class, PacketMobMagnetButton.class, 142 + 7, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketTabletButton.class, PacketTabletButton.class, 142 + 8, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketPlacerButton.class, PacketPlacerButton.class, 142 + 9, Side.SERVER);
|
||||
}
|
||||
|
||||
EMTCompat.init();
|
||||
public void registerVersionChecker() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setString("curseProjectName", "75598-thaumic-tinkerer");
|
||||
compound.setString("curseFilenameParser", "ThaumicTinkerer-[].jar");
|
||||
compound.setString("modDisplayName", "Thaumic Tinkerer");
|
||||
FMLInterModComms.sendRuntimeMessage(LibMisc.MOD_ID, "VersionChecker", "addCurseCheck", compound);
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
@@ -194,41 +204,6 @@ public class TTCommonProxy {
|
||||
ItemFocusDeflect.setupBlackList();
|
||||
}
|
||||
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
ICommandManager command = server.getCommandManager();
|
||||
ServerCommandManager manager = (ServerCommandManager) command;
|
||||
manager.registerCommand(new SetTendencyCommand());
|
||||
manager.registerCommand(new MaxResearchCommand());
|
||||
manager.registerCommand(new KamiUnlockedCommand());
|
||||
this.potionHandlerServer = new PotionEffectHandlerServer();
|
||||
MinecraftForge.EVENT_BUS.register(potionHandlerServer);
|
||||
FMLCommonHandler.instance().bus().register(potionHandlerServer);
|
||||
}
|
||||
|
||||
public void serverStopped(FMLServerStoppedEvent event) {
|
||||
if (this.potionHandlerServer != null) {
|
||||
MinecraftForge.EVENT_BUS.unregister(potionHandlerServer);
|
||||
FMLCommonHandler.instance().bus().unregister(potionHandlerServer);
|
||||
this.potionHandlerServer = null;
|
||||
}
|
||||
}
|
||||
|
||||
// spotless:off
|
||||
protected void registerPackets() {
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketSoulHearts.class, PacketSoulHearts.class, 142 + 0, Side.CLIENT);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketToggleArmor.class, PacketToggleArmor.class, 142 + 1, Side.CLIENT);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketToggleArmor.class, PacketToggleArmor.class, 142 + 2, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketWarpGateButton.class, PacketWarpGateButton.class, 142 + 3, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketWarpGateTeleport.class, PacketWarpGateTeleport.class, 142 + 4, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketEnchanterAddEnchant.class, PacketEnchanterAddEnchant.class, 142 + 5, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketEnchanterStartWorking.class, PacketEnchanterStartWorking.class, 142 + 6, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketMobMagnetButton.class, PacketMobMagnetButton.class, 142 + 7, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketTabletButton.class, PacketTabletButton.class, 142 + 8, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketPlacerButton.class, PacketPlacerButton.class, 142 + 9, Side.SERVER);
|
||||
}
|
||||
// spotless:on
|
||||
|
||||
@Optional.Method(modid = "EnderIO")
|
||||
protected void InitEnderIO() {
|
||||
EnderIO.registerPlanters();
|
||||
@@ -277,26 +252,4 @@ public class TTCommonProxy {
|
||||
public void shadowSparkle(World world, float x, float y, float z, int size) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public static class NEIEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerHandler(NEIRegisterHandlerInfosEvent event) {
|
||||
ItemStack necromancyTablet = new ItemStack(
|
||||
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockSummon.class));
|
||||
event.registerHandlerInfo(
|
||||
new HandlerInfo.Builder(NEINecromancyHandler.class, LibMisc.MOD_NAME, LibMisc.MOD_ID).setHeight(88)
|
||||
.setDisplayStack(necromancyTablet).build());
|
||||
RecipeCatalysts.putRecipeCatalysts(
|
||||
NEINecromancyHandler.OVERLAY,
|
||||
Arrays.asList(
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemBloodSword.class)),
|
||||
necromancyTablet));
|
||||
|
||||
event.registerHandlerInfo(
|
||||
new HandlerInfo.Builder(NEIInfusedSeedRecipeHandler.class, LibMisc.MOD_NAME, LibMisc.MOD_ID)
|
||||
.setDisplayStack(ItemInfusedSeeds.getStackFromAspect(Aspect.AIR))
|
||||
.setShowFavoritesButton(false).setShowOverlayButton(false).build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class ModEnchantmentHandler {
|
||||
int finalStrike = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.finalStrike, heldItem);
|
||||
if (finalStrike > 0) {
|
||||
Random rand = new Random();
|
||||
if (finalStrike > rand.nextInt(19)) {
|
||||
if ((finalStrike >= 19 || rand.nextInt(20 - finalStrike) == 0)) {
|
||||
event.ammount *= 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
@@ -30,6 +32,11 @@ public class ItemBlockFire extends ItemBlock implements ITTinkererItem {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return ((ITTinkererBlock) field_150939_a).getBlockName();
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -37,6 +39,11 @@ public class ItemBlockMagnet extends ItemBlock implements ITTinkererItem {
|
||||
return "tile." + (par1ItemStack.getItemDamage() == 0 ? LibBlockNames.MAGNET : LibBlockNames.MOB_MAGNET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibBlockNames.MAGNET;
|
||||
|
||||
Loaded 100 of 450 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user