mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-25 14:44:35 +00:00
Compare commits
175
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb87007dfd | ||
|
|
8318b6a614 | ||
|
|
143a01f6c2 | ||
|
|
9c00a7d61f | ||
|
|
a431e2a65c | ||
|
|
aa803a1e51 | ||
|
|
d08e48b73b | ||
|
|
3d3260cd71 | ||
|
|
ff70c8b2e3 | ||
|
|
c1ac213eab | ||
|
|
54c339e03e | ||
|
|
d34cd0445a | ||
|
|
8655f8b0a8 | ||
|
|
886c8819c0 | ||
|
|
539ddce15f | ||
|
|
f60a89dcce | ||
|
|
3a3c7035fe | ||
|
|
c943d0c35a | ||
|
|
ec610dc876 | ||
|
|
2ae1f8ba93 | ||
|
|
7b9537571e | ||
|
|
b031b59002 | ||
|
|
4073a4c04c | ||
|
|
643d9b72ba | ||
|
|
fa3b49a673 | ||
|
|
165e5db275 | ||
|
|
4fcfaffa63 | ||
|
|
21690ddb09 | ||
|
|
1cb9a96d4f | ||
|
|
12460a6e02 | ||
|
|
20d2fc8c3f | ||
|
|
3f395fef1d | ||
|
|
2593b14c53 | ||
|
|
72341f1633 | ||
|
|
8a7a4a79f0 | ||
|
|
2e1a20d829 | ||
|
|
39e860974a | ||
|
|
1464929264 | ||
|
|
c4c1953ae1 | ||
|
|
6efa21100b | ||
|
|
c3e1675ac8 | ||
|
|
cc9b8ab774 | ||
|
|
674d2b389b | ||
|
|
78dbb36fec | ||
|
|
6385002193 | ||
|
|
e969289b22 | ||
|
|
f95fa2752f | ||
|
|
e963872d9e | ||
|
|
7a6076d9cd | ||
|
|
39b96c5ec0 | ||
|
|
d81198fa0a | ||
|
|
5b169882bc | ||
|
|
30ad41cc57 | ||
|
|
4588690780 | ||
|
|
a00cd59d4c | ||
|
|
e5f830ebb1 | ||
|
|
6fc3505ae7 | ||
|
|
51883263d7 | ||
|
|
97fd3003e3 | ||
|
|
14f6a09b9a | ||
|
|
40144a0fa5 | ||
|
|
4ce0134bed | ||
|
|
21caa10d34 | ||
|
|
4001d105a8 | ||
|
|
b5514a9aa0 | ||
|
|
c1f3c93bc3 | ||
|
|
5a2852532b | ||
|
|
189b3bc95c | ||
|
|
126ca91eeb | ||
|
|
477b6e354c | ||
|
|
c312d2c311 | ||
|
|
4c0218c708 | ||
|
|
3568223fc6 | ||
|
|
019f9a670a | ||
|
|
29be0033d7 | ||
|
|
2165ec04ea | ||
|
|
3da974b1cf | ||
|
|
637001538c | ||
|
|
95c8c72db5 | ||
|
|
2415e17583 | ||
|
|
0cabe335dd | ||
|
|
568e405e25 | ||
|
|
e851556159 | ||
|
|
b610b590a2 | ||
|
|
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 | ||
|
|
df216f68b4 | ||
|
|
834beb5ac8 | ||
|
|
a0f11f404a | ||
|
|
9899ca1177 | ||
|
|
1d94ff613d | ||
|
|
494addb994 | ||
|
|
e17147a14c | ||
|
|
605d47eeed | ||
|
|
0147be4afb | ||
|
|
f5d9bee22e | ||
|
|
aa90eb92a4 | ||
|
|
0f7113c3dc | ||
|
|
fe46a1208f | ||
|
|
529bb240a2 | ||
|
|
7d0672aa09 | ||
|
|
65d2a18875 | ||
|
|
3c419d6524 | ||
|
|
dd8f34a6ec | ||
|
|
aaaf548ff4 | ||
|
|
03c60ef024 | ||
|
|
41d38fc263 | ||
|
|
bfbdcb07cf | ||
|
|
1be95d427a | ||
|
|
5759cddae3 | ||
|
|
3bfa3b4dc6 | ||
|
|
35b56b65b6 | ||
|
|
b64693d439 | ||
|
|
305cc21c46 | ||
|
|
e97ca89b15 | ||
|
|
1578bba172 | ||
|
|
85c0301dba | ||
|
|
68a00eea9d | ||
|
|
ad20e3f2ad | ||
|
|
dc80d5dd81 | ||
|
|
c86b27646e | ||
|
|
79e853ad0b | ||
|
|
82de7905b1 | ||
|
|
33c845e2bf | ||
|
|
8f026dad8f | ||
|
|
a314fccd1b | ||
|
|
c2f1c134bd | ||
|
|
9b92e3aee9 | ||
|
|
958f306252 | ||
|
|
150cf1e42d | ||
|
|
2e2d7e2879 | ||
|
|
f13c2c0ddc | ||
|
|
37b8bf7eca | ||
|
|
1407b34861 | ||
|
|
90077cdea5 | ||
|
|
32d5e538fd | ||
|
|
3a6d40b550 | ||
|
|
dfe8f5e56d |
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
# Ignore spotlessApply reformat
|
||||||
|
8f026dad8fb7dcb86b68aaedf52ce12775b2af8d
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
* text eol=lf
|
||||||
|
|
||||||
|
*.[jJ][aA][rR] binary
|
||||||
|
|
||||||
|
*.[pP][nN][gG] binary
|
||||||
|
*.[jJ][pP][gG] binary
|
||||||
|
*.[jJ][pP][eE][gG] binary
|
||||||
|
*.[gG][iI][fF] binary
|
||||||
|
*.[tT][iI][fF] binary
|
||||||
|
*.[tT][iI][fF][fF] binary
|
||||||
|
*.[iI][cC][oO] binary
|
||||||
|
*.[sS][vV][gG] text
|
||||||
|
*.[eE][pP][sS] binary
|
||||||
|
*.[xX][cC][fF] binary
|
||||||
|
|
||||||
|
*.[kK][aA][rR] binary
|
||||||
|
*.[mM]4[aA] binary
|
||||||
|
*.[mM][iI][dD] binary
|
||||||
|
*.[mM][iI][dD][iI] binary
|
||||||
|
*.[mM][pP]3 binary
|
||||||
|
*.[oO][gG][gG] binary
|
||||||
|
*.[rR][aA] binary
|
||||||
|
|
||||||
|
*.7[zZ] binary
|
||||||
|
*.[gG][zZ] binary
|
||||||
|
*.[tT][aA][rR] binary
|
||||||
|
*.[tT][gG][zZ] binary
|
||||||
|
*.[zZ][iI][pP] binary
|
||||||
|
|
||||||
|
*.[tT][cC][nN] binary
|
||||||
|
*.[sS][oO] binary
|
||||||
|
*.[dD][lL][lL] binary
|
||||||
|
*.[dD][yY][lL][iI][bB] binary
|
||||||
|
*.[pP][sS][dD] binary
|
||||||
|
*.[tT][tT][fF] binary
|
||||||
|
*.[oO][tT][fF] binary
|
||||||
|
|
||||||
|
*.[pP][aA][tT][cC][hH] -text
|
||||||
|
|
||||||
|
*.[bB][aA][tT] text eol=crlf
|
||||||
|
*.[cC][mM][dD] text eol=crlf
|
||||||
|
*.[pP][sS]1 text eol=crlf
|
||||||
|
|
||||||
|
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
|
||||||
@@ -1,45 +1,13 @@
|
|||||||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
|
|
||||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
|
||||||
|
|
||||||
name: Build and test
|
name: Build and test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master, main ]
|
branches: [ master, main, release/** ]
|
||||||
push:
|
push:
|
||||||
branches: [ master, main ]
|
branches: [ master, main, release/** ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
runs-on: ubuntu-latest
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
|
||||||
steps:
|
secrets: inherit
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up JDK 8
|
|
||||||
uses: actions/setup-java@v2
|
|
||||||
with:
|
|
||||||
java-version: '8'
|
|
||||||
distribution: 'adopt'
|
|
||||||
cache: gradle
|
|
||||||
|
|
||||||
- name: Grant execute permission for gradlew
|
|
||||||
run: chmod +x gradlew
|
|
||||||
|
|
||||||
- name: Setup the workspace
|
|
||||||
run: ./gradlew setupCIWorkspace
|
|
||||||
|
|
||||||
- name: Build the mod
|
|
||||||
run: ./gradlew build
|
|
||||||
|
|
||||||
- name: Run server for 1.5 minutes
|
|
||||||
run: |
|
|
||||||
mkdir run
|
|
||||||
echo "eula=true" > run/eula.txt
|
|
||||||
timeout 90 ./gradlew runServer 2>&1 | tee -a server.log || true
|
|
||||||
|
|
||||||
- name: Test no errors reported during server run
|
|
||||||
run: |
|
|
||||||
chmod +x .github/scripts/test_no_error_reports
|
|
||||||
.github/scripts/test_no_error_reports
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
name: Optimize images
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [ master, main, release/** ]
|
||||||
|
paths:
|
||||||
|
- "**/*.png"
|
||||||
|
|
||||||
|
push:
|
||||||
|
branches: [ master, main, release/** ]
|
||||||
|
paths:
|
||||||
|
- "**/*.png"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
optimize-images:
|
||||||
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||||
|
secrets: inherit
|
||||||
@@ -1,51 +1,14 @@
|
|||||||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
|
|
||||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
|
||||||
|
|
||||||
name: Release tagged build
|
name: Release tagged build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags: [ '*' ]
|
||||||
- '*'
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
release-tags:
|
||||||
runs-on: ubuntu-latest
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
|
||||||
steps:
|
secrets: inherit
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set release version
|
|
||||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Set up JDK 8
|
|
||||||
uses: actions/setup-java@v2
|
|
||||||
with:
|
|
||||||
java-version: '8'
|
|
||||||
distribution: 'adopt'
|
|
||||||
cache: gradle
|
|
||||||
|
|
||||||
- name: Grant execute permission for gradlew
|
|
||||||
run: chmod +x gradlew
|
|
||||||
|
|
||||||
- name: Setup the workspace
|
|
||||||
run: ./gradlew setupCIWorkspace
|
|
||||||
|
|
||||||
- name: Build the mod
|
|
||||||
run: ./gradlew build
|
|
||||||
|
|
||||||
- name: Release under current tag
|
|
||||||
uses: "marvinpinto/action-automatic-releases@latest"
|
|
||||||
with:
|
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
|
|
||||||
prerelease: false
|
|
||||||
title: "${{ env.RELEASE_VERSION }}"
|
|
||||||
files: build/libs/*.jar
|
|
||||||
|
|
||||||
- name: Publish to Maven
|
|
||||||
run: ./gradlew publish
|
|
||||||
env:
|
|
||||||
MAVEN_USER: ${{ secrets.MAVEN_USER }}
|
|
||||||
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
|
||||||
@@ -27,3 +27,5 @@ whitelist.json
|
|||||||
*.iws
|
*.iws
|
||||||
src/main/resources/mixins.*.json
|
src/main/resources/mixins.*.json
|
||||||
*.bat
|
*.bat
|
||||||
|
layout.json
|
||||||
|
.DS_Store
|
||||||
+3
-3
@@ -1,5 +1,6 @@
|
|||||||
Contributing
|
Contributing
|
||||||
============
|
============
|
||||||
|
Before contributing, make sure you're familiar with the [GT:NH Contribution Guidelines](https://github.com/GTNewHorizons/.github/blob/master/CONTRIBUTING.md)
|
||||||
___
|
___
|
||||||
Setting up a Development Environment
|
Setting up a Development Environment
|
||||||
------------------------------------
|
------------------------------------
|
||||||
@@ -15,7 +16,7 @@ To set up the mod as to allow you to make changes, do the following:
|
|||||||
|
|
||||||
### IntelliJ IDEA
|
### IntelliJ IDEA
|
||||||
1. Run `gradlew 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.
|
3. After opening the project in IntelliJ, run `gradlew genIntellijRuns` in the command terminal you opened earlier.
|
||||||
|
|
||||||
### Eclipse
|
### Eclipse
|
||||||
@@ -24,9 +25,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.
|
2. Open Eclipse and import the folder as a project.
|
||||||
|
|
||||||
You now have a functional local copy of Chisel, ready to develop on.
|
You now have a functional local copy of Chisel, ready to develop on.
|
||||||
|
|
||||||
___
|
___
|
||||||
Formatting
|
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.
|
||||||
@@ -12,9 +12,7 @@ It was previously maintained by [tterrag](http://github.com/tterrag1098), [Drull
|
|||||||
Pull Requests
|
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.
|
Pull requests with new features, translations, and bugfixes are very welcome.
|
||||||
|
|
||||||
Do not make PRs that are solely formatting or other aesthetic things.
|
|
||||||
|
|
||||||
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.
|
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
|
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:
|
issue, please be sure to include:
|
||||||
|
|
||||||
- The version of Chisel you are using ("latest" is not an acceptable version)
|
- The version of Chisel or GTNH you are using ("latest" is not an acceptable version)
|
||||||
- The version of Forge you are using
|
- The crash report (preferably via [Pastebin](http://pastebin.com/)) generated by the error, if any
|
||||||
- If applicable, the crash report (preferably via [Pastebin](http://pastebin.com/)). generated by the error
|
|
||||||
- Depending on the error, an image of the problem
|
- Depending on the error, an image of the problem
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
compileJava {
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
+2
-745
@@ -1,748 +1,5 @@
|
|||||||
//version: 1652851397
|
//version: 1707058017
|
||||||
/*
|
|
||||||
DO NOT CHANGE THIS FILE!
|
|
||||||
|
|
||||||
Also, you may replace this file at any time if there is an update available.
|
|
||||||
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
|
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
||||||
import org.gradle.internal.logging.text.StyledTextOutput.Style
|
|
||||||
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name 'forge'
|
|
||||||
url 'https://maven.minecraftforge.net'
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name 'sonatype'
|
|
||||||
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name 'Scala CI dependencies'
|
|
||||||
url 'https://repo1.maven.org/maven2/'
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name 'jitpack'
|
|
||||||
url 'https://jitpack.io'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'java-library'
|
id 'com.gtnewhorizons.gtnhconvention'
|
||||||
id 'idea'
|
|
||||||
id 'eclipse'
|
|
||||||
id 'scala'
|
|
||||||
id 'maven-publish'
|
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
|
|
||||||
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
|
|
||||||
id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false
|
|
||||||
id 'org.ajoberstar.grgit' version '4.1.1'
|
|
||||||
id 'com.github.johnrengelman.shadow' version '4.0.4'
|
|
||||||
id 'com.palantir.git-version' version '0.13.0' apply false
|
|
||||||
id 'de.undercouch.download' version '5.0.1'
|
|
||||||
id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (project.file('.git/HEAD').isFile()) {
|
|
||||||
apply plugin: 'com.palantir.git-version'
|
|
||||||
}
|
|
||||||
|
|
||||||
def out = services.get(StyledTextOutputFactory).create('an-output')
|
|
||||||
|
|
||||||
apply plugin: 'forge'
|
|
||||||
|
|
||||||
def projectJavaVersion = JavaLanguageVersion.of(8)
|
|
||||||
|
|
||||||
java {
|
|
||||||
toolchain {
|
|
||||||
languageVersion.set(projectJavaVersion)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
idea {
|
|
||||||
module {
|
|
||||||
inheritOutputDirs = true
|
|
||||||
downloadJavadoc = true
|
|
||||||
downloadSources = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
|
|
||||||
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
|
|
||||||
}
|
|
||||||
|
|
||||||
checkPropertyExists("modName")
|
|
||||||
checkPropertyExists("modId")
|
|
||||||
checkPropertyExists("modGroup")
|
|
||||||
checkPropertyExists("autoUpdateBuildScript")
|
|
||||||
checkPropertyExists("minecraftVersion")
|
|
||||||
checkPropertyExists("forgeVersion")
|
|
||||||
checkPropertyExists("replaceGradleTokenInFile")
|
|
||||||
checkPropertyExists("gradleTokenModId")
|
|
||||||
checkPropertyExists("gradleTokenModName")
|
|
||||||
checkPropertyExists("gradleTokenVersion")
|
|
||||||
checkPropertyExists("gradleTokenGroupName")
|
|
||||||
checkPropertyExists("apiPackage")
|
|
||||||
checkPropertyExists("accessTransformersFile")
|
|
||||||
checkPropertyExists("usesMixins")
|
|
||||||
checkPropertyExists("mixinPlugin")
|
|
||||||
checkPropertyExists("mixinsPackage")
|
|
||||||
checkPropertyExists("coreModClass")
|
|
||||||
checkPropertyExists("containsMixinsAndOrCoreModOnly")
|
|
||||||
checkPropertyExists("usesShadowedDependencies")
|
|
||||||
checkPropertyExists("developmentEnvironmentUserName")
|
|
||||||
|
|
||||||
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
|
|
||||||
boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
|
|
||||||
|
|
||||||
String javaSourceDir = "src/main/java/"
|
|
||||||
String scalaSourceDir = "src/main/scala/"
|
|
||||||
String kotlinSourceDir = "src/main/kotlin/"
|
|
||||||
|
|
||||||
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
|
||||||
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
|
||||||
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
|
||||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
|
||||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
|
||||||
}
|
|
||||||
|
|
||||||
if(apiPackage) {
|
|
||||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
|
||||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
|
||||||
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
|
||||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
|
||||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(accessTransformersFile) {
|
|
||||||
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
|
|
||||||
if(!getFile(targetFile).exists()) {
|
|
||||||
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) {
|
|
||||||
throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!")
|
|
||||||
}
|
|
||||||
|
|
||||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
|
||||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
|
||||||
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
|
||||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
|
||||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
|
||||||
}
|
|
||||||
|
|
||||||
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
|
||||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
|
|
||||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
|
||||||
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt"
|
|
||||||
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
|
||||||
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(coreModClass) {
|
|
||||||
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
|
||||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
|
|
||||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
|
||||||
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt"
|
|
||||||
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
|
||||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations.all {
|
|
||||||
resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
|
|
||||||
|
|
||||||
// Make sure GregTech build won't time out
|
|
||||||
System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String)
|
|
||||||
System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
|
|
||||||
try {
|
|
||||||
'git config core.fileMode false'.execute()
|
|
||||||
}
|
|
||||||
catch (Exception ignored) {
|
|
||||||
out.style(Style.Failure).println("git isn't installed at all")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pulls version first from the VERSION env and then git tag
|
|
||||||
String identifiedVersion
|
|
||||||
String versionOverride = System.getenv("VERSION") ?: null
|
|
||||||
try {
|
|
||||||
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
|
|
||||||
}
|
|
||||||
catch (Exception ignored) {
|
|
||||||
out.style(Style.Failure).text(
|
|
||||||
'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
|
|
||||||
'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
|
|
||||||
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
|
|
||||||
)
|
|
||||||
versionOverride = 'NO-GIT-TAG-SET'
|
|
||||||
identifiedVersion = versionOverride
|
|
||||||
}
|
|
||||||
version = minecraftVersion + '-' + identifiedVersion
|
|
||||||
ext {
|
|
||||||
modVersion = identifiedVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
if(identifiedVersion == versionOverride) {
|
|
||||||
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
|
|
||||||
}
|
|
||||||
|
|
||||||
group = modGroup
|
|
||||||
if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
|
||||||
archivesBaseName = customArchiveBaseName
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
archivesBaseName = modId
|
|
||||||
}
|
|
||||||
|
|
||||||
def arguments = []
|
|
||||||
def jvmArguments = []
|
|
||||||
|
|
||||||
if (usesMixins.toBoolean()) {
|
|
||||||
arguments += [
|
|
||||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
|
||||||
]
|
|
||||||
if (usesMixinDebug.toBoolean()) {
|
|
||||||
jvmArguments += [
|
|
||||||
"-Dmixin.debug.countInjections=true",
|
|
||||||
"-Dmixin.debug.verbose=true",
|
|
||||||
"-Dmixin.debug.export=true"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
minecraft {
|
|
||||||
version = minecraftVersion + '-' + forgeVersion + '-' + minecraftVersion
|
|
||||||
runDir = 'run'
|
|
||||||
|
|
||||||
if (replaceGradleTokenInFile) {
|
|
||||||
replaceIn replaceGradleTokenInFile
|
|
||||||
if(gradleTokenModId) {
|
|
||||||
replace gradleTokenModId, modId
|
|
||||||
}
|
|
||||||
if(gradleTokenModName) {
|
|
||||||
replace gradleTokenModName, modName
|
|
||||||
}
|
|
||||||
if(gradleTokenVersion) {
|
|
||||||
replace gradleTokenVersion, modVersion
|
|
||||||
}
|
|
||||||
if(gradleTokenGroupName) {
|
|
||||||
replace gradleTokenGroupName, modGroup
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
clientIntellijRun {
|
|
||||||
args(arguments)
|
|
||||||
jvmArgs(jvmArguments)
|
|
||||||
|
|
||||||
if(developmentEnvironmentUserName) {
|
|
||||||
args("--username", developmentEnvironmentUserName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
serverIntellijRun {
|
|
||||||
args(arguments)
|
|
||||||
jvmArgs(jvmArguments)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(file('addon.gradle').exists()) {
|
|
||||||
apply from: 'addon.gradle'
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: 'repositories.gradle'
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
|
|
||||||
implementation.extendsFrom(shadowCompile)
|
|
||||||
implementation.extendsFrom(shadeCompile)
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name 'Overmind forge repo mirror'
|
|
||||||
url 'https://gregtech.overminddl1.com/'
|
|
||||||
}
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
maven {
|
|
||||||
name 'sponge'
|
|
||||||
url 'https://repo.spongepowered.org/repository/maven-public'
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url 'https://jitpack.io'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
|
|
||||||
annotationProcessor('com.google.guava:guava:24.1.1-jre')
|
|
||||||
annotationProcessor('com.google.code.gson:gson:2.8.6')
|
|
||||||
annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT')
|
|
||||||
// using 0.8 to workaround a issue in 0.7 which fails mixin application
|
|
||||||
compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') {
|
|
||||||
// Mixin includes a lot of dependencies that are too up-to-date
|
|
||||||
exclude module: 'launchwrapper'
|
|
||||||
exclude module: 'guava'
|
|
||||||
exclude module: 'gson'
|
|
||||||
exclude module: 'commons-io'
|
|
||||||
exclude module: 'log4j-core'
|
|
||||||
}
|
|
||||||
compile('com.github.GTNewHorizons:SpongeMixins:1.5.0')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: 'dependencies.gradle'
|
|
||||||
|
|
||||||
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
|
|
||||||
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
|
|
||||||
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
|
|
||||||
|
|
||||||
task generateAssets {
|
|
||||||
if (usesMixins.toBoolean()) {
|
|
||||||
def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json");
|
|
||||||
if (!mixinConfigFile.exists()) {
|
|
||||||
mixinConfigFile.text = """{
|
|
||||||
"required": true,
|
|
||||||
"minVersion": "0.7.11",
|
|
||||||
"package": "${modGroup}.${mixinsPackage}",
|
|
||||||
"plugin": "${modGroup}.${mixinPlugin}",
|
|
||||||
"refmap": "${mixingConfigRefMap}",
|
|
||||||
"target": "@env(DEFAULT)",
|
|
||||||
"compatibilityLevel": "JAVA_8",
|
|
||||||
"mixins": [],
|
|
||||||
"client": [],
|
|
||||||
"server": []
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task relocateShadowJar(type: ConfigureShadowRelocation) {
|
|
||||||
target = tasks.shadowJar
|
|
||||||
prefix = modGroup + ".shadow"
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
project.configurations.shadeCompile.each { dep ->
|
|
||||||
from(project.zipTree(dep)) {
|
|
||||||
exclude 'META-INF', 'META-INF/**'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
manifest {
|
|
||||||
attributes(getManifestAttributes())
|
|
||||||
}
|
|
||||||
|
|
||||||
minimize() // This will only allow shading for actually used classes
|
|
||||||
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
|
|
||||||
dependsOn(relocateShadowJar)
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
project.configurations.shadeCompile.each { dep ->
|
|
||||||
from(project.zipTree(dep)) {
|
|
||||||
exclude 'META-INF', 'META-INF/**'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
manifest {
|
|
||||||
attributes(getManifestAttributes())
|
|
||||||
}
|
|
||||||
|
|
||||||
if(usesShadowedDependencies.toBoolean()) {
|
|
||||||
dependsOn(shadowJar)
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
reobf {
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
addExtraSrgFile mixinSrg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
afterEvaluate {
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
tasks.compileJava {
|
|
||||||
options.compilerArgs += [
|
|
||||||
"-AreobfSrgFile=${tasks.reobf.srg}",
|
|
||||||
"-AoutSrgFile=${mixinSrg}",
|
|
||||||
"-AoutRefMapFile=${refMap}",
|
|
||||||
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
|
|
||||||
"-XDenableSunApiLintControl",
|
|
||||||
"-XDignore.symbol.file"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
runClient {
|
|
||||||
if(developmentEnvironmentUserName) {
|
|
||||||
arguments += [
|
|
||||||
"--username",
|
|
||||||
developmentEnvironmentUserName
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
args(arguments)
|
|
||||||
jvmArgs(jvmArguments)
|
|
||||||
}
|
|
||||||
|
|
||||||
runServer {
|
|
||||||
args(arguments)
|
|
||||||
jvmArgs(jvmArguments)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaExec).configureEach {
|
|
||||||
javaLauncher.set(
|
|
||||||
javaToolchains.launcherFor {
|
|
||||||
languageVersion = projectJavaVersion
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
// this will ensure that this task is redone when the versions change.
|
|
||||||
inputs.property "version", project.version
|
|
||||||
inputs.property "mcversion", project.minecraft.version
|
|
||||||
|
|
||||||
// replace stuff in mcmod.info, nothing else
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
include 'mcmod.info'
|
|
||||||
|
|
||||||
// replace modVersion and minecraftVersion
|
|
||||||
expand "minecraftVersion": project.minecraft.version,
|
|
||||||
"modVersion": modVersion,
|
|
||||||
"modId": modId,
|
|
||||||
"modName": modName
|
|
||||||
}
|
|
||||||
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
from refMap
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy everything else that's not the mcmod.info
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude 'mcmod.info'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def getManifestAttributes() {
|
|
||||||
def manifestAttributes = [:]
|
|
||||||
if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
|
|
||||||
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(accessTransformersFile) {
|
|
||||||
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(coreModClass) {
|
|
||||||
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
manifestAttributes += [
|
|
||||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
|
||||||
"MixinConfigs" : "mixins." + modId + ".json",
|
|
||||||
"ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean()
|
|
||||||
]
|
|
||||||
}
|
|
||||||
return manifestAttributes
|
|
||||||
}
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
|
||||||
from (sourceSets.main.allSource)
|
|
||||||
from (file("$projectDir/LICENSE"))
|
|
||||||
getArchiveClassifier().set('sources')
|
|
||||||
}
|
|
||||||
|
|
||||||
task shadowDevJar(type: ShadowJar) {
|
|
||||||
project.configurations.shadeCompile.each { dep ->
|
|
||||||
from(project.zipTree(dep)) {
|
|
||||||
exclude 'META-INF', 'META-INF/**'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
from sourceSets.main.output
|
|
||||||
getArchiveClassifier().set("dev")
|
|
||||||
|
|
||||||
manifest {
|
|
||||||
attributes(getManifestAttributes())
|
|
||||||
}
|
|
||||||
|
|
||||||
minimize() // This will only allow shading for actually used classes
|
|
||||||
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
|
|
||||||
}
|
|
||||||
|
|
||||||
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
|
|
||||||
target = tasks.shadowDevJar
|
|
||||||
prefix = modGroup + ".shadow"
|
|
||||||
}
|
|
||||||
|
|
||||||
task circularResolverJar(type: Jar) {
|
|
||||||
dependsOn(relocateShadowDevJar)
|
|
||||||
dependsOn(shadowDevJar)
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
task devJar(type: Jar) {
|
|
||||||
project.configurations.shadeCompile.each { dep ->
|
|
||||||
from(project.zipTree(dep)) {
|
|
||||||
exclude 'META-INF', 'META-INF/**'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
from sourceSets.main.output
|
|
||||||
getArchiveClassifier().set("dev")
|
|
||||||
|
|
||||||
manifest {
|
|
||||||
attributes(getManifestAttributes())
|
|
||||||
}
|
|
||||||
|
|
||||||
if(usesShadowedDependencies.toBoolean()) {
|
|
||||||
dependsOn(circularResolverJar)
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task apiJar(type: Jar) {
|
|
||||||
from (sourceSets.main.allSource) {
|
|
||||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
|
||||||
}
|
|
||||||
|
|
||||||
from (sourceSets.main.output) {
|
|
||||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
|
||||||
}
|
|
||||||
|
|
||||||
from (sourceSets.main.resources.srcDirs) {
|
|
||||||
include("LICENSE")
|
|
||||||
}
|
|
||||||
|
|
||||||
getArchiveClassifier().set('api')
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
if(!noPublishedSources) {
|
|
||||||
archives sourcesJar
|
|
||||||
}
|
|
||||||
archives devJar
|
|
||||||
if(apiPackage) {
|
|
||||||
archives apiJar
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID),
|
|
||||||
// and isn't strictly needed with the POM so just disable it.
|
|
||||||
tasks.withType(GenerateModuleMetadata) {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// workaround variable hiding in pom processing
|
|
||||||
def projectConfigs = project.configurations
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
maven(MavenPublication) {
|
|
||||||
from components.java
|
|
||||||
if(usesShadowedDependencies.toBoolean()) {
|
|
||||||
artifact source: shadowJar, classifier: ""
|
|
||||||
}
|
|
||||||
if(!noPublishedSources) {
|
|
||||||
artifact source: sourcesJar, classifier: "sources"
|
|
||||||
}
|
|
||||||
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
|
|
||||||
if (apiPackage) {
|
|
||||||
artifact source: apiJar, classifier: "api"
|
|
||||||
}
|
|
||||||
|
|
||||||
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons"
|
|
||||||
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
|
|
||||||
// Using the identified version, not project.version as it has the prepended 1.7.10
|
|
||||||
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
|
|
||||||
|
|
||||||
// remove extra garbage from minecraft and minecraftDeps configuration
|
|
||||||
pom.withXml {
|
|
||||||
def badArtifacts = [:].withDefault {[] as Set<String>}
|
|
||||||
for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) {
|
|
||||||
for (dependency in configuration.allDependencies) {
|
|
||||||
badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// example for specifying extra stuff to ignore
|
|
||||||
// badArtifacts["org.example.group"] += "artifactName"
|
|
||||||
|
|
||||||
Node pomNode = asNode()
|
|
||||||
pomNode.dependencies.'*'.findAll() {
|
|
||||||
badArtifacts[it.groupId.text()].contains(it.artifactId.text())
|
|
||||||
}.each() {
|
|
||||||
it.parent().remove(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
|
|
||||||
credentials {
|
|
||||||
username = System.getenv("MAVEN_USER") ?: "NONE"
|
|
||||||
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Updating
|
|
||||||
task updateBuildScript {
|
|
||||||
doLast {
|
|
||||||
if (performBuildScriptUpdate(projectDir.toString())) return
|
|
||||||
|
|
||||||
print("Build script already up-to-date!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
|
|
||||||
if (autoUpdateBuildScript.toBoolean()) {
|
|
||||||
performBuildScriptUpdate(projectDir.toString())
|
|
||||||
} else {
|
|
||||||
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static URL availableBuildScriptUrl() {
|
|
||||||
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean performBuildScriptUpdate(String projectDir) {
|
|
||||||
if (isNewBuildScriptVersionAvailable(projectDir)) {
|
|
||||||
def buildscriptFile = getFile("build.gradle")
|
|
||||||
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
|
||||||
out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isNewBuildScriptVersionAvailable(String projectDir) {
|
|
||||||
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
|
|
||||||
|
|
||||||
String currentBuildScript = getFile("build.gradle").getText()
|
|
||||||
String currentBuildScriptHash = getVersionHash(currentBuildScript)
|
|
||||||
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
|
|
||||||
String availableBuildScriptHash = getVersionHash(availableBuildScript)
|
|
||||||
|
|
||||||
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
|
|
||||||
return !isUpToDate
|
|
||||||
}
|
|
||||||
|
|
||||||
static String getVersionHash(String buildScriptContent) {
|
|
||||||
String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
|
|
||||||
if(versionLine != null) {
|
|
||||||
return versionLine.split(": ").last()
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(updateBuildScript) {
|
|
||||||
group = 'forgegradle'
|
|
||||||
description = 'Updates the build script to the latest version'
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deobfuscation
|
|
||||||
|
|
||||||
def deobf(String sourceURL) {
|
|
||||||
try {
|
|
||||||
URL url = new URL(sourceURL)
|
|
||||||
String fileName = url.getFile()
|
|
||||||
|
|
||||||
//get rid of directories:
|
|
||||||
int lastSlash = fileName.lastIndexOf("/")
|
|
||||||
if(lastSlash > 0) {
|
|
||||||
fileName = fileName.substring(lastSlash + 1)
|
|
||||||
}
|
|
||||||
//get rid of extension:
|
|
||||||
if(fileName.endsWith(".jar")) {
|
|
||||||
fileName = fileName.substring(0, fileName.lastIndexOf("."))
|
|
||||||
}
|
|
||||||
|
|
||||||
String hostName = url.getHost()
|
|
||||||
if(hostName.startsWith("www.")) {
|
|
||||||
hostName = hostName.substring(4)
|
|
||||||
}
|
|
||||||
List parts = Arrays.asList(hostName.split("\\."))
|
|
||||||
Collections.reverse(parts)
|
|
||||||
hostName = String.join(".", parts)
|
|
||||||
|
|
||||||
return deobf(sourceURL, hostName + "/" + fileName)
|
|
||||||
} catch(Exception e) {
|
|
||||||
return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
|
|
||||||
def deobf(String sourceURL, String fileName) {
|
|
||||||
String cacheDir = System.getProperty("user.home") + "/.gradle/caches/"
|
|
||||||
String bon2Dir = cacheDir + "forge_gradle/deobf"
|
|
||||||
String bon2File = bon2Dir + "/BON2-2.5.0.jar"
|
|
||||||
String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar"
|
|
||||||
String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar"
|
|
||||||
|
|
||||||
if(file(deobfFile).exists()) {
|
|
||||||
return files(deobfFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
download.run {
|
|
||||||
src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar'
|
|
||||||
dest bon2File
|
|
||||||
quiet true
|
|
||||||
overwrite false
|
|
||||||
}
|
|
||||||
|
|
||||||
download.run {
|
|
||||||
src sourceURL
|
|
||||||
dest obfFile
|
|
||||||
quiet true
|
|
||||||
overwrite false
|
|
||||||
}
|
|
||||||
|
|
||||||
exec {
|
|
||||||
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch'
|
|
||||||
workingDir bon2Dir
|
|
||||||
standardOutput = new ByteArrayOutputStream()
|
|
||||||
}
|
|
||||||
|
|
||||||
return files(deobfFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper methods
|
|
||||||
|
|
||||||
def checkPropertyExists(String propertyName) {
|
|
||||||
if (!project.hasProperty(propertyName)) {
|
|
||||||
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def getFile(String relativePath) {
|
|
||||||
return new File(projectDir, relativePath)
|
|
||||||
}
|
}
|
||||||
+10
-9
@@ -1,22 +1,23 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile("com.github.GTNewHorizons:CodeChickenCore:1.1.5:dev")
|
implementation("com.github.GTNewHorizons:CodeChickenCore:1.4.12:dev")
|
||||||
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev")
|
implementation("com.github.GTNewHorizons:NotEnoughItems:2.8.84-GTNH:dev")
|
||||||
compile("com.github.GTNewHorizons:NotEnoughItems:2.2.8-GTNH:dev")
|
implementation("com.github.GTNewHorizons:ForgeMultipart:2.0.0:dev")
|
||||||
|
|
||||||
compileOnly("org.projectlombok:lombok:1.18.24")
|
compileOnly("org.projectlombok:lombok:1.18.24")
|
||||||
annotationProcessor("org.projectlombok:lombok:1.18.24")
|
annotationProcessor("org.projectlombok:lombok:1.18.24")
|
||||||
|
|
||||||
shadeCompile("com.github.GTNewHorizons:CTMLib:1.4.2:dev")
|
devOnlyNonPublishable("com.github.GTNewHorizons:waila:1.19.22:dev") {
|
||||||
|
|
||||||
compileOnly("com.github.GTNewHorizons:waila:1.5.19:dev") {
|
|
||||||
transitive = false
|
|
||||||
}
|
|
||||||
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.2.7:dev") {
|
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
|
devOnlyNonPublishable("com.github.GTNewHorizons:WailaHarvestability:1.3.4-GTNH:dev")
|
||||||
|
|
||||||
compileOnly("curse.maven:ee3-65509:2305023") { // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
compileOnly("curse.maven:ee3-65509:2305023") { // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileOnly("com.github.GTNewHorizons:Angelica:2.1.15:api") {
|
||||||
|
transitive = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+203
-29
@@ -1,64 +1,238 @@
|
|||||||
|
# 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
|
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
|
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
|
modGroup = com.cricketcraft.chisel
|
||||||
|
|
||||||
# WHY is there no version field?
|
# Whether to use modGroup as the maven publishing group.
|
||||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
# When false, com.github.GTNewHorizons is used.
|
||||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
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
|
autoUpdateBuildScript = false
|
||||||
|
|
||||||
|
# Version of Minecraft to target
|
||||||
minecraftVersion = 1.7.10
|
minecraftVersion = 1.7.10
|
||||||
|
|
||||||
|
# Version of Minecraft Forge to target
|
||||||
forgeVersion = 10.13.4.1614
|
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
|
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||||
# restart Minecraft in development. Choose this dependent on your mod:
|
channel = stable
|
||||||
# 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
|
|
||||||
developmentEnvironmentUserName = "Developer"
|
|
||||||
|
|
||||||
# Define a source file of your project with:
|
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
mappingsVersion = 12
|
||||||
# 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, [...])
|
# Defines other MCP mappings for dependency deobfuscation.
|
||||||
# Leave these properties empty to skip individual token replacements
|
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||||
replaceGradleTokenInFile = Chisel.java
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Enables modern Java syntax support. Valid values:
|
||||||
|
# - false: No modern syntax, Java 8 only
|
||||||
|
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||||
|
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||||
|
# - modern: Native modern Java bytecode, no downgrading
|
||||||
|
enableModernJavaSyntax = jabel
|
||||||
|
|
||||||
|
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||||
|
# and should *not* be used in most situations. -1 disables this.
|
||||||
|
# forceToolchainVersion = -1
|
||||||
|
|
||||||
|
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||||
|
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||||
|
# downgradeTargetVersion = 8
|
||||||
|
|
||||||
|
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||||
|
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||||
|
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||||
|
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||||
|
|
||||||
|
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||||
|
# - shade: Shade minimized stubs into the jar
|
||||||
|
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||||
|
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||||
|
# - (empty): Warning reminding you to configure stubs
|
||||||
|
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||||
|
# jvmDowngraderStubsProvider =
|
||||||
|
|
||||||
|
# Enables 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 =
|
gradleTokenModId =
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod name replacement token.
|
||||||
gradleTokenModName =
|
gradleTokenModName =
|
||||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
|
||||||
|
# [DEPRECATED] Mod Group replacement token.
|
||||||
gradleTokenGroupName =
|
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.
|
# 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
|
apiPackage = api
|
||||||
|
|
||||||
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||||
# Example value: mymodid_at.cfg
|
# There can be multiple files in a space-separated list.
|
||||||
|
# Example value: mymodid_at.cfg nei_at.cfg
|
||||||
accessTransformersFile = chisel_compile_at.cfg
|
accessTransformersFile = chisel_compile_at.cfg
|
||||||
|
|
||||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||||
usesMixins = false
|
usesMixins = false
|
||||||
|
|
||||||
|
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
||||||
|
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
||||||
|
# Mixin classes will have access to "main" classes, but not the other way around.
|
||||||
|
separateMixinSourceSet =
|
||||||
|
|
||||||
|
# Adds some debug arguments like verbose output and class export.
|
||||||
|
usesMixinDebug = false
|
||||||
|
|
||||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||||
mixinPlugin =
|
mixinPlugin =
|
||||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
|
||||||
|
# Specify the package that contains all of your Mixins. The package must exist or
|
||||||
|
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||||
|
# it must match with this or the build will fail.
|
||||||
mixinsPackage =
|
mixinsPackage =
|
||||||
|
|
||||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||||
# This parameter is for legacy compatability only
|
# This parameter is for legacy compatibility only
|
||||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||||
coreModClass =
|
coreModClass =
|
||||||
|
|
||||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||||
containsMixinsAndOrCoreModOnly = false
|
containsMixinsAndOrCoreModOnly = false
|
||||||
|
|
||||||
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
|
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||||
# responsibility check the licence and request permission for distribution, if required.
|
forceEnableMixins = false
|
||||||
usesShadowedDependencies = false
|
|
||||||
|
|
||||||
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
# 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
|
||||||
|
|
||||||
|
# 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 CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||||
|
includeWellKnownRepositories = true
|
||||||
|
|
||||||
|
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
||||||
|
# list of strings, with the acceptable keys being(case does not matter):
|
||||||
|
# cursemaven
|
||||||
|
# modrinth
|
||||||
|
excludeWellKnownRepositories =
|
||||||
|
|
||||||
|
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||||
|
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||||
|
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||||
|
usesMavenPublishing = true
|
||||||
|
|
||||||
|
# Maven repository to publish the mod to.
|
||||||
|
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||||
|
|
||||||
|
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||||
|
#
|
||||||
|
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||||
|
# Leave this empty if you don't want to publish to Modrinth.
|
||||||
|
modrinthProjectId =
|
||||||
|
|
||||||
|
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||||
|
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||||
|
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||||
|
# type can be one of [project, version],
|
||||||
|
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||||
|
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||||
|
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||||
|
modrinthRelations =
|
||||||
|
|
||||||
|
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||||
|
#
|
||||||
|
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||||
|
# Leave this empty if you don't want to publish on CurseForge.
|
||||||
|
curseForgeProjectId =
|
||||||
|
|
||||||
|
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||||
|
# Syntax: type1:name1;type2:name2;...
|
||||||
|
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||||
|
# and the name is the CurseForge project slug of the other mod.
|
||||||
|
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||||
|
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||||
|
curseForgeRelations =
|
||||||
|
|
||||||
|
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||||
# projects. New projects should not use this parameter.
|
# projects. New projects should not use this parameter.
|
||||||
#customArchiveBaseName =
|
# customArchiveBaseName =
|
||||||
|
|
||||||
|
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||||
|
# runClientWorkingDirectory = run/client
|
||||||
|
|
||||||
|
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||||
|
# runServerWorkingDirectory = run/server
|
||||||
|
|
||||||
|
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Non-GTNH properties
|
||||||
|
org.gradle.configuration-cache = true
|
||||||
|
org.gradle.parallel = true
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#This file is generated by updateDaemonJvm
|
||||||
|
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||||
|
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
||||||
|
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||||
|
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
||||||
|
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d4fd992c9557644e637ebe98263e0ae7/redirect
|
||||||
|
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/faa12903720d410b387cc69ccafb1a74/redirect
|
||||||
|
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||||
|
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
||||||
|
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a4c09dd2e2d7079373d30e524bbc2829/redirect
|
||||||
|
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
|
||||||
|
toolchainVersion=25
|
||||||
Vendored
BIN
Binary file not shown.
+3
-1
@@ -1,5 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2015 the original author or authors.
|
# Copyright © 2015 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -15,80 +15,114 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
@@ -97,92 +131,118 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
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
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=$((i+1))
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
(0) set -- ;;
|
|
||||||
(1) set -- "$args0" ;;
|
|
||||||
(2) set -- "$args0" "$args1" ;;
|
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=$(save "$@")
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+27
-34
@@ -13,8 +13,10 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,10 +27,14 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@@ -37,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@@ -51,48 +57,35 @@ goto fail
|
|||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|||||||
@@ -1,14 +1,4 @@
|
|||||||
// Add any additional repositories for your dependencies here
|
// Add any additional repositories for your dependencies here
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
|
||||||
name = "GTNH"
|
|
||||||
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url "https://cursemaven.com"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url = "https://jitpack.io"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
// RetroFuturaGradle
|
||||||
|
name "GTNH Maven"
|
||||||
|
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||||
|
mavenContent {
|
||||||
|
includeGroup("com.gtnewhorizons")
|
||||||
|
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gradlePluginPortal()
|
||||||
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3,6 +3,7 @@ package com.cricketcraft.chisel.api;
|
|||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@@ -53,7 +54,6 @@ public class ChiselTabs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static final CustomCreativeTab tabChisel = new CustomCreativeTab("tabChisel", false);
|
public static final CustomCreativeTab tabChisel = new CustomCreativeTab("tabChisel", false);
|
||||||
public static final CustomCreativeTab tabStoneChiselBlocks = new CustomCreativeTab("tabStoneChiselBlocks", true);
|
public static final CustomCreativeTab tabStoneChiselBlocks = new CustomCreativeTab("tabStoneChiselBlocks", true);
|
||||||
public static final CustomCreativeTab tabWoodChiselBlocks = new CustomCreativeTab("tabWoodChiselBlocks", true);
|
public static final CustomCreativeTab tabWoodChiselBlocks = new CustomCreativeTab("tabWoodChiselBlocks", true);
|
||||||
@@ -62,5 +62,4 @@ public class ChiselTabs {
|
|||||||
public static final CustomCreativeTab tabModdedChiselBlocks = new CustomCreativeTab("tabModdedChiselBlocks", true);
|
public static final CustomCreativeTab tabModdedChiselBlocks = new CustomCreativeTab("tabModdedChiselBlocks", true);
|
||||||
public static final CustomCreativeTab tabStairChiselBlocks = new CustomCreativeTab("tabStairChiselBlocks", true);
|
public static final CustomCreativeTab tabStairChiselBlocks = new CustomCreativeTab("tabStairChiselBlocks", true);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.cricketcraft.chisel.api;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
|
|
||||||
public class FMPIMC {
|
public class FMPIMC {
|
||||||
|
|||||||
@@ -12,10 +12,8 @@ public interface IAdvancedChisel {
|
|||||||
/**
|
/**
|
||||||
* Gets the next mode the button in the GUI should switch to given the current mode.
|
* Gets the next mode the button in the GUI should switch to given the current mode.
|
||||||
*
|
*
|
||||||
* @param stack
|
* @param stack The {@link ItemStack} representing the chisel
|
||||||
* The {@link ItemStack} representing the chisel
|
* @param current The {@link IChiselMode} that is currently active
|
||||||
* @param current
|
|
||||||
* The {@link IChiselMode} that is currently active
|
|
||||||
* @return The next {@link IChiselMode} in the loop
|
* @return The next {@link IChiselMode} in the loop
|
||||||
*/
|
*/
|
||||||
public IChiselMode getNextMode(ItemStack stack, IChiselMode current);
|
public IChiselMode getNextMode(ItemStack stack, IChiselMode current);
|
||||||
@@ -23,10 +21,8 @@ public interface IAdvancedChisel {
|
|||||||
/**
|
/**
|
||||||
* Gets an {@link IChiselMode} instance from a String name
|
* Gets an {@link IChiselMode} instance from a String name
|
||||||
*
|
*
|
||||||
* @param chisel
|
* @param chisel The {@link ItemStack} representing the chisel
|
||||||
* The {@link ItemStack} representing the chisel
|
* @param name The name of the {@link IChiselMode mode}
|
||||||
* @param name
|
|
||||||
* The name of the {@link IChiselMode mode}
|
|
||||||
* @return An {@link IChiselMode} that has the name {@code name}
|
* @return An {@link IChiselMode} that has the name {@code name}
|
||||||
*/
|
*/
|
||||||
public IChiselMode getMode(ItemStack chisel, String name);
|
public IChiselMode getMode(ItemStack chisel, String name);
|
||||||
|
|||||||
@@ -1,34 +1,32 @@
|
|||||||
package com.cricketcraft.chisel.api;
|
package com.cricketcraft.chisel.api;
|
||||||
|
|
||||||
import team.chisel.ctmlib.ICTMBlock;
|
|
||||||
import team.chisel.ctmlib.ISubmapManager;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||||
|
|
||||||
|
import team.chisel.ctmlib.ICTMBlock;
|
||||||
|
import team.chisel.ctmlib.ISubmapManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To be implemented on blocks that can be chiseled and need advanced metadata to variation mapping. Currently not very usable without internal classes.
|
* To be implemented on blocks that can be chiseled and need advanced metadata to variation mapping. Currently not very
|
||||||
|
* usable without internal classes.
|
||||||
*/
|
*/
|
||||||
public interface ICarvable extends ICTMBlock<IVariationInfo> {
|
public interface ICarvable extends ICTMBlock<IVariationInfo> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a {@link ISubmapManager} from this block, based on metadata.
|
* Gets a {@link ISubmapManager} from this block, based on metadata.
|
||||||
* <p>
|
* <p>
|
||||||
* Typically you can refer this method to {@link CarvableHelper#getVariation(int)} but this method is provided for more complex metadata handling.
|
* Typically you can refer this method to {@link CarvableHelper#getVariation(int)} but this method is provided for
|
||||||
|
* more complex metadata handling.
|
||||||
*
|
*
|
||||||
* @param metadata
|
* @param metadata The metadata of the block
|
||||||
* The metadata of the block
|
* @param world {@link IBlockAccess} object, usually a world. Use of {@link IBlockAccess} Is necessary due to
|
||||||
* @param world
|
* this method's use in rendering.
|
||||||
* {@link IBlockAccess} object, usually a world. Use of {@link IBlockAccess} Is necessary due to this method's use in rendering.
|
* @param x X coord of the block
|
||||||
* @param x
|
* @param y Y coord of the block
|
||||||
* X coord of the block
|
* @param z Z coord of the block
|
||||||
* @param y
|
* @param metadata The metadata of the block
|
||||||
* Y coord of the block
|
|
||||||
* @param z
|
|
||||||
* Z coord of the block
|
|
||||||
* @param metadata
|
|
||||||
* The metadata of the block
|
|
||||||
* @return The {@link ISubmapManager} that represents this block in the world.
|
* @return The {@link ISubmapManager} that represents this block in the world.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -15,12 +15,10 @@ public interface IChiselItem {
|
|||||||
/**
|
/**
|
||||||
* Checks whether the chisel can have its GUI opened
|
* Checks whether the chisel can have its GUI opened
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world {@link World} object
|
||||||
* {@link World} object
|
* @param player The player holding the chisel. It can always be assumed that the player's current item will be
|
||||||
* @param player
|
* this.
|
||||||
* The player holding the chisel. It can always be assumed that the player's current item will be this.
|
* @param chisel The {@link ItemStack} representing your chisel
|
||||||
* @param chisel
|
|
||||||
* The {@link ItemStack} representing your chisel
|
|
||||||
* @return True if the GUI should open. False otherwise.
|
* @return True if the GUI should open. False otherwise.
|
||||||
*/
|
*/
|
||||||
boolean canOpenGui(World world, EntityPlayer player, ItemStack chisel);
|
boolean canOpenGui(World world, EntityPlayer player, ItemStack chisel);
|
||||||
@@ -28,27 +26,23 @@ public interface IChiselItem {
|
|||||||
/**
|
/**
|
||||||
* Called when an item is chiseled using this chisel
|
* Called when an item is chiseled using this chisel
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world {@link World} object
|
||||||
* {@link World} object
|
* @param chisel The {@link ItemStack} representing the chisel
|
||||||
* @param chisel
|
* @param target The {@link ICarvingVariation} representing the target item
|
||||||
* The {@link ItemStack} representing the chisel
|
|
||||||
* @param target
|
|
||||||
* The {@link ICarvingVariation} representing the target item
|
|
||||||
* @return True if the chisel should be damaged. False otherwise.
|
* @return True if the chisel should be damaged. False otherwise.
|
||||||
*/
|
*/
|
||||||
boolean onChisel(World world, ItemStack chisel, ICarvingVariation target);
|
boolean onChisel(World world, ItemStack chisel, ICarvingVariation target);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to check if this {@link ItemStack} can be chiseled in this chisel. If not, there will be no possible variants displayed in the GUI.
|
* Called to check if this {@link ItemStack} can be chiseled in this chisel. If not, there will be no possible
|
||||||
|
* variants displayed in the GUI.
|
||||||
* <p>
|
* <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.
|
* 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
|
* @param world {@link World} object
|
||||||
* {@link World} object
|
* @param chisel The {@link ItemStack} representing the chisel
|
||||||
* @param chisel
|
* @param target The {@link ICarvingVariation} representing the target item
|
||||||
* The {@link ItemStack} representing the chisel
|
|
||||||
* @param target
|
|
||||||
* The {@link ICarvingVariation} representing the target item
|
|
||||||
* @return True if the current target can be chiseled into anything. False otherwise.
|
* @return True if the current target can be chiseled into anything. False otherwise.
|
||||||
*/
|
*/
|
||||||
boolean canChisel(World world, ItemStack chisel, ICarvingVariation target);
|
boolean canChisel(World world, ItemStack chisel, ICarvingVariation target);
|
||||||
@@ -56,20 +50,13 @@ public interface IChiselItem {
|
|||||||
/**
|
/**
|
||||||
* Allows you to control if your item can chisel this block in the world.
|
* Allows you to control if your item can chisel this block in the world.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world World object
|
||||||
* World object
|
* @param player {@link EntityPlayer The player} holding the chisel.
|
||||||
* @param player
|
* @param x X coord of the block being chiseled
|
||||||
* {@link EntityPlayer The player} holding the chisel.
|
* @param y Y coord of the block being chiseled
|
||||||
* @param x
|
* @param z Z coord of the block being chiseled
|
||||||
* X coord of the block being chiseled
|
* @param block The {@link Block} being chiseled
|
||||||
* @param y
|
* @param metadata The blocks' metadata
|
||||||
* Y coord of the block being chiseled
|
|
||||||
* @param z
|
|
||||||
* Z coord of the block being chiseled
|
|
||||||
* @param block
|
|
||||||
* The {@link Block} being chiseled
|
|
||||||
* @param metadata
|
|
||||||
* The blocks' metadata
|
|
||||||
* @return True if the chiseling should take place. False otherwise.
|
* @return True if the chiseling should take place. False otherwise.
|
||||||
*/
|
*/
|
||||||
boolean canChiselBlock(World world, EntityPlayer player, int x, int y, int z, Block block, int metadata);
|
boolean canChiselBlock(World world, EntityPlayer player, int x, int y, int z, Block block, int metadata);
|
||||||
@@ -77,8 +64,7 @@ public interface IChiselItem {
|
|||||||
/**
|
/**
|
||||||
* Allows you to control if your item has chiseling modes.
|
* Allows you to control if your item has chiseling modes.
|
||||||
*
|
*
|
||||||
* @param chisel
|
* @param chisel The {@link ItemStack} representing the chisel.
|
||||||
* The {@link ItemStack} representing the chisel.
|
|
||||||
* @return True if the chisel supports modes. False otherwise.
|
* @return True if the chisel supports modes. False otherwise.
|
||||||
*/
|
*/
|
||||||
boolean hasModes(ItemStack chisel);
|
boolean hasModes(ItemStack chisel);
|
||||||
|
|||||||
@@ -11,14 +11,10 @@ public interface IConnectable {
|
|||||||
* Determines whether other CTM blocks can connect to this one.
|
* Determines whether other CTM blocks can connect to this one.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param x
|
* @param x The X position of the block that is connecting to this one. NOT the position of your block.
|
||||||
* The X position of the block that is connecting to this one. NOT the position of your block.
|
* @param y The Y position of the block that is connecting to this one. NOT the position of your block.
|
||||||
* @param y
|
* @param z The Z position of the block that is connecting to this one. NOT the position of your block.
|
||||||
* The Y position of the block that is connecting to this one. NOT the position of your block.
|
* @param side The side being drawn.
|
||||||
* @param z
|
|
||||||
* The Z position of the block that is connecting to this one. NOT the position of your block.
|
|
||||||
* @param side
|
|
||||||
* The side being drawn.
|
|
||||||
* @return True if a block can connect to this one from the given direction. False otherwise.
|
* @return True if a block can connect to this one from the given direction. False otherwise.
|
||||||
*/
|
*/
|
||||||
boolean canConnectCTM(IBlockAccess world, int x, int y, int z, int side);
|
boolean canConnectCTM(IBlockAccess world, int x, int y, int z, int side);
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.cricketcraft.chisel.api;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To be implemented on an {@link IBlockAccess} that renders blocks which are only part of a block space, so it can
|
||||||
|
* decide connected textures itself instead of reporting the blocks around it.
|
||||||
|
* <p>
|
||||||
|
* Connected textures ask this for every location they check, while rendering in this world. Render bounds smaller than
|
||||||
|
* the block are then a part of the block: they show the matching part of the block's connected texture, instead of the
|
||||||
|
* whole texture squeezed into the bounds.
|
||||||
|
*/
|
||||||
|
public interface IConnectionAccess {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the given location shows the block being rendered, as seen from the block being rendered.
|
||||||
|
*
|
||||||
|
* @param x X coord of the block to check against. NOT the position of the block being rendered.
|
||||||
|
* @param y Y coord of the block to check against.
|
||||||
|
* @param z Z coord of the block to check against.
|
||||||
|
* @param side The side being rendered, NOT the side being connected from.
|
||||||
|
* <p>
|
||||||
|
* This value can be -1 if no side is specified. Please handle this appropriately.
|
||||||
|
* @param fromX X coord of the block being rendered. It is not necessarily adjacent, it can also be diagonal to the
|
||||||
|
* location.
|
||||||
|
* @param fromY Y coord of the block being rendered.
|
||||||
|
* @param fromZ Z coord of the block being rendered.
|
||||||
|
* @param block The block being rendered.
|
||||||
|
* @param meta The metadata of the block being rendered.
|
||||||
|
* @return True if the location shows the given block and metadata.
|
||||||
|
*/
|
||||||
|
boolean matches(int x, int y, int z, int side, int fromX, int fromY, int fromZ, Block block, int meta);
|
||||||
|
}
|
||||||
@@ -12,16 +12,11 @@ public interface IFacade {
|
|||||||
/**
|
/**
|
||||||
* Gets the block this facade is acting as.
|
* Gets the block this facade is acting as.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world {@link World}
|
||||||
* {@link World}
|
* @param x X coord of your block
|
||||||
* @param x
|
* @param y Y coord of your block
|
||||||
* X coord of your block
|
* @param z Z coord of your block
|
||||||
* @param y
|
* @param side The side being rendered, NOT the side being connected from.
|
||||||
* Y coord of your block
|
|
||||||
* @param z
|
|
||||||
* Z coord of your block
|
|
||||||
* @param side
|
|
||||||
* The side being rendered, NOT the side being connected from.
|
|
||||||
* <p>
|
* <p>
|
||||||
* This value can be -1 if no side is specified. Please handle this appropriately.
|
* This value can be -1 if no side is specified. Please handle this appropriately.
|
||||||
* @return The block inside of your facade block.
|
* @return The block inside of your facade block.
|
||||||
@@ -31,19 +26,67 @@ public interface IFacade {
|
|||||||
/**
|
/**
|
||||||
* Gets the metadata of the block that this facade is acting as.
|
* Gets the metadata of the block that this facade is acting as.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world {@link World}
|
||||||
* {@link World}
|
* @param x X coord of your block
|
||||||
* @param x
|
* @param y Y coord of your block
|
||||||
* X coord of your block
|
* @param z Z coord of your block
|
||||||
* @param y
|
* @param side The side being rendered, NOT the side being connected from.
|
||||||
* Y coord of your block
|
|
||||||
* @param z
|
|
||||||
* Z coord of your block
|
|
||||||
* @param side
|
|
||||||
* The side being rendered, NOT the side being connected from.
|
|
||||||
* <p>
|
* <p>
|
||||||
* This value can be -1 if no side is specified. Please handle this appropriately.
|
* This value can be -1 if no side is specified. Please handle this appropriately.
|
||||||
* @return The metadata of your facade block.
|
* @return The metadata of your facade block.
|
||||||
*/
|
*/
|
||||||
int getFacadeMetadata(IBlockAccess world, int x, int y, int z, int side);
|
int getFacadeMetadata(IBlockAccess world, int x, int y, int z, int side);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the block this facade is acting as towards the block that is checking for a connection. Implement this if
|
||||||
|
* the facade can show different blocks to different neighbours.
|
||||||
|
* <p>
|
||||||
|
* Defaults to {@link #getFacade(IBlockAccess, int, int, int, int)}.
|
||||||
|
*
|
||||||
|
* @param world {@link World}
|
||||||
|
* @param x X coord of your block
|
||||||
|
* @param y Y coord of your block
|
||||||
|
* @param z Z coord of your block
|
||||||
|
* @param side The side being rendered, NOT the side being connected from.
|
||||||
|
* <p>
|
||||||
|
* This value can be -1 if no side is specified. Please handle this appropriately.
|
||||||
|
* @param fromX X coord of the block being rendered, which is checking for a connection. NOT the position of
|
||||||
|
* your block. It is not necessarily adjacent, it can also be diagonal to your block.
|
||||||
|
* @param fromY Y coord of the block being rendered.
|
||||||
|
* @param fromZ Z coord of the block being rendered.
|
||||||
|
* @param fromBlock The block being rendered.
|
||||||
|
* @param fromMeta The metadata of the block being rendered.
|
||||||
|
* @return The block inside of your facade block, as seen from the block being rendered.
|
||||||
|
*/
|
||||||
|
default Block getFacade(IBlockAccess world, int x, int y, int z, int side, int fromX, int fromY, int fromZ,
|
||||||
|
Block fromBlock, int fromMeta) {
|
||||||
|
return getFacade(world, x, y, z, side);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the metadata of the block that this facade is acting as towards the block that is checking for a
|
||||||
|
* connection. Implement this together with
|
||||||
|
* {@link #getFacade(IBlockAccess, int, int, int, int, int, int, int, Block, int)}.
|
||||||
|
* <p>
|
||||||
|
* Defaults to {@link #getFacadeMetadata(IBlockAccess, int, int, int, int)}.
|
||||||
|
*
|
||||||
|
* @param world {@link World}
|
||||||
|
* @param x X coord of your block
|
||||||
|
* @param y Y coord of your block
|
||||||
|
* @param z Z coord of your block
|
||||||
|
* @param side The side being rendered, NOT the side being connected from.
|
||||||
|
* <p>
|
||||||
|
* This value can be -1 if no side is specified. Please handle this appropriately.
|
||||||
|
* @param fromX X coord of the block being rendered, which is checking for a connection. NOT the position of
|
||||||
|
* your block. It is not necessarily adjacent, it can also be diagonal to your block.
|
||||||
|
* @param fromY Y coord of the block being rendered.
|
||||||
|
* @param fromZ Z coord of the block being rendered.
|
||||||
|
* @param fromBlock The block being rendered.
|
||||||
|
* @param fromMeta The metadata of the block being rendered.
|
||||||
|
* @return The metadata of your facade block, as seen from the block being rendered.
|
||||||
|
*/
|
||||||
|
default int getFacadeMetadata(IBlockAccess world, int x, int y, int z, int side, int fromX, int fromY, int fromZ,
|
||||||
|
Block fromBlock, int fromMeta) {
|
||||||
|
return getFacadeMetadata(world, x, y, z, side);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package com.cricketcraft.chisel.api;
|
package com.cricketcraft.chisel.api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the enum constants (using {@link #key} or calling {@link #toString()}) in this class as keys for IMC messages sent to chisel
|
* Use the enum constants (using {@link #key} or calling {@link #toString()}) in this class as keys for IMC messages
|
||||||
|
* sent to chisel
|
||||||
* <p>
|
* <p>
|
||||||
* It is also acceptable to copy the Strings in this class to avoid referencing this API.
|
* It is also acceptable to copy the Strings in this class to avoid referencing this API.
|
||||||
*/
|
*/
|
||||||
@@ -14,7 +15,8 @@ public enum IMC {
|
|||||||
* <p>
|
* <p>
|
||||||
* groupname|blockname|meta
|
* groupname|blockname|meta
|
||||||
* <p>
|
* <p>
|
||||||
* An example would be {@code "mygroup|minecraft:dirt|1"} and this will add the vanilla dirt block with metadata 1 to the "mygroup" group, creating that group if need be.
|
* An example would be {@code "mygroup|minecraft:dirt|1"} and this will add the vanilla dirt block with metadata 1
|
||||||
|
* to the "mygroup" group, creating that group if need be.
|
||||||
*/
|
*/
|
||||||
ADD_VARIATION("variation:add"),
|
ADD_VARIATION("variation:add"),
|
||||||
|
|
||||||
@@ -25,16 +27,19 @@ public enum IMC {
|
|||||||
* <p>
|
* <p>
|
||||||
* groupname|blockname|meta
|
* groupname|blockname|meta
|
||||||
* <p>
|
* <p>
|
||||||
* An example would be {@code "mygroup|minecraft:dirt|1"} and this will add the vanilla dirt block with metadata 1 to the "mygroup" group, creating that group if need be.
|
* An example would be {@code "mygroup|minecraft:dirt|1"} and this will add the vanilla dirt block with metadata 1
|
||||||
|
* to the "mygroup" group, creating that group if need be.
|
||||||
*/
|
*/
|
||||||
REMOVE_VARIATION("variation:remove"),
|
REMOVE_VARIATION("variation:remove"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers an oredict name to a group. This can be used to automatically add all blocks with this oredict name to a group. String syntax:
|
* Registers an oredict name to a group. This can be used to automatically add all blocks with this oredict name to
|
||||||
|
* a group. String syntax:
|
||||||
* <p>
|
* <p>
|
||||||
* groupname|oredictname
|
* groupname|oredictname
|
||||||
* <p>
|
* <p>
|
||||||
* An example would be {@code "mygroup|plankWood"} which will add all blocks registered in the oredict as "plankWood" to your group called "mygroup".
|
* An example would be {@code "mygroup|plankWood"} which will add all blocks registered in the oredict as
|
||||||
|
* "plankWood" to your group called "mygroup".
|
||||||
*/
|
*/
|
||||||
REGISTER_GROUP_ORE("group:ore");
|
REGISTER_GROUP_ORE("group:ore");
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import net.minecraft.util.ChatComponentTranslation;
|
|||||||
|
|
||||||
public class Statistics {
|
public class Statistics {
|
||||||
|
|
||||||
public static StatBase blocksChiseled = (new StatBasic("stat.blockChiseled", new ChatComponentTranslation("stat.blockChiseled", new Object[0])));
|
public static StatBase blocksChiseled = (new StatBasic(
|
||||||
|
"stat.blockChiseled",
|
||||||
|
new ChatComponentTranslation("stat.blockChiseled", new Object[0])));
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
blocksChiseled.initIndependentStat();
|
blocksChiseled.initIndependentStat();
|
||||||
|
|||||||
@@ -14,16 +14,19 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import team.chisel.ctmlib.ISubmapManager;
|
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ChiselAPIProps;
|
import com.cricketcraft.chisel.api.ChiselAPIProps;
|
||||||
import com.cricketcraft.chisel.api.FMPIMC;
|
import com.cricketcraft.chisel.api.FMPIMC;
|
||||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
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 {
|
public class CarvableHelper {
|
||||||
|
|
||||||
@@ -71,7 +74,8 @@ public class CarvableHelper {
|
|||||||
addVariation(description, metadata, null, bb, blockMeta, modid);
|
addVariation(description, metadata, null, bb, blockMeta, modid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, Block bb, int blockMeta, Material material, String modid) {
|
public void addVariation(String description, int metadata, Block bb, int blockMeta, Material material,
|
||||||
|
String modid) {
|
||||||
addVariation(description, metadata, null, bb, blockMeta, modid);
|
addVariation(description, metadata, null, bb, blockMeta, modid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +83,8 @@ public class CarvableHelper {
|
|||||||
addVariation(description, metadata, texture, null, 0, modid);
|
addVariation(description, metadata, texture, null, 0, modid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, String texture, Block block, int blockMeta, String modid) {
|
public void addVariation(String description, int metadata, String texture, Block block, int blockMeta,
|
||||||
|
String modid) {
|
||||||
addVariation(description, metadata, texture, block, blockMeta, modid, null, metadata);
|
addVariation(description, metadata, texture, block, blockMeta, modid, null, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,23 +92,27 @@ public class CarvableHelper {
|
|||||||
addVariation(description, metadata, texture, null, 0, ChiselAPIProps.MOD_ID, (ISubmapManager) null, order);
|
addVariation(description, metadata, texture, null, 0, ChiselAPIProps.MOD_ID, (ISubmapManager) null, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, String texture, Block block, int blockMeta, String modid, ISubmapManager customManager, int order) {
|
public void addVariation(String description, int metadata, String texture, Block block, int blockMeta, String modid,
|
||||||
|
ISubmapManager customManager, int order) {
|
||||||
|
|
||||||
if (infoList.size() >= 16)
|
if (infoList.size() >= 16) return;
|
||||||
return;
|
|
||||||
|
|
||||||
IVariationInfo info = FMLCommonHandler.instance().getSide().isClient() ? getClientInfo(modid, texture, description, metadata, block, blockMeta, customManager, order) : getServerInfo(modid,
|
IVariationInfo info = FMLCommonHandler.instance()
|
||||||
texture, description, metadata, block, blockMeta, customManager, order);
|
.getSide()
|
||||||
|
.isClient() ? getClientInfo(modid, texture, description, metadata, block, blockMeta, customManager, order)
|
||||||
|
: getServerInfo(modid, texture, description, metadata, block, blockMeta, customManager, order);
|
||||||
|
|
||||||
infoList.add(info);
|
infoList.add(info);
|
||||||
infoMap[metadata] = info;
|
infoMap[metadata] = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IVariationInfo getClientInfo(String modid, String texture, String description, int metadata, Block block, int blockMeta, ISubmapManager customManager, int order) {
|
private IVariationInfo getClientInfo(String modid, String texture, String description, int metadata, Block block,
|
||||||
|
int blockMeta, ISubmapManager customManager, int order) {
|
||||||
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(getBlock(), metadata, order);
|
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(getBlock(), metadata, order);
|
||||||
TextureType type = TextureType.getTypeFor(this, modid, texture);
|
TextureType type = TextureType.getTypeFor(this, modid, texture);
|
||||||
if (type == TextureType.CUSTOM && customManager == null && block == null) {
|
if (type == TextureType.CUSTOM && customManager == null && block == null) {
|
||||||
throw new IllegalArgumentException(String.format("Could not find texture %s, and no custom texture manager was provided.", texture));
|
throw new IllegalArgumentException(
|
||||||
|
String.format("Could not find texture %s, and no custom texture manager was provided.", texture));
|
||||||
}
|
}
|
||||||
|
|
||||||
ISubmapManager manager;
|
ISubmapManager manager;
|
||||||
@@ -117,29 +126,26 @@ public class CarvableHelper {
|
|||||||
return new VariationInfoBase(var, description, manager, type);
|
return new VariationInfoBase(var, description, manager, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IVariationInfo getServerInfo(String modid, String texture, String description, int metadata, Block block, int blockMeta, ISubmapManager customManager, int order) {
|
private IVariationInfo getServerInfo(String modid, String texture, String description, int metadata, Block block,
|
||||||
|
int blockMeta, ISubmapManager customManager, int order) {
|
||||||
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(getBlock(), metadata, order);
|
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(getBlock(), metadata, order);
|
||||||
return new VariationInfoBase(var, description, null);
|
return new VariationInfoBase(var, description, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IVariationInfo getVariation(int metadata) {
|
public IVariationInfo getVariation(int metadata) {
|
||||||
if (metadata < 0 || metadata > 15)
|
if (metadata < 0 || metadata > 15) metadata = 0;
|
||||||
metadata = 0;
|
|
||||||
|
|
||||||
IVariationInfo info = infoMap[metadata];
|
IVariationInfo info = infoMap[metadata];
|
||||||
if (info == null)
|
if (info == null) return null;
|
||||||
return null;
|
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
if (metadata < 0 || metadata > 15)
|
if (metadata < 0 || metadata > 15) metadata = 0;
|
||||||
metadata = 0;
|
|
||||||
|
|
||||||
IVariationInfo info = infoMap[metadata];
|
IVariationInfo info = infoMap[metadata];
|
||||||
if (info == null)
|
if (info == null) return getMissingIcon();
|
||||||
return getMissingIcon();
|
|
||||||
|
|
||||||
return info.getIcon(side, metadata);
|
return info.getIcon(side, metadata);
|
||||||
}
|
}
|
||||||
@@ -147,12 +153,10 @@ public class CarvableHelper {
|
|||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
int metadata = world.getBlockMetadata(x, y, z);
|
int metadata = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
if (metadata < 0 || metadata > 15)
|
if (metadata < 0 || metadata > 15) metadata = 0;
|
||||||
metadata = 0;
|
|
||||||
|
|
||||||
IVariationInfo info = infoMap[metadata];
|
IVariationInfo info = infoMap[metadata];
|
||||||
if (info == null)
|
if (info == null) return getMissingIcon();
|
||||||
return getMissingIcon();
|
|
||||||
|
|
||||||
return info.getIcon(world, x, y, z, side);
|
return info.getIcon(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
@@ -183,16 +187,24 @@ public class CarvableHelper {
|
|||||||
|
|
||||||
public void registerVariation(String name, IVariationInfo info) {
|
public void registerVariation(String name, IVariationInfo info) {
|
||||||
|
|
||||||
Block block = info.getVariation().getBlock();
|
Block block = info.getVariation()
|
||||||
|
.getBlock();
|
||||||
|
|
||||||
|
if (Loader.isModLoaded("ForgeMultipart") && block instanceof BlockCarvableGlowie) {
|
||||||
|
FMPCompat.registerGlowieVariation(info, block);
|
||||||
|
} else {
|
||||||
if (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
|
if (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
|
||||||
FMPIMC.registerFMP(block, info.getVariation().getBlockMeta());
|
FMPIMC.registerFMP(
|
||||||
|
block,
|
||||||
|
info.getVariation()
|
||||||
|
.getBlockMeta());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forbidChiseling)
|
if (forbidChiseling) return;
|
||||||
return;
|
|
||||||
|
|
||||||
CarvingUtils.getChiselRegistry().addVariation(name, info.getVariation());
|
CarvingUtils.getChiselRegistry()
|
||||||
|
.addVariation(name, info.getVariation());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@@ -204,7 +216,12 @@ public class CarvableHelper {
|
|||||||
|
|
||||||
public void registerSubBlocks(Block block, CreativeTabs tabs, List<ItemStack> list) {
|
public void registerSubBlocks(Block block, CreativeTabs tabs, List<ItemStack> list) {
|
||||||
for (IVariationInfo info : infoList) {
|
for (IVariationInfo info : infoList) {
|
||||||
list.add(new ItemStack(block, 1, info.getVariation().getItemMeta()));
|
list.add(
|
||||||
|
new ItemStack(
|
||||||
|
block,
|
||||||
|
1,
|
||||||
|
info.getVariation()
|
||||||
|
.getItemMeta()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +231,9 @@ public class CarvableHelper {
|
|||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getMissingIcon() {
|
public IIcon getMissingIcon() {
|
||||||
return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno");
|
return ((TextureMap) Minecraft.getMinecraft()
|
||||||
|
.getTextureManager()
|
||||||
|
.getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block getBlock() {
|
public Block getBlock() {
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ import com.google.common.collect.Lists;
|
|||||||
public class CarvingUtils {
|
public class CarvingUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple way to compare two {@link ICarvingVariation} objects based on the {@link ICarvingVariation#getOrder() getOrder()} method.
|
* A simple way to compare two {@link ICarvingVariation} objects based on the {@link ICarvingVariation#getOrder()
|
||||||
|
* getOrder()} method.
|
||||||
*
|
*
|
||||||
* @param v1
|
* @param v1 The first {@link ICarvingVariation variation}.
|
||||||
* The first {@link ICarvingVariation variation}.
|
* @param v2 The second {@link ICarvingVariation variation}.
|
||||||
* @param v2
|
* @return A positive integer if the first's order is greater, a negative integer if the second's is greater, and 0
|
||||||
* The second {@link ICarvingVariation variation}.
|
* if they are equal.
|
||||||
* @return A positive integer if the first's order is greater, a negative integer if the second's is greater, and 0 if they are equal.
|
|
||||||
*/
|
*/
|
||||||
public static int compare(ICarvingVariation v1, ICarvingVariation v2) {
|
public static int compare(ICarvingVariation v1, ICarvingVariation v2) {
|
||||||
return v1.getOrder() - v2.getOrder();
|
return v1.getOrder() - v2.getOrder();
|
||||||
@@ -27,8 +27,7 @@ public class CarvingUtils {
|
|||||||
/**
|
/**
|
||||||
* Gets an {@link ItemStack} representing the passed {@link ICarvingVariation}.
|
* Gets an {@link ItemStack} representing the passed {@link ICarvingVariation}.
|
||||||
*
|
*
|
||||||
* @param variation
|
* @param variation An {@link ICarvingVariation}
|
||||||
* An {@link ICarvingVariation}
|
|
||||||
* @return An {@link ItemStack}
|
* @return An {@link ItemStack}
|
||||||
*/
|
*/
|
||||||
public static ItemStack getStack(ICarvingVariation variation) {
|
public static ItemStack getStack(ICarvingVariation variation) {
|
||||||
@@ -47,14 +46,12 @@ 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.
|
* 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
|
* @param block The block of the variation
|
||||||
* The block of the variation
|
* @param metadata The metadata of both the block and item
|
||||||
* @param metadata
|
* @param order The sorting order.
|
||||||
* The metadata of both the block and item
|
|
||||||
* @param order
|
|
||||||
* The sorting order.
|
|
||||||
* @return A standard {@link ICarvingVariation} instance.
|
* @return A standard {@link ICarvingVariation} instance.
|
||||||
*/
|
*/
|
||||||
public static ICarvingVariation getDefaultVariationFor(Block block, int metadata, int order) {
|
public static ICarvingVariation getDefaultVariationFor(Block block, int metadata, int order) {
|
||||||
@@ -62,10 +59,10 @@ 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.
|
* 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
|
* @param name The name of the group.
|
||||||
* The name of the group.
|
|
||||||
* @return A standard {@link ICarvingGroup} instance.
|
* @return A standard {@link ICarvingGroup} instance.
|
||||||
*/
|
*/
|
||||||
public static ICarvingGroup getDefaultGroupFor(String name) {
|
public static ICarvingGroup getDefaultGroupFor(String name) {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Represents a group of chiselable blocks.
|
* Represents a group of chiselable blocks.
|
||||||
* <p>
|
* <p>
|
||||||
* This is an object that contains a collection of {@link ICarvingVariation} objects, and keeps them sorted. You may sort them in any way (or not at all), and {@link ICarvingVariation#getOrder()} will
|
* This is an object that contains a collection of {@link ICarvingVariation} objects, and keeps them sorted. You may
|
||||||
* likely be of use to do so.
|
* sort them in any way (or not at all), and {@link ICarvingVariation#getOrder()} will likely be of use to do so.
|
||||||
* <p>
|
* <p>
|
||||||
* It also defines what sound and oredict name the group as a whole has.
|
* It also defines what sound and oredict name the group as a whole has.
|
||||||
*/
|
*/
|
||||||
@@ -29,13 +29,13 @@ public interface ICarvingGroup {
|
|||||||
/**
|
/**
|
||||||
* Sets the sound of this group
|
* Sets the sound of this group
|
||||||
*
|
*
|
||||||
* @param sound
|
* @param sound A string resource path for the sound this group makes when chiseled
|
||||||
* A string resource path for the sound this group makes when chiseled
|
|
||||||
*/
|
*/
|
||||||
void setSound(String sound);
|
void setSound(String sound);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The oredict name to match to this group. All items with this oredict name will be assumed to be part of this group.
|
* The oredict name to match to this group. All items with this oredict name will be assumed to be part of this
|
||||||
|
* group.
|
||||||
*
|
*
|
||||||
* @return An ore dictionary name
|
* @return An ore dictionary name
|
||||||
*/
|
*/
|
||||||
@@ -44,8 +44,7 @@ public interface ICarvingGroup {
|
|||||||
/**
|
/**
|
||||||
* Sets the oredict name for this group.
|
* Sets the oredict name for this group.
|
||||||
*
|
*
|
||||||
* @param oreName
|
* @param oreName The String oredict name to be associated with this group.
|
||||||
* The String oredict name to be associated with this group.
|
|
||||||
*/
|
*/
|
||||||
void setOreName(String oreName);
|
void setOreName(String oreName);
|
||||||
|
|
||||||
@@ -57,18 +56,18 @@ public interface ICarvingGroup {
|
|||||||
List<ICarvingVariation> getVariations();
|
List<ICarvingVariation> getVariations();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a variation to this group. Do not call this from external code, as it will fail to remove the inverse lookup from the registry.
|
* Adds a variation to this group. Do not call this from external code, as it will fail to remove the inverse lookup
|
||||||
|
* from the registry.
|
||||||
*
|
*
|
||||||
* @param variation
|
* @param variation An {@link ICarvingVariation} to add to this group
|
||||||
* An {@link ICarvingVariation} to add to this group
|
|
||||||
*/
|
*/
|
||||||
void addVariation(ICarvingVariation variation);
|
void addVariation(ICarvingVariation variation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a variation to this group. Do not call this from external code, as it will fail to remove the inverse lookup from the registry.
|
* Removes a variation to this group. Do not call this from external code, as it will fail to remove the inverse
|
||||||
|
* lookup from the registry.
|
||||||
*
|
*
|
||||||
* @param variation
|
* @param variation An {@link ICarvingVariation} to add to this group
|
||||||
* An {@link ICarvingVariation} to add to this group
|
|
||||||
*/
|
*/
|
||||||
boolean removeVariation(ICarvingVariation variation);
|
boolean removeVariation(ICarvingVariation variation);
|
||||||
}
|
}
|
||||||
@@ -19,10 +19,8 @@ public interface ICarvingRegistry {
|
|||||||
/**
|
/**
|
||||||
* Finds the group the block/meta pair belongs to in the registry.
|
* Finds the group the block/meta pair belongs to in the registry.
|
||||||
*
|
*
|
||||||
* @param block
|
* @param block The block of the variation
|
||||||
* The block of the variation
|
* @param meta The metadata of the variation
|
||||||
* @param meta
|
|
||||||
* The metadata of the variation
|
|
||||||
* @return The {@link ICarvingGroup} that the block/meta pair belongs to
|
* @return The {@link ICarvingGroup} that the block/meta pair belongs to
|
||||||
*/
|
*/
|
||||||
ICarvingGroup getGroup(Block block, int meta);
|
ICarvingGroup getGroup(Block block, int meta);
|
||||||
@@ -30,8 +28,7 @@ public interface ICarvingRegistry {
|
|||||||
/**
|
/**
|
||||||
* Gets an {@link ICarvingGroup} by its name.
|
* Gets an {@link ICarvingGroup} by its name.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name The name of the group
|
||||||
* The name of the group
|
|
||||||
* @return An {@link ICarvingGroup}
|
* @return An {@link ICarvingGroup}
|
||||||
*/
|
*/
|
||||||
ICarvingGroup getGroup(String name);
|
ICarvingGroup getGroup(String name);
|
||||||
@@ -39,10 +36,8 @@ public interface ICarvingRegistry {
|
|||||||
/**
|
/**
|
||||||
* Gets the {@link ICarvingVariation} instance represented by this block/meta pair.
|
* Gets the {@link ICarvingVariation} instance represented by this block/meta pair.
|
||||||
*
|
*
|
||||||
* @param block
|
* @param block The block of the variatoin
|
||||||
* The block of the variatoin
|
* @param meta The metadata of the variation
|
||||||
* @param meta
|
|
||||||
* The metadata of the variation
|
|
||||||
* @return The {@link ICarvingVariation} containing this block/meta pair
|
* @return The {@link ICarvingVariation} containing this block/meta pair
|
||||||
*/
|
*/
|
||||||
ICarvingVariation getVariation(Block block, int meta);
|
ICarvingVariation getVariation(Block block, int meta);
|
||||||
@@ -50,10 +45,8 @@ public interface ICarvingRegistry {
|
|||||||
/**
|
/**
|
||||||
* Gets the list of {@link ICarvingVariation}s from the group that contains this block/meta pair.
|
* Gets the list of {@link ICarvingVariation}s from the group that contains this block/meta pair.
|
||||||
*
|
*
|
||||||
* @param block
|
* @param block The block of the variation
|
||||||
* The block of the variation
|
* @param meta The metadata 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
|
* @return All of the {@link ICarvingVariation}s in the group that contains this block/meta pair
|
||||||
*/
|
*/
|
||||||
List<ICarvingVariation> getGroupVariations(Block block, int meta);
|
List<ICarvingVariation> getGroupVariations(Block block, int meta);
|
||||||
@@ -61,10 +54,8 @@ public interface ICarvingRegistry {
|
|||||||
/**
|
/**
|
||||||
* Gets the oredict name for the group that contains this block/meta pair.
|
* Gets the oredict name for the group that contains this block/meta pair.
|
||||||
*
|
*
|
||||||
* @param block
|
* @param block The block of the variation
|
||||||
* The block of the variation
|
* @param meta The metadata of the variation
|
||||||
* @param meta
|
|
||||||
* The metadata of the variation
|
|
||||||
* @return A string oredict name for the group
|
* @return A string oredict name for the group
|
||||||
*/
|
*/
|
||||||
String getOreName(Block block, int meta);
|
String getOreName(Block block, int meta);
|
||||||
@@ -72,8 +63,7 @@ public interface ICarvingRegistry {
|
|||||||
/**
|
/**
|
||||||
* Gets the possible output items for this {@link ItemStack}. To be used for machines/GUIs that chisel items.
|
* Gets the possible output items for this {@link ItemStack}. To be used for machines/GUIs that chisel items.
|
||||||
*
|
*
|
||||||
* @param chiseled
|
* @param chiseled The {@link ItemStack} being chiseled
|
||||||
* The {@link ItemStack} being chiseled
|
|
||||||
* @return A list of stacks that can be chiseled from the passed {@link ItemStack stack}
|
* @return A list of stacks that can be chiseled from the passed {@link ItemStack stack}
|
||||||
*/
|
*/
|
||||||
List<ItemStack> getItemsForChiseling(ItemStack chiseled);
|
List<ItemStack> getItemsForChiseling(ItemStack chiseled);
|
||||||
@@ -81,24 +71,23 @@ public interface ICarvingRegistry {
|
|||||||
/**
|
/**
|
||||||
* Gets the sound resource string for the group represented by this block/meta pair.
|
* Gets the sound resource string for the group represented by this block/meta pair.
|
||||||
*
|
*
|
||||||
* @param block
|
* @param block The block of the variation
|
||||||
* The block of the variation
|
* @param metadata The metadata of the variation
|
||||||
* @param metadata
|
* @return The string resource for the sound that can be used in
|
||||||
* The metadata of the variation
|
* {@link World#playSound(double, double, double, String, float, float, boolean)} and other methods.
|
||||||
* @return The string resource for the sound that can be used in {@link World#playSound(double, double, double, String, float, float, boolean)} and other methods.
|
|
||||||
*/
|
*/
|
||||||
public String getVariationSound(Block block, int metadata);
|
public String getVariationSound(Block block, int metadata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the sound resource string for the group represented by this item/meta pair.
|
* Gets the sound resource string for the group represented by this item/meta pair.
|
||||||
* <p>
|
* <p>
|
||||||
* Mostly a convenience for calling {@link #getVariationSound(Block, int)} with {@link Block#getBlockFromItem(Item)}.
|
* Mostly a convenience for calling {@link #getVariationSound(Block, int)} with
|
||||||
|
* {@link Block#getBlockFromItem(Item)}.
|
||||||
*
|
*
|
||||||
* @param item
|
* @param item The item of the variation
|
||||||
* The item of the variation
|
* @param metadata The metadata of the variation
|
||||||
* @param metadata
|
* @return The string resource for the sound that can be used in
|
||||||
* The metadata of the variation
|
* {@link World#playSound(double, double, double, String, float, float, boolean)} and other methods.
|
||||||
* @return The string resource for the sound that can be used in {@link World#playSound(double, double, double, String, float, float, boolean)} and other methods.
|
|
||||||
*/
|
*/
|
||||||
public String getVariationSound(Item item, int metadata);
|
public String getVariationSound(Item item, int metadata);
|
||||||
|
|
||||||
@@ -112,67 +101,58 @@ public interface ICarvingRegistry {
|
|||||||
/**
|
/**
|
||||||
* Adds a variation to the registry.
|
* Adds a variation to the registry.
|
||||||
*
|
*
|
||||||
* @param groupName
|
* @param groupName The name of the group to add to.
|
||||||
* The name of the group to add to.
|
* @param block The block of the variation
|
||||||
* @param block
|
* @param metadata The metadata of the variation
|
||||||
* The block of the variation
|
* @param order The order of the variation in the list of all variations in the group. Higher numbers are sorted
|
||||||
* @param metadata
|
* at the end.
|
||||||
* The metadata of the variation
|
|
||||||
* @param order
|
|
||||||
* The order of the variation in the list of all variations in the group. Higher numbers are sorted at the end.
|
|
||||||
*/
|
*/
|
||||||
void addVariation(String groupName, Block block, int metadata, int order);
|
void addVariation(String groupName, Block block, int metadata, int order);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a variation to the registry.
|
* Adds a variation to the registry.
|
||||||
*
|
*
|
||||||
* @param groupName
|
* @param groupName The name of the group to add to
|
||||||
* The name of the group to add to
|
* @param variation The {@link ICarvingVariation} to add
|
||||||
* @param variation
|
|
||||||
* The {@link ICarvingVariation} to add
|
|
||||||
*/
|
*/
|
||||||
void addVariation(String groupName, ICarvingVariation variation);
|
void addVariation(String groupName, ICarvingVariation variation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a group to the registry.
|
* Adds a group to the registry.
|
||||||
*
|
*
|
||||||
* @param group
|
* @param group The {@link ICarvingGroup} to add.
|
||||||
* The {@link ICarvingGroup} to add.
|
|
||||||
*/
|
*/
|
||||||
void addGroup(ICarvingGroup group);
|
void addGroup(ICarvingGroup group);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a group from the registry.
|
* Removes a group from the registry.
|
||||||
* <p>
|
* <p>
|
||||||
* 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
|
* This in effect removes all variations associated with the group, though they are not explicitly removed from the
|
||||||
* removed, it will still contain its variations.
|
* object. If you maintain a reference to the {@link ICarvingGroup} that is removed, it will still contain its
|
||||||
|
* variations.
|
||||||
*
|
*
|
||||||
* @param groupName
|
* @param groupName The name of the group to remove.
|
||||||
* The name of the group to remove.
|
|
||||||
* @return The {@link ICarvingGroup} that was removed.
|
* @return The {@link ICarvingGroup} that was removed.
|
||||||
*/
|
*/
|
||||||
ICarvingGroup removeGroup(String groupName);
|
ICarvingGroup removeGroup(String groupName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
* 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
|
* @param block The {@link Block} of the {@link ICarvingVariation variation}
|
||||||
* The {@link Block} of the {@link ICarvingVariation variation}
|
* @param metadata The metadata 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.
|
* @return The ICarvingVariation that was removed. Null if nothing was removed.
|
||||||
*/
|
*/
|
||||||
ICarvingVariation removeVariation(Block block, int metadata);
|
ICarvingVariation removeVariation(Block block, int metadata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a varaition with the passed {@link Block} and metadata from the registry, but only from the specified {@link ICarvingGroup} name.
|
* Removes a varaition with the passed {@link Block} and metadata from the registry, but only from the specified
|
||||||
|
* {@link ICarvingGroup} name.
|
||||||
*
|
*
|
||||||
* @param block
|
* @param block The {@link Block} of the {@link ICarvingVariation variation}
|
||||||
* The {@link Block} of the {@link ICarvingVariation variation}
|
* @param metadata The metadata of the {@link ICarvingVariation variation}
|
||||||
* @param metadata
|
* @param group The name of the group that the variation should be removed from
|
||||||
* The metadata of the {@link ICarvingVariation variation}
|
|
||||||
* @param group
|
|
||||||
* The name of the group that the variation should be removed from
|
|
||||||
* @return The ICarvingVariation that was removed. Null if nothing was removed.
|
* @return The ICarvingVariation that was removed. Null if nothing was removed.
|
||||||
*/
|
*/
|
||||||
ICarvingVariation removeVariation(Block block, int metadata, String group);
|
ICarvingVariation removeVariation(Block block, int metadata, String group);
|
||||||
@@ -180,12 +160,11 @@ public interface ICarvingRegistry {
|
|||||||
/**
|
/**
|
||||||
* Registers a group to an oredict name.
|
* Registers a group to an oredict name.
|
||||||
* <p>
|
* <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.
|
* 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
|
* @param groupName The name of the group
|
||||||
* The name of the group
|
* @param oreName The oredict name
|
||||||
* @param oreName
|
|
||||||
* The oredict name
|
|
||||||
*/
|
*/
|
||||||
void registerOre(String groupName, String oreName);
|
void registerOre(String groupName, String oreName);
|
||||||
|
|
||||||
@@ -195,10 +174,8 @@ public interface ICarvingRegistry {
|
|||||||
* This is the sound that is used when a block from this group is chiseled. <br/>
|
* 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.
|
* Does <i>not</i> need to be explicitly set.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name The name of the group
|
||||||
* The name of the group
|
* @param sound The resource string for the sound
|
||||||
* @param sound
|
|
||||||
* The resource string for the sound
|
|
||||||
*/
|
*/
|
||||||
void setVariationSound(String name, String sound);
|
void setVariationSound(String name, String sound);
|
||||||
}
|
}
|
||||||
@@ -9,10 +9,12 @@ public interface IChiselMode {
|
|||||||
/**
|
/**
|
||||||
* NOTE: This method is responsible for increasing the "Blocks Chiseled" statistic found in the Statistics class.
|
* NOTE: This method is responsible for increasing the "Blocks Chiseled" statistic found in the Statistics class.
|
||||||
*/
|
*/
|
||||||
void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side, ICarvingVariation variation);
|
void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side,
|
||||||
|
ICarvingVariation variation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implemented implicitly by enums. If your IChiselMode is not an enum constant, this needs to be implemented explicitly.
|
* Implemented implicitly by enums. If your IChiselMode is not an enum constant, this needs to be implemented
|
||||||
|
* explicitly.
|
||||||
*
|
*
|
||||||
* @return The name of the mode.
|
* @return The name of the mode.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.cricketcraft.chisel.api.carving;
|
package com.cricketcraft.chisel.api.carving;
|
||||||
|
|
||||||
import team.chisel.ctmlib.ISubmapManager;
|
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||||
|
|
||||||
|
import team.chisel.ctmlib.ISubmapManager;
|
||||||
|
|
||||||
public interface IVariationInfo extends ISubmapManager {
|
public interface IVariationInfo extends ISubmapManager {
|
||||||
|
|
||||||
ICarvingVariation getVariation();
|
ICarvingVariation getVariation();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.cricketcraft.chisel.api.carving;
|
package com.cricketcraft.chisel.api.carving;
|
||||||
|
|
||||||
import team.chisel.ctmlib.ISubmapManager;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -11,12 +10,14 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
|
|
||||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||||
|
|
||||||
|
import team.chisel.ctmlib.ISubmapManager;
|
||||||
|
|
||||||
public class VariationInfoBase implements IVariationInfo {
|
public class VariationInfoBase implements IVariationInfo {
|
||||||
|
|
||||||
private ICarvingVariation variation;
|
private final ICarvingVariation variation;
|
||||||
private String unlocDesc;
|
private final String unlocDesc;
|
||||||
private ISubmapManager manager;
|
private final ISubmapManager manager;
|
||||||
private TextureType type;
|
private final TextureType type;
|
||||||
|
|
||||||
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager) {
|
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager) {
|
||||||
this(variation, unlocDesc, manager, TextureType.CUSTOM);
|
this(variation, unlocDesc, manager, TextureType.CUSTOM);
|
||||||
|
|||||||
@@ -4,4 +4,3 @@ package com.cricketcraft.chisel.api.carving;
|
|||||||
import com.cricketcraft.chisel.api.ChiselAPIProps;
|
import com.cricketcraft.chisel.api.ChiselAPIProps;
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
||||||
|
|
||||||
@@ -2,4 +2,3 @@
|
|||||||
package com.cricketcraft.chisel.api;
|
package com.cricketcraft.chisel.api;
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
||||||
|
|
||||||
@@ -6,6 +6,11 @@ import net.minecraft.block.Block;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.client.resources.FallbackResourceManager;
|
||||||
|
import net.minecraft.client.resources.IResourceManager;
|
||||||
|
import net.minecraft.client.resources.IResourcePack;
|
||||||
|
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||||
|
import net.minecraft.launchwrapper.Launch;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
@@ -15,18 +20,18 @@ import org.apache.commons.lang3.ArrayUtils;
|
|||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.apache.commons.lang3.tuple.Triple;
|
import org.apache.commons.lang3.tuple.Triple;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import team.chisel.ctmlib.CTM;
|
import team.chisel.ctmlib.CTM;
|
||||||
import team.chisel.ctmlib.ISubmapManager;
|
import team.chisel.ctmlib.ISubmapManager;
|
||||||
import team.chisel.ctmlib.RenderBlocksCTM;
|
import team.chisel.ctmlib.RenderBlocksCTM;
|
||||||
import team.chisel.ctmlib.RenderBlocksColumn;
|
import team.chisel.ctmlib.RenderBlocksColumn;
|
||||||
import team.chisel.ctmlib.TextureSubmap;
|
import team.chisel.ctmlib.TextureSubmap;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all default {@link ISubmapManager} behavior
|
* Handles all default {@link ISubmapManager} behavior
|
||||||
*/
|
*/
|
||||||
@@ -85,15 +90,15 @@ public enum TextureType {
|
|||||||
return data.getRight();
|
return data.getRight();
|
||||||
|
|
||||||
Block block = world.getBlock(x, y, z);
|
Block block = world.getBlock(x, y, z);
|
||||||
boolean topConnected = ctm.isConnected(world, x, y + 1, z, side, block, meta);
|
boolean topConnected = ctm.isConnected(world, x, y + 1, z, side, x, y, z, block, meta);
|
||||||
boolean botConnected = ctm.isConnected(world, x, y - 1, z, side, block, meta);
|
boolean botConnected = ctm.isConnected(world, x, y - 1, z, side, x, y, z, block, meta);
|
||||||
|
|
||||||
TextureSubmap map = data.getLeft();
|
TextureSubmap map = data.getLeft();
|
||||||
if (topConnected && botConnected)
|
if (topConnected && botConnected)
|
||||||
return map.getSubIcon(0, 1);
|
return map.getSubIcon(0, 1);
|
||||||
if (topConnected && !botConnected)
|
if (topConnected)
|
||||||
return map.getSubIcon(1, 1);
|
return map.getSubIcon(1, 1);
|
||||||
if (!topConnected && botConnected)
|
if (botConnected)
|
||||||
return map.getSubIcon(1, 0);
|
return map.getSubIcon(1, 0);
|
||||||
return map.getSubIcon(0, 0);
|
return map.getSubIcon(0, 0);
|
||||||
}
|
}
|
||||||
@@ -101,10 +106,9 @@ public enum TextureType {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||||
RenderBlocksColumn ret = theRenderBlocksColumn;
|
RenderBlocksColumn ret = theRenderBlocksColumn.get();
|
||||||
Pair<TextureSubmap, IIcon> data = (Pair<TextureSubmap, IIcon>) cachedObject;
|
Pair<TextureSubmap, IIcon> data = (Pair<TextureSubmap, IIcon>) cachedObject;
|
||||||
|
|
||||||
ret.blockAccess = world;
|
|
||||||
ret.renderMaxX = 1.0;
|
ret.renderMaxX = 1.0;
|
||||||
ret.renderMaxY = 1.0;
|
ret.renderMaxY = 1.0;
|
||||||
ret.renderMaxZ = 1.0;
|
ret.renderMaxZ = 1.0;
|
||||||
@@ -138,11 +142,11 @@ public enum TextureType {
|
|||||||
boolean reverse = side == 3 || side == 4;
|
boolean reverse = side == 3 || side == 4;
|
||||||
|
|
||||||
if (side < 4) {
|
if (side < 4) {
|
||||||
p = ctm.isConnected(world, x - 1, y, z, side, block, meta);
|
p = ctm.isConnected(world, x - 1, y, z, side, x, y, z, block, meta);
|
||||||
n = ctm.isConnected(world, x + 1, y, z, side, block, meta);
|
n = ctm.isConnected(world, x + 1, y, z, side, x, y, z, block, meta);
|
||||||
} else {
|
} else {
|
||||||
p = ctm.isConnected(world, x, y, z - 1, side, block, meta);
|
p = ctm.isConnected(world, x, y, z - 1, side, x, y, z, block, meta);
|
||||||
n = ctm.isConnected(world, x, y, z + 1, side, block, meta);
|
n = ctm.isConnected(world, x, y, z + 1, side, x, y, z, block, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureSubmap map = data.getLeft();
|
TextureSubmap map = data.getLeft();
|
||||||
@@ -206,14 +210,12 @@ public enum TextureType {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||||
RenderBlocksCTM ret = theRenderBlocksCTM;
|
RenderBlocksCTM ret = theRenderBlocksCTM.get();
|
||||||
Triple<?, TextureSubmap, TextureSubmap> data = (Triple<?, TextureSubmap, TextureSubmap>) cachedObject;
|
Triple<?, TextureSubmap, TextureSubmap> data = (Triple<?, TextureSubmap, TextureSubmap>) cachedObject;
|
||||||
ret.blockAccess = world;
|
|
||||||
|
|
||||||
ret.submap = data.getMiddle();
|
ret.submap = data.getMiddle();
|
||||||
ret.submapSmall = data.getRight();
|
ret.submapSmall = data.getRight();
|
||||||
|
|
||||||
ret.rendererOld = rendererOld;
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -270,6 +272,8 @@ public enum TextureType {
|
|||||||
CUSTOM;
|
CUSTOM;
|
||||||
|
|
||||||
/* Some util stuff for shared code between v* and r* */
|
/* Some util stuff for shared code between v* and r* */
|
||||||
|
public static final boolean fixedBottomFaceUV = (boolean) Launch.blackboard
|
||||||
|
.getOrDefault("hodgepodge.FixesConfig.fixBottomFaceUV", Boolean.FALSE);
|
||||||
|
|
||||||
public static IIcon getVIcon(TextureType type, TextureSubmap map, int x, int y, int z, int side) {
|
public static IIcon getVIcon(TextureType type, TextureSubmap map, int x, int y, int z, int side) {
|
||||||
int variationSize = (type == TextureType.V9) ? 3 : 2;
|
int variationSize = (type == TextureType.V9) ? 3 : 2;
|
||||||
@@ -290,6 +294,9 @@ public enum TextureType {
|
|||||||
//For DOWN, reverse the indexes for only Z
|
//For DOWN, reverse the indexes for only Z
|
||||||
textureZ = (variationSize - textureZ - 1);
|
textureZ = (variationSize - textureZ - 1);
|
||||||
}*/
|
}*/
|
||||||
|
else if (side == 0 && fixedBottomFaceUV) {
|
||||||
|
textureX = variationSize - textureX - 1;
|
||||||
|
}
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
if (side == 0 || side == 1) {
|
if (side == 0 || side == 1) {
|
||||||
@@ -325,27 +332,18 @@ public enum TextureType {
|
|||||||
private static final TextureType[] VALUES;
|
private static final TextureType[] VALUES;
|
||||||
private static final CTM ctm = CTM.getInstance();
|
private static final CTM ctm = CTM.getInstance();
|
||||||
private static final Random rand = new Random();
|
private static final Random rand = new Random();
|
||||||
@SideOnly(Side.CLIENT)
|
private static final ThreadLocal<RenderBlocksCTM> theRenderBlocksCTM = FMLLaunchHandler.side().isClient() ? ThreadLocal.withInitial(RenderBlocksCTM::new) : null;
|
||||||
private static RenderBlocksCTM theRenderBlocksCTM;
|
private static final ThreadLocal<RenderBlocksColumn> theRenderBlocksColumn = FMLLaunchHandler.side().isClient() ? ThreadLocal.withInitial(RenderBlocksColumn::new) : null;
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
private static RenderBlocksColumn theRenderBlocksColumn;
|
|
||||||
|
|
||||||
private String[] suffixes;
|
private final String[] suffixes;
|
||||||
static {
|
static {
|
||||||
VALUES = ArrayUtils.subarray(values(), 0, values().length - 1);
|
VALUES = ArrayUtils.subarray(values(), 0, values().length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextureType(String... suffixes) {
|
TextureType(String... suffixes) {
|
||||||
this.suffixes = suffixes.length == 0 ? new 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) {
|
public ISubmapManager createManagerFor(ICarvingVariation variation, String texturePath) {
|
||||||
return new SubmapManagerDefault(this, variation, texturePath);
|
return new SubmapManagerDefault(this, variation, texturePath);
|
||||||
}
|
}
|
||||||
@@ -390,11 +388,25 @@ public enum TextureType {
|
|||||||
return CUSTOM;
|
return CUSTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is ugly, but faster than class.getResource
|
|
||||||
private static boolean exists(String modid, String path, String postfix) {
|
private static boolean exists(String modid, String path, String postfix) {
|
||||||
ResourceLocation rl = new ResourceLocation(modid, "textures/blocks/" + path + postfix + ".png");
|
ResourceLocation rl = new ResourceLocation(modid, "textures/blocks/" + path + postfix + ".png");
|
||||||
|
|
||||||
|
final IResourceManager resMan = Minecraft.getMinecraft().getResourceManager();
|
||||||
|
if (resMan instanceof SimpleReloadableResourceManager simple) {
|
||||||
|
FallbackResourceManager fallback = (FallbackResourceManager)simple.domainResourceManagers.get(rl.getResourceDomain());
|
||||||
|
if (fallback != null) {
|
||||||
|
for (Object obj : fallback.resourcePacks) {
|
||||||
|
if (obj instanceof IResourcePack rp && rp.resourceExists(rl)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback
|
||||||
try {
|
try {
|
||||||
Minecraft.getMinecraft().getResourceManager().getAllResources(rl);
|
resMan.getAllResources(rl);
|
||||||
return true;
|
return true;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
return false;
|
return false;
|
||||||
@@ -424,7 +436,6 @@ public enum TextureType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||||
initStatics();
|
|
||||||
RenderBlocks rb = type.createRenderContext(rendererOld, world, cachedObject);
|
RenderBlocks rb = type.createRenderContext(rendererOld, world, cachedObject);
|
||||||
rb.setRenderBoundsFromBlock(block);
|
rb.setRenderBoundsFromBlock(block);
|
||||||
return rb;
|
return rb;
|
||||||
|
|||||||
@@ -4,4 +4,3 @@ package com.cricketcraft.chisel.api.rendering;
|
|||||||
import com.cricketcraft.chisel.api.ChiselAPIProps;
|
import com.cricketcraft.chisel.api.ChiselAPIProps;
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
||||||
|
|
||||||
@@ -2,11 +2,12 @@ package team.chisel;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import team.chisel.utils.General;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import team.chisel.utils.General;
|
||||||
|
|
||||||
public class BlockNameConversion {
|
public class BlockNameConversion {
|
||||||
|
|
||||||
@@ -29,7 +30,8 @@ public class BlockNameConversion {
|
|||||||
return newname;
|
return newname;
|
||||||
case 2: // rename "marbleSlab" -> "marble_slab", "redstone" ->
|
case 2: // rename "marbleSlab" -> "marble_slab", "redstone" ->
|
||||||
// "redstone_block"
|
// "redstone_block"
|
||||||
newname = oldname.replaceAll("([a-z]+)([A-Z])", "$1_$2").toLowerCase();
|
newname = oldname.replaceAll("([a-z]+)([A-Z])", "$1_$2")
|
||||||
|
.toLowerCase();
|
||||||
|
|
||||||
if (newname.startsWith("block_")) {
|
if (newname.startsWith("block_")) {
|
||||||
newname = newname.replaceFirst("block_([a-z_]+)", "$1_block");
|
newname = newname.replaceFirst("block_([a-z_]+)", "$1_block");
|
||||||
@@ -38,7 +40,9 @@ public class BlockNameConversion {
|
|||||||
}
|
}
|
||||||
return newname;
|
return newname;
|
||||||
case 3: // rename "wood-dark-oak" -> "dark_oak_planks"
|
case 3: // rename "wood-dark-oak" -> "dark_oak_planks"
|
||||||
newname = oldname.replaceAll("([a-z]+)([A-Z])", "$1_$2").toLowerCase().replace('-', '_');
|
newname = oldname.replaceAll("([a-z]+)([A-Z])", "$1_$2")
|
||||||
|
.toLowerCase()
|
||||||
|
.replace('-', '_');
|
||||||
if (newname.contains("wood_")) {
|
if (newname.contains("wood_")) {
|
||||||
newname = newname.replaceFirst("wood_([a-z_]+)", "$1_planks");
|
newname = newname.replaceFirst("wood_([a-z_]+)", "$1_planks");
|
||||||
}
|
}
|
||||||
@@ -47,7 +51,9 @@ public class BlockNameConversion {
|
|||||||
// "dirt" -> "dirt").
|
// "dirt" -> "dirt").
|
||||||
// This can be dangerous in cases like "carpet" (a block) ->
|
// This can be dangerous in cases like "carpet" (a block) ->
|
||||||
// "carpet" (NO block)
|
// "carpet" (NO block)
|
||||||
return oldname.replaceAll("([a-z]+)([A-Z])", "$1_$2").toLowerCase().replaceFirst("block_", "");
|
return oldname.replaceAll("([a-z]+)([A-Z])", "$1_$2")
|
||||||
|
.toLowerCase()
|
||||||
|
.replaceFirst("block_", "");
|
||||||
default:
|
default:
|
||||||
throw new IndexOutOfBoundsException("conversion got invalid parameter step=" + step);
|
throw new IndexOutOfBoundsException("conversion got invalid parameter step=" + step);
|
||||||
}
|
}
|
||||||
@@ -82,13 +88,16 @@ public class BlockNameConversion {
|
|||||||
namingConversion.put("blockFft", "fantasyblock");
|
namingConversion.put("blockFft", "fantasyblock");
|
||||||
namingConversion.put("blockCarpetFloor", "carpet");
|
namingConversion.put("blockCarpetFloor", "carpet");
|
||||||
namingConversion.put("blockLaboratory", "laboratoryblock");
|
namingConversion.put("blockLaboratory", "laboratoryblock");
|
||||||
|
namingConversion.put("wroughtironblock", "castironblock");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Item findItem(String oldname) {
|
public static Item findItem(String oldname) {
|
||||||
FMLLog.getLogger().trace("[Chisel 2] findItem() START " + oldname);
|
FMLLog.getLogger()
|
||||||
|
.trace("[Chisel 2] findItem() START " + oldname);
|
||||||
Item item = null;
|
Item item = null;
|
||||||
for (int i = 0; i < NameConversions.MAX && item == null; i++) {
|
for (int i = 0; i < NameConversions.MAX && item == null; i++) {
|
||||||
FMLLog.getLogger().trace("[Chisel 2] findItem() Checking for " + NameConversions.conversion(oldname, i));
|
FMLLog.getLogger()
|
||||||
|
.trace("[Chisel 2] findItem() Checking for " + NameConversions.conversion(oldname, i));
|
||||||
item = GameRegistry.findItem(Chisel.MOD_ID, NameConversions.conversion(oldname, i));
|
item = GameRegistry.findItem(Chisel.MOD_ID, NameConversions.conversion(oldname, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,10 +105,12 @@ public class BlockNameConversion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Block findBlock(String oldname) {
|
public static Block findBlock(String oldname) {
|
||||||
FMLLog.getLogger().trace("[Chisel 2] findBlock() START: " + oldname);
|
FMLLog.getLogger()
|
||||||
|
.trace("[Chisel 2] findBlock() START: " + oldname);
|
||||||
Block block = null;
|
Block block = null;
|
||||||
for (int i = 0; i < NameConversions.MAX && block == null; i++) {
|
for (int i = 0; i < NameConversions.MAX && block == null; i++) {
|
||||||
FMLLog.getLogger().trace("[Chisel 2] findBlock() Checking for " + NameConversions.conversion(oldname, i));
|
FMLLog.getLogger()
|
||||||
|
.trace("[Chisel 2] findBlock() Checking for " + NameConversions.conversion(oldname, i));
|
||||||
block = GameRegistry.findBlock(Chisel.MOD_ID, NameConversions.conversion(oldname, i));
|
block = GameRegistry.findBlock(Chisel.MOD_ID, NameConversions.conversion(oldname, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,23 +10,6 @@ import net.minecraftforge.common.config.Configuration;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import team.chisel.block.BlockCarvable;
|
|
||||||
import team.chisel.carving.Carving;
|
|
||||||
import team.chisel.compat.Compatibility;
|
|
||||||
import team.chisel.compat.IMCHandler;
|
|
||||||
import team.chisel.compat.fmp.FMPCompat;
|
|
||||||
import team.chisel.config.Configurations;
|
|
||||||
import team.chisel.entity.EntityChiselSnowman;
|
|
||||||
import team.chisel.init.ChiselBlocks;
|
|
||||||
import team.chisel.init.TabsInit;
|
|
||||||
import team.chisel.item.ItemCarvable;
|
|
||||||
import team.chisel.item.chisel.ChiselController;
|
|
||||||
import team.chisel.network.ChiselGuiHandler;
|
|
||||||
import team.chisel.network.PacketHandler;
|
|
||||||
import team.chisel.proxy.CommonProxy;
|
|
||||||
import team.chisel.utils.General;
|
|
||||||
import team.chisel.world.GeneratorChisel;
|
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ChiselAPIProps;
|
import com.cricketcraft.chisel.api.ChiselAPIProps;
|
||||||
import com.cricketcraft.chisel.api.Statistics;
|
import com.cricketcraft.chisel.api.Statistics;
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
@@ -52,18 +35,47 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
|||||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry.Type;
|
import cpw.mods.fml.common.registry.GameRegistry.Type;
|
||||||
|
import team.chisel.block.BlockCarvable;
|
||||||
|
import team.chisel.carving.Carving;
|
||||||
|
import team.chisel.compat.Compatibility;
|
||||||
|
import team.chisel.compat.IMCHandler;
|
||||||
|
import team.chisel.compat.fmp.FMPCompat;
|
||||||
|
import team.chisel.config.Configurations;
|
||||||
|
import team.chisel.entity.EntityChiselSnowman;
|
||||||
|
import team.chisel.init.ChiselBlocks;
|
||||||
|
import team.chisel.init.TabsInit;
|
||||||
|
import team.chisel.item.ItemCarvable;
|
||||||
|
import team.chisel.item.chisel.ChiselController;
|
||||||
|
import team.chisel.network.ChiselGuiHandler;
|
||||||
|
import team.chisel.network.PacketHandler;
|
||||||
|
import team.chisel.proxy.CommonProxy;
|
||||||
|
import team.chisel.utils.General;
|
||||||
|
import team.chisel.world.GeneratorChisel;
|
||||||
|
|
||||||
@Mod(modid = Chisel.MOD_ID, name = Chisel.MOD_NAME, version = Chisel.VERSION, guiFactory = "team.chisel.client.gui.GuiFactory", dependencies = "after:EE3;after:ForgeMultipart;after:Thaumcraft;after:appliedenergistics2;after:Railcraft;after:AWWayofTime;after:TwilightForest")
|
@Mod(
|
||||||
|
modid = Chisel.MOD_ID,
|
||||||
|
name = Chisel.MOD_NAME,
|
||||||
|
version = Chisel.VERSION,
|
||||||
|
guiFactory = "team.chisel.client.gui.GuiFactory",
|
||||||
|
dependencies = "after:EE3;after:ForgeMultipart@[2.0.0,);after:Thaumcraft;after:appliedenergistics2;after:Railcraft;after:AWWayofTime;after:TwilightForest;after:BiomesOPlenty")
|
||||||
public class Chisel {
|
public class Chisel {
|
||||||
|
|
||||||
public static final String MOD_ID = "chisel";
|
public static final String MOD_ID = "chisel";
|
||||||
public static final BlockCarvable.SoundType soundTempleFootstep = new BlockCarvable.SoundType("dig.stone", MOD_ID + ":step.templeblock", 1.0f, 1.0f);
|
public static final BlockCarvable.SoundType soundTempleFootstep = new BlockCarvable.SoundType(
|
||||||
|
"dig.stone",
|
||||||
|
MOD_ID + ":step.templeblock",
|
||||||
|
1.0f,
|
||||||
|
1.0f);
|
||||||
public static final String MOD_NAME = "Chisel";
|
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, 1.0f);
|
public static final BlockCarvable.SoundType soundHolystoneFootstep = new BlockCarvable.SoundType(
|
||||||
|
"holystone",
|
||||||
|
1.0f,
|
||||||
|
1.0f);
|
||||||
public static final BlockCarvable.SoundType soundMetalFootstep = new BlockCarvable.SoundType("metal", 1.0f, 1.0f);
|
public static final BlockCarvable.SoundType soundMetalFootstep = new BlockCarvable.SoundType("metal", 1.0f, 1.0f);
|
||||||
public static boolean multipartLoaded = false;
|
public static boolean multipartLoaded = false;
|
||||||
public static boolean gtnhLoaded = false;
|
public static boolean gtnhLoaded = false;
|
||||||
|
public static boolean iguanaTweaksLoaded = false;
|
||||||
public static int renderEldritchId;
|
public static int renderEldritchId;
|
||||||
public static int renderAutoChiselId;
|
public static int renderAutoChiselId;
|
||||||
public static int renderGlowId;
|
public static int renderGlowId;
|
||||||
@@ -105,25 +117,28 @@ public class Chisel {
|
|||||||
|
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
m.remap(block);
|
m.remap(block);
|
||||||
FMLLog.getLogger().info("Remapping block " + m.name + " to " + General.getName(block));
|
FMLLog.getLogger()
|
||||||
} else
|
.info("Remapping block " + m.name + " to " + General.getName(block));
|
||||||
FMLLog.getLogger().warn("Block " + m.name + " could not get remapped.");
|
} else FMLLog.getLogger()
|
||||||
|
.warn("Block " + m.name + " could not get remapped.");
|
||||||
} else if (m.type == Type.ITEM) {
|
} else if (m.type == Type.ITEM) {
|
||||||
final Item item = BlockNameConversion.findItem(m.name);
|
final Item item = BlockNameConversion.findItem(m.name);
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
m.remap(item);
|
m.remap(item);
|
||||||
FMLLog.getLogger().info("Remapping item " + m.name + " to " + General.getName(item));
|
FMLLog.getLogger()
|
||||||
|
.info("Remapping item " + m.name + " to " + General.getName(item));
|
||||||
|
|
||||||
} else
|
} else FMLLog.getLogger()
|
||||||
FMLLog.getLogger().warn("Item " + m.name + " could not get remapped.");
|
.warn("Item " + m.name + " could not get remapped.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
FMLCommonHandler.instance().registerCrashCallable(new ChiselCrashCallable());
|
FMLCommonHandler.instance()
|
||||||
|
.registerCrashCallable(new ChiselCrashCallable());
|
||||||
|
|
||||||
File configFile = event.getSuggestedConfigurationFile();
|
File configFile = event.getSuggestedConfigurationFile();
|
||||||
Configurations.configExists = configFile.exists();
|
Configurations.configExists = configFile.exists();
|
||||||
@@ -134,6 +149,9 @@ public class Chisel {
|
|||||||
if (Loader.isModLoaded("dreamcraft")) {
|
if (Loader.isModLoaded("dreamcraft")) {
|
||||||
gtnhLoaded = true;
|
gtnhLoaded = true;
|
||||||
}
|
}
|
||||||
|
if (Loader.isModLoaded("IguanaTweaksTConstruct")) {
|
||||||
|
iguanaTweaksLoaded = true;
|
||||||
|
}
|
||||||
TabsInit.preInit();
|
TabsInit.preInit();
|
||||||
Features.preInit();
|
Features.preInit();
|
||||||
Statistics.init();
|
Statistics.init();
|
||||||
@@ -162,7 +180,9 @@ public class Chisel {
|
|||||||
|
|
||||||
proxy.init();
|
proxy.init();
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
FMLCommonHandler.instance().bus().register(instance);
|
FMLCommonHandler.instance()
|
||||||
|
.bus()
|
||||||
|
.register(instance);
|
||||||
|
|
||||||
FMLInterModComms.sendMessage("Waila", "register", "team.chisel.compat.WailaCompat.register");
|
FMLInterModComms.sendMessage("Waila", "register", "team.chisel.compat.WailaCompat.register");
|
||||||
}
|
}
|
||||||
|
|||||||
+3697
-511
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,5 @@
|
|||||||
package team.chisel.block;
|
package team.chisel.block;
|
||||||
|
|
||||||
import team.chisel.Chisel;
|
|
||||||
import team.chisel.block.tileentity.TileEntityAutoChisel;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@@ -10,6 +8,9 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import team.chisel.Chisel;
|
||||||
|
import team.chisel.block.tileentity.TileEntityAutoChisel;
|
||||||
|
|
||||||
public class BlockAutoChisel extends BlockContainer {
|
public class BlockAutoChisel extends BlockContainer {
|
||||||
|
|
||||||
public BlockAutoChisel() {
|
public BlockAutoChisel() {
|
||||||
@@ -34,10 +35,10 @@ public class BlockAutoChisel extends BlockContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float x1, float y1, float z1) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float x1,
|
||||||
|
float y1, float z1) {
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if (world.isRemote)
|
if (world.isRemote) return true;
|
||||||
return true;
|
|
||||||
|
|
||||||
if (tile != null && tile instanceof TileEntityAutoChisel && !player.isSneaking()) {
|
if (tile != null && tile instanceof TileEntityAutoChisel && !player.isSneaking()) {
|
||||||
player.openGui(Chisel.instance, 1, world, x, y, z);
|
player.openGui(Chisel.instance, 1, world, x, y, z);
|
||||||
|
|||||||
@@ -2,22 +2,25 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
import com.cricketcraft.chisel.api.ICarvable;
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||||
|
|
||||||
import team.chisel.Chisel;
|
|
||||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.Chisel;
|
||||||
|
import team.chisel.config.Configurations;
|
||||||
|
|
||||||
public class BlockCarvable extends Block implements ICarvable {
|
public class BlockCarvable extends Block implements ICarvable {
|
||||||
|
|
||||||
@@ -99,14 +102,13 @@ public class BlockCarvable extends Block implements ICarvable {
|
|||||||
public final String soundNamePlace;
|
public final String soundNamePlace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* @param soundName block of the sound. Will automatically be expanded to "mod:dig.soundName" and
|
||||||
* block of the sound. Will automatically be expanded to "mod:dig.soundName" and "mod:step.soundName" respectively)
|
* "mod:step.soundName" respectively)
|
||||||
* @param volume
|
* @param volume default 1.0f
|
||||||
* default 1.0f
|
* @param frequency default 1.0f
|
||||||
* @param frequency
|
|
||||||
* default 1.0f
|
|
||||||
*/
|
*/
|
||||||
public SoundType(String soundName, float volume, float frequency) {
|
public SoundType(String soundName, float volume, float frequency) {
|
||||||
super(soundName, volume, frequency);
|
super(soundName, volume, frequency);
|
||||||
@@ -116,16 +118,13 @@ 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
|
* Creates a SoundType with manual names for step and break sounds. Sound names must be specified in the
|
||||||
|
* sounds.json
|
||||||
*
|
*
|
||||||
* @param soundNameBreak
|
* @param soundNameBreak block break sound
|
||||||
* block break sound
|
* @param soundNameStep block step sound
|
||||||
* @param soundNameStep
|
* @param volume default 1.0f
|
||||||
* block step sound
|
* @param frequency default 1.0f
|
||||||
* @param volume
|
|
||||||
* default 1.0f
|
|
||||||
* @param frequency
|
|
||||||
* default 1.0f
|
|
||||||
*/
|
*/
|
||||||
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
|
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
|
||||||
super(soundNameStep, volume, frequency);
|
super(soundNameStep, volume, frequency);
|
||||||
@@ -135,20 +134,17 @@ 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
|
* Creates a SoundType with manual names for step, break and place sounds. Sound names must be specified in the
|
||||||
|
* sounds.json
|
||||||
*
|
*
|
||||||
* @param soundNameBreak
|
* @param soundNameBreak block break sound
|
||||||
* block break sound
|
* @param soundNameStep block step sound
|
||||||
* @param soundNameStep
|
* @param soundNamePlace block place sound
|
||||||
* block step sound
|
* @param volume default 1.0f
|
||||||
* @param soundNamePlace
|
* @param frequency default 1.0f
|
||||||
* block place sound
|
|
||||||
* @param volume
|
|
||||||
* default 1.0f
|
|
||||||
* @param frequency
|
|
||||||
* default 1.0f
|
|
||||||
*/
|
*/
|
||||||
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume, float frequency) {
|
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume,
|
||||||
|
float frequency) {
|
||||||
super(soundNameStep, volume, frequency);
|
super(soundNameStep, volume, frequency);
|
||||||
this.soundNameStep = soundNameStep;
|
this.soundNameStep = soundNameStep;
|
||||||
this.soundNameBreak = soundNameBreak;
|
this.soundNameBreak = soundNameBreak;
|
||||||
@@ -157,26 +153,25 @@ public class BlockCarvable extends Block implements ICarvable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBreakSound() {
|
public String getBreakSound() {
|
||||||
if (soundNameBreak == null)
|
if (soundNameBreak == null) return Chisel.MOD_ID + ":dig." + this.soundName;
|
||||||
return Chisel.MOD_ID + ":dig." + this.soundName;
|
else return this.soundNameBreak;
|
||||||
else
|
|
||||||
return this.soundNameBreak;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStepResourcePath() {
|
public String getStepResourcePath() {
|
||||||
if (soundNameStep == null)
|
if (soundNameStep == null) return Chisel.MOD_ID + ":step." + this.soundName;
|
||||||
return Chisel.MOD_ID + ":step." + this.soundName;
|
else return this.soundNameStep;
|
||||||
else
|
|
||||||
return this.soundNameStep;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String func_150496_b() {
|
public String func_150496_b() {
|
||||||
if (soundNamePlace == null)
|
if (soundNamePlace == null) return getBreakSound();
|
||||||
return getBreakSound();
|
else return this.soundNamePlace;
|
||||||
else
|
|
||||||
return this.soundNamePlace;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||||
|
return Configurations.canMobsSpawnOnTheChiselBlocks;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package team.chisel.block;
|
package team.chisel.block;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.EnumCreatureType;
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.ICarvable;
|
||||||
|
|
||||||
public class BlockCarvableAntiBlock extends BlockCarvableColor implements ICarvable {
|
public class BlockCarvableAntiBlock extends BlockCarvableColor implements ICarvable {
|
||||||
|
|
||||||
public BlockCarvableAntiBlock() {
|
public BlockCarvableAntiBlock() {
|
||||||
|
|||||||
@@ -12,14 +12,15 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import team.chisel.block.tileentity.TileEntityCarvableBeacon;
|
|
||||||
import team.chisel.init.ChiselBlocks;
|
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
import com.cricketcraft.chisel.api.ICarvable;
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||||
|
|
||||||
|
import team.chisel.block.tileentity.TileEntityCarvableBeacon;
|
||||||
|
import team.chisel.init.ChiselBlocks;
|
||||||
|
|
||||||
public class BlockCarvableBeacon extends BlockBeacon implements ICarvable {
|
public class BlockCarvableBeacon extends BlockBeacon implements ICarvable {
|
||||||
|
|
||||||
public static int renderId;
|
public static int renderId;
|
||||||
@@ -40,7 +41,8 @@ public class BlockCarvableBeacon extends BlockBeacon implements ICarvable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par5, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par5, float hitX,
|
||||||
|
float hitY, float hitZ) {
|
||||||
if (world.isRemote) {
|
if (world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@@ -22,15 +23,13 @@ public class BlockCarvableBookshelf extends BlockCarvable {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
if (side < 2)
|
if (side < 2) return Blocks.planks.getBlockTextureFromSide(side);
|
||||||
return Blocks.planks.getBlockTextureFromSide(side);
|
|
||||||
return super.getIcon(side, metadata);
|
return super.getIcon(side, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
if (side < 2)
|
if (side < 2) return Blocks.planks.getBlockTextureFromSide(side);
|
||||||
return Blocks.planks.getBlockTextureFromSide(side);
|
|
||||||
return super.getIcon(world, x, y, z, side);
|
return super.getIcon(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,6 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
|
||||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
|
||||||
|
|
||||||
import net.minecraft.block.BlockCarpet;
|
import net.minecraft.block.BlockCarpet;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -15,6 +10,11 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.ICarvable;
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||||
|
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||||
|
|
||||||
public class BlockCarvableCarpet extends BlockCarpet implements ICarvable {
|
public class BlockCarvableCarpet extends BlockCarpet implements ICarvable {
|
||||||
|
|
||||||
public CarvableHelper carverHelper;
|
public CarvableHelper carverHelper;
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package team.chisel.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.util.MovementInput;
|
||||||
|
import net.minecraft.util.MovementInputFromOptions;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||||
|
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.config.Configurations;
|
||||||
|
|
||||||
|
public class BlockCarvableConcreteSlab extends BlockCarvableSlab {
|
||||||
|
|
||||||
|
public BlockCarvableConcreteSlab(BlockCarvable block) {
|
||||||
|
super(block);
|
||||||
|
top = new BlockCarvableConcreteSlab(this);
|
||||||
|
FMLCommonHandler.instance()
|
||||||
|
.bus()
|
||||||
|
.register(new EventHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constructor to get concrete top slabs to work
|
||||||
|
public BlockCarvableConcreteSlab(BlockCarvableSlab bottomBlock) {
|
||||||
|
super(bottomBlock);
|
||||||
|
FMLCommonHandler.instance()
|
||||||
|
.bus()
|
||||||
|
.register(new EventHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private static MovementInput manualInputCheck;
|
||||||
|
|
||||||
|
public class EventHandler {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void speedupPlayer(PlayerTickEvent event) {
|
||||||
|
if (event.phase == Phase.START && event.side.isClient()
|
||||||
|
&& event.player.onGround
|
||||||
|
&& event.player instanceof EntityPlayerSP) {
|
||||||
|
if (manualInputCheck == null) {
|
||||||
|
manualInputCheck = new MovementInputFromOptions(Minecraft.getMinecraft().gameSettings);
|
||||||
|
}
|
||||||
|
EntityPlayerSP player = (EntityPlayerSP) event.player;
|
||||||
|
Block below = player.worldObj.getBlock(
|
||||||
|
MathHelper.floor_double(player.posX),
|
||||||
|
MathHelper.floor_double(player.posY) - 2,
|
||||||
|
MathHelper.floor_double(player.posZ));
|
||||||
|
|
||||||
|
if (below == BlockCarvableConcreteSlab.this) {
|
||||||
|
manualInputCheck.updatePlayerMoveState();
|
||||||
|
if (manualInputCheck.moveForward != 0 || manualInputCheck.moveStrafe != 0) {
|
||||||
|
player.motionX *= Configurations.concreteVelocityMult + 0.05;
|
||||||
|
player.motionZ *= Configurations.concreteVelocityMult + 0.05;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package team.chisel.block;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.util.MovementInput;
|
||||||
|
import net.minecraft.util.MovementInputFromOptions;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.config.Configurations;
|
||||||
|
|
||||||
|
public class BlockCarvableConcreteStairs extends BlockCarvableStairs {
|
||||||
|
|
||||||
|
public BlockCarvableConcreteStairs(Block block, int meta, CarvableHelper helper) {
|
||||||
|
super(block, meta, helper);
|
||||||
|
|
||||||
|
FMLCommonHandler.instance()
|
||||||
|
.bus()
|
||||||
|
.register(new EventHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override super's getSubBlocks to allow concrete's 11 variants
|
||||||
|
// Stairs are added to the list in pairs, so odd-numbered variant counts create
|
||||||
|
// a block that shouldn't exist. This modification makes the block unreachable by normal
|
||||||
|
// means (NEI, creative menu), but still technically exists in-game
|
||||||
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
|
@Override
|
||||||
|
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||||
|
list.add(new ItemStack(block, 1, 0));
|
||||||
|
|
||||||
|
// If odd# of variations && meta for the current block == variation.size - 1, exit
|
||||||
|
// Second check checks if the current block is at the end of the variation list
|
||||||
|
if (carverHelper.infoList.size() % 2 == 1 && this.blockMeta == carverHelper.infoList.size() - 1) return;
|
||||||
|
list.add(new ItemStack(block, 1, 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private static MovementInput manualInputCheck;
|
||||||
|
|
||||||
|
public class EventHandler {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void speedupPlayer(TickEvent.PlayerTickEvent event) {
|
||||||
|
if (event.phase == TickEvent.Phase.START && event.side.isClient()
|
||||||
|
&& event.player.onGround
|
||||||
|
&& event.player instanceof EntityPlayerSP) {
|
||||||
|
if (manualInputCheck == null) {
|
||||||
|
manualInputCheck = new MovementInputFromOptions(Minecraft.getMinecraft().gameSettings);
|
||||||
|
}
|
||||||
|
EntityPlayerSP player = (EntityPlayerSP) event.player;
|
||||||
|
Block below = player.worldObj.getBlock(
|
||||||
|
MathHelper.floor_double(player.posX),
|
||||||
|
MathHelper.floor_double(player.posY) - 2,
|
||||||
|
MathHelper.floor_double(player.posZ));
|
||||||
|
|
||||||
|
if (below == BlockCarvableConcreteStairs.this) {
|
||||||
|
manualInputCheck.updatePlayerMoveState();
|
||||||
|
if (manualInputCheck.moveForward != 0 || manualInputCheck.moveStrafe != 0) {
|
||||||
|
player.motionX *= Configurations.concreteVelocityMult + 0.05;
|
||||||
|
player.motionZ *= Configurations.concreteVelocityMult + 0.05;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package team.chisel.block;
|
package team.chisel.block;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockGlass;
|
import net.minecraft.block.BlockGlass;
|
||||||
@@ -11,7 +13,6 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import team.chisel.ctmlib.CTM;
|
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
import com.cricketcraft.chisel.api.ICarvable;
|
||||||
@@ -21,6 +22,7 @@ import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
|||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.ctmlib.CTM;
|
||||||
|
|
||||||
public class BlockCarvableGlass extends BlockGlass implements ICarvable {
|
public class BlockCarvableGlass extends BlockGlass implements ICarvable {
|
||||||
|
|
||||||
@@ -62,7 +64,8 @@ public class BlockCarvableGlass extends BlockGlass implements ICarvable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
ForgeDirection face = ForgeDirection.getOrientation(side).getOpposite();
|
ForgeDirection face = ForgeDirection.getOrientation(side)
|
||||||
|
.getOpposite();
|
||||||
int meX = x + face.offsetX;
|
int meX = x + face.offsetX;
|
||||||
int meY = y + face.offsetY;
|
int meY = y + face.offsetY;
|
||||||
int meZ = z + face.offsetZ;
|
int meZ = z + face.offsetZ;
|
||||||
@@ -104,4 +107,9 @@ public class BlockCarvableGlass extends BlockGlass implements ICarvable {
|
|||||||
public int getRenderBlockPass() {
|
public int getRenderBlockPass() {
|
||||||
return isAlpha ? 1 : 0;
|
return isAlpha ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int quantityDropped(Random random) {
|
||||||
|
return Objects.equals(this.getUnlocalizedName(), "tile.chisel.technical2") ? 1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
package team.chisel.block;
|
package team.chisel.block;
|
||||||
|
|
||||||
import team.chisel.Chisel;
|
|
||||||
import team.chisel.client.render.SubmapManagerBase;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.Chisel;
|
||||||
|
import team.chisel.client.render.SubmapManagerBase;
|
||||||
|
|
||||||
public class BlockCarvableGlow extends BlockCarvableColor {
|
public class BlockCarvableGlow extends BlockCarvableColor {
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package team.chisel.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
public class BlockCarvableGlowie extends BlockCarvable {
|
||||||
|
|
||||||
|
public BlockCarvableGlowie(Material material) {
|
||||||
|
super(material);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,6 +33,11 @@ public class BlockCarvableGlowstone extends BlockCarvable {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDamageValue(World world, int x, int y, int z) {
|
||||||
|
return world.getBlockMetadata(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||||
Block glowstone = world.getBlock(x, y, z);
|
Block glowstone = world.getBlock(x, y, z);
|
||||||
|
|||||||
@@ -2,11 +2,6 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
|
||||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockIce;
|
import net.minecraft.block.BlockIce;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -18,6 +13,11 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.ICarvable;
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||||
|
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||||
|
|
||||||
public class BlockCarvableIce extends BlockIce implements ICarvable {
|
public class BlockCarvableIce extends BlockIce implements ICarvable {
|
||||||
|
|
||||||
public CarvableHelper carverHelper;
|
public CarvableHelper carverHelper;
|
||||||
@@ -56,10 +56,10 @@ public class BlockCarvableIce extends BlockIce implements ICarvable {
|
|||||||
par2EntityPlayer.addExhaustion(0.025F);
|
par2EntityPlayer.addExhaustion(0.025F);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) { ItemStack itemstack =
|
* if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) &&
|
||||||
* this.createStackedBlock(par6);
|
* EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) { ItemStack itemstack =
|
||||||
*
|
* this.createStackedBlock(par6); if(itemstack != null) { this.dropBlockAsItem(par1World, par3, par4, par5,
|
||||||
* if(itemstack != null) { this.dropBlockAsItem(par1World, par3, par4, par5, itemstack); } }
|
* itemstack); } }
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
|
|
||||||
import team.chisel.init.ChiselBlocks;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
|
||||||
|
import team.chisel.init.ChiselBlocks;
|
||||||
|
|
||||||
public class BlockCarvableIceStairs extends BlockCarvableStairs {
|
public class BlockCarvableIceStairs extends BlockCarvableStairs {
|
||||||
|
|
||||||
public BlockCarvableIceStairs(Block block, int meta, CarvableHelper helper) {
|
public BlockCarvableIceStairs(Block block, int meta, CarvableHelper helper) {
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ public class BlockCarvableLamp extends BlockCarvable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void checkPower(World world, int x, int y, int z) {
|
public void checkPower(World world, int x, int y, int z) {
|
||||||
if (world.isRemote)
|
if (world.isRemote) return;
|
||||||
return;
|
|
||||||
|
|
||||||
boolean isGettingPower = world.isBlockIndirectlyGettingPowered(x, y, z);
|
boolean isGettingPower = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
@@ -64,8 +63,8 @@ public class BlockCarvableLamp extends BlockCarvable {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @Override public void updateTick(World world, int x, int y, int z, Random rand){ if (world.isRemote) return;
|
* @Override public void updateTick(World world, int x, int y, int z, Random rand){ if (world.isRemote) return;
|
||||||
*
|
* if(powered && !world.isBlockIndirectlyGettingPowered(x, y, z)){ int meta=world.getBlockMetadata(x, y, z);
|
||||||
* if(powered && !world.isBlockIndirectlyGettingPowered(x, y, z)){ int meta=world.getBlockMetadata(x, y, z); world.setBlock(x, y, z, Block.redstoneLampIdle.blockID, meta, 2); } }
|
* world.setBlock(x, y, z, Block.redstoneLampIdle.blockID, meta, 2); } }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package team.chisel.block;
|
package team.chisel.block;
|
||||||
|
|
||||||
import team.chisel.Chisel;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.Chisel;
|
||||||
|
|
||||||
public class BlockCarvableLayered extends BlockCarvable {
|
public class BlockCarvableLayered extends BlockCarvable {
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,6 @@ package team.chisel.block;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
|
||||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -20,6 +15,11 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.ICarvable;
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||||
|
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||||
|
|
||||||
public class BlockCarvablePackedIce extends Block implements ICarvable {
|
public class BlockCarvablePackedIce extends Block implements ICarvable {
|
||||||
|
|
||||||
public CarvableHelper carverHelper;
|
public CarvableHelper carverHelper;
|
||||||
@@ -64,10 +64,10 @@ public class BlockCarvablePackedIce extends Block implements ICarvable {
|
|||||||
par2EntityPlayer.addExhaustion(0.025F);
|
par2EntityPlayer.addExhaustion(0.025F);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) { ItemStack itemstack =
|
* if(this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) &&
|
||||||
* this.createStackedBlock(par6);
|
* EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) { ItemStack itemstack =
|
||||||
*
|
* this.createStackedBlock(par6); if(itemstack != null) { this.dropBlockAsItem(par1World, par3, par4, par5,
|
||||||
* if(itemstack != null) { this.dropBlockAsItem(par1World, par3, par4, par5, itemstack); } }
|
* itemstack); } }
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
|
|
||||||
import team.chisel.init.ChiselBlocks;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
|
||||||
|
import team.chisel.init.ChiselBlocks;
|
||||||
|
|
||||||
public class BlockCarvablePackedIceStairs extends BlockCarvableStairs {
|
public class BlockCarvablePackedIceStairs extends BlockCarvableStairs {
|
||||||
|
|
||||||
public BlockCarvablePackedIceStairs(Block block, int meta, CarvableHelper helper) {
|
public BlockCarvablePackedIceStairs(Block block, int meta, CarvableHelper helper) {
|
||||||
|
|||||||
@@ -2,12 +2,6 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
|
||||||
|
|
||||||
import team.chisel.client.render.RendererCTMPane;
|
|
||||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
|
||||||
import net.minecraft.block.BlockPane;
|
import net.minecraft.block.BlockPane;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -15,8 +9,15 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||||
|
import com.cricketcraft.chisel.api.ICarvable;
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.client.render.RendererCTMPane;
|
||||||
|
|
||||||
public class BlockCarvablePane extends BlockPane implements ICarvable {
|
public class BlockCarvablePane extends BlockPane implements ICarvable {
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ public class BlockCarvablePowered extends BlockCarvable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube returns true, standard redstone propagation rules will apply instead and this will
|
* Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube
|
||||||
* not be called. Args: World, X, Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block.
|
* returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X,
|
||||||
|
* Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
package team.chisel.block;
|
package team.chisel.block;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
|
||||||
|
|
||||||
import team.chisel.Chisel;
|
|
||||||
import team.chisel.entity.EntityChiselSnowman;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockPumpkin;
|
import net.minecraft.block.BlockPumpkin;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -13,14 +7,14 @@ import net.minecraft.entity.monster.EntityIronGolem;
|
|||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.Chisel;
|
||||||
|
import team.chisel.entity.EntityChiselSnowman;
|
||||||
|
|
||||||
public class BlockCarvablePumpkin extends BlockPumpkin implements ICarvable {
|
public class BlockCarvablePumpkin extends BlockPumpkin {
|
||||||
|
|
||||||
public CarvableHelper carverHelper;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon top, face;
|
private IIcon top, face;
|
||||||
@@ -30,9 +24,7 @@ public class BlockCarvablePumpkin extends BlockPumpkin implements ICarvable {
|
|||||||
public BlockCarvablePumpkin(boolean isOn) {
|
public BlockCarvablePumpkin(boolean isOn) {
|
||||||
super(isOn);
|
super(isOn);
|
||||||
this.setStepSound(Block.soundTypeWood);
|
this.setStepSound(Block.soundTypeWood);
|
||||||
if (isOn)
|
if (isOn) setLightLevel(10.0F);
|
||||||
setLightLevel(10.0F);
|
|
||||||
carverHelper = new CarvableHelper(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -56,11 +48,21 @@ public class BlockCarvablePumpkin extends BlockPumpkin implements ICarvable {
|
|||||||
|
|
||||||
// Spawn some lovely particles
|
// Spawn some lovely particles
|
||||||
for (int c = 0; c < 120; ++c) {
|
for (int c = 0; c < 120; ++c) {
|
||||||
world.spawnParticle("snowshovel", x + world.rand.nextDouble(), y - 2 + world.rand.nextDouble() * 2.5D, z + world.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
|
world.spawnParticle(
|
||||||
|
"snowshovel",
|
||||||
|
x + world.rand.nextDouble(),
|
||||||
|
y - 2 + world.rand.nextDouble() * 2.5D,
|
||||||
|
z + world.rand.nextDouble(),
|
||||||
|
0.0D,
|
||||||
|
0.0D,
|
||||||
|
0.0D);
|
||||||
}
|
}
|
||||||
} else if (world.getBlock(x, y - 1, z) == Blocks.iron_block || world.getBlock(x, y - 2, z) == Blocks.iron_block) {
|
} else
|
||||||
boolean flag = world.getBlock(x - 1, y - 1, z) == Blocks.iron_block && world.getBlock(x + 1, y - 1, z) == Blocks.iron_block;
|
if (world.getBlock(x, y - 1, z) == Blocks.iron_block || world.getBlock(x, y - 2, z) == Blocks.iron_block) {
|
||||||
boolean flag1 = world.getBlock(x, y - 1, z - 1) == Blocks.iron_block && world.getBlock(x, y - 1, z + 1) == Blocks.iron_block;
|
boolean flag = world.getBlock(x - 1, y - 1, z) == Blocks.iron_block
|
||||||
|
&& world.getBlock(x + 1, y - 1, z) == Blocks.iron_block;
|
||||||
|
boolean flag1 = world.getBlock(x, y - 1, z - 1) == Blocks.iron_block
|
||||||
|
&& world.getBlock(x, y - 1, z + 1) == Blocks.iron_block;
|
||||||
|
|
||||||
if (flag || flag1) {
|
if (flag || flag1) {
|
||||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||||
@@ -98,7 +100,10 @@ public class BlockCarvablePumpkin extends BlockPumpkin implements ICarvable {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
return side == 1 ? top : (side == 0 ? top : (meta == 2 && side == 2 ? face : (meta == 3 && side == 5 ? face
|
return side == 1 ? top
|
||||||
|
: (side == 0 ? top
|
||||||
|
: (meta == 2 && side == 2 ? face
|
||||||
|
: (meta == 3 && side == 5 ? face
|
||||||
: (meta == 0 && side == 3 ? face : (meta == 1 && side == 4 ? face : this.blockIcon)))));
|
: (meta == 0 && side == 3 ? face : (meta == 1 && side == 4 ? face : this.blockIcon)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,16 +114,6 @@ public class BlockCarvablePumpkin extends BlockPumpkin implements ICarvable {
|
|||||||
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":pumpkin/pumpkin_side");
|
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":pumpkin/pumpkin_side");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
|
||||||
return carverHelper.getVariation(metadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IVariationInfo getManager(int meta) {
|
|
||||||
return carverHelper.getVariation(meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInformation(String textureLocation) {
|
public void setInformation(String textureLocation) {
|
||||||
this.faceLocation = textureLocation;
|
this.faceLocation = textureLocation;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,22 +2,25 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockSand;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
import com.cricketcraft.chisel.api.ICarvable;
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||||
|
|
||||||
import team.chisel.Chisel;
|
|
||||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockSand;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.Chisel;
|
||||||
|
import team.chisel.config.Configurations;
|
||||||
|
|
||||||
public class BlockCarvableSand extends BlockSand implements ICarvable {
|
public class BlockCarvableSand extends BlockSand implements ICarvable {
|
||||||
|
|
||||||
@@ -82,6 +85,11 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
|
|||||||
return carverHelper.getVariation(meta);
|
return carverHelper.getVariation(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||||
|
return Configurations.canMobsSpawnOnTheChiselBlocks;
|
||||||
|
}
|
||||||
|
|
||||||
public static class SoundType extends Block.SoundType {
|
public static class SoundType extends Block.SoundType {
|
||||||
|
|
||||||
public final String soundNameStep;
|
public final String soundNameStep;
|
||||||
@@ -89,14 +97,13 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
|
|||||||
public final String soundNamePlace;
|
public final String soundNamePlace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* @param soundName block of the sound. Will automatically be expanded to "mod:dig.soundName" and
|
||||||
* block of the sound. Will automatically be expanded to "mod:dig.soundName" and "mod:step.soundName" respectively)
|
* "mod:step.soundName" respectively)
|
||||||
* @param volume
|
* @param volume default 1.0f
|
||||||
* default 1.0f
|
* @param frequency default 1.0f
|
||||||
* @param frequency
|
|
||||||
* default 1.0f
|
|
||||||
*/
|
*/
|
||||||
public SoundType(String soundName, float volume, float frequency) {
|
public SoundType(String soundName, float volume, float frequency) {
|
||||||
super(soundName, volume, frequency);
|
super(soundName, volume, frequency);
|
||||||
@@ -106,16 +113,13 @@ 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
|
* Creates a SoundType with manual names for step and break sounds. Sound names must be specified in the
|
||||||
|
* sounds.json
|
||||||
*
|
*
|
||||||
* @param soundNameBreak
|
* @param soundNameBreak block break sound
|
||||||
* block break sound
|
* @param soundNameStep block step sound
|
||||||
* @param soundNameStep
|
* @param volume default 1.0f
|
||||||
* block step sound
|
* @param frequency default 1.0f
|
||||||
* @param volume
|
|
||||||
* default 1.0f
|
|
||||||
* @param frequency
|
|
||||||
* default 1.0f
|
|
||||||
*/
|
*/
|
||||||
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
|
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
|
||||||
super(soundNameStep, volume, frequency);
|
super(soundNameStep, volume, frequency);
|
||||||
@@ -125,20 +129,17 @@ 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
|
* Creates a SoundType with manual names for step, break and place sounds. Sound names must be specified in the
|
||||||
|
* sounds.json
|
||||||
*
|
*
|
||||||
* @param soundNameBreak
|
* @param soundNameBreak block break sound
|
||||||
* block break sound
|
* @param soundNameStep block step sound
|
||||||
* @param soundNameStep
|
* @param soundNamePlace block place sound
|
||||||
* block step sound
|
* @param volume default 1.0f
|
||||||
* @param soundNamePlace
|
* @param frequency default 1.0f
|
||||||
* block place sound
|
|
||||||
* @param volume
|
|
||||||
* default 1.0f
|
|
||||||
* @param frequency
|
|
||||||
* default 1.0f
|
|
||||||
*/
|
*/
|
||||||
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume, float frequency) {
|
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume,
|
||||||
|
float frequency) {
|
||||||
super(soundNameStep, volume, frequency);
|
super(soundNameStep, volume, frequency);
|
||||||
this.soundNameStep = soundNameStep;
|
this.soundNameStep = soundNameStep;
|
||||||
this.soundNameBreak = soundNameBreak;
|
this.soundNameBreak = soundNameBreak;
|
||||||
@@ -147,26 +148,20 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBreakSound() {
|
public String getBreakSound() {
|
||||||
if (soundNameBreak == null)
|
if (soundNameBreak == null) return Chisel.MOD_ID + ":dig." + this.soundName;
|
||||||
return Chisel.MOD_ID + ":dig." + this.soundName;
|
else return this.soundNameBreak;
|
||||||
else
|
|
||||||
return this.soundNameBreak;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStepResourcePath() {
|
public String getStepResourcePath() {
|
||||||
if (soundNameStep == null)
|
if (soundNameStep == null) return Chisel.MOD_ID + ":step." + this.soundName;
|
||||||
return Chisel.MOD_ID + ":step." + this.soundName;
|
else return this.soundNameStep;
|
||||||
else
|
|
||||||
return this.soundNameStep;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String func_150496_b() {
|
public String func_150496_b() {
|
||||||
if (soundNamePlace == null)
|
if (soundNamePlace == null) return getBreakSound();
|
||||||
return getBreakSound();
|
else return this.soundNamePlace;
|
||||||
else
|
|
||||||
return this.soundNamePlace;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package team.chisel.block;
|
package team.chisel.block;
|
||||||
|
|
||||||
|
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@@ -14,9 +16,9 @@ import net.minecraft.util.MovingObjectPosition;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
|
||||||
|
|
||||||
public class BlockCarvableSlab extends BlockCarvable {
|
public class BlockCarvableSlab extends BlockCarvable {
|
||||||
|
|
||||||
@@ -72,7 +74,8 @@ public class BlockCarvableSlab extends BlockCarvable {
|
|||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
@Override
|
@Override
|
||||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
|
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB,
|
||||||
|
List par6List, Entity par7Entity) {
|
||||||
setBlockBoundsBasedOnState(par1World, par2, par3, par4);
|
setBlockBoundsBasedOnState(par1World, par2, par3, par4);
|
||||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||||
}
|
}
|
||||||
@@ -112,23 +115,17 @@ public class BlockCarvableSlab extends BlockCarvable {
|
|||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||||
if (isBottom)
|
if (isBottom) super.getSubBlocks(block, tabs, list);
|
||||||
super.getSubBlocks(block, tabs, list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the block is a solid face on the given side, used by placement logic.
|
* Checks if the block is a solid face on the given side, used by placement logic.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world The current world
|
||||||
* The current world
|
* @param x X Position
|
||||||
* @param x
|
* @param y Y position
|
||||||
* X Position
|
* @param z Z position
|
||||||
* @param y
|
* @param side The side to check
|
||||||
* Y position
|
|
||||||
* @param z
|
|
||||||
* Z position
|
|
||||||
* @param side
|
|
||||||
* The side to check
|
|
||||||
* @return True if the block is solid on the specified side.
|
* @return True if the block is solid on the specified side.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,11 +2,6 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
|
||||||
|
|
||||||
import team.chisel.client.render.RendererStairs;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockStairs;
|
import net.minecraft.block.BlockStairs;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -19,6 +14,12 @@ import net.minecraft.util.MathHelper;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.ICarvable;
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||||
|
|
||||||
|
import team.chisel.client.render.RendererStairs;
|
||||||
|
|
||||||
public class BlockCarvableStairs extends BlockStairs implements ICarvable {
|
public class BlockCarvableStairs extends BlockStairs implements ICarvable {
|
||||||
|
|
||||||
CarvableHelper carverHelper;
|
CarvableHelper carverHelper;
|
||||||
@@ -39,13 +40,12 @@ public class BlockCarvableStairs extends BlockStairs implements ICarvable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int i) {
|
public int damageDropped(int i) {
|
||||||
return i / 8;
|
return i & 0x8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
if (blockMeta == 0)
|
if (blockMeta == 0) carverHelper.registerBlockIcons("Chisel", this, register);
|
||||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@@ -61,7 +61,8 @@ public class BlockCarvableStairs extends BlockStairs implements ICarvable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
|
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving,
|
||||||
|
ItemStack par6ItemStack) {
|
||||||
int meta = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
int meta = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||||
|
|
||||||
// 0->2 2->3 3->0 1->1
|
// 0->2 2->3 3->0 1->1
|
||||||
|
|||||||
@@ -2,29 +2,24 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
|
||||||
|
|
||||||
import team.chisel.Chisel;
|
|
||||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
|
||||||
import net.minecraft.block.BlockTorch;
|
import net.minecraft.block.BlockTorch;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.Chisel;
|
||||||
|
|
||||||
public class BlockCarvableTorch extends BlockTorch implements ICarvable {
|
public class BlockCarvableTorch extends BlockTorch {
|
||||||
|
|
||||||
public CarvableHelper carverHelper;
|
|
||||||
private String texLocation;
|
private String texLocation;
|
||||||
protected boolean emitsParticles = true;
|
protected boolean emitsParticles = true;
|
||||||
public int idx;
|
public int idx;
|
||||||
|
|
||||||
public BlockCarvableTorch(int idx, String tex) {
|
public BlockCarvableTorch(int idx, String tex) {
|
||||||
super();
|
super();
|
||||||
carverHelper = new CarvableHelper(this);
|
|
||||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||||
setLightLevel(0.9375F);
|
setLightLevel(0.9375F);
|
||||||
setBlockName("torch");
|
setBlockName("torch");
|
||||||
@@ -32,16 +27,6 @@ public class BlockCarvableTorch extends BlockTorch implements ICarvable {
|
|||||||
this.texLocation = tex;
|
this.texLocation = tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
|
||||||
return carverHelper.getVariation(metadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IVariationInfo getManager(int meta) {
|
|
||||||
return carverHelper.getVariation(meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister icon) {
|
public void registerBlockIcons(IIconRegister icon) {
|
||||||
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":torch/" + texLocation);
|
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":torch/" + texLocation);
|
||||||
@@ -54,7 +39,8 @@ public class BlockCarvableTorch extends BlockTorch implements ICarvable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) {
|
public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_,
|
||||||
|
Random p_149734_5_) {
|
||||||
if (emitsParticles) {
|
if (emitsParticles) {
|
||||||
int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_);
|
int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_);
|
||||||
double d0 = p_149734_2_ + 0.5F;
|
double d0 = p_149734_2_ + 0.5F;
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockWall;
|
import net.minecraft.block.BlockWall;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -11,6 +9,8 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
|
||||||
public class BlockCarvableWall extends BlockWall {
|
public class BlockCarvableWall extends BlockWall {
|
||||||
|
|
||||||
CarvableHelper carverHelper;
|
CarvableHelper carverHelper;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import team.chisel.config.Configurations;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
@@ -10,8 +9,10 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.config.Configurations;
|
||||||
|
|
||||||
public class BlockCloud extends BlockCarvable {
|
public class BlockCloud extends BlockCarvable {
|
||||||
|
|
||||||
|
|||||||
@@ -6,34 +6,44 @@ import net.minecraft.client.entity.EntityPlayerSP;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.MovementInput;
|
import net.minecraft.util.MovementInput;
|
||||||
import net.minecraft.util.MovementInputFromOptions;
|
import net.minecraft.util.MovementInputFromOptions;
|
||||||
import team.chisel.config.Configurations;
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||||
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.config.Configurations;
|
||||||
|
|
||||||
public class BlockConcrete extends BlockCarvable {
|
public class BlockConcrete extends BlockCarvable {
|
||||||
|
|
||||||
public BlockConcrete() {
|
public BlockConcrete() {
|
||||||
super();
|
super();
|
||||||
FMLCommonHandler.instance().bus().register(this);
|
FMLCommonHandler.instance()
|
||||||
|
.bus()
|
||||||
|
.register(new EventHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private static MovementInput manualInputCheck;
|
private static MovementInput manualInputCheck;
|
||||||
|
|
||||||
|
public class EventHandler {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void speedupPlayer(PlayerTickEvent event) {
|
public void speedupPlayer(PlayerTickEvent event) {
|
||||||
if (event.phase == Phase.START && event.side.isClient() && event.player.onGround && event.player instanceof EntityPlayerSP) {
|
if (event.phase == Phase.START && event.side.isClient()
|
||||||
|
&& event.player.onGround
|
||||||
|
&& event.player instanceof EntityPlayerSP) {
|
||||||
if (manualInputCheck == null) {
|
if (manualInputCheck == null) {
|
||||||
manualInputCheck = new MovementInputFromOptions(Minecraft.getMinecraft().gameSettings);
|
manualInputCheck = new MovementInputFromOptions(Minecraft.getMinecraft().gameSettings);
|
||||||
}
|
}
|
||||||
EntityPlayerSP player = (EntityPlayerSP) event.player;
|
EntityPlayerSP player = (EntityPlayerSP) event.player;
|
||||||
Block below = player.worldObj.getBlock(MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY) - 2, MathHelper.floor_double(player.posZ));
|
Block below = player.worldObj.getBlock(
|
||||||
if (below == this) {
|
MathHelper.floor_double(player.posX),
|
||||||
|
MathHelper.floor_double(player.posY) - 2,
|
||||||
|
MathHelper.floor_double(player.posZ));
|
||||||
|
if (below == BlockConcrete.this) {
|
||||||
manualInputCheck.updatePlayerMoveState();
|
manualInputCheck.updatePlayerMoveState();
|
||||||
if (manualInputCheck.moveForward != 0 || manualInputCheck.moveStrafe != 0) {
|
if (manualInputCheck.moveForward != 0 || manualInputCheck.moveStrafe != 0) {
|
||||||
player.motionX *= Configurations.concreteVelocityMult + 0.05;
|
player.motionX *= Configurations.concreteVelocityMult + 0.05;
|
||||||
@@ -42,4 +52,5 @@ public class BlockConcrete extends BlockCarvable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,14 +2,15 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import team.chisel.Chisel;
|
|
||||||
import team.chisel.client.GeneralChiselClient;
|
|
||||||
import team.chisel.utils.General;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import team.chisel.Chisel;
|
||||||
|
import team.chisel.client.GeneralChiselClient;
|
||||||
|
import team.chisel.utils.General;
|
||||||
|
|
||||||
public class BlockGrimstone extends BlockCarvable {
|
public class BlockGrimstone extends BlockCarvable {
|
||||||
|
|
||||||
public IIcon iconStar;
|
public IIcon iconStar;
|
||||||
@@ -20,8 +21,7 @@ public class BlockGrimstone extends BlockCarvable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||||
if (General.rand.nextInt(4) == 0 && world.isRemote)
|
if (General.rand.nextInt(4) == 0 && world.isRemote) GeneralChiselClient.spawnGrimstoneFX(world, this, x, y, z);
|
||||||
GeneralChiselClient.spawnGrimstoneFX(world, this, x, y, z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import team.chisel.client.GeneralChiselClient;
|
|
||||||
import team.chisel.utils.General;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import team.chisel.client.GeneralChiselClient;
|
||||||
|
import team.chisel.utils.General;
|
||||||
|
|
||||||
public class BlockHolystone extends BlockCarvable {
|
public class BlockHolystone extends BlockCarvable {
|
||||||
|
|
||||||
public IIcon iconStar;
|
public IIcon iconStar;
|
||||||
@@ -21,8 +22,7 @@ public class BlockHolystone extends BlockCarvable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||||
if (General.rand.nextInt(4) == 0 && world.isRemote)
|
if (General.rand.nextInt(4) == 0 && world.isRemote) GeneralChiselClient.spawnHolystoneFX(world, this, x, y, z);
|
||||||
GeneralChiselClient.spawnHolystoneFX(world, this, x, y, z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import team.chisel.client.GeneralChiselClient;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import team.chisel.client.GeneralChiselClient;
|
||||||
|
|
||||||
public class BlockLavastone extends BlockMultiLayer {
|
public class BlockLavastone extends BlockMultiLayer {
|
||||||
|
|
||||||
public BlockLavastone(Material mat, String baseIcon) {
|
public BlockLavastone(Material mat, String baseIcon) {
|
||||||
@@ -15,8 +16,7 @@ public class BlockLavastone extends BlockMultiLayer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||||
if (random.nextInt(8) == 0 && world.isRemote)
|
if (random.nextInt(8) == 0 && world.isRemote) GeneralChiselClient.spawnLavastoneFX(world, this, x, y, z);
|
||||||
GeneralChiselClient.spawnLavastoneFX(world, this, x, y, z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,18 +2,21 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.ICarvable;
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||||
|
|
||||||
|
import team.chisel.config.Configurations;
|
||||||
|
|
||||||
public class BlockMultiLayer extends BlockMultiLayerBase implements ICarvable {
|
public class BlockMultiLayer extends BlockMultiLayerBase implements ICarvable {
|
||||||
|
|
||||||
public CarvableHelper carverHelper;
|
public CarvableHelper carverHelper;
|
||||||
@@ -62,4 +65,9 @@ public class BlockMultiLayer extends BlockMultiLayerBase implements ICarvable {
|
|||||||
public IVariationInfo getManager(int meta) {
|
public IVariationInfo getManager(int meta) {
|
||||||
return carverHelper.getVariation(meta);
|
return carverHelper.getVariation(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||||
|
return Configurations.canMobsSpawnOnTheChiselBlocks;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package team.chisel.block;
|
package team.chisel.block;
|
||||||
|
|
||||||
import team.chisel.client.render.RendererMultiLayer;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraftforge.client.ForgeHooksClient;
|
|
||||||
|
import team.chisel.client.render.RendererMultiLayer;
|
||||||
|
|
||||||
public abstract class BlockMultiLayerBase extends Block {
|
public abstract class BlockMultiLayerBase extends Block {
|
||||||
|
|
||||||
@@ -42,14 +42,12 @@ public abstract class BlockMultiLayerBase extends Block {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRenderInPass(int pass) {
|
public boolean canRenderInPass(int pass) {
|
||||||
ForgeHooksClient.setRenderPass(pass);
|
|
||||||
return pass == 1 || pass == 0;
|
return pass == 1 || pass == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
if (iconFile != null)
|
if (iconFile != null) icon = register.registerIcon(iconFile);
|
||||||
icon = register.registerIcon(iconFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,12 +2,6 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ICarvable;
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
|
||||||
|
|
||||||
import team.chisel.Chisel;
|
|
||||||
import team.chisel.block.tileentity.TileEntityPresent;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -24,8 +18,15 @@ import net.minecraft.util.MovingObjectPosition;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.ICarvable;
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.Chisel;
|
||||||
|
import team.chisel.block.tileentity.TileEntityPresent;
|
||||||
|
|
||||||
public class BlockPresent extends Block implements ICarvable {
|
public class BlockPresent extends Block implements ICarvable {
|
||||||
|
|
||||||
@@ -107,7 +108,8 @@ public class BlockPresent extends Block implements ICarvable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitX, float hitY, float hitZ, float p_149727_9_) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitX, float hitY,
|
||||||
|
float hitZ, float p_149727_9_) {
|
||||||
if (!world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) {
|
if (!world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(Chisel.instance, 2, world, x, y, z);
|
player.openGui(Chisel.instance, 2, world, x, y, z);
|
||||||
@@ -121,16 +123,14 @@ public class BlockPresent extends Block implements ICarvable {
|
|||||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityPresent)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityPresent)
|
||||||
return getBoundingBox((TileEntityPresent) world.getTileEntity(x, y, z));
|
return getBoundingBox((TileEntityPresent) world.getTileEntity(x, y, z));
|
||||||
else
|
else return null;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityPresent)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityPresent)
|
||||||
return getBoundingBox((TileEntityPresent) world.getTileEntity(x, y, z));
|
return getBoundingBox((TileEntityPresent) world.getTileEntity(x, y, z));
|
||||||
else
|
else return null;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxisAlignedBB getBoundingBox(TileEntityPresent me) {
|
public AxisAlignedBB getBoundingBox(TileEntityPresent me) {
|
||||||
@@ -141,10 +141,23 @@ public class BlockPresent extends Block implements ICarvable {
|
|||||||
if (me.isConnected()) {
|
if (me.isConnected()) {
|
||||||
ForgeDirection dir = me.getConnectionDir();
|
ForgeDirection dir = me.getConnectionDir();
|
||||||
// warning: magic below! Do not change this conditional
|
// warning: magic below! Do not change this conditional
|
||||||
if (dir == ForgeDirection.EAST || (me.isParent() && dir == ForgeDirection.SOUTH) || (!me.isParent() && dir == ForgeDirection.SOUTH)) {
|
if (dir == ForgeDirection.EAST || (me.isParent() && dir == ForgeDirection.SOUTH)
|
||||||
return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX + dir.offsetX, y + maxY, z + maxZ + dir.offsetZ);
|
|| (!me.isParent() && dir == ForgeDirection.SOUTH)) {
|
||||||
|
return AxisAlignedBB.getBoundingBox(
|
||||||
|
x + minX,
|
||||||
|
y + minY,
|
||||||
|
z + minZ,
|
||||||
|
x + maxX + dir.offsetX,
|
||||||
|
y + maxY,
|
||||||
|
z + maxZ + dir.offsetZ);
|
||||||
} else {
|
} else {
|
||||||
return AxisAlignedBB.getBoundingBox(x + dir.offsetX + minX, y + minY, z + dir.offsetZ + minZ, x + maxX, y + maxY, z + maxZ);
|
return AxisAlignedBB.getBoundingBox(
|
||||||
|
x + dir.offsetX + minX,
|
||||||
|
y + minY,
|
||||||
|
z + dir.offsetZ + minZ,
|
||||||
|
x + maxX,
|
||||||
|
y + maxY,
|
||||||
|
z + maxZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX, y + maxY, z + maxZ);
|
return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX, y + maxY, z + maxZ);
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package team.chisel.block;
|
package team.chisel.block;
|
||||||
|
|
||||||
import team.chisel.Chisel;
|
|
||||||
import team.chisel.config.Configurations;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -10,14 +8,17 @@ import net.minecraft.util.AxisAlignedBB;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.Chisel;
|
||||||
|
import team.chisel.config.Configurations;
|
||||||
|
|
||||||
public class BlockRoadLine extends BlockCarvable {
|
public class BlockRoadLine extends BlockCarvable {
|
||||||
|
|
||||||
public IIcon aloneIcon[] = new IIcon[4];
|
public IIcon aloneIcon[] = new IIcon[5];
|
||||||
public IIcon halfLineIcon[] = new IIcon[4];
|
public IIcon halfLineIcon[] = new IIcon[5];
|
||||||
public IIcon fullLineIcon[] = new IIcon[4];
|
public IIcon fullLineIcon[] = new IIcon[5];
|
||||||
|
|
||||||
public BlockRoadLine() {
|
public BlockRoadLine() {
|
||||||
super(Material.circuits);
|
super(Material.circuits);
|
||||||
@@ -51,16 +52,17 @@ public class BlockRoadLine extends BlockCarvable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
|
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
|
||||||
return World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) || par1World.getBlock(par2, par3 - 1, par4).equals(Blocks.glowstone);
|
return World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4)
|
||||||
|
|| par1World.getBlock(par2, par3 - 1, par4)
|
||||||
|
.equals(Blocks.glowstone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block block) {
|
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block block) {
|
||||||
if (par1World.isRemote)
|
if (par1World.isRemote) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) {
|
if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) {
|
||||||
this.dropBlockAsItem(par1World, par2, par3, par4, 0, 0);
|
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
|
||||||
par1World.setBlockToAir(par2, par3, par4);
|
par1World.setBlockToAir(par2, par3, par4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,8 +72,8 @@ public class BlockRoadLine extends BlockCarvable {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister reg) {
|
public void registerBlockIcons(IIconRegister reg) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
String[] texNames = { "white", "yellow", "double-white", "double-yellow" };
|
String[] texNames = { "white", "yellow", "double-white", "double-yellow", "warning" };
|
||||||
aloneIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-center");
|
aloneIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-center");
|
||||||
halfLineIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-side");
|
halfLineIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-side");
|
||||||
fullLineIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-long");
|
fullLineIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-long");
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import team.chisel.client.render.RendererSnakeStone;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -14,6 +13,8 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import team.chisel.client.render.RendererSnakeStone;
|
||||||
|
|
||||||
public class BlockSnakestone extends Block {
|
public class BlockSnakestone extends Block {
|
||||||
|
|
||||||
static final int SEC_HEAD = 0;
|
static final int SEC_HEAD = 0;
|
||||||
@@ -69,11 +70,9 @@ public class BlockSnakestone extends Block {
|
|||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
if (meta > 3)
|
if (meta > 3) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (rotateHead(world, x, y, z) != -1)
|
if (rotateHead(world, x, y, z) != -1) return;
|
||||||
return;
|
|
||||||
|
|
||||||
int rot = rotRemap[(MathHelper.floor_double(entity.rotationYaw * 4.0 / 360.0 + 0.5)) & 3];
|
int rot = rotRemap[(MathHelper.floor_double(entity.rotationYaw * 4.0 / 360.0 + 0.5)) & 3];
|
||||||
|
|
||||||
@@ -82,19 +81,15 @@ public class BlockSnakestone extends Block {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hx, float hy, float hz, int meta) {
|
public int onBlockPlaced(World world, int x, int y, int z, int side, float hx, float hy, float hz, int meta) {
|
||||||
if (meta <= 3)
|
if (meta <= 3) return meta;
|
||||||
return meta;
|
|
||||||
|
|
||||||
if (rotateBodyPart(world, x, y, z)) {
|
if (rotateBodyPart(world, x, y, z)) {
|
||||||
return world.getBlockMetadata(x, y, z);
|
return world.getBlockMetadata(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (side == 0 || side == 1)
|
if (side == 0 || side == 1) meta = 14;
|
||||||
meta = 14;
|
if (side == 2 || side == 3) meta = 13;
|
||||||
if (side == 2 || side == 3)
|
if (side == 4 || side == 5) meta = 12;
|
||||||
meta = 13;
|
|
||||||
if (side == 4 || side == 5)
|
|
||||||
meta = 12;
|
|
||||||
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||||
|
|
||||||
@@ -139,8 +134,8 @@ public class BlockSnakestone extends Block {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!world.getBlock(x, y, z).equals(this))
|
if (!world.getBlock(x, y, z)
|
||||||
continue;
|
.equals(this)) continue;
|
||||||
boolean match = false;
|
boolean match = false;
|
||||||
|
|
||||||
int px1 = x, px2 = x;
|
int px1 = x, px2 = x;
|
||||||
@@ -149,10 +144,8 @@ public class BlockSnakestone extends Block {
|
|||||||
|
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
if ((meta & 0xc) == 4 || (meta & 0xc) == 8) {
|
if ((meta & 0xc) == 4 || (meta & 0xc) == 8) {
|
||||||
if ((meta & 4) == 4)
|
if ((meta & 4) == 4) py1--;
|
||||||
py1--;
|
else py1++;
|
||||||
else
|
|
||||||
py1++;
|
|
||||||
|
|
||||||
switch (meta & 3) {
|
switch (meta & 3) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -187,22 +180,17 @@ public class BlockSnakestone extends Block {
|
|||||||
Block b1 = world.getBlock(px1, py1, pz1);
|
Block b1 = world.getBlock(px1, py1, pz1);
|
||||||
Block b2 = world.getBlock(px2, py2, pz2);
|
Block b2 = world.getBlock(px2, py2, pz2);
|
||||||
|
|
||||||
if (b1 != this || b2 != this)
|
if (b1 != this || b2 != this) match = true;
|
||||||
match = true;
|
|
||||||
|
|
||||||
if (ox == px1 && oy == py1 && oz == pz1)
|
if (ox == px1 && oy == py1 && oz == pz1) match = true;
|
||||||
match = true;
|
|
||||||
|
|
||||||
if (ox == px2 && oy == py2 && oz == pz2)
|
if (ox == px2 && oy == py2 && oz == pz2) match = true;
|
||||||
match = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match)
|
if (match) res[index++] = direction;
|
||||||
res[index++] = direction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index != 5)
|
if (index != 5) res[index] = -1;
|
||||||
res[index] = -1;
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -211,10 +199,8 @@ public class BlockSnakestone extends Block {
|
|||||||
int[] con = getConnections(world, x, y, z);
|
int[] con = getConnections(world, x, y, z);
|
||||||
int blockMeta = world.getBlockMetadata(x, y, z);
|
int blockMeta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
if (con[1] == -1)
|
if (con[1] == -1) return false;
|
||||||
return false;
|
if (con[2] != -1) return false;
|
||||||
if (con[2] != -1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int meta = 15;
|
int meta = 15;
|
||||||
|
|
||||||
@@ -230,8 +216,7 @@ public class BlockSnakestone extends Block {
|
|||||||
meta = SEC_UP | con[0];
|
meta = SEC_UP | con[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockMeta != meta)
|
if (blockMeta != meta) world.setBlockMetadataWithNotify(x, y, z, meta, 3);
|
||||||
world.setBlockMetadataWithNotify(x, y, z, meta, 3);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -239,8 +224,7 @@ public class BlockSnakestone extends Block {
|
|||||||
public int rotateHead(World world, int x, int y, int z) {
|
public int rotateHead(World world, int x, int y, int z) {
|
||||||
int[] con = getConnections(world, x, y, z);
|
int[] con = getConnections(world, x, y, z);
|
||||||
|
|
||||||
if (con[1] >= 0 && con[1] < 4)
|
if (con[1] >= 0 && con[1] < 4) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
int meta = -1;
|
int meta = -1;
|
||||||
switch (con[0]) {
|
switch (con[0]) {
|
||||||
@@ -258,8 +242,7 @@ public class BlockSnakestone extends Block {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meta == -1)
|
if (meta == -1) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
world.setBlock(x, y, z, this, meta, 3);
|
world.setBlock(x, y, z, this, meta, 3);
|
||||||
return meta;
|
return meta;
|
||||||
@@ -268,17 +251,23 @@ public class BlockSnakestone extends Block {
|
|||||||
public boolean connectedTo(World par1World, int x, int y, int z, int direction) {
|
public boolean connectedTo(World par1World, int x, int y, int z, int direction) {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case 0:
|
case 0:
|
||||||
return par1World.getBlock(x, y, z - 1).equals(this);
|
return par1World.getBlock(x, y, z - 1)
|
||||||
|
.equals(this);
|
||||||
case 1:
|
case 1:
|
||||||
return par1World.getBlock(x, y, z + 1).equals(this);
|
return par1World.getBlock(x, y, z + 1)
|
||||||
|
.equals(this);
|
||||||
case 2:
|
case 2:
|
||||||
return par1World.getBlock(x - 1, y, z).equals(this);
|
return par1World.getBlock(x - 1, y, z)
|
||||||
|
.equals(this);
|
||||||
case 3:
|
case 3:
|
||||||
return par1World.getBlock(x + 1, y, z).equals(this);
|
return par1World.getBlock(x + 1, y, z)
|
||||||
|
.equals(this);
|
||||||
case 4:
|
case 4:
|
||||||
return par1World.getBlock(x, y - 1, z).equals(this);
|
return par1World.getBlock(x, y - 1, z)
|
||||||
|
.equals(this);
|
||||||
case 5:
|
case 5:
|
||||||
return par1World.getBlock(x, y + 1, z).equals(this);
|
return par1World.getBlock(x, y + 1, z)
|
||||||
|
.equals(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import team.chisel.client.GeneralChiselClient;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import team.chisel.client.GeneralChiselClient;
|
||||||
|
|
||||||
public class BlockSnakestoneObsidian extends BlockSnakestone {
|
public class BlockSnakestoneObsidian extends BlockSnakestone {
|
||||||
|
|
||||||
public static IIcon[] particles = new IIcon[8];
|
public static IIcon[] particles = new IIcon[8];
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ package team.chisel.block;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import team.chisel.carving.Carving;
|
|
||||||
import team.chisel.item.ItemCarvable;
|
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.ChiselTabs;
|
import com.cricketcraft.chisel.api.ChiselTabs;
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||||
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import team.chisel.carving.Carving;
|
||||||
|
import team.chisel.item.ItemCarvable;
|
||||||
|
|
||||||
public class CarvableStairsMaker {
|
public class CarvableStairsMaker {
|
||||||
|
|
||||||
@@ -28,14 +28,22 @@ public class CarvableStairsMaker {
|
|||||||
public void create(IStairsCreator creator, String name, Block[] blocks) {
|
public void create(IStairsCreator creator, String name, Block[] blocks) {
|
||||||
for (int i = 0; i < blocks.length; i++) {
|
for (int i = 0; i < blocks.length; i++) {
|
||||||
String n = name + "." + i;
|
String n = name + "." + i;
|
||||||
blocks[i] = creator == null ? new BlockCarvableStairs(blockBase, i * 2, carverHelper) : creator.create(blockBase, i * 2, carverHelper);
|
blocks[i] = creator == null ? new BlockCarvableStairs(blockBase, i * 2, carverHelper)
|
||||||
|
: creator.create(blockBase, i * 2, carverHelper);
|
||||||
|
|
||||||
blocks[i].setBlockName("chisel." + n).setCreativeTab(ChiselTabs.tabStairChiselBlocks);
|
blocks[i].setBlockName("chisel." + n)
|
||||||
|
.setCreativeTab(ChiselTabs.tabStairChiselBlocks);
|
||||||
GameRegistry.registerBlock(blocks[i], ItemCarvable.class, n);
|
GameRegistry.registerBlock(blocks[i], ItemCarvable.class, n);
|
||||||
|
|
||||||
for (int meta = 0; meta < 2 && i * 2 + meta < carverHelper.infoList.size(); meta++) {
|
for (int meta = 0; meta < 2 && i * 2 + meta < carverHelper.infoList.size(); meta++) {
|
||||||
Carving.chisel.addVariation(name, CarvingUtils.getDefaultVariationFor(blocks[i], meta * 8, i));
|
Carving.chisel.addVariation(name, CarvingUtils.getDefaultVariationFor(blocks[i], meta * 8, i));
|
||||||
GameRegistry.addRecipe(new ItemStack(blocks[i], 4, meta * 8), "* ", "** ", "***", '*', new ItemStack(blockBase, 1, i * 2 + meta));
|
GameRegistry.addRecipe(
|
||||||
|
new ItemStack(blocks[i], 4, meta * 8),
|
||||||
|
"* ",
|
||||||
|
"** ",
|
||||||
|
"***",
|
||||||
|
'*',
|
||||||
|
new ItemStack(blockBase, 1, i * 2 + meta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package team.chisel.block;
|
package team.chisel.block;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||||
|
|
||||||
public interface IStairsCreator {
|
public interface IStairsCreator {
|
||||||
|
|
||||||
public BlockCarvableStairs create(Block block, int meta, CarvableHelper helper);
|
public BlockCarvableStairs create(Block block, int meta, CarvableHelper helper);
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ public interface IDoubleChest {
|
|||||||
int getTrueSizeInventory();
|
int getTrueSizeInventory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param slot
|
* @param slot The true slot index.
|
||||||
* The true slot index.
|
|
||||||
* @return The actual stack in this chest's slot. Does not account for the connection.
|
* @return The actual stack in this chest's slot. Does not account for the connection.
|
||||||
*/
|
*/
|
||||||
ItemStack getTrueStackInSlot(int slot);
|
ItemStack getTrueStackInSlot(int slot);
|
||||||
@@ -19,10 +18,8 @@ public interface IDoubleChest {
|
|||||||
/**
|
/**
|
||||||
* Puts a stack in this chest's real slot at the given true index.
|
* Puts a stack in this chest's real slot at the given true index.
|
||||||
*
|
*
|
||||||
* @param slot
|
* @param slot The true slot index.
|
||||||
* The true slot index.
|
* @param stack The ItemStack to place in the slot.
|
||||||
* @param stack
|
|
||||||
* The ItemStack to place in the slot.
|
|
||||||
*/
|
*/
|
||||||
void putStackInTrueSlot(int slot, ItemStack stack);
|
void putStackInTrueSlot(int slot, ItemStack stack);
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package team.chisel.block.tileentity;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -14,6 +13,11 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.IChiselItem;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import team.chisel.Features;
|
import team.chisel.Features;
|
||||||
import team.chisel.carving.Carving;
|
import team.chisel.carving.Carving;
|
||||||
import team.chisel.client.GeneralChiselClient;
|
import team.chisel.client.GeneralChiselClient;
|
||||||
@@ -23,30 +27,32 @@ import team.chisel.network.message.MessageAutoChisel;
|
|||||||
import team.chisel.network.message.MessageSlotUpdate;
|
import team.chisel.network.message.MessageSlotUpdate;
|
||||||
import team.chisel.utils.General;
|
import team.chisel.utils.General;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.IChiselItem;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class TileEntityAutoChisel extends TileEntity implements ISidedInventory {
|
public class TileEntityAutoChisel extends TileEntity implements ISidedInventory {
|
||||||
|
|
||||||
public enum Upgrade {
|
public enum Upgrade {
|
||||||
|
|
||||||
SPEED,
|
SPEED,
|
||||||
AUTOMATION,
|
AUTOMATION,
|
||||||
STACK,
|
STACK,
|
||||||
REVERSION;
|
REVERSION;
|
||||||
|
|
||||||
|
public static final Upgrade[] VALUES = values();
|
||||||
|
|
||||||
public String getUnlocalizedName() {
|
public String getUnlocalizedName() {
|
||||||
if (Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
if (Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
||||||
return "item.upgrade_" + this.name().toLowerCase();
|
return "item.upgrade_" + this.name()
|
||||||
|
.toLowerCase();
|
||||||
}
|
}
|
||||||
return "chisel.autochisel.upgrade.disabled";
|
return "chisel.autochisel.upgrade.disabled";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocalizedName() {
|
public String getLocalizedName() {
|
||||||
String ret = StatCollector.translateToLocal("autochisel.slot." + this.name().toLowerCase() + ".tooltip");
|
String ret = StatCollector.translateToLocal(
|
||||||
|
"autochisel.slot." + this.name()
|
||||||
|
.toLowerCase() + ".tooltip");
|
||||||
if (!Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
if (!Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
||||||
ret = EnumChatFormatting.RED.toString().concat(ret);
|
ret = EnumChatFormatting.RED.toString()
|
||||||
|
.concat(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -57,7 +63,6 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
|||||||
|
|
||||||
private int progress = 0;
|
private int progress = 0;
|
||||||
|
|
||||||
private static EntityItem ghostItem;
|
|
||||||
boolean equal = false;
|
boolean equal = false;
|
||||||
private ItemStack[] inventory = new ItemStack[8];
|
private ItemStack[] inventory = new ItemStack[8];
|
||||||
private String name = "autoChisel";
|
private String name = "autoChisel";
|
||||||
@@ -91,8 +96,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
|||||||
return is;
|
return is;
|
||||||
} else {
|
} else {
|
||||||
is = inventory[slot].splitStack(size);
|
is = inventory[slot].splitStack(size);
|
||||||
if (inventory[slot].stackSize == 0)
|
if (inventory[slot].stackSize == 0) inventory[slot] = null;
|
||||||
inventory[slot] = null;
|
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -225,28 +229,40 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((IChiselItem) inventory[CHISEL].getItem()).canChisel(worldObj, inventory[CHISEL], General.getVariation(getTarget()));
|
return ((IChiselItem) inventory[CHISEL].getItem())
|
||||||
|
.canChisel(worldObj, inventory[CHISEL], General.getVariation(getTarget()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasChisel() {
|
private boolean hasChisel() {
|
||||||
return inventory[CHISEL] != null && inventory[CHISEL].getItem() instanceof IChiselItem && inventory[CHISEL].stackSize >= 1;
|
return inventory[CHISEL] != null && inventory[CHISEL].getItem() instanceof IChiselItem
|
||||||
|
&& inventory[CHISEL].stackSize >= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Calls IChiselItem#onChisel() and sends the chisel packet for sound/animation */
|
/** Calls IChiselItem#onChisel() and sends the chisel packet for sound/animation */
|
||||||
private void chiselItem(int chiseled, ItemStack target) {
|
private void chiselItem(int chiseled, ItemStack target) {
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
boolean breakChisel = false;
|
boolean breakChisel = false;
|
||||||
if (((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, inventory[CHISEL], General.getVariation(target))) {
|
if (((IChiselItem) inventory[CHISEL].getItem())
|
||||||
|
.onChisel(worldObj, inventory[CHISEL], General.getVariation(target))) {
|
||||||
inventory[CHISEL].setItemDamage(inventory[CHISEL].getItemDamage() + 1);
|
inventory[CHISEL].setItemDamage(inventory[CHISEL].getItemDamage() + 1);
|
||||||
if (inventory[CHISEL].getItemDamage() >= inventory[CHISEL].getMaxDamage()) {
|
if (inventory[CHISEL].getItemDamage() >= inventory[CHISEL].getMaxDamage()) {
|
||||||
setInventorySlotContents(CHISEL, null);
|
setInventorySlotContents(CHISEL, null);
|
||||||
breakChisel = true;
|
breakChisel = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(this, chiseled, true, breakChisel), worldObj.provider.dimensionId);
|
PacketHandler.INSTANCE.sendToDimension(
|
||||||
|
new MessageAutoChisel(this, chiseled, true, breakChisel),
|
||||||
|
worldObj.provider.dimensionId);
|
||||||
} else {
|
} else {
|
||||||
if (breakChisel) {
|
if (breakChisel) {
|
||||||
worldObj.playSound(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.break", 0.8F, 0.8F + worldObj.rand.nextFloat() * 0.4F, false);
|
worldObj.playSound(
|
||||||
|
xCoord + 0.5,
|
||||||
|
yCoord + 0.5,
|
||||||
|
zCoord + 0.5,
|
||||||
|
"random.break",
|
||||||
|
0.8F,
|
||||||
|
0.8F + worldObj.rand.nextFloat() * 0.4F,
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
GeneralChiselClient.spawnAutoChiselFX(this, lastBase != null ? lastBase : inventory[BASE]);
|
GeneralChiselClient.spawnAutoChiselFX(this, lastBase != null ? lastBase : inventory[BASE]);
|
||||||
chiseling = false;
|
chiseling = false;
|
||||||
@@ -296,8 +312,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
|||||||
ItemStack is = inventory[slot];
|
ItemStack is = inventory[slot];
|
||||||
inventory[slot] = null;
|
inventory[slot] = null;
|
||||||
return is;
|
return is;
|
||||||
} else
|
} else return null;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -318,7 +333,8 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void slotChanged(int slot) {
|
private void slotChanged(int slot) {
|
||||||
PacketHandler.INSTANCE.sendToDimension(new MessageSlotUpdate(this, slot, inventory[slot]), worldObj.provider.dimensionId);
|
PacketHandler.INSTANCE
|
||||||
|
.sendToDimension(new MessageSlotUpdate(this, slot, inventory[slot]), worldObj.provider.dimensionId);
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,13 +372,15 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
|||||||
switch (slot) {
|
switch (slot) {
|
||||||
case BASE:
|
case BASE:
|
||||||
case TARGET:
|
case TARGET:
|
||||||
return !Carving.chisel.getItemsForChiseling(itemStack).isEmpty();
|
return !Carving.chisel.getItemsForChiseling(itemStack)
|
||||||
|
.isEmpty();
|
||||||
case OUTPUT:
|
case OUTPUT:
|
||||||
return false;
|
return false;
|
||||||
case CHISEL:
|
case CHISEL:
|
||||||
return itemStack.getItem() instanceof IChiselItem;
|
return itemStack.getItem() instanceof IChiselItem;
|
||||||
default:
|
default:
|
||||||
return Features.AUTO_CHISEL_UPGRADES.enabled() && itemStack.getItem() == ChiselItems.upgrade && Upgrade.values()[slot - MIN_UPGRADE].ordinal() == itemStack.getItemDamage();
|
return Features.AUTO_CHISEL_UPGRADES.enabled() && itemStack.getItem() == ChiselItems.upgrade
|
||||||
|
&& Upgrade.VALUES[slot - MIN_UPGRADE].ordinal() == itemStack.getItemDamage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,27 +405,15 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public EntityItem getItemForRendering(int slot) {
|
public ItemStack getItemForRendering(int slot) {
|
||||||
if (ghostItem == null) {
|
|
||||||
ghostItem = new EntityItem(worldObj);
|
|
||||||
ghostItem.hoverStart = 0.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (slot == BASE && lastBase != null) {
|
if (slot == BASE && lastBase != null) {
|
||||||
ghostItem.setEntityItemStack(lastBase.copy());
|
return lastBase.copy();
|
||||||
return ghostItem;
|
|
||||||
} else if (slot == TARGET) {
|
} else if (slot == TARGET) {
|
||||||
ItemStack target = getTarget();
|
return getTarget();
|
||||||
if (target != null) {
|
|
||||||
ghostItem.setEntityItemStack(target);
|
|
||||||
return ghostItem;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
} else if (inventory[slot] == null) {
|
} else if (inventory[slot] == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
ghostItem.setEntityItemStack(inventory[slot].copy());
|
return inventory[slot].copy();
|
||||||
return ghostItem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,7 +453,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
|||||||
String unloc = name == null ? null : String.format(base, name);
|
String unloc = name == null ? null : String.format(base, name);
|
||||||
return StatCollector.translateToLocal(unloc);
|
return StatCollector.translateToLocal(unloc);
|
||||||
} else {
|
} else {
|
||||||
return Upgrade.values()[slotNumber - MIN_UPGRADE].getLocalizedName();
|
return Upgrade.VALUES[slotNumber - MIN_UPGRADE].getLocalizedName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package team.chisel.block.tileentity;
|
|||||||
|
|
||||||
import net.minecraft.tileentity.TileEntityBeacon;
|
import net.minecraft.tileentity.TileEntityBeacon;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package team.chisel.block.tileentity;
|
package team.chisel.block.tileentity;
|
||||||
|
|
||||||
import team.chisel.init.ChiselBlocks;
|
|
||||||
import team.chisel.network.PacketHandler;
|
|
||||||
import team.chisel.network.message.MessagePresentConnect;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
@@ -17,6 +14,10 @@ import net.minecraft.util.AxisAlignedBB;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import team.chisel.init.ChiselBlocks;
|
||||||
|
import team.chisel.network.PacketHandler;
|
||||||
|
import team.chisel.network.message.MessagePresentConnect;
|
||||||
|
|
||||||
public class TileEntityPresent extends TileEntity implements IInventory, IDoubleChest {
|
public class TileEntityPresent extends TileEntity implements IInventory, IDoubleChest {
|
||||||
|
|
||||||
private TileEntityPresent connection = null;
|
private TileEntityPresent connection = null;
|
||||||
@@ -45,7 +46,8 @@ public class TileEntityPresent extends TileEntity implements IInventory, IDouble
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean connectTo(TileEntityPresent present, ForgeDirection dir) {
|
private boolean connectTo(TileEntityPresent present, ForgeDirection dir) {
|
||||||
if (present.getBlockMetadata() == getBlockMetadata() && !present.isConnected() && (present.cachedDir == null || present.cachedDir == dir.getOpposite())
|
if (present.getBlockMetadata() == getBlockMetadata() && !present.isConnected()
|
||||||
|
&& (present.cachedDir == null || present.cachedDir == dir.getOpposite())
|
||||||
&& Math.abs(present.xCoord - xCoord + present.yCoord - yCoord + present.zCoord - zCoord) == 1) {
|
&& Math.abs(present.xCoord - xCoord + present.yCoord - yCoord + present.zCoord - zCoord) == 1) {
|
||||||
connection = present;
|
connection = present;
|
||||||
connection.connection = this;
|
connection.connection = this;
|
||||||
@@ -54,7 +56,8 @@ public class TileEntityPresent extends TileEntity implements IInventory, IDouble
|
|||||||
cachedDir = dir;
|
cachedDir = dir;
|
||||||
isParent = !present.isParent;
|
isParent = !present.isParent;
|
||||||
markDirty();
|
markDirty();
|
||||||
PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this, dir, true), worldObj.provider.dimensionId);
|
PacketHandler.INSTANCE
|
||||||
|
.sendToDimension(new MessagePresentConnect(this, dir, true), worldObj.provider.dimensionId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -70,8 +73,8 @@ public class TileEntityPresent extends TileEntity implements IInventory, IDouble
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param preserveDir
|
* @param preserveDir If true, this is only a virtual disconnect, meaning the other chest still exists, but is still
|
||||||
* If true, this is only a virtual disconnect, meaning the other chest still exists, but is still loaded, so maintain a cachedDir for reconnection upon chunk load.
|
* loaded, so maintain a cachedDir for reconnection upon chunk load.
|
||||||
*/
|
*/
|
||||||
public void disconnect(boolean preserveDir) {
|
public void disconnect(boolean preserveDir) {
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
@@ -83,7 +86,9 @@ public class TileEntityPresent extends TileEntity implements IInventory, IDouble
|
|||||||
this.connection.markDirty();
|
this.connection.markDirty();
|
||||||
this.connection = null;
|
this.connection = null;
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this, ForgeDirection.UNKNOWN, false, preserveDir), worldObj.provider.dimensionId);
|
PacketHandler.INSTANCE.sendToDimension(
|
||||||
|
new MessagePresentConnect(this, ForgeDirection.UNKNOWN, false, preserveDir),
|
||||||
|
worldObj.provider.dimensionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +196,8 @@ public class TileEntityPresent extends TileEntity implements IInventory, IDouble
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z) {
|
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y,
|
||||||
|
int z) {
|
||||||
// prevent losing TE data when in-world chiseling
|
// prevent losing TE data when in-world chiseling
|
||||||
return oldBlock != newBlock;
|
return oldBlock != newBlock;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
package team.chisel.carving;
|
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;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||||
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
||||||
@@ -8,10 +16,6 @@ import com.cricketcraft.chisel.api.carving.ICarvingRegistry;
|
|||||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||||
|
|
||||||
import team.chisel.Chisel;
|
import team.chisel.Chisel;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
|
|
||||||
public class Carving implements ICarvingRegistry {
|
public class Carving implements ICarvingRegistry {
|
||||||
|
|
||||||
@@ -48,8 +52,7 @@ public class Carving implements ICarvingRegistry {
|
|||||||
@Override
|
@Override
|
||||||
public List<ICarvingVariation> getGroupVariations(Block block, int metadata) {
|
public List<ICarvingVariation> getGroupVariations(Block block, int metadata) {
|
||||||
ICarvingGroup group = getGroup(block, metadata);
|
ICarvingGroup group = getGroup(block, metadata);
|
||||||
if (group == null)
|
if (group == null) return Collections.emptyList();
|
||||||
return Collections.emptyList();
|
|
||||||
|
|
||||||
return group.getVariations();
|
return group.getVariations();
|
||||||
}
|
}
|
||||||
@@ -57,8 +60,7 @@ public class Carving implements ICarvingRegistry {
|
|||||||
@Override
|
@Override
|
||||||
public String getOreName(Block block, int metadata) {
|
public String getOreName(Block block, int metadata) {
|
||||||
ICarvingGroup group = getGroup(block, metadata);
|
ICarvingGroup group = getGroup(block, metadata);
|
||||||
if (group == null)
|
if (group == null) return null;
|
||||||
return null;
|
|
||||||
|
|
||||||
return group.getOreName();
|
return group.getOreName();
|
||||||
}
|
}
|
||||||
@@ -81,8 +83,7 @@ public class Carving implements ICarvingRegistry {
|
|||||||
group = getGroup(Block.getBlockFromItem(chiseledItem.getItem()), chiseledItem.getItemDamage());
|
group = getGroup(Block.getBlockFromItem(chiseledItem.getItem()), chiseledItem.getItemDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (group == null)
|
if (group == null) return items;
|
||||||
return items;
|
|
||||||
|
|
||||||
HashSet<String> mapping = new HashSet<>();
|
HashSet<String> mapping = new HashSet<>();
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ public class GroupList implements Set<ICarvingGroup> {
|
|||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof ICarvingVariation) {
|
if (obj instanceof ICarvingVariation) {
|
||||||
ICarvingVariation v2 = (ICarvingVariation) obj;
|
ICarvingVariation v2 = (ICarvingVariation) obj;
|
||||||
return v.getBlock() == v2.getBlock() && (v.getBlockMeta() == v2.getBlockMeta() || v.getItemMeta() == v2.getItemMeta());
|
return v.getBlock() == v2.getBlock()
|
||||||
|
&& (v.getBlockMeta() == v2.getBlockMeta() || v.getItemMeta() == v2.getItemMeta());
|
||||||
} else if (obj instanceof VariationWrapper) {
|
} else if (obj instanceof VariationWrapper) {
|
||||||
return equals(((VariationWrapper) obj).v);
|
return equals(((VariationWrapper) obj).v);
|
||||||
}
|
}
|
||||||
@@ -38,7 +39,8 @@ public class GroupList implements Set<ICarvingGroup> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return v.getBlock().hashCode();
|
return v.getBlock()
|
||||||
|
.hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,17 +101,20 @@ public class GroupList implements Set<ICarvingGroup> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<ICarvingGroup> iterator() {
|
public Iterator<ICarvingGroup> iterator() {
|
||||||
return groups.values().iterator();
|
return groups.values()
|
||||||
|
.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] toArray() {
|
public Object[] toArray() {
|
||||||
return groups.values().toArray();
|
return groups.values()
|
||||||
|
.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T[] toArray(T[] arr) {
|
public <T> T[] toArray(T[] arr) {
|
||||||
return groups.values().toArray(arr);
|
return groups.values()
|
||||||
|
.toArray(arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -133,7 +138,9 @@ public class GroupList implements Set<ICarvingGroup> {
|
|||||||
if (o instanceof ICarvingGroup) {
|
if (o instanceof ICarvingGroup) {
|
||||||
List<VariationWrapper> toRemove = Lists.newArrayList();
|
List<VariationWrapper> toRemove = Lists.newArrayList();
|
||||||
for (VariationWrapper v : lookup.keySet()) {
|
for (VariationWrapper v : lookup.keySet()) {
|
||||||
if (lookup.get(v).getName().equals(((ICarvingGroup) o).getName())) {
|
if (lookup.get(v)
|
||||||
|
.getName()
|
||||||
|
.equals(((ICarvingGroup) o).getName())) {
|
||||||
toRemove.add(v);
|
toRemove.add(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,8 +234,11 @@ public class GroupList implements Set<ICarvingGroup> {
|
|||||||
}
|
}
|
||||||
List<VariationWrapper> toRemove = Lists.newArrayList();
|
List<VariationWrapper> toRemove = Lists.newArrayList();
|
||||||
for (VariationWrapper v : lookup.keySet()) {
|
for (VariationWrapper v : lookup.keySet()) {
|
||||||
if ((g == null || lookup.get(v).getName().equals(g.getName())) && v.equals(new VariationWrapper(new VariationKey(block, metadata)))) {
|
if ((g == null || lookup.get(v)
|
||||||
lookup.get(v).removeVariation(v.v);
|
.getName()
|
||||||
|
.equals(g.getName())) && v.equals(new VariationWrapper(new VariationKey(block, metadata)))) {
|
||||||
|
lookup.get(v)
|
||||||
|
.removeVariation(v.v);
|
||||||
toRemove.add(v);
|
toRemove.add(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import net.minecraft.client.particle.EntityDiggingFX;
|
|||||||
import net.minecraft.client.particle.EntityLavaFX;
|
import net.minecraft.client.particle.EntityLavaFX;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import team.chisel.block.BlockGrimstone;
|
import team.chisel.block.BlockGrimstone;
|
||||||
import team.chisel.block.BlockHolystone;
|
import team.chisel.block.BlockHolystone;
|
||||||
import team.chisel.block.BlockLavastone;
|
import team.chisel.block.BlockLavastone;
|
||||||
@@ -28,13 +29,19 @@ public class GeneralChiselClient {
|
|||||||
public static int tick = 0;
|
public static int tick = 0;
|
||||||
|
|
||||||
public static void spawnLavastoneFX(World world, BlockLavastone block, int x, int y, int z) {
|
public static void spawnLavastoneFX(World world, BlockLavastone block, int x, int y, int z) {
|
||||||
if (Configurations.particlesTickrate != 0 && tick++ % Configurations.particlesTickrate != 0 || Minecraft.getMinecraft().gameSettings.particleSetting != 0)
|
if (Configurations.particlesTickrate != 0 && tick++ % Configurations.particlesTickrate != 0
|
||||||
return;
|
|| Minecraft.getMinecraft().gameSettings.particleSetting != 0) return;
|
||||||
|
|
||||||
float f = 0.15F;
|
float f = 0.15F;
|
||||||
double x1 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX();
|
double x1 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F)
|
||||||
double y1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY();
|
+ f
|
||||||
double z1 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ();
|
+ block.getBlockBoundsMinX();
|
||||||
|
double y1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F)
|
||||||
|
+ f
|
||||||
|
+ block.getBlockBoundsMinY();
|
||||||
|
double z1 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F)
|
||||||
|
+ f
|
||||||
|
+ block.getBlockBoundsMinZ();
|
||||||
|
|
||||||
switch (rand.nextInt(6)) {
|
switch (rand.nextInt(6)) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -63,8 +70,8 @@ public class GeneralChiselClient {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getBlock(x, y, z).isOpaqueCube())
|
if (world.getBlock(x, y, z)
|
||||||
return;
|
.isOpaqueCube()) return;
|
||||||
|
|
||||||
EntityLavaFX res = new EntityLavaFX(world, x1, y1, z1);
|
EntityLavaFX res = new EntityLavaFX(world, x1, y1, z1);
|
||||||
double multiplier = 0.45;
|
double multiplier = 0.45;
|
||||||
@@ -76,13 +83,19 @@ public class GeneralChiselClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void spawnHolystoneFX(World world, BlockHolystone block, int x, int y, int z) {
|
public static void spawnHolystoneFX(World world, BlockHolystone block, int x, int y, int z) {
|
||||||
if (Configurations.particlesTickrate != 0 && tick++ % Configurations.particlesTickrate != 0 || Minecraft.getMinecraft().gameSettings.particleSetting != 0)
|
if (Configurations.particlesTickrate != 0 && tick++ % Configurations.particlesTickrate != 0
|
||||||
return;
|
|| Minecraft.getMinecraft().gameSettings.particleSetting != 0) return;
|
||||||
|
|
||||||
float f = 0.15F;
|
float f = 0.15F;
|
||||||
double x1 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX();
|
double x1 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F)
|
||||||
double y1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY();
|
+ f
|
||||||
double z1 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ();
|
+ block.getBlockBoundsMinX();
|
||||||
|
double y1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F)
|
||||||
|
+ f
|
||||||
|
+ block.getBlockBoundsMinY();
|
||||||
|
double z1 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F)
|
||||||
|
+ f
|
||||||
|
+ block.getBlockBoundsMinZ();
|
||||||
|
|
||||||
switch (rand.nextInt(6)) {
|
switch (rand.nextInt(6)) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -111,21 +124,26 @@ public class GeneralChiselClient {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getBlock(x, y, z).isOpaqueCube())
|
if (world.getBlock(x, y, z)
|
||||||
return;
|
.isOpaqueCube()) return;
|
||||||
|
|
||||||
EntityHolystoneFX res = new EntityHolystoneFX(world, block, x1, y1, z1);
|
EntityHolystoneFX res = new EntityHolystoneFX(world, block, x1, y1, z1);
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void spawnGrimstoneFX(World world, BlockGrimstone block, int x, int y, int z) {
|
public static void spawnGrimstoneFX(World world, BlockGrimstone block, int x, int y, int z) {
|
||||||
if (Configurations.particlesTickrate != 0 && tick++ % Configurations.particlesTickrate != 0)
|
if (Configurations.particlesTickrate != 0 && tick++ % Configurations.particlesTickrate != 0) return;
|
||||||
return;
|
|
||||||
|
|
||||||
float f = 0.15F;
|
float f = 0.15F;
|
||||||
double x1 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX();
|
double x1 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F)
|
||||||
double y1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY();
|
+ f
|
||||||
double z1 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ();
|
+ block.getBlockBoundsMinX();
|
||||||
|
double y1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F)
|
||||||
|
+ f
|
||||||
|
+ block.getBlockBoundsMinY();
|
||||||
|
double z1 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F)
|
||||||
|
+ f
|
||||||
|
+ block.getBlockBoundsMinZ();
|
||||||
|
|
||||||
switch (rand.nextInt(6)) {
|
switch (rand.nextInt(6)) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -154,22 +172,24 @@ public class GeneralChiselClient {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getBlock(x, y, z).isOpaqueCube())
|
if (world.getBlock(x, y, z)
|
||||||
return;
|
.isOpaqueCube()) return;
|
||||||
|
|
||||||
EntityGrimstoneFX res = new EntityGrimstoneFX(world, block, x1, y1, z1);
|
EntityGrimstoneFX res = new EntityGrimstoneFX(world, block, x1, y1, z1);
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void spawnSnakestoneObsidianFX(World world, BlockSnakestoneObsidian block, int x, int y, int z) {
|
public static void spawnSnakestoneObsidianFX(World world, BlockSnakestoneObsidian block, int x, int y, int z) {
|
||||||
if (Configurations.particlesTickrate != 0 || tick++ % Configurations.particlesTickrate != 0 || Minecraft.getMinecraft().gameSettings.particleSetting != 0) {
|
if (Configurations.particlesTickrate != 0 || tick++ % Configurations.particlesTickrate != 0
|
||||||
|
|| Minecraft.getMinecraft().gameSettings.particleSetting != 0) {
|
||||||
EntitySnakestoneObsidianFX res = new EntitySnakestoneObsidianFX(world, block, x, y, z);
|
EntitySnakestoneObsidianFX res = new EntitySnakestoneObsidianFX(world, block, x, y, z);
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void spawnBallOMossFX(World world, double x, double y, double z) {
|
public static void spawnBallOMossFX(World world, double x, double y, double z) {
|
||||||
if (Configurations.particlesTickrate == 0 || tick++ % Configurations.particlesTickrate == 0 || Minecraft.getMinecraft().gameSettings.particleSetting != 0) {
|
if (Configurations.particlesTickrate == 0 || tick++ % Configurations.particlesTickrate == 0
|
||||||
|
|| Minecraft.getMinecraft().gameSettings.particleSetting != 0) {
|
||||||
EntityBallOMossFX res = new EntityBallOMossFX(world, x, y, z);
|
EntityBallOMossFX res = new EntityBallOMossFX(world, x, y, z);
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||||
}
|
}
|
||||||
@@ -177,15 +197,20 @@ public class GeneralChiselClient {
|
|||||||
|
|
||||||
public static EntityDiggingFX addBlockHitEffects(World world, int x, int y, int z, int side) {
|
public static EntityDiggingFX addBlockHitEffects(World world, int x, int y, int z, int side) {
|
||||||
Block block = world.getBlock(x, y, z);
|
Block block = world.getBlock(x, y, z);
|
||||||
if (block.isAir(world, x, y, z) || Minecraft.getMinecraft().gameSettings.particleSetting != 0)
|
if (block.isAir(world, x, y, z) || Minecraft.getMinecraft().gameSettings.particleSetting != 0) return null;
|
||||||
return null;
|
|
||||||
|
|
||||||
EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer;
|
EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer;
|
||||||
|
|
||||||
float f = 0.1F;
|
float f = 0.1F;
|
||||||
double d0 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX();
|
double d0 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F)
|
||||||
double d1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY();
|
+ f
|
||||||
double d2 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ();
|
+ block.getBlockBoundsMinX();
|
||||||
|
double d1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F)
|
||||||
|
+ f
|
||||||
|
+ block.getBlockBoundsMinY();
|
||||||
|
double d2 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F)
|
||||||
|
+ f
|
||||||
|
+ block.getBlockBoundsMinZ();
|
||||||
|
|
||||||
switch (side) {
|
switch (side) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -208,7 +233,17 @@ public class GeneralChiselClient {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityDiggingFX res = new EntityDiggingFX(world, d0, d1, d2, 0.0D, 0.0D, 0.0D, block, world.getBlockMetadata(x, y, z), side);
|
EntityDiggingFX res = new EntityDiggingFX(
|
||||||
|
world,
|
||||||
|
d0,
|
||||||
|
d1,
|
||||||
|
d2,
|
||||||
|
0.0D,
|
||||||
|
0.0D,
|
||||||
|
0.0D,
|
||||||
|
block,
|
||||||
|
world.getBlockMetadata(x, y, z),
|
||||||
|
side);
|
||||||
res.motionX = d0 - (x + 0.5);
|
res.motionX = d0 - (x + 0.5);
|
||||||
res.motionY = d1 - (y + 0.5);
|
res.motionY = d1 - (y + 0.5);
|
||||||
res.motionZ = d2 - (z + 0.5);
|
res.motionZ = d2 - (z + 0.5);
|
||||||
@@ -223,8 +258,7 @@ public class GeneralChiselClient {
|
|||||||
for (int side = 0; side < 6; side++) {
|
for (int side = 0; side < 6; side++) {
|
||||||
for (int j = 0; j < 16; j++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
EntityDiggingFX fx = addBlockHitEffects(Minecraft.getMinecraft().theWorld, x, y, z, side);
|
EntityDiggingFX fx = addBlockHitEffects(Minecraft.getMinecraft().theWorld, x, y, z, side);
|
||||||
if (fx == null)
|
if (fx == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
fx.multipleParticleScaleBy(0.25f + 0.5f * rand.nextFloat());
|
fx.multipleParticleScaleBy(0.25f + 0.5f * rand.nextFloat());
|
||||||
fx.multiplyVelocity(0.3f * rand.nextFloat());
|
fx.multiplyVelocity(0.3f * rand.nextFloat());
|
||||||
@@ -237,9 +271,20 @@ public class GeneralChiselClient {
|
|||||||
public static void spawnAutoChiselFX(TileEntityAutoChisel te, ItemStack base) {
|
public static void spawnAutoChiselFX(TileEntityAutoChisel te, ItemStack base) {
|
||||||
if (base != null && Minecraft.getMinecraft().gameSettings.particleSetting == 0) {
|
if (base != null && Minecraft.getMinecraft().gameSettings.particleSetting == 0) {
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
EntityDiggingFX particle = new EntityDiggingFX(te.getWorldObj(), te.xCoord + 0.5, te.yCoord + 0.95, te.zCoord + 0.5, 0, 0, 0, Block.getBlockFromItem(base.getItem()),
|
EntityDiggingFX particle = new EntityDiggingFX(
|
||||||
|
te.getWorldObj(),
|
||||||
|
te.xCoord + 0.5,
|
||||||
|
te.yCoord + 0.95,
|
||||||
|
te.zCoord + 0.5,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Block.getBlockFromItem(base.getItem()),
|
||||||
base.getItemDamage());
|
base.getItemDamage());
|
||||||
particle.setVelocity((te.getWorldObj().rand.nextDouble() / 4) - 0.125, te.getWorldObj().rand.nextDouble() / 8, (te.getWorldObj().rand.nextDouble() / 4) - 0.125);
|
particle.setVelocity(
|
||||||
|
(te.getWorldObj().rand.nextDouble() / 4) - 0.125,
|
||||||
|
te.getWorldObj().rand.nextDouble() / 8,
|
||||||
|
(te.getWorldObj().rand.nextDouble() / 4) - 0.125);
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
|
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
|
||||||
}
|
}
|
||||||
String sound = Carving.chisel.getVariationSound(base.getItem(), base.getItemDamage());
|
String sound = Carving.chisel.getVariationSound(base.getItem(), base.getItemDamage());
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import team.chisel.block.tileentity.TileEntityAutoChisel;
|
|
||||||
import team.chisel.inventory.ContainerAutoChisel;
|
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import team.chisel.block.tileentity.TileEntityAutoChisel;
|
||||||
|
import team.chisel.inventory.ContainerAutoChisel;
|
||||||
|
|
||||||
public class GuiAutoChisel extends GuiContainer {
|
public class GuiAutoChisel extends GuiContainer {
|
||||||
|
|
||||||
private static final ResourceLocation gui = new ResourceLocation("chisel:textures/autochisel-gui.png");
|
private static final ResourceLocation gui = new ResourceLocation("chisel:textures/autochisel-gui.png");
|
||||||
@@ -54,7 +54,9 @@ public class GuiAutoChisel extends GuiContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean mouseInside(Slot slot, int x, int y) {
|
private boolean mouseInside(Slot slot, int x, int y) {
|
||||||
return x >= slot.xDisplayPosition && x <= slot.xDisplayPosition + 16 && y >= slot.yDisplayPosition && y <= slot.yDisplayPosition + 16;
|
return x >= slot.xDisplayPosition && x <= slot.xDisplayPosition + 16
|
||||||
|
&& y >= slot.yDisplayPosition
|
||||||
|
&& y <= slot.yDisplayPosition + 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -78,6 +80,12 @@ public class GuiAutoChisel extends GuiContainer {
|
|||||||
|
|
||||||
public static void drawSlotOverlay(GuiContainer gui, int x, int y, Slot slot, int u, int v, int padding) {
|
public static void drawSlotOverlay(GuiContainer gui, int x, int y, Slot slot, int u, int v, int padding) {
|
||||||
padding /= 2;
|
padding /= 2;
|
||||||
gui.drawTexturedModalRect(x + (slot.xDisplayPosition - padding), y + (slot.yDisplayPosition - padding), u, v, 18 + padding, 18 + padding);
|
gui.drawTexturedModalRect(
|
||||||
|
x + (slot.xDisplayPosition - padding),
|
||||||
|
y + (slot.yDisplayPosition - padding),
|
||||||
|
u,
|
||||||
|
v,
|
||||||
|
18 + padding,
|
||||||
|
18 + padding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
package team.chisel.client.gui;
|
package team.chisel.client.gui;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.IAdvancedChisel;
|
import static team.chisel.Chisel.MOD_ID;
|
||||||
import com.cricketcraft.chisel.api.IChiselItem;
|
|
||||||
import com.cricketcraft.chisel.api.carving.IChiselMode;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
@@ -13,8 +10,16 @@ import net.minecraft.entity.player.InventoryPlayer;
|
|||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.cricketcraft.chisel.api.IAdvancedChisel;
|
||||||
|
import com.cricketcraft.chisel.api.IChiselItem;
|
||||||
|
import com.cricketcraft.chisel.api.carving.IChiselMode;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import team.chisel.client.gui.widgets.GuiButtonChiselMode;
|
import team.chisel.client.gui.widgets.GuiButtonChiselMode;
|
||||||
import team.chisel.inventory.ContainerChisel;
|
import team.chisel.inventory.ContainerChisel;
|
||||||
import team.chisel.inventory.InventoryChiselSelection;
|
import team.chisel.inventory.InventoryChiselSelection;
|
||||||
@@ -24,12 +29,12 @@ import team.chisel.network.PacketHandler;
|
|||||||
import team.chisel.network.message.MessageChiselMode;
|
import team.chisel.network.message.MessageChiselMode;
|
||||||
import team.chisel.utils.General;
|
import team.chisel.utils.General;
|
||||||
|
|
||||||
import static team.chisel.Chisel.MOD_ID;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiChisel extends GuiContainer {
|
public class GuiChisel extends GuiContainer {
|
||||||
|
|
||||||
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(MOD_ID, "textures/chisel2GuiScroll.png");
|
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(
|
||||||
|
MOD_ID,
|
||||||
|
"textures/chisel2GuiScroll.png");
|
||||||
public static final int TEXTURE_WIDTH = 266;
|
public static final int TEXTURE_WIDTH = 266;
|
||||||
public static final int TEXTURE_HEIGHT = 250;
|
public static final int TEXTURE_HEIGHT = 250;
|
||||||
public static final int GUI_WIDTH = 266;
|
public static final int GUI_WIDTH = 266;
|
||||||
@@ -84,8 +89,7 @@ public class GuiChisel extends GuiContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean showMode() {
|
private boolean showMode() {
|
||||||
return container.chisel != null
|
return container.chisel != null && container.chisel.getItem() instanceof IChiselItem
|
||||||
&& container.chisel.getItem() instanceof IChiselItem
|
|
||||||
&& ((IChiselItem) container.chisel.getItem()).hasModes(container.chisel);
|
&& ((IChiselItem) container.chisel.getItem()).hasModes(container.chisel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,11 +98,16 @@ public class GuiChisel extends GuiContainer {
|
|||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
final String titleText = I18n.format(container.inventory.getInventoryName() + ".title");
|
final String titleText = I18n.format(container.inventory.getInventoryName() + ".title");
|
||||||
fontRendererObj.drawSplitString(titleText, 50 - fontRendererObj.getStringWidth(titleText) / 2, 60, 40, 0x404040);
|
fontRendererObj
|
||||||
|
.drawSplitString(titleText, 50 - fontRendererObj.getStringWidth(titleText) / 2, 60, 40, 0x404040);
|
||||||
|
|
||||||
if (showMode()) {
|
if (showMode()) {
|
||||||
final String modeText = I18n.format(container.inventory.getInventoryName() + ".mode");
|
final String modeText = I18n.format(container.inventory.getInventoryName() + ".mode");
|
||||||
fontRendererObj.drawString(modeText, 12 + (GuiButtonChiselMode.BUTTON_WIDTH - fontRendererObj.getStringWidth(modeText)) / 2, 122, 0x404040);
|
fontRendererObj.drawString(
|
||||||
|
modeText,
|
||||||
|
12 + (GuiButtonChiselMode.BUTTON_WIDTH - fontRendererObj.getStringWidth(modeText)) / 2,
|
||||||
|
122,
|
||||||
|
0x404040);
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollBar.draw(this);
|
scrollBar.draw(this);
|
||||||
@@ -109,13 +118,22 @@ public class GuiChisel extends GuiContainer {
|
|||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
|
||||||
mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
|
mc.getTextureManager()
|
||||||
|
.bindTexture(TEXTURE_RESOURCE_LOCATION);
|
||||||
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
||||||
func_146110_a(guiLeft, guiTop, 0, 0, xSize, ySize, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
func_146110_a(guiLeft, guiTop, 0, 0, xSize, ySize, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
||||||
|
|
||||||
Slot main = (Slot) container.inventorySlots.get(InventoryChiselSelection.normalSlots);
|
Slot main = (Slot) container.inventorySlots.get(InventoryChiselSelection.normalSlots);
|
||||||
if (main.getStack() == null) {
|
if (main.getStack() == null) {
|
||||||
func_146110_a(guiLeft + 8, guiTop + 8, 0, GUI_HEIGHT, CHISEL_INPUT_SIZE, CHISEL_INPUT_SIZE, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
func_146110_a(
|
||||||
|
guiLeft + 8,
|
||||||
|
guiTop + 8,
|
||||||
|
0,
|
||||||
|
GUI_HEIGHT,
|
||||||
|
CHISEL_INPUT_SIZE,
|
||||||
|
CHISEL_INPUT_SIZE,
|
||||||
|
TEXTURE_WIDTH,
|
||||||
|
TEXTURE_HEIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,24 @@
|
|||||||
package team.chisel.client.gui;
|
package team.chisel.client.gui;
|
||||||
|
|
||||||
import team.chisel.Chisel;
|
|
||||||
import team.chisel.config.Configurations;
|
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraftforge.common.config.ConfigCategory;
|
import net.minecraftforge.common.config.ConfigCategory;
|
||||||
import net.minecraftforge.common.config.ConfigElement;
|
import net.minecraftforge.common.config.ConfigElement;
|
||||||
import net.minecraftforge.common.config.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
|
|
||||||
import cpw.mods.fml.client.config.GuiConfig;
|
import cpw.mods.fml.client.config.GuiConfig;
|
||||||
|
import team.chisel.Chisel;
|
||||||
|
import team.chisel.config.Configurations;
|
||||||
|
|
||||||
public class GuiChiselConfig extends GuiConfig {
|
public class GuiChiselConfig extends GuiConfig {
|
||||||
|
|
||||||
public GuiChiselConfig(GuiScreen parent) {
|
public GuiChiselConfig(GuiScreen parent) {
|
||||||
super(parent, new ConfigElement<ConfigCategory>(Configurations.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), Chisel.MOD_ID, false, false, GuiConfig
|
super(
|
||||||
.getAbridgedConfigPath(Configurations.config.toString()));
|
parent,
|
||||||
|
new ConfigElement<ConfigCategory>(Configurations.config.getCategory(Configuration.CATEGORY_GENERAL))
|
||||||
|
.getChildElements(),
|
||||||
|
Chisel.MOD_ID,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
GuiConfig.getAbridgedConfigPath(Configurations.config.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
import cpw.mods.fml.client.IModGuiFactory;
|
import cpw.mods.fml.client.IModGuiFactory;
|
||||||
|
|
||||||
public class GuiFactory implements IModGuiFactory {
|
public class GuiFactory implements IModGuiFactory {
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ public class GuiPresent extends GuiContainer {
|
|||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
this.mc.getTextureManager().bindTexture(gui);
|
this.mc.getTextureManager()
|
||||||
|
.bindTexture(gui);
|
||||||
int x = (this.width - this.xSize) / 2;
|
int x = (this.width - this.xSize) / 2;
|
||||||
int y = (this.height - this.ySize) / 2;
|
int y = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.rows * 18 + 17);
|
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.rows * 18 + 17);
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
package team.chisel.client.gui;
|
package team.chisel.client.gui;
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import team.chisel.inventory.ContainerChisel;
|
import team.chisel.inventory.ContainerChisel;
|
||||||
import team.chisel.network.PacketHandler;
|
import team.chisel.network.PacketHandler;
|
||||||
import team.chisel.network.message.MessageScrollUpdate;
|
import team.chisel.network.message.MessageScrollUpdate;
|
||||||
|
|
||||||
public class GuiScrollbar {
|
public class GuiScrollbar {
|
||||||
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation("minecraft", "textures/gui/container/creative_inventory/tabs.png");
|
|
||||||
|
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(
|
||||||
|
"minecraft",
|
||||||
|
"textures/gui/container/creative_inventory/tabs.png");
|
||||||
|
|
||||||
private int displayX = 0;
|
private int displayX = 0;
|
||||||
private int displayY = 0;
|
private int displayY = 0;
|
||||||
@@ -21,8 +26,10 @@ public class GuiScrollbar {
|
|||||||
private ContainerChisel container;
|
private ContainerChisel container;
|
||||||
|
|
||||||
public void draw(GuiChisel g) {
|
public void draw(GuiChisel g) {
|
||||||
// chisel2GuiScroll scroll button texture coordinates work strange (maybe because of alignment) so taking vanilla one
|
// chisel2GuiScroll scroll button texture coordinates work strange (maybe because of alignment) so taking
|
||||||
g.mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
|
// vanilla one
|
||||||
|
g.mc.getTextureManager()
|
||||||
|
.bindTexture(TEXTURE_RESOURCE_LOCATION);
|
||||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
if (getMaxScroll() == 0) {
|
if (getMaxScroll() == 0) {
|
||||||
|
|||||||
@@ -1,17 +1,22 @@
|
|||||||
package team.chisel.client.gui.widgets;
|
package team.chisel.client.gui.widgets;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
import team.chisel.client.gui.GuiChisel;
|
import team.chisel.client.gui.GuiChisel;
|
||||||
import team.chisel.item.chisel.ChiselMode;
|
import team.chisel.item.chisel.ChiselMode;
|
||||||
|
|
||||||
import static team.chisel.client.gui.GuiChisel.*;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiButtonChiselMode extends GuiButton {
|
public class GuiButtonChiselMode extends GuiButton {
|
||||||
|
|
||||||
public static final int BUTTON_WIDTH = 48;
|
public static final int BUTTON_WIDTH = 48;
|
||||||
public static final int BUTTON_HEIGHT = 48;
|
public static final int BUTTON_HEIGHT = 48;
|
||||||
private static final float BUTTON_BACKGROUND_U = 48;
|
private static final float BUTTON_BACKGROUND_U = 48;
|
||||||
@@ -39,10 +44,13 @@ public class GuiButtonChiselMode extends GuiButton {
|
|||||||
@Override
|
@Override
|
||||||
public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) {
|
public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) {
|
||||||
if (this.visible) {
|
if (this.visible) {
|
||||||
mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
|
mc.getTextureManager()
|
||||||
|
.bindTexture(TEXTURE_RESOURCE_LOCATION);
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
// Mouse Hover State
|
// Mouse Hover State
|
||||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
|
||||||
|
&& mouseX < this.xPosition + this.width
|
||||||
|
&& mouseY < this.yPosition + this.height;
|
||||||
drawButtonBackgroundLayer();
|
drawButtonBackgroundLayer();
|
||||||
drawButtonForegroundLayer();
|
drawButtonForegroundLayer();
|
||||||
}
|
}
|
||||||
@@ -51,7 +59,15 @@ public class GuiButtonChiselMode extends GuiButton {
|
|||||||
private void drawButtonBackgroundLayer() {
|
private void drawButtonBackgroundLayer() {
|
||||||
final float u = BUTTON_BACKGROUND_U + (this.field_146123_n ? BUTTON_WIDTH : 0);
|
final float u = BUTTON_BACKGROUND_U + (this.field_146123_n ? BUTTON_WIDTH : 0);
|
||||||
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
||||||
func_146110_a(this.xPosition, this.yPosition, u, BUTTON_BACKGROUND_V, this.width, this.height, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
func_146110_a(
|
||||||
|
this.xPosition,
|
||||||
|
this.yPosition,
|
||||||
|
u,
|
||||||
|
BUTTON_BACKGROUND_V,
|
||||||
|
this.width,
|
||||||
|
this.height,
|
||||||
|
TEXTURE_WIDTH,
|
||||||
|
TEXTURE_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawButtonForegroundLayer() {
|
private void drawButtonForegroundLayer() {
|
||||||
|
|||||||
@@ -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.instance().colourAttrib);
|
||||||
|
state.pipeline.addDependency(CCRenderState.instance().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;
|
||||||
|
}
|
||||||
@@ -11,19 +11,28 @@ public class RenderBlocksEldritch extends RenderBlocks {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
static double displacementMap[] = { +0.1165, -0.0352, -0.1208, +0.0906, -0.0295, +0.0302, -0.0973, +0.0548, -0.1077, +0.0662, -0.0932, -0.0925, -0.1161, +0.0073, -0.1084, +0.1136, +0.0307,
|
static double displacementMap[] = { +0.1165, -0.0352, -0.1208, +0.0906, -0.0295, +0.0302, -0.0973, +0.0548, -0.1077,
|
||||||
+0.0316, -0.1066, -0.0237, +0.0614, -0.0864, +0.0837, +0.1218, +0.0502, -0.0529, -0.0942, +0.1209, -0.0418, +0.1035, +0.0066, -0.0255, +0.0830, -0.0361, +0.0965, +0.0646, +0.1124,
|
+0.0662, -0.0932, -0.0925, -0.1161, +0.0073, -0.1084, +0.1136, +0.0307, +0.0316, -0.1066, -0.0237, +0.0614,
|
||||||
+0.0890, -0.0037, +0.0467, +0.1025, +0.1161, +0.0014, +0.0365, +0.0755, -0.0025, +0.0739, +0.0656, +0.0571, -0.0813, -0.0062, -0.0904, -0.0005, +0.0612, -0.0227, +0.0138, -0.0899,
|
-0.0864, +0.0837, +0.1218, +0.0502, -0.0529, -0.0942, +0.1209, -0.0418, +0.1035, +0.0066, -0.0255, +0.0830,
|
||||||
-0.0019, -0.1047, +0.1191, -0.1197, -0.1123, +0.0999, +0.0638, +0.0865, +0.0029, -0.0084, +0.1132, -0.0433, +0.0115, +0.0850, +0.0439, +0.0748, +0.0460, -0.0441, +0.0839, +0.0162,
|
-0.0361, +0.0965, +0.0646, +0.1124, +0.0890, -0.0037, +0.0467, +0.1025, +0.1161, +0.0014, +0.0365, +0.0755,
|
||||||
-0.0229, +0.0774, -0.0647, -0.0636, -0.0709, -0.0719, -0.0194, +0.1070, -0.0466, -0.1200, -0.0996, -0.0298, -0.1035, -0.0006, +0.0530, -0.0939, -0.1210, +0.0176, +0.0924, +0.0343,
|
-0.0025, +0.0739, +0.0656, +0.0571, -0.0813, -0.0062, -0.0904, -0.0005, +0.0612, -0.0227, +0.0138, -0.0899,
|
||||||
-0.0777, +0.1050, -0.0729, -0.0062, -0.1107, -0.0434, -0.0042, +0.0232, +0.0269, +0.0709, -0.0388, +0.0342, +0.0240, -0.0192, +0.0491, +0.0017, -0.1240, +0.0687, -0.1160, +0.1123,
|
-0.0019, -0.1047, +0.1191, -0.1197, -0.1123, +0.0999, +0.0638, +0.0865, +0.0029, -0.0084, +0.1132, -0.0433,
|
||||||
-0.0332, -0.0260, +0.0476, -0.0049, -0.0893, -0.0243, -0.0371, -0.0230, +0.0656, +0.1080, +0.0781, -0.0648, +0.0082, -0.1086, -0.0451, -0.0594, -0.1155, -0.0623, -0.0152, +0.0131,
|
+0.0115, +0.0850, +0.0439, +0.0748, +0.0460, -0.0441, +0.0839, +0.0162, -0.0229, +0.0774, -0.0647, -0.0636,
|
||||||
-0.0754, +0.0607, +0.0876, -0.0657, +0.0366, -0.0981, +0.1164, -0.0623, +0.0181, -0.0475, +0.0722, -0.0293, +0.0486, -0.0195, +0.1041, +0.1011, +0.0042, -0.0045, -0.1031, +0.0110,
|
-0.0709, -0.0719, -0.0194, +0.1070, -0.0466, -0.1200, -0.0996, -0.0298, -0.1035, -0.0006, +0.0530, -0.0939,
|
||||||
+0.0058, +0.0083, -0.0782, -0.1003, -0.0082, -0.0304, -0.0971, -0.0097, -0.0208, -0.1059, -0.0239, -0.0385, +0.0505, +0.0537, -0.1098, -0.0022, -0.0165, -0.0027, -0.0208, +0.0305,
|
-0.1210, +0.0176, +0.0924, +0.0343, -0.0777, +0.1050, -0.0729, -0.0062, -0.1107, -0.0434, -0.0042, +0.0232,
|
||||||
+0.0592, +0.0301, +0.0055, +0.1138, -0.0338, -0.0901, +0.1015, +0.0061, +0.0861, -0.1057, -0.0889, -0.0972, +0.0783, -0.1052, -0.0932, -0.1103, +0.0497, +0.1222, -0.0146, +0.0632,
|
+0.0269, +0.0709, -0.0388, +0.0342, +0.0240, -0.0192, +0.0491, +0.0017, -0.1240, +0.0687, -0.1160, +0.1123,
|
||||||
-0.0240, -0.0193, +0.0676, -0.1128, -0.0886, +0.0926, +0.0538, -0.0175, -0.0966, -0.0369, +0.1124, -0.0820, -0.1013, -0.0836, -0.0981, -0.0502, +0.0573, +0.0616, -0.0458, +0.0294,
|
-0.0332, -0.0260, +0.0476, -0.0049, -0.0893, -0.0243, -0.0371, -0.0230, +0.0656, +0.1080, +0.0781, -0.0648,
|
||||||
+0.0108, -0.0782, +0.0692, +0.0234, -0.0178, -0.0171, -0.0505, -0.0313, +0.0538, +0.0462, -0.0758, +0.0556, -0.0023, -0.1086, -0.0100, -0.0897, -0.0409, -0.1161, +0.0212, +0.1229,
|
+0.0082, -0.1086, -0.0451, -0.0594, -0.1155, -0.0623, -0.0152, +0.0131, -0.0754, +0.0607, +0.0876, -0.0657,
|
||||||
-0.0945, +0.0341, +0.1238, +0.0893, -0.1189, -0.1098, -0.0125, +0.1137, -0.0202, +0.0239, -0.0408, +0.0920, +0.0777, -0.0085, -0.0572, -0.0293, -0.0131, +0.0272, +0.0991, };
|
+0.0366, -0.0981, +0.1164, -0.0623, +0.0181, -0.0475, +0.0722, -0.0293, +0.0486, -0.0195, +0.1041, +0.1011,
|
||||||
|
+0.0042, -0.0045, -0.1031, +0.0110, +0.0058, +0.0083, -0.0782, -0.1003, -0.0082, -0.0304, -0.0971, -0.0097,
|
||||||
|
-0.0208, -0.1059, -0.0239, -0.0385, +0.0505, +0.0537, -0.1098, -0.0022, -0.0165, -0.0027, -0.0208, +0.0305,
|
||||||
|
+0.0592, +0.0301, +0.0055, +0.1138, -0.0338, -0.0901, +0.1015, +0.0061, +0.0861, -0.1057, -0.0889, -0.0972,
|
||||||
|
+0.0783, -0.1052, -0.0932, -0.1103, +0.0497, +0.1222, -0.0146, +0.0632, -0.0240, -0.0193, +0.0676, -0.1128,
|
||||||
|
-0.0886, +0.0926, +0.0538, -0.0175, -0.0966, -0.0369, +0.1124, -0.0820, -0.1013, -0.0836, -0.0981, -0.0502,
|
||||||
|
+0.0573, +0.0616, -0.0458, +0.0294, +0.0108, -0.0782, +0.0692, +0.0234, -0.0178, -0.0171, -0.0505, -0.0313,
|
||||||
|
+0.0538, +0.0462, -0.0758, +0.0556, -0.0023, -0.1086, -0.0100, -0.0897, -0.0409, -0.1161, +0.0212, +0.1229,
|
||||||
|
-0.0945, +0.0341, +0.1238, +0.0893, -0.1189, -0.1098, -0.0125, +0.1137, -0.0202, +0.0239, -0.0408, +0.0920,
|
||||||
|
+0.0777, -0.0085, -0.0572, -0.0293, -0.0131, +0.0272, +0.0991, };
|
||||||
|
|
||||||
static int dmap1 = displacementMap.length * 1 / 6;
|
static int dmap1 = displacementMap.length * 1 / 6;
|
||||||
static int dmap2 = displacementMap.length * 2 / 6;
|
static int dmap2 = displacementMap.length * 2 / 6;
|
||||||
@@ -46,8 +55,7 @@ public class RenderBlocksEldritch extends RenderBlocks {
|
|||||||
@Override
|
@Override
|
||||||
public boolean renderStandardBlock(Block block, int x, int y, int z) {
|
public boolean renderStandardBlock(Block block, int x, int y, int z) {
|
||||||
int index = x + y * 34573 + z * 32465781;
|
int index = x + y * 34573 + z * 32465781;
|
||||||
if (index < 0)
|
if (index < 0) index = -index;
|
||||||
index = -index;
|
|
||||||
|
|
||||||
X[0] = x;
|
X[0] = x;
|
||||||
Z[0] = z;
|
Z[0] = z;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package team.chisel.client.render;
|
package team.chisel.client.render;
|
||||||
|
|
||||||
|
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
|
||||||
|
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.model.ModelSnowMan;
|
import net.minecraft.client.model.ModelSnowMan;
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
@@ -15,8 +18,6 @@ import net.minecraftforge.client.MinecraftForgeClient;
|
|||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import team.chisel.entity.EntityChiselSnowman;
|
import team.chisel.entity.EntityChiselSnowman;
|
||||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
|
|
||||||
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
|
|
||||||
|
|
||||||
public class RenderChiselSnowman extends RenderLiving {
|
public class RenderChiselSnowman extends RenderLiving {
|
||||||
|
|
||||||
@@ -52,9 +53,12 @@ public class RenderChiselSnowman extends RenderLiving {
|
|||||||
this.snowMan.head.postRender(0.0625F);
|
this.snowMan.head.postRender(0.0625F);
|
||||||
|
|
||||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemStack, EQUIPPED);
|
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemStack, EQUIPPED);
|
||||||
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemStack, BLOCK_3D));
|
boolean is3D = (customRenderer != null
|
||||||
|
&& customRenderer.shouldUseRenderHelper(EQUIPPED, itemStack, BLOCK_3D));
|
||||||
|
|
||||||
if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemStack.getItem()).getRenderType())) {
|
if (is3D || RenderBlocks.renderItemIn3d(
|
||||||
|
Block.getBlockFromItem(itemStack.getItem())
|
||||||
|
.getRenderType())) {
|
||||||
float f1 = 0.625F;
|
float f1 = 0.625F;
|
||||||
GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
|
GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
|
||||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
|||||||
Loaded 100 of 3557 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user