Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7808254465 | ||
|
|
71340a23ef | ||
|
|
2d050bdd08 | ||
|
|
f10595d062 | ||
|
|
7221176efd | ||
|
|
aa7d02cfb0 | ||
|
|
d2ce5b7362 | ||
|
|
09e2b847fc | ||
|
|
faa052f70c | ||
|
|
15298cb677 | ||
|
|
d3054211db | ||
|
|
732f64a1b4 | ||
|
|
2a5e2a150f | ||
|
|
1a4edfbc89 | ||
|
|
525fcc56ad | ||
|
|
a36120fc91 | ||
|
|
238b041f12 | ||
|
|
0b0e99024d | ||
|
|
a1db9a100e | ||
|
|
3c42abd7ac | ||
|
|
f3a0ab0568 | ||
|
|
a0af5e19cf | ||
|
|
3f27188181 | ||
|
|
4fc6b9cff2 | ||
|
|
ef67761bc3 | ||
|
|
d50ec43d76 | ||
|
|
05eb683a33 | ||
|
|
11b6142320 | ||
|
|
de264540d2 | ||
|
|
bc3542efd2 | ||
|
|
ad7a1d3cea | ||
|
|
1bd4ef4a0f | ||
|
|
439243b00a | ||
|
|
38a2bf629f | ||
|
|
2abb775696 | ||
|
|
b60993f39b | ||
|
|
76a1df6eff | ||
|
|
25b74b4bbc | ||
|
|
f4a9610e22 | ||
|
|
3a01a5bd21 | ||
|
|
83feeeec8e | ||
|
|
901dfcb5a0 | ||
|
|
794c3ca030 | ||
|
|
ee37e779fd | ||
|
|
5039fb8984 | ||
|
|
cb276d92f5 | ||
|
|
d336cfbb67 |
No files matched your search
@@ -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,5 +25,6 @@ whitelist.json
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
src/main/resources/mixins.*.json
|
||||
src/main/resources/mixins.*.refmap.json
|
||||
*.bat
|
||||
layout.json
|
||||
@@ -1,6 +1,15 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api("com.github.GTNewHorizons:CodeChickenLib:1.1.8:dev")
|
||||
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev")
|
||||
implementation("com.github.GTNewHorizons:CodeChickenCore:1.4.19:dev")
|
||||
compileOnly("com.cardinalstar.cubicchunks:CubicChunks1710:v0.1.8-alpha:dev")
|
||||
compileOnly("com.github.GTNewHorizons:Angelica:2.1.54:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Hodgepodge:2.7.174:dev")
|
||||
compileOnly("com.github.GTNewHorizons:Postea:1.2.5:dev") {transitive = false}
|
||||
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.8.114-GTNH:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'CodeChickenCore'
|
||||
}
|
||||
compileOnly("com.github.GTNewHorizons:GTNHLib:0.11.44:dev")
|
||||
// devOnlyNonPublishable("com.github.GTNewHorizons:Angelica:2.2.10:dev")
|
||||
devOnlyNonPublishable("io.github.legacymoddingmc:unimixins:0.1.23:dev")
|
||||
}
|
||||
@@ -1,59 +1,235 @@
|
||||
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
|
||||
# LOCAL to test local config updates.
|
||||
gtnh.settings.blowdryerTag = 0.2.0
|
||||
|
||||
# Human-readable mod name, available for mcmod.info population.
|
||||
modName = Forge Multipart
|
||||
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||
# Conventionally lowercase.
|
||||
modId = ForgeMultipart
|
||||
|
||||
# Root package of the mod, used to find various classes in other properties,
|
||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||
modGroup = codechicken
|
||||
|
||||
# WHY is there no version field?
|
||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
||||
# Will update your build.gradle automatically whenever an update is available
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# When false, com.github.GTNewHorizons is used.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
autoUpdateBuildScript = false
|
||||
|
||||
# Version of Minecraft to target
|
||||
minecraftVersion = 1.7.10
|
||||
|
||||
# Version of Minecraft Forge to target
|
||||
forgeVersion = 10.13.4.1614
|
||||
|
||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
|
||||
# restart Minecraft in development. Choose this dependent on your mod:
|
||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||
channel = stable
|
||||
|
||||
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||
mappingsVersion = 12
|
||||
|
||||
# Defines other MCP mappings for dependency deobfuscation.
|
||||
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
|
||||
# Select a default username for testing your mod. You can always override this per-run by running
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Define a source file of your project with:
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...])
|
||||
# Leave these properties empty to skip individual token replacements
|
||||
replaceGradleTokenInFile = Tags.java
|
||||
gradleTokenModId = GRADLETOKEN_MODID
|
||||
gradleTokenModName = GRADLETOKEN_MODNAME
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
gradleTokenGroupName = GRADLETOKEN_GROUPNAME
|
||||
# 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 = false
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
|
||||
# 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.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
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.
|
||||
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||
generateGradleTokenClass = codechicken.multipart.Tags
|
||||
|
||||
# Name of the token containing the project's current version to generate/replace.
|
||||
gradleTokenVersion = VERSION
|
||||
|
||||
# [DEPRECATED] Mod ID replacement token.
|
||||
gradleTokenModId =
|
||||
|
||||
# [DEPRECATED] Mod name replacement token.
|
||||
gradleTokenModName =
|
||||
|
||||
# [DEPRECATED] Mod Group replacement token.
|
||||
gradleTokenGroupName =
|
||||
|
||||
# [DEPRECATED]
|
||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...]).
|
||||
# Leave these properties empty to skip individual token replacements.
|
||||
replaceGradleTokenInFile =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||
# leave this property empty.
|
||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
||||
apiPackage =
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
||||
# Example value: mymodid_at.cfg
|
||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||
# There can be multiple files in a space-separated list.
|
||||
# Example value: mymodid_at.cfg nei_at.cfg
|
||||
accessTransformersFile = multipart_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
# Specify the location of your implementation of IMixinPlugin. Leave it empty otherwise.
|
||||
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 = mixin
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = true
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
mixinsPackage =
|
||||
|
||||
# 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.
|
||||
mixinsPackage = multipart.mixin
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatability only
|
||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass = core.launch.DepLoader
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
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
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
containsMixinsAndOrCoreModOnly = false
|
||||
|
||||
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
|
||||
# responsibility check the licence and request permission for distribution, if required.
|
||||
usesShadowedDependencies = false
|
||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||
forceEnableMixins = false
|
||||
|
||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||
# responsibility to check the license and request permission for distribution if required.
|
||||
usesShadowedDependencies = false
|
||||
|
||||
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
||||
# their own classes, making the minimization unreliable.
|
||||
minimizeShadowedDependencies = true
|
||||
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Adds 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.
|
||||
usesMavenPublishing = true
|
||||
|
||||
# Maven repository to publish the mod to.
|
||||
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||
|
||||
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||
#
|
||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||
# Leave this empty if you don't want to publish to Modrinth.
|
||||
modrinthProjectId =
|
||||
|
||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||
# 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.
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
#
|
||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# 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],
|
||||
# and the name is the CurseForge project slug of the other mod.
|
||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
curseForgeRelations =
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||
# 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.
|
||||
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
||||
# versionPattern =
|
||||
|
||||
# Uncomment to prevent the source code from being published.
|
||||
# noPublishedSources = true
|
||||
|
||||
# Uncomment this to disable Spotless checks.
|
||||
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||
# disableSpotless = true
|
||||
|
||||
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
||||
# disableCheckstyle = true
|
||||
|
||||
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
||||
# (force use delegated build).
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
||||
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
||||
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
||||
# ideaOverrideBuildType = idea
|
||||
|
||||
# Whether IDEA should run spotless checks when pressing the Build button.
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
|
||||
toolchainVersion=25
|
||||
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 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,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/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/.
|
||||
@@ -83,7 +85,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
# 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
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -111,7 +114,6 @@ 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.
|
||||
@@ -144,7 +146,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -152,7 +154,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -169,7 +171,6 @@ 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" )
|
||||
|
||||
@@ -201,16 +202,15 @@ fi
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_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" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
@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 ##########################################################################
|
||||
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
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
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,22 +59,21 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
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
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Add any additional repositiroes for your dependencies here
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
}
|
||||
@@ -4,10 +4,10 @@ pluginManagement {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name "GTNH Maven"
|
||||
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
allowInsecureProtocol = true
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons.retrofuturagradle")
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
gradlePluginPortal()
|
||||
@@ -17,12 +17,5 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
|
||||
}
|
||||
|
||||
blowdryerSetup {
|
||||
repoSubfolder 'gtnhShared'
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
|
||||
}
|
||||
@@ -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 |
@@ -6,6 +6,8 @@ item.microblock:sawIron.name=Iron Saw
|
||||
item.microblock:sawDiamond.name=Diamond Saw
|
||||
item.microblock:stoneRod.name=Stone Rod
|
||||
|
||||
item.microblock.name=Microblock
|
||||
|
||||
mcr_face.1.name=%s Cover
|
||||
mcr_face.1.subset=Cover
|
||||
mcr_face.2.name=%s Panel
|
||||
@@ -36,4 +38,4 @@ mcr_cnr.4.subset=Notch
|
||||
|
||||
nei.subsets.Microblocks=Microblocks
|
||||
|
||||
key.control=Switch block disposition
|
||||
key.control=Switch block disposition
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"repo": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.5.5/",
|
||||
"file": "CodeChickenLib-1.7.10-1.1.5.5.jar",
|
||||
"dev": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.5.5/CodeChickenLib-1.7.10-1.1.5.5-dev.jar",
|
||||
"class": "codechicken.lib.asm.ASMHelper",
|
||||
"coreLib": true
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -1,639 +0,0 @@
|
||||
package codechicken.core.launch;
|
||||
|
||||
import static java.awt.Component.LEFT_ALIGNMENT;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.awt.Dialog.ModalityType;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.WindowConstants;
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
import javax.swing.event.HyperlinkListener;
|
||||
|
||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import cpw.mods.fml.common.versioning.ComparableVersion;
|
||||
import cpw.mods.fml.relauncher.FMLInjectionData;
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import cpw.mods.fml.relauncher.IFMLCallHook;
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
import sun.misc.URLClassPath;
|
||||
import sun.net.util.URLUtil;
|
||||
|
||||
/**
|
||||
* For autodownloading stuff. This is really unoriginal, mostly ripped off FML, credits to cpw.
|
||||
*/
|
||||
public class DepLoader implements IFMLLoadingPlugin, IFMLCallHook {
|
||||
|
||||
private static ByteBuffer downloadBuffer = ByteBuffer.allocateDirect(1 << 23);
|
||||
private static final String owner = "CB's DepLoader";
|
||||
private static DepLoadInst inst;
|
||||
|
||||
public interface IDownloadDisplay {
|
||||
|
||||
void resetProgress(int sizeGuess);
|
||||
|
||||
void setPokeThread(Thread currentThread);
|
||||
|
||||
void updateProgress(int fullLength);
|
||||
|
||||
boolean shouldStopIt();
|
||||
|
||||
void updateProgressString(String string, Object... data);
|
||||
|
||||
Object makeDialog();
|
||||
|
||||
void showErrorDialog(String name, String url);
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class Downloader extends JOptionPane implements IDownloadDisplay {
|
||||
|
||||
private JDialog container;
|
||||
private JLabel currentActivity;
|
||||
private JProgressBar progress;
|
||||
boolean stopIt;
|
||||
Thread pokeThread;
|
||||
|
||||
private Box makeProgressPanel() {
|
||||
Box box = Box.createVerticalBox();
|
||||
box.add(Box.createRigidArea(new Dimension(0, 10)));
|
||||
JLabel welcomeLabel = new JLabel(
|
||||
"<html><b><font size='+1'>" + owner
|
||||
+ " is setting up your minecraft environment</font></b></html>");
|
||||
box.add(welcomeLabel);
|
||||
welcomeLabel.setAlignmentY(LEFT_ALIGNMENT);
|
||||
welcomeLabel = new JLabel(
|
||||
"<html>Please wait, " + owner + " has some tasks to do before you can play</html>");
|
||||
welcomeLabel.setAlignmentY(LEFT_ALIGNMENT);
|
||||
box.add(welcomeLabel);
|
||||
box.add(Box.createRigidArea(new Dimension(0, 10)));
|
||||
currentActivity = new JLabel("Currently doing ...");
|
||||
box.add(currentActivity);
|
||||
box.add(Box.createRigidArea(new Dimension(0, 10)));
|
||||
progress = new JProgressBar(0, 100);
|
||||
progress.setStringPainted(true);
|
||||
box.add(progress);
|
||||
box.add(Box.createRigidArea(new Dimension(0, 30)));
|
||||
return box;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JDialog makeDialog() {
|
||||
if (container != null) return container;
|
||||
|
||||
setMessageType(JOptionPane.INFORMATION_MESSAGE);
|
||||
setMessage(makeProgressPanel());
|
||||
setOptions(new Object[] { "Stop" });
|
||||
addPropertyChangeListener(new PropertyChangeListener() {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (evt.getSource() == Downloader.this && evt.getPropertyName() == VALUE_PROPERTY) {
|
||||
requestClose("This will stop minecraft from launching\nAre you sure you want to do this?");
|
||||
}
|
||||
}
|
||||
});
|
||||
container = new JDialog(null, "Hello", ModalityType.MODELESS);
|
||||
container.setResizable(false);
|
||||
container.setLocationRelativeTo(null);
|
||||
container.add(this);
|
||||
this.updateUI();
|
||||
container.pack();
|
||||
container.setMinimumSize(container.getPreferredSize());
|
||||
container.setVisible(true);
|
||||
container.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
container.addWindowListener(new WindowAdapter() {
|
||||
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
requestClose(
|
||||
"Closing this window will stop minecraft from launching\nAre you sure you wish to do this?");
|
||||
}
|
||||
});
|
||||
return container;
|
||||
}
|
||||
|
||||
protected void requestClose(String message) {
|
||||
int shouldClose = JOptionPane.showConfirmDialog(
|
||||
container,
|
||||
message,
|
||||
"Are you sure you want to stop?",
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
if (shouldClose == JOptionPane.YES_OPTION) container.dispose();
|
||||
|
||||
stopIt = true;
|
||||
if (pokeThread != null) pokeThread.interrupt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressString(String progressUpdate, Object... data) {
|
||||
// FMLLog.finest(progressUpdate, data);
|
||||
if (currentActivity != null) currentActivity.setText(String.format(progressUpdate, data));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetProgress(int sizeGuess) {
|
||||
if (progress != null) progress.getModel().setRangeProperties(0, 0, 0, sizeGuess, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(int fullLength) {
|
||||
if (progress != null) progress.getModel().setValue(fullLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPokeThread(Thread currentThread) {
|
||||
this.pokeThread = currentThread;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldStopIt() {
|
||||
return stopIt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showErrorDialog(String name, String url) {
|
||||
JEditorPane ep = new JEditorPane(
|
||||
"text/html",
|
||||
"<html>" + owner
|
||||
+ " was unable to download required library "
|
||||
+ name
|
||||
+ "<br>Check your internet connection and try restarting or download it manually from"
|
||||
+ "<br><a href=\""
|
||||
+ url
|
||||
+ "\">"
|
||||
+ url
|
||||
+ "</a> and put it in your mods folder"
|
||||
+ "</html>");
|
||||
|
||||
ep.setEditable(false);
|
||||
ep.setOpaque(false);
|
||||
ep.addHyperlinkListener(new HyperlinkListener() {
|
||||
|
||||
@Override
|
||||
public void hyperlinkUpdate(HyperlinkEvent event) {
|
||||
try {
|
||||
if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED))
|
||||
Desktop.getDesktop().browse(event.getURL().toURI());
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
});
|
||||
|
||||
JOptionPane.showMessageDialog(null, ep, "A download error has occured", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
public static class DummyDownloader implements IDownloadDisplay {
|
||||
|
||||
@Override
|
||||
public void resetProgress(int sizeGuess) {}
|
||||
|
||||
@Override
|
||||
public void setPokeThread(Thread currentThread) {}
|
||||
|
||||
@Override
|
||||
public void updateProgress(int fullLength) {}
|
||||
|
||||
@Override
|
||||
public boolean shouldStopIt() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressString(String string, Object... data) {}
|
||||
|
||||
@Override
|
||||
public Object makeDialog() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showErrorDialog(String name, String url) {}
|
||||
}
|
||||
|
||||
public static class VersionedFile {
|
||||
|
||||
public final Pattern pattern;
|
||||
public final String filename;
|
||||
public final ComparableVersion version;
|
||||
public final String name;
|
||||
|
||||
public VersionedFile(String filename, Pattern pattern) {
|
||||
this.pattern = pattern;
|
||||
this.filename = filename;
|
||||
Matcher m = pattern.matcher(filename);
|
||||
if (m.matches()) {
|
||||
name = m.group(1);
|
||||
version = new ComparableVersion(m.group(2));
|
||||
} else {
|
||||
name = null;
|
||||
version = null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean matches() {
|
||||
return name != null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Dependency {
|
||||
|
||||
public String url;
|
||||
public VersionedFile file;
|
||||
|
||||
public String existing;
|
||||
/**
|
||||
* Flag set to add this dep to the classpath immediately because it is required for a coremod.
|
||||
*/
|
||||
public boolean coreLib;
|
||||
|
||||
public Dependency(String url, VersionedFile file, boolean coreLib) {
|
||||
this.url = url;
|
||||
this.file = file;
|
||||
this.coreLib = coreLib;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DepLoadInst {
|
||||
|
||||
private File modsDir;
|
||||
private File v_modsDir;
|
||||
private IDownloadDisplay downloadMonitor;
|
||||
private JDialog popupWindow;
|
||||
|
||||
private Map<String, Dependency> depMap = new HashMap<String, Dependency>();
|
||||
private HashSet<String> depSet = new HashSet<String>();
|
||||
|
||||
public DepLoadInst() {
|
||||
String mcVer = (String) FMLInjectionData.data()[4];
|
||||
File mcDir = (File) FMLInjectionData.data()[6];
|
||||
|
||||
modsDir = new File(mcDir, "mods");
|
||||
v_modsDir = new File(mcDir, "mods/" + mcVer);
|
||||
if (!v_modsDir.exists()) v_modsDir.mkdirs();
|
||||
}
|
||||
|
||||
private void addClasspath(String name) {
|
||||
try {
|
||||
((LaunchClassLoader) DepLoader.class.getClassLoader())
|
||||
.addURL(new File(v_modsDir, name).toURI().toURL());
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteMod(File mod) {
|
||||
if (mod.delete()) return;
|
||||
|
||||
try {
|
||||
ClassLoader cl = DepLoader.class.getClassLoader();
|
||||
URL url = mod.toURI().toURL();
|
||||
Field f_ucp = URLClassLoader.class.getDeclaredField("ucp");
|
||||
Field f_loaders = URLClassPath.class.getDeclaredField("loaders");
|
||||
Field f_lmap = URLClassPath.class.getDeclaredField("lmap");
|
||||
f_ucp.setAccessible(true);
|
||||
f_loaders.setAccessible(true);
|
||||
f_lmap.setAccessible(true);
|
||||
|
||||
URLClassPath ucp = (URLClassPath) f_ucp.get(cl);
|
||||
Closeable loader = ((Map<String, Closeable>) f_lmap.get(ucp)).remove(URLUtil.urlNoFragString(url));
|
||||
if (loader != null) {
|
||||
loader.close();
|
||||
((List<?>) f_loaders.get(ucp)).remove(loader);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (!mod.delete()) {
|
||||
mod.deleteOnExit();
|
||||
String msg = owner + " was unable to delete file "
|
||||
+ mod.getPath()
|
||||
+ " the game will now try to delete it on exit. If this dialog appears again, delete it manually.";
|
||||
System.err.println(msg);
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
JOptionPane.showMessageDialog(null, msg, "An update error has occured", JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private void download(Dependency dep) {
|
||||
popupWindow = (JDialog) downloadMonitor.makeDialog();
|
||||
File libFile = new File(v_modsDir, dep.file.filename);
|
||||
try {
|
||||
URL libDownload = new URL(dep.url + '/' + dep.file.filename);
|
||||
downloadMonitor.updateProgressString("Downloading file %s", libDownload.toString());
|
||||
System.out.format("Downloading file %s\n", libDownload.toString());
|
||||
URLConnection connection = libDownload.openConnection();
|
||||
connection.setConnectTimeout(5000);
|
||||
connection.setReadTimeout(5000);
|
||||
connection.setRequestProperty("User-Agent", "" + owner + " Downloader");
|
||||
int sizeGuess = connection.getContentLength();
|
||||
download(connection.getInputStream(), sizeGuess, libFile);
|
||||
downloadMonitor.updateProgressString("Download complete");
|
||||
System.out.println("Download complete");
|
||||
|
||||
scanDepInfo(libFile);
|
||||
} catch (Exception e) {
|
||||
libFile.delete();
|
||||
if (downloadMonitor.shouldStopIt()) {
|
||||
System.err.println("You have stopped the downloading operation before it could complete");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
downloadMonitor.showErrorDialog(dep.file.filename, dep.url + '/' + dep.file.filename);
|
||||
throw new RuntimeException("A download error occured", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void download(InputStream is, int sizeGuess, File target) throws Exception {
|
||||
if (sizeGuess > downloadBuffer.capacity()) throw new Exception(
|
||||
String.format(
|
||||
"The file %s is too large to be downloaded by " + owner + " - the download is invalid",
|
||||
target.getName()));
|
||||
|
||||
downloadBuffer.clear();
|
||||
|
||||
int bytesRead, fullLength = 0;
|
||||
|
||||
downloadMonitor.resetProgress(sizeGuess);
|
||||
try {
|
||||
downloadMonitor.setPokeThread(Thread.currentThread());
|
||||
byte[] smallBuffer = new byte[1024];
|
||||
while ((bytesRead = is.read(smallBuffer)) >= 0) {
|
||||
downloadBuffer.put(smallBuffer, 0, bytesRead);
|
||||
fullLength += bytesRead;
|
||||
if (downloadMonitor.shouldStopIt()) {
|
||||
break;
|
||||
}
|
||||
downloadMonitor.updateProgress(fullLength);
|
||||
}
|
||||
is.close();
|
||||
downloadMonitor.setPokeThread(null);
|
||||
downloadBuffer.limit(fullLength);
|
||||
downloadBuffer.position(0);
|
||||
} catch (InterruptedIOException e) {
|
||||
// We were interrupted by the stop button. We're stopping now.. clear interruption flag.
|
||||
Thread.interrupted();
|
||||
throw new Exception("Stop");
|
||||
} catch (IOException e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
try {
|
||||
/*
|
||||
* String cksum = generateChecksum(downloadBuffer); if (cksum.equals(validationHash)) {
|
||||
*/
|
||||
if (!target.exists()) target.createNewFile();
|
||||
|
||||
downloadBuffer.position(0);
|
||||
FileOutputStream fos = new FileOutputStream(target);
|
||||
fos.getChannel().write(downloadBuffer);
|
||||
fos.close();
|
||||
/*
|
||||
* } else { throw new RuntimeException(String.
|
||||
* format("The downloaded file %s has an invalid checksum %s (expecting %s). The download did not succeed correctly and the file has been deleted. Please try launching again."
|
||||
* , target.getName(), cksum, validationHash)); }
|
||||
*/
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private String checkExisting(Dependency dep) {
|
||||
for (File f : modsDir.listFiles()) {
|
||||
VersionedFile vfile = new VersionedFile(f.getName(), dep.file.pattern);
|
||||
if (!vfile.matches() || !vfile.name.equals(dep.file.name)) continue;
|
||||
|
||||
if (f.renameTo(new File(v_modsDir, f.getName()))) continue;
|
||||
|
||||
deleteMod(f);
|
||||
}
|
||||
|
||||
for (File f : v_modsDir.listFiles()) {
|
||||
VersionedFile vfile = new VersionedFile(f.getName(), dep.file.pattern);
|
||||
if (!vfile.matches() || !vfile.name.equals(dep.file.name)) continue;
|
||||
|
||||
int cmp = vfile.version.compareTo(dep.file.version);
|
||||
if (cmp < 0) {
|
||||
System.out.println("Deleted old version " + f.getName());
|
||||
deleteMod(f);
|
||||
return null;
|
||||
}
|
||||
if (cmp > 0) {
|
||||
System.err.println(
|
||||
"Warning: version of " + dep.file.name
|
||||
+ ", "
|
||||
+ vfile.version
|
||||
+ " is newer than request "
|
||||
+ dep.file.version);
|
||||
return f.getName();
|
||||
}
|
||||
return f.getName(); // found dependency
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void load() {
|
||||
scanDepInfos();
|
||||
if (depMap.isEmpty()) return;
|
||||
|
||||
loadDeps();
|
||||
activateDeps();
|
||||
}
|
||||
|
||||
private void activateDeps() {
|
||||
for (Dependency dep : depMap.values()) if (dep.coreLib) addClasspath(dep.existing);
|
||||
}
|
||||
|
||||
private void loadDeps() {
|
||||
downloadMonitor = FMLLaunchHandler.side().isClient() ? new Downloader() : new DummyDownloader();
|
||||
try {
|
||||
while (!depSet.isEmpty()) {
|
||||
Iterator<String> it = depSet.iterator();
|
||||
Dependency dep = depMap.get(it.next());
|
||||
it.remove();
|
||||
load(dep);
|
||||
}
|
||||
} finally {
|
||||
if (popupWindow != null) {
|
||||
popupWindow.setVisible(false);
|
||||
popupWindow.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void load(Dependency dep) {
|
||||
dep.existing = checkExisting(dep);
|
||||
if (dep.existing == null) // download dep
|
||||
{
|
||||
download(dep);
|
||||
dep.existing = dep.file.filename;
|
||||
}
|
||||
}
|
||||
|
||||
private List<File> modFiles() {
|
||||
List<File> list = new LinkedList<File>();
|
||||
list.addAll(Arrays.asList(modsDir.listFiles()));
|
||||
list.addAll(Arrays.asList(v_modsDir.listFiles()));
|
||||
return list;
|
||||
}
|
||||
|
||||
private void scanDepInfos() {
|
||||
for (File file : modFiles()) {
|
||||
if (!file.getName().endsWith(".jar") && !file.getName().endsWith(".zip")) continue;
|
||||
|
||||
scanDepInfo(file);
|
||||
}
|
||||
}
|
||||
|
||||
private void scanDepInfo(File file) {
|
||||
try {
|
||||
ZipFile zip = new ZipFile(file);
|
||||
ZipEntry e = zip.getEntry("dependancies.info");
|
||||
if (e == null) e = zip.getEntry("dependencies.info");
|
||||
if (e != null) loadJSon(zip.getInputStream(e));
|
||||
zip.close();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Failed to load dependencies.info from " + file.getName() + " as JSON");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadJSon(InputStream input) throws IOException {
|
||||
InputStreamReader reader = new InputStreamReader(input);
|
||||
JsonElement root = new JsonParser().parse(reader);
|
||||
if (root.isJsonArray()) loadJSonArr(root);
|
||||
else loadJson(root.getAsJsonObject());
|
||||
reader.close();
|
||||
}
|
||||
|
||||
private void loadJSonArr(JsonElement root) throws IOException {
|
||||
for (JsonElement node : root.getAsJsonArray()) loadJson(node.getAsJsonObject());
|
||||
}
|
||||
|
||||
private void loadJson(JsonObject node) throws IOException {
|
||||
boolean obfuscated = ((LaunchClassLoader) DepLoader.class.getClassLoader())
|
||||
.getClassBytes("net.minecraft.world.World") == null;
|
||||
|
||||
String testClass = node.get("class").getAsString();
|
||||
if (DepLoader.class.getResource("/" + testClass.replace('.', '/') + ".class") != null) return;
|
||||
|
||||
String repo = node.get("repo").getAsString();
|
||||
String filename = node.get("file").getAsString();
|
||||
if (!obfuscated && node.has("dev")) filename = node.get("dev").getAsString();
|
||||
|
||||
boolean coreLib = node.has("coreLib") && node.get("coreLib").getAsBoolean();
|
||||
|
||||
Pattern pattern = null;
|
||||
try {
|
||||
if (node.has("pattern")) pattern = Pattern.compile(node.get("pattern").getAsString());
|
||||
} catch (PatternSyntaxException e) {
|
||||
System.err.println("Invalid filename pattern: " + node.get("pattern"));
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (pattern == null) pattern = Pattern.compile("(\\w+).*?([\\d\\.]+)[-\\w]*\\.[^\\d]+");
|
||||
|
||||
VersionedFile file = new VersionedFile(filename, pattern);
|
||||
if (!file.matches()) throw new RuntimeException("Invalid filename format for dependency: " + filename);
|
||||
|
||||
addDep(new Dependency(repo, file, coreLib));
|
||||
}
|
||||
|
||||
private void addDep(Dependency newDep) {
|
||||
if (mergeNew(depMap.get(newDep.file.name), newDep)) {
|
||||
depMap.put(newDep.file.name, newDep);
|
||||
depSet.add(newDep.file.name);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean mergeNew(Dependency oldDep, Dependency newDep) {
|
||||
if (oldDep == null) return true;
|
||||
|
||||
Dependency newest = newDep.file.version.compareTo(oldDep.file.version) > 0 ? newDep : oldDep;
|
||||
newest.coreLib = newDep.coreLib || oldDep.coreLib;
|
||||
|
||||
return newest == newDep;
|
||||
}
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
if (inst == null) {
|
||||
inst = new DepLoadInst();
|
||||
inst.load();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getASMTransformerClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModContainerClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSetupClass() {
|
||||
return getClass().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectData(Map<String, Object> data) {}
|
||||
|
||||
@Override
|
||||
public Void call() {
|
||||
load();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccessTransformerClass() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package codechicken.microblock
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.CapturingTessellator
|
||||
import net.coderbot.iris.Iris
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.client.renderer.Tessellator
|
||||
|
||||
class AngelicaCompat {
|
||||
def setShaderMaterialOverride(block: Block, meta: Int) = {
|
||||
try {
|
||||
if (Tessellator.instance.isInstanceOf[CapturingTessellator])
|
||||
Iris.setShaderMaterialOverride(block, meta)
|
||||
} catch {
|
||||
case ex: ClassCastException => Unit
|
||||
}
|
||||
}
|
||||
|
||||
def resetShaderMaterialOverride() = {
|
||||
try {
|
||||
if (Tessellator.instance.isInstanceOf[CapturingTessellator])
|
||||
Iris.resetShaderMaterialOverride()
|
||||
} catch {
|
||||
case ex: ClassCastException => Unit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,21 +10,35 @@ import codechicken.lib.vec.{Cuboid6, Vector3}
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import codechicken.lib.render.{
|
||||
CCRenderPipeline,
|
||||
ColourMultiplier,
|
||||
CCRenderState
|
||||
CCRenderState,
|
||||
ColourMultiplier
|
||||
}
|
||||
import codechicken.microblock.handler.MicroblockProxy
|
||||
import codechicken.microblock.handler.{MicroblockMod, MicroblockProxy}
|
||||
import net.minecraft.entity.Entity
|
||||
import codechicken.lib.render.uv.{UVTransformation, MultiIconTransformation}
|
||||
import cpw.mods.fml.common.registry.{GameRegistry, GameData}
|
||||
import codechicken.lib.render.uv.{MultiIconTransformation, UVTransformation}
|
||||
import cpw.mods.fml.common.registry.{GameData, GameRegistry}
|
||||
|
||||
import java.util.function.Supplier
|
||||
|
||||
private class ThreadState {
|
||||
var pass = 0
|
||||
var builder: CCRenderPipeline#PipelineBuilder = _
|
||||
}
|
||||
|
||||
object MaterialRenderHelper {
|
||||
private var pass = 0
|
||||
private var builder: CCRenderPipeline#PipelineBuilder = _
|
||||
private val threadState =
|
||||
ThreadLocal.withInitial[ThreadState](new Supplier[ThreadState]() {
|
||||
override def get(): ThreadState = new ThreadState()
|
||||
})
|
||||
def pass = threadState.get().pass
|
||||
def pass_=(pass: Int) = threadState.get().pass = pass
|
||||
def builder = threadState.get().builder
|
||||
def builder_=(builder: CCRenderPipeline#PipelineBuilder) =
|
||||
threadState.get().builder = builder
|
||||
|
||||
def start(pos: Vector3, pass: Int, uvt: UVTransformation) = {
|
||||
this.pass = pass
|
||||
builder = CCRenderState.pipeline.builder()
|
||||
builder = CCRenderState.instance().pipeline.builder()
|
||||
builder.add(pos.translation()).add(uvt)
|
||||
this
|
||||
}
|
||||
@@ -36,11 +50,21 @@ object MaterialRenderHelper {
|
||||
|
||||
def lighting() = {
|
||||
if (pass != -1)
|
||||
builder.add(CCRenderState.lightMatrix)
|
||||
builder.add(CCRenderState.instance().lightMatrix)
|
||||
this
|
||||
}
|
||||
|
||||
def render() = builder.render()
|
||||
def blockAndMeta(b: Block, meta: Int) = {
|
||||
if (MicroblockMod.angelicaCompat != null)
|
||||
MicroblockMod.angelicaCompat.setShaderMaterialOverride(b, meta)
|
||||
this
|
||||
}
|
||||
|
||||
def render(): Unit = {
|
||||
builder.render()
|
||||
if (MicroblockMod.angelicaCompat != null)
|
||||
MicroblockMod.angelicaCompat.resetShaderMaterialOverride()
|
||||
}
|
||||
}
|
||||
|
||||
/** Standard micro material class suitable for most blocks.
|
||||
@@ -78,6 +102,7 @@ class BlockMicroMaterial(val block: Block, val meta: Int = 0)
|
||||
.start(pos, pass, icont)
|
||||
.blockColour(getColour(pass))
|
||||
.lighting()
|
||||
.blockAndMeta(block, meta)
|
||||
.render()
|
||||
}
|
||||
|
||||
@@ -85,9 +110,10 @@ class BlockMicroMaterial(val block: Block, val meta: Int = 0)
|
||||
if (pass == -1)
|
||||
block.getBlockColor << 8 | 0xff
|
||||
else {
|
||||
val pos = CCRenderState.lightMatrix.pos
|
||||
val state = CCRenderState.instance
|
||||
val pos = state.lightMatrix.pos
|
||||
block.colorMultiplier(
|
||||
CCRenderState.lightMatrix.access,
|
||||
state.lightMatrix.access,
|
||||
pos.x,
|
||||
pos.y,
|
||||
pos.z
|
||||
|
||||
@@ -54,5 +54,7 @@ object DefaultContent {
|
||||
registerMaterial(new GrassMicroMaterial, materialKey(grass))
|
||||
MicroMaterialRegistry.remapName(oldKey(mycelium), materialKey(mycelium))
|
||||
registerMaterial(new TopMicroMaterial(mycelium), materialKey(mycelium))
|
||||
|
||||
registerMaterial(MissingMicroMaterial, MissingMicroMaterial.key)
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package codechicken.microblock
|
||||
|
||||
import codechicken.lib.vec.{Cuboid6, Vector3}
|
||||
import net.minecraft.block.Block
|
||||
import codechicken.lib.render.{ColourMultiplier, CCRenderState}
|
||||
import codechicken.lib.render.CCRenderState
|
||||
import net.minecraft.block.BlockGrass
|
||||
import net.minecraft.init.Blocks
|
||||
import codechicken.lib.render.uv.{UVTranslation, IconTransformation}
|
||||
@@ -17,7 +17,7 @@ class GrassMicroMaterial extends BlockMicroMaterial(Blocks.grass, 0) {
|
||||
}
|
||||
|
||||
override def renderMicroFace(pos: Vector3, pass: Int, bounds: Cuboid6) {
|
||||
val face = CCRenderState.model.asInstanceOf[BlockFace]
|
||||
val face = CCRenderState.instance().model.asInstanceOf[BlockFace]
|
||||
if (pass != -1)
|
||||
face.computeLightCoords()
|
||||
|
||||
@@ -26,6 +26,7 @@ class GrassMicroMaterial extends BlockMicroMaterial(Blocks.grass, 0) {
|
||||
.start(pos, pass, icont)
|
||||
.blockColour(getColour(pass))
|
||||
.lighting()
|
||||
.blockAndMeta(block, meta)
|
||||
.render()
|
||||
else
|
||||
MaterialRenderHelper.start(pos, pass, icont).lighting().render()
|
||||
@@ -35,6 +36,7 @@ class GrassMicroMaterial extends BlockMicroMaterial(Blocks.grass, 0) {
|
||||
.start(pos, pass, new UVTranslation(0, bounds.max.y - 1) ++ sideIconT)
|
||||
.blockColour(getColour(pass))
|
||||
.lighting()
|
||||
.blockAndMeta(block, meta)
|
||||
.render()
|
||||
}
|
||||
}
|
||||
@@ -42,18 +44,20 @@ class GrassMicroMaterial extends BlockMicroMaterial(Blocks.grass, 0) {
|
||||
class TopMicroMaterial($block: Block, $meta: Int = 0)
|
||||
extends BlockMicroMaterial($block, $meta) {
|
||||
override def renderMicroFace(pos: Vector3, pass: Int, bounds: Cuboid6) {
|
||||
val face = CCRenderState.model.asInstanceOf[BlockFace]
|
||||
val face = CCRenderState.instance().model.asInstanceOf[BlockFace]
|
||||
if (face.side <= 1)
|
||||
MaterialRenderHelper
|
||||
.start(pos, pass, icont)
|
||||
.blockColour(getColour(pass))
|
||||
.lighting()
|
||||
.blockAndMeta(block, meta)
|
||||
.render()
|
||||
else
|
||||
MaterialRenderHelper
|
||||
.start(pos, pass, new UVTranslation(0, bounds.max.y - 1) ++ icont)
|
||||
.blockColour(getColour(pass))
|
||||
.lighting()
|
||||
.blockAndMeta(block, meta)
|
||||
.render()
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import Vector3._
|
||||
import codechicken.lib.raytracer.IndexedCuboid6
|
||||
import org.lwjgl.opengl.GL11
|
||||
import codechicken.lib.render.uv.IconTransformation
|
||||
import codechicken.lib.lighting.LightMatrix
|
||||
|
||||
object HollowPlacement extends PlacementProperties {
|
||||
object HollowPlacementGrid extends FaceEdgeGrid(3 / 8d)
|
||||
@@ -74,8 +73,9 @@ trait HollowMicroblockClient
|
||||
}
|
||||
|
||||
override def drawBreaking(renderBlocks: RenderBlocks) {
|
||||
CCRenderState.reset()
|
||||
CCRenderState.setPipeline(
|
||||
val state = CCRenderState.instance
|
||||
state.resetInstance()
|
||||
state.setPipelineInstance(
|
||||
new Translation(x, y, z),
|
||||
new IconTransformation(renderBlocks.overrideBlockTexture)
|
||||
)
|
||||
|
||||
@@ -133,15 +133,18 @@ object ItemMicroPart {
|
||||
if (!stack.getTagCompound.hasKey("mat"))
|
||||
return null
|
||||
|
||||
return MicroMaterialRegistry.getMaterial(
|
||||
MicroMaterialRegistry.getMaterial(
|
||||
stack.getTagCompound.getString("mat")
|
||||
)
|
||||
) match {
|
||||
case null => MissingMicroMaterial
|
||||
case mat => mat
|
||||
}
|
||||
}
|
||||
|
||||
def getMaterialID(stack: ItemStack): Int = {
|
||||
checkTagCompound(stack)
|
||||
if (!stack.getTagCompound.hasKey("mat"))
|
||||
return 0
|
||||
return MicroMaterialRegistry.getMissingId
|
||||
|
||||
return MicroMaterialRegistry.materialID(
|
||||
stack.getTagCompound.getString("mat")
|
||||
@@ -170,17 +173,17 @@ object ItemMicroPartRenderer extends IItemRenderer {
|
||||
GL11.glScaled(0.5, 0.5, 0.5)
|
||||
if (t == ItemRenderType.INVENTORY || t == ItemRenderType.ENTITY)
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f)
|
||||
|
||||
TextureUtils.bindAtlas(0)
|
||||
CCRenderState.reset()
|
||||
CCRenderState.useNormals = true
|
||||
CCRenderState.pullLightmap()
|
||||
CCRenderState.startDrawing()
|
||||
val state = CCRenderState.instance
|
||||
state.resetInstance()
|
||||
state.useNormals = true
|
||||
state.pullLightmapInstance()
|
||||
state.startDrawingInstance()
|
||||
val part =
|
||||
mcrClass.create(true, getMaterialID(item)).asInstanceOf[MicroblockClient]
|
||||
part.setShape(size, mcrClass.itemSlot)
|
||||
part.render(new Vector3(0.5, 0.5, 0.5).subtract(part.getBounds.center), -1)
|
||||
CCRenderState.draw()
|
||||
state.drawInstance()
|
||||
GL11.glPopMatrix()
|
||||
}
|
||||
|
||||
|
||||
@@ -112,17 +112,17 @@ object ItemSawRenderer extends IItemRenderer {
|
||||
)
|
||||
case _ => return
|
||||
}
|
||||
|
||||
CCRenderState.reset()
|
||||
CCRenderState.useNormals = true
|
||||
CCRenderState.pullLightmap()
|
||||
val state = CCRenderState.instance
|
||||
state.resetInstance()
|
||||
state.useNormals = true
|
||||
state.pullLightmapInstance()
|
||||
CCRenderState.changeTexture("microblock:textures/items/saw.png")
|
||||
CCRenderState.startDrawing()
|
||||
state.startDrawingInstance()
|
||||
handle.render(t)
|
||||
holder.render(t)
|
||||
CCRenderState.draw()
|
||||
state.drawInstance()
|
||||
GL11.glDisable(GL11.GL_CULL_FACE)
|
||||
CCRenderState.startDrawing()
|
||||
state.startDrawingInstance()
|
||||
blade.render(
|
||||
t,
|
||||
new UVTranslation(
|
||||
@@ -130,7 +130,7 @@ object ItemSawRenderer extends IItemRenderer {
|
||||
(item.getItem.asInstanceOf[Saw].getCuttingStrength(item) - 1) * 4 / 64d
|
||||
)
|
||||
)
|
||||
CCRenderState.draw()
|
||||
state.drawInstance()
|
||||
GL11.glEnable(GL11.GL_CULL_FACE)
|
||||
}
|
||||
}
|
||||
@@ -114,6 +114,7 @@ object MicroMaterialRegistry {
|
||||
private var maxCuttingStrength: Int = _
|
||||
|
||||
private val remap = HashMap[String, String]()
|
||||
private var missingId: Int = 0
|
||||
|
||||
/** Register a micro material with unique identifier name
|
||||
*/
|
||||
@@ -162,8 +163,17 @@ object MicroMaterialRegistry {
|
||||
nameMap.clear()
|
||||
for (i <- 0 until idMap.length)
|
||||
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() {
|
||||
val it = Item.itemRegistry.iterator.asInstanceOf[JIterator[Item]]
|
||||
maxCuttingStrength = it.flatMap {
|
||||
@@ -216,7 +226,7 @@ object MicroMaterialRegistry {
|
||||
case Some(v) => v
|
||||
case None =>
|
||||
logger.error("Missing mapping for part with ID: " + name)
|
||||
0
|
||||
missingId
|
||||
}
|
||||
|
||||
def getMaterial(name: String) =
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.lwjgl.opengl.GL11._
|
||||
import codechicken.lib.render.{CCRenderState, TextureUtils}
|
||||
import codechicken.lib.render.BlockRenderer.BlockFace
|
||||
import codechicken.microblock.MicroMaterialRegistry.IMicroMaterial
|
||||
import java.util.function.Supplier
|
||||
|
||||
object MicroblockRender {
|
||||
def renderHighlight(
|
||||
@@ -31,6 +32,7 @@ object MicroblockRender {
|
||||
return
|
||||
val pos = placement.pos
|
||||
val part = placement.part.asInstanceOf[MicroblockClient]
|
||||
val state = CCRenderState.instance
|
||||
|
||||
glPushMatrix()
|
||||
glTranslated(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
|
||||
@@ -40,21 +42,23 @@ object MicroblockRender {
|
||||
glEnable(GL_BLEND)
|
||||
glDepthMask(false)
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
|
||||
|
||||
// TODO: update to use a thread local copy
|
||||
TextureUtils.bindAtlas(0)
|
||||
CCRenderState.reset()
|
||||
CCRenderState.alphaOverride = 80
|
||||
CCRenderState.useNormals = true
|
||||
CCRenderState.startDrawing()
|
||||
state.resetInstance()
|
||||
state.alphaOverride = 80
|
||||
state.useNormals = true
|
||||
state.startDrawingInstance()
|
||||
part.render(Vector3.zero, -1)
|
||||
CCRenderState.draw()
|
||||
state.drawInstance()
|
||||
|
||||
glDisable(GL_BLEND)
|
||||
glDepthMask(true)
|
||||
glPopMatrix()
|
||||
}
|
||||
|
||||
val face = new BlockFace()
|
||||
val face = ThreadLocal.withInitial[BlockFace](new Supplier[BlockFace]() {
|
||||
override def get(): BlockFace = new BlockFace()
|
||||
})
|
||||
def renderCuboid(
|
||||
pos: Vector3,
|
||||
mat: IMicroMaterial,
|
||||
@@ -62,9 +66,10 @@ object MicroblockRender {
|
||||
c: Cuboid6,
|
||||
faces: Int
|
||||
) {
|
||||
CCRenderState.setModel(face)
|
||||
val localFace = face.get()
|
||||
CCRenderState.instance().setModelInstance(localFace)
|
||||
for (s <- 0 until 6 if (faces & 1 << s) == 0) {
|
||||
face.loadCuboidFace(c, s)
|
||||
localFace.loadCuboidFace(c, s)
|
||||
mat.renderMicroFace(pos, pass, c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,25 @@ import cpw.mods.fml.common.event.FMLInitializationEvent
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent
|
||||
import cpw.mods.fml.common.Mod.EventHandler
|
||||
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent
|
||||
import codechicken.microblock.MicroMaterialRegistry
|
||||
import codechicken.microblock.DefaultContent
|
||||
import codechicken.microblock.{
|
||||
AngelicaCompat,
|
||||
ConfigContent,
|
||||
DefaultContent,
|
||||
MicroMaterialRegistry
|
||||
}
|
||||
import codechicken.multipart.Tags
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent
|
||||
import codechicken.microblock.ConfigContent
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent
|
||||
|
||||
import scala.collection.JavaConversions._
|
||||
|
||||
@Mod(
|
||||
modid = "ForgeMicroblock",
|
||||
name = "Forge Microblocks",
|
||||
acceptedMinecraftVersions = "[1.7.10]",
|
||||
dependencies = "required-after:ForgeMultipart",
|
||||
dependencies =
|
||||
"required-after:CodeChickenCore@[1.4.3,);required-after:ForgeMultipart",
|
||||
version = Tags.VERSION,
|
||||
modLanguage = "scala"
|
||||
)
|
||||
object MicroblockMod {
|
||||
@@ -47,4 +55,6 @@ object MicroblockMod {
|
||||
def handleIMC(event: IMCEvent) {
|
||||
ConfigContent.handleIMC(event.getMessages)
|
||||
}
|
||||
|
||||
var angelicaCompat: AngelicaCompat = null
|
||||
}
|
||||
@@ -26,7 +26,14 @@ object MicroblockCPH extends MicroblockPH with IClientPacketHandler {
|
||||
netHandler: INetHandlerPlayClient
|
||||
) {
|
||||
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.minecraftforge.oredict.ShapedOreRecipe
|
||||
import codechicken.lib.packet.PacketCustom
|
||||
import codechicken.microblock.compat.PosteaCompat
|
||||
import cpw.mods.fml.common.Loader
|
||||
import cpw.mods.fml.common.registry.GameRegistry
|
||||
import net.minecraft.client.renderer.RenderBlocks
|
||||
@@ -110,6 +111,9 @@ class MicroblockProxy_serverImpl {
|
||||
MicroblockSPH.registryChannel,
|
||||
MicroblockSPH
|
||||
)
|
||||
if (Loader.isModLoaded("postea")) {
|
||||
PosteaCompat.registerTransformers()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +127,9 @@ class MicroblockProxy_clientImpl extends MicroblockProxy_serverImpl {
|
||||
MicroMaterialRegistry.loadIcons()
|
||||
MinecraftForgeClient.registerItemRenderer(itemMicro, ItemMicroPartRenderer)
|
||||
PacketCustom.assignHandler(MicroblockCPH.registryChannel, MicroblockCPH)
|
||||
|
||||
if (Loader.isModLoaded("angelica"))
|
||||
MicroblockMod.angelicaCompat = new AngelicaCompat
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -3,7 +3,7 @@ package codechicken.multipart
|
||||
import java.util.List
|
||||
import java.lang.Iterable
|
||||
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.util.AxisAlignedBB
|
||||
import net.minecraft.world.World
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.util.Vec3
|
||||
import net.minecraft.util.MovingObjectPosition
|
||||
import codechicken.lib.raytracer.RayTracer
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
|
||||
import java.util.Random
|
||||
import java.util.ArrayList
|
||||
import net.minecraft.item.ItemStack
|
||||
@@ -68,7 +69,7 @@ object BlockMultipart {
|
||||
|
||||
/** 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._
|
||||
|
||||
override def hasTileEntity(meta: Int = 0) = true
|
||||
@@ -256,10 +257,7 @@ class BlockMultipart extends Block(Material.rock) {
|
||||
|
||||
override def getRenderBlockPass = 1
|
||||
|
||||
override def canRenderInPass(pass: Int): Boolean = {
|
||||
MultipartRenderer.pass = pass
|
||||
return true
|
||||
}
|
||||
override def canRenderInPass(pass: Int): Boolean = true
|
||||
|
||||
override def getPickBlock(
|
||||
hit: MovingObjectPosition,
|
||||
|
||||
@@ -18,10 +18,17 @@ object ControlKeyModifer {
|
||||
implicit def playerControlValue(p: EntityPlayer) = new ControlKeyValue(p)
|
||||
|
||||
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)
|
||||
var isClientPressing = false;
|
||||
|
||||
/** Implicit static for Java users.
|
||||
*/
|
||||
@@ -46,7 +53,7 @@ object ControlKeyHandler
|
||||
if (pressed != wasPressed) {
|
||||
wasPressed = pressed
|
||||
if (Minecraft.getMinecraft.getNetHandler != null) {
|
||||
map.put(Minecraft.getMinecraft.thePlayer, pressed)
|
||||
isClientPressing = pressed
|
||||
val packet = new PacketCustom(MultipartCPH.channel, 1)
|
||||
packet.writeBoolean(pressed)
|
||||
packet.sendToServer()
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -122,9 +122,14 @@ object MultipartGenerator extends ScratchBitSet {
|
||||
* adding it to the tick list
|
||||
*/
|
||||
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)
|
||||
if (chunk != null)
|
||||
chunk.func_150812_a(pos.x & 15, pos.y, pos.z & 15, tile)
|
||||
if (chunk != null) {
|
||||
chunk.addTileEntity(tile)
|
||||
}
|
||||
}
|
||||
|
||||
/** 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.RenderingRegistry
|
||||
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.tileentity.TileEntity
|
||||
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.Side
|
||||
import codechicken.lib.raytracer.ExtendedMOP
|
||||
import codechicken.lib.lighting.LightMatrix
|
||||
import codechicken.multipart.RenderPartResolver
|
||||
|
||||
/** Internal class for rendering callbacks. Should be moved to the handler
|
||||
* package
|
||||
@@ -23,7 +22,6 @@ object MultipartRenderer
|
||||
extends TileEntitySpecialRenderer
|
||||
with ISimpleBlockRenderingHandler {
|
||||
TileMultipart.renderID = RenderingRegistry.getNextAvailableRenderId
|
||||
var pass: Int = 0
|
||||
|
||||
override def renderTileEntityAt(
|
||||
t: TileEntity,
|
||||
@@ -33,15 +31,16 @@ object MultipartRenderer
|
||||
f: Float
|
||||
) {
|
||||
val tmpart = t.asInstanceOf[TileMultipartClient]
|
||||
if (tmpart.partList.isEmpty)
|
||||
if (tmpart.partList.isEmpty | !tmpart.hasDynamicParts)
|
||||
return
|
||||
|
||||
CCRenderState.reset()
|
||||
CCRenderState.pullLightmap()
|
||||
CCRenderState.useNormals = true
|
||||
val state = CCRenderState.instance
|
||||
state.resetInstance()
|
||||
state.pullLightmapInstance()
|
||||
state.useNormals = true
|
||||
|
||||
val pos = new Vector3(x, y, z)
|
||||
tmpart.renderDynamic(pos, f, pass)
|
||||
tmpart.renderDynamic(pos, f, MinecraftForgeClient.getRenderPass)
|
||||
}
|
||||
|
||||
override def getRenderId = TileMultipart.renderID
|
||||
@@ -64,26 +63,25 @@ object MultipartRenderer
|
||||
return false
|
||||
|
||||
if (renderer.hasOverrideBlockTexture) {
|
||||
val hit = Minecraft.getMinecraft.objectMouseOver
|
||||
if (
|
||||
hit != null && hit.blockX == x && hit.blockY == y && hit.blockZ == z && ExtendedMOP
|
||||
.getData(hit)
|
||||
.isInstanceOf[(_, _)]
|
||||
) {
|
||||
val hitInfo: (Int, _) = ExtendedMOP.getData(hit)
|
||||
if (
|
||||
hitInfo._1.isInstanceOf[
|
||||
Int
|
||||
] && hitInfo._1 >= 0 && hitInfo._1 < tmpart.partList.size
|
||||
)
|
||||
tmpart.partList(hitInfo._1).drawBreaking(renderer)
|
||||
val part =
|
||||
RenderPartResolver.resolve(world, x, y, z)
|
||||
if (part != null) {
|
||||
part match {
|
||||
case isbrh: ISBRHPart =>
|
||||
isbrh.renderWorldBlock(world, x, y, z, renderer)
|
||||
case _ =>
|
||||
part.drawBreaking(renderer)
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
CCRenderState.reset()
|
||||
CCRenderState.lightMatrix.locate(world, x, y, z)
|
||||
return tmpart.renderStatic(new Vector3(x, y, z), pass)
|
||||
val state = CCRenderState.instance
|
||||
state.resetInstance()
|
||||
state.lightMatrix.locate(world, x, y, z)
|
||||
val b = tmpart.renderStatic(world, new Vector3(x, y, z), renderer)
|
||||
state.lightMatrix.access = null
|
||||
b
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -31,8 +31,9 @@ trait TCuboidPart extends TMultiPart {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def drawBreaking(renderBlocks: RenderBlocks) {
|
||||
CCRenderState.reset()
|
||||
CCRenderState.setPipeline(
|
||||
val state = CCRenderState.instance
|
||||
state.resetInstance()
|
||||
state.setPipelineInstance(
|
||||
new Translation(x, y, z),
|
||||
new IconTransformation(renderBlocks.overrideBlockTexture)
|
||||
)
|
||||
|
||||
@@ -252,7 +252,9 @@ abstract class TMultiPart {
|
||||
* Incremental changes should be sent rather than the whole description
|
||||
* 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
|
||||
* parameter may be null if several things have changed.
|
||||
@@ -316,6 +318,12 @@ abstract class TMultiPart {
|
||||
*/
|
||||
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
|
||||
* false if another part in the space needs ticks.
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package codechicken.multipart
|
||||
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
|
||||
import scala.collection.mutable.ListBuffer
|
||||
import codechicken.lib.packet.PacketCustom
|
||||
import codechicken.lib.vec.{Cuboid6, BlockCoord, Vector3}
|
||||
import net.minecraft.world.World
|
||||
import codechicken.lib.vec.{BlockCoord, Cuboid6, Vector3}
|
||||
import net.minecraft.world.{IBlockAccess, World}
|
||||
|
||||
import java.util.List
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import codechicken.lib.data.MCDataOutput
|
||||
@@ -15,16 +17,22 @@ import codechicken.multipart.handler.{
|
||||
}
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.nbt.NBTTagList
|
||||
|
||||
import java.util.Random
|
||||
import net.minecraft.entity.item.EntityItem
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.entity.Entity
|
||||
|
||||
import scala.collection.JavaConversions._
|
||||
import java.util.Collection
|
||||
import codechicken.lib.raytracer.ExtendedMOP
|
||||
import net.minecraft.util.Vec3
|
||||
import net.minecraft.util.{AxisAlignedBB, Vec3}
|
||||
|
||||
import java.lang.Iterable
|
||||
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 {
|
||||
|
||||
@@ -70,7 +78,8 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
|
||||
val it = partList.iterator
|
||||
while (it.hasNext) {
|
||||
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() {
|
||||
super.validate()
|
||||
|
||||
if (worldObj != null && worldObj.isRemote)
|
||||
TileCache.add(this)
|
||||
}
|
||||
@@ -162,7 +172,20 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
|
||||
*/
|
||||
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) =
|
||||
partList.view.map(_.explosionResistance(entity)).max
|
||||
@@ -326,6 +349,8 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
|
||||
if (r < 0)
|
||||
throw new IllegalArgumentException("Tried to remove a non-existant part")
|
||||
|
||||
val removedLightValue = part.getLightValue
|
||||
|
||||
part.preRemove()
|
||||
partList = partList.filterNot(_ == part)
|
||||
|
||||
@@ -357,6 +382,7 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
|
||||
private[multipart] def loadParts(parts: scala.Iterable[TMultiPart]) {
|
||||
clearParts()
|
||||
parts.foreach(p => addPart_do(p))
|
||||
|
||||
if (worldObj != null) {
|
||||
if (worldObj.isRemote)
|
||||
operate(_.onWorldJoin())
|
||||
@@ -449,24 +475,161 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
|
||||
}
|
||||
|
||||
trait TileMultipartClient extends TileMultipart {
|
||||
def renderStatic(pos: Vector3, pass: Int) =
|
||||
partList.foldLeft(false)((r, part) => part.renderStatic(pos, pass) || r)
|
||||
private var cachedRenderBounds: AxisAlignedBB = null
|
||||
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) {
|
||||
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) {}
|
||||
|
||||
override def shouldRenderInPass(pass: Int) = {
|
||||
MultipartRenderer.pass = pass
|
||||
true
|
||||
if (staticCache == null) updateRenderCache()
|
||||
hasDynamicParts
|
||||
}
|
||||
|
||||
override def getRenderBoundingBox = {
|
||||
val c = Cuboid6.full.copy
|
||||
partList.foreach(part => c.enclose(part.getRenderBounds))
|
||||
c.add(Vector3.fromTileEntity(this)).toAABB
|
||||
if (cachedRenderBounds == null) updateRenderCache()
|
||||
cachedRenderBounds
|
||||
}
|
||||
|
||||
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,37 +1,38 @@
|
||||
package codechicken.multipart.handler
|
||||
|
||||
import codechicken.multipart.{
|
||||
TileCache,
|
||||
TileMultipart,
|
||||
MultiPartRegistry,
|
||||
BlockMultipart
|
||||
}
|
||||
import codechicken.multipart.{BlockMultipart, TileCache, TileMultipart}
|
||||
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.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 {
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
def tileEntityLoad(event: ChunkDataEvent.Load) {
|
||||
MultipartSaveLoad.loadTiles(event.getChunk)
|
||||
MultipartSaveLoad.loadTiles(
|
||||
event.getChunk.worldObj,
|
||||
event.getChunk.chunkTileEntityMap
|
||||
.asInstanceOf[java.util.Map[ChunkPosition, TileEntity]]
|
||||
)
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
def worldUnLoad(event: WorldEvent.Unload) {
|
||||
MultipartSPH.onWorldUnload(event.world)
|
||||
if (event.world.isRemote)
|
||||
if (event.world.isRemote) {
|
||||
TileCache.clear()
|
||||
} else {
|
||||
MultipartSaveLoad.loadingWorld = null
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
package codechicken.multipart.handler
|
||||
|
||||
import cpw.mods.fml.common.Mod
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent
|
||||
import cpw.mods.fml.common.event.{
|
||||
FMLInitializationEvent,
|
||||
FMLPostInitializationEvent,
|
||||
FMLPreInitializationEvent,
|
||||
FMLServerAboutToStartEvent,
|
||||
FMLServerStoppedEvent
|
||||
}
|
||||
import cpw.mods.fml.common.Mod.EventHandler
|
||||
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent
|
||||
import codechicken.multipart.MultiPartRegistry
|
||||
import codechicken.multipart.{ControlKeyModifer, MultiPartRegistry, Tags}
|
||||
|
||||
@Mod(
|
||||
modid = "ForgeMultipart",
|
||||
name = "Forge Multipart",
|
||||
acceptedMinecraftVersions = "[1.7.10]",
|
||||
version = Tags.VERSION,
|
||||
modLanguage = "scala"
|
||||
)
|
||||
object MultipartMod {
|
||||
@@ -36,4 +41,10 @@ object MultipartMod {
|
||||
def beforeServerStart(event: FMLServerAboutToStartEvent) {
|
||||
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.nbt.NBTTagCompound
|
||||
|
||||
import java.util.Map
|
||||
import net.minecraft.world.chunk.Chunk
|
||||
import net.minecraft.world.ChunkPosition
|
||||
import codechicken.multipart.{MultipartHelper, TileMultipart}
|
||||
import codechicken.lib.asm.ObfMapping
|
||||
import net.minecraft.world.World
|
||||
|
||||
import scala.collection.mutable
|
||||
import codechicken.multipart.MultipartHelper.IPartTileConverter
|
||||
|
||||
import scala.collection.JavaConversions._
|
||||
|
||||
/** Hack due to lack of TileEntityLoadEvent in forge
|
||||
@@ -58,12 +60,9 @@ object MultipartSaveLoad {
|
||||
field.get(null).asInstanceOf[Map[Class[_ <: TileEntity], String]]
|
||||
}
|
||||
|
||||
def loadTiles(chunk: Chunk) {
|
||||
loadingWorld = chunk.worldObj
|
||||
val iterator = chunk.chunkTileEntityMap
|
||||
.asInstanceOf[Map[ChunkPosition, TileEntity]]
|
||||
.entrySet
|
||||
.iterator
|
||||
def loadTiles(world: World, tiles: Map[ChunkPosition, TileEntity]) {
|
||||
loadingWorld = world
|
||||
val iterator = tiles.entrySet.iterator
|
||||
while (iterator.hasNext) {
|
||||
val e = iterator.next
|
||||
var next = false
|
||||
@@ -88,7 +87,7 @@ object MultipartSaveLoad {
|
||||
|
||||
if (!next) {
|
||||
if (t != null) {
|
||||
t.setWorldObj(e.getValue.getWorldObj)
|
||||
t.setWorldObj(world)
|
||||
t.validate()
|
||||
e.setValue(t)
|
||||
} else
|
||||
|
||||
@@ -82,7 +82,11 @@ object MultipartCPH extends MultipartPH with IClientPacketHandler {
|
||||
for (i <- 0 until num)
|
||||
TileMultipart.handleDescPacket(
|
||||
world,
|
||||
indexInChunk(cc, packet.readShort),
|
||||
new BlockCoord(
|
||||
packet.readByte + (cc.chunkXPos << 4),
|
||||
packet.readInt,
|
||||
packet.readByte + (cc.chunkZPos << 4)
|
||||
),
|
||||
packet
|
||||
)
|
||||
}
|
||||
@@ -220,7 +224,9 @@ object MultipartSPH
|
||||
while (it.hasNext) {
|
||||
val tile = it.next
|
||||
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)
|
||||
num += 1
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import codechicken.lib.packet.PacketCustom
|
||||
import net.minecraft.world.ChunkCoordIntPair
|
||||
import codechicken.lib.vec.BlockCoord
|
||||
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 net.minecraft.block.Block
|
||||
import org.apache.logging.log4j.Logger
|
||||
@@ -29,7 +29,7 @@ class MultipartProxy_serverImpl {
|
||||
.setComment("Multipart API config file")
|
||||
|
||||
GameRegistry.registerBlock(
|
||||
new BlockMultipart().setBlockName("multipart"),
|
||||
new BlockMultipart().setBlockName("codechicken/multipart"),
|
||||
null,
|
||||
"block"
|
||||
)
|
||||
@@ -90,6 +90,8 @@ class MultipartProxy_serverImpl {
|
||||
TileChunkLoadHook.init()
|
||||
|
||||
MultipartCompatiblity.load()
|
||||
if (Loader.isModLoaded("cubicchunks"))
|
||||
CubicChunksCompat.init()
|
||||
}
|
||||
|
||||
def onTileClassBuilt(t: Class[_ <: TileEntity]) {
|
||||
|
||||
@@ -3,12 +3,17 @@ package codechicken.multipart.minecraft;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import codechicken.lib.packet.PacketCustom;
|
||||
import codechicken.multipart.Tags;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
@Mod(modid = "McMultipart", acceptedMinecraftVersions = "[1.7.10]")
|
||||
@Mod(
|
||||
modid = "McMultipart",
|
||||
name = "Minecraft Multipart Plugin",
|
||||
acceptedMinecraftVersions = "[1.7.10]",
|
||||
version = Tags.VERSION)
|
||||
public class MinecraftMultipartMod {
|
||||
|
||||
@Instance("McMultipart")
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||