Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5657d3af74 | ||
|
|
b42613eca8 | ||
|
|
deeb23c22d | ||
|
|
290dc4a815 | ||
|
|
9eb69cdc13 | ||
|
|
7808254465 | ||
|
|
71340a23ef | ||
|
|
2d050bdd08 | ||
|
|
f10595d062 | ||
|
|
7221176efd | ||
|
|
aa7d02cfb0 | ||
|
|
d2ce5b7362 | ||
|
|
09e2b847fc | ||
|
|
faa052f70c | ||
|
|
15298cb677 | ||
|
|
d3054211db | ||
|
|
732f64a1b4 | ||
|
|
2a5e2a150f | ||
|
|
1a4edfbc89 | ||
|
|
525fcc56ad | ||
|
|
a36120fc91 | ||
|
|
238b041f12 | ||
|
|
0b0e99024d | ||
|
|
a1db9a100e | ||
|
|
3c42abd7ac |
No files matched your search
@@ -3,9 +3,9 @@ name: Build and test
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master, main ]
|
branches: [ master, main, release/** ]
|
||||||
push:
|
push:
|
||||||
branches: [ master, main ]
|
branches: [ master, main, release/** ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
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
|
||||||
@@ -25,6 +25,7 @@ whitelist.json
|
|||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
src/main/resources/mixins.*.json
|
src/main/resources/mixins.*.refmap.json
|
||||||
*.bat
|
*.bat
|
||||||
|
*.sh
|
||||||
layout.json
|
layout.json
|
||||||
@@ -1,9 +1,15 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.github.GTNewHorizons:CodeChickenCore:1.4.3:dev")
|
implementation("com.github.GTNewHorizons:CodeChickenCore:1.4.22:dev")
|
||||||
compileOnly("com.github.GTNewHorizons:Angelica:1.0.0-beta53:dev")
|
compileOnly("com.cardinalstar.cubicchunks:CubicChunks1710:v0.1.8-alpha:dev")
|
||||||
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.7.69-GTNH:dev") {
|
compileOnly("com.github.GTNewHorizons:Angelica:2.2.32:dev")
|
||||||
|
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Hodgepodge:2.7.216:dev")
|
||||||
|
compileOnly("com.github.GTNewHorizons:Postea:1.2.7:dev") {transitive = false}
|
||||||
|
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.8.160-GTNH:dev") {
|
||||||
exclude group: 'com.github.GTNewHorizons', module: 'CodeChickenCore'
|
exclude group: 'com.github.GTNewHorizons', module: 'CodeChickenCore'
|
||||||
}
|
}
|
||||||
|
compileOnly("com.github.GTNewHorizons:GTNHLib:0.11.54:dev")
|
||||||
|
// devOnlyNonPublishable("com.github.GTNewHorizons:Angelica:2.2.32:dev")
|
||||||
|
devOnlyNonPublishable("io.github.legacymoddingmc:unimixins:0.1.23:dev")
|
||||||
}
|
}
|
||||||
@@ -39,10 +39,34 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
|||||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||||
developmentEnvironmentUserName = Developer
|
developmentEnvironmentUserName = Developer
|
||||||
|
|
||||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
# Enables modern Java syntax support. Valid values:
|
||||||
# See https://github.com/bsideup/jabel for details on how this works.
|
# - 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 = false
|
enableModernJavaSyntax = false
|
||||||
|
|
||||||
|
# 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 injecting missing generics into the decompiled source code for a better coding experience.
|
# 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.
|
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||||
enableGenericInjection = false
|
enableGenericInjection = false
|
||||||
@@ -83,26 +107,28 @@ apiPackage =
|
|||||||
accessTransformersFile = multipart_at.cfg
|
accessTransformersFile = multipart_at.cfg
|
||||||
|
|
||||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||||
usesMixins = false
|
usesMixins = true
|
||||||
|
|
||||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
# 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.
|
# 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.
|
# Mixin classes will have access to "main" classes, but not the other way around.
|
||||||
separateMixinSourceSet =
|
separateMixinSourceSet = mixin
|
||||||
|
|
||||||
# Adds some debug arguments like verbose output and class export.
|
# 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.
|
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||||
mixinPlugin =
|
mixinPlugin =
|
||||||
|
|
||||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
# Specify the package that contains all of your Mixins. The package must exist or
|
||||||
mixinsPackage =
|
# 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.
|
||||||
|
mixinsPackage = multipart.mixin
|
||||||
|
|
||||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||||
# This parameter is for legacy compatibility only
|
# This parameter is for legacy compatibility only
|
||||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||||
coreModClass =
|
coreModClass = multipart.mixin.FMPMixinLoader
|
||||||
|
|
||||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||||
@@ -160,6 +186,11 @@ modrinthRelations =
|
|||||||
# Leave this empty if you don't want to publish on CurseForge.
|
# Leave this empty if you don't want to publish on CurseForge.
|
||||||
curseForgeProjectId =
|
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.
|
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||||
# Syntax: type1:name1;type2:name2;...
|
# Syntax: type1:name1;type2:name2;...
|
||||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||||
@@ -172,6 +203,12 @@ curseForgeRelations =
|
|||||||
# projects. New projects should not use this parameter.
|
# projects. New projects should not use this parameter.
|
||||||
# customArchiveBaseName =
|
# 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.
|
# 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'.
|
# 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.
|
# The check is ONLY performed if the version is a git tag.
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#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
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
|
retries=0
|
||||||
|
retryBackOffMs=500
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright © 2015-2021 the original authors.
|
# Copyright © 2015 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# Gradle start up script for POSIX generated by Gradle.
|
# gradlew start up script for POSIX generated by Gradle.
|
||||||
#
|
#
|
||||||
# Important for running:
|
# Important for running:
|
||||||
#
|
#
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
# bash, then to run this script, type that shell name before the whole
|
# bash, then to run this script, type that shell name before the whole
|
||||||
# command line, like:
|
# command line, like:
|
||||||
#
|
#
|
||||||
# ksh Gradle
|
# ksh gradlew
|
||||||
#
|
#
|
||||||
# Busybox and similar reduced shells will NOT work, because this script
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
# requires all of these POSIX shell features:
|
# requires all of these POSIX shell features:
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -114,7 +114,6 @@ case "$( uname )" in #(
|
|||||||
NONSTOP* ) nonstop=true ;;
|
NONSTOP* ) nonstop=true ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
@@ -172,7 +171,6 @@ fi
|
|||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if "$cygwin" || "$msys" ; then
|
if "$cygwin" || "$msys" ; then
|
||||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
||||||
|
|
||||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
@@ -212,8 +210,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
-classpath "$CLASSPATH" \
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
org.gradle.wrapper.GradleWrapperMain \
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
# Stop when "xargs" is not available.
|
# Stop when "xargs" is not available.
|
||||||
|
|||||||
@@ -19,12 +19,12 @@
|
|||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem gradlew startup script for Windows
|
||||||
@rem
|
@rem
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
setlocal EnableExtensions
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%"=="" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
@@ -51,7 +51,7 @@ echo. 1>&2
|
|||||||
echo Please set the JAVA_HOME variable in your environment to match the 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
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
"%COMSPEC%" /c exit 1
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
:findJavaFromJavaHome
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
@@ -65,30 +65,18 @@ echo. 1>&2
|
|||||||
echo Please set the JAVA_HOME variable in your environment to match the 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
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
"%COMSPEC%" /c exit 1
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute gradlew
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
@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
|
||||||
|
|
||||||
:end
|
:exitWithErrorLevel
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||||
|
|
||||||
: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,4 +1,5 @@
|
|||||||
// Add any additional repositiroes for your dependencies here
|
// Add any additional repositiroes for your dependencies here
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,5 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.41'
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.34'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package codechicken.multipart.mixin;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader;
|
||||||
|
import com.gtnewhorizon.gtnhmixins.builders.IMixins;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||||
|
|
||||||
|
@IFMLLoadingPlugin.MCVersion("1.7.10")
|
||||||
|
public class FMPMixinLoader implements IFMLLoadingPlugin, IEarlyMixinLoader {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getASMTransformerClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getModContainerClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSetupClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void injectData(Map<String, Object> data) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTransformerClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMixinConfig() {
|
||||||
|
return "mixins.ForgeMultipart.early.json";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getMixins(Set<String> loadedCoreMods) {
|
||||||
|
return IMixins.getEarlyMixins(Mixins.class, loadedCoreMods);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package codechicken.multipart.mixin;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhmixins.builders.IMixins;
|
||||||
|
import com.gtnewhorizon.gtnhmixins.builders.MixinBuilder;
|
||||||
|
|
||||||
|
public enum Mixins implements IMixins {
|
||||||
|
|
||||||
|
RENDER_GLOBAL_MIXIN(new MixinBuilder("Redirects part block break renders to ISBRHModel")
|
||||||
|
.addClientMixins("MixinRenderGlobal").addRequiredMod(TargetedMod.GTNHLIB).setPhase(Phase.EARLY));
|
||||||
|
|
||||||
|
private final MixinBuilder builder;
|
||||||
|
|
||||||
|
Mixins(MixinBuilder builder) {
|
||||||
|
this.builder = builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public MixinBuilder getBuilder() {
|
||||||
|
return this.builder;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package codechicken.multipart.mixin;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhmixins.builders.ITargetMod;
|
||||||
|
import com.gtnewhorizon.gtnhmixins.builders.TargetModBuilder;
|
||||||
|
|
||||||
|
public enum TargetedMod implements ITargetMod {
|
||||||
|
|
||||||
|
GTNHLIB("GTNHLib Core", "gtnhlib");
|
||||||
|
|
||||||
|
private final TargetModBuilder builder;
|
||||||
|
|
||||||
|
TargetedMod(String modId) {
|
||||||
|
this(null, modId, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
TargetedMod(String coreModClass, String modId) {
|
||||||
|
this(coreModClass, modId, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
TargetedMod(String coreModClass, String modId, String targetClass) {
|
||||||
|
this.builder = new TargetModBuilder().setCoreModClass(coreModClass).setModId(modId).setTargetClass(targetClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public TargetModBuilder getBuilder() {
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 531 B After Width: | Height: | Size: 500 B |
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"minVersion": "0.8.5-GTNH",
|
||||||
|
"package": "codechicken.multipart.mixin.early",
|
||||||
|
"refmap": "mixins.ForgeMultipart.refmap.json",
|
||||||
|
"target": "@env(DEFAULT)",
|
||||||
|
"mixinextras": {
|
||||||
|
"minVersion": "0.5.0"
|
||||||
|
},
|
||||||
|
"compatibilityLevel": "JAVA_8"
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"minVersion": "0.8.5-GTNH",
|
||||||
|
"refmap": "mixins.ForgeMultipart.refmap.json",
|
||||||
|
"target": "@env(DEFAULT)",
|
||||||
|
"compatibilityLevel": "JAVA_8"
|
||||||
|
}
|
||||||
@@ -54,5 +54,7 @@ object DefaultContent {
|
|||||||
registerMaterial(new GrassMicroMaterial, materialKey(grass))
|
registerMaterial(new GrassMicroMaterial, materialKey(grass))
|
||||||
MicroMaterialRegistry.remapName(oldKey(mycelium), materialKey(mycelium))
|
MicroMaterialRegistry.remapName(oldKey(mycelium), materialKey(mycelium))
|
||||||
registerMaterial(new TopMicroMaterial(mycelium), materialKey(mycelium))
|
registerMaterial(new TopMicroMaterial(mycelium), materialKey(mycelium))
|
||||||
|
|
||||||
|
registerMaterial(MissingMicroMaterial, MissingMicroMaterial.key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,15 +133,18 @@ object ItemMicroPart {
|
|||||||
if (!stack.getTagCompound.hasKey("mat"))
|
if (!stack.getTagCompound.hasKey("mat"))
|
||||||
return null
|
return null
|
||||||
|
|
||||||
return MicroMaterialRegistry.getMaterial(
|
MicroMaterialRegistry.getMaterial(
|
||||||
stack.getTagCompound.getString("mat")
|
stack.getTagCompound.getString("mat")
|
||||||
)
|
) match {
|
||||||
|
case null => MissingMicroMaterial
|
||||||
|
case mat => mat
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def getMaterialID(stack: ItemStack): Int = {
|
def getMaterialID(stack: ItemStack): Int = {
|
||||||
checkTagCompound(stack)
|
checkTagCompound(stack)
|
||||||
if (!stack.getTagCompound.hasKey("mat"))
|
if (!stack.getTagCompound.hasKey("mat"))
|
||||||
return 0
|
return MicroMaterialRegistry.getMissingId
|
||||||
|
|
||||||
return MicroMaterialRegistry.materialID(
|
return MicroMaterialRegistry.materialID(
|
||||||
stack.getTagCompound.getString("mat")
|
stack.getTagCompound.getString("mat")
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ object MicroMaterialRegistry {
|
|||||||
private var maxCuttingStrength: Int = _
|
private var maxCuttingStrength: Int = _
|
||||||
|
|
||||||
private val remap = HashMap[String, String]()
|
private val remap = HashMap[String, String]()
|
||||||
|
private var missingId: Int = 0
|
||||||
|
|
||||||
/** Register a micro material with unique identifier name
|
/** Register a micro material with unique identifier name
|
||||||
*/
|
*/
|
||||||
@@ -162,8 +163,17 @@ object MicroMaterialRegistry {
|
|||||||
nameMap.clear()
|
nameMap.clear()
|
||||||
for (i <- 0 until idMap.length)
|
for (i <- 0 until idMap.length)
|
||||||
nameMap.put(idMap(i)._1, i)
|
nameMap.put(idMap(i)._1, i)
|
||||||
|
missingId = nameMap.getOrElse(
|
||||||
|
MissingMicroMaterial.key,
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"MissingMicroMaterial is not registered; the placeholder must never " +
|
||||||
|
"fall back to id 0."
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def getMissingId = missingId
|
||||||
|
|
||||||
private[microblock] def calcMaxCuttingStrength() {
|
private[microblock] def calcMaxCuttingStrength() {
|
||||||
val it = Item.itemRegistry.iterator.asInstanceOf[JIterator[Item]]
|
val it = Item.itemRegistry.iterator.asInstanceOf[JIterator[Item]]
|
||||||
maxCuttingStrength = it.flatMap {
|
maxCuttingStrength = it.flatMap {
|
||||||
@@ -216,7 +226,7 @@ object MicroMaterialRegistry {
|
|||||||
case Some(v) => v
|
case Some(v) => v
|
||||||
case None =>
|
case None =>
|
||||||
logger.error("Missing mapping for part with ID: " + name)
|
logger.error("Missing mapping for part with ID: " + name)
|
||||||
0
|
missingId
|
||||||
}
|
}
|
||||||
|
|
||||||
def getMaterial(name: String) =
|
def getMaterial(name: String) =
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ object MicroRecipe extends IRecipe {
|
|||||||
def findMaterial(item: ItemStack): Int =
|
def findMaterial(item: ItemStack): Int =
|
||||||
MicroMaterialRegistry.getIdMap.find { m =>
|
MicroMaterialRegistry.getIdMap.find { m =>
|
||||||
val mitem = m._2.getItem
|
val mitem = m._2.getItem
|
||||||
item.getItem == mitem.getItem &&
|
m._2 != MissingMicroMaterial && item.getItem == mitem.getItem &&
|
||||||
item.getItemDamage == mitem.getItemDamage &&
|
item.getItemDamage == mitem.getItemDamage &&
|
||||||
ItemStack.areItemStackTagsEqual(item, mitem)
|
ItemStack.areItemStackTagsEqual(item, mitem)
|
||||||
} match {
|
} match {
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package codechicken.microblock
|
||||||
|
|
||||||
|
import codechicken.lib.render.uv.IconTransformation
|
||||||
|
import codechicken.lib.vec.{Cuboid6, Vector3}
|
||||||
|
import codechicken.microblock.MicroMaterialRegistry.IMicroMaterial
|
||||||
|
import codechicken.microblock.handler.MicroblockProxy
|
||||||
|
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||||
|
import net.minecraft.block.Block
|
||||||
|
import net.minecraft.block.Block.SoundType
|
||||||
|
import net.minecraft.entity.Entity
|
||||||
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
|
import net.minecraft.init.Blocks
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.util.IIcon
|
||||||
|
|
||||||
|
/** Stand-in for a material whose name could not be resolved at load time.
|
||||||
|
* Renders the vanilla missing texture (magenta/black checkerboard) and behaves
|
||||||
|
* inertly. Resolving an unknown name to this placeholder keeps microblocks
|
||||||
|
* from silently becoming material id 0 (Blood Rune in GTNH).
|
||||||
|
*/
|
||||||
|
object MissingMicroMaterial extends IMicroMaterial {
|
||||||
|
val key = "forgemicroblock:missing"
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private var icon: IIcon = _
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
override def loadIcons(): Unit = {
|
||||||
|
icon = MicroblockProxy.renderBlocks.getIconSafe(null)
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
override def getBreakingIcon(side: Int): IIcon = icon
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
override def renderMicroFace(
|
||||||
|
pos: Vector3,
|
||||||
|
pass: Int,
|
||||||
|
bounds: Cuboid6
|
||||||
|
): Unit = {
|
||||||
|
MaterialRenderHelper
|
||||||
|
.start(pos, pass, new IconTransformation(icon))
|
||||||
|
.lighting()
|
||||||
|
.render()
|
||||||
|
}
|
||||||
|
|
||||||
|
override def isTransparent: Boolean = false
|
||||||
|
override def getLightValue: Int = 0
|
||||||
|
override def getStrength(player: EntityPlayer): Float = 1f
|
||||||
|
override def getLocalizedName: String = "Missing Material"
|
||||||
|
override def getItem: ItemStack = new ItemStack(Blocks.stone)
|
||||||
|
override def getCutterStrength: Int = 0
|
||||||
|
override def getSound: SoundType = Block.soundTypeStone
|
||||||
|
override def explosionResistance(entity: Entity): Float = 6f
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package codechicken.microblock.compat;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
import com.gtnewhorizons.postea.api.IItemStackTransformationHandler;
|
||||||
|
|
||||||
|
import codechicken.microblock.MicroMaterialRegistry;
|
||||||
|
|
||||||
|
public class ItemMicroPartTransformer implements IItemStackTransformationHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(String originalItemId, NBTTagCompound stackTag) {
|
||||||
|
if (!stackTag.hasKey("tag")) return false;
|
||||||
|
NBTTagCompound tag = stackTag.getCompoundTag("tag");
|
||||||
|
if (!tag.hasKey("mat")) return false;
|
||||||
|
|
||||||
|
String matName = tag.getString("mat");
|
||||||
|
|
||||||
|
// Goes through the remap layer, which is private
|
||||||
|
int remappedId = MicroMaterialRegistry.materialID(matName);
|
||||||
|
String remappedName = MicroMaterialRegistry.materialName(remappedId);
|
||||||
|
|
||||||
|
if (remappedName.equals(matName)) return false;
|
||||||
|
|
||||||
|
tag.setString("mat", remappedName);
|
||||||
|
stackTag.setTag("tag", tag);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package codechicken.microblock.compat;
|
||||||
|
|
||||||
|
import com.gtnewhorizons.postea.api.ItemStackReplacementManager;
|
||||||
|
|
||||||
|
public class PosteaCompat {
|
||||||
|
|
||||||
|
public static void registerTransformers() {
|
||||||
|
ItemStackReplacementManager
|
||||||
|
.addTransformationHandler("ForgeMicroblock:microblock", new ItemMicroPartTransformer());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package codechicken.microblock.handler
|
package codechicken.microblock.handler
|
||||||
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent
|
import cpw.mods.fml.common.eventhandler.{EventPriority, SubscribeEvent}
|
||||||
import cpw.mods.fml.relauncher.SideOnly
|
import cpw.mods.fml.relauncher.SideOnly
|
||||||
import cpw.mods.fml.relauncher.Side
|
import cpw.mods.fml.relauncher.Side
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent
|
import net.minecraftforge.client.event.TextureStitchEvent
|
||||||
@@ -14,7 +14,7 @@ import cpw.mods.fml.common.LoaderState
|
|||||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType
|
import net.minecraft.util.MovingObjectPosition.MovingObjectType
|
||||||
|
|
||||||
object MicroblockEventHandler {
|
object MicroblockEventHandler {
|
||||||
@SubscribeEvent
|
@SubscribeEvent(priority = EventPriority.LOW)
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
def postTextureStitch(event: TextureStitchEvent.Post) {
|
def postTextureStitch(event: TextureStitchEvent.Post) {
|
||||||
if (event.map.getTextureType == 0)
|
if (event.map.getTextureType == 0)
|
||||||
|
|||||||
@@ -26,7 +26,14 @@ object MicroblockCPH extends MicroblockPH with IClientPacketHandler {
|
|||||||
netHandler: INetHandlerPlayClient
|
netHandler: INetHandlerPlayClient
|
||||||
) {
|
) {
|
||||||
packet.getType match {
|
packet.getType match {
|
||||||
case 1 => handleMaterialRegistration(packet, netHandler)
|
// In singleplayer the integrated server and this client share the one
|
||||||
|
// static registry, so the id-map packet is redundant. Skipping it avoids
|
||||||
|
// rebuilding (clearing) the shared maps on the netty thread while the
|
||||||
|
// server thread reads them - the race that turned microblocks into Blood
|
||||||
|
// Rune slabs.
|
||||||
|
case 1 =>
|
||||||
|
if (!mc.isSingleplayer)
|
||||||
|
handleMaterialRegistration(packet, netHandler)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import net.minecraftforge.oredict.OreDictionary
|
|||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe
|
import net.minecraftforge.oredict.ShapedOreRecipe
|
||||||
import codechicken.lib.packet.PacketCustom
|
import codechicken.lib.packet.PacketCustom
|
||||||
|
import codechicken.microblock.compat.PosteaCompat
|
||||||
import cpw.mods.fml.common.Loader
|
import cpw.mods.fml.common.Loader
|
||||||
import cpw.mods.fml.common.registry.GameRegistry
|
import cpw.mods.fml.common.registry.GameRegistry
|
||||||
import net.minecraft.client.renderer.RenderBlocks
|
import net.minecraft.client.renderer.RenderBlocks
|
||||||
@@ -110,6 +111,9 @@ class MicroblockProxy_serverImpl {
|
|||||||
MicroblockSPH.registryChannel,
|
MicroblockSPH.registryChannel,
|
||||||
MicroblockSPH
|
MicroblockSPH
|
||||||
)
|
)
|
||||||
|
if (Loader.isModLoaded("postea")) {
|
||||||
|
PosteaCompat.registerTransformers()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package codechicken.multipart
|
|||||||
import java.util.List
|
import java.util.List
|
||||||
import java.lang.Iterable
|
import java.lang.Iterable
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.block.material.Material
|
import net.minecraft.block.material.{MapColor, Material}
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.util.AxisAlignedBB
|
import net.minecraft.util.AxisAlignedBB
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
@@ -12,6 +12,7 @@ import net.minecraft.util.Vec3
|
|||||||
import net.minecraft.util.MovingObjectPosition
|
import net.minecraft.util.MovingObjectPosition
|
||||||
import codechicken.lib.raytracer.RayTracer
|
import codechicken.lib.raytracer.RayTracer
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
|
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
@@ -68,7 +69,7 @@ object BlockMultipart {
|
|||||||
|
|
||||||
/** Block class for all multiparts, should be internal use only.
|
/** Block class for all multiparts, should be internal use only.
|
||||||
*/
|
*/
|
||||||
class BlockMultipart extends Block(Material.rock) {
|
class BlockMultipart extends Block(new Material(MapColor.stoneColor)) {
|
||||||
import BlockMultipart._
|
import BlockMultipart._
|
||||||
|
|
||||||
override def hasTileEntity(meta: Int = 0) = true
|
override def hasTileEntity(meta: Int = 0) = true
|
||||||
@@ -256,10 +257,7 @@ class BlockMultipart extends Block(Material.rock) {
|
|||||||
|
|
||||||
override def getRenderBlockPass = 1
|
override def getRenderBlockPass = 1
|
||||||
|
|
||||||
override def canRenderInPass(pass: Int): Boolean = {
|
override def canRenderInPass(pass: Int): Boolean = true
|
||||||
MultipartRenderer.pass = pass
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override def getPickBlock(
|
override def getPickBlock(
|
||||||
hit: MovingObjectPosition,
|
hit: MovingObjectPosition,
|
||||||
|
|||||||
@@ -18,10 +18,17 @@ object ControlKeyModifer {
|
|||||||
implicit def playerControlValue(p: EntityPlayer) = new ControlKeyValue(p)
|
implicit def playerControlValue(p: EntityPlayer) = new ControlKeyValue(p)
|
||||||
|
|
||||||
class ControlKeyValue(p: EntityPlayer) {
|
class ControlKeyValue(p: EntityPlayer) {
|
||||||
def isControlDown = map(p)
|
def isControlDown = {
|
||||||
|
if (p.worldObj.isRemote) {
|
||||||
|
isClientPressing
|
||||||
|
} else {
|
||||||
|
map(p)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val map = HashMap[EntityPlayer, Boolean]().withDefaultValue(false)
|
val map = HashMap[EntityPlayer, Boolean]().withDefaultValue(false)
|
||||||
|
var isClientPressing = false;
|
||||||
|
|
||||||
/** Implicit static for Java users.
|
/** Implicit static for Java users.
|
||||||
*/
|
*/
|
||||||
@@ -38,7 +45,6 @@ object ControlKeyHandler
|
|||||||
) {
|
) {
|
||||||
import ControlKeyModifer._
|
import ControlKeyModifer._
|
||||||
var wasPressed = false
|
var wasPressed = false
|
||||||
var oldPlayer: EntityPlayer = null
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@@ -47,19 +53,11 @@ object ControlKeyHandler
|
|||||||
if (pressed != wasPressed) {
|
if (pressed != wasPressed) {
|
||||||
wasPressed = pressed
|
wasPressed = pressed
|
||||||
if (Minecraft.getMinecraft.getNetHandler != null) {
|
if (Minecraft.getMinecraft.getNetHandler != null) {
|
||||||
map.put(Minecraft.getMinecraft.thePlayer, pressed)
|
isClientPressing = pressed
|
||||||
val packet = new PacketCustom(MultipartCPH.channel, 1)
|
val packet = new PacketCustom(MultipartCPH.channel, 1)
|
||||||
packet.writeBoolean(pressed)
|
packet.writeBoolean(pressed)
|
||||||
packet.sendToServer()
|
packet.sendToServer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldPlayer != null) {
|
|
||||||
if (oldPlayer != Minecraft.getMinecraft.thePlayer) {
|
|
||||||
map.remove(oldPlayer)
|
|
||||||
oldPlayer = Minecraft.getMinecraft.thePlayer
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
oldPlayer = Minecraft.getMinecraft.thePlayer
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package codechicken.multipart;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
public interface ISBRHPart {
|
||||||
|
|
||||||
|
boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, RenderBlocks renderer);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package codechicken.multipart;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
public interface JsonModeledPart {
|
||||||
|
|
||||||
|
Block getBlock();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use to give your part a world that can be used to define properties for rendering. For example having your world
|
||||||
|
* returning your block with some specific state such as meta you can override the getMeta for the input location to
|
||||||
|
* be the meta you desire
|
||||||
|
*
|
||||||
|
* @return The world to use
|
||||||
|
*/
|
||||||
|
IBlockAccess getRenderWorld();
|
||||||
|
}
|
||||||
@@ -81,12 +81,14 @@ object MultipartGenerator extends ScratchBitSet {
|
|||||||
pos: BlockCoord,
|
pos: BlockCoord,
|
||||||
part: TMultiPart
|
part: TMultiPart
|
||||||
): TileMultipart = {
|
): TileMultipart = {
|
||||||
val (tile, converted) = TileMultipart.getOrConvertTile2(world, pos)
|
val (tile, converted) =
|
||||||
|
if (world.isRemote) (TileMultipart.getTile(world, pos), false)
|
||||||
|
else TileMultipart.getOrConvertTile2(world, pos)
|
||||||
val bitset = setTraits(part, world.isRemote)
|
val bitset = setTraits(part, world.isRemote)
|
||||||
|
|
||||||
var ntile = tile
|
var ntile = tile
|
||||||
if (ntile != null) {
|
if (ntile != null) {
|
||||||
if (converted) { // perform client conversion
|
if (converted) { // server-side conversion, then tell the clients
|
||||||
ntile.partList(0).invalidateConvertedTile()
|
ntile.partList(0).invalidateConvertedTile()
|
||||||
world.setBlock(pos.x, pos.y, pos.z, MultipartProxy.block, 0, 0)
|
world.setBlock(pos.x, pos.y, pos.z, MultipartProxy.block, 0, 0)
|
||||||
silentAddTile(world, pos, ntile)
|
silentAddTile(world, pos, ntile)
|
||||||
@@ -122,9 +124,14 @@ object MultipartGenerator extends ScratchBitSet {
|
|||||||
* adding it to the tick list
|
* adding it to the tick list
|
||||||
*/
|
*/
|
||||||
def silentAddTile(world: World, pos: BlockCoord, tile: TileEntity) {
|
def silentAddTile(world: World, pos: BlockCoord, tile: TileEntity) {
|
||||||
|
tile.xCoord = pos.x;
|
||||||
|
tile.yCoord = pos.y;
|
||||||
|
tile.zCoord = pos.z;
|
||||||
|
|
||||||
val chunk = world.getChunkFromBlockCoords(pos.x, pos.z)
|
val chunk = world.getChunkFromBlockCoords(pos.x, pos.z)
|
||||||
if (chunk != null)
|
if (chunk != null) {
|
||||||
chunk.func_150812_a(pos.x & 15, pos.y, pos.z & 15, tile)
|
chunk.addTileEntity(tile)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if tile satisfies all the interfaces required by parts. If not,
|
/** Check if tile satisfies all the interfaces required by parts. If not,
|
||||||
|
|||||||
@@ -5,15 +5,14 @@ import codechicken.lib.vec.Vector3
|
|||||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry
|
import cpw.mods.fml.client.registry.RenderingRegistry
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.client.renderer.{Tessellator, RenderBlocks}
|
import net.minecraft.client.renderer.{RenderBlocks, Tessellator}
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.world.IBlockAccess
|
import net.minecraft.world.IBlockAccess
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraftforge.client.MinecraftForgeClient
|
||||||
import cpw.mods.fml.relauncher.SideOnly
|
import cpw.mods.fml.relauncher.SideOnly
|
||||||
import cpw.mods.fml.relauncher.Side
|
import cpw.mods.fml.relauncher.Side
|
||||||
import codechicken.lib.raytracer.ExtendedMOP
|
import codechicken.multipart.RenderPartResolver
|
||||||
import codechicken.lib.lighting.LightMatrix
|
|
||||||
|
|
||||||
/** Internal class for rendering callbacks. Should be moved to the handler
|
/** Internal class for rendering callbacks. Should be moved to the handler
|
||||||
* package
|
* package
|
||||||
@@ -23,7 +22,6 @@ object MultipartRenderer
|
|||||||
extends TileEntitySpecialRenderer
|
extends TileEntitySpecialRenderer
|
||||||
with ISimpleBlockRenderingHandler {
|
with ISimpleBlockRenderingHandler {
|
||||||
TileMultipart.renderID = RenderingRegistry.getNextAvailableRenderId
|
TileMultipart.renderID = RenderingRegistry.getNextAvailableRenderId
|
||||||
var pass: Int = 0
|
|
||||||
|
|
||||||
override def renderTileEntityAt(
|
override def renderTileEntityAt(
|
||||||
t: TileEntity,
|
t: TileEntity,
|
||||||
@@ -33,7 +31,7 @@ object MultipartRenderer
|
|||||||
f: Float
|
f: Float
|
||||||
) {
|
) {
|
||||||
val tmpart = t.asInstanceOf[TileMultipartClient]
|
val tmpart = t.asInstanceOf[TileMultipartClient]
|
||||||
if (tmpart.partList.isEmpty)
|
if (tmpart.partList.isEmpty | !tmpart.hasDynamicParts)
|
||||||
return
|
return
|
||||||
|
|
||||||
val state = CCRenderState.instance
|
val state = CCRenderState.instance
|
||||||
@@ -42,7 +40,7 @@ object MultipartRenderer
|
|||||||
state.useNormals = true
|
state.useNormals = true
|
||||||
|
|
||||||
val pos = new Vector3(x, y, z)
|
val pos = new Vector3(x, y, z)
|
||||||
tmpart.renderDynamic(pos, f, pass)
|
tmpart.renderDynamic(pos, f, MinecraftForgeClient.getRenderPass)
|
||||||
}
|
}
|
||||||
|
|
||||||
override def getRenderId = TileMultipart.renderID
|
override def getRenderId = TileMultipart.renderID
|
||||||
@@ -65,19 +63,15 @@ object MultipartRenderer
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
if (renderer.hasOverrideBlockTexture) {
|
if (renderer.hasOverrideBlockTexture) {
|
||||||
val hit = Minecraft.getMinecraft.objectMouseOver
|
val part =
|
||||||
if (
|
RenderPartResolver.resolve(world, x, y, z)
|
||||||
hit != null && hit.blockX == x && hit.blockY == y && hit.blockZ == z && ExtendedMOP
|
if (part != null) {
|
||||||
.getData(hit)
|
part match {
|
||||||
.isInstanceOf[(_, _)]
|
case isbrh: ISBRHPart =>
|
||||||
) {
|
isbrh.renderWorldBlock(world, x, y, z, renderer)
|
||||||
val hitInfo: (Int, _) = ExtendedMOP.getData(hit)
|
case _ =>
|
||||||
if (
|
part.drawBreaking(renderer)
|
||||||
hitInfo._1.isInstanceOf[
|
}
|
||||||
Int
|
|
||||||
] && hitInfo._1 >= 0 && hitInfo._1 < tmpart.partList.size
|
|
||||||
)
|
|
||||||
tmpart.partList(hitInfo._1).drawBreaking(renderer)
|
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -85,7 +79,9 @@ object MultipartRenderer
|
|||||||
val state = CCRenderState.instance
|
val state = CCRenderState.instance
|
||||||
state.resetInstance()
|
state.resetInstance()
|
||||||
state.lightMatrix.locate(world, x, y, z)
|
state.lightMatrix.locate(world, x, y, z)
|
||||||
return tmpart.renderStatic(new Vector3(x, y, z), pass)
|
val b = tmpart.renderStatic(world, new Vector3(x, y, z), renderer)
|
||||||
|
state.lightMatrix.access = null
|
||||||
|
b
|
||||||
}
|
}
|
||||||
|
|
||||||
override def renderInventoryBlock(
|
override def renderInventoryBlock(
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package codechicken.multipart;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
import codechicken.lib.raytracer.ExtendedMOP;
|
||||||
|
import scala.Tuple2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A helper class for resolving parts so we don't do a double look up
|
||||||
|
*/
|
||||||
|
public final class RenderPartResolver {
|
||||||
|
|
||||||
|
public static TMultiPart resolve(IBlockAccess world, int x, int y, int z) {
|
||||||
|
|
||||||
|
if (world == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// Make sure the hit is actually this block.
|
||||||
|
MovingObjectPosition hit = Minecraft.getMinecraft().objectMouseOver;
|
||||||
|
|
||||||
|
if (hit == null || hit.blockX != x || hit.blockY != y || hit.blockZ != z) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object data = ExtendedMOP.getData(hit);
|
||||||
|
|
||||||
|
if (!(data instanceof Tuple2)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Tuple2<?, ?> hitInfo = (Tuple2<?, ?>) data;
|
||||||
|
Object indexObject = hitInfo._1();
|
||||||
|
if (!(indexObject instanceof Integer)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = (Integer) indexObject;
|
||||||
|
TileMultipartClient tile = getMultipartTile(world, x, y, z);
|
||||||
|
if (tile == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Needed because scala is stupid and the client tile doesn't expose what we need.
|
||||||
|
TileMultipart multipart = (TileMultipart) tile;
|
||||||
|
|
||||||
|
if (index < 0 || index >= multipart.jPartList().size()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return multipart.jPartList().get(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TileMultipartClient getMultipartTile(IBlockAccess world, int x, int y, int z) {
|
||||||
|
if (world.getTileEntity(x, y, z) instanceof TileMultipartClient) {
|
||||||
|
return (TileMultipartClient) world.getTileEntity(x, y, z);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -252,7 +252,9 @@ abstract class TMultiPart {
|
|||||||
* Incremental changes should be sent rather than the whole description
|
* Incremental changes should be sent rather than the whole description
|
||||||
* packet if possible.
|
* packet if possible.
|
||||||
*/
|
*/
|
||||||
def sendDescUpdate() = writeDesc(getWriteStream)
|
def sendDescUpdate() {
|
||||||
|
if (tile != null) writeDesc(getWriteStream)
|
||||||
|
}
|
||||||
|
|
||||||
/** Called when a part is added or removed from this block space. The part
|
/** Called when a part is added or removed from this block space. The part
|
||||||
* parameter may be null if several things have changed.
|
* parameter may be null if several things have changed.
|
||||||
@@ -316,6 +318,12 @@ abstract class TMultiPart {
|
|||||||
*/
|
*/
|
||||||
def doesTick = true
|
def doesTick = true
|
||||||
|
|
||||||
|
/** Return whether this part needs to be included in the dynamic render loop
|
||||||
|
* (renderDynamic). Default is false. Override this to true for parts like
|
||||||
|
* lights that need per-frame rendering but no logic updates.
|
||||||
|
*/
|
||||||
|
def shouldRenderDynamic = false
|
||||||
|
|
||||||
/** Called once per world tick. This will be called even if doesTick returns
|
/** Called once per world tick. This will be called even if doesTick returns
|
||||||
* false if another part in the space needs ticks.
|
* false if another part in the space needs ticks.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package codechicken.multipart
|
package codechicken.multipart
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
|
|
||||||
import scala.collection.mutable.ListBuffer
|
import scala.collection.mutable.ListBuffer
|
||||||
import codechicken.lib.packet.PacketCustom
|
import codechicken.lib.packet.PacketCustom
|
||||||
import codechicken.lib.vec.{Cuboid6, BlockCoord, Vector3}
|
import codechicken.lib.vec.{BlockCoord, Cuboid6, Vector3}
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.{IBlockAccess, World}
|
||||||
|
|
||||||
import java.util.List
|
import java.util.List
|
||||||
import net.minecraft.nbt.NBTTagCompound
|
import net.minecraft.nbt.NBTTagCompound
|
||||||
import codechicken.lib.data.MCDataOutput
|
import codechicken.lib.data.MCDataOutput
|
||||||
@@ -15,16 +17,22 @@ import codechicken.multipart.handler.{
|
|||||||
}
|
}
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.nbt.NBTTagList
|
import net.minecraft.nbt.NBTTagList
|
||||||
|
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
import net.minecraft.entity.item.EntityItem
|
import net.minecraft.entity.item.EntityItem
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
|
|
||||||
import scala.collection.JavaConversions._
|
import scala.collection.JavaConversions._
|
||||||
import java.util.Collection
|
import java.util.Collection
|
||||||
import codechicken.lib.raytracer.ExtendedMOP
|
import codechicken.lib.raytracer.ExtendedMOP
|
||||||
import net.minecraft.util.Vec3
|
import net.minecraft.util.{AxisAlignedBB, Vec3}
|
||||||
|
|
||||||
import java.lang.Iterable
|
import java.lang.Iterable
|
||||||
import codechicken.lib.world.IChunkLoadTile
|
import codechicken.lib.world.IChunkLoadTile
|
||||||
|
import com.gtnewhorizon.gtnhlib.client.model.ModelISBRH
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks
|
||||||
|
import net.minecraftforge.client.ForgeHooksClient
|
||||||
|
|
||||||
class TileMultipart extends TileEntity with IChunkLoadTile {
|
class TileMultipart extends TileEntity with IChunkLoadTile {
|
||||||
|
|
||||||
@@ -70,7 +78,8 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
|
|||||||
val it = partList.iterator
|
val it = partList.iterator
|
||||||
while (it.hasNext) {
|
while (it.hasNext) {
|
||||||
val p = it.next()
|
val p = it.next()
|
||||||
if (p.tile != null) f(p)
|
// A replaced tile can still receive queued callbacks after its parts have moved.
|
||||||
|
if (p.tile == this) f(p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +119,7 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
|
|||||||
|
|
||||||
override def validate() {
|
override def validate() {
|
||||||
super.validate()
|
super.validate()
|
||||||
|
|
||||||
if (worldObj != null && worldObj.isRemote)
|
if (worldObj != null && worldObj.isRemote)
|
||||||
TileCache.add(this)
|
TileCache.add(this)
|
||||||
}
|
}
|
||||||
@@ -162,7 +172,20 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
|
|||||||
*/
|
*/
|
||||||
def getWeakChanges = false
|
def getWeakChanges = false
|
||||||
|
|
||||||
def getLightValue = partList.view.map(_.getLightValue).max
|
def getLightValue: Int = {
|
||||||
|
if (partList.isEmpty) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var max = 0
|
||||||
|
val it = partList.iterator
|
||||||
|
while (it.hasNext) {
|
||||||
|
val l = it.next().getLightValue
|
||||||
|
if (l > max) max = l
|
||||||
|
}
|
||||||
|
|
||||||
|
max
|
||||||
|
}
|
||||||
|
|
||||||
def getExplosionResistance(entity: Entity) =
|
def getExplosionResistance(entity: Entity) =
|
||||||
partList.view.map(_.explosionResistance(entity)).max
|
partList.view.map(_.explosionResistance(entity)).max
|
||||||
@@ -326,6 +349,8 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
throw new IllegalArgumentException("Tried to remove a non-existant part")
|
throw new IllegalArgumentException("Tried to remove a non-existant part")
|
||||||
|
|
||||||
|
val removedLightValue = part.getLightValue
|
||||||
|
|
||||||
part.preRemove()
|
part.preRemove()
|
||||||
partList = partList.filterNot(_ == part)
|
partList = partList.filterNot(_ == part)
|
||||||
|
|
||||||
@@ -357,6 +382,7 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
|
|||||||
private[multipart] def loadParts(parts: scala.Iterable[TMultiPart]) {
|
private[multipart] def loadParts(parts: scala.Iterable[TMultiPart]) {
|
||||||
clearParts()
|
clearParts()
|
||||||
parts.foreach(p => addPart_do(p))
|
parts.foreach(p => addPart_do(p))
|
||||||
|
|
||||||
if (worldObj != null) {
|
if (worldObj != null) {
|
||||||
if (worldObj.isRemote)
|
if (worldObj.isRemote)
|
||||||
operate(_.onWorldJoin())
|
operate(_.onWorldJoin())
|
||||||
@@ -449,24 +475,161 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
trait TileMultipartClient extends TileMultipart {
|
trait TileMultipartClient extends TileMultipart {
|
||||||
def renderStatic(pos: Vector3, pass: Int) =
|
private var cachedRenderBounds: AxisAlignedBB = null
|
||||||
partList.foldLeft(false)((r, part) => part.renderStatic(pos, pass) || r)
|
private var staticCache: Array[TMultiPart] = null
|
||||||
|
private var dynamicCache: Array[TMultiPart] = null
|
||||||
|
|
||||||
|
var hasDynamicParts: Boolean = false
|
||||||
|
|
||||||
|
def updateRenderCache() {
|
||||||
|
if (partList != null) {
|
||||||
|
val (dynamic, static) =
|
||||||
|
partList.partition(p => p.doesTick || p.shouldRenderDynamic)
|
||||||
|
val sArr = static.toArray
|
||||||
|
val dArr = dynamic.toArray
|
||||||
|
|
||||||
|
var c: Cuboid6 = null
|
||||||
|
var i = 0
|
||||||
|
val allParts = sArr ++ dArr
|
||||||
|
while (i < allParts.length) {
|
||||||
|
val b = allParts(i).getRenderBounds
|
||||||
|
if (c == null) c = b.copy
|
||||||
|
else c.enclose(b)
|
||||||
|
i += 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c == null) c = Cuboid6.full
|
||||||
|
|
||||||
|
c.add(Vector3.fromTileEntity(this))
|
||||||
|
cachedRenderBounds = c.toAABB
|
||||||
|
staticCache = sArr
|
||||||
|
dynamicCache = dArr
|
||||||
|
hasDynamicParts = dArr.length > 0
|
||||||
|
} else {
|
||||||
|
staticCache = Array.empty
|
||||||
|
dynamicCache = Array.empty
|
||||||
|
hasDynamicParts = false
|
||||||
|
cachedRenderBounds = AxisAlignedBB.getBoundingBox(
|
||||||
|
xCoord,
|
||||||
|
yCoord,
|
||||||
|
zCoord,
|
||||||
|
xCoord + 1,
|
||||||
|
yCoord + 1,
|
||||||
|
zCoord + 1
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def renderStatic(
|
||||||
|
world: IBlockAccess,
|
||||||
|
vec: Vector3,
|
||||||
|
renderer: RenderBlocks
|
||||||
|
) = {
|
||||||
|
if (staticCache == null)
|
||||||
|
updateRenderCache()
|
||||||
|
|
||||||
|
var rendered = false
|
||||||
|
|
||||||
|
def renderPart(part: TMultiPart): Unit = {
|
||||||
|
if (part == null)
|
||||||
|
return
|
||||||
|
|
||||||
|
part match {
|
||||||
|
case jsonModeledPart: JsonModeledPart =>
|
||||||
|
if (
|
||||||
|
ModelISBRH.INSTANCE
|
||||||
|
.get()
|
||||||
|
.renderWorldBlock(
|
||||||
|
jsonModeledPart.getRenderWorld,
|
||||||
|
vec.x.toInt,
|
||||||
|
vec.y.toInt,
|
||||||
|
vec.z.toInt,
|
||||||
|
jsonModeledPart.getBlock,
|
||||||
|
ModelISBRH.JSON_ISBRH_ID,
|
||||||
|
renderer
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
rendered = true
|
||||||
|
}
|
||||||
|
case isbrh: ISBRHPart =>
|
||||||
|
if (
|
||||||
|
isbrh.renderWorldBlock(
|
||||||
|
world,
|
||||||
|
vec.x.toInt,
|
||||||
|
vec.y.toInt,
|
||||||
|
vec.z.toInt,
|
||||||
|
renderer
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
rendered = true
|
||||||
|
}
|
||||||
|
|
||||||
|
case _ =>
|
||||||
|
if (
|
||||||
|
part.renderStatic(
|
||||||
|
vec,
|
||||||
|
ForgeHooksClient.getWorldRenderPass
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
rendered = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val statics = staticCache
|
||||||
|
if (statics != null) {
|
||||||
|
var i = 0
|
||||||
|
val len = statics.length
|
||||||
|
|
||||||
|
while (i < len) {
|
||||||
|
renderPart(statics(i))
|
||||||
|
i += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val dynamics = dynamicCache
|
||||||
|
if (dynamics != null) {
|
||||||
|
var i = 0
|
||||||
|
val len = dynamics.length
|
||||||
|
|
||||||
|
while (i < len) {
|
||||||
|
renderPart(dynamics(i))
|
||||||
|
i += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rendered
|
||||||
|
}
|
||||||
|
|
||||||
def renderDynamic(pos: Vector3, frame: Float, pass: Int) {
|
def renderDynamic(pos: Vector3, frame: Float, pass: Int) {
|
||||||
partList.foreach(part => part.renderDynamic(pos, frame, pass: Int))
|
if (!hasDynamicParts) return
|
||||||
|
|
||||||
|
val dynamics = dynamicCache
|
||||||
|
if (dynamics != null) {
|
||||||
|
var i = 0
|
||||||
|
val len = dynamics.length
|
||||||
|
while (i < len) {
|
||||||
|
if (dynamics(i) != null) dynamics(i).renderDynamic(pos, frame, pass)
|
||||||
|
i += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def randomDisplayTick(random: Random) {}
|
def randomDisplayTick(random: Random) {}
|
||||||
|
|
||||||
override def shouldRenderInPass(pass: Int) = {
|
override def shouldRenderInPass(pass: Int) = {
|
||||||
MultipartRenderer.pass = pass
|
if (staticCache == null) updateRenderCache()
|
||||||
true
|
hasDynamicParts
|
||||||
}
|
}
|
||||||
|
|
||||||
override def getRenderBoundingBox = {
|
override def getRenderBoundingBox = {
|
||||||
val c = Cuboid6.full.copy
|
if (cachedRenderBounds == null) updateRenderCache()
|
||||||
partList.foreach(part => c.enclose(part.getRenderBounds))
|
cachedRenderBounds
|
||||||
c.add(Vector3.fromTileEntity(this)).toAABB
|
}
|
||||||
|
|
||||||
|
override def markRender(): Unit = {
|
||||||
|
super.markRender()
|
||||||
|
updateRenderCache()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package codechicken.multipart.handler
|
||||||
|
|
||||||
|
import com.cardinalstar.cubicchunks.api.event.CubeEvent
|
||||||
|
import cpw.mods.fml.common.eventhandler.{EventPriority, SubscribeEvent}
|
||||||
|
import net.minecraftforge.common.MinecraftForge
|
||||||
|
import scala.collection.JavaConversions._
|
||||||
|
|
||||||
|
object CubicChunksCompat {
|
||||||
|
def init(): Unit = MinecraftForge.EVENT_BUS.register(this)
|
||||||
|
|
||||||
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
|
def onTileEntitiesLoad(event: CubeEvent.DataLoad): Unit = {
|
||||||
|
val cube = event.cube
|
||||||
|
val world = event.world
|
||||||
|
|
||||||
|
MultipartSaveLoad.loadTiles(world, cube.cubeTileEntityMap)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,30 +1,28 @@
|
|||||||
package codechicken.multipart.handler
|
package codechicken.multipart.handler
|
||||||
|
|
||||||
import codechicken.multipart.{
|
import codechicken.multipart.{BlockMultipart, TileCache, TileMultipart}
|
||||||
TileCache,
|
|
||||||
TileMultipart,
|
|
||||||
MultiPartRegistry,
|
|
||||||
BlockMultipart
|
|
||||||
}
|
|
||||||
import cpw.mods.fml.common.eventhandler.{EventPriority, SubscribeEvent}
|
import cpw.mods.fml.common.eventhandler.{EventPriority, SubscribeEvent}
|
||||||
import net.minecraft.server.MinecraftServer
|
|
||||||
import codechicken.lib.packet.PacketCustom
|
|
||||||
import net.minecraftforge.event.world._
|
|
||||||
import java.util.EnumSet
|
|
||||||
import scala.collection.JavaConverters._
|
|
||||||
import java.util.List
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly
|
|
||||||
import cpw.mods.fml.relauncher.Side
|
|
||||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent
|
|
||||||
import net.minecraft.util.MovingObjectPosition
|
|
||||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType
|
|
||||||
import cpw.mods.fml.common.gameevent.TickEvent
|
import cpw.mods.fml.common.gameevent.TickEvent
|
||||||
|
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP
|
||||||
|
import net.minecraft.server.MinecraftServer
|
||||||
|
import net.minecraft.tileentity.TileEntity
|
||||||
|
import net.minecraft.util.MovingObjectPosition.MovingObjectType
|
||||||
|
import net.minecraft.world.ChunkPosition
|
||||||
|
import net.minecraftforge.client.event.DrawBlockHighlightEvent
|
||||||
|
import net.minecraftforge.event.world._
|
||||||
|
|
||||||
|
import java.util.List
|
||||||
|
import scala.collection.JavaConverters._
|
||||||
|
|
||||||
object MultipartEventHandler {
|
object MultipartEventHandler {
|
||||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
def tileEntityLoad(event: ChunkDataEvent.Load) {
|
def tileEntityLoad(event: ChunkDataEvent.Load) {
|
||||||
MultipartSaveLoad.loadTiles(event.getChunk)
|
MultipartSaveLoad.loadTiles(
|
||||||
|
event.getChunk.worldObj,
|
||||||
|
event.getChunk.chunkTileEntityMap
|
||||||
|
.asInstanceOf[java.util.Map[ChunkPosition, TileEntity]]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
package codechicken.multipart.handler
|
package codechicken.multipart.handler
|
||||||
|
|
||||||
import cpw.mods.fml.common.Mod
|
import cpw.mods.fml.common.Mod
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent
|
import cpw.mods.fml.common.event.{
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent
|
FMLInitializationEvent,
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent
|
FMLPostInitializationEvent,
|
||||||
|
FMLPreInitializationEvent,
|
||||||
|
FMLServerAboutToStartEvent,
|
||||||
|
FMLServerStoppedEvent
|
||||||
|
}
|
||||||
import cpw.mods.fml.common.Mod.EventHandler
|
import cpw.mods.fml.common.Mod.EventHandler
|
||||||
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent
|
import codechicken.multipart.{ControlKeyModifer, MultiPartRegistry, Tags}
|
||||||
import codechicken.multipart.MultiPartRegistry
|
|
||||||
import codechicken.multipart.Tags
|
|
||||||
|
|
||||||
@Mod(
|
@Mod(
|
||||||
modid = "ForgeMultipart",
|
modid = "ForgeMultipart",
|
||||||
@@ -39,4 +41,10 @@ object MultipartMod {
|
|||||||
def beforeServerStart(event: FMLServerAboutToStartEvent) {
|
def beforeServerStart(event: FMLServerAboutToStartEvent) {
|
||||||
MultiPartRegistry.beforeServerStart()
|
MultiPartRegistry.beforeServerStart()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
def serverStopped(event: FMLServerStoppedEvent) {
|
||||||
|
MultipartSaveLoad.loadingWorld = null;
|
||||||
|
ControlKeyModifer.map.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,14 +2,16 @@ package codechicken.multipart.handler
|
|||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
import net.minecraft.nbt.NBTTagCompound
|
import net.minecraft.nbt.NBTTagCompound
|
||||||
|
|
||||||
import java.util.Map
|
import java.util.Map
|
||||||
import net.minecraft.world.chunk.Chunk
|
|
||||||
import net.minecraft.world.ChunkPosition
|
import net.minecraft.world.ChunkPosition
|
||||||
import codechicken.multipart.{MultipartHelper, TileMultipart}
|
import codechicken.multipart.{MultipartHelper, TileMultipart}
|
||||||
import codechicken.lib.asm.ObfMapping
|
import codechicken.lib.asm.ObfMapping
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
|
||||||
import scala.collection.mutable
|
import scala.collection.mutable
|
||||||
import codechicken.multipart.MultipartHelper.IPartTileConverter
|
import codechicken.multipart.MultipartHelper.IPartTileConverter
|
||||||
|
|
||||||
import scala.collection.JavaConversions._
|
import scala.collection.JavaConversions._
|
||||||
|
|
||||||
/** Hack due to lack of TileEntityLoadEvent in forge
|
/** Hack due to lack of TileEntityLoadEvent in forge
|
||||||
@@ -58,12 +60,9 @@ object MultipartSaveLoad {
|
|||||||
field.get(null).asInstanceOf[Map[Class[_ <: TileEntity], String]]
|
field.get(null).asInstanceOf[Map[Class[_ <: TileEntity], String]]
|
||||||
}
|
}
|
||||||
|
|
||||||
def loadTiles(chunk: Chunk) {
|
def loadTiles(world: World, tiles: Map[ChunkPosition, TileEntity]) {
|
||||||
loadingWorld = chunk.worldObj
|
loadingWorld = world
|
||||||
val iterator = chunk.chunkTileEntityMap
|
val iterator = tiles.entrySet.iterator
|
||||||
.asInstanceOf[Map[ChunkPosition, TileEntity]]
|
|
||||||
.entrySet
|
|
||||||
.iterator
|
|
||||||
while (iterator.hasNext) {
|
while (iterator.hasNext) {
|
||||||
val e = iterator.next
|
val e = iterator.next
|
||||||
var next = false
|
var next = false
|
||||||
@@ -88,7 +87,7 @@ object MultipartSaveLoad {
|
|||||||
|
|
||||||
if (!next) {
|
if (!next) {
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
t.setWorldObj(e.getValue.getWorldObj)
|
t.setWorldObj(world)
|
||||||
t.validate()
|
t.validate()
|
||||||
e.setValue(t)
|
e.setValue(t)
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -82,7 +82,11 @@ object MultipartCPH extends MultipartPH with IClientPacketHandler {
|
|||||||
for (i <- 0 until num)
|
for (i <- 0 until num)
|
||||||
TileMultipart.handleDescPacket(
|
TileMultipart.handleDescPacket(
|
||||||
world,
|
world,
|
||||||
indexInChunk(cc, packet.readShort),
|
new BlockCoord(
|
||||||
|
packet.readByte + (cc.chunkXPos << 4),
|
||||||
|
packet.readInt,
|
||||||
|
packet.readByte + (cc.chunkZPos << 4)
|
||||||
|
),
|
||||||
packet
|
packet
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -220,7 +224,9 @@ object MultipartSPH
|
|||||||
while (it.hasNext) {
|
while (it.hasNext) {
|
||||||
val tile = it.next
|
val tile = it.next
|
||||||
if (tile.isInstanceOf[TileMultipart]) {
|
if (tile.isInstanceOf[TileMultipart]) {
|
||||||
s.writeShort(indexInChunk(new BlockCoord(tile)))
|
s.writeByte(tile.xCoord & 0xf)
|
||||||
|
s.writeInt(tile.yCoord)
|
||||||
|
s.writeByte(tile.zCoord & 0xf)
|
||||||
tile.asInstanceOf[TileMultipart].writeDesc(s)
|
tile.asInstanceOf[TileMultipart].writeDesc(s)
|
||||||
num += 1
|
num += 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import codechicken.lib.packet.PacketCustom
|
|||||||
import net.minecraft.world.ChunkCoordIntPair
|
import net.minecraft.world.ChunkCoordIntPair
|
||||||
import codechicken.lib.vec.BlockCoord
|
import codechicken.lib.vec.BlockCoord
|
||||||
import codechicken.lib.world.{TileChunkLoadHook, WorldExtensionManager}
|
import codechicken.lib.world.{TileChunkLoadHook, WorldExtensionManager}
|
||||||
import cpw.mods.fml.common.FMLCommonHandler
|
import cpw.mods.fml.common.{FMLCommonHandler, Loader}
|
||||||
import cpw.mods.fml.common.registry.GameRegistry
|
import cpw.mods.fml.common.registry.GameRegistry
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import org.apache.logging.log4j.Logger
|
import org.apache.logging.log4j.Logger
|
||||||
@@ -29,7 +29,7 @@ class MultipartProxy_serverImpl {
|
|||||||
.setComment("Multipart API config file")
|
.setComment("Multipart API config file")
|
||||||
|
|
||||||
GameRegistry.registerBlock(
|
GameRegistry.registerBlock(
|
||||||
new BlockMultipart().setBlockName("multipart"),
|
new BlockMultipart().setBlockName("codechicken/multipart"),
|
||||||
null,
|
null,
|
||||||
"block"
|
"block"
|
||||||
)
|
)
|
||||||
@@ -90,6 +90,8 @@ class MultipartProxy_serverImpl {
|
|||||||
TileChunkLoadHook.init()
|
TileChunkLoadHook.init()
|
||||||
|
|
||||||
MultipartCompatiblity.load()
|
MultipartCompatiblity.load()
|
||||||
|
if (Loader.isModLoaded("cubicchunks"))
|
||||||
|
CubicChunksCompat.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
def onTileClassBuilt(t: Class[_ <: TileEntity]) {
|
def onTileClassBuilt(t: Class[_ <: TileEntity]) {
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package codechicken.multipart.mixin.early;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.multiplayer.WorldClient;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.client.renderer.RenderGlobal;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.client.model.ModelISBRH;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
|
|
||||||
|
import codechicken.multipart.JsonModeledPart;
|
||||||
|
import codechicken.multipart.RenderPartResolver;
|
||||||
|
import codechicken.multipart.TMultiPart;
|
||||||
|
|
||||||
|
@Mixin(RenderGlobal.class)
|
||||||
|
public class MixinRenderGlobal {
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private WorldClient theWorld;
|
||||||
|
|
||||||
|
@Redirect(
|
||||||
|
method = "drawBlockDamageTexture(Lnet/minecraft/client/renderer/Tessellator;Lnet/minecraft/entity/EntityLivingBase;F)V",
|
||||||
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/client/multiplayer/WorldClient;getBlock(III)Lnet/minecraft/block/Block;"))
|
||||||
|
private Block forgemultipart$redirectDamageBlock(WorldClient world, int x, int y, int z) {
|
||||||
|
Block block = world.getBlock(x, y, z);
|
||||||
|
TMultiPart part = RenderPartResolver.resolve(world, x, y, z);
|
||||||
|
if (part instanceof JsonModeledPart) {
|
||||||
|
return ((JsonModeledPart) part).getBlock();
|
||||||
|
}
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
@WrapOperation(
|
||||||
|
method = "drawBlockDamageTexture(Lnet/minecraft/client/renderer/Tessellator;Lnet/minecraft/entity/EntityLivingBase;F)V",
|
||||||
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/client/renderer/RenderBlocks;renderBlockUsingTexture(Lnet/minecraft/block/Block;IIILnet/minecraft/util/IIcon;)V"))
|
||||||
|
private void forgemultipart$redirectBreakingModeledPartDraw(RenderBlocks instance, Block block, int x, int y, int z,
|
||||||
|
IIcon overrideTexture, Operation<Void> original) {
|
||||||
|
TMultiPart candidatePart = RenderPartResolver.resolve(theWorld, x, y, z);
|
||||||
|
if (candidatePart instanceof JsonModeledPart) {
|
||||||
|
JsonModeledPart part = (JsonModeledPart) candidatePart;
|
||||||
|
|
||||||
|
instance.setOverrideBlockTexture(overrideTexture);
|
||||||
|
try {
|
||||||
|
ModelISBRH.INSTANCE.get().renderWorldBlock(
|
||||||
|
part.getRenderWorld(),
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
part.getBlock(),
|
||||||
|
ModelISBRH.JSON_ISBRH_ID,
|
||||||
|
instance);
|
||||||
|
} finally {
|
||||||
|
instance.clearOverrideBlockTexture();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
original.call(instance, block, x, y, z, overrideTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||