Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6788f10a3e | ||
|
|
691d3a2962 | ||
|
|
a99686e3a8 | ||
|
|
6064b7bc3d | ||
|
|
3b8a85a20d | ||
|
|
772987a4f2 | ||
|
|
33f240c73a | ||
|
|
06ec360694 | ||
|
|
e9e63d6fc5 | ||
|
|
83cd16061f | ||
|
|
13ecd240fe | ||
|
|
64b5b41f02 | ||
|
|
15a0f7f6c6 | ||
|
|
66fb9ddbb3 | ||
|
|
0fff3926fe | ||
|
|
2e62cb2a32 | ||
|
|
2db573f5c3 | ||
|
|
ff494012ed | ||
|
|
d5dbfe5f6d | ||
|
|
a2b32f4d73 | ||
|
|
2a93fbd33d | ||
|
|
52496b770a | ||
|
|
c964972006 | ||
|
|
cd20d23b1b | ||
|
|
631c562f34 | ||
|
|
3e6930d1f1 | ||
|
|
82955ad34d | ||
|
|
d726351abc | ||
|
|
ea103bcc80 | ||
|
|
f4291635b2 | ||
|
|
739e5fc9c3 | ||
|
|
0aab92fe6c | ||
|
|
52b110a0da | ||
|
|
afb21dcf8c | ||
|
|
c0dd868ca6 | ||
|
|
966fad56ca | ||
|
|
9beab25b7a | ||
|
|
f471a0c094 | ||
|
|
2150548111 |
No files matched your search
@@ -15,7 +15,7 @@ To set up the mod as to allow you to make changes, do the following:
|
||||
|
||||
### IntelliJ IDEA
|
||||
1. Run `gradlew idea`.
|
||||
2. Open IntelliJ and point to either the project folder or the build.gradle file.
|
||||
2. Open IntelliJ and point to either the project folder or the `build.gradle` file.
|
||||
3. After opening the project in IntelliJ, run `gradlew genIntellijRuns` in the command terminal you opened earlier.
|
||||
|
||||
### Eclipse
|
||||
@@ -24,9 +24,8 @@ To set up the mod as to allow you to make changes, do the following:
|
||||
2. Open Eclipse and import the folder as a project.
|
||||
|
||||
You now have a functional local copy of Chisel, ready to develop on.
|
||||
|
||||
___
|
||||
Formatting
|
||||
----------
|
||||
|
||||
When coding for Chisel 2, please use the provided [formatter settings](eclipseFormat.xml) to format your code. Poorly formatted code, or PRs which reformat existing code will likely not be accepted.
|
||||
When coding for the GTNH branch, please run `gradlew spotlessApply` before posting a PR.
|
||||
@@ -1,6 +1,6 @@
|
||||
Chisel
|
||||
=======
|
||||
Chisel is a mod for Minecraft which adds aesthetic blocks to the game through the use of a chisel.
|
||||
Chisel is a mod for Minecraft which adds aesthetic blocks to the game through the use of a chisel.
|
||||
|
||||
Originally created by AUTOMATIC_MAIDEN, it was ported to Minecraft 1.7.2 by asie, and maintained by Pokefenn/Cricket during 1.7.10.
|
||||
|
||||
@@ -12,9 +12,7 @@ It was previously maintained by [tterrag](http://github.com/tterrag1098), [Drull
|
||||
Pull Requests
|
||||
---------------
|
||||
|
||||
Pull requests with new features, translations, and bugfixes are very welcome. Please make sure to always submit PRs against the ***dev*** branch, not master.
|
||||
|
||||
Do not make PRs that are solely formatting or other aesthetic things.
|
||||
Pull requests with new features, translations, and bugfixes are very welcome.
|
||||
|
||||
If your PR is going to take a lot of work, it may be best to make an issue so we can discuss the feature before you create it.
|
||||
|
||||
@@ -22,10 +20,9 @@ See the [CONTRIBUTING](CONTRIBUTING.md) file for more details.
|
||||
|
||||
Issue Reporting
|
||||
----------------
|
||||
If you wish to report an issue with the mod, please submit one to the issue tracker in this repository. When creating an
|
||||
If you wish to report an issue with this version of the mod, please submit one to the [GTNH issue tracker](https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues). When creating an
|
||||
issue, please be sure to include:
|
||||
|
||||
- The version of Chisel you are using ("latest" is not an acceptable version)
|
||||
- The version of Forge you are using
|
||||
- If applicable, the crash report (preferably via [Pastebin](http://pastebin.com/)). generated by the error
|
||||
- The version of Chisel or GTNH you are using ("latest" is not an acceptable version)
|
||||
- The crash report (preferably via [Pastebin](http://pastebin.com/)) generated by the error, if any
|
||||
- Depending on the error, an image of the problem
|
||||
@@ -1,22 +1,24 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
implementation("com.github.GTNewHorizons:CodeChickenCore:1.1.11:dev")
|
||||
implementation("com.github.GTNewHorizons:CodeChickenLib:1.1.8:dev")
|
||||
implementation("com.github.GTNewHorizons:NotEnoughItems:2.3.82-GTNH:dev")
|
||||
implementation("com.github.GTNewHorizons:CodeChickenCore:1.2.1:dev")
|
||||
implementation("com.github.GTNewHorizons:CodeChickenLib:1.2.1:dev")
|
||||
implementation("com.github.GTNewHorizons:NotEnoughItems:2.6.0-GTNH:dev")
|
||||
implementation("com.github.GTNewHorizons:ForgeMultipart:1.4.8:dev")
|
||||
|
||||
compileOnly("org.projectlombok:lombok:1.18.24")
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.24")
|
||||
|
||||
shadowImplementation("com.github.GTNewHorizons:CTMLib:1.4.4:dev")
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:waila:1.6.0:dev") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.3.4:dev") {
|
||||
devOnlyNonPublishable("com.github.GTNewHorizons:waila:1.7.3:dev") {
|
||||
transitive = false
|
||||
}
|
||||
devOnlyNonPublishable("com.github.GTNewHorizons:WailaHarvestability:1.2.1-GTNH:dev")
|
||||
|
||||
compileOnly("curse.maven:ee3-65509:2305023") { // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
||||
transitive = false
|
||||
}
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:Angelica:1.0.0-alpha48:api") {
|
||||
transitive = false
|
||||
}
|
||||
}
|
||||
@@ -1,64 +1,192 @@
|
||||
# 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.2
|
||||
|
||||
# Human-readable mod name, available for mcmod.info population.
|
||||
modName = Chisel
|
||||
|
||||
# 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 = chisel
|
||||
|
||||
# Root package of the mod, used to find various classes in other properties,
|
||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||
modGroup = com.cricketcraft.chisel
|
||||
|
||||
# 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/
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Will update your build.gradle automatically whenever an update is available
|
||||
# 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 = Chisel.java
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = false
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = 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 = team.chisel.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 =
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
|
||||
# [DEPRECATED] Mod Group replacement token.
|
||||
gradleTokenGroupName =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
|
||||
# [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 = api
|
||||
|
||||
# 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 = chisel_compile_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = false
|
||||
|
||||
# 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 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
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass =
|
||||
|
||||
# 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.
|
||||
# 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 = true
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
||||
# 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 = false
|
||||
|
||||
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# 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: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
#
|
||||
# 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 =
|
||||
# customArchiveBaseName =
|
||||
|
||||
# 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
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -83,10 +83,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# 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"'
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -133,10 +131,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@@ -144,7 +145,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 +153,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
|
||||
@@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# 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.
|
||||
|
||||
# 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, 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" \
|
||||
|
||||
@@ -43,11 +43,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,11 +57,11 @@ 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
|
||||
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "GTNH"
|
||||
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
}
|
||||
maven {
|
||||
url "https://cursemaven.com"
|
||||
}
|
||||
maven {
|
||||
url = "https://jitpack.io"
|
||||
}
|
||||
}
|
||||
@@ -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,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
|
||||
}
|
||||
|
||||
blowdryerSetup {
|
||||
repoSubfolder 'gtnhShared'
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.2')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public interface IAdvancedChisel {
|
||||
|
||||
/**
|
||||
* Gets the next mode the button in the GUI should switch to given the current mode.
|
||||
*
|
||||
*
|
||||
* @param stack The {@link ItemStack} representing the chisel
|
||||
* @param current The {@link IChiselMode} that is currently active
|
||||
* @return The next {@link IChiselMode} in the loop
|
||||
@@ -20,7 +20,7 @@ public interface IAdvancedChisel {
|
||||
|
||||
/**
|
||||
* Gets an {@link IChiselMode} instance from a String name
|
||||
*
|
||||
*
|
||||
* @param chisel The {@link ItemStack} representing the chisel
|
||||
* @param name The name of the {@link IChiselMode mode}
|
||||
* @return An {@link IChiselMode} that has the name {@code name}
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface ICarvable extends ICTMBlock<IVariationInfo> {
|
||||
* <p>
|
||||
* Typically you can refer this method to {@link CarvableHelper#getVariation(int)} but this method is provided for
|
||||
* more complex metadata handling.
|
||||
*
|
||||
*
|
||||
* @param metadata The metadata of the block
|
||||
* @param world {@link IBlockAccess} object, usually a world. Use of {@link IBlockAccess} Is necessary due to
|
||||
* this method's use in rendering.
|
||||
@@ -34,7 +34,7 @@ public interface ICarvable extends ICTMBlock<IVariationInfo> {
|
||||
|
||||
/**
|
||||
* Gets the {@link ISubmapManager} for this block when it is in item form.
|
||||
*
|
||||
*
|
||||
* @return A {@link ISubmapManager}
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -14,7 +14,7 @@ public interface IChiselItem {
|
||||
|
||||
/**
|
||||
* Checks whether the chisel can have its GUI opened
|
||||
*
|
||||
*
|
||||
* @param world {@link World} object
|
||||
* @param player The player holding the chisel. It can always be assumed that the player's current item will be
|
||||
* this.
|
||||
@@ -25,7 +25,7 @@ public interface IChiselItem {
|
||||
|
||||
/**
|
||||
* Called when an item is chiseled using this chisel
|
||||
*
|
||||
*
|
||||
* @param world {@link World} object
|
||||
* @param chisel The {@link ItemStack} representing the chisel
|
||||
* @param target The {@link ICarvingVariation} representing the target item
|
||||
@@ -39,7 +39,7 @@ public interface IChiselItem {
|
||||
* <p>
|
||||
* It is not necessary to take into account whether this item <i>has</i> any variants, this method will only be
|
||||
* called after that check.
|
||||
*
|
||||
*
|
||||
* @param world {@link World} object
|
||||
* @param chisel The {@link ItemStack} representing the chisel
|
||||
* @param target The {@link ICarvingVariation} representing the target item
|
||||
@@ -49,7 +49,7 @@ public interface IChiselItem {
|
||||
|
||||
/**
|
||||
* Allows you to control if your item can chisel this block in the world.
|
||||
*
|
||||
*
|
||||
* @param world World object
|
||||
* @param player {@link EntityPlayer The player} holding the chisel.
|
||||
* @param x X coord of the block being chiseled
|
||||
@@ -63,7 +63,7 @@ public interface IChiselItem {
|
||||
|
||||
/**
|
||||
* Allows you to control if your item has chiseling modes.
|
||||
*
|
||||
*
|
||||
* @param chisel The {@link ItemStack} representing the chisel.
|
||||
* @return True if the chisel supports modes. False otherwise.
|
||||
*/
|
||||
|
||||
@@ -20,9 +20,12 @@ import com.cricketcraft.chisel.api.FMPIMC;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import team.chisel.block.BlockCarvableGlowie;
|
||||
import team.chisel.compat.fmp.FMPCompat;
|
||||
import team.chisel.ctmlib.ISubmapManager;
|
||||
|
||||
public class CarvableHelper {
|
||||
@@ -187,11 +190,15 @@ public class CarvableHelper {
|
||||
Block block = info.getVariation()
|
||||
.getBlock();
|
||||
|
||||
if (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
|
||||
FMPIMC.registerFMP(
|
||||
block,
|
||||
info.getVariation()
|
||||
.getBlockMeta());
|
||||
if (Loader.isModLoaded("ForgeMultipart") && block instanceof BlockCarvableGlowie) {
|
||||
FMPCompat.registerGlowieVariation(info, block);
|
||||
} else {
|
||||
if (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
|
||||
FMPIMC.registerFMP(
|
||||
block,
|
||||
info.getVariation()
|
||||
.getBlockMeta());
|
||||
}
|
||||
}
|
||||
|
||||
if (forbidChiseling) return;
|
||||
|
||||
@@ -14,7 +14,7 @@ public class CarvingUtils {
|
||||
/**
|
||||
* A simple way to compare two {@link ICarvingVariation} objects based on the {@link ICarvingVariation#getOrder()
|
||||
* getOrder()} method.
|
||||
*
|
||||
*
|
||||
* @param v1 The first {@link ICarvingVariation variation}.
|
||||
* @param v2 The second {@link ICarvingVariation variation}.
|
||||
* @return A positive integer if the first's order is greater, a negative integer if the second's is greater, and 0
|
||||
@@ -26,7 +26,7 @@ public class CarvingUtils {
|
||||
|
||||
/**
|
||||
* Gets an {@link ItemStack} representing the passed {@link ICarvingVariation}.
|
||||
*
|
||||
*
|
||||
* @param variation An {@link ICarvingVariation}
|
||||
* @return An {@link ItemStack}
|
||||
*/
|
||||
@@ -48,7 +48,7 @@ public class CarvingUtils {
|
||||
/**
|
||||
* Creates a standard {@link ICarvingVariation} for the given data. Use this if you do not need any custom behavior
|
||||
* in your own variation.
|
||||
*
|
||||
*
|
||||
* @param block The block of the variation
|
||||
* @param metadata The metadata of both the block and item
|
||||
* @param order The sorting order.
|
||||
@@ -61,7 +61,7 @@ public class CarvingUtils {
|
||||
/**
|
||||
* Creates a standard {@link ICarvingGroup} for the given name. Use this if you do not need any custom behavior in
|
||||
* your own group.
|
||||
*
|
||||
*
|
||||
* @param name The name of the group.
|
||||
* @return A standard {@link ICarvingGroup} instance.
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@ public interface ICarvingRegistry {
|
||||
|
||||
/**
|
||||
* Finds the group the block/meta pair belongs to in the registry.
|
||||
*
|
||||
*
|
||||
* @param block The block of the variation
|
||||
* @param meta The metadata of the variation
|
||||
* @return The {@link ICarvingGroup} that the block/meta pair belongs to
|
||||
@@ -27,7 +27,7 @@ public interface ICarvingRegistry {
|
||||
|
||||
/**
|
||||
* Gets an {@link ICarvingGroup} by its name.
|
||||
*
|
||||
*
|
||||
* @param name The name of the group
|
||||
* @return An {@link ICarvingGroup}
|
||||
*/
|
||||
@@ -35,7 +35,7 @@ public interface ICarvingRegistry {
|
||||
|
||||
/**
|
||||
* Gets the {@link ICarvingVariation} instance represented by this block/meta pair.
|
||||
*
|
||||
*
|
||||
* @param block The block of the variatoin
|
||||
* @param meta The metadata of the variation
|
||||
* @return The {@link ICarvingVariation} containing this block/meta pair
|
||||
@@ -44,7 +44,7 @@ public interface ICarvingRegistry {
|
||||
|
||||
/**
|
||||
* Gets the list of {@link ICarvingVariation}s from the group that contains this block/meta pair.
|
||||
*
|
||||
*
|
||||
* @param block The block of the variation
|
||||
* @param meta The metadata of the variation
|
||||
* @return All of the {@link ICarvingVariation}s in the group that contains this block/meta pair
|
||||
@@ -53,7 +53,7 @@ public interface ICarvingRegistry {
|
||||
|
||||
/**
|
||||
* Gets the oredict name for the group that contains this block/meta pair.
|
||||
*
|
||||
*
|
||||
* @param block The block of the variation
|
||||
* @param meta The metadata of the variation
|
||||
* @return A string oredict name for the group
|
||||
@@ -62,7 +62,7 @@ public interface ICarvingRegistry {
|
||||
|
||||
/**
|
||||
* Gets the possible output items for this {@link ItemStack}. To be used for machines/GUIs that chisel items.
|
||||
*
|
||||
*
|
||||
* @param chiseled The {@link ItemStack} being chiseled
|
||||
* @return A list of stacks that can be chiseled from the passed {@link ItemStack stack}
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ public interface ICarvingRegistry {
|
||||
|
||||
/**
|
||||
* Gets the sound resource string for the group represented by this block/meta pair.
|
||||
*
|
||||
*
|
||||
* @param block The block of the variation
|
||||
* @param metadata The metadata of the variation
|
||||
* @return The string resource for the sound that can be used in
|
||||
@@ -83,7 +83,7 @@ public interface ICarvingRegistry {
|
||||
* <p>
|
||||
* Mostly a convenience for calling {@link #getVariationSound(Block, int)} with
|
||||
* {@link Block#getBlockFromItem(Item)}.
|
||||
*
|
||||
*
|
||||
* @param item The item of the variation
|
||||
* @param metadata The metadata of the variation
|
||||
* @return The string resource for the sound that can be used in
|
||||
@@ -100,7 +100,7 @@ public interface ICarvingRegistry {
|
||||
|
||||
/**
|
||||
* Adds a variation to the registry.
|
||||
*
|
||||
*
|
||||
* @param groupName The name of the group to add to.
|
||||
* @param block The block of the variation
|
||||
* @param metadata The metadata of the variation
|
||||
@@ -111,7 +111,7 @@ public interface ICarvingRegistry {
|
||||
|
||||
/**
|
||||
* Adds a variation to the registry.
|
||||
*
|
||||
*
|
||||
* @param groupName The name of the group to add to
|
||||
* @param variation The {@link ICarvingVariation} to add
|
||||
*/
|
||||
@@ -119,7 +119,7 @@ public interface ICarvingRegistry {
|
||||
|
||||
/**
|
||||
* Adds a group to the registry.
|
||||
*
|
||||
*
|
||||
* @param group The {@link ICarvingGroup} to add.
|
||||
*/
|
||||
void addGroup(ICarvingGroup group);
|
||||
@@ -130,7 +130,7 @@ public interface ICarvingRegistry {
|
||||
* This in effect removes all variations associated with the group, though they are not explicitly removed from the
|
||||
* object. If you maintain a reference to the {@link ICarvingGroup} that is removed, it will still contain its
|
||||
* variations.
|
||||
*
|
||||
*
|
||||
* @param groupName The name of the group to remove.
|
||||
* @return The {@link ICarvingGroup} that was removed.
|
||||
*/
|
||||
@@ -139,7 +139,7 @@ public interface ICarvingRegistry {
|
||||
/**
|
||||
* Removes a varaition with the passed {@link Block} and metadata from the registry. If this variation is registered
|
||||
* with mutiple groups, it will remove it from all of them.
|
||||
*
|
||||
*
|
||||
* @param block The {@link Block} of the {@link ICarvingVariation variation}
|
||||
* @param metadata The metadata of the {@link ICarvingVariation variation}
|
||||
* @return The ICarvingVariation that was removed. Null if nothing was removed.
|
||||
@@ -149,7 +149,7 @@ public interface ICarvingRegistry {
|
||||
/**
|
||||
* Removes a varaition with the passed {@link Block} and metadata from the registry, but only from the specified
|
||||
* {@link ICarvingGroup} name.
|
||||
*
|
||||
*
|
||||
* @param block The {@link Block} of the {@link ICarvingVariation variation}
|
||||
* @param metadata The metadata of the {@link ICarvingVariation variation}
|
||||
* @param group The name of the group that the variation should be removed from
|
||||
@@ -162,7 +162,7 @@ public interface ICarvingRegistry {
|
||||
* <p>
|
||||
* Doing this means that all blocks that are registered to this oredict name will act as if they are a part of this
|
||||
* group.
|
||||
*
|
||||
*
|
||||
* @param groupName The name of the group
|
||||
* @param oreName The oredict name
|
||||
*/
|
||||
@@ -173,7 +173,7 @@ public interface ICarvingRegistry {
|
||||
* <p>
|
||||
* This is the sound that is used when a block from this group is chiseled. <br/>
|
||||
* Does <i>not</i> need to be explicitly set.
|
||||
*
|
||||
*
|
||||
* @param name The name of the group
|
||||
* @param sound The resource string for the sound
|
||||
*/
|
||||
|
||||
@@ -42,7 +42,7 @@ public enum TextureType {
|
||||
register.registerIcon(modName + ":" + texturePath + "-top")
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
IIcon[] icons = (IIcon[]) cachedObject;
|
||||
@@ -57,7 +57,7 @@ public enum TextureType {
|
||||
register.registerIcon(modName + ":" + texturePath + "-top")
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
IIcon[] icons = (IIcon[]) cachedObject;
|
||||
@@ -65,18 +65,18 @@ public enum TextureType {
|
||||
}
|
||||
},
|
||||
CTMV("ctmv", "top"){
|
||||
|
||||
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return Pair.of(new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-ctmv"), 2, 2), register.registerIcon(modName + ":" + texturePath + "-top"));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
Pair<TextureSubmap, IIcon> data = (Pair<TextureSubmap, IIcon>) cachedObject;
|
||||
return side < 2 ? data.getRight() : data.getLeft().getSubIcon(0, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
Pair<TextureSubmap, IIcon> data = (Pair<TextureSubmap, IIcon>) cachedObject;
|
||||
@@ -96,13 +96,14 @@ public enum TextureType {
|
||||
return map.getSubIcon(1, 0);
|
||||
return map.getSubIcon(0, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||
RenderBlocksColumn ret = theRenderBlocksColumn;
|
||||
TextureType.initStatics();
|
||||
RenderBlocksColumn ret = theRenderBlocksColumn.get();
|
||||
Pair<TextureSubmap, IIcon> data = (Pair<TextureSubmap, IIcon>) cachedObject;
|
||||
|
||||
|
||||
ret.blockAccess = world;
|
||||
ret.renderMaxX = 1.0;
|
||||
ret.renderMaxY = 1.0;
|
||||
@@ -117,13 +118,13 @@ public enum TextureType {
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return Pair.of(new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-ctmh"), 2, 2), register.registerIcon(modName + ":" + texturePath + "-top"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return CTMV.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
Pair<TextureSubmap, IIcon> data = (Pair<TextureSubmap, IIcon>) cachedObject;
|
||||
@@ -143,7 +144,7 @@ public enum TextureType {
|
||||
p = ctm.isConnected(world, x, y, z - 1, side, block, meta);
|
||||
n = ctm.isConnected(world, x, y, z + 1, side, block, meta);
|
||||
}
|
||||
|
||||
|
||||
TextureSubmap map = data.getLeft();
|
||||
if (p && n)
|
||||
return map.getSubIcon(1, 0);
|
||||
@@ -159,14 +160,14 @@ public enum TextureType {
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-v9"), 3, 3);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return ((TextureSubmap)cachedObject).getSubIcon(1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getVIcon(this, (TextureSubmap) cachedObject, x, y, z, side);
|
||||
}
|
||||
},
|
||||
@@ -175,12 +176,12 @@ public enum TextureType {
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-v4"), 2, 2);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return ((TextureSubmap)cachedObject).getSubIcon(0, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getVIcon(this, (TextureSubmap) cachedObject, x, y, z, side);
|
||||
@@ -196,16 +197,17 @@ public enum TextureType {
|
||||
new TextureSubmap(baseIcon, 2, 2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return ((Triple<IIcon, ?, ?>)cachedObject).getLeft();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||
RenderBlocksCTM ret = theRenderBlocksCTM;
|
||||
TextureType.initStatics();
|
||||
RenderBlocksCTM ret = theRenderBlocksCTM.get();
|
||||
Triple<?, TextureSubmap, TextureSubmap> data = (Triple<?, TextureSubmap, TextureSubmap>) cachedObject;
|
||||
ret.blockAccess = world;
|
||||
|
||||
@@ -220,13 +222,13 @@ public enum TextureType {
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-r16"), 4, 4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return V9.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getRIcon(this, (TextureSubmap) cachedObject, x, y, z, side);
|
||||
@@ -236,30 +238,30 @@ public enum TextureType {
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-r9"), 3, 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return V9.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getRIcon(this, (TextureSubmap) cachedObject, x, y, z, side);
|
||||
}
|
||||
},
|
||||
R4("r4"){
|
||||
|
||||
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-r4"), 2, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return V4.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getRIcon(this, (TextureSubmap) cachedObject, x, y, z, side);
|
||||
@@ -267,9 +269,9 @@ public enum TextureType {
|
||||
},
|
||||
NORMAL,
|
||||
CUSTOM;
|
||||
|
||||
|
||||
/* Some util stuff for shared code between v* and r* */
|
||||
|
||||
|
||||
public static IIcon getVIcon(TextureType type, TextureSubmap map, int x, int y, int z, int side) {
|
||||
int variationSize = (type == TextureType.V9) ? 3 : 2;
|
||||
|
||||
@@ -304,30 +306,30 @@ public enum TextureType {
|
||||
|
||||
return map.getSubIcon(index % variationSize, index / variationSize);
|
||||
}
|
||||
|
||||
|
||||
public static IIcon getRIcon(TextureType type, TextureSubmap map, int x, int y, int z, int side) {
|
||||
rand.setSeed(getCoordinateRandom(x, y, z));
|
||||
rand.nextBoolean();
|
||||
int size = type == TextureType.R4 ? 2 : type == TextureType.R9 ? 3 : 4;
|
||||
return map.getSubIcon(rand.nextInt(size), rand.nextInt(size));
|
||||
}
|
||||
|
||||
|
||||
private static long getCoordinateRandom(int x, int y, int z) {
|
||||
// MC 1.8 code...
|
||||
long l = (x * 3129871) ^ z * 116129781L ^ y;
|
||||
l = l * l * 42317861L + l * 11L;
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
/* End of that mess */
|
||||
|
||||
|
||||
private static final TextureType[] VALUES;
|
||||
private static final CTM ctm = CTM.getInstance();
|
||||
private static final Random rand = new Random();
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTM theRenderBlocksCTM;
|
||||
private static ThreadLocal<RenderBlocksCTM> theRenderBlocksCTM;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksColumn theRenderBlocksColumn;
|
||||
private static ThreadLocal<RenderBlocksColumn> theRenderBlocksColumn;
|
||||
|
||||
private String[] suffixes;
|
||||
static {
|
||||
@@ -337,31 +339,37 @@ public enum TextureType {
|
||||
private TextureType(String... suffixes) {
|
||||
this.suffixes = suffixes.length == 0 ? new String[] { "" } : suffixes;
|
||||
}
|
||||
|
||||
private static void initStatics() {
|
||||
if (theRenderBlocksCTM == null) {
|
||||
theRenderBlocksCTM = new RenderBlocksCTM();
|
||||
theRenderBlocksColumn = new RenderBlocksColumn();
|
||||
}
|
||||
}
|
||||
|
||||
public ISubmapManager createManagerFor(ICarvingVariation variation, String texturePath) {
|
||||
|
||||
private static void initStatics() {
|
||||
if (theRenderBlocksCTM == null) {
|
||||
theRenderBlocksCTM = ThreadLocal.withInitial(RenderBlocksCTM::new);
|
||||
theRenderBlocksColumn = ThreadLocal.withInitial(RenderBlocksColumn::new);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void clearStatics() {
|
||||
if(theRenderBlocksCTM != null) theRenderBlocksCTM.remove();
|
||||
if(theRenderBlocksColumn != null) theRenderBlocksColumn.remove();
|
||||
}
|
||||
|
||||
public ISubmapManager createManagerFor(ICarvingVariation variation, String texturePath) {
|
||||
return new SubmapManagerDefault(this, variation, texturePath);
|
||||
}
|
||||
|
||||
|
||||
public ISubmapManager createManagerFor(ICarvingVariation variation, Block block, int meta) {
|
||||
return new SubmapManagerExistingIcon(this, variation, block, meta);
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return register.registerIcon(modName + ":" + texturePath);
|
||||
}
|
||||
|
||||
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return (IIcon) cachedObject;
|
||||
}
|
||||
|
||||
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
@@ -370,7 +378,7 @@ public enum TextureType {
|
||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||
return rendererOld;
|
||||
}
|
||||
|
||||
|
||||
public static TextureType getTypeFor(CarvableHelper inst, String modid, String path) {
|
||||
if (path == null) {
|
||||
return CUSTOM;
|
||||
@@ -388,7 +396,7 @@ public enum TextureType {
|
||||
}
|
||||
return CUSTOM;
|
||||
}
|
||||
|
||||
|
||||
// This is ugly, but faster than class.getResource
|
||||
private static boolean exists(String modid, String path, String postfix) {
|
||||
ResourceLocation rl = new ResourceLocation(modid, "textures/blocks/" + path + postfix + ".png");
|
||||
@@ -399,18 +407,18 @@ public enum TextureType {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract static class AbstractSubmapManager implements ISubmapManager {
|
||||
protected final TextureType type;
|
||||
protected ICarvingVariation variation;
|
||||
protected Object cachedObject;
|
||||
|
||||
|
||||
private AbstractSubmapManager(TextureType type, ICarvingVariation variation) {
|
||||
this.type = type;
|
||||
this.variation = variation;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return type.getIcon(variation, cachedObject, side, meta);
|
||||
@@ -420,23 +428,22 @@ public enum TextureType {
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return type.getIcon(variation, cachedObject, world, x, y, z, side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
initStatics();
|
||||
RenderBlocks rb = type.createRenderContext(rendererOld, world, cachedObject);
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
return rb;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
|
||||
|
||||
public Object getCachedObject() {
|
||||
return cachedObject;
|
||||
}
|
||||
@@ -446,7 +453,7 @@ public enum TextureType {
|
||||
private static class SubmapManagerDefault extends AbstractSubmapManager {
|
||||
|
||||
private String texturePath;
|
||||
|
||||
|
||||
private SubmapManagerDefault(TextureType type, ICarvingVariation variation, String texturePath) {
|
||||
super(type, variation);
|
||||
this.texturePath = texturePath;
|
||||
@@ -457,24 +464,24 @@ public enum TextureType {
|
||||
cachedObject = type.registerIcons(variation, modName, texturePath, register);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static class SubmapManagerExistingIcon extends AbstractSubmapManager {
|
||||
|
||||
|
||||
private Block block;
|
||||
private int meta;
|
||||
|
||||
|
||||
private SubmapManagerExistingIcon(TextureType type, ICarvingVariation variation, Block block, int meta) {
|
||||
super(type, variation);
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return block.getIcon(side, this.meta);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
@@ -484,4 +491,4 @@ public enum TextureType {
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class Chisel {
|
||||
1.0f,
|
||||
1.0f);
|
||||
public static final String MOD_NAME = "Chisel";
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
public static final String VERSION = Tags.VERSION;
|
||||
public static final BlockCarvable.SoundType soundHolystoneFootstep = new BlockCarvable.SoundType(
|
||||
"holystone",
|
||||
1.0f,
|
||||
@@ -75,6 +75,7 @@ public class Chisel {
|
||||
public static final BlockCarvable.SoundType soundMetalFootstep = new BlockCarvable.SoundType("metal", 1.0f, 1.0f);
|
||||
public static boolean multipartLoaded = false;
|
||||
public static boolean gtnhLoaded = false;
|
||||
public static boolean iguanaTweaksLoaded = false;
|
||||
public static int renderEldritchId;
|
||||
public static int renderAutoChiselId;
|
||||
public static int renderGlowId;
|
||||
@@ -148,6 +149,9 @@ public class Chisel {
|
||||
if (Loader.isModLoaded("dreamcraft")) {
|
||||
gtnhLoaded = true;
|
||||
}
|
||||
if (Loader.isModLoaded("IguanaTweaksTConstruct")) {
|
||||
iguanaTweaksLoaded = true;
|
||||
}
|
||||
TabsInit.preInit();
|
||||
Features.preInit();
|
||||
Statistics.init();
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
package team.chisel;
|
||||
|
||||
import static team.chisel.init.ChiselBlocks.*;
|
||||
import static team.chisel.utils.General.*;
|
||||
import static team.chisel.init.ChiselBlocks.andesite;
|
||||
import static team.chisel.init.ChiselBlocks.cubit;
|
||||
import static team.chisel.init.ChiselBlocks.diorite;
|
||||
import static team.chisel.init.ChiselBlocks.granite;
|
||||
import static team.chisel.init.ChiselBlocks.jackolantern;
|
||||
import static team.chisel.init.ChiselBlocks.neonite;
|
||||
import static team.chisel.init.ChiselBlocks.nucrete;
|
||||
import static team.chisel.init.ChiselBlocks.planks;
|
||||
import static team.chisel.init.ChiselBlocks.pumpkin;
|
||||
import static team.chisel.init.ChiselBlocks.stainedGlass;
|
||||
import static team.chisel.init.ChiselBlocks.stainedGlassForestry;
|
||||
import static team.chisel.init.ChiselBlocks.stainedGlassPane;
|
||||
import static team.chisel.init.ChiselBlocks.sveltstone;
|
||||
import static team.chisel.init.ChiselBlocks.torches;
|
||||
import static team.chisel.utils.General.featureColors;
|
||||
import static team.chisel.utils.General.sGNames;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,10 +44,51 @@ import com.google.common.collect.Lists;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import team.chisel.block.*;
|
||||
import team.chisel.block.BlockAutoChisel;
|
||||
import team.chisel.block.BlockBeaconBase;
|
||||
import team.chisel.block.BlockCarvable;
|
||||
import team.chisel.block.BlockCarvableBeacon;
|
||||
import team.chisel.block.BlockCarvableBookshelf;
|
||||
import team.chisel.block.BlockCarvableCarpet;
|
||||
import team.chisel.block.BlockCarvableGlass;
|
||||
import team.chisel.block.BlockCarvableGlow;
|
||||
import team.chisel.block.BlockCarvableGlowie;
|
||||
import team.chisel.block.BlockCarvableGlowstone;
|
||||
import team.chisel.block.BlockCarvableIce;
|
||||
import team.chisel.block.BlockCarvableIceStairs;
|
||||
import team.chisel.block.BlockCarvableLayered;
|
||||
import team.chisel.block.BlockCarvablePackedIce;
|
||||
import team.chisel.block.BlockCarvablePackedIceStairs;
|
||||
import team.chisel.block.BlockCarvablePane;
|
||||
import team.chisel.block.BlockCarvablePowered;
|
||||
import team.chisel.block.BlockCarvablePumpkin;
|
||||
import team.chisel.block.BlockCarvableSand;
|
||||
import team.chisel.block.BlockCarvableSlab;
|
||||
import team.chisel.block.BlockCarvableStairs;
|
||||
import team.chisel.block.BlockCarvableTorch;
|
||||
import team.chisel.block.BlockCloud;
|
||||
import team.chisel.block.BlockConcrete;
|
||||
import team.chisel.block.BlockEldritch;
|
||||
import team.chisel.block.BlockGrimstone;
|
||||
import team.chisel.block.BlockHolystone;
|
||||
import team.chisel.block.BlockLavastone;
|
||||
import team.chisel.block.BlockLeaf;
|
||||
import team.chisel.block.BlockPresent;
|
||||
import team.chisel.block.BlockRoadLine;
|
||||
import team.chisel.block.BlockSnakestone;
|
||||
import team.chisel.block.BlockSnakestoneObsidian;
|
||||
import team.chisel.block.BlockWaterstone;
|
||||
import team.chisel.block.CarvableStairsMaker;
|
||||
import team.chisel.block.IStairsCreator;
|
||||
import team.chisel.carving.Carving;
|
||||
import team.chisel.client.render.*;
|
||||
import team.chisel.client.render.SubmapManagerAntiblock;
|
||||
import team.chisel.client.render.SubmapManagerCarpetFloor;
|
||||
import team.chisel.client.render.SubmapManagerCombinedCTM;
|
||||
import team.chisel.client.render.SubmapManagerFakeController;
|
||||
import team.chisel.client.render.SubmapManagerLeaves;
|
||||
import team.chisel.client.render.SubmapManagerSlab;
|
||||
import team.chisel.client.render.SubmapManagerSpecialMaterial;
|
||||
import team.chisel.client.render.SubmapManagerVoidstone;
|
||||
import team.chisel.compat.fmp.ItemBlockChiselTorchPart;
|
||||
import team.chisel.config.Configurations;
|
||||
import team.chisel.entity.EntityBallOMoss;
|
||||
@@ -181,7 +236,7 @@ public enum Features {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable antiBlock = (BlockCarvable) new BlockCarvableAntiBlock()
|
||||
BlockCarvable antiBlock = (BlockCarvable) new BlockCarvableGlowie(Material.rock)
|
||||
.setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
|
||||
if (!Configurations.allowChiselCrossColors) {
|
||||
@@ -884,6 +939,13 @@ public enum Features {
|
||||
.setHardness(5F)
|
||||
.setResistance(10F)
|
||||
.setStepSound(Block.soundTypeMetal);
|
||||
|
||||
if (Chisel.iguanaTweaksLoaded) {
|
||||
diamond_block.setHarvestLevel("pickaxe", 4);
|
||||
} else {
|
||||
diamond_block.setHarvestLevel("pickaxe", 2);
|
||||
}
|
||||
|
||||
Carving.chisel.addVariation("diamond_block", Blocks.diamond_block, 0, 0);
|
||||
diamond_block.carverHelper.addVariation("tile.diamond.1.desc", 1, "diamond/terrain-diamond-embossed");
|
||||
diamond_block.carverHelper.addVariation("tile.diamond.2.desc", 2, "diamond/terrain-diamond-gem");
|
||||
@@ -976,6 +1038,13 @@ public enum Features {
|
||||
.setHardness(5.0F)
|
||||
.setResistance(10.0F)
|
||||
.setStepSound(Block.soundTypeMetal);
|
||||
|
||||
if (Chisel.iguanaTweaksLoaded) {
|
||||
emerald_block.setHarvestLevel("pickaxe", 4);
|
||||
} else {
|
||||
emerald_block.setHarvestLevel("pickaxe", 2);
|
||||
}
|
||||
|
||||
Carving.chisel.addVariation("emerald_block", Blocks.emerald_block, 0, 0);
|
||||
emerald_block.carverHelper.addVariation("tile.emerald.1.desc", 1, "emerald/panel");
|
||||
emerald_block.carverHelper.addVariation("tile.emerald.2.desc", 2, "emerald/panelclassic");
|
||||
@@ -1457,6 +1526,13 @@ public enum Features {
|
||||
.setHardness(3F)
|
||||
.setResistance(10F)
|
||||
.setStepSound(Block.soundTypeMetal);
|
||||
|
||||
if (Chisel.iguanaTweaksLoaded) {
|
||||
gold_block.setHarvestLevel("pickaxe", 3);
|
||||
} else {
|
||||
gold_block.setHarvestLevel("pickaxe", 2);
|
||||
}
|
||||
|
||||
Carving.chisel.addVariation("gold_block", Blocks.gold_block, 0, 0);
|
||||
gold_block.carverHelper.addVariation("tile.gold.1.desc", 1, "gold/terrain-gold-largeingot");
|
||||
gold_block.carverHelper.addVariation("tile.gold.2.desc", 2, "gold/terrain-gold-smallingot");
|
||||
@@ -1865,6 +1941,13 @@ public enum Features {
|
||||
.setHardness(5F)
|
||||
.setResistance(10F)
|
||||
.setStepSound(Block.soundTypeMetal);
|
||||
|
||||
if (Chisel.iguanaTweaksLoaded) {
|
||||
iron_block.setHarvestLevel("pickaxe", 2);
|
||||
} else {
|
||||
iron_block.setHarvestLevel("pickaxe", 1);
|
||||
}
|
||||
|
||||
Carving.chisel.addVariation("iron_block", Blocks.iron_block, 0, 0);
|
||||
iron_block.carverHelper.addVariation("tile.iron.1.desc", 1, "iron/terrain-iron-largeingot");
|
||||
iron_block.carverHelper.addVariation("tile.iron.2.desc", 2, "iron/terrain-iron-smallingot");
|
||||
@@ -1976,6 +2059,13 @@ public enum Features {
|
||||
.setHardness(3F)
|
||||
.setResistance(5F)
|
||||
.setStepSound(Block.soundTypeStone);
|
||||
|
||||
if (Chisel.iguanaTweaksLoaded) {
|
||||
lapis_block.setHarvestLevel("pickaxe", 2);
|
||||
} else {
|
||||
lapis_block.setHarvestLevel("pickaxe", 1);
|
||||
}
|
||||
|
||||
Carving.chisel.addVariation("lapis_block", Blocks.lapis_block, 0, 0);
|
||||
lapis_block.carverHelper.addVariation("tile.lapis.1.desc", 1, "lapis/terrain-lapisblock-chunky");
|
||||
lapis_block.carverHelper.addVariation("tile.lapis.2.desc", 2, "lapis/terrain-lapisblock-panel");
|
||||
@@ -2734,6 +2824,12 @@ public enum Features {
|
||||
.setResistance(2000.0F)
|
||||
.setStepSound(Block.soundTypeStone);
|
||||
|
||||
if (Chisel.iguanaTweaksLoaded) {
|
||||
obsidian.setHarvestLevel("pickaxe", 5);
|
||||
} else {
|
||||
obsidian.setHarvestLevel("pickaxe", 3);
|
||||
}
|
||||
|
||||
Carving.chisel.addVariation("obsidian", Blocks.obsidian, 0, 0);
|
||||
obsidian.carverHelper.addVariation("tile.obsidian.1.desc", 1, "obsidian/pillar");
|
||||
obsidian.carverHelper.addVariation("tile.obsidian.2.desc", 2, "obsidian/pillar-quartz");
|
||||
@@ -2973,8 +3069,8 @@ public enum Features {
|
||||
@Override
|
||||
void addRecipes() {
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(ChiselBlocks.jackolantern[meta]),
|
||||
new ItemStack(ChiselBlocks.pumpkin[meta], 1),
|
||||
new ItemStack(jackolantern[meta]),
|
||||
new ItemStack(pumpkin[meta], 1),
|
||||
new ItemStack(Item.getItemFromBlock(Blocks.torch), 1));
|
||||
}
|
||||
|
||||
@@ -3424,6 +3520,11 @@ public enum Features {
|
||||
.setHardness(50.0F)
|
||||
.setResistance(2000.0F);
|
||||
GameRegistry.registerBlock(obsidian_snakestone, ItemCarvable.class, "obsidian_snakestone");
|
||||
if (Chisel.iguanaTweaksLoaded) {
|
||||
obsidian_snakestone.setHarvestLevel("pickaxe", 5);
|
||||
} else {
|
||||
obsidian_snakestone.setHarvestLevel("pickaxe", 3);
|
||||
}
|
||||
Carving.chisel.addVariation("obsidian", obsidian_snakestone, 1, 100);
|
||||
Carving.chisel.addVariation("obsidian", obsidian_snakestone, 13, 101);
|
||||
// Carving.chisel.registerOre("obsidianSnakestone",
|
||||
@@ -3525,7 +3626,7 @@ public enum Features {
|
||||
'*',
|
||||
new ItemStack(Blocks.stone, 1),
|
||||
'X',
|
||||
new ItemStack(ChiselBlocks.andesite, 1));
|
||||
new ItemStack(andesite, 1));
|
||||
}
|
||||
},
|
||||
|
||||
@@ -4201,6 +4302,39 @@ public enum Features {
|
||||
boolean needsMetaRecipes() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
FROGLIGHT {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable froglight = (BlockCarvable) new BlockCarvable()
|
||||
.setCreativeTab(ChiselTabs.tabOtherChiselBlocks)
|
||||
.setHardness(1F)
|
||||
.setLightLevel(1.0F)
|
||||
.setStepSound(Block.soundTypeStone);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
froglight.carverHelper.addVariation("tile.froglight." + i + ".desc", i, "froglight/" + i);
|
||||
}
|
||||
|
||||
froglight.carverHelper.registerAll(froglight, "froglight");
|
||||
}
|
||||
|
||||
@Override
|
||||
void addRecipes() {
|
||||
GameRegistry.addRecipe(
|
||||
new ItemStack(ChiselBlocks.froglight, 8, 0),
|
||||
"SGS",
|
||||
"BSB",
|
||||
"SGS",
|
||||
'S',
|
||||
new ItemStack(Blocks.stone, 1, 0),
|
||||
'G',
|
||||
new ItemStack(Items.glowstone_dust, 1),
|
||||
'B',
|
||||
new ItemStack(Items.slime_ball, 1));
|
||||
}
|
||||
};
|
||||
|
||||
private static final String[] dyeOres = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple",
|
||||
|
||||
@@ -104,7 +104,7 @@ public class BlockCarvable extends Block implements ICarvable {
|
||||
/**
|
||||
* Creates a SoundType with automatic names for step and break sounds. Sound names dig.soundName and
|
||||
* step.soundName must be specified in the sounds.json
|
||||
*
|
||||
*
|
||||
* @param soundName block of the sound. Will automatically be expanded to "mod:dig.soundName" and
|
||||
* "mod:step.soundName" respectively)
|
||||
* @param volume default 1.0f
|
||||
@@ -120,7 +120,7 @@ public class BlockCarvable extends Block implements ICarvable {
|
||||
/**
|
||||
* Creates a SoundType with manual names for step and break sounds. Sound names must be specified in the
|
||||
* sounds.json
|
||||
*
|
||||
*
|
||||
* @param soundNameBreak block break sound
|
||||
* @param soundNameStep block step sound
|
||||
* @param volume default 1.0f
|
||||
@@ -136,7 +136,7 @@ public class BlockCarvable extends Block implements ICarvable {
|
||||
/**
|
||||
* Creates a SoundType with manual names for step, break and place sounds. Sound names must be specified in the
|
||||
* sounds.json
|
||||
*
|
||||
*
|
||||
* @param soundNameBreak block break sound
|
||||
* @param soundNameStep block step sound
|
||||
* @param soundNamePlace block place sound
|
||||
|
||||
@@ -92,7 +92,7 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
|
||||
/**
|
||||
* Creates a SoundType with automatic names for step and break sounds. Sound names dig.soundName and
|
||||
* step.soundName must be specified in the sounds.json
|
||||
*
|
||||
*
|
||||
* @param soundName block of the sound. Will automatically be expanded to "mod:dig.soundName" and
|
||||
* "mod:step.soundName" respectively)
|
||||
* @param volume default 1.0f
|
||||
@@ -108,7 +108,7 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
|
||||
/**
|
||||
* Creates a SoundType with manual names for step and break sounds. Sound names must be specified in the
|
||||
* sounds.json
|
||||
*
|
||||
*
|
||||
* @param soundNameBreak block break sound
|
||||
* @param soundNameStep block step sound
|
||||
* @param volume default 1.0f
|
||||
@@ -124,7 +124,7 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
|
||||
/**
|
||||
* Creates a SoundType with manual names for step, break and place sounds. Sound names must be specified in the
|
||||
* sounds.json
|
||||
*
|
||||
*
|
||||
* @param soundNameBreak block break sound
|
||||
* @param soundNameStep block step sound
|
||||
* @param soundNamePlace block place sound
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package team.chisel.carving;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package team.chisel.client.gui.widgets;
|
||||
|
||||
import static team.chisel.client.gui.GuiChisel.*;
|
||||
import static team.chisel.client.gui.GuiChisel.TEXTURE_HEIGHT;
|
||||
import static team.chisel.client.gui.GuiChisel.TEXTURE_RESOURCE_LOCATION;
|
||||
import static team.chisel.client.gui.GuiChisel.TEXTURE_WIDTH;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
|
||||
public class FullBrightLighting implements CCRenderState.IVertexOperation {
|
||||
|
||||
public static FullBrightLighting instance = new FullBrightLighting();
|
||||
public int id;
|
||||
|
||||
public boolean load() {
|
||||
final CCRenderState state = CCRenderState.instance();
|
||||
|
||||
if (!state.computeLighting) {
|
||||
return false;
|
||||
}
|
||||
state.pipeline.addDependency(CCRenderState.colourAttrib);
|
||||
state.pipeline.addDependency(CCRenderState.lightCoordAttrib);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void operate() {
|
||||
CCRenderState.instance()
|
||||
.setBrightness(FULL_BRIGHT_BLOCK_BRIGHTNESS);
|
||||
}
|
||||
|
||||
public int operationID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
{
|
||||
id = CCRenderState.registerOperation();
|
||||
}
|
||||
|
||||
// magic number from 'RenderBlocksCTMFullbright'
|
||||
// this is the brightness of the neonite, anti, glotek blocks
|
||||
// so we use it for custom microblock lighting
|
||||
private final static int FULL_BRIGHT_BLOCK_BRIGHTNESS = 0xF000F0;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.lib.render.ColourMultiplier;
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.microblock.BlockMicroMaterial;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class FullBrightMicroMaterial extends BlockMicroMaterial {
|
||||
|
||||
public FullBrightMicroMaterial(final Block block, final int meta) {
|
||||
super(block, meta);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderMicroFace(final Vector3 pos, final int pass, final Cuboid6 bounds) {
|
||||
CCRenderState.instance().pipeline.builder()
|
||||
.add((CCRenderState.IVertexOperation) pos.translation())
|
||||
.add((CCRenderState.IVertexOperation) this.icont())
|
||||
.add((CCRenderState.IVertexOperation) ColourMultiplier.instance(FULL_BRIGHT_COLOR_MULTIPLIER))
|
||||
.add((CCRenderState.IVertexOperation) FullBrightLighting.instance)
|
||||
.render();
|
||||
}
|
||||
|
||||
// magic number from 'RenderBlocksCTMFullbright'
|
||||
// this is what makes the neonite, anti, glotek blocks burn bright as my ass does
|
||||
// so we use it for custom microblock render
|
||||
private final static int FULL_BRIGHT_COLOR_MULTIPLIER = 0xFFFFFFFF;
|
||||
}
|
||||
@@ -10,10 +10,13 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int id;
|
||||
@@ -32,8 +35,6 @@ public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
|
||||
class PaneRenderer {
|
||||
|
||||
Tessellator tessellator;
|
||||
|
||||
double i0u0;
|
||||
double i0uh;
|
||||
double i0u1;
|
||||
@@ -69,8 +70,6 @@ public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
double y1;
|
||||
|
||||
void set(double x, double y, double z, IIcon icon, IIcon icon1, IIcon icon2) {
|
||||
tessellator = Tessellator.instance;
|
||||
|
||||
i0u0 = icon.getMinU();
|
||||
i0uh = icon.getInterpolatedU(8.0D);
|
||||
i0u1 = icon.getMaxU();
|
||||
@@ -107,6 +106,8 @@ public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
public void renderNorthPane() {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.addVertexWithUV(xh, y1, z0, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, z0, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
@@ -118,6 +119,8 @@ public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
public void renderSouthPane() {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, z1, i0uh, i0v1);
|
||||
@@ -129,6 +132,8 @@ public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
public void renderWestPane() {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.addVertexWithUV(x0, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x0, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
@@ -140,6 +145,8 @@ public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
public void renderEastPane() {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(x1, y0, zh, i0uh, i0v1);
|
||||
@@ -151,6 +158,8 @@ public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
public void renderVerticalNS(double y, double zoff0, double zoff1, double v0, double v1) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff1, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff1, i1u1, i1v0 + i1v * v1);
|
||||
@@ -162,6 +171,8 @@ public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
public void renderVerticalWE(double y, double xoff0, double xoff1, double v0, double v1) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp1, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp0, i1u0, i1v0 + i1v * v1);
|
||||
@@ -173,6 +184,8 @@ public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
public void renderHorizontalNS(double zoff, double v0, double v1) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.addVertexWithUV(xp0, y1, z0 + zoff, i2u0, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp0, y0, z0 + zoff, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0, z0 + zoff, i2u1, i2v0 + i2v * v0);
|
||||
@@ -185,6 +198,8 @@ public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
public void renderHorizontalWE(double xoff, double v0, double v1) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp0, i2u0, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp0, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp1, i2u1, i2v0 + i2v * v0);
|
||||
@@ -196,13 +211,14 @@ public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
}
|
||||
|
||||
PaneRenderer paneRenderer = new PaneRenderer();
|
||||
final ThreadLocal<PaneRenderer> paneRendererThreadLocal = ThreadLocal.withInitial(PaneRenderer::new);
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
BlockPane block = (BlockPane) b;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final PaneRenderer paneRenderer = paneRendererThreadLocal.get();
|
||||
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
|
||||
|
||||
@@ -6,11 +6,14 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class RendererEldritch implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public RendererEldritch() {
|
||||
@@ -24,12 +27,14 @@ public class RendererEldritch implements ISimpleBlockRenderingHandler {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
RenderBlocksEldritch renderer = new RenderBlocksEldritch();
|
||||
ThreadLocal<RenderBlocksEldritch> rendererThreadLocal = ThreadLocal.withInitial(RenderBlocksEldritch::new);
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks rendererOld) {
|
||||
|
||||
final RenderBlocksEldritch renderer = rendererThreadLocal.get();
|
||||
|
||||
// tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x,
|
||||
// y, z));
|
||||
/*
|
||||
|
||||
@@ -7,6 +7,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import team.chisel.Chisel;
|
||||
@@ -15,6 +17,7 @@ import team.chisel.config.Configurations;
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
import team.chisel.utils.GeneralClient;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class RendererLayeredGlow implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public RendererLayeredGlow() {
|
||||
@@ -36,8 +39,9 @@ public class RendererLayeredGlow implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
Tessellator.instance.setColorOpaque_I(Configurations.configColors[world.getBlockMetadata(x, y, z)]);
|
||||
Tessellator.instance.setBrightness(0xF000F0);
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setColorOpaque_I(Configurations.configColors[world.getBlockMetadata(x, y, z)]);
|
||||
tessellator.setBrightness(0xF000F0);
|
||||
Drawing.renderAllFaces(renderer, block, x, y, z, ((BlockCarvableGlow) block).getGlowTexture());
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static org.lwjgl.opengl.GL11.GL_BLEND;
|
||||
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.glBlendFunc;
|
||||
import static org.lwjgl.opengl.GL11.glDisable;
|
||||
import static org.lwjgl.opengl.GL11.glEnable;
|
||||
import static org.lwjgl.opengl.GL11.glPopMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glPushMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glTranslatef;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -8,14 +16,18 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import team.chisel.block.BlockMultiLayerBase;
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class RendererMultiLayer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
float bot = -0.001f, top = 1.0f - bot;
|
||||
final static float bot = -0.001f;
|
||||
final static float top = 1.0f - bot;
|
||||
public static int id;
|
||||
|
||||
public RendererMultiLayer() {
|
||||
|
||||
@@ -7,12 +7,15 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.block.BlockRoadLine;
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class RendererRoadLine implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public RendererRoadLine() {
|
||||
|
||||
@@ -6,12 +6,15 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.block.BlockCarvableLayered;
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class RendererSimpleLayered implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public RendererSimpleLayered() {
|
||||
|
||||
@@ -6,11 +6,14 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import team.chisel.block.BlockSnakestone;
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class RendererSnakeStone implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int id;
|
||||
|
||||
@@ -6,11 +6,14 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import team.chisel.block.BlockCarvableStairs;
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class RendererStairs implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int id;
|
||||
|
||||
@@ -75,7 +75,7 @@ public class SubmapManagerAntiblock extends SubmapManagerBase {
|
||||
};
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTMFullbright rb;
|
||||
private RenderBlocksCTMFullbright rb;
|
||||
|
||||
private String color;
|
||||
private TextureSubmap submap, submapSmall;
|
||||
|
||||
@@ -14,7 +14,7 @@ import team.chisel.ctmlib.TextureSubmap;
|
||||
public class SubmapManagerCarpetFloor extends SubmapManagerBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTM rb;
|
||||
private RenderBlocksCTM rb;
|
||||
|
||||
private TextureSubmap submap;
|
||||
private TextureSubmap submapSmall;
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import static team.chisel.ctmlib.Dir.*;
|
||||
import static team.chisel.ctmlib.Dir.BOTTOM;
|
||||
import static team.chisel.ctmlib.Dir.BOTTOM_LEFT;
|
||||
import static team.chisel.ctmlib.Dir.BOTTOM_RIGHT;
|
||||
import static team.chisel.ctmlib.Dir.LEFT;
|
||||
import static team.chisel.ctmlib.Dir.RIGHT;
|
||||
import static team.chisel.ctmlib.Dir.TOP;
|
||||
import static team.chisel.ctmlib.Dir.TOP_LEFT;
|
||||
import static team.chisel.ctmlib.Dir.TOP_RIGHT;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
@@ -16,7 +16,7 @@ import team.chisel.ctmlib.TextureSubmap;
|
||||
public class SubmapManagerSlab implements ISubmapManager {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTM rb;
|
||||
private RenderBlocksCTM rb;
|
||||
|
||||
private TextureSubmap submap;
|
||||
private TextureSubmap submapSmall;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class SubmapManagerSpecialMaterial extends SubmapManagerBase {
|
||||
}
|
||||
};
|
||||
|
||||
private static RenderBlocksCTMFullbright renderBlocksFullbright;
|
||||
private RenderBlocksCTMFullbright renderBlocksFullbright;
|
||||
|
||||
private String color;
|
||||
private MaterialType materialType;
|
||||
@@ -84,4 +84,5 @@ public class SubmapManagerSpecialMaterial extends SubmapManagerBase {
|
||||
renderBlocksFullbright.submapSmall = submapSmall;
|
||||
return renderBlocksFullbright;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,20 @@
|
||||
package team.chisel.client.render.tile;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static org.lwjgl.opengl.GL11.GL_ALL_ATTRIB_BITS;
|
||||
import static org.lwjgl.opengl.GL11.GL_BLEND;
|
||||
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_CONSTANT_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.glBlendFunc;
|
||||
import static org.lwjgl.opengl.GL11.glDepthMask;
|
||||
import static org.lwjgl.opengl.GL11.glEnable;
|
||||
import static org.lwjgl.opengl.GL11.glPopAttrib;
|
||||
import static org.lwjgl.opengl.GL11.glPopMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glPushAttrib;
|
||||
import static org.lwjgl.opengl.GL11.glPushMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glRotatef;
|
||||
import static org.lwjgl.opengl.GL11.glScalef;
|
||||
import static org.lwjgl.opengl.GL11.glTranslated;
|
||||
import static org.lwjgl.opengl.GL11.glTranslatef;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
@@ -3,13 +3,16 @@ package team.chisel.compat.fmp;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.microblock.MicroMaterialRegistry;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartConverter;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import team.chisel.client.render.FullBrightMicroMaterial;
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
|
||||
public class FMPCompat implements IPartFactory, IPartConverter {
|
||||
@@ -42,4 +45,13 @@ public class FMPCompat implements IPartFactory, IPartConverter {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void registerGlowieVariation(IVariationInfo info, Block block) {
|
||||
int meta = info.getVariation()
|
||||
.getBlockMeta();
|
||||
|
||||
MicroMaterialRegistry.registerMaterial(
|
||||
new FullBrightMicroMaterial(block, meta),
|
||||
block.getUnlocalizedName() + ((meta > 0) ? ("_" + meta) : ""));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import static team.chisel.ctmlib.Dir.BOTTOM;
|
||||
import static team.chisel.ctmlib.Dir.BOTTOM_LEFT;
|
||||
import static team.chisel.ctmlib.Dir.BOTTOM_RIGHT;
|
||||
import static team.chisel.ctmlib.Dir.LEFT;
|
||||
import static team.chisel.ctmlib.Dir.RIGHT;
|
||||
import static team.chisel.ctmlib.Dir.TOP;
|
||||
import static team.chisel.ctmlib.Dir.TOP_LEFT;
|
||||
import static team.chisel.ctmlib.Dir.TOP_RIGHT;
|
||||
|
||||
import java.util.EnumMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.cricketcraft.chisel.api.IConnectable;
|
||||
import com.cricketcraft.chisel.api.IFacade;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import gnu.trove.map.TIntObjectMap;
|
||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
|
||||
//@formatter:off
|
||||
/**
|
||||
* The CTM renderer will draw the block's FACE using by assembling 4 quadrants from the 5 available block
|
||||
* textures. The normal Texture.png is the blocks "unconnected" texture, and is used when CTM is disabled or the block
|
||||
* has nothing to connect to. This texture has all of the outside corner quadrants The texture-ctm.png contains the
|
||||
* rest of the quadrants.
|
||||
* <pre><blockquote>
|
||||
* ┌─────────────────┐ ┌────────────────────────────────┐
|
||||
* │ texture.png │ │ texture-ctm.png │
|
||||
* │ ╔══════╤══════╗ │ │ ──────┼────── ║ ─────┼───── ║ │
|
||||
* │ ║ │ ║ │ │ │ │ │║ │ ║ │
|
||||
* │ ║ 16 │ 17 ║ │ │ │ 0 │ 1 │║ 2 │ 3 ║ │
|
||||
* │ ╟──────┼──────╢ │ │ ┼──────┼──────┼╟──────┼──────╢ │
|
||||
* │ ║ │ ║ │ │ │ │ │║ │ ║ │
|
||||
* │ ║ 18 │ 19 ║ │ │ │ 4 │ 5 │║ 6 │ 7 ║ │
|
||||
* │ ╚══════╧══════╝ │ │ ──────┼────── ║ ─────┼───── ║ │
|
||||
* └─────────────────┘ │ ═══════╤═══════╝ ─────┼───── ╚ │
|
||||
* │ │ │ ││ │ │ │
|
||||
* │ │ 8 │ 9 ││ 10 │ 11 │ │
|
||||
* │ ┼──────┼──────┼┼──────┼──────┼ │
|
||||
* │ │ │ ││ │ │ │
|
||||
* │ │ 12 │ 13 ││ 14 │ 15 │ │
|
||||
* │ ═══════╧═══════╗ ─────┼───── ╔ │
|
||||
* └────────────────────────────────┘
|
||||
* </blockquote></pre>
|
||||
* combining { 18, 13, 9, 16 }, we can generate a texture connected to the right!
|
||||
* <pre><blockquote>
|
||||
* ╔══════╤═══════
|
||||
* ║ │ │
|
||||
* ║ 16 │ 9 │
|
||||
* ╟──────┼──────┼
|
||||
* ║ │ │
|
||||
* ║ 18 │ 13 │
|
||||
* ╚══════╧═══════
|
||||
* </blockquote></pre>
|
||||
*
|
||||
* combining { 18, 13, 11, 2 }, we can generate a texture, in the shape of an L (connected to the right, and up
|
||||
* <pre><blockquote>
|
||||
* ║ ─────┼───── ╚
|
||||
* ║ │ │
|
||||
* ║ 2 │ 11 │
|
||||
* ╟──────┼──────┼
|
||||
* ║ │ │
|
||||
* ║ 18 │ 13 │
|
||||
* ╚══════╧═══════
|
||||
* </blockquote></pre>
|
||||
*
|
||||
* HAVE FUN!
|
||||
* -CptRageToaster-
|
||||
*/
|
||||
//@formatter:on
|
||||
public class CTM {
|
||||
|
||||
/** Some hardcoded offset values for the different corner indeces */
|
||||
protected static int[] submapOffsets = { 4, 5, 1, 0 };
|
||||
/** For use via the Chisel 2 config only, altering this could cause unintended behavior */
|
||||
public static boolean disableObscuredFaceCheckConfig = false;
|
||||
|
||||
public Optional<Boolean> disableObscuredFaceCheck = Optional.absent();
|
||||
|
||||
protected TIntObjectMap<Dir[]> submapMap = new TIntObjectHashMap<>();
|
||||
protected EnumMap<Dir, Boolean> connectionMap = Maps.newEnumMap(Dir.class);
|
||||
|
||||
protected CTM() {
|
||||
for (Dir dir : Dir.VALUES) {
|
||||
connectionMap.put(dir, false);
|
||||
}
|
||||
|
||||
// Mapping the different corner indeces to their respective dirs
|
||||
submapMap.put(0, new Dir[] { BOTTOM, LEFT, BOTTOM_LEFT });
|
||||
submapMap.put(1, new Dir[] { BOTTOM, RIGHT, BOTTOM_RIGHT });
|
||||
submapMap.put(2, new Dir[] { TOP, RIGHT, TOP_RIGHT });
|
||||
submapMap.put(3, new Dir[] { TOP, LEFT, TOP_LEFT });
|
||||
}
|
||||
|
||||
public static CTM getInstance() {
|
||||
return new CTM();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The indeces of the typical 4x4 submap to use for the given face at the given location.
|
||||
*
|
||||
* Indeces are in counter-clockwise order starting at bottom left.
|
||||
*/
|
||||
public int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side) {
|
||||
int[] ret = new int[] { 18, 19, 17, 16 };
|
||||
|
||||
if (world == null) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
buildConnectionMap(world, x, y, z, side, block, meta);
|
||||
|
||||
// Map connections to submap indeces
|
||||
for (int i = 0; i < 4; i++) {
|
||||
fillSubmaps(ret, i);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the connection map and stores it in this CTM instance. The {@link #connected(Dir)},
|
||||
* {@link #connectedAnd(Dir...)}, and {@link #connectedOr(Dir...)} methods can be used to access it.
|
||||
*/
|
||||
public void buildConnectionMap(IBlockAccess world, int x, int y, int z, int side, Block block, int meta) {
|
||||
for (Dir dir : Dir.VALUES) {
|
||||
connectionMap.put(dir, dir.isConnected(this, world, x, y, z, side, block, meta));
|
||||
}
|
||||
}
|
||||
|
||||
private void fillSubmaps(int[] ret, int idx) {
|
||||
Dir[] dirs = submapMap.get(idx);
|
||||
if (connectedOr(dirs[0], dirs[1])) {
|
||||
if (connectedAnd(dirs)) {
|
||||
// If all dirs are connected, we use the fully connected face,
|
||||
// the base offset value.
|
||||
ret[idx] = submapOffsets[idx];
|
||||
} else {
|
||||
// This is a bit magic-y, but basically the array is ordered so
|
||||
// the first dir requires an offset of 2, and the second dir
|
||||
// requires an offset of 8, plus the initial offset for the
|
||||
// corner.
|
||||
ret[idx] = submapOffsets[idx] + (connected(dirs[0]) ? 2 : 0) + (connected(dirs[1]) ? 8 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dir The direction to check connection in.
|
||||
* @return True if the cached connectionMap holds a connection in this {@link Dir direction}.
|
||||
*/
|
||||
public boolean connected(Dir dir) {
|
||||
return connectionMap.get(dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dirs The directions to check connection in.
|
||||
* @return True if the cached connectionMap holds a connection in <i><b>all</b></i> the given {@link Dir
|
||||
* directions}.
|
||||
*/
|
||||
public boolean connectedAnd(Dir... dirs) {
|
||||
for (Dir dir : dirs) {
|
||||
if (!connected(dir)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dirs The directions to check connection in.
|
||||
* @return True if the cached connectionMap holds a connection in <i><b>one of</b></i> the given {@link Dir
|
||||
* directions}.
|
||||
*/
|
||||
private boolean connectedOr(Dir... dirs) {
|
||||
for (Dir dir : dirs) {
|
||||
if (connected(dir)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple check for if the given block can connect to the given direction on the given side.
|
||||
*
|
||||
* @param world
|
||||
* @param x The x coordinate of the block to check <i>against</i>. This is not the position of your block.
|
||||
* @param y The y coordinate of the block to check <i>against</i>. This is not the position of your block.
|
||||
* @param z The z coordinate of the block to check <i>against</i>. This is not the position of your block.
|
||||
* @param side The side of the block to check for connection status. This is <i>not</i> the direction to check in.
|
||||
* @param block The block to check against for connection.
|
||||
* @param meta The metadata to check against for connection.
|
||||
* @return True if the given block can connect to the given location on the given side.
|
||||
*/
|
||||
public boolean isConnected(IBlockAccess world, int x, int y, int z, int side, Block block, int meta) {
|
||||
ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[side];
|
||||
return isConnected(world, x, y, z, dir, block, meta);
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple check for if the given block can connect to the given direction on the given side.
|
||||
*
|
||||
* @param world
|
||||
* @param x The x coordinate of the block to check <i>against</i>. This is not the position of your block.
|
||||
* @param y The y coordinate of the block to check <i>against</i>. This is not the position of your block.
|
||||
* @param z The z coordinate of the block to check <i>against</i>. This is not the position of your block.
|
||||
* @param dir The {@link ForgeDirection side} of the block to check for connection status. This is <i>not</i> the
|
||||
* direction to check in.
|
||||
* @param block The block to check against for connection.
|
||||
* @param meta The metadata to check against for connection.
|
||||
* @return True if the given block can connect to the given location on the given side.
|
||||
*/
|
||||
public boolean isConnected(IBlockAccess world, int x, int y, int z, ForgeDirection dir, Block block, int meta) {
|
||||
|
||||
if (CTMLib.chiselLoaded() && connectionBlocked(world, x, y, z, dir.ordinal())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int x2 = x + dir.offsetX;
|
||||
int y2 = y + dir.offsetY;
|
||||
int z2 = z + dir.offsetZ;
|
||||
|
||||
boolean disableObscured = disableObscuredFaceCheck.or(disableObscuredFaceCheckConfig);
|
||||
|
||||
Block con = getBlockOrFacade(world, x, y, z, dir.ordinal());
|
||||
Block obscuring = disableObscured ? null : getBlockOrFacade(world, x2, y2, z2, dir.ordinal());
|
||||
|
||||
// no block or a bad API user
|
||||
if (con == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean ret = con.equals(block) && getBlockOrFacadeMetadata(world, x, y, z, dir.ordinal()) == meta;
|
||||
|
||||
// no block obscuring this face
|
||||
if (obscuring == null) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// check that we aren't already connected outwards from this side
|
||||
ret &= !(obscuring.equals(block) && getBlockOrFacadeMetadata(world, x2, y2, z2, dir.ordinal()) == meta);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private boolean connectionBlocked(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block instanceof IConnectable) {
|
||||
return !((IConnectable) block).canConnectCTM(world, x, y, z, side);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* A utility method to access metadata from both the world and {@link IFacade} blocks in the world.
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param side The side to check for. -1 for unknown.
|
||||
* @return The metadata at this position in the world, or inside an {@link IFacade} block.
|
||||
*/
|
||||
public int getBlockOrFacadeMetadata(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block blk = world.getBlock(x, y, z);
|
||||
if (CTMLib.chiselLoaded()) {
|
||||
return getFacadeMeta(blk, world, x, y, z, side);
|
||||
}
|
||||
return world.getBlockMetadata(x, y, z);
|
||||
}
|
||||
|
||||
private int getFacadeMeta(Block blk, IBlockAccess world, int x, int y, int z, int side) {
|
||||
if (blk instanceof IFacade) {
|
||||
return ((IFacade) blk).getFacadeMetadata(world, x, y, z, side);
|
||||
}
|
||||
return world.getBlockMetadata(x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* A utility method to access a block from both the world and {@link IFacade} blocks in the world.
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param side The side to check for. -1 for unknown.
|
||||
* @return The block at this position in the world, or inside an {@link IFacade} block.
|
||||
*/
|
||||
public Block getBlockOrFacade(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block blk = world.getBlock(x, y, z);
|
||||
if (CTMLib.chiselLoaded()) {
|
||||
return getFacade(blk, world, x, y, z, side);
|
||||
}
|
||||
return blk;
|
||||
}
|
||||
|
||||
private Block getFacade(Block blk, IBlockAccess world, int x, int y, int z, int side) {
|
||||
if (blk instanceof IFacade) {
|
||||
blk = ((IFacade) blk).getFacade(world, x, y, z, side);
|
||||
}
|
||||
return blk;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Convenience implementation of ICMBlock. This does everything you should need for basic CTM.
|
||||
* <p>
|
||||
* This class does <i>not</i> handle metadata-dependent textures.
|
||||
*/
|
||||
public class CTMBlock extends Block implements ICTMBlock<ISubmapManager> {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private SubmapManagerCTM manager;
|
||||
|
||||
@Getter
|
||||
private final String modid;
|
||||
@Getter
|
||||
private final String texturePath;
|
||||
|
||||
private final int renderId;
|
||||
|
||||
public CTMBlock(String modid, String texturePath, int renderId) {
|
||||
super(Material.rock);
|
||||
this.modid = modid;
|
||||
this.texturePath = texturePath;
|
||||
this.renderId = renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
manager = new SubmapManagerCTM(texturePath);
|
||||
manager.registerIcons(modid, this, icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return manager.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return manager.getIcon(side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderType() {
|
||||
return renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubmapManager getManager(IBlockAccess world, int x, int y, int z, int meta) {
|
||||
return manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubmapManager getManager(int meta) {
|
||||
return manager;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import cpw.mods.fml.common.ModAPIManager;
|
||||
import team.chisel.Tags;
|
||||
|
||||
public class CTMLib {
|
||||
|
||||
public static final String VERSION = Tags.VERSION;
|
||||
|
||||
private static boolean chiselPresent, chiselInitialized;
|
||||
|
||||
public static boolean chiselLoaded() {
|
||||
if (!chiselInitialized) {
|
||||
chiselInitialized = true;
|
||||
chiselPresent = ModAPIManager.INSTANCE.hasAPI("ChiselAPI");
|
||||
}
|
||||
return chiselPresent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.crash.CrashReportCategory;
|
||||
import net.minecraft.util.ReportedException;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
/**
|
||||
* A convenience base class for CTM blocks. Any block using this must implement {@link ICTMBlock}.
|
||||
*/
|
||||
public class CTMRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
private final int renderId;
|
||||
|
||||
public CTMRenderer(int renderId) {
|
||||
this.renderId = renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
RenderBlocks rb = getContext(
|
||||
renderer,
|
||||
block,
|
||||
Minecraft.getMinecraft().theWorld,
|
||||
((ICTMBlock<?>) block).getManager(metadata),
|
||||
metadata);
|
||||
Drawing.drawBlock(block, metadata, rb);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
rb.unlockBlockBounds();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks rendererOld) {
|
||||
try {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
RenderBlocks rb = getContext(
|
||||
rendererOld,
|
||||
block,
|
||||
world,
|
||||
((ICTMBlock<?>) block).getManager(world, x, y, z, meta),
|
||||
meta);
|
||||
boolean ret = rb.renderStandardBlock(block, x, y, z);
|
||||
rb.unlockBlockBounds();
|
||||
return ret;
|
||||
} catch (Throwable t) {
|
||||
CrashReport crashreport = CrashReport.makeCrashReport(t, "Rendering CTM Block");
|
||||
CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being rendered");
|
||||
crashreportcategory.addCrashSection("Block name", GameRegistry.findUniqueIdentifierFor(block));
|
||||
crashreportcategory.addCrashSection("Block metadata", world.getBlockMetadata(x, y, z));
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
}
|
||||
|
||||
protected RenderBlocks getContext(RenderBlocks rendererOld, Block block, IBlockAccess world, ISubmapManager manager,
|
||||
int meta) {
|
||||
if (!rendererOld.hasOverrideBlockTexture() && manager != null) {
|
||||
RenderBlocks rb = manager.createRenderContext(rendererOld, block, world);
|
||||
if (rb != null && rb != rendererOld) {
|
||||
rb.blockAccess = world;
|
||||
if (rendererOld.lockBlockBounds) {
|
||||
rb.overrideBlockBounds(
|
||||
rendererOld.renderMinX,
|
||||
rendererOld.renderMinY,
|
||||
rendererOld.renderMinZ,
|
||||
rendererOld.renderMaxX,
|
||||
rendererOld.renderMaxY,
|
||||
rendererOld.renderMaxZ);
|
||||
}
|
||||
if (rb instanceof RenderBlocksCTM) {
|
||||
RenderBlocksCTM rbctm = (RenderBlocksCTM) rb;
|
||||
rbctm.manager = rbctm.manager == null ? manager : rbctm.manager;
|
||||
rbctm.rendererOld = rbctm.rendererOld == null ? rendererOld : rbctm.rendererOld;
|
||||
}
|
||||
return rb;
|
||||
}
|
||||
}
|
||||
return rendererOld;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return renderId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.EAST;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.WEST;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.getOrientation;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Think of this class as a "Two dimensional ForgeDirection, with diagonals".
|
||||
* <p>
|
||||
* It represents the eight different directions a face of a block can connect with CTM, and contains the logic for
|
||||
* determining if a block is indeed connected in that direction.
|
||||
* <p>
|
||||
* Note that, for example, {@link #TOP_RIGHT} does not mean connected to the {@link #TOP} and {@link #RIGHT}, but
|
||||
* connected in the diagonal direction represented by {@link #TOP_RIGHT}. This is used for inner corner rendering.
|
||||
*/
|
||||
public enum Dir {
|
||||
|
||||
// @formatter:off
|
||||
TOP(UP),
|
||||
TOP_RIGHT(UP, EAST),
|
||||
RIGHT(EAST),
|
||||
BOTTOM_RIGHT(DOWN, EAST),
|
||||
BOTTOM(DOWN),
|
||||
BOTTOM_LEFT(DOWN, WEST),
|
||||
LEFT(WEST),
|
||||
TOP_LEFT(UP, WEST);
|
||||
// @formatter:on
|
||||
|
||||
/**
|
||||
* All values of this enum, used to prevent unnecessary allocation via {@link #values()}.
|
||||
*/
|
||||
public static final Dir[] VALUES = values();
|
||||
private static final ForgeDirection NORMAL = SOUTH;
|
||||
|
||||
private ForgeDirection[] dirs;
|
||||
|
||||
private Dir(ForgeDirection... dirs) {
|
||||
this.dirs = dirs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds if this block is connected for the given side in this Dir.
|
||||
*
|
||||
* @param inst The CTM instance to use for logic.
|
||||
* @param world The world the block is in.
|
||||
* @param x The x coordinate of your block.
|
||||
* @param y The y coordinate of your block.
|
||||
* @param z The z coordinate of your block.
|
||||
* @param sideIdx The side index of the current face. This equivalent to {@link ForgeDirection#ordinal()}
|
||||
* @param block The block being rendered.
|
||||
* @param meta The metadata of the block.
|
||||
* @return True if the block is connected in the given Dir, false otherwise.
|
||||
*/
|
||||
public boolean isConnected(CTM inst, IBlockAccess world, int x, int y, int z, int sideIdx, Block block, int meta) {
|
||||
ForgeDirection side = getOrientation(sideIdx);
|
||||
ForgeDirection[] dirs = getNormalizedDirs(side);
|
||||
for (ForgeDirection dir : dirs) {
|
||||
x += dir.offsetX;
|
||||
y += dir.offsetY;
|
||||
z += dir.offsetZ;
|
||||
}
|
||||
return inst.isConnected(world, x, y, z, side, block, meta);
|
||||
}
|
||||
|
||||
private ForgeDirection[] getNormalizedDirs(ForgeDirection normal) {
|
||||
if (normal == NORMAL) {
|
||||
return dirs;
|
||||
} else if (normal == NORMAL.getOpposite()) {
|
||||
// If this is the opposite direction of the default normal, we
|
||||
// need to mirror the dirs
|
||||
// A mirror version does not affect y+ and y- so we ignore those
|
||||
ForgeDirection[] ret = new ForgeDirection[dirs.length];
|
||||
for (int i = 0; i < ret.length; i++) {
|
||||
ret[i] = dirs[i].offsetY != 0 ? dirs[i] : dirs[i].getOpposite();
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
ForgeDirection axis = null;
|
||||
// Next, we need different a different rotation axis depending
|
||||
// on if this is up/down or not
|
||||
if (normal.offsetY == 0) {
|
||||
// If it is not up/down, pick either the left or right-hand
|
||||
// rotation
|
||||
axis = normal == NORMAL.getRotation(UP) ? UP : DOWN;
|
||||
} else {
|
||||
// If it is up/down, pick either the up or down rotation.
|
||||
axis = normal == UP ? NORMAL.getRotation(DOWN) : NORMAL.getRotation(UP);
|
||||
}
|
||||
ForgeDirection[] ret = new ForgeDirection[dirs.length];
|
||||
// Finally apply all the rotations
|
||||
for (int i = 0; i < ret.length; i++) {
|
||||
ret[i] = dirs[i].getRotation(axis);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class Drawing {
|
||||
|
||||
public static void drawBlock(Block block, IIcon icon, RenderBlocks renderer) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, icon);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, icon);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, icon);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, icon);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, icon);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, icon);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public static void drawBlock(Block block, int meta, RenderBlocks renderer) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public static void renderAllFaces(RenderBlocks renderer, Block block, int x, int y, int z, IIcon icon) {
|
||||
renderer.renderFaceYNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceYPos(block, x, y, z, icon);
|
||||
renderer.renderFaceZNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceZPos(block, x, y, z, icon);
|
||||
renderer.renderFaceXNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceXPos(block, x, y, z, icon);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public interface ICTMBlock<T extends ISubmapManager> {
|
||||
|
||||
/**
|
||||
* Gets the {@link ISubmapManager} for this block in the world.
|
||||
*/
|
||||
T getManager(IBlockAccess world, int x, int y, int z, int meta);
|
||||
|
||||
/**
|
||||
* Gets the {@link ISubmapManager} for this block in item form.
|
||||
*
|
||||
* @param meta The meta (damage) of the stack.
|
||||
*/
|
||||
T getManager(int meta);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface ISubmap {
|
||||
|
||||
/**
|
||||
* The width, in icons, of the submap.
|
||||
*/
|
||||
int getWidth();
|
||||
|
||||
/**
|
||||
* The height, in icons, of the submap.
|
||||
*/
|
||||
int getHeight();
|
||||
|
||||
IIcon getSubIcon(int x, int y);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public interface ISubmapManager {
|
||||
|
||||
/**
|
||||
* Gets the icon for item rendering, based on side and item metadata.
|
||||
*
|
||||
* @param side Side of the ItemBlock.
|
||||
* @param meta Metadata of the ItemBlock.
|
||||
* @return The IIcon for rendering.
|
||||
*/
|
||||
IIcon getIcon(int side, int meta);
|
||||
|
||||
/**
|
||||
* Gets the icon for world rendering, based on world position and side.
|
||||
*/
|
||||
IIcon getIcon(IBlockAccess world, int x, int y, int z, int side);
|
||||
|
||||
/**
|
||||
* Hook for registering any custom icons you might need in this class. Will be called during the normal block
|
||||
* method.
|
||||
*
|
||||
* @param modName The mod ID this submap was registered to.
|
||||
* @param block The block being registered for.
|
||||
* @param register The IIconRegister instance.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerIcons(String modName, Block block, IIconRegister register);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side);
|
||||
}
|
||||
@@ -0,0 +1,561 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.XNEG_LB;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.XNEG_LT;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.XNEG_RB;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.XNEG_RT;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.XPOS_LB;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.XPOS_LT;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.XPOS_RB;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.XPOS_RT;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.YNEG_LB;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.YNEG_LT;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.YNEG_RB;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.YNEG_RT;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.YPOS_LB;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.YPOS_LT;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.YPOS_RB;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.YPOS_RT;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.ZNEG_LB;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.ZNEG_LT;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.ZNEG_RB;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.ZNEG_RT;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.ZPOS_LB;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.ZPOS_LT;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.ZPOS_RB;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.SubSide.ZPOS_RT;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.X;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.XY;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.XYZ;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.XY_HALF;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.XY_HALF_Z;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.XZ;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.XZ_HALF;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.XZ_HALF_Y;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.X_HALF;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.X_HALF_Y;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.X_HALF_YZ;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.X_HALF_Z;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.Y;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.YZ;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.YZ_HALF;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.YZ_HALF_X;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.Y_HALF;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.Y_HALF_X;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.Y_HALF_XZ;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.Y_HALF_Z;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.Z;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.ZERO;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.Z_HALF;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.Z_HALF_X;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.Z_HALF_XY;
|
||||
import static team.chisel.ctmlib.RenderBlocksCTM.Vert.Z_HALF_Y;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class RenderBlocksCTM extends RenderBlocks {
|
||||
|
||||
/**
|
||||
* An enum for all possible 26 sub-side vertices.
|
||||
*
|
||||
* The naming scheme is as follows:
|
||||
*
|
||||
* ZERO is a special case, it is the absolute min point of the block. X, Y, Z, or any combination means that the
|
||||
* axes listed in the name are at 1. X, Y, Z, or any combination followed by HALF means that those axes are at 0.5.
|
||||
* X, Y, Z, or any combination after a HALF means those axes are at 1.
|
||||
*/
|
||||
protected enum Vert {
|
||||
|
||||
// @formatter:off
|
||||
ZERO(0, 0, 0),
|
||||
XYZ(1, 1, 1),
|
||||
X(1, 0, 0),
|
||||
Y(0, 1, 0),
|
||||
Z(0, 0, 1),
|
||||
XY(1, 1, 0),
|
||||
YZ(0, 1, 1),
|
||||
XZ(1, 0, 1),
|
||||
X_HALF(0.5, 0, 0),
|
||||
Y_HALF(0, 0.5, 0),
|
||||
Z_HALF(0, 0, 0.5),
|
||||
XY_HALF(0.5, 0.5, 0),
|
||||
YZ_HALF(0, 0.5, 0.5),
|
||||
XZ_HALF(0.5, 0, 0.5),
|
||||
X_HALF_Y(0.5, 1, 0),
|
||||
X_HALF_Z(0.5, 0, 1),
|
||||
Y_HALF_X(1, 0.5, 0),
|
||||
Y_HALF_Z(0, 0.5, 1),
|
||||
Z_HALF_X(1, 0, 0.5),
|
||||
Z_HALF_Y(0, 1, 0.5),
|
||||
X_HALF_YZ(0.5, 1, 1),
|
||||
Y_HALF_XZ(1, 0.5, 1),
|
||||
Z_HALF_XY(1, 1, 0.5),
|
||||
XY_HALF_Z(0.5, 0.5, 1),
|
||||
YZ_HALF_X(1, 0.5, 0.5),
|
||||
XZ_HALF_Y(0.5, 1, 0.5);
|
||||
// @formatter:on
|
||||
|
||||
private double x, y, z;
|
||||
|
||||
private Vert(double x, double y, double z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
private static double u, v, xDiff, yDiff, zDiff, uDiff, vDiff;
|
||||
|
||||
void render(RenderBlocksCTM inst, ForgeDirection normal, int cacheID) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (inst.enableAO) {
|
||||
tessellator.setColorOpaque_F(inst.redCache[cacheID], inst.grnCache[cacheID], inst.bluCache[cacheID]);
|
||||
tessellator.setBrightness(inst.lightingCache[cacheID]);
|
||||
}
|
||||
|
||||
u = cacheID == 1 || cacheID == 2 ? inst.maxU : inst.minU;
|
||||
v = cacheID < 2 ? inst.maxV : inst.minV;
|
||||
|
||||
uDiff = inst.maxU - inst.minU;
|
||||
vDiff = inst.maxV - inst.minV;
|
||||
|
||||
if (inst.renderMinX + inst.renderMinY + inst.renderMinZ != 0
|
||||
|| inst.renderMaxX + inst.renderMaxY + inst.renderMaxZ != 3) {
|
||||
boolean uMin = u == inst.minU;
|
||||
boolean vMin = v == inst.minV;
|
||||
|
||||
xDiff = inst.renderMaxX - inst.renderMinX;
|
||||
yDiff = inst.renderMaxY - inst.renderMinY;
|
||||
zDiff = inst.renderMaxZ - inst.renderMinZ;
|
||||
|
||||
if (normal.offsetY != 0) {
|
||||
uDiff *= uMin ? inst.renderMinX : 1 - inst.renderMaxX;
|
||||
vDiff *= vMin ? inst.renderMinZ : 1 - inst.renderMaxZ;
|
||||
} else if (normal.offsetX != 0) {
|
||||
uDiff *= uMin ? inst.renderMinZ : 1 - inst.renderMaxZ;
|
||||
vDiff *= vMin ? inst.renderMinY : 1 - inst.renderMaxY;
|
||||
} else if (normal.offsetZ != 0) {
|
||||
uDiff *= uMin ? inst.renderMinX : 1 - inst.renderMaxX;
|
||||
vDiff *= vMin ? inst.renderMinY : 1 - inst.renderMaxY;
|
||||
}
|
||||
u = u == inst.minU ? inst.minU + uDiff : inst.maxU - uDiff;
|
||||
|
||||
v = v == inst.minV ? inst.minV + vDiff : inst.maxV - vDiff;
|
||||
} else {
|
||||
xDiff = yDiff = zDiff = 1;
|
||||
}
|
||||
|
||||
tessellator.addVertexWithUV(
|
||||
inst.renderMinX + (x * xDiff),
|
||||
inst.renderMinY + (y * yDiff),
|
||||
inst.renderMinZ + (z * zDiff),
|
||||
u,
|
||||
v);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Each side is divided into 4 sub-sides. LB(left bottom), RB(right bottom), LT(right top), and RT(right top).
|
||||
*
|
||||
* Each sub-side contains 4 {@link Vert} objects representing its position on the block.
|
||||
*/
|
||||
protected enum SubSide {
|
||||
|
||||
// @formatter:off
|
||||
XNEG_LB(ZERO, Z_HALF, YZ_HALF, Y_HALF), XNEG_RB(Z_HALF, Z, Y_HALF_Z, YZ_HALF), XNEG_RT(YZ_HALF, Y_HALF_Z, YZ, Z_HALF_Y), XNEG_LT(Y_HALF, YZ_HALF, Z_HALF_Y, Y),
|
||||
XPOS_LB(XZ, Z_HALF_X, YZ_HALF_X, Y_HALF_XZ), XPOS_RB(Z_HALF_X, X, Y_HALF_X, YZ_HALF_X), XPOS_RT(YZ_HALF_X, Y_HALF_X, XY, Z_HALF_XY), XPOS_LT(Y_HALF_XZ, YZ_HALF_X, Z_HALF_XY, XYZ),
|
||||
|
||||
ZNEG_LB(X, X_HALF, XY_HALF, Y_HALF_X), ZNEG_RB(X_HALF, ZERO, Y_HALF, XY_HALF), ZNEG_RT(XY_HALF, Y_HALF, Y, X_HALF_Y), ZNEG_LT(Y_HALF_X, XY_HALF, X_HALF_Y, XY),
|
||||
ZPOS_LB(Z, X_HALF_Z, XY_HALF_Z, Y_HALF_Z), ZPOS_RB(X_HALF_Z, XZ, Y_HALF_XZ, XY_HALF_Z), ZPOS_RT(XY_HALF_Z, Y_HALF_XZ, XYZ, X_HALF_YZ), ZPOS_LT(Y_HALF_Z, XY_HALF_Z, X_HALF_YZ, YZ),
|
||||
|
||||
YNEG_LB(ZERO, X_HALF, XZ_HALF, Z_HALF), YNEG_RB(X_HALF, X, Z_HALF_X, XZ_HALF), YNEG_RT(XZ_HALF, Z_HALF_X, XZ, X_HALF_Z), YNEG_LT(Z_HALF, XZ_HALF, X_HALF_Z, Z),
|
||||
YPOS_LB(YZ, X_HALF_YZ, XZ_HALF_Y, Z_HALF_Y), YPOS_RB(X_HALF_YZ, XYZ, Z_HALF_XY, XZ_HALF_Y), YPOS_RT(XZ_HALF_Y, Z_HALF_XY, XY, X_HALF_Y), YPOS_LT(Z_HALF_Y, XZ_HALF_Y, X_HALF_Y, Y);
|
||||
// @formatter:on
|
||||
private Vert xmin, xmax, ymin, ymax;
|
||||
private ForgeDirection normal;
|
||||
|
||||
SubSide(Vert xmin, Vert ymin, Vert ymax, Vert xmax) {
|
||||
this.xmin = xmin;
|
||||
this.ymin = ymin;
|
||||
this.ymax = ymax;
|
||||
this.xmax = xmax;
|
||||
this.normal = calcNormal();
|
||||
}
|
||||
|
||||
private ForgeDirection calcNormal() {
|
||||
double xTot = xmin.x + xmax.x + ymin.x + ymax.x;
|
||||
double yTot = xmin.y + xmax.y + ymin.y + ymax.y;
|
||||
double zTot = xmin.z + xmax.z + ymin.z + ymax.z;
|
||||
if (xTot % 4 == 0) {
|
||||
return xTot > 0 ? ForgeDirection.EAST : ForgeDirection.WEST;
|
||||
} else if (yTot % 4 == 0) {
|
||||
return yTot > 0 ? ForgeDirection.UP : ForgeDirection.DOWN;
|
||||
} else if (zTot % 4 == 0) {
|
||||
return zTot > 0 ? ForgeDirection.SOUTH : ForgeDirection.NORTH;
|
||||
}
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
void render(RenderBlocksCTM inst) {
|
||||
xmin.render(inst, normal, 0);
|
||||
ymin.render(inst, normal, 1);
|
||||
ymax.render(inst, normal, 2);
|
||||
xmax.render(inst, normal, 3);
|
||||
}
|
||||
}
|
||||
|
||||
public CTM ctm = CTM.getInstance();
|
||||
|
||||
// globals added to save the JVM some trouble. No need to constantly create
|
||||
// and destroy ints if we don't have to
|
||||
protected int blockLightBitChannel = 0;
|
||||
protected int redBitChannel = 0;
|
||||
protected int greenBitChannel = 0;
|
||||
protected int blueBitChannel = 0;
|
||||
protected int sunlightBitChannel = 0;
|
||||
|
||||
public RenderBlocksCTM() {
|
||||
super();
|
||||
renderMaxX = renderMaxY = renderMaxZ = 1;
|
||||
}
|
||||
|
||||
protected double minU, maxU;
|
||||
protected double minV, maxV;
|
||||
protected int[] lightingCache = new int[4];
|
||||
protected float[] redCache = new float[4];
|
||||
protected float[] grnCache = new float[4];
|
||||
protected float[] bluCache = new float[4];
|
||||
public TextureSubmap submap;
|
||||
public TextureSubmap submapSmall;
|
||||
public RenderBlocks rendererOld;
|
||||
public ISubmapManager manager;
|
||||
|
||||
protected int[][] lightmap = new int[3][3];
|
||||
protected float[][] redmap = new float[3][3];
|
||||
protected float[][] grnmap = new float[3][3];
|
||||
protected float[][] blumap = new float[3][3];
|
||||
|
||||
protected int bx, by, bz, meta;
|
||||
|
||||
@Getter
|
||||
protected boolean inWorld = false;
|
||||
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, int x, int y, int z) {
|
||||
bx = x;
|
||||
by = y;
|
||||
bz = z;
|
||||
meta = Minecraft.getMinecraft().theWorld.getBlockMetadata(x, y, z);
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
tessellator.addTranslation(x, y, z);
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
setOverrideBlockTexture(rendererOld.overrideBlockTexture);
|
||||
}
|
||||
inWorld = true;
|
||||
boolean res = super.renderStandardBlock(block, x, y, z);
|
||||
inWorld = false;
|
||||
tessellator.addTranslation(-x, -y, -z);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* @formatter:off
|
||||
* This method fills a 3x3 grid of light values based on the four corners, by averaging them together.
|
||||
*
|
||||
* 2 TL x TR
|
||||
*
|
||||
* 1 x x x
|
||||
*
|
||||
* 0 BL x BR
|
||||
* 0 1 2
|
||||
*
|
||||
* Note: Variable names mean nothing... don't touch
|
||||
*
|
||||
* ._.
|
||||
*
|
||||
* shakes fist in anger
|
||||
*/
|
||||
// @formatter:on
|
||||
protected void fillLightmap(int bottomLeft, int bottomRight, int topRight, int topLeft) {
|
||||
lightmap[0][0] = bottomLeft;
|
||||
lightmap[2][0] = bottomRight;
|
||||
lightmap[2][2] = topRight;
|
||||
lightmap[0][2] = topLeft;
|
||||
|
||||
lightmap[1][0] = avg(bottomLeft, bottomRight);
|
||||
lightmap[2][1] = avg(bottomRight, topRight);
|
||||
lightmap[1][2] = avg(topRight, topLeft);
|
||||
lightmap[0][1] = avg(topLeft, bottomLeft);
|
||||
|
||||
lightmap[1][1] = avg(bottomLeft, bottomRight, topRight, topLeft);
|
||||
}
|
||||
|
||||
protected void fillColormap(float bottomLeft, float bottomRight, float topRight, float topLeft, float[][] map) {
|
||||
map[0][0] = bottomLeft;
|
||||
map[2][0] = bottomRight;
|
||||
map[2][2] = topRight;
|
||||
map[0][2] = topLeft;
|
||||
|
||||
map[1][0] = (bottomLeft + bottomRight) / 2.0F;
|
||||
map[2][1] = (bottomRight + topRight) / 2.0F;
|
||||
map[1][2] = (topRight + topLeft) / 2.0F;
|
||||
map[0][1] = (topLeft + bottomLeft) / 2.0F;
|
||||
|
||||
map[1][1] = (bottomLeft + bottomRight + topRight + topLeft) / 4.0F;
|
||||
}
|
||||
|
||||
protected void getLight(int x, int y) {
|
||||
lightingCache[0] = lightmap[0 + x][0 + y];
|
||||
lightingCache[1] = lightmap[1 + x][0 + y];
|
||||
lightingCache[2] = lightmap[1 + x][1 + y];
|
||||
lightingCache[3] = lightmap[0 + x][1 + y];
|
||||
|
||||
redCache[0] = redmap[0 + x][0 + y];
|
||||
redCache[1] = redmap[1 + x][0 + y];
|
||||
redCache[2] = redmap[1 + x][1 + y];
|
||||
redCache[3] = redmap[0 + x][1 + y];
|
||||
|
||||
grnCache[0] = grnmap[0 + x][0 + y];
|
||||
grnCache[1] = grnmap[1 + x][0 + y];
|
||||
grnCache[2] = grnmap[1 + x][1 + y];
|
||||
grnCache[3] = grnmap[0 + x][1 + y];
|
||||
|
||||
bluCache[0] = blumap[0 + x][0 + y];
|
||||
bluCache[1] = blumap[1 + x][0 + y];
|
||||
bluCache[2] = blumap[1 + x][1 + y];
|
||||
bluCache[3] = blumap[0 + x][1 + y];
|
||||
}
|
||||
|
||||
/**
|
||||
* This works around a bug in CLC atm
|
||||
*/
|
||||
private int avg(int... lightVals) {
|
||||
blockLightBitChannel = 0;
|
||||
redBitChannel = 0;
|
||||
greenBitChannel = 0;
|
||||
blueBitChannel = 0;
|
||||
sunlightBitChannel = 0;
|
||||
|
||||
for (int light : lightVals) {
|
||||
blockLightBitChannel += (light & 0xFF);
|
||||
redBitChannel += (light & 0xF00);
|
||||
greenBitChannel += (light & 0xF000);
|
||||
blueBitChannel += (light & 0xF0000);
|
||||
sunlightBitChannel += (light & 0xF00000);
|
||||
}
|
||||
|
||||
return ((blockLightBitChannel / lightVals.length) & 0xFF) | ((redBitChannel / lightVals.length) & 0xF00)
|
||||
| ((greenBitChannel / lightVals.length) & 0xF000)
|
||||
| ((blueBitChannel / lightVals.length) & 0xF0000)
|
||||
| ((sunlightBitChannel / lightVals.length) & 0xF00000);
|
||||
}
|
||||
|
||||
protected void side(Block block, SubSide side, int iconIndex) {
|
||||
|
||||
IIcon icon;
|
||||
TextureSubmap map;
|
||||
if (iconIndex >= 16) {
|
||||
iconIndex -= 16;
|
||||
map = submapSmall;
|
||||
} else {
|
||||
map = submap;
|
||||
}
|
||||
|
||||
if (map == null) {
|
||||
icon = getBlockIconFromSideAndMetadata(block, side.normal.ordinal(), meta);
|
||||
} else {
|
||||
int x = iconIndex % map.getWidth();
|
||||
int y = iconIndex / map.getHeight();
|
||||
icon = map.getSubIcon(x, y);
|
||||
}
|
||||
|
||||
double umax = icon.getMaxU();
|
||||
double umin = icon.getMinU();
|
||||
double vmax = icon.getMaxV();
|
||||
double vmin = icon.getMinV();
|
||||
|
||||
minU = umin;
|
||||
maxU = umax;
|
||||
minV = vmin;
|
||||
maxV = vmax;
|
||||
|
||||
// uCache[0] = umin;
|
||||
// uCache[1] = umax;
|
||||
// uCache[2] = umax;
|
||||
// uCache[3] = umin;
|
||||
//
|
||||
// vCache[0] = vmax;
|
||||
// vCache[1] = vmax;
|
||||
// vCache[2] = vmin;
|
||||
// vCache[3] = vmin;
|
||||
|
||||
side.render(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
pre(ForgeDirection.WEST);
|
||||
if (!inWorld || hasOverrideBlockTexture() || submap == null) {
|
||||
super.renderFaceXNeg(block, 0, 0, 0, icon);
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 4);
|
||||
|
||||
fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft);
|
||||
fillColormap(colorRedBottomRight, colorRedTopRight, colorRedTopLeft, colorRedBottomLeft, redmap);
|
||||
fillColormap(colorGreenBottomRight, colorGreenTopRight, colorGreenTopLeft, colorGreenBottomLeft, grnmap);
|
||||
fillColormap(colorBlueBottomRight, colorBlueTopRight, colorBlueTopLeft, colorBlueBottomLeft, blumap);
|
||||
|
||||
getLight(0, 0);
|
||||
side(block, XNEG_LB, tex[0]);
|
||||
getLight(1, 0);
|
||||
side(block, XNEG_RB, tex[1]);
|
||||
getLight(1, 1);
|
||||
side(block, XNEG_RT, tex[2]);
|
||||
getLight(0, 1);
|
||||
side(block, XNEG_LT, tex[3]);
|
||||
}
|
||||
post(ForgeDirection.WEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
pre(ForgeDirection.EAST);
|
||||
if (!inWorld || hasOverrideBlockTexture() || submap == null) {
|
||||
super.renderFaceXPos(block, 0, 0, 0, icon);
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 5);
|
||||
|
||||
fillLightmap(brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight, brightnessTopRight);
|
||||
fillColormap(colorRedTopLeft, colorRedBottomLeft, colorRedBottomRight, colorRedTopRight, redmap);
|
||||
fillColormap(colorGreenTopLeft, colorGreenBottomLeft, colorGreenBottomRight, colorGreenTopRight, grnmap);
|
||||
fillColormap(colorBlueTopLeft, colorBlueBottomLeft, colorBlueBottomRight, colorBlueTopRight, blumap);
|
||||
|
||||
getLight(0, 0);
|
||||
side(block, XPOS_LB, tex[0]);
|
||||
getLight(1, 0);
|
||||
side(block, XPOS_RB, tex[1]);
|
||||
getLight(1, 1);
|
||||
side(block, XPOS_RT, tex[2]);
|
||||
getLight(0, 1);
|
||||
side(block, XPOS_LT, tex[3]);
|
||||
}
|
||||
post(ForgeDirection.EAST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
pre(ForgeDirection.NORTH);
|
||||
if (!inWorld || hasOverrideBlockTexture() || submap == null) {
|
||||
super.renderFaceZNeg(block, 0, 0, 0, icon);
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 2);
|
||||
|
||||
fillLightmap(brightnessBottomRight, brightnessTopRight, brightnessTopLeft, brightnessBottomLeft);
|
||||
fillColormap(colorRedBottomRight, colorRedTopRight, colorRedTopLeft, colorRedBottomLeft, redmap);
|
||||
fillColormap(colorGreenBottomRight, colorGreenTopRight, colorGreenTopLeft, colorGreenBottomLeft, grnmap);
|
||||
fillColormap(colorBlueBottomRight, colorBlueTopRight, colorBlueTopLeft, colorBlueBottomLeft, blumap);
|
||||
|
||||
getLight(0, 0);
|
||||
side(block, ZNEG_LB, tex[0]);
|
||||
getLight(1, 0);
|
||||
side(block, ZNEG_RB, tex[1]);
|
||||
getLight(1, 1);
|
||||
side(block, ZNEG_RT, tex[2]);
|
||||
getLight(0, 1);
|
||||
side(block, ZNEG_LT, tex[3]);
|
||||
}
|
||||
post(ForgeDirection.NORTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
pre(ForgeDirection.SOUTH);
|
||||
if (!inWorld || hasOverrideBlockTexture() || submap == null) {
|
||||
super.renderFaceZPos(block, 0, 0, 0, icon);
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 3);
|
||||
|
||||
fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft);
|
||||
fillColormap(colorRedBottomLeft, colorRedBottomRight, colorRedTopRight, colorRedTopLeft, redmap);
|
||||
fillColormap(colorGreenBottomLeft, colorGreenBottomRight, colorGreenTopRight, colorGreenTopLeft, grnmap);
|
||||
fillColormap(colorBlueBottomLeft, colorBlueBottomRight, colorBlueTopRight, colorBlueTopLeft, blumap);
|
||||
|
||||
getLight(0, 0);
|
||||
side(block, ZPOS_LB, tex[0]);
|
||||
getLight(1, 0);
|
||||
side(block, ZPOS_RB, tex[1]);
|
||||
getLight(1, 1);
|
||||
side(block, ZPOS_RT, tex[2]);
|
||||
getLight(0, 1);
|
||||
side(block, ZPOS_LT, tex[3]);
|
||||
}
|
||||
post(ForgeDirection.SOUTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
pre(ForgeDirection.DOWN);
|
||||
if (!inWorld || hasOverrideBlockTexture() || submap == null) {
|
||||
super.renderFaceYNeg(block, 0, 0, 0, icon);
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 0);
|
||||
|
||||
fillLightmap(brightnessBottomLeft, brightnessBottomRight, brightnessTopRight, brightnessTopLeft);
|
||||
fillColormap(colorRedBottomLeft, colorRedBottomRight, colorRedTopRight, colorRedTopLeft, redmap);
|
||||
fillColormap(colorGreenBottomLeft, colorGreenBottomRight, colorGreenTopRight, colorGreenTopLeft, grnmap);
|
||||
fillColormap(colorBlueBottomLeft, colorBlueBottomRight, colorBlueTopRight, colorBlueTopLeft, blumap);
|
||||
|
||||
getLight(0, 0);
|
||||
side(block, YNEG_LB, tex[0]);
|
||||
getLight(1, 0);
|
||||
side(block, YNEG_RB, tex[1]);
|
||||
getLight(1, 1);
|
||||
side(block, YNEG_RT, tex[2]);
|
||||
getLight(0, 1);
|
||||
side(block, YNEG_LT, tex[3]);
|
||||
}
|
||||
post(ForgeDirection.DOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
pre(ForgeDirection.UP);
|
||||
if (!inWorld || hasOverrideBlockTexture() || submap == null) {
|
||||
super.renderFaceYPos(block, 0, 0, 0, icon);
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 1);
|
||||
|
||||
fillLightmap(brightnessTopRight, brightnessTopLeft, brightnessBottomLeft, brightnessBottomRight);
|
||||
fillColormap(colorRedTopRight, colorRedTopLeft, colorRedBottomLeft, colorRedBottomRight, redmap);
|
||||
fillColormap(colorGreenTopRight, colorGreenTopLeft, colorGreenBottomLeft, colorGreenBottomRight, grnmap);
|
||||
fillColormap(colorBlueTopRight, colorBlueTopLeft, colorBlueBottomLeft, colorBlueBottomRight, blumap);
|
||||
|
||||
getLight(0, 0);
|
||||
side(block, YPOS_LB, tex[0]);
|
||||
getLight(1, 0);
|
||||
side(block, YPOS_RB, tex[1]);
|
||||
getLight(1, 1);
|
||||
side(block, YPOS_RT, tex[2]);
|
||||
getLight(0, 1);
|
||||
side(block, YPOS_LT, tex[3]);
|
||||
}
|
||||
post(ForgeDirection.UP);
|
||||
}
|
||||
|
||||
protected void pre(ForgeDirection face) {
|
||||
manager.preRenderSide(this, blockAccess, bx, by, bz, face);
|
||||
}
|
||||
|
||||
protected void post(ForgeDirection face) {
|
||||
manager.postRenderSide(this, blockAccess, bx, by, bz, face);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
|
||||
/**
|
||||
* Used by {@link TextureType#CTMV}
|
||||
*/
|
||||
public class RenderBlocksColumn extends RenderBlocks {
|
||||
|
||||
public TextureSubmap submap;
|
||||
public IIcon iconTop;
|
||||
private boolean inWorld;
|
||||
|
||||
private IIcon sides[] = new IIcon[6];
|
||||
private CTM ctm = CTM.getInstance();
|
||||
|
||||
public RenderBlocksColumn() {
|
||||
super();
|
||||
}
|
||||
|
||||
boolean connected(IBlockAccess world, int x, int y, int z, Block block, int meta) {
|
||||
Block inWorld = ctm.getBlockOrFacade(world, x, y, z, -1);
|
||||
return inWorld != null && inWorld.equals(block) && ctm.getBlockOrFacadeMetadata(world, x, y, z, -1) == meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, int x, int y, int z) {
|
||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
inWorld = true;
|
||||
|
||||
boolean yp = connected(blockAccess, x, y + 1, z, block, metadata);
|
||||
boolean yn = connected(blockAccess, x, y - 1, z, block, metadata);
|
||||
|
||||
if (yp || yn) {
|
||||
sides[0] = iconTop;
|
||||
sides[1] = iconTop;
|
||||
|
||||
if (yp && yn) sides[2] = submap.getSubIcon(0, 1);
|
||||
else if (yp) sides[2] = submap.getSubIcon(1, 1);
|
||||
else sides[2] = submap.getSubIcon(1, 0);
|
||||
|
||||
sides[3] = sides[4] = sides[5] = sides[2];
|
||||
} else {
|
||||
boolean xp = connected(blockAccess, x + 1, y, z, block, metadata);
|
||||
boolean xn = connected(blockAccess, x - 1, y, z, block, metadata);
|
||||
|
||||
if (xp && (connected(blockAccess, x + 1, y + 1, z, block, metadata)
|
||||
|| connected(blockAccess, x + 1, y - 1, z, block, metadata))) xp = false;
|
||||
if (xn && (connected(blockAccess, x - 1, y + 1, z, block, metadata)
|
||||
|| connected(blockAccess, x - 1, y - 1, z, block, metadata))) xn = false;
|
||||
|
||||
if (xp || xn) {
|
||||
uvRotateEast = 2;
|
||||
uvRotateWest = 1;
|
||||
uvRotateTop = 1;
|
||||
uvRotateBottom = 1;
|
||||
|
||||
sides[4] = iconTop;
|
||||
sides[5] = iconTop;
|
||||
|
||||
// for some reason along the x axis the bottom texture on the ends is backwards. This flips it around.
|
||||
if (xp && xn) {
|
||||
sides[1] = submap.getSubIcon(0, 1);
|
||||
sides[0] = sides[1];
|
||||
} else if (xp) {
|
||||
sides[1] = submap.getSubIcon(1, 1);
|
||||
sides[0] = submap.getSubIcon(1, 0);
|
||||
} else {
|
||||
sides[1] = submap.getSubIcon(1, 0);
|
||||
sides[0] = submap.getSubIcon(1, 1);
|
||||
}
|
||||
sides[2] = sides[3] = sides[1];
|
||||
} else {
|
||||
boolean zp = connected(blockAccess, x, y, z + 1, block, metadata);
|
||||
boolean zn = connected(blockAccess, x, y, z - 1, block, metadata);
|
||||
|
||||
if (zp && (connected(blockAccess, x, y + 1, z + 1, block, metadata)
|
||||
|| connected(blockAccess, x, y - 1, z + 1, block, metadata))) zp = false;
|
||||
if (zp && (connected(blockAccess, x + 1, y, z + 1, block, metadata)
|
||||
|| connected(blockAccess, x - 1, y, z + 1, block, metadata))) zp = false;
|
||||
if (zn && (connected(blockAccess, x, y + 1, z - 1, block, metadata)
|
||||
|| connected(blockAccess, x, y - 1, z - 1, block, metadata))) zn = false;
|
||||
if (zn && (connected(blockAccess, x + 1, y, z - 1, block, metadata)
|
||||
|| connected(blockAccess, x - 1, y, z - 1, block, metadata))) zn = false;
|
||||
|
||||
if (zp || zn) {
|
||||
uvRotateSouth = 1;
|
||||
uvRotateNorth = 2;
|
||||
|
||||
sides[2] = iconTop;
|
||||
sides[3] = iconTop;
|
||||
|
||||
if (zp && zn) sides[0] = submap.getSubIcon(0, 1);
|
||||
else if (zp) sides[0] = submap.getSubIcon(1, 0);
|
||||
else sides[0] = submap.getSubIcon(1, 1);
|
||||
|
||||
sides[1] = sides[4] = sides[5] = sides[0];
|
||||
} else {
|
||||
sides[0] = sides[1] = iconTop;
|
||||
sides[2] = sides[3] = sides[4] = sides[5] = submap.getSubIcon(0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean flag = super.renderStandardBlock(block, x, y, z);
|
||||
|
||||
uvRotateSouth = 0;
|
||||
uvRotateEast = 0;
|
||||
uvRotateWest = 0;
|
||||
uvRotateNorth = 0;
|
||||
uvRotateTop = 0;
|
||||
uvRotateBottom = 0;
|
||||
|
||||
inWorld = false;
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceXNeg(block, x, y, z, getIcon(icon, 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceXPos(block, x, y, z, getIcon(icon, 5));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceZNeg(block, x, y, z, getIcon(icon, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceZPos(block, x, y, z, getIcon(icon, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceYNeg(block, x, y, z, getIcon(icon, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceYPos(block, x, y, z, getIcon(icon, 1));
|
||||
}
|
||||
|
||||
private IIcon getIcon(IIcon defaultIcon, int side) {
|
||||
return sides[side] == null || !inWorld ? defaultIcon : sides[side];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* A convenience implementation of {@link ISubmapManager} which does the standard CTM behavior.
|
||||
*/
|
||||
public class SubmapManagerCTM implements ISubmapManager {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static final ThreadLocal<RenderBlocksCTM> renderBlocksThreadLocal = ThreadLocal
|
||||
.withInitial(RenderBlocksCTM::new);
|
||||
|
||||
@Getter
|
||||
private TextureSubmap submap, submapSmall;
|
||||
@Getter
|
||||
private final String textureName;
|
||||
|
||||
/**
|
||||
* @param textureName The path to the texture, excluding the mod ID (this is passed into
|
||||
* {@link #registerIcons(String, Block, IIconRegister)}).
|
||||
* <p>
|
||||
* The CTM texture will be this path, plus {@code "-ctm"}.
|
||||
*/
|
||||
public SubmapManagerCTM(String textureName) {
|
||||
this.textureName = textureName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return submapSmall.getBaseIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
submap = new TextureSubmap(register.registerIcon(modName + ":" + textureName + "-ctm"), 4, 4);
|
||||
submapSmall = new TextureSubmap(register.registerIcon(modName + ":" + textureName), 2, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
RenderBlocksCTM rb = renderBlocksThreadLocal.get();
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
return rb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {}
|
||||
|
||||
@Override
|
||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package team.chisel.ctmlib;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import lombok.experimental.Delegate;
|
||||
|
||||
/**
|
||||
* This class is used to split up a large IIcon into smaller "submapped" icons used for CTM and other texture
|
||||
* manipulation.
|
||||
*/
|
||||
public class TextureSubmap implements IIcon, ISubmap {
|
||||
|
||||
private static List<TextureSubmap> submaps = Lists.newArrayList();
|
||||
private static TextureSubmap dummy = new TextureSubmap(null, 0, 0);
|
||||
static {
|
||||
MinecraftForge.EVENT_BUS.register(dummy);
|
||||
}
|
||||
|
||||
private int width, height;
|
||||
@Delegate
|
||||
private IIcon baseIcon;
|
||||
|
||||
protected IIcon[][] icons;
|
||||
|
||||
/**
|
||||
* Construct a new submap. A submap is not required to be square, but it is required to be rectangular.
|
||||
*
|
||||
* @param baseIcon The IIcon to submap.
|
||||
* @param width The width of the map, in icons.
|
||||
* @param height The height of the map, in icons.
|
||||
*/
|
||||
public TextureSubmap(IIcon baseIcon, int width, int height) {
|
||||
this.baseIcon = baseIcon;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.icons = new IIcon[width][height];
|
||||
submaps.add(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* The large "base" icon used for the submap.
|
||||
*/
|
||||
public IIcon getBaseIcon() {
|
||||
return baseIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the icons in this submap. This is an expensive operation as it first clones the entire 2D array.
|
||||
*
|
||||
* @return All icons in this submap.
|
||||
*/
|
||||
public IIcon[][] getAllIcons() {
|
||||
IIcon[][] ret = ArrayUtils.clone(icons);
|
||||
for (int i = 0; i < ret.length; i++) {
|
||||
ret[i] = ArrayUtils.clone(ret[i]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ==== ISubmap ==== */
|
||||
|
||||
/**
|
||||
* Finds and returns the sub-icon at the given coordinates. For example, if you have a 3 by 3 submap, calling
|
||||
* {@code getSubIcon(1, 1)} will return the center subicon.
|
||||
*/
|
||||
@Override
|
||||
public IIcon getSubIcon(int x, int y) {
|
||||
x = x % icons.length;
|
||||
return icons[x][y % icons[x].length];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
/* ==== Internal Stitching Logic ==== */
|
||||
|
||||
/**
|
||||
* For internal use only, this is used to create the virtual "subicons" used in the map.
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public final void TexturesStitched(TextureStitchEvent.Post event) {
|
||||
for (TextureSubmap ts : submaps) {
|
||||
ts.texturesStitched();
|
||||
}
|
||||
}
|
||||
|
||||
public void texturesStitched() {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
icons[x][y] = new TextureVirtual(getBaseIcon(), width, height, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class TextureVirtual implements IIcon {
|
||||
|
||||
private int width, height;
|
||||
private float umin, umax, vmin, vmax;
|
||||
private IIcon parentIcon;
|
||||
|
||||
private TextureVirtual(IIcon parent, int w, int h, int x, int y) {
|
||||
parentIcon = parent;
|
||||
|
||||
umin = parentIcon.getInterpolatedU(16.0 * (x) / w);
|
||||
umax = parentIcon.getInterpolatedU(16.0 * (x + 1) / w);
|
||||
vmin = parentIcon.getInterpolatedV(16.0 * (y) / h);
|
||||
vmax = parentIcon.getInterpolatedV(16.0 * (y + 1) / h);
|
||||
|
||||
width = parentIcon.getIconWidth();
|
||||
height = parentIcon.getIconHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMinU() {
|
||||
return umin;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaxU() {
|
||||
return umax;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getInterpolatedU(double d0) {
|
||||
return (float) (umin + (umax - umin) * d0 / 16.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMinV() {
|
||||
return vmin;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaxV() {
|
||||
return vmax;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getInterpolatedV(double d0) {
|
||||
return (float) (vmin + (vmax - vmin) * d0 / 16.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getIconName() {
|
||||
return parentIcon.getIconName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getIconWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getIconHeight() {
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,34 @@ import net.minecraft.block.Block;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.block.*;
|
||||
import team.chisel.block.BlockCarvable;
|
||||
import team.chisel.block.BlockCarvableBeacon;
|
||||
import team.chisel.block.BlockCarvableCarpet;
|
||||
import team.chisel.block.BlockCarvableGlass;
|
||||
import team.chisel.block.BlockCarvableGlowstone;
|
||||
import team.chisel.block.BlockCarvableIce;
|
||||
import team.chisel.block.BlockCarvableIceStairs;
|
||||
import team.chisel.block.BlockCarvableLayered;
|
||||
import team.chisel.block.BlockCarvablePackedIce;
|
||||
import team.chisel.block.BlockCarvablePackedIceStairs;
|
||||
import team.chisel.block.BlockCarvablePane;
|
||||
import team.chisel.block.BlockCarvablePowered;
|
||||
import team.chisel.block.BlockCarvablePumpkin;
|
||||
import team.chisel.block.BlockCarvableSand;
|
||||
import team.chisel.block.BlockCarvableSlab;
|
||||
import team.chisel.block.BlockCarvableStairs;
|
||||
import team.chisel.block.BlockCarvableTorch;
|
||||
import team.chisel.block.BlockCarvableWall;
|
||||
import team.chisel.block.BlockCloud;
|
||||
import team.chisel.block.BlockConcrete;
|
||||
import team.chisel.block.BlockGrimstone;
|
||||
import team.chisel.block.BlockHolystone;
|
||||
import team.chisel.block.BlockLavastone;
|
||||
import team.chisel.block.BlockPresent;
|
||||
import team.chisel.block.BlockRoadLine;
|
||||
import team.chisel.block.BlockSnakestone;
|
||||
import team.chisel.block.BlockSnakestoneObsidian;
|
||||
import team.chisel.block.BlockWaterstone;
|
||||
|
||||
@ObjectHolder(Chisel.MOD_ID)
|
||||
public final class ChiselBlocks {
|
||||
@@ -140,5 +167,8 @@ public final class ChiselBlocks {
|
||||
// 1.9... drull pls
|
||||
public static final BlockCarvable purpur = null;
|
||||
|
||||
// 1.19, skipped 10 versions but thats fine
|
||||
public static final BlockCarvable froglight = null;
|
||||
|
||||
private ChiselBlocks() {}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public class ContainerAutoChisel extends Container {
|
||||
|
||||
/**
|
||||
* Added validation of slot input
|
||||
*
|
||||
*
|
||||
* @author CrazyPants
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -11,12 +11,14 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
import com.cricketcraft.chisel.api.carving.IChiselMode;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
import com.google.common.collect.Queues;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
@@ -160,4 +162,12 @@ public final class ChiselController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldUnload(WorldEvent.Unload event) {
|
||||
if (event.world.isRemote) {
|
||||
TextureType.clearStatics();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1878,3 +1878,16 @@ tile.glotek.12.desc=Cranberry
|
||||
tile.glotek.13.desc=Brink Pink
|
||||
tile.glotek.14.desc=Dark Salmon
|
||||
tile.glotek.15.desc=Harvest Gold
|
||||
|
||||
#Froglight
|
||||
tile.chisel.froglight.name=Froglight
|
||||
tile.froglight.0.desc=Aluminium
|
||||
tile.froglight.1.desc=Titanium
|
||||
tile.froglight.2.desc=Tungstensteel
|
||||
tile.froglight.3.desc=Osmium
|
||||
tile.froglight.4.desc=Fluxed
|
||||
tile.froglight.5.desc=Uranium
|
||||
tile.froglight.6.desc=Girisium
|
||||
tile.froglight.7.desc=Orundum
|
||||
tile.froglight.8.desc=Blood-Stained
|
||||
tile.froglight.9.desc=Ichor
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1005 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 956 B |
|
After Width: | Height: | Size: 960 B |
|
After Width: | Height: | Size: 1.0 KiB |